Skip to content
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

Expose more attributes for typing #817

Merged
merged 2 commits into from
Dec 18, 2022
Merged
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.178
rev: v0.0.185
hooks:
- id: ruff
args: ["--fix"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies = ["mypy>=0.990"]
test = "mypy --install-types --non-interactive {args:.}"

[tool.hatch.envs.lint]
dependencies = ["black==22.10.0", "mdformat>0.7", "ruff==0.0.178"]
dependencies = ["black==22.10.0", "mdformat>0.7", "ruff==0.0.185"]
detached = true
[tool.hatch.envs.lint.scripts]
style = [
Expand Down
10 changes: 10 additions & 0 deletions traitlets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
from .utils.decorators import signature_has_traits
from .utils.importstring import import_item

__all__ = [
"traitlets",
"__version__",
"version_info",
"Bunch",
"signature_has_traits",
"import_item",
"Sentinel",
]


class Sentinel(traitlets.Sentinel): # type:ignore[name-defined]
def __init__(self, *args, **kwargs):
Expand Down
12 changes: 12 additions & 0 deletions traitlets/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@
from .application import *
from .configurable import *
from .loader import Config

__all__ = [ # noqa
"Config",
"Application",
"ApplicationError",
"LevelFormatter",
"configurable",
"ConfigurableError",
"MultipleInstanceError",
"LoggingConfigurable",
"SingletonConfigurable",
]
4 changes: 2 additions & 2 deletions traitlets/tests/test_traitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def test_str_klass(self):
class A(HasTraits):
klass = Type("traitlets.config.Config")

from traitlets.config import Config # type:ignore
from traitlets.config import Config

a = A()
a.klass = Config
Expand All @@ -1059,7 +1059,7 @@ class A(HasTraits):
klass = Type()

a = A(klass="traitlets.config.Config")
from traitlets.config import Config # type:ignore
from traitlets.config import Config

self.assertEqual(a.klass, Config)

Expand Down