diff --git a/.gitignore b/.gitignore index b6e4761..487b123 100644 --- a/.gitignore +++ b/.gitignore @@ -1,129 +1,10 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy .mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ +/.coverage +/.coverage.* +/.nox/ +/.python-version +/.pytype/ +/dist/ +/docs/_build/ +/src/*.egg-info/ +__pycache__/ diff --git a/README.md b/README.md index 6377694..cdcaf4b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Diagrams as text tools for databases and distributed systems [_ophistory_](#ophistory) lets you write a simple text file of operations starting and ending in order, and renders them like so:[^1] - + ## ophistory @@ -41,7 +41,7 @@ A: D(y) A: E(z) - +

@@ -52,7 +52,7 @@ B: END a
 A: END a
 
- +

@@ -61,7 +61,7 @@ B: D(x)
 A: END a
 
- +

@@ -75,7 +75,7 @@ A: END a
 C: END a
 
- + diff --git a/examples/linearizability_1.2.a.svg b/docs/linearizability_1.2.a.svg similarity index 100% rename from examples/linearizability_1.2.a.svg rename to docs/linearizability_1.2.a.svg diff --git a/examples/linearizability_1.2.b.svg b/docs/linearizability_1.2.b.svg similarity index 100% rename from examples/linearizability_1.2.b.svg rename to docs/linearizability_1.2.b.svg diff --git a/examples/linearizability_1.2.c.svg b/docs/linearizability_1.2.c.svg similarity index 100% rename from examples/linearizability_1.2.c.svg rename to docs/linearizability_1.2.c.svg diff --git a/examples/linearizability_1.2.d.svg b/docs/linearizability_1.2.d.svg similarity index 100% rename from examples/linearizability_1.2.d.svg rename to docs/linearizability_1.2.d.svg diff --git a/examples/ophistory_all.svg b/docs/ophistory_all.svg similarity index 100% rename from examples/ophistory_all.svg rename to docs/ophistory_all.svg diff --git a/examples/ophistory_all.txt b/docs/ophistory_all.txt similarity index 100% rename from examples/ophistory_all.txt rename to docs/ophistory_all.txt diff --git a/ophistory.py b/src/ophistory.py similarity index 100% rename from ophistory.py rename to src/ophistory.py index c59fcd4..a4d35a2 100755 --- a/ophistory.py +++ b/src/ophistory.py @@ -75,19 +75,6 @@ def parse_operations(text : str) -> list[Operation]: #### Data Model -@dataclasses.dataclass -class Span(object): - actor : str - start : int - end : int - height : int - text : tuple[Optional[str], Optional[str]] - eventpoint : Optional[int] - x1 : Optional[UnitsCh] = None - x2 : Optional[UnitsCh] = None - event_x : Optional[UnitsCh] = None - y : Optional[UnitsPx] = None - class TokenBucket(object): def __init__(self): self._tokens = [] @@ -108,6 +95,19 @@ def release(self, token : int) -> None: def max_token(self) -> int: return self._max_token +@dataclasses.dataclass +class Span(object): + actor : str + start : int + end : int + height : int + text : tuple[Optional[str], Optional[str]] + eventpoint : Optional[int] + x1 : Optional[UnitsCh] = None + x2 : Optional[UnitsCh] = None + event_x : Optional[UnitsCh] = None + y : Optional[UnitsPx] = None + @dataclasses.dataclass class SpanStart(object): op : str