Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#830)Co-authored-by: pre-commi…
Browse files Browse the repository at this point in the history
…t-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <steven.silvester@ieee.org>

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/python-jsonschema/check-jsonschema: 0.19.2 → 0.21.0](python-jsonschema/check-jsonschema@0.19.2...0.21.0)
- [github.com/psf/black: 22.12.0 → 23.1.0](psf/black@22.12.0...23.1.0)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.207 → v0.0.243](astral-sh/ruff-pre-commit@v0.0.207...v0.0.243)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* sync deps and lint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

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>
  • Loading branch information
pre-commit-ci[bot] and blink1073 committed Feb 7, 2023
1 parent 098711f commit 7fe6ec9
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 92 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.2
rev: 0.21.0
hooks:
- id: check-github-workflows

Expand All @@ -29,12 +29,12 @@ repos:
- id: mdformat

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.207
rev: v0.0.243
hooks:
- id: ruff
args: ["--fix"]
2 changes: 0 additions & 2 deletions examples/myapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ class Foo(Configurable):


class Bar(Configurable):

enabled = Bool(True, help="Enable bar.").tag(config=True)


class MyApp(Application):

name = Unicode("myapp")
running = Bool(False, help="Is the app running?").tag(config=True)
classes = List([Bar, Foo]) # type:ignore[assignment]
Expand Down
4 changes: 3 additions & 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.12.0", "mdformat>0.7", "ruff==0.0.206"]
dependencies = ["black==23.1.0", "mdformat>0.7", "ruff==0.0.243"]
detached = true
[tool.hatch.envs.lint.scripts]
style = [
Expand Down Expand Up @@ -182,6 +182,8 @@ ignore = [
"C408",
# N801 Class name `directional_link` should use CapWords convention
"N801",
# S110 `try`-`except`-`pass` detected
"S110",
]
unfixable = [
# Don't touch print statements
Expand Down
4 changes: 2 additions & 2 deletions traitlets/config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def __init__(self, **kwargs):
if cls not in self.classes:
if self.classes is cls.classes:
# class attr, assign instead of insert
self.classes = [cls] + self.classes
self.classes = [cls, *self.classes]
else:
self.classes.insert(0, self.__class__)

Expand Down Expand Up @@ -947,7 +947,7 @@ def load_config_file(self, filename, path=None):
"""Load config files by filename and path."""
filename, ext = os.path.splitext(filename)
new_config = Config()
for (config, fname) in self._load_config_files(
for config, fname in self._load_config_files(
filename,
path=path,
log=self.log,
Expand Down
5 changes: 2 additions & 3 deletions traitlets/config/configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class MultipleInstanceError(ConfigurableError):


class Configurable(HasTraits):

config = Instance(Config, (), {})
parent = Instance("traitlets.config.configurable.Configurable", allow_none=True)

Expand Down Expand Up @@ -558,8 +557,8 @@ def instance(cls, *args, **kwargs):
return cls._instance
else:
raise MultipleInstanceError(
"An incompatible sibling of '%s' is already instantiated"
" as singleton: %s" % (cls.__name__, type(cls._instance).__name__)
"An incompatible sibling of '{}' is already instantiated"
" as singleton: {}".format(cls.__name__, type(cls._instance).__name__)
)

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions traitlets/config/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def __setitem__(self, key, value):
if not isinstance(value, Config):
raise ValueError(
"values whose keys begin with an uppercase "
"char must be Config instances: %r, %r" % (key, value)
"char must be Config instances: {!r}, {!r}".format(key, value)
)
dict.__setitem__(self, key, value)

Expand Down Expand Up @@ -1037,8 +1037,8 @@ def _add_arguments(self, aliases, flags, classes):
# flag sets 'action', so can't have flag & alias with custom action
# on the same name
raise ArgumentError(
"The alias `%s` for the 'append' sequence "
"config-trait `%s` cannot be also a flag!'" % (key, traitname)
"The alias `{}` for the 'append' sequence "
"config-trait `{}` cannot be also a flag!'".format(key, traitname)
)
# For argcomplete, check if any either an argcompleter metadata tag or method
# is available. If so, it should be a callable which takes the command-line key
Expand Down
4 changes: 0 additions & 4 deletions traitlets/config/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@


class Foo(Configurable):

i = Integer(
0,
help="""
Expand All @@ -51,7 +50,6 @@ class Foo(Configurable):


class Bar(Configurable):

b = Integer(0, help="The integer b.").tag(config=True)
enabled = Bool(True, help="Enable bar.").tag(config=True)
tb = Tuple(()).tag(config=True, multiplicity="*")
Expand All @@ -62,7 +60,6 @@ class Bar(Configurable):


class MyApp(Application):

name = Unicode("myapp")
running = Bool(False, help="Is the app running?").tag(config=True)
classes = List([Bar, Foo]) # type:ignore
Expand Down Expand Up @@ -475,7 +472,6 @@ def test_flatten_aliases(self):
self.assertEqual(app.config.MyApp.log_level, "CRITICAL")

def test_extra_args(self):

app = MyApp()
app.parse_command_line(["--Bar.b=5", "extra", "args", "--disable"])
app.init_bar()
Expand Down
1 change: 0 additions & 1 deletion traitlets/config/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def test_json(self):
self._check_conf(config)

def test_context_manager(self):

fd, fname = mkstemp(".json", prefix="μnïcø∂e")
f = os.fdopen(fd, "w")
f.write("{}")
Expand Down

0 comments on commit 7fe6ec9

Please sign in to comment.