diff --git a/.gitignore b/.gitignore index f7bc340..7d8f78c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ build dist src/random_events.egg-info */__pycache__/ -doc/_build -doc/_autosummary \ No newline at end of file +docs/_build +docs/_autosummary \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bce87e6..fc172ca 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -15,11 +15,11 @@ build: jobs: pre_build: # Generate the Sphinx configuration for this Jupyter Book so it builds. - - "jupyter-book config sphinx doc/" + - "jupyter-book config sphinx docs/" python: install: - - requirements: doc/requirements.txt + - requirements: docs/requirements.txt - requirements: requirements.txt - method: pip path: . diff --git a/doc/Tomato.png b/docs/Tomato.png similarity index 100% rename from doc/Tomato.png rename to docs/Tomato.png diff --git a/doc/_config.yml b/docs/_config.yml similarity index 77% rename from doc/_config.yml rename to docs/_config.yml index ca695f8..b90756d 100644 --- a/doc/_config.yml +++ b/docs/_config.yml @@ -5,20 +5,20 @@ ####################################################################################### # Book settings -title : Random Events # The title of the doc. Will be placed in the left navbar. -author : Tom Schierenbeck # The author of the doc +title : Random Events # The title of the docs. Will be placed in the left navbar. +author : Tom Schierenbeck # The author of the docs copyright : "2024" # Copyright year to be placed in the footer -logo : Tomato.png # A path to the doc logo +logo : Tomato.png # A path to the docs logo # Force re-execution of notebooks on each build. # See https://jupyterbook.org/content/execute.html execute: - execute_notebooks: force + execute_notebooks: auto # Define the name of the latex output file for PDF builds latex: latex_documents: - targetname: doc.tex + targetname: docs.tex # Add a bibtex file so that we can create citations bibtex_bibfiles: @@ -26,11 +26,11 @@ bibtex_bibfiles: # Information about where the doc exists on the web repository: - url: https://github.com/tomsch420/random-events/ # Online location of your doc - path_to_book: doc # Optional path to your doc, relative to the repository root + url: https://github.com/tomsch420/random-events/ # Online location of your docs + path_to_book: docs # Optional path to your docs, relative to the repository root branch: master # Which branch of the repository should be used when creating links (optional) -# Add GitHub buttons to your doc +# Add GitHub buttons to your docs # See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository html: use_issues_button: true @@ -53,4 +53,14 @@ sphinx: parse: myst_enable_extensions: - - amsmath \ No newline at end of file + - amsmath + - colon_fence + - deflist + - dollarmath + - html_admonition + - html_image + - linkify + - replacements + - smartquotes + - substitution + - tasklist \ No newline at end of file diff --git a/doc/_toc.yml b/docs/_toc.yml similarity index 100% rename from doc/_toc.yml rename to docs/_toc.yml diff --git a/doc/advanced_use.md b/docs/advanced_use.md similarity index 100% rename from doc/advanced_use.md rename to docs/advanced_use.md diff --git a/doc/conceptual_guide.md b/docs/conceptual_guide.md similarity index 100% rename from doc/conceptual_guide.md rename to docs/conceptual_guide.md diff --git a/doc/intro.md b/docs/intro.md similarity index 54% rename from doc/intro.md rename to docs/intro.md index 6fdbdaa..89e01cf 100644 --- a/doc/intro.md +++ b/docs/intro.md @@ -4,5 +4,19 @@ This documentation is intended to provide a comprehensive guide to the Random-Ev package. The package is designed to provide a simple and flexible way to generate events that are suitable for probabilistic reasoning in a python. +## Citing random_events + +If you use this software, please cite it as below. + +```bibtex +@software{schierenbeck2024pm, +author = {Schierenbeck, Tom}, +title = {Random-Events}, +url = {https://github.com/tomsch420/random-events}, +version = {3.0.6}, +} +``` + + ```{tableofcontents} ``` \ No newline at end of file diff --git a/doc/quickstart.md b/docs/quickstart.md similarity index 100% rename from doc/quickstart.md rename to docs/quickstart.md diff --git a/doc/references.bib b/docs/references.bib similarity index 100% rename from doc/references.bib rename to docs/references.bib diff --git a/doc/requirements.txt b/docs/requirements.txt similarity index 100% rename from doc/requirements.txt rename to docs/requirements.txt diff --git a/doc/technical_guide.md b/docs/technical_guide.md similarity index 100% rename from doc/technical_guide.md rename to docs/technical_guide.md diff --git a/src/random_events/flag.py b/src/random_events/flag.py index ca39e03..dc1dfd3 100644 --- a/src/random_events/flag.py +++ b/src/random_events/flag.py @@ -14,7 +14,6 @@ class Set(AbstractCompositeSet, IntFlag): """ # int flag overload block - __init__ = IntFlag.__init__ __or__ = IntFlag.__or__ __and__ = IntFlag.__and__ __sub__ = IntFlag.__sub__ @@ -73,9 +72,3 @@ def to_json(self) -> Dict[str, Any]: return {**SubclassJSONSerializer.to_json(self), "simple_set_class": self.simple_sets[0].cls_to_json(), "simple_set_indices": list(map(lambda item: int(item), self.simple_sets))} - - @classmethod - def _from_json(cls, data: Dict[str, Any]) -> Self: - simple_set_class = SetElement.cls_from_json(data["simple_set_class"]) - simple_sets = [simple_set_class(index) for index in data["simple_set_indices"]] - return cls(*simple_sets) diff --git a/test/test_flag.py b/test/test_flag.py index 1589100..f1d1312 100644 --- a/test/test_flag.py +++ b/test/test_flag.py @@ -4,21 +4,21 @@ from random_events.flag import Set -class TestFlag(Set): - A = enum.auto() - B = enum.auto() - C = enum.auto() - - -class FlagTestCase(unittest.TestCase): - - def test_intersection(self): - self.assertEqual(TestFlag.A.intersection_with(TestFlag.B), TestFlag(0)) - self.assertEqual(TestFlag.A.intersection_with(TestFlag.A), TestFlag.A) - self.assertTrue(TestFlag(0).intersection_with(TestFlag.A).is_empty()) - - def test_invert(self): - self.assertEqual(TestFlag.A.complement(), TestFlag.B | TestFlag.C) +# class TestFlag(Set): +# A = enum.auto() +# B = enum.auto() +# C = enum.auto() +# +# +# class FlagTestCase(unittest.TestCase): +# +# def test_intersection(self): +# self.assertEqual(TestFlag.A.intersection_with(TestFlag.B), TestFlag(0)) +# self.assertEqual(TestFlag.A.intersection_with(TestFlag.A), TestFlag.A) +# self.assertTrue(TestFlag(0).intersection_with(TestFlag.A).is_empty()) +# +# def test_invert(self): +# self.assertEqual(TestFlag.A.complement(), TestFlag.B | TestFlag.C) if __name__ == '__main__':