Skip to content

Add __all__ to top-level modules #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions refactor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
)
from refactor.runner import run

__all__ = [
"Configuration",
"Context",
"Representative",
"Action",
"NewStatementAction",
"ReplacementAction",
"Rule",
"Session",
"run",
]


def _check_asserts():
import sys
Expand Down
9 changes: 9 additions & 0 deletions refactor/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

from refactor import common

__all__ = [
"BaseUnparser",
"Lines",
"PreciseUnparser",
"UNPARSER_BACKENDS",
"Unparser",
"split_lines",
]


@dataclass
class Lines(UserList):
Expand Down
2 changes: 2 additions & 0 deletions refactor/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from refactor.ast import split_lines

__all__ = ["Change"]


@dataclass
class Change:
Expand Down
17 changes: 17 additions & 0 deletions refactor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`."""
Expand Down
12 changes: 12 additions & 0 deletions refactor/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions refactor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
resolve_dependencies,
)

__all__ = [
"Action",
"NewStatementAction",
"ReplacementAction",
"Rule",
"Session",
"TargetedNewStatementAction",
]


@dataclass
class Action:
Expand Down
2 changes: 2 additions & 0 deletions refactor/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

from refactor.core import Session

__all__ = ["dump_stats", "expand_paths", "run", "run_files", "unbound_main"]

_DEFAULT_WORKERS = object()


Expand Down
2 changes: 2 additions & 0 deletions refactor/validate_inputs.py
Original file line number Diff line number Diff line change
@@ -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")]


Expand Down