diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index c6e7763..0000000 --- a/.gitattributes +++ /dev/null @@ -1,42 +0,0 @@ -# Auto detect text files and normalize line endings to LF -* text=auto - -# Python files -*.py text eol=lf -*.pyx text eol=lf -*.pyi text eol=lf - -# Shell scripts -*.sh text eol=lf -*.bash text eol=lf - -# Windows batch files -*.bat text eol=crlf -*.cmd text eol=crlf -*.ps1 text eol=crlf - -# Config files -*.json text eol=lf -*.toml text eol=lf -*.yaml text eol=lf -*.yml text eol=lf -*.ini text eol=lf -*.cfg text eol=lf - -# Documentation -*.md text eol=lf -README text eol=lf -LICENSE text eol=lf - -# Binary files -*.db binary -*.sqlite binary -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.webp binary -*.mov binary -*.mp4 binary -*.webm binary -*.pdf binary diff --git a/.github/workflows/smoke-mm.yml b/.github/workflows/smoke-mm.yml deleted file mode 100644 index ae3d108..0000000 --- a/.github/workflows/smoke-mm.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: smoke-mm - -on: - pull_request: - push: - branches: - - main - -jobs: - smoke: - name: Install & smoke test mm --help - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Create venv and install - run: | - python -m venv venv - . venv/bin/activate - python -m pip install -U pip - python -m pip install -e . - - - name: Run smoke test (mm --help) - run: | - . venv/bin/activate - mm --help diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d77c823..0000000 --- a/.gitignore +++ /dev/null @@ -1,240 +0,0 @@ -# ---> Python -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class -config.conf -config.d/ -# 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 -test_* -# 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 -cookies.txt -# Installer logs -pip-log.txt -pip-delete-this-directory.txt -backup/ -# 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 -config.conf -config.d/ -# 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 - -# UV -# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -#uv.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/latest/usage/project/#working-with-version-control -.pdm.toml -.pdm-python -.pdm-build/ - -# 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/ - -# Ruff stuff: -.ruff_cache/ - -# PyPI configuration file -.pypirc - -# ---> Lua -# Compiled Lua sources -luac.out - -# luarocks build files -*.src.rock -*.zip -*.tar.gz - -# Object files -*.o -*.os -*.ko -*.obj -*.elf - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo -*.def -*.exp - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - - -config.conf -config.d/ -MPV/ffmpeg/* - -Log/ -Log/medeia_macina/telegram.session -*.session -example.py -test* -MPV/portable_config/watch_later* -hydrusnetwork -.style.yapf -.yapfignore -tests/ -scripts/mm.ps1 -scripts/mm -.style.yapf -.yapfignore - - diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index cb73650..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "editor.formatOnSave": true, - "editor.defaultFormatter": "ms-python.python", - - "python.formatting.provider": "yapf", - "python.formatting.yapfArgs": ["--style", ".style.yapf"], - - "[python]": { - "editor.defaultFormatter": "ms-python.python", - "editor.formatOnSave": true - } -} diff --git a/tests/test_pipeline_state.py b/tests/test_pipeline_state.py deleted file mode 100644 index f08606e..0000000 --- a/tests/test_pipeline_state.py +++ /dev/null @@ -1,114 +0,0 @@ -import pytest - -from SYS import pipeline as ctx - - -def test_new_pipeline_state_isolation(): - # Ensure we start with a clean baseline - ctx.reset() - ctx.set_last_items(["global"]) - assert ctx.get_last_items() == ["global"] - - with ctx.new_pipeline_state(): - # New state should be fresh - assert ctx.get_last_items() == [] - ctx.set_last_items(["inner1"]) - assert ctx.get_last_items() == ["inner1"] - - with ctx.new_pipeline_state(): - # Nested fresh state - assert ctx.get_last_items() == [] - ctx.set_last_items(["inner2"]) - assert ctx.get_last_items() == ["inner2"] - - # After exiting inner, outer new state should still have its values - assert ctx.get_last_items() == ["inner1"] - - # After all contexts exit, global state remains unchanged - assert ctx.get_last_items() == ["global"] - - -def test_display_overlay_priority_and_restore(): - ctx.reset() - - # Set a base last result table and items - ctx.set_last_result_table("table-a", ["a1", "a2"], subject="sub-a") - assert ctx.get_last_result_items() == ["a1", "a2"] - - # Overlay should take precedence for selection - ctx.set_last_result_table_overlay("table-b", ["b1"], subject="sub-b") - assert ctx.get_last_result_items() == ["b1"] - assert ctx.get_last_result_subject() == "sub-b" - - # Restoring previous should revert to base - assert ctx.restore_previous_result_table() is True - assert ctx.get_last_result_items() == ["a1", "a2"] - assert ctx.get_last_result_subject() == "sub-a" - - -def test_pipeline_runner_snapshot_restore(): - from TUI.pipeline_runner import PipelineRunner - - runner = PipelineRunner() - ctx.reset() - - # Seed state with a few values - ctx.set_last_result_table("table-x", ["x1", "x2"], subject="sx") - ctx.set_last_items(["L1"]) - ctx.set_current_cmdlet_name("cmd-name") - ctx.set_pending_pipeline_tail([["stage1"], ["stage2"]], source_command="source") - - snap = runner._snapshot_ctx_state() - - # Mutate state - ctx.clear_last_result() - ctx.set_last_items([]) - ctx.set_current_cmdlet_name("other") - ctx.clear_pending_pipeline_tail() - - # Restore and verify - runner._restore_ctx_state(snap) - assert ctx.get_last_result_items() == ["x1", "x2"] - assert ctx.get_last_items() == ["L1"] - assert ctx.get_current_cmdlet_name() == "cmd-name" - assert ctx.get_pending_pipeline_tail() == [["stage1"], ["stage2"]] - - -def test_preserve_history_no_push(): - ctx.reset() - - ctx.set_last_result_table("t1", ["a"], subject="s1") - # Push second table - ctx.set_last_result_table("t2", ["b"], subject="s2") - state = ctx.get_pipeline_state() - assert len(state.result_table_history) == 1 - - # Preserve history update should NOT push a new history entry - ctx.set_last_result_table_preserve_history("t2b", ["c"], subject="s2b") - assert len(state.result_table_history) == 1 - assert ctx.get_last_result_items() == ["c"] - - -def test_forward_and_restore(): - ctx.reset() - - ctx.set_last_result_table("t1", ["a"], subject="s1") - ctx.set_last_result_table("t2", ["b"], subject="s2") - - assert ctx.restore_previous_result_table() is True - assert ctx.get_last_result_items() == ["a"] - - assert ctx.restore_next_result_table() is True - assert ctx.get_last_result_items() == ["b"] - - -def test_display_items_priority(): - ctx.reset() - - ctx.set_last_result_table("base", ["x1", "x2"]) - ctx.set_last_result_items_only(["d1", "d2"]) - - # display items take priority for selection - assert ctx.get_last_result_items() == ["d1", "d2"] - # but selectable items should ignore display-only items - assert ctx.get_last_selectable_result_items() == ["x1", "x2"]