From 397cb1cae47494cf210043995c05d64101578579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hakan=20=C3=87elik?= Date: Sun, 17 Jul 2022 13:57:50 +0300 Subject: [PATCH] Add __all__ to top-level modules --- refactor/__init__.py | 12 ++++++++++++ refactor/ast.py | 9 +++++++++ refactor/change.py | 2 ++ refactor/common.py | 17 +++++++++++++++++ refactor/context.py | 12 ++++++++++++ refactor/core.py | 9 +++++++++ refactor/runner.py | 2 ++ refactor/validate_inputs.py | 2 ++ 8 files changed, 65 insertions(+) diff --git a/refactor/__init__.py b/refactor/__init__.py index dfddaa5..b1bd7cb 100644 --- a/refactor/__init__.py +++ b/refactor/__init__.py @@ -8,6 +8,18 @@ ) from refactor.runner import run +__all__ = [ + "Configuration", + "Context", + "Representative", + "Action", + "NewStatementAction", + "ReplacementAction", + "Rule", + "Session", + "run", +] + def _check_asserts(): import sys diff --git a/refactor/ast.py b/refactor/ast.py index eee9424..4088fc0 100644 --- a/refactor/ast.py +++ b/refactor/ast.py @@ -9,6 +9,15 @@ from refactor import common +__all__ = [ + "BaseUnparser", + "Lines", + "PreciseUnparser", + "UNPARSER_BACKENDS", + "Unparser", + "split_lines", +] + @dataclass class Lines(UserList): diff --git a/refactor/change.py b/refactor/change.py index 583064a..cc744e9 100644 --- a/refactor/change.py +++ b/refactor/change.py @@ -5,6 +5,8 @@ from refactor.ast import split_lines +__all__ = ["Change"] + @dataclass class Change: diff --git a/refactor/common.py b/refactor/common.py index edf3625..177ae14 100644 --- a/refactor/common.py +++ b/refactor/common.py @@ -16,6 +16,23 @@ cast, ) +__all__ = [ + "Singleton", + "apply_condition", + "compare_ast", + "find_closest", + "find_indent", + "get_source_segment", + "has_positions", + "is_truthy", + "negate", + "pascal_to_snake", + "position_for", + "unpack_lhs", + "walk_scope", + "wrap_with_parens", +] + def negate(node: ast.expr) -> ast.UnaryOp: """Negate the given `node`.""" diff --git a/refactor/context.py b/refactor/context.py index 789f51a..17aee52 100644 --- a/refactor/context.py +++ b/refactor/context.py @@ -25,6 +25,18 @@ import refactor.common as common from refactor.ast import UNPARSER_BACKENDS, BaseUnparser +__all__ = [ + "Ancestry", + "Configuration", + "Context", + "Dependable", + "Representative", + "Scope", + "ScopeInfo", + "ScopeType", + "resolve_dependencies", +] + @dataclass class Configuration: diff --git a/refactor/core.py b/refactor/core.py index 5c2dfa1..557a67c 100644 --- a/refactor/core.py +++ b/refactor/core.py @@ -19,6 +19,15 @@ resolve_dependencies, ) +__all__ = [ + "Action", + "NewStatementAction", + "ReplacementAction", + "Rule", + "Session", + "TargetedNewStatementAction", +] + @dataclass class Action: diff --git a/refactor/runner.py b/refactor/runner.py index 48cbd8f..13eff1a 100644 --- a/refactor/runner.py +++ b/refactor/runner.py @@ -18,6 +18,8 @@ from refactor.core import Session +__all__ = ["dump_stats", "expand_paths", "run", "run_files", "unbound_main"] + _DEFAULT_WORKERS = object() diff --git a/refactor/validate_inputs.py b/refactor/validate_inputs.py index f4e8ae8..0cebb8a 100644 --- a/refactor/validate_inputs.py +++ b/refactor/validate_inputs.py @@ -1,6 +1,8 @@ from argparse import Namespace from pathlib import Path +__all__ = ["validate_main_inputs"] + _DEFAULT_FILES = [Path("refactors.py"), Path(".refactors/__init__.py")]