Skip to content

Commit

Permalink
Removed typeguard.__all__ in favor of explicit re-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Feb 26, 2023
1 parent f568103 commit 67c97da
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 46 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ skip_gitignore = true
[tool.flake8]
max-line-length = 88
ignore = ["E203", "W503"]
per-file-ignores = [
"**/__init__.py:F401"
]

[tool.mypy]
python_version = "3.9"
Expand Down
71 changes: 25 additions & 46 deletions src/typeguard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,28 @@
__all__ = (
"CallMemo",
"CollectionCheckStrategy",
"ForwardRefPolicy",
"ImportHookManager",
"TypeCheckerCallable",
"TypeCheckFailCallback",
"TypeCheckLookupCallback",
"TypeCheckConfiguration",
"TypeHintWarning",
"TypeCheckWarning",
"TypeCheckError",
"TypeCheckMemo",
"TypeguardFinder",
"check_type",
"check_type_internal",
"checker_lookup_functions",
"config",
"install_import_hook",
"load_plugins",
"suppress_type_checks",
"typechecked",
"typeguard_ignore",
"warn_on_error",
)

import os
from typing import Any

from ._checkers import (
TypeCheckerCallable,
TypeCheckLookupCallback,
check_type_internal,
checker_lookup_functions,
load_plugins,
)
from ._config import CollectionCheckStrategy, ForwardRefPolicy, TypeCheckConfiguration
from ._config import global_config as _global_config
from ._decorators import typechecked, typeguard_ignore
from ._exceptions import TypeCheckError, TypeCheckWarning, TypeHintWarning
from ._functions import (
TypeCheckFailCallback,
check_type,
suppress_type_checks,
warn_on_error,
)
from ._importhook import ImportHookManager, TypeguardFinder, install_import_hook
from ._memo import CallMemo, TypeCheckMemo
from ._checkers import TypeCheckerCallable as TypeCheckerCallable
from ._checkers import TypeCheckLookupCallback as TypeCheckLookupCallback
from ._checkers import check_type_internal as check_type_internal
from ._checkers import checker_lookup_functions as checker_lookup_functions
from ._checkers import load_plugins as load_plugins
from ._config import CollectionCheckStrategy as CollectionCheckStrategy
from ._config import ForwardRefPolicy as ForwardRefPolicy
from ._config import TypeCheckConfiguration as TypeCheckConfiguration
from ._decorators import typechecked as typechecked
from ._decorators import typeguard_ignore as typeguard_ignore
from ._exceptions import TypeCheckError as TypeCheckError
from ._exceptions import TypeCheckWarning as TypeCheckWarning
from ._exceptions import TypeHintWarning as TypeHintWarning
from ._functions import TypeCheckFailCallback as TypeCheckFailCallback
from ._functions import check_type as check_type
from ._functions import suppress_type_checks as suppress_type_checks
from ._functions import warn_on_error as warn_on_error
from ._importhook import ImportHookManager as ImportHookManager
from ._importhook import TypeguardFinder as TypeguardFinder
from ._importhook import install_import_hook as install_import_hook
from ._memo import CallMemo as CallMemo
from ._memo import TypeCheckMemo as TypeCheckMemo

# Re-export imports so they look like they live directly in this package
for value in list(locals().values()):
Expand All @@ -58,7 +35,9 @@

def __getattr__(name: str) -> Any:
if name == "config":
return _global_config
from ._config import global_config

return global_config


# Automatically load checker lookup functions unless explicitly disabled
Expand Down

0 comments on commit 67c97da

Please sign in to comment.