Skip to content

Commit

Permalink
Expose more attributes for typing (#817)
Browse files Browse the repository at this point in the history
* expose more attributes for typing

* address unused ignores
  • Loading branch information
blink1073 authored Dec 18, 2022
1 parent 74928f6 commit 928ec87
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
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

0 comments on commit 928ec87

Please sign in to comment.