Skip to content

Commit 05d6ecb

Browse files
[pre-commit.ci] pre-commit autoupdate (#852)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
1 parent c2d04ba commit 05d6ecb

File tree

6 files changed

+12
-18
lines changed

6 files changed

+12
-18
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: trailing-whitespace
2020

2121
- repo: https://github.com/python-jsonschema/check-jsonschema
22-
rev: 0.23.2
22+
rev: 0.23.3
2323
hooks:
2424
- id: check-github-workflows
2525

@@ -29,12 +29,12 @@ repos:
2929
- id: mdformat
3030

3131
- repo: https://github.com/psf/black
32-
rev: 23.3.0
32+
rev: 23.7.0
3333
hooks:
3434
- id: black
3535

3636
- repo: https://github.com/astral-sh/ruff-pre-commit
37-
rev: v0.0.276
37+
rev: v0.0.281
3838
hooks:
3939
- id: ruff
4040
args: ["--fix"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dependencies = ["mypy>=0.990"]
5757
test = "mypy --install-types --non-interactive {args:.}"
5858

5959
[tool.hatch.envs.lint]
60-
dependencies = ["black==23.3.0", "mdformat>0.7", "ruff==0.0.276"]
60+
dependencies = ["black==23.3.0", "mdformat>0.7", "ruff==0.0.281"]
6161
detached = true
6262
[tool.hatch.envs.lint.scripts]
6363
style = [

traitlets/config/configurable.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,7 @@ def warn(msg):
189189
return warnings.warn(msg, UserWarning, stacklevel=9)
190190

191191
matches = get_close_matches(name, traits)
192-
msg = "Config option `{option}` not recognized by `{klass}`.".format(
193-
option=name, klass=self.__class__.__name__
194-
)
192+
msg = f"Config option `{name}` not recognized by `{self.__class__.__name__}`."
195193

196194
if len(matches) == 1:
197195
msg += f" Did you mean `{matches[0]}`?"

traitlets/config/sphinxdoc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ def reverse_aliases(app):
124124
# Treat flags which set one trait to True as aliases.
125125
for flag, (cfg, _) in app.flags.items():
126126
if len(cfg) == 1:
127-
classname = list(cfg)[0]
127+
classname = next(iter(cfg))
128128
cls_cfg = cfg[classname]
129129
if len(cls_cfg) == 1:
130-
traitname = list(cls_cfg)[0]
130+
traitname = next(iter(cls_cfg))
131131
if cls_cfg[traitname] is True:
132132
res[classname + "." + traitname].append(flag)
133133

traitlets/traitlets.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,8 @@ def from_string_list(self, s_list):
29032903
item_from_string = self.item_from_string
29042904
else:
29052905
# backward-compat: allow item_from_string to ignore index arg
2906-
item_from_string = lambda s, index=None: self.item_from_string(s) # noqa[E371]
2906+
def item_from_string(s, index=None):
2907+
return self.item_from_string(s) # noqa[E371]
29072908

29082909
return self.klass(
29092910
[item_from_string(s, index=idx) for idx, s in enumerate(s_list)]
@@ -3426,10 +3427,7 @@ def item_from_string(self, s):
34263427

34273428
if "=" not in s:
34283429
raise TraitError(
3429-
"'{}' options must have the form 'key=value', got {}".format(
3430-
self.__class__.__name__,
3431-
repr(s),
3432-
)
3430+
f"'{self.__class__.__name__}' options must have the form 'key=value', got {s!r}"
34333431
)
34343432
key, value = s.split("=", 1)
34353433

@@ -3521,7 +3519,7 @@ def __init__(self, enum_class, default_value=None, **kwargs):
35213519
assert issubclass(enum_class, enum.Enum), "REQUIRE: enum.Enum, but was: %r" % enum_class
35223520
allow_none = kwargs.get("allow_none", False)
35233521
if default_value is None and not allow_none:
3524-
default_value = list(enum_class.__members__.values())[0]
3522+
default_value = next(iter(enum_class.__members__.values()))
35253523
super().__init__(default_value=default_value, **kwargs)
35263524
self.enum_class = enum_class
35273525
self.name_prefix = enum_class.__name__ + "."

traitlets/utils/warnings.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ def deprecated_method(method, cls, method_name, msg):
1717
Uses warn_explicit to bind warning to method definition instead of triggering code,
1818
which isn't relevant.
1919
"""
20-
warn_msg = "{classname}.{method_name} is deprecated in traitlets 4.1: {msg}".format(
21-
classname=cls.__name__, method_name=method_name, msg=msg
22-
)
20+
warn_msg = f"{cls.__name__}.{method_name} is deprecated in traitlets 4.1: {msg}"
2321

2422
for parent in inspect.getmro(cls):
2523
if method_name in parent.__dict__:

0 commit comments

Comments
 (0)