pax_global_header00006660000000000000000000000064146566270260014530gustar00rootroot0000000000000052 comment=28748cae740caedfb4fa6cb688b8e816bb50c9bc timmo001-system-bridge-models-28748ca/000077500000000000000000000000001465662702600174755ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/.codecov.yml000066400000000000000000000002651465662702600217230ustar00rootroot00000000000000codecov: branch: master coverage: status: project: default: target: 90 threshold: "0.09" patch: default: target: auto comment: false timmo001-system-bridge-models-28748ca/.editorconfig000066400000000000000000000007651465662702600221620ustar00rootroot00000000000000; EditorConfig helps developers define and maintain consistent ; coding styles between different editors and IDEs. ; For more visit http://editorconfig.org. root = true ; Choose between lf or rf on "end_of_line" property [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.{js,css,scss}] indent_size = 2 [*.html] indent_style = space [*.{py,qss,html,md}] indent_size = 4 [*.md] trim_trailing_whitespace = true timmo001-system-bridge-models-28748ca/.github/000077500000000000000000000000001465662702600210355ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/.github/CODEOWNERS000066400000000000000000000000241465662702600224240ustar00rootroot00000000000000.github/* @timmo001 timmo001-system-bridge-models-28748ca/.github/FUNDING.yml000066400000000000000000000000451465662702600226510ustar00rootroot00000000000000--- github: timmo001 ko_fi: timmo001 timmo001-system-bridge-models-28748ca/.github/dependabot.yaml000066400000000000000000000003561465662702600240320ustar00rootroot00000000000000--- version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: daily - package-ecosystem: "pip" directory: "/" open-pull-requests-limit: 20 schedule: interval: "daily" timmo001-system-bridge-models-28748ca/.github/labels.yml000066400000000000000000000066461465662702600230360ustar00rootroot00000000000000--- - name: "breaking-change" color: ee0701 description: "A breaking change for existing users." - name: "bug" color: ee0701 description: "Inconsistencies or issues which will cause a problem for users or implementors." - name: "bugfix" color: ee0701 description: "Inconsistencies or issues which will cause a problem for users or implementors." - name: "documentation" color: 0052cc description: "Solely about the documentation of the project." - name: "enhancement" color: 1d76db description: "Enhancement of the code, not introducing new features." - name: "refactor" color: 1d76db description: "Improvement of existing code, not introducing new features." - name: "performance" color: 1d76db description: "Improving performance, not introducing new features." - name: "new-feature" color: 0e8a16 description: "New features or options." - name: "maintenance" color: 2af79e description: "Generic maintenance tasks." - name: "ci" color: 1d76db description: "Work that improves the continue integration." - name: "dependencies" color: 1d76db description: "Upgrade or downgrade of project dependencies." - name: "in-progress" color: fbca04 description: "Issue is currently being resolved by a developer." - name: "stale" color: fef2c0 description: "There has not been activity on this issue or PR for quite some time." - name: "no-stale" color: fef2c0 description: "This issue or PR is exempted from the stable bot." - name: "security" color: ee0701 description: "Marks a security issue that needs to be resolved asap." - name: "incomplete" color: fef2c0 description: "Marks a PR or issue that is missing information." - name: "invalid" color: fef2c0 description: "Marks a PR or issue that is missing information." - name: "beginner-friendly" color: 0e8a16 description: "Good first issue for people wanting to contribute to the project." - name: "help-wanted" color: 0e8a16 description: "We need some extra helping hands or expertise in order to resolve this." - name: "hacktoberfest" description: "Issues/PRs are participating in the Hacktoberfest." color: fbca04 - name: "hacktoberfest-accepted" description: "Issues/PRs are participating in the Hacktoberfest." color: fbca04 - name: "priority-critical" color: ee0701 description: "This should be dealt with ASAP. Not fixing this issue would be a serious error." - name: "priority-high" color: b60205 description: "After critical issues are fixed, these should be dealt with before any further issues." - name: "priority-medium" color: 0e8a16 description: "This issue may be useful, and needs some attention." - name: "priority-low" color: e4ea8a description: "Nice addition, maybe... someday..." - name: "major" color: b60205 description: "This PR causes a major version bump in the version number." - name: "minor" color: 0e8a16 description: "This PR causes a minor version bump in the version number." - name: "investigation" color: 0e8a16 description: "An investigation is needed to determine what causes this." - name: "waiting-for-response" color: ffee58 description: "This issue is waiting for a response." - name: "unable-to-reproduce" color: ffee58 description: "This issue cannot be reproduced. It may be configuration or system related." - name: "linux" color: ffeb3b description: "This issue is related to Linux." - name: "windows" color: 03a9f4 description: "This issue is related to Windows." timmo001-system-bridge-models-28748ca/.github/release-drafter.yml000066400000000000000000000020451465662702600246260ustar00rootroot00000000000000--- name-template: "$RESOLVED_VERSION" tag-template: "$RESOLVED_VERSION" change-template: "- $TITLE @$AUTHOR (#$NUMBER)" sort-direction: ascending categories: - title: "🚨 Breaking changes" labels: - "breaking-change" - title: "✨ New features" labels: - "new-feature" - title: "πŸ› Bug fixes" labels: - "bugfix" - title: "πŸš€ Enhancements" labels: - "enhancement" - "refactor" - "performance" - title: "🧰 Maintenance" labels: - "maintenance" - "ci" - title: "πŸ“š Documentation" labels: - "documentation" - title: "⬆️ Dependency updates" labels: - "dependencies" version-resolver: major: labels: - "major" - "breaking-change" minor: labels: - "minor" - "new-feature" patch: labels: - "bugfix" - "chore" - "ci" - "dependencies" - "documentation" - "enhancement" - "performance" - "refactor" default: patch template: | ## What’s changed $CHANGES timmo001-system-bridge-models-28748ca/.github/workflows/000077500000000000000000000000001465662702600230725ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/.github/workflows/build.yml000066400000000000000000000006171465662702600247200ustar00rootroot00000000000000--- name: "Build" # yamllint disable-line rule:truthy on: push: branches: - master pull_request: types: - opened - reopened - synchronize workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: build: uses: timmo001/workflows/.github/workflows/build-python-linux.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/codeql.yml000066400000000000000000000007461465662702600250730ustar00rootroot00000000000000--- name: "CodeQL" # yamllint disable-line rule:truthy on: push: branches: - master pull_request: branches: - master schedule: - cron: "0 12 * * 4" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true permissions: actions: read contents: read security-events: write jobs: codeql-analyze-python: uses: timmo001/workflows/.github/workflows/codeql-python.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/dependabot-automerge.yml000066400000000000000000000004151465662702600277100ustar00rootroot00000000000000--- name: "Dependabot - Auto-merge" # yamllint disable-line rule:truthy on: pull_request_target: permissions: pull-requests: write contents: write jobs: dependabot-automerge: uses: timmo001/workflows/.github/workflows/dependabot-automerge-any.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/dependency-review.yml000066400000000000000000000003361465662702600272340ustar00rootroot00000000000000--- name: "Dependency Review" # yamllint disable-line rule:truthy on: - pull_request permissions: contents: read jobs: dependency-review: uses: timmo001/workflows/.github/workflows/depedency-review.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/deploy.yml000066400000000000000000000076331465662702600251220ustar00rootroot00000000000000--- name: "Deploy" # yamllint disable-line rule:truthy on: release: types: - published workflow_dispatch: env: MODULE_NAME: systembridgemodels jobs: deploy: name: πŸš€ Linux - Deploy Module runs-on: ubuntu-latest permissions: id-token: write steps: - name: ‡️ Check out code from GitHub uses: actions/checkout@v4.1.7 with: ref: "master" token: ${{ secrets.PUSH_TOKEN }} - name: πŸ— Set up Python uses: actions/setup-python@v5.1.1 with: python-version: "3.12" architecture: "x64" cache: "pip" - name: πŸ— Install setuptools, wheel, twine, click, twisted, incremental run: | python -m pip install --upgrade setuptools wheel twine click twisted incremental - name: πŸ”’ Get old version id: get-version-old run: | python -m pip install . # Read version from _version.py result=$(python <> $GITHUB_OUTPUT - name: πŸ”’ Set correct vertion - Developement if: ${{ github.event_name != 'release' }} run: | # If version does not contain dev, add it if [[ ! "${{ steps.get-version-old.outputs.version }}" == *"dev"* ]]; then python -m incremental.update ${{ env.MODULE_NAME }} --dev fi - name: πŸ”’ Set correct vertion - Release if: ${{ github.event_name == 'release' }} run: | # If version contains dev*, remove it if [[ "${{ steps.get-version-old.outputs.version }}" == *"dev"* ]]; then NEW_VERSION=$(echo "${{ steps.get-version-old.outputs.version }}" | sed 's/.dev.*//') python -m incremental.update ${{ env.MODULE_NAME }} --newversion $NEW_VERSION fi - name: πŸ”’ Get current version id: get-version-current run: | result=$(python <> $GITHUB_OUTPUT - name: ‡️ Pull latest changes from GitHub run: | git pull --ff - name: πŸ–Š Commit uses: stefanzweifel/git-auto-commit-action@v5.0.1 env: GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} with: commit_message: | Bump ${{ env.MODULE_NAME }} version to ${{ steps.get-version-current.outputs.version }} - name: πŸ— Install package run: | python setup.py sdist bdist_wheel - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true - name: πŸ”’ Increment version - Developement if: ${{ github.event_name != 'release' }} run: | python -m incremental.update ${{ env.MODULE_NAME }} --dev - name: πŸ”’ Increment version - Release if: ${{ github.event_name == 'release' }} run: | python -m incremental.update ${{ env.MODULE_NAME }} --patch python -m incremental.update ${{ env.MODULE_NAME }} --dev - name: πŸ”’ Get new version id: get-version-new run: | result=$(python <> $GITHUB_OUTPUT - name: ‡️ Pull latest changes from GitHub run: | git pull --ff - name: πŸ–Š Commit uses: stefanzweifel/git-auto-commit-action@v5.0.1 env: GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }} with: commit_message: | Bump ${{ env.MODULE_NAME }} version to ${{ steps.get-version-new.outputs.version }} timmo001-system-bridge-models-28748ca/.github/workflows/labels.yml000066400000000000000000000004301465662702600250540ustar00rootroot00000000000000--- name: "Sync labels" # yamllint disable-line rule:truthy on: push: branches: - master paths: - .github/labels.yml schedule: - cron: "34 5 * * *" workflow_dispatch: jobs: labels: uses: timmo001/workflows/.github/workflows/labels.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/lint.yml000066400000000000000000000020151465662702600245610ustar00rootroot00000000000000--- name: "Lint" # yamllint disable-line rule:truthy on: push: branches: - master pull_request: types: - opened - reopened - synchronize workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: lint-jsonlint: uses: timmo001/workflows/.github/workflows/lint-jsonlint.yml@master lint-markdown-links: uses: timmo001/workflows/.github/workflows/lint-markdown-links.yml@master lint-markdownlint: uses: timmo001/workflows/.github/workflows/lint-markdownlint.yml@master lint-prettier: uses: timmo001/workflows/.github/workflows/lint-prettier.yml@master with: file-types: "{json,yml,yaml}" lint-pylint: uses: timmo001/workflows/.github/workflows/lint-pylint.yml@master with: module-name: systembridgemodels lint-ruff: uses: timmo001/workflows/.github/workflows/lint-ruff.yml@master lint-yamllint: uses: timmo001/workflows/.github/workflows/lint-yamllint.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/release-drafter.yml000066400000000000000000000004321465662702600266610ustar00rootroot00000000000000--- name: "Release Drafter" # yamllint disable-line rule:truthy on: push: branches: - master workflow_dispatch: permissions: contents: write pull-requests: write jobs: release-drafter: uses: timmo001/workflows/.github/workflows/release-drafter.yml@master timmo001-system-bridge-models-28748ca/.github/workflows/test.yml000066400000000000000000000007671465662702600246060ustar00rootroot00000000000000--- name: "Test" # yamllint disable-line rule:truthy on: push: branches: - master pull_request: types: - opened - reopened - synchronize workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: test: uses: timmo001/workflows/.github/workflows/test-pytest.yml@master secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: module-name: "systembridgemodels" timmo001-system-bridge-models-28748ca/.gitignore000066400000000000000000000060061465662702600214670ustar00rootroot00000000000000# 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/ 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/ cover/ # 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 .pybuilder/ target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .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 # poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __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/ # pytype static type analyzer .pytype/ # Cython debug symbols cython_debug/ # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ timmo001-system-bridge-models-28748ca/.mdl.rb000066400000000000000000000001671465662702600206600ustar00rootroot00000000000000all rule 'MD013', :tables => false exclude_rule 'MD002' exclude_rule 'MD013' exclude_rule 'MD024' exclude_rule 'MD041' timmo001-system-bridge-models-28748ca/.mdlrc000066400000000000000000000000201465662702600205670ustar00rootroot00000000000000style '.mdl.rb' timmo001-system-bridge-models-28748ca/.vscode/000077500000000000000000000000001465662702600210365ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/.vscode/tasks.json000066400000000000000000000014031465662702600230540ustar00rootroot00000000000000{ "version": "2.0.0", "tasks": [ { "type": "shell", "label": "pip install", "command": "pip install .", "dependsOn": [] }, { "type": "shell", "label": "pip install test requirements", "command": "pip install -r requirements_test.txt", "dependsOn": ["pip install"] }, { "type": "shell", "label": "pytest", "command": "pytest -vv tests", "dependsOn": ["pip install test requirements"] }, { "type": "shell", "label": "pytest coverage", "command": "python -m pytest -qq --cov=systembridgemodels --cov-report=xml --cov-report=term-missing -o console_output_style=count -p no:sugar tests", "dependsOn": ["pip install test requirements"] } ] } timmo001-system-bridge-models-28748ca/.yamllint.yml000066400000000000000000000001761465662702600221330ustar00rootroot00000000000000--- extends: default rules: line-length: ignore: | .gitlab-ci.yml .github/ .yarn/ level: warning timmo001-system-bridge-models-28748ca/LICENSE000066400000000000000000000261351465662702600205110ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. timmo001-system-bridge-models-28748ca/MANIFEST.in000066400000000000000000000001701465662702600212310ustar00rootroot00000000000000include LICENSE include README.md include requirements.txt include requirements_setup.txt include requirements_test.txt timmo001-system-bridge-models-28748ca/README.md000066400000000000000000000002051465662702600207510ustar00rootroot00000000000000# System Bridge - Models This is the models package used by the [System Bridge](https://github.com/timmo001/system-bridge) project. timmo001-system-bridge-models-28748ca/mlc_config.json000066400000000000000000000004111465662702600224640ustar00rootroot00000000000000{ "ignorePatterns": [ { "pattern": "^http://localhost" }, { "pattern": "^aidan@timmo" }, { "pattern": "^https://www.buymeacoffee.com" }, { "pattern": "^https://microbadger.com" } ], "retryOn429": true } timmo001-system-bridge-models-28748ca/pyproject.toml000066400000000000000000000174211465662702600224160ustar00rootroot00000000000000[tool.black] extend-exclude = "/generated/" [tool.pylint.MAIN] py-version = "3.12" ignore = [ "tests", ] # Use a conservative default here; 2 should speed up most setups and not hurt # any too bad. Override on command line as appropriate. jobs = 2 init-hook = """\ from pathlib import Path; \ import sys; \ from pylint.config import find_default_config_files; \ sys.path.append( \ str(Path(next(find_default_config_files())).parent.joinpath('pylint/plugins')) ) \ """ load-plugins = [ "pylint.extensions.code_style", "pylint.extensions.typing", ] persistent = false extension-pkg-allow-list = [ "av.audio.stream", "av.logging", "av.stream", "ciso8601", "orjson", "cv2", ] fail-on = [ "I", ] [tool.pylint.BASIC] class-const-naming-style = "any" [tool.pylint."MESSAGES CONTROL"] # Reasons disabled: # format - handled by black # locally-disabled - it spams too much # duplicate-code - unavoidable # cyclic-import - doesn't test if both import on load # unused-argument - generic callbacks and setup methods create a lot of warnings # too-many-* - are not enforced for the sake of readability # too-few-* - same as too-many-* # abstract-method - with intro of async there are always methods missing # inconsistent-return-statements - doesn't handle raise # too-many-ancestors - it's too strict. # wrong-import-order - isort guards this disable = [ "abstract-method", "consider-alternative-union-syntax", "cyclic-import", "duplicate-code", "fixme", "format", "inconsistent-return-statements", "locally-disabled", "not-context-manager", "too-few-public-methods", "too-many-ancestors", "too-many-arguments", "too-many-boolean-expressions", "too-many-branches", "too-many-instance-attributes", "too-many-lines", "too-many-locals", "too-many-public-methods", "too-many-return-statements", "too-many-statements", "unused-argument", "wrong-import-order", ] enable = [ #"useless-suppression", # temporarily every now and then to clean them up "use-symbolic-message-instead", ] [tool.isort] profile = "black" line_length = 88 [tool.pylint.REPORTS] score = false [tool.pylint.TYPECHECK] ignored-classes = [ "_CountingAttr", # for attrs ] mixin-class-rgx = ".*[Mm]ix[Ii]n" [tool.pylint.FORMAT] expected-line-ending-format = "LF" [tool.pylint.EXCEPTIONS] overgeneral-exceptions = [ "builtins.BaseException", "builtins.Exception", ] [tool.pylint.TYPING] runtime-typing = false [tool.pylint.CODE_STYLE] max-line-length-suggestions = 72 [tool.pytest.ini_options] testpaths = [ "tests", ] norecursedirs = [ ".git", "testing_config", ] log_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(threadName)s %(name)s:%(filename)s:%(lineno)s %(message)s" log_date_format = "%Y-%m-%d %H:%M:%S" asyncio_mode = "auto" [tool.ruff] select = [ "B002", # Python does not support the unary prefix increment "B007", # Loop control variable {name} not used within loop body "B014", # Exception handler with duplicate exception "B023", # Function definition does not bind loop variable {name} "B026", # Star-arg unpacking after a keyword argument is strongly discouraged "C", # complexity "COM818", # Trailing comma on bare tuple prohibited "D", # docstrings "DTZ003", # Use datetime.now(tz=) instead of datetime.utcnow() "DTZ004", # Use datetime.fromtimestamp(ts, tz=) instead of datetime.utcfromtimestamp(ts) "E", # pycodestyle "F", # pyflakes/autoflake "G", # flake8-logging-format "I", # isort "ICN001", # import concentions; {name} should be imported as {asname} "ISC001", # Implicitly concatenated string literals on one line "N804", # First argument of a class method should be named cls "N805", # First argument of a method should be named self "N815", # Variable {name} in class scope should not be mixedCase "PGH001", # No builtin eval() allowed "PGH004", # Use specific rule codes when using noqa "PLC", # pylint "PLC0414", # Useless import alias. Import alias does not rename original package. "PLE", # pylint "PLR", # pylint "PLW", # pylint "Q000", # Double quotes found but single quotes preferred "RUF006", # Store a reference to the return value of asyncio.create_task "S102", # Use of exec detected "S103", # bad-file-permissions "S108", # hardcoded-temp-file "S306", # suspicious-mktemp-usage "S307", # suspicious-eval-usage "S313", # suspicious-xmlc-element-tree-usage "S314", # suspicious-xml-element-tree-usage "S315", # suspicious-xml-expat-reader-usage "S316", # suspicious-xml-expat-builder-usage "S317", # suspicious-xml-sax-usage "S318", # suspicious-xml-mini-dom-usage "S319", # suspicious-xml-pull-dom-usage "S320", # suspicious-xmle-tree-usage "S601", # paramiko-call "S602", # subprocess-popen-with-shell-equals-true "S604", # call-with-shell-equals-true "S608", # hardcoded-sql-expression "S609", # unix-command-wildcard-injection "SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass "SIM117", # Merge with-statements that use the same scope "SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys() "SIM201", # Use {left} != {right} instead of not {left} == {right} "SIM208", # Use {expr} instead of not (not {expr}) "SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a} "SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'. "SIM401", # Use get from dict with default instead of an if block "T100", # Trace found: {name} used "T20", # flake8-print "TID251", # Banned imports "TRY004", # Prefer TypeError exception for invalid type "TRY200", # Use raise from to specify exception cause "TRY302", # Remove exception handler; error is immediately re-raised "UP", # pyupgrade "W", # pycodestyle ] ignore = [ "D202", # No blank lines allowed after function docstring "D203", # 1 blank line required before class docstring "D213", # Multi-line docstring summary should start at the second line "D406", # Section name should end with a newline "D407", # Section name underlining "E501", # line too long "E731", # do not assign a lambda expression, use a def "PLC0208", # Use a sequence type instead of a `set` when iterating over values "PLR0911", # Too many return statements ({returns} > {max_returns}) "PLR0912", # Too many branches ({branches} > {max_branches}) "PLR0913", # Too many arguments to function call ({c_args} > {max_args}) "PLR0915", # Too many statements ({statements} > {max_statements}) "PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable "PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target "UP006", # keep type annotation style as is "UP007", # keep type annotation style as is "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` ] [tool.ruff.flake8-import-conventions.extend-aliases] voluptuous = "vol" [tool.ruff.flake8-pytest-style] fixture-parentheses = false [tool.ruff.flake8-tidy-imports.banned-api] "async_timeout".msg = "use asyncio.timeout instead" "pytz".msg = "use zoneinfo instead" [tool.ruff.isort] force-sort-within-sections = true known-first-party = [ "systembridgebackend", "systembridgecli", "systembridgeconnector", "systembridgefrontend", "systembridgegui", "systembridgemodels", "systembridgeshared", "systembridgewindowssensors", ] combine-as-imports = true split-on-trailing-comma = false [tool.ruff.per-file-ignores] "_version.py" = ["D200", "D212"] # Allow for main entry & scripts to write to stdout "script/*" = ["T20"] [tool.ruff.mccabe] max-complexity = 25 timmo001-system-bridge-models-28748ca/requirements.txt000066400000000000000000000000241465662702600227550ustar00rootroot00000000000000incremental>=24.7.2 timmo001-system-bridge-models-28748ca/requirements_setup.txt000066400000000000000000000000241465662702600241750ustar00rootroot00000000000000incremental>=24.7.2 timmo001-system-bridge-models-28748ca/requirements_test.txt000066400000000000000000000002051465662702600240150ustar00rootroot00000000000000pytest-aiohttp==1.0.5 pytest-asyncio==0.23.6 pytest-cov==5.0.0 pytest-sugar==1.0.0 pytest-timeout==2.3.1 pytest==8.1.1 syrupy==4.6.1 timmo001-system-bridge-models-28748ca/schemas/000077500000000000000000000000001465662702600211205ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/schemas/action.json000066400000000000000000000004431465662702600232710ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Action", "properties": { "command": { "type": "string" }, "data": { "type": "object" }, "label": { "type": "string" } }, "required": ["command"] } timmo001-system-bridge-models-28748ca/schemas/data/000077500000000000000000000000001465662702600220315ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/schemas/data/battery.json000066400000000000000000000012101465662702600243700ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Battery", "properties": { "id": { "type": "string", "description": "Event ID" }, "is_charging": { "type": "boolean" }, "percentage": { "type": "number" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "is_charging": { "type": "number" }, "percentage": { "type": "number" } }, "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/cpu.json000066400000000000000000000061441465662702600235200ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "CPU", "properties": { "id": { "type": "string", "description": "Event ID" }, "count": { "type": "integer" }, "frequency_current": { "type": "number" }, "frequency_min": { "type": "number" }, "frequency_max": { "type": "number" }, "load_average": { "type": "number" }, "power_package": { "type": "number" }, "stats_ctx_switches": { "type": "integer" }, "stats_interrupts": { "type": "integer" }, "stats_soft_interrupts": { "type": "integer" }, "stats_syscalls": { "type": "integer" }, "temperature": { "type": "number" }, "times_user": { "type": "number" }, "times_system": { "type": "number" }, "times_idle": { "type": "number" }, "times_interrupt": { "type": "number" }, "times_dpc": { "type": "number" }, "times_percent_user": { "type": "number" }, "times_percent_system": { "type": "number" }, "times_percent_idle": { "type": "number" }, "times_percent_interrupt": { "type": "number" }, "times_percent_dpc": { "type": "number" }, "usage": { "type": "number" }, "voltage": { "type": "number" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "count": { "type": "number" }, "frequency_current": { "type": "number" }, "frequency_min": { "type": "number" }, "frequency_max": { "type": "number" }, "load_average": { "type": "number" }, "power_package": { "type": "number" }, "stats_ctx_switches": { "type": "number" }, "stats_interrupts": { "type": "number" }, "stats_soft_interrupts": { "type": "number" }, "stats_syscalls": { "type": "number" }, "temperature": { "type": "number" }, "times_user": { "type": "number" }, "times_system": { "type": "number" }, "times_idle": { "type": "number" }, "times_interrupt": { "type": "number" }, "times_dpc": { "type": "number" }, "times_percent_user": { "type": "number" }, "times_percent_system": { "type": "number" }, "times_percent_idle": { "type": "number" }, "times_percent_interrupt": { "type": "number" }, "times_percent_dpc": { "type": "number" }, "usage": { "type": "number" }, "voltage": { "type": "number" } }, "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/disk.json000066400000000000000000000030101465662702600236500ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Disk", "properties": { "id": { "type": "string", "description": "Event ID" }, "devices": { "type": "array" }, "io_counters_read_count": { "type": "integer" }, "io_counters_write_count": { "type": "integer" }, "io_counters_read_bytes": { "type": "integer" }, "io_counters_write_bytes": { "type": "integer" }, "io_counters_read_time": { "type": "integer" }, "io_counters_write_time": { "type": "integer" }, "partitions": { "type": "array" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "devices": { "type": "number" }, "io_counters_read_count": { "type": "number" }, "io_counters_write_count": { "type": "number" }, "io_counters_read_bytes": { "type": "number" }, "io_counters_write_bytes": { "type": "number" }, "io_counters_read_time": { "type": "number" }, "io_counters_write_time": { "type": "number" }, "partitions": { "type": "number" } }, "additionalProperties": { "type": "number" }, "required": ["devices", "partitions"] } }, "additionalProperties": true, "required": ["devices", "partitions"] } timmo001-system-bridge-models-28748ca/schemas/data/display.json000066400000000000000000000010201465662702600243620ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Display", "properties": { "id": { "type": "string", "description": "Event ID" }, "displays": { "type": "array" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "displays": { "type": "number" } }, "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/gpu.json000066400000000000000000000010041465662702600235120ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "GPU", "properties": { "id": { "type": "string", "description": "Event ID" }, "gpus": { "type": "array" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "gpus": { "type": "number" } }, "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/media.json000066400000000000000000000024221465662702600240030ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "additionalProperties": true, "description": "Media Info", "properties": { "album_artist": { "type": "string" }, "album_title": { "type": "string" }, "artist": { "type": "string" }, "duration": { "type": "number" }, "is_fast_forward_enabled": { "type": "boolean" }, "is_next_enabled": { "type": "boolean" }, "is_pause_enabled": { "type": "boolean" }, "is_play_enabled": { "type": "boolean" }, "is_previous_enabled": { "type": "boolean" }, "is_rewind_enabled": { "type": "boolean" }, "is_stop_enabled": { "type": "boolean" }, "playback_rate": { "type": "number" }, "position": { "type": "number" }, "repeat": { "type": "string" }, "shuffle": { "type": "boolean" }, "status": { "type": "string" }, "subtitle": { "type": "string" }, "thumbnail": { "type": "string" }, "title": { "type": "string" }, "track_number": { "type": "integer" }, "type": { "type": "string" }, "updated_at": { "type": "number" } }, "type": "object" } timmo001-system-bridge-models-28748ca/schemas/data/memory.json000066400000000000000000000032341465662702600242360ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Memory", "properties": { "id": { "type": "string", "description": "Event ID" }, "swap_total": { "type": "integer" }, "swap_used": { "type": "integer" }, "swap_free": { "type": "number" }, "swap_percent": { "type": "number" }, "swap_sin": { "type": "integer" }, "swap_sout": { "type": "integer" }, "virtual_total": { "type": "integer" }, "virtual_available": { "type": "integer" }, "virtual_percent": { "type": "number" }, "virtual_used": { "type": "integer" }, "virtual_free": { "type": "integer" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "swap_total": { "type": "number" }, "swap_used": { "type": "number" }, "swap_free": { "type": "number" }, "swap_percent": { "type": "number" }, "swap_sin": { "type": "number" }, "swap_sout": { "type": "number" }, "virtual_total": { "type": "number" }, "virtual_available": { "type": "number" }, "virtual_percent": { "type": "number" }, "virtual_used": { "type": "number" }, "virtual_free": { "type": "number" } }, "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/network.json000066400000000000000000000027251465662702600244230ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Network", "properties": { "id": { "type": "string", "description": "Event ID" }, "io_counters_bytes_sent": { "type": "integer" }, "io_counters_bytes_recv": { "type": "integer" }, "io_counters_packets_sent": { "type": "integer" }, "io_counters_packets_recv": { "type": "integer" }, "io_counters_errin": { "type": "integer" }, "io_counters_errout": { "type": "integer" }, "io_counters_dropin": { "type": "integer" }, "io_counters_dropout": { "type": "integer" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "io_counters_bytes_sent": { "type": "number" }, "io_counters_bytes_recv": { "type": "number" }, "io_counters_packets_sent": { "type": "number" }, "io_counters_packets_recv": { "type": "number" }, "io_counters_errin": { "type": "number" }, "io_counters_errout": { "type": "number" }, "io_counters_dropin": { "type": "number" }, "io_counters_dropout": { "type": "number" } }, "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/processes.json000066400000000000000000000035571465662702600247440ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Processes", "properties": { "id": { "type": "string", "description": "Event ID" }, "count": { "type": "number" }, "processes": { "type": "array", "description": "Processes", "items": { "type": "object", "description": "Process", "properties": { "id": { "type": "number", "description": "ID" }, "name": { "type": "string", "description": "Name" }, "cpu_usage": { "type": "number", "description": "CPU usage percentage" }, "created": { "type": "number", "description": "Created time (epoch)" }, "memory_usage": { "type": "number", "description": "Memory usage percentage" }, "path": { "type": "string", "description": "Path" }, "status": { "type": "string", "description": "Status" }, "username": { "type": "string", "description": "Username" }, "working_directory": { "type": "string", "description": "Working directory" } }, "required": ["id", "name"], "additionalProperties": true } }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "count": { "type": "number" }, "processes": { "type": "number" } }, "additionalItems": { "type": "number" }, "required": ["count", "processes"] } }, "additionalItems": {}, "required": ["count", "processes"] } timmo001-system-bridge-models-28748ca/schemas/data/sensors.json000066400000000000000000000006071465662702600244230ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Sensors", "properties": { "id": { "type": "string", "description": "Event ID" }, "last_updated": { "type": "object", "description": "Last updated", "additionalProperties": { "type": "number" } } }, "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/data/system.json000066400000000000000000000052221465662702600242510ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "System", "properties": { "id": { "type": "string", "description": "Event ID" }, "active_user_id": { "type": "number" }, "active_user_name": { "type": "string" }, "boot_time": { "type": "number" }, "camera_usage": { "type": "array", "items": { "type": "string" } }, "fqdn": { "type": "string" }, "hostname": { "type": "string" }, "ip_address_4": { "type": "string" }, "mac_address": { "type": "string" }, "pending_reboot": { "type": "boolean" }, "platform": { "type": "string" }, "platform_version": { "type": "string" }, "uptime": { "type": "number" }, "uuid": { "type": "string" }, "version": { "type": "string" }, "version_latest": { "type": "string" }, "version_newer_available": { "type": "boolean" }, "last_updated": { "type": "object", "description": "Last updated", "properties": { "active_user_id": { "type": "number" }, "active_user_name": { "type": "number" }, "boot_time": { "type": "number" }, "camera_usage": { "type": "number" }, "fqdn": { "type": "number" }, "hostname": { "type": "number" }, "ip_address_4": { "type": "number" }, "mac_address": { "type": "number" }, "pending_reboot": { "type": "number" }, "platform": { "type": "number" }, "platform_version": { "type": "number" }, "uptime": { "type": "number" }, "uuid": { "type": "number" }, "version": { "type": "number" }, "version_latest": { "type": "number" }, "version_newer_available": { "type": "number" } }, "additionalItems": { "type": "number" }, "required": [ "boot_time", "fqdn", "hostname", "ip_address_4", "mac_address", "platform", "platform_version", "uptime", "uuid", "version" ] } }, "additionalItems": {}, "required": [ "boot_time", "fqdn", "hostname", "ip_address_4", "mac_address", "platform", "platform_version", "uptime", "uuid", "version" ] } timmo001-system-bridge-models-28748ca/schemas/get_data.json000066400000000000000000000003131465662702600235600ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Get Data", "properties": { "modules": { "type": "array" } }, "required": ["modules"] } timmo001-system-bridge-models-28748ca/schemas/keyboard/000077500000000000000000000000001465662702600227205ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/schemas/keyboard/keyboard_key.json000066400000000000000000000003101465662702600262550ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Keyboard Key", "properties": { "key": { "type": "string" } }, "required": ["key"] } timmo001-system-bridge-models-28748ca/schemas/keyboard/keyboard_text.json000066400000000000000000000003131465662702600264540ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Keyboard Text", "properties": { "text": { "type": "string" } }, "required": ["text"] } timmo001-system-bridge-models-28748ca/schemas/media/000077500000000000000000000000001465662702600221775ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/schemas/media/media_control.json000066400000000000000000000007451465662702600257170ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Media Control", "properties": { "action": { "type": "string", "enum": [ "PLAY", "PAUSE", "STOP", "PREVIOUS", "NEXT", "SEEK", "REWIND", "FASTFORWARD", "SHUFFLE", "REPEAT", "MUTE", "VOLUMEDOWN", "VOLUMEUP" ] }, "value": {} }, "required": ["action"] } timmo001-system-bridge-models-28748ca/schemas/media/media_directories.json000066400000000000000000000007231465662702600265470ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "directories": { "type": "array", "items": [ { "type": "object", "properties": { "key": { "type": "string" }, "path": { "type": "string" } }, "required": ["key", "path"] } ] } }, "required": ["directories"] } timmo001-system-bridge-models-28748ca/schemas/media/media_files.json000066400000000000000000000026711465662702600253410ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Media Files", "properties": { "files": { "type": "array", "items": [ { "type": "object", "description": "Media File", "properties": { "name": { "type": "string" }, "path": { "type": "string" }, "fullpath": { "type": "string" }, "size": { "type": "integer" }, "last_accessed": { "type": "number" }, "created": { "type": "number" }, "modified": { "type": "number" }, "is_directory": { "type": "boolean" }, "is_file": { "type": "boolean" }, "is_link": { "type": "boolean" }, "mime_type": { "type": "string" } }, "required": [ "name", "path", "fullpath", "size", "last_accessed", "created", "modified", "is_directory", "is_file", "is_link" ] } ] }, "path": { "type": "string" } }, "required": ["files", "path"] } timmo001-system-bridge-models-28748ca/schemas/media/media_get_file.json000066400000000000000000000003721465662702600260110ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Get File", "properties": { "base": { "type": "string" }, "path": { "type": "string" } }, "required": ["base", "path"] } timmo001-system-bridge-models-28748ca/schemas/media/media_get_files.json000066400000000000000000000003631465662702600261740ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Get Files", "properties": { "base": { "type": "string" }, "path": { "type": "string" } }, "required": ["base"] } timmo001-system-bridge-models-28748ca/schemas/media/media_play.json000066400000000000000000000010071465662702600251740ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Media Play", "properties": { "album": { "type": "string" }, "artist": { "type": "string" }, "autoplay": { "type": "boolean", "default": false }, "cover": { "type": "string" }, "title": { "type": "string" }, "url": { "type": "string" }, "volume": { "type": "number", "default": 40 } }, "required": ["url"] } timmo001-system-bridge-models-28748ca/schemas/notification.json000066400000000000000000000020531465662702600245010ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Notification", "properties": { "title": { "type": "string" }, "message": { "type": "string" }, "icon": { "type": "string" }, "image": { "type": "string" }, "actions": { "type": "array", "items": { "type": "object", "description": "Notification Action", "properties": { "command": { "type": "string" }, "data": { "type": "object" }, "label": { "type": "string" } }, "required": ["command", "label"] } }, "timeout": { "type": "number" }, "audio": { "type": "object", "properties": { "source": { "type": "string" }, "volume": { "type": "number", "minimum": 0, "maximum": 100 } }, "required": ["source"] } }, "required": ["title"] } timmo001-system-bridge-models-28748ca/schemas/open/000077500000000000000000000000001465662702600220615ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/schemas/open/open_path.json000066400000000000000000000003071465662702600247310ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Open Path", "properties": { "path": { "type": "string" } }, "required": ["path"] } timmo001-system-bridge-models-28748ca/schemas/open/open_url.json000066400000000000000000000003041465662702600245740ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Open URL", "properties": { "url": { "type": "string" } }, "required": ["url"] } timmo001-system-bridge-models-28748ca/schemas/register_data_listener.json000066400000000000000000000003311465662702600265320ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Register Data Listener", "properties": { "modules": { "type": "array" } }, "required": ["modules"] } timmo001-system-bridge-models-28748ca/schemas/request.json000066400000000000000000000006351465662702600235070ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Request", "properties": { "token": { "type": "string", "description": "Token" }, "id": { "type": "string", "description": "Message ID" }, "event": { "type": "string", "description": "Event" } }, "required": ["event"], "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/response.json000066400000000000000000000011541465662702600236520ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Response", "properties": { "id": { "type": "string", "description": "Message ID" }, "type": { "type": "string", "description": "Type" }, "subtype": { "type": "string", "description": "Subtype" }, "message": { "type": "string", "description": "Message" }, "module": { "type": "string", "description": "Module" }, "data": { "description": "Data" } }, "required": ["type"], "additionalProperties": true } timmo001-system-bridge-models-28748ca/schemas/setting/000077500000000000000000000000001465662702600225755ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/schemas/setting/get_setting.json000066400000000000000000000003171465662702600260050ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Get Setting", "properties": { "setting": { "type": "string" } }, "required": ["setting"] } timmo001-system-bridge-models-28748ca/schemas/setting/update_setting.json000066400000000000000000000003541465662702600265110ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Update Setting", "properties": { "setting": { "type": "string" }, "value": {} }, "required": ["setting", "value"] } timmo001-system-bridge-models-28748ca/schemas/update.json000066400000000000000000000003131465662702600232720ustar00rootroot00000000000000{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "description": "Version", "properties": { "version": { "type": "string" } }, "required": ["version"] } timmo001-system-bridge-models-28748ca/setup.py000066400000000000000000000017001465662702600212050ustar00rootroot00000000000000"""Setup.""" from setuptools import find_packages, setup # Get setup packages from requirements.txt with open("requirements_setup.txt", encoding="utf-8") as f: requirements_setup = f.read().splitlines() # Get packages from requirements.txt with open("requirements.txt", encoding="utf-8") as f: requirements = f.read().splitlines() with open("README.md", encoding="utf-8") as f: readme = f.read() setup( name="systembridgemodels", author="Aidan Timson (Timmo)", author_email="aidan@timmo.dev", description="System Bridge Models", keywords="system-bridge", license="Apache-2.0", long_description=readme, long_description_content_type="text/markdown", url="https://github.com/timmo001/system-bridge-models", install_requires=requirements, packages=find_packages(exclude=["tests", "tests.*", "generator"]), python_requires=">=3.11", setup_requires=requirements_setup, use_incremental=True, ) timmo001-system-bridge-models-28748ca/systembridgemodels/000077500000000000000000000000001465662702600234025ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/systembridgemodels/__init__.py000066400000000000000000000000161465662702600255100ustar00rootroot00000000000000"""Models.""" timmo001-system-bridge-models-28748ca/systembridgemodels/_version.py000066400000000000000000000004531465662702600256020ustar00rootroot00000000000000""" Provides systembridgemodels version information. """ # This file is auto-generated! Do not edit! # Use `python -m incremental.update systembridgemodels` to change this file. from incremental import Version __version__ = Version("systembridgemodels", 4, 2, 4, dev=0) __all__ = ["__version__"] timmo001-system-bridge-models-28748ca/systembridgemodels/action.py000066400000000000000000000003721465662702600252330ustar00rootroot00000000000000"""Action.""" from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass(slots=True) class Action: """Action.""" command: str data: dict[str, Any] | None = None label: str | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/const.py000066400000000000000000000044761465662702600251150ustar00rootroot00000000000000"""Model constants.""" from enum import StrEnum from .keyboard_key import KeyboardKey from .keyboard_text import KeyboardText from .media_directories import MediaDirectory from .media_files import MediaFile, MediaFiles from .modules import Module, ModulesData from .modules.battery import Battery from .modules.cpu import CPU from .modules.disks import Disks from .modules.displays import Display from .modules.gpus import GPU from .modules.media import Media from .modules.memory import Memory from .modules.networks import Networks from .modules.processes import Process from .modules.sensors import Sensors from .modules.system import System from .notification import Notification from .open_path import OpenPath from .open_url import OpenUrl from .response import Response class Model(StrEnum): """Model Enums.""" BATTERY = Module.BATTERY CPU = Module.CPU DATA = "data" DISKS = Module.DISKS DISPLAYS = Module.DISPLAYS GPUS = Module.GPUS KEYBOARD_KEY = "keyboard_key" KEYBOARD_TEXT = "keyboard_text" MEDIA = Module.MEDIA MEDIA_DIRECTORIES = "media_directories" MEDIA_FILE = "media_file" MEDIA_FILES = "media_files" MEMORY = Module.MEMORY NETWORKS = Module.NETWORKS NOTIFICATION = "notification" OPEN_PATH = "open_path" OPEN_URL = "open_url" PROCESSES = Module.PROCESSES RESPONSE = "response" SECRETS = "secrets" SENSORS = Module.SENSORS SETTINGS = "settings" SYSTEM = Module.SYSTEM MODEL_MAP = { Model.BATTERY: Battery, Model.CPU: CPU, Model.DATA: ModulesData, Model.DISKS: Disks, Model.DISPLAYS: Display, # Map to Display not list[Display] so it can be mapped Model.GPUS: GPU, # Map to GPU not list[GPU] so it can be mapped Model.KEYBOARD_KEY: KeyboardKey, Model.KEYBOARD_TEXT: KeyboardText, Model.MEDIA_DIRECTORIES: MediaDirectory, # Map to MediaDirectory not list[MediaDirectory] so it can be mapped Model.MEDIA_FILE: MediaFile, Model.MEDIA_FILES: MediaFiles, Model.MEDIA: Media, Model.MEMORY: Memory, Model.NETWORKS: Networks, Model.NOTIFICATION: Notification, Model.OPEN_PATH: OpenPath, Model.OPEN_URL: OpenUrl, Model.PROCESSES: Process, # Map to Process not list[Process] so it can be mapped Model.RESPONSE: Response, Model.SENSORS: Sensors, Model.SYSTEM: System, } timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/000077500000000000000000000000001465662702600252535ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/__init__.py000066400000000000000000000000201465662702600273540ustar00rootroot00000000000000"""Fixtures.""" timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/media_files.py000066400000000000000000000010361465662702600300660ustar00rootroot00000000000000"""Fixture for media files.""" from systembridgemodels.media_files import MediaFile, MediaFiles FIXTURE_MEDIA_FILES = MediaFiles( files=[ MediaFile( name="file1", path="path/to/file1", fullpath="/full/path/to/file1", size=100, last_accessed=100.0, created=100.0, modified=100.0, is_directory=False, is_file=True, is_link=False, mime_type="text/plain", ), ], path="path/to/file", ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/000077500000000000000000000000001465662702600267235ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/__init__.py000066400000000000000000000000341465662702600310310ustar00rootroot00000000000000"""Fixtures for modules.""" timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/battery.py000066400000000000000000000002711465662702600307470ustar00rootroot00000000000000"""Fixture for battery module.""" from systembridgemodels.modules.battery import Battery FIXTURE_BATTERY = Battery( is_charging=True, percentage=98.4, time_remaining=12, ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/cpu.py000066400000000000000000000025371465662702600300730ustar00rootroot00000000000000"""Fixture for cpu module.""" from systembridgemodels.modules.cpu import CPU, CPUFrequency, CPUStats, CPUTimes, PerCPU FIXTURE_CPU = CPU( count=4, frequency=CPUFrequency( current=2.3, min=0.8, max=3.1, ), load_average=1.5, per_cpu=[ PerCPU( id=0, frequency=CPUFrequency( current=2.3, min=0.8, max=3.1, ), power=50.0, times=CPUTimes( user=120.0, system=30.0, idle=600.0, interrupt=0.0, dpc=0.0, ), times_percent=CPUTimes( user=20.0, system=5.0, idle=100.0, interrupt=0.0, dpc=0.0, ), usage=20.0, voltage=1.2, ) ], power=200.0, stats=CPUStats( ctx_switches=1000, interrupts=500, soft_interrupts=200, syscalls=8000, ), temperature=45.0, times=CPUTimes( user=480.0, system=120.0, idle=2400.0, interrupt=0.0, dpc=0.0, ), times_percent=CPUTimes( user=80.0, system=20.0, idle=400.0, interrupt=0.0, dpc=0.0, ), usage=80.0, voltage=1.2, ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/disks.py000066400000000000000000000022571465662702600304200ustar00rootroot00000000000000"""Test fixtures for the disks module.""" from systembridgemodels.modules.disks import ( Disk, DiskIOCounters, DiskPartition, Disks, DiskUsage, ) FIXTURE_DISKS = Disks( devices=[ Disk( name="name", partitions=[ DiskPartition( device="device", mount_point="mountpoint", filesystem_type="fstype", options="options", max_file_size=1, max_path_length=2, usage=DiskUsage( total=1, used=2, free=3, percent=40.2, ), ), ], io_counters=DiskIOCounters( read_bytes=1, write_bytes=2, read_count=3, write_count=4, read_time=5, write_time=6, ), ) ], io_counters=DiskIOCounters( read_bytes=1, write_bytes=2, read_count=3, write_count=4, read_time=5, write_time=6, ), ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/displays.py000066400000000000000000000006161465662702600311300ustar00rootroot00000000000000"""Fixtures for displays module.""" from systembridgemodels.modules.displays import Display FIXTURE_DISPLAYS = [ Display( id="abc123", name="name", resolution_horizontal=1920, resolution_vertical=1080, x=1920, y=1080, width=1920, height=1080, is_primary=True, pixel_clock=60.0, refresh_rate=60.0, ) ] timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/gpus.py000066400000000000000000000006541465662702600302600ustar00rootroot00000000000000"""Fixtures for GPU models.""" from systembridgemodels.modules.gpus import GPU FIXTURE_GPUS = [ GPU( id="abc123", name="name", core_clock=1000.0, core_load=100.0, fan_speed=100.0, memory_clock=1000.0, memory_load=100.0, memory_free=1000.0, memory_used=1000.0, memory_total=1000.0, power_usage=100.0, temperature=100.0, ) ] timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/media.py000066400000000000000000000011771465662702600303620ustar00rootroot00000000000000"""Fixtures for media models.""" from systembridgemodels.modules.media import Media FIXTURE_MEDIA = Media( album_artist="Album Artist", album_title="Album Title", artist="Artist", duration=100, is_fast_forward_enabled=True, is_next_enabled=True, is_pause_enabled=True, is_play_enabled=True, is_previous_enabled=True, is_rewind_enabled=True, is_stop_enabled=True, playback_rate=1.0, position=100, repeat="repeat", shuffle=True, status="status", subtitle="subtitle", thumbnail="thumbnail", title="title", track_number=1, type="type", updated_at=100, ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/memory.py000066400000000000000000000010331465662702600306020ustar00rootroot00000000000000"""Fixture for memory module.""" from systembridgemodels.modules.memory import Memory, MemorySwap, MemoryVirtual FIXTURE_MEMORY = Memory( swap=MemorySwap( total=1000, used=500, free=500, percent=50.0, sin=100, sout=100, ), virtual=MemoryVirtual( total=1000, available=500, percent=50.0, used=500, free=500, active=500, inactive=500, buffers=500, cached=500, wired=500, shared=500, ), ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/networks.py000066400000000000000000000022671465662702600311600ustar00rootroot00000000000000"""Fixture for networks module.""" from systembridgemodels.modules.networks import ( Network, NetworkAddress, NetworkConnection, NetworkIO, Networks, NetworkStats, ) FIXTURE_NETWORKS = Networks( connections=[ NetworkConnection( fd=1, family=2, type=3, laddr="laddr", raddr="raddr", status="status", pid=4, ) ], io=NetworkIO( bytes_sent=1, bytes_recv=2, packets_sent=3, packets_recv=4, errin=5, errout=6, dropin=7, dropout=8, ), networks=[ Network( name="name", addresses=[ NetworkAddress( address="address", netmask="netmask", broadcast="broadcast", ptp="ptp", ) ], stats=NetworkStats( isup=True, duplex="duplex", speed=1, mtu=2, flags=[ "flag1", "flag2", ], ), ) ], ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/processes.py000066400000000000000000000005651465662702600313110ustar00rootroot00000000000000"""Fixture for processes module.""" from systembridgemodels.modules.processes import Process FIXTURE_PROCESSES = [ Process( id=1234, name="name", cpu_usage=12.3, created=12.3, memory_usage=12.3, path="/path", status="running", username="username", working_directory="/working/directory", ) ] timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/sensors.py000066400000000000000000000063701465662702600307770ustar00rootroot00000000000000"""Fixture for sensors module.""" from systembridgemodels.modules.sensors import ( Sensors, SensorsNVIDIA, SensorsNVIDIAChipset, SensorsNVIDIADisplay, SensorsNVIDIADriver, SensorsNVIDIAGPU, SensorsWindows, SensorsWindowsHardware, SensorsWindowsSensor, ) FIXTURE_SENSORS = Sensors( fans=None, temperatures=None, windows_sensors=SensorsWindows( hardware=[ SensorsWindowsHardware( id="id", name="name", type="type", subhardware=[ SensorsWindowsHardware( id="id", name="name", type="type", subhardware=[], sensors=[ SensorsWindowsSensor( id="id", name="name", type="type", value=12.3, ) ], ) ], sensors=[ SensorsWindowsSensor( id="id", name="name", type="type", value=12.3, ) ], ) ], nvidia=SensorsNVIDIA( chipset=SensorsNVIDIAChipset( id=1234, name="name", flags="flags", vendor_id=1234, vendor_name="Vendor Name", ), displays=[ SensorsNVIDIADisplay( id=1234, name="name", active=True, available=True, connected=True, dynamic=True, aspect_horizontal=16, aspect_vertical=9, brightness_current=90, brightness_default=80, brightness_max=100, brightness_min=0, color_depth="Color Depth", connection_type="Connection Type", pixel_clock=60, refresh_rate=144, resolution_horizontal=1920, resolution_vertical=1080, ) ], driver=SensorsNVIDIADriver( branch_version="Branch Version", interface_version="Interface Version", version=1234, ), gpus=[ SensorsNVIDIAGPU( id=1234, name="name", bios_oem_revision=1234, bios_revision=1234, bios_version="bios_version", current_fan_speed_level=1234, current_fan_speed_rpm=1234, driver_model=1234, memory_available=1234, memory_capacity=1234, memory_maker="Memory Maker", serial="abc123", system_type="System Type", type="Type", ) ], ), ), ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/modules/system.py000066400000000000000000000015731465662702600306270ustar00rootroot00000000000000"""Fixture for system module.""" from systembridgemodels.modules.system import RunMode, System, SystemUser FIXTURE_SYSTEM = System( boot_time=1234, fqdn="hostname.local", hostname="hostname", ip_address_4="192.168.1.100", mac_address="00:00:00:00:00:00", platform_version="1.0.0", platform="platform", run_mode=RunMode.STANDALONE, uptime=1234, users=[ SystemUser( name="username", active=True, terminal="terminal", host="host", started=1234, pid=1234, ) ], uuid="uuid", version="1.0.0", camera_usage=[ "camera1", "camera2", ], ip_address_6="::1", pending_reboot=True, version_latest_url="https://github.com/timmo001/system-bridge/releases/latest", version_latest="4.99.0", version_newer_available=True, ) timmo001-system-bridge-models-28748ca/systembridgemodels/fixtures/notification.py000066400000000000000000000007411465662702600303150ustar00rootroot00000000000000"""Fixture for notification.""" from systembridgemodels.notification import Action, Audio, Notification FIXTURE_NOTIFICATION = Notification( title="Title", message="Message", icon="https://www.example.com/icon.png", image="https://www.example.com/image.png", actions=[Action(command="COMMAND_TEST", label="LABEL_TEST", data={"test": "test"})], timeout=1000, audio=Audio( source="https://www.example.com/audio.mp3", volume=100, ), ) timmo001-system-bridge-models-28748ca/systembridgemodels/helpers.py000066400000000000000000000010771465662702600254230ustar00rootroot00000000000000"""Helper functions for systembridge models.""" from dataclasses import fields def filter_unexpected_fields(cls): """Filter unexpected fields from a dataclass. Useful when using **kwargs in __init__. """ original_init = cls.__init__ def new_init(self, *args, **kwargs): expected_fields = {field.name for field in fields(cls)} cleaned_kwargs = { key: value for key, value in kwargs.items() if key in expected_fields } original_init(self, *args, **cleaned_kwargs) cls.__init__ = new_init return cls timmo001-system-bridge-models-28748ca/systembridgemodels/keyboard_key.py000066400000000000000000000002551465662702600264260ustar00rootroot00000000000000"""Keyboard Key.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class KeyboardKey: """Keyboard Key.""" key: str timmo001-system-bridge-models-28748ca/systembridgemodels/keyboard_text.py000066400000000000000000000002601465662702600266160ustar00rootroot00000000000000"""Keyboard Text.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class KeyboardText: """Keyboard Text.""" text: str timmo001-system-bridge-models-28748ca/systembridgemodels/media_control.py000066400000000000000000000011241465662702600265710ustar00rootroot00000000000000"""Media Control.""" from __future__ import annotations from dataclasses import dataclass from enum import Enum from typing import Any class MediaAction(Enum): """Media Action.""" PLAY = "PLAY" PAUSE = "PAUSE" STOP = "STOP" PREVIOUS = "PREVIOUS" NEXT = "NEXT" SEEK = "SEEK" REWIND = "REWIND" FASTFORWARD = "FASTFORWARD" SHUFFLE = "SHUFFLE" REPEAT = "REPEAT" MUTE = "MUTE" VOLUMEDOWN = "VOLUMEDOWN" VOLUMEUP = "VOLUMEUP" @dataclass(slots=True) class MediaControl: """Media Control.""" action: str value: Any | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/media_directories.py000066400000000000000000000003001465662702600274200ustar00rootroot00000000000000"""Media directories.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class MediaDirectory: """Directory.""" key: str path: str timmo001-system-bridge-models-28748ca/systembridgemodels/media_files.py000066400000000000000000000015721465662702600262220ustar00rootroot00000000000000"""Media Files.""" from __future__ import annotations from dataclasses import dataclass from typing import cast @dataclass(slots=True) class MediaFile: """Media File.""" name: str path: str fullpath: str size: int last_accessed: float created: float modified: float is_directory: bool is_file: bool is_link: bool mime_type: str | None = None @dataclass(slots=True) class MediaFiles: """Media Files.""" files: list[MediaFile] path: str def __post_init__(self) -> None: """Post Init.""" if isinstance(self.files, list) and all( isinstance(item, dict) for item in self.files ): new_files: list[MediaFile] = [] for f in self.files: file: dict = cast(dict, f) new_files.append(MediaFile(**file)) self.files = new_files timmo001-system-bridge-models-28748ca/systembridgemodels/media_get_file.py000066400000000000000000000003001465662702600266620ustar00rootroot00000000000000"""Media Get File.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class MediaGetFile: """Media Get File.""" base: str path: str timmo001-system-bridge-models-28748ca/systembridgemodels/media_get_files.py000066400000000000000000000003211465662702600270500ustar00rootroot00000000000000"""Media Get Files.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class MediaGetFiles: """Media Get Files.""" base: str path: str | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/media_play.py000066400000000000000000000005331465662702600260610ustar00rootroot00000000000000"""Media Play.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class MediaPlay: """Media Play.""" url: str album: str | None = None artist: str | None = None autoplay: bool | None = False cover: str | None = None title: str | None = None volume: float | None = 40 timmo001-system-bridge-models-28748ca/systembridgemodels/modules/000077500000000000000000000000001465662702600250525ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/systembridgemodels/modules/__init__.py000066400000000000000000000024451465662702600271700ustar00rootroot00000000000000"""Modules.""" from __future__ import annotations from dataclasses import dataclass from enum import StrEnum from .battery import Battery from .cpu import CPU from .disks import Disks from .displays import Display from .gpus import GPU from .media import Media from .memory import Memory from .networks import Networks from .processes import Process from .sensors import Sensors from .system import System class Module(StrEnum): """Module Enum.""" BATTERY = "battery" CPU = "cpu" DISKS = "disks" DISPLAYS = "displays" GPUS = "gpus" MEDIA = "media" MEMORY = "memory" NETWORKS = "networks" PROCESSES = "processes" SENSORS = "sensors" SYSTEM = "system" @dataclass(slots=True) class GetData: """Get Data.""" modules: list[Module] @dataclass(slots=True) class RegisterDataListener(GetData): """Register Data Listener.""" @dataclass class ModulesData: """Data.""" battery: Battery | None = None cpu: CPU | None = None disks: Disks | None = None displays: list[Display] | None = None gpus: list[GPU] | None = None media: Media | None = None memory: Memory | None = None networks: Networks | None = None processes: list[Process] | None = None sensors: Sensors | None = None system: System | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/modules/battery.py000066400000000000000000000005131465662702600270750ustar00rootroot00000000000000"""Battery.""" from __future__ import annotations from dataclasses import dataclass from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class Battery: """Battery.""" is_charging: bool | None = None percentage: float | None = None time_remaining: float | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/modules/cpu.py000066400000000000000000000066051465662702600262220ustar00rootroot00000000000000"""CPU.""" from __future__ import annotations from dataclasses import dataclass from typing import cast from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class CPUFrequency: """CPU Frequency.""" current: float | None = None min: float | None = None max: float | None = None @filter_unexpected_fields @dataclass(slots=True) class CPUStats: """CPU Stats.""" ctx_switches: int | None = None interrupts: int | None = None soft_interrupts: int | None = None syscalls: int | None = None @filter_unexpected_fields @dataclass(slots=True) class CPUTimes: """CPU Times.""" user: float | None = None system: float | None = None idle: float | None = None interrupt: float | None = None dpc: float | None = None @filter_unexpected_fields @dataclass(slots=True) class PerCPU: """Per CPU.""" id: int frequency: CPUFrequency | None = None power: float | None = None times: CPUTimes | None = None times_percent: CPUTimes | None = None usage: float | None = None voltage: float | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.frequency, dict): self.frequency = CPUFrequency(**self.frequency) if isinstance(self.times, dict): self.times = CPUTimes(**self.times) if isinstance(self.times_percent, dict): self.times_percent = CPUTimes(**self.times_percent) @filter_unexpected_fields @dataclass(slots=True) class CPU: """CPU.""" count: int | None = None frequency: CPUFrequency | None = None load_average: float | None = None per_cpu: list[PerCPU] | None = None power: float | None = None stats: CPUStats | None = None temperature: float | None = None times: CPUTimes | None = None times_percent: CPUTimes | None = None usage: float | None = None voltage: float | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.frequency, dict): self.frequency = CPUFrequency(**self.frequency) if isinstance(self.per_cpu, list) and all( isinstance(item, dict) for item in self.per_cpu ): new_per_cpu: list[PerCPU] = [] for p in self.per_cpu: per_cpu: dict = cast(dict, p) frequency = per_cpu.get("frequency") times = per_cpu.get("times") times_percent = per_cpu.get("times_percent") new_per_cpu.append( PerCPU( id=per_cpu["id"], frequency=CPUFrequency(**frequency) if frequency else None, power=per_cpu["power"], times=CPUTimes(**times) if times else None, times_percent=CPUTimes(**times_percent) if times_percent else None, usage=per_cpu["usage"], voltage=per_cpu["voltage"], ) ) self.per_cpu = new_per_cpu if isinstance(self.stats, dict): self.stats = CPUStats(**self.stats) if isinstance(self.times, dict): self.times = CPUTimes(**self.times) if isinstance(self.times_percent, dict): self.times_percent = CPUTimes(**self.times_percent) timmo001-system-bridge-models-28748ca/systembridgemodels/modules/disks.py000066400000000000000000000054631465662702600265510ustar00rootroot00000000000000"""Disks.""" from __future__ import annotations from dataclasses import dataclass from typing import cast from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class DiskIOCounters: """Disk IO Counters.""" read_count: int write_count: int read_bytes: int write_bytes: int read_time: int write_time: int @filter_unexpected_fields @dataclass(slots=True) class DiskUsage: """Disk Usage.""" total: int used: int free: int percent: float @filter_unexpected_fields @dataclass(slots=True) class DiskPartition: """Disk Partition.""" device: str mount_point: str filesystem_type: str options: str max_file_size: int max_path_length: int usage: DiskUsage | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.usage, dict): self.usage = DiskUsage(**self.usage) @filter_unexpected_fields @dataclass(slots=True) class Disk: """Disk.""" name: str partitions: list[DiskPartition] io_counters: DiskIOCounters | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.partitions, list) and all( isinstance(item, dict) for item in self.partitions ): new_partitions: list[DiskPartition] = [] for p in self.partitions: partition: dict = cast(dict, p) new_partitions.append(DiskPartition(**partition)) self.partitions = new_partitions if isinstance(self.io_counters, dict): self.io_counters = DiskIOCounters(**self.io_counters) @filter_unexpected_fields @dataclass(slots=True) class Disks: """Disks.""" devices: list[Disk] io_counters: DiskIOCounters | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.devices, list) and all( isinstance(item, dict) for item in self.devices ): new_devices: list[Disk] = [] for d in self.devices: device: dict = cast(dict, d) partitions: list[DiskPartition] = [] for partition in device.get("partitions", []): partitions.append(DiskPartition(**partition)) io_counters = device.get("io_counters") new_devices.append( Disk( name=device["name"], partitions=partitions, io_counters=( DiskIOCounters(**io_counters) if io_counters else None ), ) ) self.devices = new_devices if isinstance(self.io_counters, dict): self.io_counters = DiskIOCounters(**self.io_counters) timmo001-system-bridge-models-28748ca/systembridgemodels/modules/displays.py000066400000000000000000000007611465662702600272600ustar00rootroot00000000000000"""Displays.""" from __future__ import annotations from dataclasses import dataclass from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class Display: """Display.""" id: str name: str resolution_horizontal: int resolution_vertical: int x: int y: int width: int | None = None height: int | None = None is_primary: bool | None = None pixel_clock: float | None = None refresh_rate: float | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/modules/gpus.py000066400000000000000000000011321465662702600263770ustar00rootroot00000000000000"""GPUs.""" from __future__ import annotations from dataclasses import dataclass from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class GPU: """GPU.""" id: str name: str core_clock: float | None = None core_load: float | None = None fan_speed: float | None = None memory_clock: float | None = None memory_load: float | None = None memory_free: float | None = None memory_used: float | None = None memory_total: float | None = None power_usage: float | None = None temperature: float | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/modules/media.py000066400000000000000000000017571465662702600265150ustar00rootroot00000000000000"""Media.""" from __future__ import annotations from dataclasses import dataclass from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class Media: """Media Info.""" album_artist: str | None = None album_title: str | None = None artist: str | None = None duration: float | None = None is_fast_forward_enabled: bool | None = None is_next_enabled: bool | None = None is_pause_enabled: bool | None = None is_play_enabled: bool | None = None is_previous_enabled: bool | None = None is_rewind_enabled: bool | None = None is_stop_enabled: bool | None = None playback_rate: float | None = None position: float | None = None repeat: str | None = None shuffle: bool | None = None status: str | None = None subtitle: str | None = None thumbnail: str | None = None title: str | None = None track_number: int | None = None type: str | None = None updated_at: float | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/modules/memory.py000066400000000000000000000023351465662702600267370ustar00rootroot00000000000000"""Memory.""" from __future__ import annotations from dataclasses import dataclass from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class MemorySwap: """Memory Swap.""" total: int | None = None used: int | None = None free: float | None = None percent: float | None = None sin: int | None = None sout: int | None = None @filter_unexpected_fields @dataclass(slots=True) class MemoryVirtual: """Memory Virtual.""" total: int | None = None available: int | None = None percent: float | None = None used: int | None = None free: int | None = None active: int | None = None inactive: int | None = None buffers: int | None = None cached: int | None = None wired: int | None = None shared: int | None = None @filter_unexpected_fields @dataclass(slots=True) class Memory: """Memory.""" swap: MemorySwap | None = None virtual: MemoryVirtual | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.swap, dict): self.swap = MemorySwap(**self.swap) if isinstance(self.virtual, dict): self.virtual = MemoryVirtual(**self.virtual) timmo001-system-bridge-models-28748ca/systembridgemodels/modules/networks.py000066400000000000000000000061741465662702600273100ustar00rootroot00000000000000"""Networks.""" from __future__ import annotations from dataclasses import dataclass from typing import cast from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class NetworkAddress: """Network Address.""" address: str | None = None family: str | None = None netmask: str | None = None broadcast: str | None = None ptp: str | None = None @filter_unexpected_fields @dataclass(slots=True) class NetworkStats: """Network Stats.""" isup: bool | None = None duplex: str | None = None speed: int | None = None mtu: int | None = None flags: list[str] | None = None @filter_unexpected_fields @dataclass(slots=True) class NetworkConnection: """Network Connection.""" fd: int | None = None family: int | None = None type: int | None = None laddr: str | None = None raddr: str | None = None status: str | None = None pid: int | None = None @filter_unexpected_fields @dataclass(slots=True) class NetworkIO: """Network IO.""" bytes_sent: int | None = None bytes_recv: int | None = None packets_sent: int | None = None packets_recv: int | None = None errin: int | None = None errout: int | None = None dropin: int | None = None dropout: int | None = None @filter_unexpected_fields @dataclass(slots=True) class Network: """Network.""" name: str | None = None addresses: list[NetworkAddress] | None = None stats: NetworkStats | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.addresses, list) and all( isinstance(item, dict) for item in self.addresses ): new_addresses: list[NetworkAddress] = [] for a in self.addresses: address: dict = cast(dict, a) new_addresses.append(NetworkAddress(**address)) self.addresses = new_addresses if isinstance(self.stats, dict): stats = self.stats self.stats = NetworkStats(**stats) @filter_unexpected_fields @dataclass(slots=True) class Networks: """Networks.""" connections: list[NetworkConnection] | None = None io: NetworkIO | None = None networks: list[Network] | None = None def __post_init__(self) -> None: """Post Init.""" if isinstance(self.connections, list) and all( isinstance(item, dict) for item in self.connections ): new_connections: list[NetworkConnection] = [] for c in self.connections: connection: dict = cast(dict, c) new_connections.append(NetworkConnection(**connection)) self.connections = new_connections if isinstance(self.io, dict): io = self.io self.io = NetworkIO(**io) if isinstance(self.networks, list) and all( isinstance(item, dict) for item in self.networks ): new_networks: list[Network] = [] for n in self.networks: network: dict = cast(dict, n) new_networks.append(Network(**network)) self.networks = new_networks timmo001-system-bridge-models-28748ca/systembridgemodels/modules/processes.py000066400000000000000000000007651465662702600274420ustar00rootroot00000000000000"""Processes.""" from __future__ import annotations from dataclasses import dataclass from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class Process: """Process.""" id: float name: str | None = None cpu_usage: float | None = None created: float | None = None memory_usage: float | None = None path: str | None = None status: str | None = None username: str | None = None working_directory: str | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/modules/sensors.py000066400000000000000000000121611465662702600271210ustar00rootroot00000000000000"""System.""" from __future__ import annotations from dataclasses import dataclass from typing import Any, cast from ..helpers import filter_unexpected_fields @filter_unexpected_fields @dataclass(slots=True) class SensorsWindowsSensor: """Sensors Windows Sensor.""" id: str name: str type: str value: float | int | str | None = None @filter_unexpected_fields @dataclass(slots=True) class SensorsWindowsHardware: """Sensors Windows Hardware.""" id: str name: str type: str subhardware: list[SensorsWindowsHardware] sensors: list[SensorsWindowsSensor] def __post_init__(self): """Post Init.""" if isinstance(self.subhardware, list) and all( isinstance(item, dict) for item in self.subhardware ): new_subhardware: list[SensorsWindowsHardware] = [] for s in self.subhardware: subhardware: dict = cast(dict, s) new_subhardware.append(SensorsWindowsHardware(**subhardware)) self.subhardware = new_subhardware if isinstance(self.sensors, list) and all( isinstance(item, dict) for item in self.sensors ): new_sensors: list[SensorsWindowsSensor] = [] for s in self.sensors: sensor: dict = cast(dict, s) new_sensors.append(SensorsWindowsSensor(**sensor)) self.sensors = new_sensors @filter_unexpected_fields @dataclass(slots=True) class SensorsNVIDIAChipset: """Sensors NVIDIA Chipset.""" id: int name: str flags: str vendor_id: int vendor_name: str @filter_unexpected_fields @dataclass(slots=True) class SensorsNVIDIADisplay: """Sensors NVIDIA Display.""" id: int name: str active: bool available: bool connected: bool dynamic: bool aspect_horizontal: int aspect_vertical: int brightness_current: int brightness_default: int brightness_max: int brightness_min: int color_depth: str connection_type: str pixel_clock: int refresh_rate: int resolution_horizontal: int resolution_vertical: int @filter_unexpected_fields @dataclass(slots=True) class SensorsNVIDIADriver: """Sensors NVIDIA Driver.""" branch_version: str interface_version: str version: int @filter_unexpected_fields @dataclass(slots=True) class SensorsNVIDIAGPU: """Sensors NVIDIA GPU.""" id: int name: str bios_oem_revision: int | None = None bios_revision: int | None = None bios_version: str | None = None current_fan_speed_level: int | None = None current_fan_speed_rpm: int | None = None driver_model: int | None = None memory_available: int | None = None memory_capacity: int | None = None memory_maker: str | None = None serial: str | None = None system_type: str | None = None type: str | None = None @dataclass class SensorsNVIDIA: """Sensors NVIDIA.""" chipset: SensorsNVIDIAChipset | None = None displays: list[SensorsNVIDIADisplay] | None = None driver: SensorsNVIDIADriver | None = None gpus: list[SensorsNVIDIAGPU] | None = None def __post_init__(self): """Post Init.""" if isinstance(self.chipset, dict): self.chipset = SensorsNVIDIAChipset(**self.chipset) if isinstance(self.displays, list) and all( isinstance(item, dict) for item in self.displays ): new_displays: list[SensorsNVIDIADisplay] = [] for s in self.displays: display: dict = cast(dict, s) new_displays.append(SensorsNVIDIADisplay(**display)) self.displays = new_displays if isinstance(self.driver, dict): self.driver = SensorsNVIDIADriver(**self.driver) if isinstance(self.gpus, list) and all( isinstance(item, dict) for item in self.gpus ): new_gpus: list[SensorsNVIDIAGPU] = [] for s in self.gpus: gpu: dict = cast(dict, s) new_gpus.append(SensorsNVIDIAGPU(**gpu)) self.gpus = new_gpus @dataclass class SensorsWindows: """Sensors Windows.""" hardware: list[SensorsWindowsHardware] | None = None nvidia: SensorsNVIDIA | None = None def __post_init__(self): """Post Init.""" if isinstance(self.hardware, list) and all( isinstance(item, dict) for item in self.hardware ): new_hardware: list[SensorsWindowsHardware] = [] for s in self.hardware: hardware: dict = cast(dict, s) new_hardware.append(SensorsWindowsHardware(**hardware)) self.hardware = new_hardware if isinstance(self.nvidia, dict): self.nvidia = SensorsNVIDIA(**self.nvidia) @dataclass class Sensors: """Sensors.""" # TODO: Add fan model fans: Any | None = None # TODO: Add temperatures model temperatures: Any | None = None windows_sensors: SensorsWindows | None = None def __post_init__(self): """Post Init.""" if isinstance(self.windows_sensors, dict): self.windows_sensors = SensorsWindows(**self.windows_sensors) timmo001-system-bridge-models-28748ca/systembridgemodels/modules/system.py000066400000000000000000000020051465662702600267450ustar00rootroot00000000000000"""System.""" from __future__ import annotations from dataclasses import dataclass from enum import StrEnum from ..helpers import filter_unexpected_fields class RunMode(StrEnum): """Run Mode.""" STANDALONE = "standalone" PYTHON = "python" @filter_unexpected_fields @dataclass(slots=True) class SystemUser: """System User.""" name: str active: bool terminal: str host: str started: float pid: float @filter_unexpected_fields @dataclass(slots=True) class System: """System.""" boot_time: float fqdn: str hostname: str ip_address_4: str mac_address: str platform_version: str platform: str uptime: float users: list[SystemUser] uuid: str version: str camera_usage: list[str] | None = None ip_address_6: str | None = None pending_reboot: bool | None = None run_mode: RunMode | None = None version_latest_url: str | None = None version_latest: str | None = None version_newer_available: bool | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/notification.py000066400000000000000000000022161465662702600264430ustar00rootroot00000000000000"""Notification.""" from __future__ import annotations from dataclasses import dataclass from typing import Any, cast @dataclass(slots=True) class Action: """Notification Action.""" command: str label: str data: dict[str, Any] | None = None @dataclass(slots=True) class Audio: """Notification Audio.""" source: str volume: float | None = None @dataclass(slots=True) class Notification: """Notification.""" title: str message: str | None = None icon: str | None = None image: str | None = None actions: list[Action] | None = None timeout: float | None = None audio: Audio | None = None def __post_init__(self): """Post init.""" if isinstance(self.actions, list) and all( isinstance(item, dict) for item in self.actions ): new_actions: list[Action] = [] for a in self.actions: action = cast(dict, a) new_actions.append(Action(**action)) self.actions = new_actions if isinstance(self.audio, dict): audio = cast(dict, self.audio) self.audio = Audio(**audio) timmo001-system-bridge-models-28748ca/systembridgemodels/open_path.py000066400000000000000000000002441465662702600257310ustar00rootroot00000000000000"""Open Path.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class OpenPath: """Open Path.""" path: str timmo001-system-bridge-models-28748ca/systembridgemodels/open_url.py000066400000000000000000000002401465662702600255730ustar00rootroot00000000000000"""Open URL.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class OpenUrl: """Open URL.""" url: str timmo001-system-bridge-models-28748ca/systembridgemodels/request.py000066400000000000000000000004061465662702600254440ustar00rootroot00000000000000"""Request.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Any @dataclass(slots=True) class Request: """Request.""" token: str = field(repr=False) id: str event: str data: dict[str, Any] timmo001-system-bridge-models-28748ca/systembridgemodels/response.py000066400000000000000000000005061465662702600256130ustar00rootroot00000000000000"""Response.""" from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass(slots=True) class Response: """Response.""" id: str type: str data: dict[str, Any] | list[Any] subtype: str | None = None message: str | None = None module: str | None = None timmo001-system-bridge-models-28748ca/systembridgemodels/settings.py000066400000000000000000000031131465662702600256120ustar00rootroot00000000000000"""System.""" from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from uuid import uuid4 def generate_token() -> str: """Generate token.""" return str(uuid4()) class SettingAPIEnum(Enum): """Setting API Enum.""" TOKEN = "token" PORT = "port" class SettingHotkeyEnum(Enum): """Setting Hotkey Enum.""" NAME = "name" KEY = "key" class SettingDirectoryEnum(Enum): """Setting Media Directory Enum.""" NAME = "name" PATH = "path" class SettingMediaEnum(Enum): """Setting Media Enum.""" DIRECTORIES = "directories" class SettingEnum(Enum): """Setting Enum.""" API = "api" AUTOSTART = "autostart" KEYBOARD_HOTKEYS = "keyboard_hotkeys" LOG_LEVEL = "log_level" MEDIA = "media" @dataclass class SettingsAPI: """Settings API.""" token: str = field(default_factory=generate_token) port: int = field(default=9170) @dataclass class SettingHotkey: """Setting Hotkey.""" name: str key: str @dataclass class SettingDirectory: """Setting Directory.""" name: str path: str @dataclass class SettingsMedia: """Settings Media.""" directories: list[SettingDirectory] = field(default_factory=lambda: []) @dataclass class Settings: """Settings.""" api: SettingsAPI = field(default_factory=SettingsAPI) autostart: bool = field(default=False) keyboard_hotkeys: list[SettingHotkey] = field(default_factory=lambda: []) log_level: str = field(default="INFO") media: SettingsMedia = field(default_factory=SettingsMedia) timmo001-system-bridge-models-28748ca/systembridgemodels/update.py000066400000000000000000000002371465662702600252400ustar00rootroot00000000000000"""Update.""" from __future__ import annotations from dataclasses import dataclass @dataclass(slots=True) class Update: """Update.""" version: str timmo001-system-bridge-models-28748ca/tests/000077500000000000000000000000001465662702600206375ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/tests/__init__.py000066400000000000000000000000421465662702600227440ustar00rootroot00000000000000"""System Bridge Models Tests.""" timmo001-system-bridge-models-28748ca/tests/__snapshots__/000077500000000000000000000000001465662702600234555ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_action.ambr000066400000000000000000000001641465662702600266350ustar00rootroot00000000000000# serializer version: 1 # name: test_action Action(command='command', data={'key': 'value'}, label='label') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_const.ambr000066400000000000000000000035431465662702600265120ustar00rootroot00000000000000# serializer version: 1 # name: test_model_map dict({ : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , : , }) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_keyboard_key.ambr000066400000000000000000000001171465662702600300260ustar00rootroot00000000000000# serializer version: 1 # name: test_keyboard_key KeyboardKey(key='A') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_keyboard_text.ambr000066400000000000000000000001251465662702600302210ustar00rootroot00000000000000# serializer version: 1 # name: test_keyboard_text KeyboardText(text='Test') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_media_control.ambr000066400000000000000000000001431465662702600301740ustar00rootroot00000000000000# serializer version: 1 # name: test_media_control MediaControl(action='PLAY', value=True) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_media_directories.ambr000066400000000000000000000002011465662702600310230ustar00rootroot00000000000000# serializer version: 1 # name: test_media_directories list([ MediaDirectory(key='music', path='path/to/file'), ]) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_media_files.ambr000066400000000000000000000020741465662702600276230ustar00rootroot00000000000000# serializer version: 1 # name: test_media_files MediaFiles(files=[MediaFile(name='file1', path='path/to/file1', fullpath='/full/path/to/file1', size=100, last_accessed=100.0, created=100.0, modified=100.0, is_directory=False, is_file=True, is_link=False, mime_type='text/plain')], path='path/to/file') # --- # name: test_media_files_dict dict({ 'files': list([ dict({ 'created': 100.0, 'fullpath': '/full/path/to/file1', 'is_directory': False, 'is_file': True, 'is_link': False, 'last_accessed': 100.0, 'mime_type': 'text/plain', 'modified': 100.0, 'name': 'file1', 'path': 'path/to/file1', 'size': 100, }), ]), 'path': 'path/to/file', }) # --- # name: test_media_files_dict[media-files-dict-converted] MediaFiles(files=[MediaFile(name='file1', path='path/to/file1', fullpath='/full/path/to/file1', size=100, last_accessed=100.0, created=100.0, modified=100.0, is_directory=False, is_file=True, is_link=False, mime_type='text/plain')], path='path/to/file') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_media_get_file.ambr000066400000000000000000000001541465662702600302740ustar00rootroot00000000000000# serializer version: 1 # name: test_media_get_file MediaGetFile(base='music', path='path/to/file') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_media_get_files.ambr000066400000000000000000000001561465662702600304610ustar00rootroot00000000000000# serializer version: 1 # name: test_media_get_files MediaGetFiles(base='music', path='path/to/file') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_media_play.ambr000066400000000000000000000003401465662702600274600ustar00rootroot00000000000000# serializer version: 1 # name: test_media_play MediaPlay(url='https://www.example.com/audio.mp3', album='Album', artist='Artist', autoplay=True, cover='https://www.example.com/cover.png', title='Title', volume=100) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_notification.ambr000066400000000000000000000023101465662702600300410ustar00rootroot00000000000000# serializer version: 1 # name: test_notification Notification(title='Title', message='Message', icon='https://www.example.com/icon.png', image='https://www.example.com/image.png', actions=[Action(command='COMMAND_TEST', label='LABEL_TEST', data={'test': 'test'})], timeout=1000, audio=Audio(source='https://www.example.com/audio.mp3', volume=100)) # --- # name: test_notification_dict dict({ 'actions': list([ dict({ 'command': 'COMMAND_TEST', 'data': dict({ 'test': 'test', }), 'label': 'LABEL_TEST', }), ]), 'audio': dict({ 'source': 'https://www.example.com/audio.mp3', 'volume': 100, }), 'icon': 'https://www.example.com/icon.png', 'image': 'https://www.example.com/image.png', 'message': 'Message', 'timeout': 1000, 'title': 'Title', }) # --- # name: test_notification_dict[notification-dict-converted] Notification(title='Title', message='Message', icon='https://www.example.com/icon.png', image='https://www.example.com/image.png', actions=[Action(command='COMMAND_TEST', label='LABEL_TEST', data={'test': 'test'})], timeout=1000, audio=Audio(source='https://www.example.com/audio.mp3', volume=100)) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_open_path.ambr000066400000000000000000000001261465662702600273330ustar00rootroot00000000000000# serializer version: 1 # name: test_open_path OpenPath(path='/path/to/file') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_open_url.ambr000066400000000000000000000001351465662702600272010ustar00rootroot00000000000000# serializer version: 1 # name: test_open_url OpenUrl(url='https://www.example.com') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_request.ambr000066400000000000000000000001651465662702600270510ustar00rootroot00000000000000# serializer version: 1 # name: test_request Request(id='abc123', event='EVENT_TEST', data={'test': 'test'}) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_response.ambr000066400000000000000000000002731465662702600272170ustar00rootroot00000000000000# serializer version: 1 # name: test_response Response(id='abc123', type='TYPE_TEST', data={'test': 'test'}, subtype='SUBTYPE_TEST', message='MESSAGE_TEST', module='MODULE_TEST') # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_settings.ambr000066400000000000000000000003071465662702600272170ustar00rootroot00000000000000# serializer version: 1 # name: test_settings Settings(api=SettingsAPI(token='token', port=9170), autostart=False, keyboard_hotkeys=[], log_level='INFO', media=SettingsMedia(directories=[])) # --- timmo001-system-bridge-models-28748ca/tests/__snapshots__/test_update.ambr000066400000000000000000000001211465662702600266330ustar00rootroot00000000000000# serializer version: 1 # name: test_update Update(version='4.1.1.dev0') # --- timmo001-system-bridge-models-28748ca/tests/modules/000077500000000000000000000000001465662702600223075ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/tests/modules/__init__.py000066400000000000000000000000421465662702600244140ustar00rootroot00000000000000"""System Bridge Models Tests.""" timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/000077500000000000000000000000001465662702600251255ustar00rootroot00000000000000timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_battery.ambr000066400000000000000000000001631465662702600305010ustar00rootroot00000000000000# serializer version: 1 # name: test_battery Battery(is_charging=True, percentage=98.4, time_remaining=12) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_cpu.ambr000066400000000000000000000066501465662702600276250ustar00rootroot00000000000000# serializer version: 1 # name: test_cpu CPU(count=4, frequency=CPUFrequency(current=2.3, min=0.8, max=3.1), load_average=1.5, per_cpu=[PerCPU(id=0, frequency=CPUFrequency(current=2.3, min=0.8, max=3.1), power=50.0, times=CPUTimes(user=120.0, system=30.0, idle=600.0, interrupt=0.0, dpc=0.0), times_percent=CPUTimes(user=20.0, system=5.0, idle=100.0, interrupt=0.0, dpc=0.0), usage=20.0, voltage=1.2)], power=200.0, stats=CPUStats(ctx_switches=1000, interrupts=500, soft_interrupts=200, syscalls=8000), temperature=45.0, times=CPUTimes(user=480.0, system=120.0, idle=2400.0, interrupt=0.0, dpc=0.0), times_percent=CPUTimes(user=80.0, system=20.0, idle=400.0, interrupt=0.0, dpc=0.0), usage=80.0, voltage=1.2) # --- # name: test_cpu_dict dict({ 'count': 4, 'frequency': dict({ 'current': 2.3, 'max': 3.1, 'min': 0.8, }), 'load_average': 1.5, 'per_cpu': list([ dict({ 'frequency': dict({ 'current': 2.3, 'max': 3.1, 'min': 0.8, }), 'id': 0, 'power': 50.0, 'times': dict({ 'dpc': 0.0, 'idle': 600.0, 'interrupt': 0.0, 'system': 30.0, 'user': 120.0, }), 'times_percent': dict({ 'dpc': 0.0, 'idle': 100.0, 'interrupt': 0.0, 'system': 5.0, 'user': 20.0, }), 'usage': 20.0, 'voltage': 1.2, }), ]), 'power': 200.0, 'stats': dict({ 'ctx_switches': 1000, 'interrupts': 500, 'soft_interrupts': 200, 'syscalls': 8000, }), 'temperature': 45.0, 'times': dict({ 'dpc': 0.0, 'idle': 2400.0, 'interrupt': 0.0, 'system': 120.0, 'user': 480.0, }), 'times_percent': dict({ 'dpc': 0.0, 'idle': 400.0, 'interrupt': 0.0, 'system': 20.0, 'user': 80.0, }), 'usage': 80.0, 'voltage': 1.2, }) # --- # name: test_cpu_dict[cpu-dict-converted] CPU(count=4, frequency=CPUFrequency(current=2.3, min=0.8, max=3.1), load_average=1.5, per_cpu=[PerCPU(id=0, frequency=CPUFrequency(current=2.3, min=0.8, max=3.1), power=50.0, times=CPUTimes(user=120.0, system=30.0, idle=600.0, interrupt=0.0, dpc=0.0), times_percent=CPUTimes(user=20.0, system=5.0, idle=100.0, interrupt=0.0, dpc=0.0), usage=20.0, voltage=1.2)], power=200.0, stats=CPUStats(ctx_switches=1000, interrupts=500, soft_interrupts=200, syscalls=8000), temperature=45.0, times=CPUTimes(user=480.0, system=120.0, idle=2400.0, interrupt=0.0, dpc=0.0), times_percent=CPUTimes(user=80.0, system=20.0, idle=400.0, interrupt=0.0, dpc=0.0), usage=80.0, voltage=1.2) # --- # name: test_cpu_per_cpu_dict dict({ 'frequency': dict({ 'current': 2.3, 'max': 3.1, 'min': 0.8, }), 'id': 0, 'power': 50.0, 'times': dict({ 'dpc': 0.0, 'idle': 600.0, 'interrupt': 0.0, 'system': 30.0, 'user': 120.0, }), 'times_percent': dict({ 'dpc': 0.0, 'idle': 100.0, 'interrupt': 0.0, 'system': 5.0, 'user': 20.0, }), 'usage': 20.0, 'voltage': 1.2, }) # --- # name: test_cpu_per_cpu_dict[per-cpu-dict-converted] PerCPU(id=0, frequency=CPUFrequency(current=2.3, min=0.8, max=3.1), power=50.0, times=CPUTimes(user=120.0, system=30.0, idle=600.0, interrupt=0.0, dpc=0.0), times_percent=CPUTimes(user=20.0, system=5.0, idle=100.0, interrupt=0.0, dpc=0.0), usage=20.0, voltage=1.2) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_disks.ambr000066400000000000000000000070451465662702600301520ustar00rootroot00000000000000# serializer version: 1 # name: test_disks Disks(devices=[Disk(name='name', partitions=[DiskPartition(device='device', mount_point='mountpoint', filesystem_type='fstype', options='options', max_file_size=1, max_path_length=2, usage=DiskUsage(total=1, used=2, free=3, percent=40.2))], io_counters=DiskIOCounters(read_count=3, write_count=4, read_bytes=1, write_bytes=2, read_time=5, write_time=6))], io_counters=DiskIOCounters(read_count=3, write_count=4, read_bytes=1, write_bytes=2, read_time=5, write_time=6)) # --- # name: test_disks_devices_dict dict({ 'io_counters': dict({ 'read_bytes': 1, 'read_count': 3, 'read_time': 5, 'write_bytes': 2, 'write_count': 4, 'write_time': 6, }), 'name': 'name', 'partitions': list([ dict({ 'device': 'device', 'filesystem_type': 'fstype', 'max_file_size': 1, 'max_path_length': 2, 'mount_point': 'mountpoint', 'options': 'options', 'usage': dict({ 'free': 3, 'percent': 40.2, 'total': 1, 'used': 2, }), }), ]), }) # --- # name: test_disks_devices_dict[disks-devices-dict-converted] Disk(name='name', partitions=[DiskPartition(device='device', mount_point='mountpoint', filesystem_type='fstype', options='options', max_file_size=1, max_path_length=2, usage=DiskUsage(total=1, used=2, free=3, percent=40.2))], io_counters=DiskIOCounters(read_count=3, write_count=4, read_bytes=1, write_bytes=2, read_time=5, write_time=6)) # --- # name: test_disks_devices_partition_dict dict({ 'device': 'device', 'filesystem_type': 'fstype', 'max_file_size': 1, 'max_path_length': 2, 'mount_point': 'mountpoint', 'options': 'options', 'usage': dict({ 'free': 3, 'percent': 40.2, 'total': 1, 'used': 2, }), }) # --- # name: test_disks_devices_partition_dict[disks-devices-partition-dict-converted] DiskPartition(device='device', mount_point='mountpoint', filesystem_type='fstype', options='options', max_file_size=1, max_path_length=2, usage=DiskUsage(total=1, used=2, free=3, percent=40.2)) # --- # name: test_disks_dict dict({ 'devices': list([ dict({ 'io_counters': dict({ 'read_bytes': 1, 'read_count': 3, 'read_time': 5, 'write_bytes': 2, 'write_count': 4, 'write_time': 6, }), 'name': 'name', 'partitions': list([ dict({ 'device': 'device', 'filesystem_type': 'fstype', 'max_file_size': 1, 'max_path_length': 2, 'mount_point': 'mountpoint', 'options': 'options', 'usage': dict({ 'free': 3, 'percent': 40.2, 'total': 1, 'used': 2, }), }), ]), }), ]), 'io_counters': dict({ 'read_bytes': 1, 'read_count': 3, 'read_time': 5, 'write_bytes': 2, 'write_count': 4, 'write_time': 6, }), }) # --- # name: test_disks_dict[disks-dict-converted] Disks(devices=[Disk(name='name', partitions=[DiskPartition(device='device', mount_point='mountpoint', filesystem_type='fstype', options='options', max_file_size=1, max_path_length=2, usage=DiskUsage(total=1, used=2, free=3, percent=40.2))], io_counters=DiskIOCounters(read_count=3, write_count=4, read_bytes=1, write_bytes=2, read_time=5, write_time=6))], io_counters=DiskIOCounters(read_count=3, write_count=4, read_bytes=1, write_bytes=2, read_time=5, write_time=6)) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_displays.ambr000066400000000000000000000003761465662702600306650ustar00rootroot00000000000000# serializer version: 1 # name: test_displays list([ Display(id='abc123', name='name', resolution_horizontal=1920, resolution_vertical=1080, x=1920, y=1080, width=1920, height=1080, is_primary=True, pixel_clock=60.0, refresh_rate=60.0), ]) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_gpus.ambr000066400000000000000000000004411465662702600300040ustar00rootroot00000000000000# serializer version: 1 # name: test_gpus list([ GPU(id='abc123', name='name', core_clock=1000.0, core_load=100.0, fan_speed=100.0, memory_clock=1000.0, memory_load=100.0, memory_free=1000.0, memory_used=1000.0, memory_total=1000.0, power_usage=100.0, temperature=100.0), ]) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_media.ambr000066400000000000000000000007621465662702600301130ustar00rootroot00000000000000# serializer version: 1 # name: test_media Media(album_artist='Album Artist', album_title='Album Title', artist='Artist', duration=100, is_fast_forward_enabled=True, is_next_enabled=True, is_pause_enabled=True, is_play_enabled=True, is_previous_enabled=True, is_rewind_enabled=True, is_stop_enabled=True, playback_rate=1.0, position=100, repeat='repeat', shuffle=True, status='status', subtitle='subtitle', thumbnail='thumbnail', title='title', track_number=1, type='type', updated_at=100) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_memory.ambr000066400000000000000000000020411465662702600303340ustar00rootroot00000000000000# serializer version: 1 # name: test_memory Memory(swap=MemorySwap(total=1000, used=500, free=500, percent=50.0, sin=100, sout=100), virtual=MemoryVirtual(total=1000, available=500, percent=50.0, used=500, free=500, active=500, inactive=500, buffers=500, cached=500, wired=500, shared=500)) # --- # name: test_memory_dict dict({ 'swap': dict({ 'free': 500, 'percent': 50.0, 'sin': 100, 'sout': 100, 'total': 1000, 'used': 500, }), 'virtual': dict({ 'active': 500, 'available': 500, 'buffers': 500, 'cached': 500, 'free': 500, 'inactive': 500, 'percent': 50.0, 'shared': 500, 'total': 1000, 'used': 500, 'wired': 500, }), }) # --- # name: test_memory_dict[memory-dict-converted] Memory(swap=MemorySwap(total=1000, used=500, free=500, percent=50.0, sin=100, sout=100), virtual=MemoryVirtual(total=1000, available=500, percent=50.0, used=500, free=500, active=500, inactive=500, buffers=500, cached=500, wired=500, shared=500)) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_networks.ambr000066400000000000000000000037611465662702600307120ustar00rootroot00000000000000# serializer version: 1 # name: test_networks Networks(connections=[NetworkConnection(fd=1, family=2, type=3, laddr='laddr', raddr='raddr', status='status', pid=4)], io=NetworkIO(bytes_sent=1, bytes_recv=2, packets_sent=3, packets_recv=4, errin=5, errout=6, dropin=7, dropout=8), networks=[Network(name='name', addresses=[NetworkAddress(address='address', family=None, netmask='netmask', broadcast='broadcast', ptp='ptp')], stats=NetworkStats(isup=True, duplex='duplex', speed=1, mtu=2, flags=['flag1', 'flag2']))]) # --- # name: test_networks_dict dict({ 'connections': list([ dict({ 'family': 2, 'fd': 1, 'laddr': 'laddr', 'pid': 4, 'raddr': 'raddr', 'status': 'status', 'type': 3, }), ]), 'io': dict({ 'bytes_recv': 2, 'bytes_sent': 1, 'dropin': 7, 'dropout': 8, 'errin': 5, 'errout': 6, 'packets_recv': 4, 'packets_sent': 3, }), 'networks': list([ dict({ 'addresses': list([ dict({ 'address': 'address', 'broadcast': 'broadcast', 'family': None, 'netmask': 'netmask', 'ptp': 'ptp', }), ]), 'name': 'name', 'stats': dict({ 'duplex': 'duplex', 'flags': list([ 'flag1', 'flag2', ]), 'isup': True, 'mtu': 2, 'speed': 1, }), }), ]), }) # --- # name: test_networks_dict[networks-dict-converted] Networks(connections=[NetworkConnection(fd=1, family=2, type=3, laddr='laddr', raddr='raddr', status='status', pid=4)], io=NetworkIO(bytes_sent=1, bytes_recv=2, packets_sent=3, packets_recv=4, errin=5, errout=6, dropin=7, dropout=8), networks=[Network(name='name', addresses=[NetworkAddress(address='address', family=None, netmask='netmask', broadcast='broadcast', ptp='ptp')], stats=NetworkStats(isup=True, duplex='duplex', speed=1, mtu=2, flags=['flag1', 'flag2']))]) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_processes.ambr000066400000000000000000000003631465662702600310370ustar00rootroot00000000000000# serializer version: 1 # name: test_networks list([ Process(id=1234, name='name', cpu_usage=12.3, created=12.3, memory_usage=12.3, path='/path', status='running', username='username', working_directory='/working/directory'), ]) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_sensors.ambr000066400000000000000000000123651465662702600305320ustar00rootroot00000000000000# serializer version: 1 # name: test_sensors Sensors(fans=None, temperatures=None, windows_sensors=SensorsWindows(hardware=[SensorsWindowsHardware(id='id', name='name', type='type', subhardware=[SensorsWindowsHardware(id='id', name='name', type='type', subhardware=[], sensors=[SensorsWindowsSensor(id='id', name='name', type='type', value=12.3)])], sensors=[SensorsWindowsSensor(id='id', name='name', type='type', value=12.3)])], nvidia=SensorsNVIDIA(chipset=SensorsNVIDIAChipset(id=1234, name='name', flags='flags', vendor_id=1234, vendor_name='Vendor Name'), displays=[SensorsNVIDIADisplay(id=1234, name='name', active=True, available=True, connected=True, dynamic=True, aspect_horizontal=16, aspect_vertical=9, brightness_current=90, brightness_default=80, brightness_max=100, brightness_min=0, color_depth='Color Depth', connection_type='Connection Type', pixel_clock=60, refresh_rate=144, resolution_horizontal=1920, resolution_vertical=1080)], driver=SensorsNVIDIADriver(branch_version='Branch Version', interface_version='Interface Version', version=1234), gpus=[SensorsNVIDIAGPU(id=1234, name='name', bios_oem_revision=1234, bios_revision=1234, bios_version='bios_version', current_fan_speed_level=1234, current_fan_speed_rpm=1234, driver_model=1234, memory_available=1234, memory_capacity=1234, memory_maker='Memory Maker', serial='abc123', system_type='System Type', type='Type')]))) # --- # name: test_sensors_dict dict({ 'fans': None, 'temperatures': None, 'windows_sensors': dict({ 'hardware': list([ dict({ 'id': 'id', 'name': 'name', 'sensors': list([ dict({ 'id': 'id', 'name': 'name', 'type': 'type', 'value': 12.3, }), ]), 'subhardware': list([ dict({ 'id': 'id', 'name': 'name', 'sensors': list([ dict({ 'id': 'id', 'name': 'name', 'type': 'type', 'value': 12.3, }), ]), 'subhardware': list([ ]), 'type': 'type', }), ]), 'type': 'type', }), ]), 'nvidia': dict({ 'chipset': dict({ 'flags': 'flags', 'id': 1234, 'name': 'name', 'vendor_id': 1234, 'vendor_name': 'Vendor Name', }), 'displays': list([ dict({ 'active': True, 'aspect_horizontal': 16, 'aspect_vertical': 9, 'available': True, 'brightness_current': 90, 'brightness_default': 80, 'brightness_max': 100, 'brightness_min': 0, 'color_depth': 'Color Depth', 'connected': True, 'connection_type': 'Connection Type', 'dynamic': True, 'id': 1234, 'name': 'name', 'pixel_clock': 60, 'refresh_rate': 144, 'resolution_horizontal': 1920, 'resolution_vertical': 1080, }), ]), 'driver': dict({ 'branch_version': 'Branch Version', 'interface_version': 'Interface Version', 'version': 1234, }), 'gpus': list([ dict({ 'bios_oem_revision': 1234, 'bios_revision': 1234, 'bios_version': 'bios_version', 'current_fan_speed_level': 1234, 'current_fan_speed_rpm': 1234, 'driver_model': 1234, 'id': 1234, 'memory_available': 1234, 'memory_capacity': 1234, 'memory_maker': 'Memory Maker', 'name': 'name', 'serial': 'abc123', 'system_type': 'System Type', 'type': 'Type', }), ]), }), }), }) # --- # name: test_sensors_dict[sensors-dict-converted] Sensors(fans=None, temperatures=None, windows_sensors=SensorsWindows(hardware=[SensorsWindowsHardware(id='id', name='name', type='type', subhardware=[SensorsWindowsHardware(id='id', name='name', type='type', subhardware=[], sensors=[SensorsWindowsSensor(id='id', name='name', type='type', value=12.3)])], sensors=[SensorsWindowsSensor(id='id', name='name', type='type', value=12.3)])], nvidia=SensorsNVIDIA(chipset=SensorsNVIDIAChipset(id=1234, name='name', flags='flags', vendor_id=1234, vendor_name='Vendor Name'), displays=[SensorsNVIDIADisplay(id=1234, name='name', active=True, available=True, connected=True, dynamic=True, aspect_horizontal=16, aspect_vertical=9, brightness_current=90, brightness_default=80, brightness_max=100, brightness_min=0, color_depth='Color Depth', connection_type='Connection Type', pixel_clock=60, refresh_rate=144, resolution_horizontal=1920, resolution_vertical=1080)], driver=SensorsNVIDIADriver(branch_version='Branch Version', interface_version='Interface Version', version=1234), gpus=[SensorsNVIDIAGPU(id=1234, name='name', bios_oem_revision=1234, bios_revision=1234, bios_version='bios_version', current_fan_speed_level=1234, current_fan_speed_rpm=1234, driver_model=1234, memory_available=1234, memory_capacity=1234, memory_maker='Memory Maker', serial='abc123', system_type='System Type', type='Type')]))) # --- timmo001-system-bridge-models-28748ca/tests/modules/__snapshots__/test_system.ambr000066400000000000000000000011761465662702600303600ustar00rootroot00000000000000# serializer version: 1 # name: test_system System(boot_time=1234, fqdn='hostname.local', hostname='hostname', ip_address_4='192.168.1.100', mac_address='00:00:00:00:00:00', platform_version='1.0.0', platform='platform', run_mode=, uptime=1234, users=[SystemUser(name='username', active=True, terminal='terminal', host='host', started=1234, pid=1234)], uuid='uuid', version='1.0.0', camera_usage=['camera1', 'camera2'], ip_address_6='::1', pending_reboot=True, version_latest_url='https://github.com/timmo001/system-bridge/releases/latest', version_latest='4.99.0', version_newer_available=True) # --- timmo001-system-bridge-models-28748ca/tests/modules/test_battery.py000066400000000000000000000006151465662702600253740ustar00rootroot00000000000000"""Test the battery module model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.battery import FIXTURE_BATTERY from systembridgemodels.modules.battery import Battery def test_battery(snapshot: SnapshotAssertion): """Test the battery model.""" battery = FIXTURE_BATTERY assert isinstance(battery, Battery) assert battery == snapshot timmo001-system-bridge-models-28748ca/tests/modules/test_cpu.py000066400000000000000000000022611465662702600245100ustar00rootroot00000000000000"""Test the CPU module model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.cpu import FIXTURE_CPU from systembridgemodels.modules.cpu import CPU, PerCPU def test_cpu(snapshot: SnapshotAssertion): """Test the CPU model.""" cpu = FIXTURE_CPU assert isinstance(cpu, CPU) assert cpu == snapshot def test_cpu_dict(snapshot: SnapshotAssertion): """Test CPU dict.""" cpu_dict = asdict(FIXTURE_CPU) assert isinstance(cpu_dict, dict) assert cpu_dict == snapshot cpu_converted = CPU(**cpu_dict) assert isinstance(cpu_converted, CPU) assert cpu_converted == snapshot( name="cpu-dict-converted", ) def test_cpu_per_cpu_dict(snapshot: SnapshotAssertion): """Test CPU PerCPU dict.""" assert isinstance(FIXTURE_CPU.per_cpu, list) per_cpu = FIXTURE_CPU.per_cpu[0] per_cpu_dict = asdict(per_cpu) assert isinstance(per_cpu_dict, dict) assert per_cpu_dict == snapshot per_cpu_converted = PerCPU(**per_cpu_dict) assert isinstance(per_cpu_converted, PerCPU) assert per_cpu_converted == snapshot( name="per-cpu-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/modules/test_disks.py000066400000000000000000000054431465662702600250430ustar00rootroot00000000000000"""Test the disks module model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.disks import FIXTURE_DISKS from systembridgemodels.modules.disks import ( Disk, DiskIOCounters, DiskPartition, Disks, DiskUsage, ) def _test_disk_partition(partition: DiskPartition): assert isinstance(partition, DiskPartition) assert partition.device == "device" assert partition.mount_point == "mountpoint" assert partition.filesystem_type == "fstype" assert partition.options == "options" assert partition.max_file_size == 1 assert partition.max_path_length == 2 assert isinstance(partition.usage, DiskUsage) assert partition.usage.total == 1 assert partition.usage.used == 2 assert partition.usage.free == 3 assert partition.usage.percent == 40.2 def _test_disk(disk: Disk): assert isinstance(disk, Disk) assert disk.name == "name" assert isinstance(disk.partitions, list) assert isinstance(disk.partitions[0], DiskPartition) _test_disk_partition(disk.partitions[0]) assert isinstance(disk.io_counters, DiskIOCounters) assert disk.io_counters.read_bytes == 1 assert disk.io_counters.write_bytes == 2 assert disk.io_counters.read_count == 3 assert disk.io_counters.write_count == 4 assert disk.io_counters.read_time == 5 assert disk.io_counters.write_time == 6 def test_disks(snapshot: SnapshotAssertion): """Test the disks model.""" disks = FIXTURE_DISKS assert isinstance(disks, Disks) assert disks == snapshot def test_disks_dict(snapshot: SnapshotAssertion): """Test disks dict.""" disks_dict = asdict(FIXTURE_DISKS) assert isinstance(disks_dict, dict) assert disks_dict == snapshot disks_converted = Disks(**disks_dict) assert isinstance(disks_converted, Disks) assert disks_converted == snapshot( name="disks-dict-converted", ) def test_disks_devices_dict(snapshot: SnapshotAssertion): """Test disks devices dict.""" disk_dict = asdict(FIXTURE_DISKS.devices[0]) assert isinstance(disk_dict, dict) assert disk_dict == snapshot disk_converted = Disk(**disk_dict) assert isinstance(disk_converted, Disk) assert disk_converted == snapshot( name="disks-devices-dict-converted", ) def test_disks_devices_partition_dict(snapshot: SnapshotAssertion): """Test disks devices partition dict.""" partition_dict = asdict(FIXTURE_DISKS.devices[0].partitions[0]) assert isinstance(partition_dict, dict) assert partition_dict == snapshot partition_converted = DiskPartition(**partition_dict) assert isinstance(partition_converted, DiskPartition) assert partition_converted == snapshot( name="disks-devices-partition-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/modules/test_displays.py000066400000000000000000000007001465662702600255450ustar00rootroot00000000000000"""Test the displays module model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.displays import FIXTURE_DISPLAYS from systembridgemodels.modules.displays import Display def test_displays(snapshot: SnapshotAssertion): """Test the displays model.""" displays = FIXTURE_DISPLAYS assert isinstance(displays, list) assert isinstance(displays[0], Display) assert displays == snapshot timmo001-system-bridge-models-28748ca/tests/modules/test_gpus.py000066400000000000000000000006141465662702600246770ustar00rootroot00000000000000"""Test the gpus module model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.gpus import FIXTURE_GPUS from systembridgemodels.modules.gpus import GPU def test_gpus(snapshot: SnapshotAssertion): """Test the GPUs model.""" gpus = FIXTURE_GPUS assert isinstance(gpus, list) assert isinstance(gpus[0], GPU) assert gpus == snapshot timmo001-system-bridge-models-28748ca/tests/modules/test_init.py000066400000000000000000000025671465662702600246750ustar00rootroot00000000000000"""Test the modules model.""" from systembridgemodels.modules import ( GetData, Module, ModulesData, RegisterDataListener, ) modules = [ Module.BATTERY, Module.CPU, Module.DISKS, Module.DISPLAYS, Module.GPUS, Module.MEDIA, Module.MEMORY, Module.NETWORKS, Module.PROCESSES, Module.SENSORS, Module.SYSTEM, ] def test_get_data(): """Test get data.""" get_data = GetData( modules=modules, ) assert isinstance(get_data, GetData) assert get_data.modules == modules def test_register_data_listener(): """Test register data listener.""" register_data_listener = RegisterDataListener( modules=modules, ) assert isinstance(register_data_listener, RegisterDataListener) assert register_data_listener.modules == modules def test_modules_data(): """Test modules data.""" modules_data = ModulesData() assert isinstance(modules_data, ModulesData) assert modules_data.battery is None assert modules_data.cpu is None assert modules_data.disks is None assert modules_data.displays is None assert modules_data.gpus is None assert modules_data.media is None assert modules_data.memory is None assert modules_data.networks is None assert modules_data.processes is None assert modules_data.sensors is None assert modules_data.system is None timmo001-system-bridge-models-28748ca/tests/modules/test_media.py000066400000000000000000000005651465662702600250050ustar00rootroot00000000000000"""Test the media module model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.media import FIXTURE_MEDIA from systembridgemodels.modules.media import Media def test_media(snapshot: SnapshotAssertion): """Test the media model.""" media = FIXTURE_MEDIA assert isinstance(media, Media) assert media == snapshot timmo001-system-bridge-models-28748ca/tests/modules/test_memory.py000066400000000000000000000014321465662702600252300ustar00rootroot00000000000000"""Test the memory module model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.memory import FIXTURE_MEMORY from systembridgemodels.modules.memory import Memory def test_memory(snapshot: SnapshotAssertion): """Test the memory model.""" memory = FIXTURE_MEMORY assert isinstance(memory, Memory) assert memory == snapshot def test_memory_dict(snapshot: SnapshotAssertion): """Test memory dict.""" memory_dict = asdict(FIXTURE_MEMORY) assert isinstance(memory_dict, dict) assert memory_dict == snapshot memory_converted = Memory(**memory_dict) assert isinstance(memory_converted, Memory) assert memory_converted == snapshot( name="memory-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/modules/test_networks.py000066400000000000000000000017401465662702600255760ustar00rootroot00000000000000"""Test the networks module model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.networks import FIXTURE_NETWORKS from systembridgemodels.modules.networks import NetworkConnection, Networks def test_networks(snapshot: SnapshotAssertion): """Test the networks model.""" networks = FIXTURE_NETWORKS assert isinstance(networks, Networks) assert isinstance(networks.connections, list) assert isinstance(networks.connections[0], NetworkConnection) assert networks == snapshot def test_networks_dict(snapshot: SnapshotAssertion): """Test the networks model to dict.""" networks_dict = asdict(FIXTURE_NETWORKS) assert isinstance(networks_dict, dict) assert networks_dict == snapshot networks_converted = Networks(**networks_dict) assert isinstance(networks_converted, Networks) assert networks_converted == snapshot( name="networks-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/modules/test_processes.py000066400000000000000000000007111465662702600257250ustar00rootroot00000000000000"""Test the networks module model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.processes import FIXTURE_PROCESSES from systembridgemodels.modules.processes import Process def test_networks(snapshot: SnapshotAssertion): """Test the processes model.""" processes = FIXTURE_PROCESSES assert isinstance(processes, list) assert isinstance(processes[0], Process) assert processes == snapshot timmo001-system-bridge-models-28748ca/tests/modules/test_sensors.py000066400000000000000000000015001465662702600254100ustar00rootroot00000000000000"""Test the sensors module model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.sensors import FIXTURE_SENSORS from systembridgemodels.modules.sensors import Sensors def test_sensors(snapshot: SnapshotAssertion): """Test the sensors model.""" sensors = FIXTURE_SENSORS assert isinstance(sensors, Sensors) assert sensors == snapshot def test_sensors_dict(snapshot: SnapshotAssertion): """Test the sensors model to dict.""" sensors_dict = asdict(FIXTURE_SENSORS) assert isinstance(sensors_dict, dict) assert sensors_dict == snapshot sensors_converted = Sensors(**sensors_dict) assert isinstance(sensors_converted, Sensors) assert sensors_converted == snapshot( name="sensors-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/modules/test_system.py000066400000000000000000000006031465662702600252430ustar00rootroot00000000000000"""Test the networks module model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.modules.system import FIXTURE_SYSTEM from systembridgemodels.modules.system import System def test_system(snapshot: SnapshotAssertion): """Test the system model.""" system = FIXTURE_SYSTEM assert isinstance(system, System) assert system == snapshot timmo001-system-bridge-models-28748ca/tests/test_action.py000066400000000000000000000005621465662702600235300ustar00rootroot00000000000000"""Test the action model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.action import Action def test_action(snapshot: SnapshotAssertion): """Test action.""" action = Action( command="command", data={"key": "value"}, label="label", ) assert isinstance(action, Action) assert action == snapshot timmo001-system-bridge-models-28748ca/tests/test_const.py000066400000000000000000000004131465662702600233740ustar00rootroot00000000000000"""Test const.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.const import MODEL_MAP def test_model_map(snapshot: SnapshotAssertion): """Test the model_map.""" assert isinstance(MODEL_MAP, dict) assert snapshot == MODEL_MAP timmo001-system-bridge-models-28748ca/tests/test_keyboard_key.py000066400000000000000000000005571465662702600247270ustar00rootroot00000000000000"""Test the keyboard_key model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.keyboard_key import KeyboardKey def test_keyboard_key(snapshot: SnapshotAssertion): """Test the keyboard_key.""" keyboard_key = KeyboardKey( key="A", ) assert isinstance(keyboard_key, KeyboardKey) assert keyboard_key == snapshot timmo001-system-bridge-models-28748ca/tests/test_keyboard_text.py000066400000000000000000000005751465662702600251230ustar00rootroot00000000000000"""Test the keyboard_text model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.keyboard_text import KeyboardText def test_keyboard_text(snapshot: SnapshotAssertion): """Test the keyboard_text.""" keyboard_text = KeyboardText( text="Test", ) assert isinstance(keyboard_text, KeyboardText) assert keyboard_text == snapshot timmo001-system-bridge-models-28748ca/tests/test_media_control.py000066400000000000000000000006601465662702600250710ustar00rootroot00000000000000"""Test the media_control model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.media_control import MediaAction, MediaControl def test_media_control(snapshot: SnapshotAssertion): """Test the media_control.""" media_control = MediaControl( action=MediaAction.PLAY.value, value=True, ) assert isinstance(media_control, MediaControl) assert media_control == snapshot timmo001-system-bridge-models-28748ca/tests/test_media_directories.py000066400000000000000000000010121465662702600257150ustar00rootroot00000000000000"""Test the media_directories model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.media_directories import MediaDirectory def test_media_directories(snapshot: SnapshotAssertion): """Test the media_directories.""" media_directories = [ MediaDirectory( key="music", path="path/to/file", ) ] assert isinstance(media_directories, list) assert isinstance(media_directories[0], MediaDirectory) assert media_directories == snapshot timmo001-system-bridge-models-28748ca/tests/test_media_files.py000066400000000000000000000017471465662702600245220ustar00rootroot00000000000000"""Test the media_files model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.media_files import FIXTURE_MEDIA_FILES from systembridgemodels.media_files import MediaFile, MediaFiles def test_media_files(snapshot: SnapshotAssertion): """Test the media_files.""" media_files = FIXTURE_MEDIA_FILES assert isinstance(media_files, MediaFiles) assert isinstance(media_files.files, list) assert isinstance(media_files.files[0], MediaFile) assert media_files == snapshot def test_media_files_dict(snapshot: SnapshotAssertion): """Test media files dict.""" media_files_dict = asdict(FIXTURE_MEDIA_FILES) assert isinstance(media_files_dict, dict) assert media_files_dict == snapshot media_files_converted = MediaFiles(**media_files_dict) assert isinstance(media_files_converted, MediaFiles) assert media_files_converted == snapshot( name="media-files-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/test_media_get_file.py000066400000000000000000000006421465662702600251670ustar00rootroot00000000000000"""Test the media_get_file model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.media_get_file import MediaGetFile def test_media_get_file(snapshot: SnapshotAssertion): """Test the media_get_file.""" media_get_file = MediaGetFile( base="music", path="path/to/file", ) assert isinstance(media_get_file, MediaGetFile) assert media_get_file == snapshot timmo001-system-bridge-models-28748ca/tests/test_media_get_files.py000066400000000000000000000006541465662702600253550ustar00rootroot00000000000000"""Test the media_get_files model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.media_get_files import MediaGetFiles def test_media_get_files(snapshot: SnapshotAssertion): """Test the media_get_files.""" media_get_files = MediaGetFiles( base="music", path="path/to/file", ) assert isinstance(media_get_files, MediaGetFiles) assert media_get_files == snapshot timmo001-system-bridge-models-28748ca/tests/test_media_play.py000066400000000000000000000010401465662702600243470ustar00rootroot00000000000000"""Test the media_play model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.media_play import MediaPlay def test_media_play(snapshot: SnapshotAssertion): """Test the media_play.""" media_play = MediaPlay( url="https://www.example.com/audio.mp3", album="Album", artist="Artist", autoplay=True, cover="https://www.example.com/cover.png", title="Title", volume=100, ) assert isinstance(media_play, MediaPlay) assert media_play == snapshot timmo001-system-bridge-models-28748ca/tests/test_notification.py000066400000000000000000000016171465662702600247430ustar00rootroot00000000000000"""Test the OpenPath model.""" from dataclasses import asdict from syrupy.assertion import SnapshotAssertion from systembridgemodels.fixtures.notification import FIXTURE_NOTIFICATION from systembridgemodels.notification import Notification def test_notification(snapshot: SnapshotAssertion): """Test the notification.""" notification = FIXTURE_NOTIFICATION assert isinstance(notification, Notification) assert notification == snapshot def test_notification_dict(snapshot: SnapshotAssertion): """Test notification dict.""" notification_dict = asdict(FIXTURE_NOTIFICATION) assert isinstance(notification_dict, dict) assert notification_dict == snapshot notification_converted = Notification(**notification_dict) assert isinstance(notification_converted, Notification) assert notification_converted == snapshot( name="notification-dict-converted", ) timmo001-system-bridge-models-28748ca/tests/test_open_path.py000066400000000000000000000005351465662702600242300ustar00rootroot00000000000000"""Test the OpenPath model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.open_path import OpenPath def test_open_path(snapshot: SnapshotAssertion): """Test the open_path.""" open_path = OpenPath( path="/path/to/file", ) assert isinstance(open_path, OpenPath) assert open_path == snapshot timmo001-system-bridge-models-28748ca/tests/test_open_url.py000066400000000000000000000005341465662702600240750ustar00rootroot00000000000000"""Test the OpenUrl model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.open_url import OpenUrl def test_open_url(snapshot: SnapshotAssertion): """Test the open_url.""" open_url = OpenUrl( url="https://www.example.com", ) assert isinstance(open_url, OpenUrl) assert open_url == snapshot timmo001-system-bridge-models-28748ca/tests/test_request.py000066400000000000000000000006271465662702600237450ustar00rootroot00000000000000"""Test the request model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.request import Request def test_request(snapshot: SnapshotAssertion): """Test the request.""" request = Request( token="abc123", id="abc123", event="EVENT_TEST", data={"test": "test"}, ) assert isinstance(request, Request) assert request == snapshot timmo001-system-bridge-models-28748ca/tests/test_response.py000066400000000000000000000007451465662702600241140ustar00rootroot00000000000000"""Test the response model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.response import Response def test_response(snapshot: SnapshotAssertion): """Test the response.""" response = Response( id="abc123", type="TYPE_TEST", data={"test": "test"}, subtype="SUBTYPE_TEST", message="MESSAGE_TEST", module="MODULE_TEST", ) assert isinstance(response, Response) assert response == snapshot timmo001-system-bridge-models-28748ca/tests/test_settings.py000066400000000000000000000010031465662702600241020ustar00rootroot00000000000000"""Test the settings model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels.settings import Settings, SettingsAPI def test_settings(snapshot: SnapshotAssertion): """Test the settings.""" settings = Settings( api=SettingsAPI( token="token", ), ) assert isinstance(settings, Settings) assert settings == snapshot def test_settings_token(): """Test the settings token.""" settings = Settings() assert settings.api.token != "" timmo001-system-bridge-models-28748ca/tests/test_update.py000066400000000000000000000005771465662702600235430ustar00rootroot00000000000000"""Test the update model.""" from syrupy.assertion import SnapshotAssertion from systembridgemodels._version import __version__ from systembridgemodels.update import Update def test_update(snapshot: SnapshotAssertion): """Test the update.""" update = Update( version=__version__.public(), ) assert isinstance(update, Update) assert update == snapshot timmo001-system-bridge-models-28748ca/tests/test_version.py000066400000000000000000000002541465662702600237360ustar00rootroot00000000000000"""Test version.""" from systembridgemodels._version import __version__ def test_version(): """Test the version.""" assert isinstance(__version__.public(), str)