Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix various __all__ bugs and omissions#7618
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,85 @@ | ||
| import sys | ||
| # This is a slight lie, the implementations aren't exactly identical | ||
| # However, in all likelihood, the differences are inconsequential | ||
| from decimal import * | ||
| if sys.version_info >= (3, 7): | ||
| __all__ = [ | ||
| "Decimal", | ||
| "Context", | ||
| "DecimalTuple", | ||
| "DefaultContext", | ||
| "BasicContext", | ||
| "ExtendedContext", | ||
| "DecimalException", | ||
| "Clamped", | ||
| "InvalidOperation", | ||
| "DivisionByZero", | ||
| "Inexact", | ||
| "Rounded", | ||
| "Subnormal", | ||
| "Overflow", | ||
| "Underflow", | ||
| "FloatOperation", | ||
| "DivisionImpossible", | ||
| "InvalidContext", | ||
| "ConversionSyntax", | ||
| "DivisionUndefined", | ||
| "ROUND_DOWN", | ||
| "ROUND_HALF_UP", | ||
| "ROUND_HALF_EVEN", | ||
| "ROUND_CEILING", | ||
| "ROUND_FLOOR", | ||
| "ROUND_UP", | ||
| "ROUND_HALF_DOWN", | ||
| "ROUND_05UP", | ||
| "setcontext", | ||
| "getcontext", | ||
| "localcontext", | ||
| "MAX_PREC", | ||
| "MAX_EMAX", | ||
| "MIN_EMIN", | ||
| "MIN_ETINY", | ||
| "HAVE_THREADS", | ||
| "HAVE_CONTEXTVAR", | ||
| ] | ||
| else: | ||
| __all__ = [ | ||
| "Decimal", | ||
| "Context", | ||
| "DecimalTuple", | ||
| "DefaultContext", | ||
| "BasicContext", | ||
| "ExtendedContext", | ||
| "DecimalException", | ||
| "Clamped", | ||
| "InvalidOperation", | ||
| "DivisionByZero", | ||
| "Inexact", | ||
| "Rounded", | ||
| "Subnormal", | ||
| "Overflow", | ||
| "Underflow", | ||
| "FloatOperation", | ||
| "DivisionImpossible", | ||
| "InvalidContext", | ||
| "ConversionSyntax", | ||
| "DivisionUndefined", | ||
| "ROUND_DOWN", | ||
| "ROUND_HALF_UP", | ||
| "ROUND_HALF_EVEN", | ||
| "ROUND_CEILING", | ||
| "ROUND_FLOOR", | ||
| "ROUND_UP", | ||
| "ROUND_HALF_DOWN", | ||
| "ROUND_05UP", | ||
| "setcontext", | ||
| "getcontext", | ||
| "localcontext", | ||
| "MAX_PREC", | ||
| "MAX_EMAX", | ||
| "MIN_EMIN", | ||
| "MIN_ETINY", | ||
| "HAVE_THREADS", | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,6 +30,56 @@ from typing import ( # noqa: Y022,Y027 | ||
| overload as overload, | ||
| ) | ||
| __all__ = [ | ||
| "ClassVar", | ||
| "Concatenate", | ||
| "Final", | ||
| "LiteralString", | ||
| "ParamSpec", | ||
| "Self", | ||
| "Type", | ||
| "TypeVarTuple", | ||
| "Unpack", | ||
| "Awaitable", | ||
| "AsyncIterator", | ||
| "AsyncIterable", | ||
| "Coroutine", | ||
| "AsyncGenerator", | ||
| "AsyncContextManager", | ||
| "ChainMap", | ||
| "ContextManager", | ||
| "Counter", | ||
| "Deque", | ||
| "DefaultDict", | ||
| "OrderedDict", | ||
| "TypedDict", | ||
| "SupportsIndex", | ||
| "Annotated", | ||
| "assert_never", | ||
| "dataclass_transform", | ||
| "final", | ||
| "IntVar", | ||
| "is_typeddict", | ||
| "Literal", | ||
| "NewType", | ||
| "overload", | ||
| "Protocol", | ||
| "reveal_type", | ||
| "runtime", | ||
| "runtime_checkable", | ||
| "Text", | ||
| "TypeAlias", | ||
| "TypeGuard", | ||
| "TYPE_CHECKING", | ||
| "Never", | ||
| "NoReturn", | ||
| "Required", | ||
| "NotRequired", | ||
| "get_args", | ||
| "get_origin", | ||
| "get_type_hints", | ||
| ] | ||
| _T = TypeVar("_T") | ||
| _F = TypeVar("_F", bound=Callable[..., Any]) | ||
| _TC = TypeVar("_TC", bound=Type[object]) | ||
| @@ -82,15 +132,14 @@ TypedDict: object | ||
| OrderedDict = _Alias() | ||
| if sys.version_info >= (3, 7): | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically we shouldn't do this because the change hasn't been released yet, but I don't want to have to duplicate | ||
| def get_type_hints( | ||
| obj: Callable[..., Any], | ||
| globalns: dict[str, Any] | None = ..., | ||
| localns: dict[str, Any] | None = ..., | ||
| include_extras: bool = ..., | ||
| ) -> dict[str, Any]: ... | ||
| def get_args(tp: Any) -> tuple[Any, ...]: ... | ||
| def get_origin(tp: Any) -> Any | None: ... | ||
| def get_type_hints( | ||
| obj: Callable[..., Any], | ||
| globalns: dict[str, Any] | None = ..., | ||
| localns: dict[str, Any] | None = ..., | ||
| include_extras: bool = ..., | ||
| ) -> dict[str, Any]: ... | ||
| def get_args(tp: Any) -> tuple[Any, ...]: ... | ||
| def get_origin(tp: Any) -> Any | None: ... | ||
| Annotated: _SpecialForm | ||
| _AnnotatedAlias: Any # undocumented | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprisingly,
_pydecimalappears to have__all__even thoughdecimaldoesn't.¯\_(ツ)_/¯