unref 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unref-0.2.1 → unref-0.2.2}/Cargo.lock +1 -1
- {unref-0.2.1 → unref-0.2.2}/Cargo.toml +6 -1
- {unref-0.2.1 → unref-0.2.2}/PKG-INFO +4 -4
- {unref-0.2.1 → unref-0.2.2}/README.md +3 -3
- {unref-0.2.1 → unref-0.2.2}/docs/configuration.md +25 -1
- {unref-0.2.1 → unref-0.2.2}/docs/index.md +1 -1
- {unref-0.2.1 → unref-0.2.2}/linters/cspell/words.txt +8 -0
- {unref-0.2.1 → unref-0.2.2}/pyproject.toml +2 -0
- {unref-0.2.1 → unref-0.2.2}/scripts/benchmark.py +2 -1
- {unref-0.2.1 → unref-0.2.2}/src/classes.rs +167 -35
- {unref-0.2.1 → unref-0.2.2}/src/config.rs +48 -12
- {unref-0.2.1 → unref-0.2.2}/src/definitions.rs +3 -0
- {unref-0.2.1 → unref-0.2.2}/src/engine.rs +8 -3
- {unref-0.2.1 → unref-0.2.2}/src/frameworks.rs +358 -39
- {unref-0.2.1 → unref-0.2.2}/src/models.rs +4 -1
- {unref-0.2.1 → unref-0.2.2}/src/references.rs +50 -7
- {unref-0.2.1 → unref-0.2.2}/src/symbols.rs +4 -5
- {unref-0.2.1 → unref-0.2.2}/tests/_cli/test_config.py +18 -1
- unref-0.2.2/tests/cases/external_missing_star/.venv/lib/python3.15/site-packages/pkg/__init__.py +3 -0
- unref-0.2.2/tests/cases/external_missing_star/.venv/lib/python3.15/site-packages/pkg/optional.py +2 -0
- unref-0.2.2/tests/cases/external_missing_star/.venv/lib/python3.15/site-packages/pkg/other.py +5 -0
- unref-0.2.2/tests/cases/external_missing_star/main.py +20 -0
- unref-0.2.2/tests/cases/external_missing_star/pyproject.toml +3 -0
- unref-0.2.2/tests/cases/frameworks_django/manage.py +16 -0
- unref-0.2.2/tests/cases/frameworks_django/mysite/asgi.py +11 -0
- unref-0.2.2/tests/cases/frameworks_django/mysite/base.py +5 -0
- unref-0.2.2/tests/cases/frameworks_django/mysite/settings.py +14 -0
- unref-0.2.2/tests/cases/frameworks_django/mysite/urls.py +12 -0
- unref-0.2.2/tests/cases/frameworks_django/mysite/wsgi.py +8 -0
- unref-0.2.2/tests/cases/frameworks_django/other/settings.py +3 -0
- unref-0.2.2/tests/cases/frameworks_django/other/urls.py +2 -0
- unref-0.2.2/tests/cases/frameworks_django/polls/apps.py +20 -0
- unref-0.2.2/tests/cases/frameworks_django/polls/urls.py +12 -0
- unref-0.2.2/tests/cases/frameworks_django/polls/views.py +6 -0
- unref-0.2.2/tests/cases/frameworks_django_settings/config/settings/local.py +2 -0
- unref-0.2.2/tests/cases/frameworks_django_settings/config/settings/production.py +5 -0
- unref-0.2.2/tests/cases/frameworks_django_settings/config/urls.py +1 -0
- unref-0.2.2/tests/cases/frameworks_django_settings/pyproject.toml +2 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_flask/app.py +25 -3
- unref-0.2.2/tests/cases/frameworks_flask/cli.py +79 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_flask/views.py +4 -0
- unref-0.2.2/tests/cases/frameworks_flask/wsgi.py +17 -0
- unref-0.2.2/tests/cases/frameworks_pydantic/.venv/pyvenv.cfg +3 -0
- unref-0.2.2/tests/cases/override_base_class/star_cycle.py +14 -0
- unref-0.2.2/tests/cases/override_base_class/stars/__init__.py +3 -0
- unref-0.2.2/tests/cases/override_base_class/stars/first.py +1 -0
- unref-0.2.2/tests/cases/override_base_class/stars/second.py +7 -0
- unref-0.2.2/tests/cases/override_base_class_external/vendored/__init__.py +0 -0
- unref-0.2.2/tests/cases/package/pkg/__init__.py +0 -0
- unref-0.2.2/tests/cases/package/pkg/sub/__init__.py +0 -0
- unref-0.2.2/tests/cases/standard_library/.venv/lib/python3.13/os.py +0 -0
- unref-0.2.2/tests/cases/standard_library/.venv/lib/python3.14/os.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {unref-0.2.1 → unref-0.2.2}/.github/actionlint.yaml +0 -0
- {unref-0.2.1 → unref-0.2.2}/.github/workflows/ci.yml +0 -0
- {unref-0.2.1 → unref-0.2.2}/.github/workflows/release.yml +0 -0
- {unref-0.2.1 → unref-0.2.2}/.github/workflows/util/setup_python/action.yml +0 -0
- {unref-0.2.1 → unref-0.2.2}/.gitignore +0 -0
- {unref-0.2.1 → unref-0.2.2}/.pre-commit-hooks.yaml +0 -0
- {unref-0.2.1 → unref-0.2.2}/.readthedocs.yaml +0 -0
- {unref-0.2.1 → unref-0.2.2}/CONTRIBUTING.md +0 -0
- {unref-0.2.1 → unref-0.2.2}/LICENSE +0 -0
- {unref-0.2.1 → unref-0.2.2}/assets/benchmark.svg +0 -0
- {unref-0.2.1 → unref-0.2.2}/docs/rules.md +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/cspell.json +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/mypy.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/ruff.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/taplo.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/ty.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/unref.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/linters/yamllint.yaml +0 -0
- {unref-0.2.1 → unref-0.2.2}/prek.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/scripts/ecosystem.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/scripts/release.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/discover.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/external.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/files.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/ignores.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/main.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/modules.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/positions.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/src/transitive.rs +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/_cli/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/_cli/_files.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/_cli/test_environment.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/_cli/test_general.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/_cli/test_output.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/_unref.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/all_exports/all_exports.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/all_exports/all_exports_forms.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/all_exports/all_exports_forms_annotated.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/all_exports/all_exports_not_strings.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/all_exports/string_not_in_all.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/ast_node_visitor/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/local.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/pkg/mod.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/pkg/other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/pkg/sibling.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/attribute_of_module/pkg/third.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/columns/ascii.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/columns/cp1252.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/columns/euc_jp.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/columns/latin1.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/columns/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/columns/utf8.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/compiled_submodule_star/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/compiled_submodule_star/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/config_in_parent/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/config_in_parent/scripts/tool.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/config_in_parent/src/app/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/config_in_parent/src/app/cli.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/config_in_parent/src/app/skip.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/decorated_function/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/default_excluded/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/default_excluded/node_modules/use.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/assignment_to_other_object.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/attribute_read.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/class_.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/class_attribute.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/method_called.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/method_without_self.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/name_read.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/nested_function.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/property_setter.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/recursive_function.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/definitions/type_alias.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/dummy_variable_rgx/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/dummy_variable_rgx/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/dunders/dunder_function.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/dunders/dunder_method.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/dunders/dunder_variable.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/dunders/not_dunder.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/empty_file/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/entry_points/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/entry_points/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/entry_points/pkg/gui.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/entry_points/pkg/plugins.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/entry_points/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/enum_members/enums.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/enum_members/fruits/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/enum_members/fruits/enums.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/enum_members/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude/generated/deep/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude/generated/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude/pkg/generated/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude/single.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude_patterns/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude_patterns/node_modules/use.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude_patterns/pkg/fixtures/use.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude_patterns/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude_patterns/scripts/keep.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/exclude_patterns/scripts/one.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class/reexport.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_getattr/lazy.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_getattr/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_getattr/not_lazy.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_nested/lazy.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_nested/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_nested/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_nested/reexport.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_nested/vendored/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_base_class_nested/vendored/outer.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/bin/python +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/lib/python3.15/site-packages/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/lib/python3.15/site-packages/pkg/dotted.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/lib/python3.15/site-packages/pkg/other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/lib/python3.15/site-packages/pkg/stable.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/lib/python3.15/site-packages/pkg/tagged.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/.venv/pyvenv.cfg +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_compiled_star/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/bin/python +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/lib/python3.15/site-packages/editable.pth +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/lib/python3.15/site-packages/project_only/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/lib/python3.15/site-packages/project_only/types.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/lib/python3.15/site-packages/unreadable.pth/README.txt +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/pythonpath/project_only/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/pythonpath/project_only/types.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/pyvenv.cfg +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/.venv/src/editable_module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/external_environment/pyproject.toml +0 -0
- {unref-0.2.1/tests/cases/frameworks_pydantic → unref-0.2.2/tests/cases/external_missing_star}/.venv/pyvenv.cfg +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_dataclasses/models.py +0 -0
- {unref-0.2.1/tests/cases/hidden_directory/pkg → unref-0.2.2/tests/cases/frameworks_django/mysite}/__init__.py +0 -0
- {unref-0.2.1/tests/cases/namespace_package/pkg → unref-0.2.2/tests/cases/frameworks_django/other}/__init__.py +0 -0
- {unref-0.2.1/tests/cases/override_base_class_external/vendored → unref-0.2.2/tests/cases/frameworks_django/polls}/__init__.py +0 -0
- {unref-0.2.1/tests/cases/package/pkg → unref-0.2.2/tests/cases/frameworks_django_settings/config}/__init__.py +0 -0
- {unref-0.2.1/tests/cases/package/pkg/sub → unref-0.2.2/tests/cases/frameworks_django_settings/config/settings}/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_fastapi/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_fastapi/routers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_fastapi/test_local.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/bin/python +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/deprecated/class_validators.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/fields.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/functional_serializers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/functional_validators.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/v1/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic/v1/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic_settings/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/.venv/lib/python3.15/site-packages/pydantic_settings/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pydantic/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/bases.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/tests/conftest.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/tests/module_test.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/tests/test_asyncio.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/tests/test_inheritance.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_pytest/tests/test_module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_selected/docs/conf.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_selected/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_selected/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_selected/test_module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sphinx/docs/conf.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sphinx/other/conf.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sphinx/settings.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sphinx_configuration/docs/source/conf.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sphinx_configuration/other/conf.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sphinx_configuration/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sqlalchemy/chained.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sqlalchemy/legacy.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sqlalchemy/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_sqlalchemy/other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_unittest/base.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_unittest/checks.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_unittest/mixins.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/frameworks_unittest/testsuite.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/function/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/.gitignore +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/generated/use.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/nested/.gitignore +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/nested/scratch_nested.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/scratch_kept.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/gitignore/scratch_one.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/hidden_directory/.github/scripts/run.py +0 -0
- /unref-0.2.1/tests/cases/standard_library/.venv/lib/python3.13/os.py → /unref-0.2.2/tests/cases/hidden_directory/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/hidden_directory/pkg/util.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/ignore_comment/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/ignore_comment/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/ignore_comment/without_comment.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/ignore_comment_invalid/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/function_only_imported.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/function_only_imported_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_from_module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_from_module_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_from_module_other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_from_package.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_from_package_pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_from_package_pkg/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_lazy.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_lazy_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_lazy_other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_relative_pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_relative_pkg/helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_relative_pkg/sub/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_relative_pkg/sub/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_star.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_star_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_star_scope.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_star_scope_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_star_with_all.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_star_with_all_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_unresolved.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/import_unresolved_other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/reexport_same_name.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/reexport_same_name_pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/reexport_same_name_pkg/colors.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/reexport_same_name_pkg/tool.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/same_name_in_other_module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/imports/same_name_in_other_module_other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/class_body_read.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_class_body.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_closure.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_comprehension.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_comprehension_unpacking.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_default.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_function.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_function_closure.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_function_global.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_function_nonlocal.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_global.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_import.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_lambda.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_match.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_parameter.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_targets.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_variable.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/local_scopes/local_variable_read.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/match_class_pattern/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/match_class_pattern/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_class.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_external_base.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_metaclass.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_mixin.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_name_imported.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_name_imported_jobs.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_name_read.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_private_helper.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_protocol.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_self.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_super.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_template_method.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_unknown_base.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/member_unknown_receiver.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/same_name_elsewhere.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/shapes/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/member_receivers/shapes/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/method/main.py +0 -0
- /unref-0.2.1/tests/cases/standard_library/.venv/lib/python3.14/os.py → /unref-0.2.2/tests/cases/namespace_package/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/namespace_package/pkg/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/namespace_package/pkg/sub/deeper/mod.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/namespace_package/pkg/sub/mod.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/namespace_package/top/inner/mod.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/namespace_package/top/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/non_python_file/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/non_python_file/notes.txt +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override/conftest.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override/src/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override/tests/test_module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override/tests/unit/test_unit.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/children.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/cycle_first.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/cycle_second.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/pkg/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/pkg/base.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_and_path/models/model.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_and_path/other.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_and_path/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_external/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_external/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_external/vendored/base.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_external/vendored/broken.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_base_class_external/vendored/namespace/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_class_decorator/decorators.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_class_decorator/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_class_decorator/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_class_decorator_and_base_class/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/override_class_decorator_and_base_class/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/package/pkg/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/package/pkg/sub/module.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_annotation.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_annotation_nested.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_annotation_self.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_cast.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_plain_string.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_type_alias.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/quoted_annotations/quoted_type_var.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/reexport_cycle/first/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/reexport_cycle/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/reexport_cycle/second/__init__.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/reexport_cycle/second/values.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/standard_library/.venv/lib/python3.13/handlers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/standard_library/.venv/lib/python3.14/handlers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/standard_library/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/standard_library/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/syntax_error/bad.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/syntax_error/good.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/syntax_error/undecodable.txt +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/syntax_error/unknown_encoding.txt +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/syntax_warning/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/transitive.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/used_only_by_unused.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/used_only_by_unused_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/used_only_by_unused_star.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/used_only_by_unused_star_helpers.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/used_only_by_unused_star_star.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/transitive/used_only_by_unused_star_star_used.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/typed_dict/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/typed_dict/models.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/used_decorator/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/used_decorator/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/used_name/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/used_name/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/used_only_by_unused_root/main.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/used_only_by_unused_root/pyproject.toml +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/dummy_variable.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/instance_attribute.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/instance_attribute_declared.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/underscore.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_for_loop.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_in_block.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_only_written.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_reassigned.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_unpacking.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_walrus.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/cases/variables/variable_with.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/pytest.ini +0 -0
- {unref-0.2.1 → unref-0.2.2}/tests/test_cases.py +0 -0
- {unref-0.2.1 → unref-0.2.2}/uv.lock +0 -0
- {unref-0.2.1 → unref-0.2.2}/zensical.toml +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "unref"
|
|
3
3
|
# The release workflow sets the version from the tag that it releases.
|
|
4
|
-
version = "0.2.
|
|
4
|
+
version = "0.2.2"
|
|
5
5
|
edition = "2024"
|
|
6
6
|
rust-version = "1.97"
|
|
7
7
|
description = "Find unreferenced Python code"
|
|
@@ -31,6 +31,11 @@ ruff_text_size = { git = "https://github.com/astral-sh/ruff", tag = "0.17.5" }
|
|
|
31
31
|
lto = "fat"
|
|
32
32
|
codegen-units = 16
|
|
33
33
|
|
|
34
|
+
# For the builds of uv, which skip LTO to rebuild in seconds. The binary runs about 10 to 15% slower.
|
|
35
|
+
[profile.local]
|
|
36
|
+
inherits = "release"
|
|
37
|
+
lto = "off"
|
|
38
|
+
|
|
34
39
|
[lints.rust]
|
|
35
40
|
unsafe_code = "forbid"
|
|
36
41
|
unreachable_pub = "warn"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unref
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: Topic :: Software Development :: Quality Assurance
|
|
@@ -37,12 +37,12 @@ An extremely fast Python dead code finder, written in Rust.
|
|
|
37
37
|
</p>
|
|
38
38
|
|
|
39
39
|
<p align="center">
|
|
40
|
-
<i>Checking the whole <a href="https://github.com/python/cpython">CPython</a> codebase (v3.15.0, about 2,300 files),
|
|
40
|
+
<i>Checking the whole <a href="https://github.com/python/cpython">CPython</a> codebase (v3.15.0, about 2,300 Python files),
|
|
41
41
|
measured with <a href="https://github.com/Apakottur/unref/blob/main/scripts/benchmark.py"><code>scripts/benchmark.py</code></a>.</i>
|
|
42
42
|
</p>
|
|
43
43
|
|
|
44
|
-
- **Fast**: 20x faster than [vulture](https://github.com/jendrikseipp/vulture), it checks all of CPython
|
|
45
|
-
second.
|
|
44
|
+
- **Fast**: 20x faster than [vulture](https://github.com/jendrikseipp/vulture), it checks all of CPython's Python code in
|
|
45
|
+
under a second.
|
|
46
46
|
- **Just works**: built-in rules for pytest, Pydantic, SQLAlchemy and
|
|
47
47
|
[more](https://unref.readthedocs.io/en/latest/configuration/#frameworks), so most projects need little or no
|
|
48
48
|
configuration.
|
|
@@ -12,12 +12,12 @@ An extremely fast Python dead code finder, written in Rust.
|
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
|
-
<i>Checking the whole <a href="https://github.com/python/cpython">CPython</a> codebase (v3.15.0, about 2,300 files),
|
|
15
|
+
<i>Checking the whole <a href="https://github.com/python/cpython">CPython</a> codebase (v3.15.0, about 2,300 Python files),
|
|
16
16
|
measured with <a href="https://github.com/Apakottur/unref/blob/main/scripts/benchmark.py"><code>scripts/benchmark.py</code></a>.</i>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
- **Fast**: 20x faster than [vulture](https://github.com/jendrikseipp/vulture), it checks all of CPython
|
|
20
|
-
second.
|
|
19
|
+
- **Fast**: 20x faster than [vulture](https://github.com/jendrikseipp/vulture), it checks all of CPython's Python code in
|
|
20
|
+
under a second.
|
|
21
21
|
- **Just works**: built-in rules for pytest, Pydantic, SQLAlchemy and
|
|
22
22
|
[more](https://unref.readthedocs.io/en/latest/configuration/#frameworks), so most projects need little or no
|
|
23
23
|
configuration.
|
|
@@ -158,7 +158,12 @@ Enabled by default: yes.
|
|
|
158
158
|
Enabled by default: yes.
|
|
159
159
|
|
|
160
160
|
- Functions and methods with a route, error or request decorator, such as `app.route` or
|
|
161
|
-
`bp.errorhandler`, of
|
|
161
|
+
`bp.errorhandler`, of `Flask()` or `Blueprint()`, or an instance of a subclass, set at module level or
|
|
162
|
+
in the same function, of a module-level variable set to what a factory makes, or of `current_app`.
|
|
163
|
+
- Commands of `cli.command` and `cli.group` of these, and of `command` and `group` of an `AppGroup()`
|
|
164
|
+
or of such a group.
|
|
165
|
+
- Module-level `create_app` and `make_app` functions that make a `Flask()`, and module-level `app` and
|
|
166
|
+
`application` variables set to `Flask()` or to what such a factory makes.
|
|
162
167
|
- HTTP method handlers of `MethodView` subclasses, and `dispatch_request` of `View` subclasses.
|
|
163
168
|
|
|
164
169
|
#### `sphinx`
|
|
@@ -176,6 +181,25 @@ The configuration files are each `conf.py` that sets `project`, `extensions` or
|
|
|
176
181
|
configuration = ["docs/conf.py"]
|
|
177
182
|
```
|
|
178
183
|
|
|
184
|
+
#### `django`
|
|
185
|
+
|
|
186
|
+
Enabled by default: yes.
|
|
187
|
+
|
|
188
|
+
- In settings modules: module-level uppercase names, such as `DEBUG`.
|
|
189
|
+
- In the module that `ROOT_URLCONF` names: `urlpatterns` and `handler400`, `handler403`, `handler404`,
|
|
190
|
+
`handler500`.
|
|
191
|
+
- In modules that `include("...")` names: `urlpatterns` and `app_name`.
|
|
192
|
+
- Module-level variables set to `get_wsgi_application()` or `get_asgi_application()`.
|
|
193
|
+
- Subclasses of `AppConfig`, with their `ready` method and attributes such as `name`.
|
|
194
|
+
|
|
195
|
+
The settings modules are those that `os.environ.setdefault("DJANGO_SETTINGS_MODULE", ...)` names, those
|
|
196
|
+
that `settings` names, and the modules they star import. A table turns the rules on:
|
|
197
|
+
|
|
198
|
+
```toml
|
|
199
|
+
[tool.unref.frameworks.django]
|
|
200
|
+
settings = ["config/settings/production.py"]
|
|
201
|
+
```
|
|
202
|
+
|
|
179
203
|
### `output-format`
|
|
180
204
|
|
|
181
205
|
How the findings are printed, as [Ruff's option](https://docs.astral.sh/ruff/settings/#output-format).
|
|
@@ -80,6 +80,6 @@ Unused code piles up in every codebase, faster than ever now that AI tools write
|
|
|
80
80
|
in another.
|
|
81
81
|
- **Ruff-style**: same conventions, options and output style, ty-style rule codes and configuration in
|
|
82
82
|
`pyproject.toml`.
|
|
83
|
-
- **Fast**: written in Rust on Ruff's parser, it checks all of CPython in under a second.
|
|
83
|
+
- **Fast**: written in Rust on Ruff's parser, it checks all of CPython's Python code in under a second.
|
|
84
84
|
|
|
85
85
|
The name is short for "unreferenced".
|
|
@@ -4,6 +4,7 @@ anyio
|
|
|
4
4
|
Apakottur
|
|
5
5
|
appcontext
|
|
6
6
|
asdict
|
|
7
|
+
asgi
|
|
7
8
|
asname
|
|
8
9
|
asyncio
|
|
9
10
|
attribs
|
|
@@ -19,6 +20,7 @@ dataclass
|
|
|
19
20
|
dataclasses
|
|
20
21
|
deadcode
|
|
21
22
|
delenv
|
|
23
|
+
Deque
|
|
22
24
|
direnv
|
|
23
25
|
docstrings
|
|
24
26
|
dunder
|
|
@@ -36,6 +38,7 @@ httpx
|
|
|
36
38
|
ignorelist
|
|
37
39
|
isenabled
|
|
38
40
|
isort
|
|
41
|
+
isupper
|
|
39
42
|
kwonlyargs
|
|
40
43
|
longpaths
|
|
41
44
|
lucide
|
|
@@ -50,6 +53,7 @@ mkdocstrings
|
|
|
50
53
|
modifyitems
|
|
51
54
|
musllinux
|
|
52
55
|
mypy
|
|
56
|
+
mysite
|
|
53
57
|
pathlib
|
|
54
58
|
pathspec
|
|
55
59
|
peekable
|
|
@@ -81,6 +85,7 @@ shpyx
|
|
|
81
85
|
skylos
|
|
82
86
|
softprops
|
|
83
87
|
sqlalchemy
|
|
88
|
+
startproject
|
|
84
89
|
staticmethod
|
|
85
90
|
strerror
|
|
86
91
|
subclassing
|
|
@@ -90,6 +95,9 @@ Tarjan
|
|
|
90
95
|
typer
|
|
91
96
|
typeshed
|
|
92
97
|
unref
|
|
98
|
+
URLCONF
|
|
99
|
+
urlpatterns
|
|
93
100
|
vararg
|
|
94
101
|
venv
|
|
102
|
+
wsgi
|
|
95
103
|
Yossi
|
|
@@ -4,7 +4,8 @@ Time unref on the CPython codebase.
|
|
|
4
4
|
|
|
5
5
|
Run with `uv run scripts/benchmark.py COMMAND`. Each command downloads the source of CPython and times on it:
|
|
6
6
|
|
|
7
|
-
- `tools`: unref and other dead code finders, drawn as a bar chart in `assets/benchmark.svg`.
|
|
7
|
+
- `tools`: unref and other dead code finders, drawn as a bar chart in `assets/benchmark.svg`. uv builds unref without
|
|
8
|
+
LTO, so first rebuild it with `CARGO_PROFILE_LOCAL_LTO=fat uv sync --reinstall-package unref`.
|
|
8
9
|
- `compare BASE HEAD REPORT`: two unref binaries, written as a Markdown report that the CI posts on each PR.
|
|
9
10
|
"""
|
|
10
11
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//! The classes of a project, with the base classes that they inherit from and their decorators.
|
|
2
2
|
|
|
3
3
|
use std::cell::RefCell;
|
|
4
|
+
use std::collections::VecDeque;
|
|
4
5
|
use std::path::PathBuf;
|
|
5
6
|
use std::rc::Rc;
|
|
6
7
|
use std::sync::Arc;
|
|
@@ -34,6 +35,16 @@ pub(crate) struct ClassHierarchy {
|
|
|
34
35
|
resolved_decorators: Cache,
|
|
35
36
|
resolved: Cache,
|
|
36
37
|
followed: RefCell<FxHashMap<String, Names>>,
|
|
38
|
+
star_imported: RefCell<FxHashMap<String, Rc<StarImport>>>,
|
|
39
|
+
located: RefCell<FxHashMap<String, Located>>,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// A name that a module may star import, followed through the star imports of the modules.
|
|
43
|
+
struct StarImport {
|
|
44
|
+
/// The names on the way to the modules that give the name out, with the names in those modules.
|
|
45
|
+
names: FxHashSet<String>,
|
|
46
|
+
/// The names in the modules that give the name out, which are followed further from there.
|
|
47
|
+
sources: Vec<String>,
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
impl ClassHierarchy {
|
|
@@ -60,6 +71,8 @@ impl ClassHierarchy {
|
|
|
60
71
|
resolved_decorators: RefCell::default(),
|
|
61
72
|
resolved: RefCell::default(),
|
|
62
73
|
followed: RefCell::default(),
|
|
74
|
+
star_imported: RefCell::default(),
|
|
75
|
+
located: RefCell::default(),
|
|
63
76
|
}
|
|
64
77
|
}
|
|
65
78
|
|
|
@@ -77,7 +90,7 @@ impl ClassHierarchy {
|
|
|
77
90
|
let mut found = FxHashSet::default();
|
|
78
91
|
let symbols = self.module(module);
|
|
79
92
|
for base in symbols.bases.get(name).into_iter().flatten() {
|
|
80
|
-
|
|
93
|
+
self.resolve_written(module, base, &mut seen, &mut found);
|
|
81
94
|
}
|
|
82
95
|
found
|
|
83
96
|
})
|
|
@@ -125,7 +138,9 @@ impl ClassHierarchy {
|
|
|
125
138
|
/// imported through several modules has the name of each.
|
|
126
139
|
pub(crate) fn resolve(&self, module: usize, written: &str) -> Names {
|
|
127
140
|
cached(&self.resolved, module, written, || {
|
|
128
|
-
|
|
141
|
+
let mut found = FxHashSet::default();
|
|
142
|
+
self.resolve_written(module, written, &mut FxHashSet::default(), &mut found);
|
|
143
|
+
found
|
|
129
144
|
})
|
|
130
145
|
}
|
|
131
146
|
|
|
@@ -135,82 +150,156 @@ impl ClassHierarchy {
|
|
|
135
150
|
if let Some(found) = self.followed.borrow().get(name) {
|
|
136
151
|
return found.clone();
|
|
137
152
|
}
|
|
138
|
-
let found =
|
|
153
|
+
let mut found = FxHashSet::default();
|
|
154
|
+
self.follow(name, &mut FxHashSet::default(), &mut found);
|
|
155
|
+
let found = Rc::new(found);
|
|
139
156
|
self.followed
|
|
140
157
|
.borrow_mut()
|
|
141
158
|
.insert(name.to_string(), found.clone());
|
|
142
159
|
found
|
|
143
160
|
}
|
|
144
161
|
|
|
145
|
-
///
|
|
162
|
+
/// Add the dotted names of a base class or decorator, as it is written in a module, and of the
|
|
146
163
|
/// base classes of a base class.
|
|
147
164
|
fn resolve_written(
|
|
148
165
|
&self,
|
|
149
166
|
module: usize,
|
|
150
167
|
written: &str,
|
|
151
168
|
seen: &mut FxHashSet<String>,
|
|
152
|
-
|
|
169
|
+
found: &mut FxHashSet<String>,
|
|
170
|
+
) {
|
|
153
171
|
let symbols = self.module(module);
|
|
154
172
|
let (first, rest) = written.split_once('.').unwrap_or((written, ""));
|
|
155
173
|
|
|
156
174
|
if symbols.bases.contains_key(first) {
|
|
157
175
|
// A class or function of the module itself.
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if let Some(binding) = symbols.bindings.get(first) {
|
|
176
|
+
self.follow(&format!("{}.{written}", symbols.name.name), seen, found);
|
|
177
|
+
} else if let Some(binding) = symbols.bindings.get(first) {
|
|
162
178
|
// A name that the module imports.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
179
|
+
if let Some(imported) = imported(&symbols, binding) {
|
|
180
|
+
self.follow(&join(&imported, rest), seen, found);
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
// A builtin, or a name that the module does not define at its top level.
|
|
184
|
+
found.insert(written.to_string());
|
|
167
185
|
}
|
|
168
|
-
|
|
169
|
-
// A builtin, or a name that the module does not define at its top level.
|
|
170
|
-
FxHashSet::from_iter([written.to_string()])
|
|
171
186
|
}
|
|
172
187
|
|
|
173
|
-
///
|
|
188
|
+
/// Add a dotted name, and the dotted names of what it stands for in the project: the base classes
|
|
174
189
|
/// of a class, and the origin of an imported name.
|
|
175
|
-
|
|
190
|
+
///
|
|
191
|
+
/// The names are added to one set as they are found, rather than returned and copied at each step
|
|
192
|
+
/// of a long chain of imports.
|
|
193
|
+
fn follow(&self, name: &str, seen: &mut FxHashSet<String>, found: &mut FxHashSet<String>) {
|
|
176
194
|
if !seen.insert(name.to_string()) {
|
|
177
|
-
return
|
|
195
|
+
return;
|
|
178
196
|
}
|
|
179
197
|
|
|
180
|
-
|
|
198
|
+
found.insert(name.to_string());
|
|
181
199
|
for (file, symbol) in self.locate(name) {
|
|
182
200
|
let symbols = self.module(file);
|
|
183
201
|
let (first, rest) = symbol.split_once('.').unwrap_or((&symbol, ""));
|
|
184
202
|
if let Some(bases) = symbols.bases.get(&symbol) {
|
|
185
203
|
for base in bases {
|
|
186
|
-
|
|
204
|
+
self.resolve_written(file, base, seen, found);
|
|
187
205
|
}
|
|
188
206
|
} else if let Some(binding) = symbols.bindings.get(first) {
|
|
189
207
|
if let Some(imported) = imported(&symbols, binding) {
|
|
190
|
-
|
|
208
|
+
self.follow(&join(&imported, rest), seen, found);
|
|
191
209
|
}
|
|
192
210
|
} else if !symbols.bases.contains_key(first) {
|
|
193
|
-
// A name that the module may star import.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
.
|
|
198
|
-
|
|
199
|
-
.map(|(source, level)| symbols.name.resolve(source.as_deref(), *level))
|
|
200
|
-
.collect();
|
|
201
|
-
if !star_modules.contains(&Some(format!("{}.{first}", symbols.name.name))) {
|
|
202
|
-
for star_module in star_modules.into_iter().flatten() {
|
|
203
|
-
found.extend(self.follow(&format!("{star_module}.{symbol}"), seen));
|
|
211
|
+
// A name that the module may star import.
|
|
212
|
+
for star_module in star_modules(&symbols, first) {
|
|
213
|
+
let star = self.star_imported(&join(star_module, &symbol));
|
|
214
|
+
found.extend(star.names.iter().cloned());
|
|
215
|
+
for source in &star.sources {
|
|
216
|
+
self.follow(source, seen, found);
|
|
204
217
|
}
|
|
205
218
|
}
|
|
206
219
|
// A name that the `__getattr__` of the module imports, which it gives out.
|
|
207
220
|
for binding in symbols.lazy.get(first).into_iter().flatten() {
|
|
208
221
|
if let Some(imported) = imported(&symbols, binding) {
|
|
209
|
-
|
|
222
|
+
self.follow(&join(&imported, rest), seen, found);
|
|
210
223
|
}
|
|
211
224
|
}
|
|
212
225
|
}
|
|
213
226
|
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/// Follow a name through the star imports of the modules, to the modules that give it out.
|
|
230
|
+
///
|
|
231
|
+
/// `name` is a name in a module that the module may star import, such as `package.Model` when
|
|
232
|
+
/// `package` star imports `package.models`, which defines `Model`. A module gives out a name that
|
|
233
|
+
/// it defines, imports or gives out from its `__getattr__`. A module that is not found, such as a
|
|
234
|
+
/// compiled one, may give out any name.
|
|
235
|
+
///
|
|
236
|
+
/// The star imports of a package often import the package back, so they are followed through
|
|
237
|
+
/// their cycles once for each name, rather than once for each class that reads the name.
|
|
238
|
+
fn star_imported(&self, name: &str) -> Rc<StarImport> {
|
|
239
|
+
if let Some(found) = self.star_imported.borrow().get(name) {
|
|
240
|
+
return found.clone();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// The name that each name is first star imported by, which is on the shortest way to it. The
|
|
244
|
+
// other ways go round a cycle, through names that are no more the name than the shortest.
|
|
245
|
+
let mut importers: FxHashMap<String, Option<String>> = FxHashMap::default();
|
|
246
|
+
importers.insert(name.to_string(), None);
|
|
247
|
+
let mut pending = VecDeque::from([name.to_string()]);
|
|
248
|
+
let mut sources = Vec::new();
|
|
249
|
+
while let Some(current) = pending.pop_front() {
|
|
250
|
+
let located = self.locate(¤t);
|
|
251
|
+
if located.is_empty() {
|
|
252
|
+
sources.push(current);
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
let mut gives_out = false;
|
|
256
|
+
for (file, symbol) in located {
|
|
257
|
+
let symbols = self.module(file);
|
|
258
|
+
let first = symbol
|
|
259
|
+
.split_once('.')
|
|
260
|
+
.map_or(symbol.as_str(), |(first, _)| first);
|
|
261
|
+
if symbols.bases.contains_key(&symbol)
|
|
262
|
+
|| symbols.bindings.contains_key(first)
|
|
263
|
+
|| symbols.lazy.contains_key(first)
|
|
264
|
+
{
|
|
265
|
+
gives_out = true;
|
|
266
|
+
} else if !symbols.bases.contains_key(first) {
|
|
267
|
+
for star_module in star_modules(&symbols, first) {
|
|
268
|
+
// A star import of a module that is not found gives out no names. Its name
|
|
269
|
+
// would otherwise be looked for in the package above it, which can star import
|
|
270
|
+
// it again, with a longer name each time.
|
|
271
|
+
if !self.exists(star_module) {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
let imported = join(star_module, &symbol);
|
|
275
|
+
if !importers.contains_key(&imported) {
|
|
276
|
+
importers.insert(imported.clone(), Some(current.clone()));
|
|
277
|
+
pending.push_back(imported);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if gives_out {
|
|
283
|
+
sources.push(current);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// The names on the shortest way to each module that gives the name out. A name that leads to
|
|
288
|
+
// none is not a name of it.
|
|
289
|
+
let mut names: FxHashSet<String> = FxHashSet::default();
|
|
290
|
+
for source in &sources {
|
|
291
|
+
let mut current = Some(source);
|
|
292
|
+
while let Some(name) = current
|
|
293
|
+
&& names.insert(name.clone())
|
|
294
|
+
{
|
|
295
|
+
current = importers[name].as_ref();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
let found = Rc::new(StarImport { names, sources });
|
|
300
|
+
self.star_imported
|
|
301
|
+
.borrow_mut()
|
|
302
|
+
.insert(name.to_string(), found.clone());
|
|
214
303
|
found
|
|
215
304
|
}
|
|
216
305
|
|
|
@@ -221,8 +310,28 @@ impl ClassHierarchy {
|
|
|
221
310
|
/// longest one that is a module outside the project. A module outside the project without a source,
|
|
222
311
|
/// such as a compiled module, has no file, and a shorter start is not taken in its place.
|
|
223
312
|
fn locate(&self, name: &str) -> Vec<(usize, String)> {
|
|
313
|
+
let Some((module, last)) = name.rsplit_once('.') else {
|
|
314
|
+
return Vec::new();
|
|
315
|
+
};
|
|
316
|
+
let cached = self.located.borrow().get(module).cloned();
|
|
317
|
+
let located = cached.unwrap_or_else(|| {
|
|
318
|
+
let located: Located = self.locate_module(module).into();
|
|
319
|
+
self.located
|
|
320
|
+
.borrow_mut()
|
|
321
|
+
.insert(module.to_string(), located.clone());
|
|
322
|
+
located
|
|
323
|
+
});
|
|
324
|
+
located
|
|
325
|
+
.iter()
|
|
326
|
+
.map(|(file, rest)| (*file, join(rest, last)))
|
|
327
|
+
.collect()
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/// Get the modules that the longest start of a dotted name is, as `locate` takes them, each with
|
|
331
|
+
/// the rest of the name.
|
|
332
|
+
fn locate_module(&self, name: &str) -> Vec<(usize, String)> {
|
|
224
333
|
let parts: Vec<&str> = name.split('.').collect();
|
|
225
|
-
let starts: Vec<(String, String)> = (1
|
|
334
|
+
let starts: Vec<(String, String)> = (1..=parts.len())
|
|
226
335
|
.rev()
|
|
227
336
|
.map(|index| (parts[..index].join("."), parts[index..].join(".")))
|
|
228
337
|
.collect();
|
|
@@ -243,6 +352,11 @@ impl ClassHierarchy {
|
|
|
243
352
|
Vec::new()
|
|
244
353
|
}
|
|
245
354
|
|
|
355
|
+
/// Tell whether a module is found, in the project or outside it.
|
|
356
|
+
fn exists(&self, name: &str) -> bool {
|
|
357
|
+
self.files_by_name.contains_key(name) || self.external.borrow_mut().exists(name)
|
|
358
|
+
}
|
|
359
|
+
|
|
246
360
|
/// Get the module that is imported from outside the project by its name, and add its symbols to
|
|
247
361
|
/// those of the project.
|
|
248
362
|
fn read_external(&self, name: &str) -> Option<usize> {
|
|
@@ -259,6 +373,9 @@ impl ClassHierarchy {
|
|
|
259
373
|
}
|
|
260
374
|
}
|
|
261
375
|
|
|
376
|
+
/// The modules that a dotted name is in, each with the rest of the name in the module.
|
|
377
|
+
type Located = Rc<[(usize, String)]>;
|
|
378
|
+
|
|
262
379
|
/// A cache of sets of dotted names, by a module and a name in it.
|
|
263
380
|
type Cache = RefCell<FxHashMap<(usize, String), Names>>;
|
|
264
381
|
|
|
@@ -281,6 +398,21 @@ fn cached(
|
|
|
281
398
|
found
|
|
282
399
|
}
|
|
283
400
|
|
|
401
|
+
/// Get the modules that a module star imports, to look up a name in them by its first part.
|
|
402
|
+
///
|
|
403
|
+
/// A star import of a submodule binds the submodule itself under its name, so that name is the
|
|
404
|
+
/// submodule and not one that a star import gives out.
|
|
405
|
+
fn star_modules<'a>(module: &'a ModuleSymbols, first: &str) -> &'a [String] {
|
|
406
|
+
if module
|
|
407
|
+
.stars
|
|
408
|
+
.binary_search(&format!("{}.{first}", module.name.name))
|
|
409
|
+
.is_ok()
|
|
410
|
+
{
|
|
411
|
+
return &[];
|
|
412
|
+
}
|
|
413
|
+
&module.stars
|
|
414
|
+
}
|
|
415
|
+
|
|
284
416
|
/// Get the dotted name that an imported name of a module stands for.
|
|
285
417
|
fn imported(module: &ModuleSymbols, binding: &Binding) -> Option<String> {
|
|
286
418
|
let source = module
|
|
@@ -43,6 +43,8 @@ pub(crate) struct Config {
|
|
|
43
43
|
pub frameworks: FxHashMap<Framework, bool>,
|
|
44
44
|
/// The configuration files of Sphinx, or None to find them by their contents.
|
|
45
45
|
pub sphinx_configuration: Option<Vec<PathBuf>>,
|
|
46
|
+
/// The settings modules of Django that are given, besides those that are found.
|
|
47
|
+
pub django_settings: Vec<PathBuf>,
|
|
46
48
|
/// How the findings are printed.
|
|
47
49
|
pub output_format: OutputFormat,
|
|
48
50
|
/// Whether the unused definitions that only other unused definitions reach are printed too.
|
|
@@ -64,6 +66,7 @@ impl Default for Config {
|
|
|
64
66
|
entry_points: Vec::new(),
|
|
65
67
|
frameworks: FxHashMap::default(),
|
|
66
68
|
sphinx_configuration: None,
|
|
69
|
+
django_settings: Vec::new(),
|
|
67
70
|
output_format: OutputFormat::Concise,
|
|
68
71
|
show_transitive: false,
|
|
69
72
|
root: PathBuf::from("."),
|
|
@@ -100,6 +103,11 @@ pub(crate) fn load_config(path: Option<&Path>) -> Result<Config, String> {
|
|
|
100
103
|
if let Some(files) = &mut config.sphinx_configuration {
|
|
101
104
|
*files = files.iter().map(|file| root.join(file)).collect();
|
|
102
105
|
}
|
|
106
|
+
config.django_settings = config
|
|
107
|
+
.django_settings
|
|
108
|
+
.iter()
|
|
109
|
+
.map(|file| root.join(file))
|
|
110
|
+
.collect();
|
|
103
111
|
config.root = root;
|
|
104
112
|
}
|
|
105
113
|
Ok(config)
|
|
@@ -297,7 +305,11 @@ fn parse(options: &Table, path: &Path) -> Result<Config, String> {
|
|
|
297
305
|
|
|
298
306
|
let show_transitive = bool_option(options, "show-transitive", &place)?.unwrap_or(false);
|
|
299
307
|
|
|
300
|
-
let
|
|
308
|
+
let Frameworks {
|
|
309
|
+
enabled: frameworks,
|
|
310
|
+
sphinx_configuration,
|
|
311
|
+
django_settings,
|
|
312
|
+
} = parse_frameworks(options, &place)?;
|
|
301
313
|
|
|
302
314
|
Ok(Config {
|
|
303
315
|
used_names: string_list(options, "used-names", &place)?,
|
|
@@ -311,6 +323,7 @@ fn parse(options: &Table, path: &Path) -> Result<Config, String> {
|
|
|
311
323
|
dummy_variable_rgx,
|
|
312
324
|
frameworks,
|
|
313
325
|
sphinx_configuration,
|
|
326
|
+
django_settings,
|
|
314
327
|
output_format,
|
|
315
328
|
show_transitive,
|
|
316
329
|
..Config::default()
|
|
@@ -359,16 +372,23 @@ fn parse_override(options: &Table, path: &Path) -> Result<Override, String> {
|
|
|
359
372
|
})
|
|
360
373
|
}
|
|
361
374
|
|
|
362
|
-
/// The frameworks
|
|
363
|
-
|
|
375
|
+
/// The `frameworks` table of a configuration file.
|
|
376
|
+
#[derive(Default)]
|
|
377
|
+
struct Frameworks {
|
|
378
|
+
/// Whether the rules of each framework apply, for the frameworks that the table sets.
|
|
379
|
+
enabled: FxHashMap<Framework, bool>,
|
|
380
|
+
/// The configuration files of Sphinx, if they are set.
|
|
381
|
+
sphinx_configuration: Option<Vec<PathBuf>>,
|
|
382
|
+
/// The settings modules of Django that are given.
|
|
383
|
+
django_settings: Vec<PathBuf>,
|
|
384
|
+
}
|
|
364
385
|
|
|
365
386
|
/// Get the `frameworks` table, which maps the name of a framework to whether its rules apply. Sphinx
|
|
366
|
-
/// can instead have a table of
|
|
387
|
+
/// and Django can instead have a table of their settings, which turns their rules on.
|
|
367
388
|
fn parse_frameworks(options: &Table, place: &str) -> Result<Frameworks, String> {
|
|
368
|
-
let mut frameworks =
|
|
369
|
-
let mut sphinx_configuration = None;
|
|
389
|
+
let mut frameworks = Frameworks::default();
|
|
370
390
|
let table = match options.get("frameworks") {
|
|
371
|
-
None => return Ok(
|
|
391
|
+
None => return Ok(frameworks),
|
|
372
392
|
Some(Value::Table(table)) => table,
|
|
373
393
|
Some(_) => return Err(format!("Option 'frameworks' in {place} must be a table")),
|
|
374
394
|
};
|
|
@@ -383,15 +403,20 @@ fn parse_frameworks(options: &Table, place: &str) -> Result<Frameworks, String>
|
|
|
383
403
|
known.join(", ")
|
|
384
404
|
));
|
|
385
405
|
};
|
|
406
|
+
let has_table = matches!(framework, Framework::Sphinx | Framework::Django);
|
|
386
407
|
match value {
|
|
387
408
|
Value::Boolean(value) => {
|
|
388
|
-
frameworks.insert(framework, *value);
|
|
409
|
+
frameworks.enabled.insert(framework, *value);
|
|
389
410
|
}
|
|
390
411
|
Value::Table(settings) if framework == Framework::Sphinx => {
|
|
391
|
-
frameworks.insert(framework, true);
|
|
392
|
-
sphinx_configuration = parse_sphinx(settings, place)?;
|
|
412
|
+
frameworks.enabled.insert(framework, true);
|
|
413
|
+
frameworks.sphinx_configuration = parse_sphinx(settings, place)?;
|
|
393
414
|
}
|
|
394
|
-
|
|
415
|
+
Value::Table(settings) if framework == Framework::Django => {
|
|
416
|
+
frameworks.enabled.insert(framework, true);
|
|
417
|
+
frameworks.django_settings = parse_django(settings, place)?;
|
|
418
|
+
}
|
|
419
|
+
_ if has_table => {
|
|
395
420
|
return Err(format!(
|
|
396
421
|
"Option 'frameworks.{name}' in {place} must be a boolean or a table"
|
|
397
422
|
));
|
|
@@ -403,7 +428,7 @@ fn parse_frameworks(options: &Table, place: &str) -> Result<Frameworks, String>
|
|
|
403
428
|
}
|
|
404
429
|
}
|
|
405
430
|
}
|
|
406
|
-
Ok(
|
|
431
|
+
Ok(frameworks)
|
|
407
432
|
}
|
|
408
433
|
|
|
409
434
|
/// Get the `configuration` option of the `frameworks.sphinx` table: the configuration files of Sphinx,
|
|
@@ -422,6 +447,17 @@ fn parse_sphinx(table: &Table, place: &str) -> Result<Option<Vec<PathBuf>>, Stri
|
|
|
422
447
|
))
|
|
423
448
|
}
|
|
424
449
|
|
|
450
|
+
/// Get the `settings` option of the `frameworks.django` table: the settings modules of Django, by
|
|
451
|
+
/// their files.
|
|
452
|
+
fn parse_django(table: &Table, place: &str) -> Result<Vec<PathBuf>, String> {
|
|
453
|
+
let place = format!("the 'frameworks.django' table of {place}");
|
|
454
|
+
check_names(table, &["settings"], &place)?;
|
|
455
|
+
Ok(string_list(table, "settings", &place)?
|
|
456
|
+
.into_iter()
|
|
457
|
+
.map(PathBuf::from)
|
|
458
|
+
.collect())
|
|
459
|
+
}
|
|
460
|
+
|
|
425
461
|
/// Check that every option is a known one.
|
|
426
462
|
fn check_names(options: &Table, known: &[&str], place: &str) -> Result<(), String> {
|
|
427
463
|
match options.keys().find(|name| !known.contains(&name.as_str())) {
|
|
@@ -76,6 +76,9 @@ pub(crate) struct Definition {
|
|
|
76
76
|
/// what it calls as it is written, such as `mapped_column` for `mapped_column(Integer)`, or None
|
|
77
77
|
/// if the value is not a call of a dotted name.
|
|
78
78
|
pub call: Option<String>,
|
|
79
|
+
/// For a variable or an attribute that is first assigned a string literal, its value, such as
|
|
80
|
+
/// `project.urls` for `ROOT_URLCONF = "project.urls"`.
|
|
81
|
+
pub string: Option<String>,
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
impl Definition {
|