Skip to content

Commit

Permalink
start a more formal directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismiller committed Oct 16, 2024
1 parent fecd572 commit b3a994c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 146 deletions.
137 changes: 9 additions & 128 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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__/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

<img src="examples/ophistory_all.svg" />
<img src="docs/ophistory_all.svg" />

## ophistory

Expand Down Expand Up @@ -41,7 +41,7 @@ A: D(y)
A: E(z)
</code></pre>
</td>
<td><img src="examples/linearizability_1.2.a.svg" /></td>
<td><img src="docs/linearizability_1.2.a.svg" /></td>
</tr>
<td>
<pre><code>
Expand All @@ -52,7 +52,7 @@ B: END a
A: END a
</code></pre>
</td>
<td><img src="examples/linearizability_1.2.b.svg" /></td>
<td><img src="docs/linearizability_1.2.b.svg" /></td>
</tr>
<td>
<pre><code>
Expand All @@ -61,7 +61,7 @@ B: D(x)
A: END a
</code></pre>
</td>
<td><img src="examples/linearizability_1.2.c.svg" /></td>
<td><img src="docs/linearizability_1.2.c.svg" /></td>
</tr>
<td>
<pre><code>
Expand All @@ -75,7 +75,7 @@ A: END a
C: END a
</code></pre>
</td>
<td><img src="examples/linearizability_1.2.d.svg" /></td>
<td><img src="docs/linearizability_1.2.d.svg" /></td>
</tr>
</tbody>
</table>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
26 changes: 13 additions & 13 deletions ophistory.py → src/ophistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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
Expand Down

0 comments on commit b3a994c

Please sign in to comment.