Skip to content

Commit 7d13472

Browse files
authored
Update ruff config (#893)
1 parent f6bd8d5 commit 7d13472

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+183
-161
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/python-jsonschema/check-jsonschema
24-
rev: 0.27.1
24+
rev: 0.27.2
2525
hooks:
2626
- id: check-github-workflows
2727

@@ -33,7 +33,7 @@ repos:
3333
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
3434

3535
- repo: https://github.com/pre-commit/mirrors-prettier
36-
rev: "v3.0.3"
36+
rev: "v3.1.0"
3737
hooks:
3838
- id: prettier
3939
types_or: [yaml, html, json]
@@ -51,7 +51,7 @@ repos:
5151
args: ["-L", "sur,nd"]
5252

5353
- repo: https://github.com/pre-commit/mirrors-mypy
54-
rev: "v1.7.0"
54+
rev: "v1.7.1"
5555
hooks:
5656
- id: mypy
5757
files: "^traitlets"
@@ -67,7 +67,7 @@ repos:
6767
- id: rst-inline-touching-normal
6868

6969
- repo: https://github.com/astral-sh/ruff-pre-commit
70-
rev: v0.1.5
70+
rev: v0.1.6
7171
hooks:
7272
- id: ruff
7373
types_or: [python, jupyter]
@@ -76,7 +76,7 @@ repos:
7676
types_or: [python, jupyter]
7777

7878
- repo: https://github.com/scientific-python/cookie
79-
rev: "2023.10.27"
79+
rev: "2023.11.17"
8080
hooks:
8181
- id: sp-repo-review
8282
additional_dependencies: ["repo-review[cli]"]

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### Enhancements made
1010

11-
- Add option to load traitlets values from environement. [#856](https://github.com/ipython/traitlets/pull/856) ([@Carreau](https://github.com/Carreau))
11+
- Add option to load traitlets values from environment. [#856](https://github.com/ipython/traitlets/pull/856) ([@Carreau](https://github.com/Carreau))
1212

1313
### Maintenance and upkeep improvements
1414

docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# All configuration values have a default; values that are commented out
1616
# serve to show the default.
17+
from __future__ import annotations
1718

1819
import os.path as osp
1920
import shutil
@@ -22,7 +23,7 @@
2223
HERE = osp.abspath(osp.dirname(__file__))
2324
ROOT = osp.dirname(osp.dirname(HERE))
2425

25-
from traitlets import __version__, version_info
26+
from traitlets import __version__, version_info # noqa: E402
2627

2728
# If extensions (or modules to document with autodoc) are in another directory,
2829
# add these directories to sys.path here. If the directory is relative to the

docs/sphinxext/github.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
#
1717
# Original Copyright (c) 2010 Doug Hellmann. All rights reserved.
1818
#
19+
from __future__ import annotations
1920

2021
from docutils import nodes, utils
2122
from docutils.parsers.rst.roles import set_classes
22-
from sphinx.util.logging import getLogger # type:ignore
23+
from sphinx.util.logging import getLogger
2324

2425
info = getLogger(__name__).info
2526

@@ -50,8 +51,7 @@ def make_link_node(rawtext, app, type, slug, options):
5051
prefix = "#"
5152
if type == "pull":
5253
prefix = "PR " + prefix
53-
node = nodes.reference(rawtext, prefix + utils.unescape(slug), refuri=ref, **options)
54-
return node
54+
return nodes.reference(rawtext, prefix + utils.unescape(slug), refuri=ref, **options)
5555

5656

5757
def ghissue_role(name, rawtext, text, lineno, inliner, options=None, content=None):
@@ -170,5 +170,4 @@ def setup(app):
170170
app.add_role("ghcommit", ghcommit_role)
171171
app.add_config_value("github_project_url", None, "env")
172172

173-
metadata = {"parallel_read_safe": True, "parallel_write_safe": True}
174-
return metadata
173+
return {"parallel_read_safe": True, "parallel_write_safe": True}

examples/argcomplete_app.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@
6363
If completions are not showing, you can set the environment variable ``_ARC_DEBUG=1``
6464
to assist in debugging argcomplete. This was last checked with ``argcomplete==1.12.3``.
6565
"""
66+
from __future__ import annotations
67+
6668
import json
6769
import os
6870

6971
try:
7072
from argcomplete.completers import EnvironCompleter, SuppressCompleter
7173
except ImportError:
72-
EnvironCompleter = SuppressCompleter = None # type:ignore
74+
EnvironCompleter = SuppressCompleter = None
7375
from traitlets import Bool, Enum, Int, List, Unicode
7476
from traitlets.config.application import Application
7577
from traitlets.config.configurable import Configurable
@@ -106,8 +108,7 @@ def print(self):
106108
if env_var not in os.environ:
107109
if self.skip_if_missing:
108110
continue
109-
else:
110-
raise KeyError(f"Environment variable not set: {env_var}")
111+
raise KeyError(f"Environment variable not set: {env_var}")
111112

112113
value = os.environ[env_var]
113114
if self.style == "posix":

examples/docs/aliases.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# PYTHON_ARGCOMPLETE_OK
33
"""A simple example of using Application aliases, for docs"""
4+
from __future__ import annotations
45

56
from traitlets import Bool
67
from traitlets.config import Application, Configurable
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Example config used by load_config_app.py
2+
from __future__ import annotations
23

3-
c = get_config() # noqa
4+
c = get_config() # noqa: F821
45
c.MyClass.name = "Harvard"
56
c.MyClass.ranking = 100
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Example config used by load_config_app.py
2+
from __future__ import annotations
23

3-
c = get_config() # noqa
4+
c = get_config() # noqa: F821
45

56
# Load everything from base_config.py
6-
load_subconfig("base_config.py") # noqa
7+
load_subconfig("base_config.py") # noqa: F821
78

89
# Now override one of the values
910
c.School.name = "Caltech"

examples/docs/container.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# PYTHON_ARGCOMPLETE_OK
33
"""A simple example of using container traits in Application command-line"""
4+
from __future__ import annotations
45

56
from traitlets import Dict, Integer, List, Unicode
67
from traitlets.config import Application

examples/docs/flags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
# PYTHON_ARGCOMPLETE_OK
33
"""A simple example of using Application flags, for docs"""
4+
from __future__ import annotations
45

56
from traitlets import Bool
67
from traitlets.config import Application, Configurable

0 commit comments

Comments
 (0)