Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci

Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
pre-commit-ci[bot] authored and gaborbernat committed Aug 7, 2023
1 parent 127d84c commit c55bdb5
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/tox/config/of_type.py
Expand Up @@ -95,7 +95,7 @@ def __call__(
args.chain.append(chain_key)
try:
value = loader.load(key, self.of_type, self.factory, conf, args)
except KeyError: # noqa: PERF203
except KeyError:
continue
else:
break
Expand Down
4 changes: 2 additions & 2 deletions src/tox/config/source/discover.py
Expand Up @@ -36,7 +36,7 @@ def discover_source(config_file: Path | None, root_dir: Path | None) -> Source:
try:
src = src_type(candidate)
break
except ValueError: # noqa: PERF203
except ValueError:
continue
if src is None:
msg = f"could not find any config file in {config_file}"
Expand All @@ -53,7 +53,7 @@ def _locate_source() -> Source | None:
candidate: Path = base / src_type.FILENAME
try:
return src_type(candidate)
except ValueError: # noqa: PERF203
except ValueError:
pass
return None

Expand Down
2 changes: 1 addition & 1 deletion src/tox/provision.py
Expand Up @@ -132,7 +132,7 @@ def _get_missing(requires: list[Requirement]) -> list[tuple[Requirement, str | N
package_name = canonicalize_name(package.name)
try:
dist = distribution(package_name)
except PackageNotFoundError: # noqa: PERF203
except PackageNotFoundError:
missing.append((package, None))
else:
if not package.specifier.contains(dist.version, prereleases=True):
Expand Down
2 changes: 1 addition & 1 deletion src/tox/session/cmd/legacy.py
Expand Up @@ -139,7 +139,7 @@ def _handle_legacy_only_flags(option: Parsed, envs: EnvSelector) -> None: # noq
for at, entry in enumerate(as_root_args):
try:
req = Requirement(entry)
except InvalidRequirement: # noqa: PERF203
except InvalidRequirement:
continue
if req.name in to_force:
as_root_args[at] = str(to_force[req.name])
Expand Down
2 changes: 1 addition & 1 deletion src/tox/session/cmd/run/single.py
Expand Up @@ -112,7 +112,7 @@ def run_command_set(
outcomes.append(current_outcome)
try:
current_outcome.assert_success()
except SystemExit as exception: # noqa: PERF203
except SystemExit as exception:
if cmd.ignore_exit_code:
logging.warning("command failed but is marked ignore outcome so handling it as success")
continue
Expand Down
2 changes: 1 addition & 1 deletion src/tox/session/cmd/show_config.py
Expand Up @@ -101,7 +101,7 @@ def print_conf(is_colored: bool, conf: ConfigSet, keys: Iterable[str]) -> None:
try:
value = conf[key]
as_str, multi_line = stringify(value)
except Exception as exception: # because e.g. the interpreter cannot be found # noqa: BLE001, PERF203
except Exception as exception: # because e.g. the interpreter cannot be found # noqa: BLE001
as_str, multi_line = _colored(is_colored, Fore.LIGHTRED_EX, f"# Exception: {exception!r}"), False
if multi_line and "\n" not in as_str:
multi_line = False
Expand Down
2 changes: 1 addition & 1 deletion src/tox/tox_env/python/virtual_env/package/cmd_builder.py
Expand Up @@ -93,7 +93,7 @@ def perform_packaging(self, for_env: EnvConfigSet) -> list[Package]:
msg = "stopping as failed to build package"
raise Fail(msg)
package_glob = self.conf["package_glob"]
found = glob.glob(package_glob)
found = glob.glob(package_glob) # noqa: PTH207
if not found:
msg = f"no package found in {package_glob}"
raise Fail(msg)
Expand Down
4 changes: 2 additions & 2 deletions tests/config/loader/ini/replace/test_replace_env_var.py
Expand Up @@ -34,8 +34,8 @@ def test_replace_env_set_triple_bs(replace_one: ReplaceOne, monkeypatch: MonkeyP
def test_replace_env_set_quad_bs(replace_one: ReplaceOne, monkeypatch: MonkeyPatch) -> None:
"""Quad backslash should remain but not affect surrounding replacements."""
monkeypatch.setenv("MAGIC", "something good")
result = replace_one(r"\\{env:MAGIC}\\\\{env:MAGIC}" + "\\") # noqa: ISC003
assert result == r"\\something good\\\\something good" + "\\" # noqa: ISC003
result = replace_one(r"\\{env:MAGIC}\\\\{env:MAGIC}" + "\\")
assert result == r"\\something good\\\\something good" + "\\"


def test_replace_env_when_value_is_backslash(replace_one: ReplaceOne, monkeypatch: MonkeyPatch) -> None:
Expand Down

0 comments on commit c55bdb5

Please sign in to comment.