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

More Typing Adoption #873

Merged
merged 19 commits into from Oct 3, 2023
23 changes: 17 additions & 6 deletions pyproject.toml
Expand Up @@ -56,7 +56,7 @@ nowarn = "test -W default {args}"
[tool.hatch.envs.typing]
features = ["test"]
[tool.hatch.envs.typing.scripts]
test = "mypy --install-types --non-interactive {args:.}"
test = "mypy --install-types --non-interactive {args}"

[tool.hatch.envs.lint]
dependencies = ["black==23.3.0", "mdformat>0.7", "ruff==0.0.281"]
Expand All @@ -74,6 +74,7 @@ fmt = [
]

[tool.mypy]
files = "traitlets"
python_version = "3.8"
check_untyped_defs = true
disallow_any_generics = true
Expand All @@ -97,7 +98,7 @@ exclude = ["examples/docs/configs", "traitlets/tests/test_typing.py"]
[tool.pytest.ini_options]
addopts = "--durations=10 -ra --showlocals --doctest-modules --color yes --ignore examples/docs/configs"
testpaths = [
"traitlets",
"tests",
"examples",
]
filterwarnings = [
Expand Down Expand Up @@ -153,10 +154,18 @@ target-version = ["py37"]
target-version = "py37"
line-length = 100
select = [
"A", "B", "C", "E", "F", "FBT", "I", "N", "Q", "RUF", "S", "T",
"A", "ANN", "B", "C", "E", "F", "FBT", "I", "N", "Q", "RUF", "S", "T",
"UP", "W", "YTT",
]
ignore = [
# Dynamically typed expressions (typing.Any) are disallowed in `key`
"ANN401",
# Missing type annotation for `self` in method
"ANN101",
# Missing type annotation for `cls` in classmethod
"ANN102",
# ANN202 Missing return type annotation for private function
"ANN202",
# Allow non-abstract empty methods in abstract base classes
"B027",
# Ignore McCabe complexity
Expand Down Expand Up @@ -211,11 +220,13 @@ unfixable = [
# N802 Function name `assertIn` should be lowercase
# F841 Local variable `t` is assigned to but never used
# B018 Found useless expression
# S301 `pickle` and modules that wrap...
"traitlets/tests/*" = ["B011", "F841", "C408", "E402", "T201", "B007", "N802", "F841",
# S301 `pickle` and modules that wrap..."
"tests/*" = ["ANN", "B011", "F841", "C408", "E402", "T201", "B007", "N802", "F841",
"B018", "S301"]
# B003 Assigning to os.environ doesn't clear the environment
"traitlets/config/tests/*" = ["B003", "B018", "S301"]
"tests/config/*" = ["B003", "B018", "S301"]
# F401 `_version.__version__` imported but unused
# F403 `from .traitlets import *` used; unable to detect undefined names
"traitlets/*__init__.py" = ["F401", "F403"]
"docs/*" = ["ANN"]
"examples/*" = ["ANN"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -601,7 +601,7 @@ def test_raise_on_bad_config(self):
with self.assertRaises(SyntaxError):
app.load_config_file(name, path=[td])

def test_subcommands_instanciation(self):
def test_subcommands_instantiation(self):
"""Try all ways to specify how to create sub-apps."""
app = Root.instance()
app.parse_command_line(["sub1"])
Expand Down Expand Up @@ -694,7 +694,7 @@ class App(Application):

class Root(Application):
subcommands = {
"sub1": ("traitlets.config.tests.test_application.Sub1", "import string"),
"sub1": ("tests.config.test_application.Sub1", "import string"),
}


Expand Down
Expand Up @@ -8,6 +8,7 @@

from pytest import mark

from tests._warnings import expected_warnings
from traitlets.config.application import Application
from traitlets.config.configurable import Configurable, LoggingConfigurable, SingletonConfigurable
from traitlets.config.loader import Config
Expand All @@ -26,8 +27,6 @@
)
from traitlets.utils.warnings import _deprecations_shown

from ...tests._warnings import expected_warnings


class MyConfigurable(Configurable):
a = Integer(1, help="The integer a.").tag(config=True)
Expand Down
File renamed without changes.