cfinterface 1.7.1__tar.gz → 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cfinterface-1.8.0/.github/workflows/docs.yml +33 -0
- cfinterface-1.8.0/.github/workflows/main.yml +46 -0
- cfinterface-1.8.0/.github/workflows/publish.yml +39 -0
- cfinterface-1.8.0/.gitignore +134 -0
- cfinterface-1.7.1/LICENSE.md → cfinterface-1.8.0/LICENSE +1 -1
- {cfinterface-1.7.1 → cfinterface-1.8.0}/PKG-INFO +49 -15
- {cfinterface-1.7.1 → cfinterface-1.8.0}/README.md +6 -4
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/__init__.py +1 -1
- cfinterface-1.8.0/cfinterface/components/__init__.py +8 -0
- cfinterface-1.8.0/cfinterface/files/__init__.py +3 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/files/blockfile.py +18 -4
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/files/registerfile.py +21 -5
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/files/sectionfile.py +19 -5
- cfinterface-1.8.0/docs/source/conf.py +127 -0
- cfinterface-1.8.0/docs/source/getting_started/contributing.rst +50 -0
- cfinterface-1.8.0/docs/source/getting_started/tutorial.rst +657 -0
- cfinterface-1.8.0/docs/source/index.rst +38 -0
- cfinterface-1.8.0/docs/source/install/install.rst +28 -0
- cfinterface-1.8.0/docs/source/reference/blocks/files/block.rst +21 -0
- cfinterface-1.8.0/docs/source/reference/blocks/files/blockdata.rst +10 -0
- cfinterface-1.8.0/docs/source/reference/blocks/files/blockfile.rst +9 -0
- cfinterface-1.8.0/docs/source/reference/blocks/index.rst +11 -0
- cfinterface-1.8.0/docs/source/reference/fields/components/datetimefield.rst +12 -0
- cfinterface-1.8.0/docs/source/reference/fields/components/field.rst +11 -0
- cfinterface-1.8.0/docs/source/reference/fields/components/floatfield.rst +12 -0
- cfinterface-1.8.0/docs/source/reference/fields/components/integerfield.rst +12 -0
- cfinterface-1.8.0/docs/source/reference/fields/components/literalfield.rst +12 -0
- cfinterface-1.8.0/docs/source/reference/fields/index.rst +15 -0
- cfinterface-1.8.0/docs/source/reference/line/index.rst +12 -0
- cfinterface-1.8.0/docs/source/reference/registers/files/register.rst +21 -0
- cfinterface-1.8.0/docs/source/reference/registers/files/registerdata.rst +10 -0
- cfinterface-1.8.0/docs/source/reference/registers/files/registerfile.rst +9 -0
- cfinterface-1.8.0/docs/source/reference/registers/index.rst +11 -0
- cfinterface-1.8.0/docs/source/reference/sections/files/section.rst +21 -0
- cfinterface-1.8.0/docs/source/reference/sections/files/sectiondata.rst +10 -0
- cfinterface-1.8.0/docs/source/reference/sections/files/sectionfile.rst +9 -0
- cfinterface-1.8.0/docs/source/reference/sections/index.rst +11 -0
- cfinterface-1.8.0/examples/README.rst +8 -0
- cfinterface-1.8.0/pyproject.toml +55 -0
- cfinterface-1.7.1/cfinterface.egg-info/PKG-INFO +0 -63
- cfinterface-1.7.1/cfinterface.egg-info/SOURCES.txt +0 -92
- cfinterface-1.7.1/cfinterface.egg-info/dependency_links.txt +0 -1
- cfinterface-1.7.1/cfinterface.egg-info/requires.txt +0 -2
- cfinterface-1.7.1/cfinterface.egg-info/top_level.txt +0 -3
- cfinterface-1.7.1/setup.cfg +0 -4
- cfinterface-1.7.1/setup.py +0 -32
- cfinterface-1.7.1/tests/reading/__init__.py +0 -0
- cfinterface-1.7.1/tests/writing/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/_utils/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/components/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/components/line/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/components/line/repository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/components/repository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/reading/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/reading/repository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/writing/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/adapters/writing/repository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/block.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/datetimefield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/defaultblock.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/defaultregister.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/defaultsection.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/field.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/floatfield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/integerfield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/line.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/literalfield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/register.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/components/section.py +0 -0
- {cfinterface-1.7.1/cfinterface/components → cfinterface-1.8.0/cfinterface/data}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/data/blockdata.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/data/registerdata.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/data/sectiondata.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/py.typed +0 -0
- {cfinterface-1.7.1/cfinterface/data → cfinterface-1.8.0/cfinterface/reading}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/reading/blockreading.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/reading/registerreading.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/reading/sectionreading.py +0 -0
- {cfinterface-1.7.1/cfinterface/files → cfinterface-1.8.0/cfinterface/writing}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/writing/blockwriting.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/writing/registerwriting.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/cfinterface/writing/sectionwriting.py +0 -0
- {cfinterface-1.7.1/cfinterface/reading → cfinterface-1.8.0/examples}/__init__.py +0 -0
- {cfinterface-1.7.1/cfinterface/writing → cfinterface-1.8.0/tests}/__init__.py +0 -0
- {cfinterface-1.7.1/examples → cfinterface-1.8.0/tests/adapters}/__init__.py +0 -0
- {cfinterface-1.7.1/tests → cfinterface-1.8.0/tests/adapters/components}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/adapters/components/test_blockrepository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/adapters/components/test_linerepository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/adapters/components/test_registerrepository.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/adapters/components/test_sectionrepository.py +0 -0
- {cfinterface-1.7.1/tests/adapters → cfinterface-1.8.0/tests/adapters/reading}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/adapters/reading/test_readingrepository.py +0 -0
- {cfinterface-1.7.1/tests/adapters/components → cfinterface-1.8.0/tests/adapters/writing}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/adapters/writing/test_writingrepository.py +0 -0
- {cfinterface-1.7.1/tests/adapters/reading → cfinterface-1.8.0/tests/components}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_block.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_datetimefield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_defaultblock.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_defaultregister.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_defaultsection.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_field.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_floatfield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_integerfield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_line.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_literalfield.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_register.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/components/test_section.py +0 -0
- {cfinterface-1.7.1/tests/adapters/writing → cfinterface-1.8.0/tests/data}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/data/test_blockdata.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/data/test_registerdata.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/data/test_sectiondata.py +0 -0
- {cfinterface-1.7.1/tests/components → cfinterface-1.8.0/tests/files}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/files/test_blockfile.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/files/test_registerfile.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/files/test_sectionfile.py +0 -0
- {cfinterface-1.7.1/tests/data → cfinterface-1.8.0/tests/mocks}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/mocks/mock_open.py +0 -0
- {cfinterface-1.7.1/tests/files → cfinterface-1.8.0/tests/reading}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/reading/test_blockreading.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/reading/test_registerreading.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/reading/test_sectionreading.py +0 -0
- {cfinterface-1.7.1/tests/mocks → cfinterface-1.8.0/tests/writing}/__init__.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/writing/test_blockwriting.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/writing/test_registerwriting.py +0 -0
- {cfinterface-1.7.1 → cfinterface-1.8.0}/tests/writing/test_sectionwriting.py +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
docs:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v3
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
run: uv python install
|
|
17
|
+
- name: Install the project
|
|
18
|
+
run: |
|
|
19
|
+
uv sync --all-extras --dev
|
|
20
|
+
- name: Runs tests
|
|
21
|
+
run: |
|
|
22
|
+
uv run pytest ./tests
|
|
23
|
+
- name: Sphinx build
|
|
24
|
+
run: |
|
|
25
|
+
uv run sphinx-build -M html docs/source docs/build
|
|
26
|
+
- name: Deploy
|
|
27
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
28
|
+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
29
|
+
with:
|
|
30
|
+
publish_branch: gh-pages
|
|
31
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
+
publish_dir: docs/build/html
|
|
33
|
+
force_orphan: true
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v3
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
run: uv python install ${{ matrix.python-version }}
|
|
23
|
+
- name: Install the project
|
|
24
|
+
run: |
|
|
25
|
+
uv sync --all-extras --dev
|
|
26
|
+
- name: Runs tests
|
|
27
|
+
run: |
|
|
28
|
+
uv run pytest --cov-report=xml --cov=cfinterface ./tests
|
|
29
|
+
- uses: codecov/codecov-action@v4
|
|
30
|
+
with:
|
|
31
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
32
|
+
files: ./coverage.xml
|
|
33
|
+
flags: unittests
|
|
34
|
+
env_vars: OS,PYTHON
|
|
35
|
+
name: codecov-cfinterface
|
|
36
|
+
fail_ci_if_error: true
|
|
37
|
+
verbose: true
|
|
38
|
+
- name: Static type check
|
|
39
|
+
run: |
|
|
40
|
+
uv run mypy ./cfinterface
|
|
41
|
+
- name: Linter code check
|
|
42
|
+
run: |
|
|
43
|
+
uv run ruff check ./cfinterface
|
|
44
|
+
- name: Sphinx build
|
|
45
|
+
run: |
|
|
46
|
+
uv run sphinx-build -M html docs/source docs/build
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: deploy
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build-and-publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment:
|
|
11
|
+
name: pypi
|
|
12
|
+
url: https://pypi.org/p/cfinterface/
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v3
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
run: uv python install
|
|
21
|
+
- name: Install the project
|
|
22
|
+
run: |
|
|
23
|
+
uv sync --all-extras --dev
|
|
24
|
+
- name: Runs tests
|
|
25
|
+
run: |
|
|
26
|
+
uv run pytest ./tests
|
|
27
|
+
- name: Static typing check
|
|
28
|
+
run: |
|
|
29
|
+
uv run mypy ./cfinterface
|
|
30
|
+
- name: PEP8 check
|
|
31
|
+
run: |
|
|
32
|
+
uv run ruff check ./cfinterface
|
|
33
|
+
- name: Builds package
|
|
34
|
+
if: startsWith(github.ref, 'refs/tags')
|
|
35
|
+
run: |
|
|
36
|
+
uv build
|
|
37
|
+
- name: PyPI publish
|
|
38
|
+
if: startsWith(github.ref, 'refs/tags')
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
.vscode/
|
|
132
|
+
|
|
133
|
+
# Build system
|
|
134
|
+
uv.lock
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,19 +1,51 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: cfinterface
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Interface for handling custom formatted files
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: rogerioalves.ee@gmail.com
|
|
8
|
-
|
|
5
|
+
Project-URL: Documentation, https://rjmalves.github.io/cfinterface/
|
|
6
|
+
Project-URL: Repository, https://github.com/rjmalves/cfinterface/
|
|
7
|
+
Author-email: Rogerio Alves <rogerioalves.ee@gmail.com>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2022 Rogerio Alves
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
Classifier: Development Status :: 4 - Beta
|
|
30
|
+
Classifier: Intended Audience :: Developers
|
|
9
31
|
Classifier: License :: OSI Approved :: MIT License
|
|
10
32
|
Classifier: Operating System :: OS Independent
|
|
11
|
-
Classifier:
|
|
12
|
-
Requires-Python: >=3.
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
34
|
+
Requires-Python: >=3.10
|
|
35
|
+
Requires-Dist: numpy>=2.0.0
|
|
36
|
+
Requires-Dist: pandas>=2.2.3
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
39
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
40
|
+
Requires-Dist: numpydoc; extra == 'dev'
|
|
41
|
+
Requires-Dist: plotly; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
44
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
45
|
+
Requires-Dist: sphinx; extra == 'dev'
|
|
46
|
+
Requires-Dist: sphinx-gallery; extra == 'dev'
|
|
47
|
+
Requires-Dist: sphinx-rtd-theme; extra == 'dev'
|
|
13
48
|
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE.md
|
|
15
|
-
Requires-Dist: numpy
|
|
16
|
-
Requires-Dist: pandas
|
|
17
49
|
|
|
18
50
|
# cfinterface
|
|
19
51
|
|
|
@@ -27,6 +59,7 @@ Python package that contains a framework for dealing with custom file formats, m
|
|
|
27
59
|
`cfinterface` is a framework for designing low-level interfaces that depends on complex text or binary file parsing. It provides components for modeling lines, registers, blocks and sections in a declarative way and aggregate these blocks as components for defining files.
|
|
28
60
|
|
|
29
61
|
Suppose that a complex text file needs to be parsed and the contents of lines with a specific identifier must be extracted and validated. For instance, the line follows the format:
|
|
62
|
+
|
|
30
63
|
```
|
|
31
64
|
DATA_HIGH ID001 sudo.user 10/20/2025 901.25
|
|
32
65
|
```
|
|
@@ -34,7 +67,7 @@ DATA_HIGH ID001 sudo.user 10/20/2025 901.25
|
|
|
34
67
|
If `DATA_HIGH` is the identifier that specifies the lines to be read, than one can model it with the `Register` class in the `cfinterface` framework.
|
|
35
68
|
|
|
36
69
|
```python
|
|
37
|
-
class
|
|
70
|
+
class DataHigh(Register):
|
|
38
71
|
IDENTIFIER = "DATA_HIGH"
|
|
39
72
|
IDENTIFIER_DIGITS = 9
|
|
40
73
|
LINE = Line(
|
|
@@ -49,15 +82,16 @@ class DATA_HIGH(Register):
|
|
|
49
82
|
|
|
50
83
|
A `Register` depends on the definition of a `Line` object, that is composed of `Field` objects. By modeling these elements on a declarative way, the user gains access to reading / writing functions on the fly, and the `Register` may be added to a `RegisterFile` object, so that it can be read / written together with many other registers to files.
|
|
51
84
|
|
|
52
|
-
Despite the `Register` model, files can also be composed of `Blocks` and `Sections`, and their interfaces can be done to `text` or `binary` formats. For more information, the docs are available [here](https://rjmalves.github.io/
|
|
85
|
+
Despite the `Register` model, files can also be composed of `Blocks` and `Sections`, and their interfaces can be done to `text` or `binary` formats. For more information, the docs are available [here](https://rjmalves.github.io/cfinterface).
|
|
53
86
|
|
|
54
87
|
## Install
|
|
55
88
|
|
|
56
|
-
`cfinterface` requires python >= 3.
|
|
89
|
+
`cfinterface` requires python >= 3.10. It this requirement is met, than one may install the framework with
|
|
90
|
+
|
|
57
91
|
```
|
|
58
92
|
python -m pip install cfinterface
|
|
59
93
|
```
|
|
60
94
|
|
|
61
95
|
## Documentation
|
|
62
96
|
|
|
63
|
-
Guides, tutorials and references may be found at the package's official site: https://rjmalves.github.io/
|
|
97
|
+
Guides, tutorials and references may be found at the package's official site: https://rjmalves.github.io/cfinterface
|
|
@@ -10,6 +10,7 @@ Python package that contains a framework for dealing with custom file formats, m
|
|
|
10
10
|
`cfinterface` is a framework for designing low-level interfaces that depends on complex text or binary file parsing. It provides components for modeling lines, registers, blocks and sections in a declarative way and aggregate these blocks as components for defining files.
|
|
11
11
|
|
|
12
12
|
Suppose that a complex text file needs to be parsed and the contents of lines with a specific identifier must be extracted and validated. For instance, the line follows the format:
|
|
13
|
+
|
|
13
14
|
```
|
|
14
15
|
DATA_HIGH ID001 sudo.user 10/20/2025 901.25
|
|
15
16
|
```
|
|
@@ -17,7 +18,7 @@ DATA_HIGH ID001 sudo.user 10/20/2025 901.25
|
|
|
17
18
|
If `DATA_HIGH` is the identifier that specifies the lines to be read, than one can model it with the `Register` class in the `cfinterface` framework.
|
|
18
19
|
|
|
19
20
|
```python
|
|
20
|
-
class
|
|
21
|
+
class DataHigh(Register):
|
|
21
22
|
IDENTIFIER = "DATA_HIGH"
|
|
22
23
|
IDENTIFIER_DIGITS = 9
|
|
23
24
|
LINE = Line(
|
|
@@ -32,15 +33,16 @@ class DATA_HIGH(Register):
|
|
|
32
33
|
|
|
33
34
|
A `Register` depends on the definition of a `Line` object, that is composed of `Field` objects. By modeling these elements on a declarative way, the user gains access to reading / writing functions on the fly, and the `Register` may be added to a `RegisterFile` object, so that it can be read / written together with many other registers to files.
|
|
34
35
|
|
|
35
|
-
Despite the `Register` model, files can also be composed of `Blocks` and `Sections`, and their interfaces can be done to `text` or `binary` formats. For more information, the docs are available [here](https://rjmalves.github.io/
|
|
36
|
+
Despite the `Register` model, files can also be composed of `Blocks` and `Sections`, and their interfaces can be done to `text` or `binary` formats. For more information, the docs are available [here](https://rjmalves.github.io/cfinterface).
|
|
36
37
|
|
|
37
38
|
## Install
|
|
38
39
|
|
|
39
|
-
`cfinterface` requires python >= 3.
|
|
40
|
+
`cfinterface` requires python >= 3.10. It this requirement is met, than one may install the framework with
|
|
41
|
+
|
|
40
42
|
```
|
|
41
43
|
python -m pip install cfinterface
|
|
42
44
|
```
|
|
43
45
|
|
|
44
46
|
## Documentation
|
|
45
47
|
|
|
46
|
-
Guides, tutorials and references may be found at the package's official site: https://rjmalves.github.io/
|
|
48
|
+
Guides, tutorials and references may be found at the package's official site: https://rjmalves.github.io/cfinterface
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from .datetimefield import DatetimeField # noqa
|
|
2
|
+
from .literalfield import LiteralField # noqa
|
|
3
|
+
from .integerfield import IntegerField # noqa
|
|
4
|
+
from .floatfield import FloatField # noqa
|
|
5
|
+
from .line import Line # noqa
|
|
6
|
+
from .block import Block # noqa
|
|
7
|
+
from .section import Section # noqa
|
|
8
|
+
from .register import Register # noqa
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import IO, Dict, List, Optional, Type, Union
|
|
2
2
|
|
|
3
3
|
from cfinterface.components.block import Block
|
|
4
4
|
from cfinterface.components.defaultblock import DefaultBlock
|
|
@@ -17,7 +17,7 @@ class BlockFile:
|
|
|
17
17
|
|
|
18
18
|
VERSIONS: Dict[str, List[Type[Block]]] = {}
|
|
19
19
|
BLOCKS: List[Type[Block]] = []
|
|
20
|
-
ENCODING = "utf-8"
|
|
20
|
+
ENCODING: Union[str, List[str]] = ["utf-8", "latin-1", "ascii"]
|
|
21
21
|
STORAGE = "TEXT"
|
|
22
22
|
__VERSION = "latest"
|
|
23
23
|
|
|
@@ -27,7 +27,11 @@ class BlockFile:
|
|
|
27
27
|
) -> None:
|
|
28
28
|
self.__data = data
|
|
29
29
|
self.__storage = self.__class__.STORAGE
|
|
30
|
-
self.__encoding =
|
|
30
|
+
self.__encoding = (
|
|
31
|
+
self.__class__.ENCODING
|
|
32
|
+
if type(self.__class__.ENCODING) is str
|
|
33
|
+
else self.__class__.ENCODING[0]
|
|
34
|
+
)
|
|
31
35
|
|
|
32
36
|
def __eq__(self, o: object) -> bool:
|
|
33
37
|
if not isinstance(o, BlockFile):
|
|
@@ -44,7 +48,17 @@ class BlockFile:
|
|
|
44
48
|
:type content: str | bytes
|
|
45
49
|
"""
|
|
46
50
|
reader = BlockReading(cls.BLOCKS, cls.STORAGE)
|
|
47
|
-
|
|
51
|
+
if type(cls.ENCODING) is str:
|
|
52
|
+
return cls(reader.read(content, cls.ENCODING, *args, **kwargs))
|
|
53
|
+
else:
|
|
54
|
+
for encoding in cls.ENCODING:
|
|
55
|
+
try:
|
|
56
|
+
return cls(reader.read(content, encoding, *args, **kwargs))
|
|
57
|
+
except UnicodeDecodeError:
|
|
58
|
+
pass
|
|
59
|
+
raise EncodingWarning(
|
|
60
|
+
"Failed to decode content with all specified encodings."
|
|
61
|
+
)
|
|
48
62
|
|
|
49
63
|
def write(self, to: Union[str, IO], *args, **kwargs):
|
|
50
64
|
"""
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import IO, Dict, List, Optional, Type, Union
|
|
2
|
+
|
|
2
3
|
import pandas as pd # type: ignore
|
|
3
|
-
|
|
4
|
+
|
|
4
5
|
from cfinterface.components.defaultregister import DefaultRegister
|
|
6
|
+
from cfinterface.components.register import Register
|
|
5
7
|
from cfinterface.data.registerdata import RegisterData
|
|
6
8
|
from cfinterface.reading.registerreading import RegisterReading
|
|
7
9
|
from cfinterface.writing.registerwriting import RegisterWriting
|
|
@@ -17,7 +19,7 @@ class RegisterFile:
|
|
|
17
19
|
|
|
18
20
|
VERSIONS: Dict[str, List[Type[Register]]] = {}
|
|
19
21
|
REGISTERS: List[Type[Register]] = []
|
|
20
|
-
ENCODING = "utf-8"
|
|
22
|
+
ENCODING: Union[str, List[str]] = ["utf-8", "latin-1", "ascii"]
|
|
21
23
|
STORAGE = "TEXT"
|
|
22
24
|
__VERSION = "latest"
|
|
23
25
|
|
|
@@ -27,7 +29,11 @@ class RegisterFile:
|
|
|
27
29
|
) -> None:
|
|
28
30
|
self.__data = data
|
|
29
31
|
self.__storage = self.__class__.STORAGE
|
|
30
|
-
self.__encoding =
|
|
32
|
+
self.__encoding = (
|
|
33
|
+
self.__class__.ENCODING
|
|
34
|
+
if type(self.__class__.ENCODING) is str
|
|
35
|
+
else self.__class__.ENCODING[0]
|
|
36
|
+
)
|
|
31
37
|
|
|
32
38
|
def __eq__(self, o: object) -> bool:
|
|
33
39
|
if not isinstance(o, RegisterFile):
|
|
@@ -63,7 +69,17 @@ class RegisterFile:
|
|
|
63
69
|
:type content: str | bytes
|
|
64
70
|
"""
|
|
65
71
|
reader = RegisterReading(cls.REGISTERS, cls.STORAGE, *args, **kwargs)
|
|
66
|
-
|
|
72
|
+
if type(cls.ENCODING) is str:
|
|
73
|
+
return cls(reader.read(content, cls.ENCODING, *args, **kwargs))
|
|
74
|
+
else:
|
|
75
|
+
for encoding in cls.ENCODING:
|
|
76
|
+
try:
|
|
77
|
+
return cls(reader.read(content, encoding, *args, **kwargs))
|
|
78
|
+
except UnicodeDecodeError:
|
|
79
|
+
pass
|
|
80
|
+
raise EncodingWarning(
|
|
81
|
+
"Failed to decode content with all specified encodings."
|
|
82
|
+
)
|
|
67
83
|
|
|
68
84
|
def write(self, to: Union[str, IO], *args, **kwargs):
|
|
69
85
|
"""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import IO, Dict, List, Optional, Type, Union
|
|
2
2
|
|
|
3
|
-
from cfinterface.components.section import Section
|
|
4
3
|
from cfinterface.components.defaultsection import DefaultSection
|
|
4
|
+
from cfinterface.components.section import Section
|
|
5
5
|
from cfinterface.data.sectiondata import SectionData
|
|
6
6
|
from cfinterface.reading.sectionreading import SectionReading
|
|
7
7
|
from cfinterface.writing.sectionwriting import SectionWriting
|
|
@@ -17,7 +17,7 @@ class SectionFile:
|
|
|
17
17
|
|
|
18
18
|
VERSIONS: Dict[str, List[Type[Section]]] = {}
|
|
19
19
|
SECTIONS: List[Type[Section]] = []
|
|
20
|
-
ENCODING = "utf-8"
|
|
20
|
+
ENCODING: Union[str, List[str]] = ["utf-8", "latin-1", "ascii"]
|
|
21
21
|
STORAGE = "TEXT"
|
|
22
22
|
__VERSION = "latest"
|
|
23
23
|
|
|
@@ -27,7 +27,11 @@ class SectionFile:
|
|
|
27
27
|
) -> None:
|
|
28
28
|
self.__data = data
|
|
29
29
|
self.__storage = self.__class__.STORAGE
|
|
30
|
-
self.__encoding =
|
|
30
|
+
self.__encoding = (
|
|
31
|
+
self.__class__.ENCODING
|
|
32
|
+
if type(self.__class__.ENCODING) is str
|
|
33
|
+
else self.__class__.ENCODING[0]
|
|
34
|
+
)
|
|
31
35
|
|
|
32
36
|
def __eq__(self, o: object) -> bool:
|
|
33
37
|
if not isinstance(o, SectionFile):
|
|
@@ -44,7 +48,17 @@ class SectionFile:
|
|
|
44
48
|
:type content: str | bytes
|
|
45
49
|
"""
|
|
46
50
|
reader = SectionReading(cls.SECTIONS, cls.STORAGE)
|
|
47
|
-
|
|
51
|
+
if type(cls.ENCODING) is str:
|
|
52
|
+
return cls(reader.read(content, cls.ENCODING, *args, **kwargs))
|
|
53
|
+
else:
|
|
54
|
+
for encoding in cls.ENCODING:
|
|
55
|
+
try:
|
|
56
|
+
return cls(reader.read(content, encoding, *args, **kwargs))
|
|
57
|
+
except UnicodeDecodeError:
|
|
58
|
+
pass
|
|
59
|
+
raise EncodingWarning(
|
|
60
|
+
"Failed to decode content with all specified encodings."
|
|
61
|
+
)
|
|
48
62
|
|
|
49
63
|
def write(self, to: Union[str, IO], *args, **kwargs):
|
|
50
64
|
"""
|