Skip to content

Commit 7d68360

Browse files
[pre-commit.ci] pre-commit autoupdate (#2598)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bernát Gábor <bgabor8@bloomberg.net>
1 parent 9f9dc62 commit 7d68360

File tree

15 files changed

+24
-30
lines changed

15 files changed

+24
-30
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: prettier
2525
args: ["--print-width=120", "--prose-wrap=always"]
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: "v0.0.275"
27+
rev: "v0.0.276"
2828
hooks:
2929
- id: ruff
3030
args: [--fix, --exit-non-zero-on-fix]

docs/render_cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ def run(self):
3434
core_result = parse_parser(parser_creator())
3535
core_result["action_groups"] = [i for i in core_result["action_groups"] if i["title"] not in CUSTOM]
3636

37-
content = []
38-
for i in core_result["action_groups"]:
39-
content.append(self._build_table(i["options"], i["title"], i["description"]))
37+
content = [self._build_table(i["options"], i["title"], i["description"]) for i in core_result["action_groups"]]
4038
for key, name_to_class in CUSTOM.items():
4139
section = n.section("", ids=[f"section-{key}"])
4240
title = n.title("", key)

src/virtualenv/create/creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def non_write_able(dest, value):
121121
if trip == char:
122122
continue
123123
raise ValueError(trip) # noqa: TRY301
124-
except ValueError:
124+
except ValueError: # noqa: PERF203
125125
refused[char] = None
126126
if refused:
127127
bad = "".join(refused.keys())

src/virtualenv/discovery/builtin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def propose_interpreters(spec, try_first_with, app_data, env=None): # noqa: C90
7777
path = os.path.abspath(py_exe)
7878
try:
7979
os.lstat(path) # Windows Store Python does not work with os.path.exists, but does for os.lstat
80-
except OSError:
80+
except OSError: # noqa: PERF203
8181
pass
8282
else:
8383
yield PythonInfo.from_exe(os.path.abspath(path), app_data, env=env), True
@@ -145,7 +145,7 @@ def __repr__(self) -> str:
145145
file_path = os.path.join(self.path, file_name)
146146
if os.path.isdir(file_path) or not os.access(file_path, os.X_OK):
147147
continue
148-
except OSError:
148+
except OSError: # noqa: PERF203
149149
pass
150150
content += " "
151151
content += file_name

src/virtualenv/discovery/windows/pep514.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def enum_keys(key):
1515
while True:
1616
try:
1717
yield winreg.EnumKey(key, at)
18-
except OSError:
18+
except OSError: # noqa: PERF203
1919
break
2020
at += 1
2121

@@ -144,9 +144,7 @@ def msg(path, what):
144144

145145
def _run():
146146
basicConfig()
147-
interpreters = []
148-
for spec in discover_pythons():
149-
interpreters.append(repr(spec))
147+
interpreters = [repr(spec) for spec in discover_pythons()]
150148
print("\n".join(sorted(interpreters))) # noqa: T201
151149

152150

src/virtualenv/seed/embed/via_app_data/pip_install/symlink.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _generate_new_files(self):
3232
rel = file.relative_to(self._image_dir)
3333
if len(rel.parts) > 1:
3434
continue
35-
except ValueError:
35+
except ValueError: # noqa: PERF203
3636
pass
3737
new_files.add(file)
3838
return new_files

src/virtualenv/seed/embed/via_app_data/via_app_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _get(distribution, version):
9393
)
9494
if result is not None:
9595
break
96-
except Exception as exception:
96+
except Exception as exception: # noqa: PERF203
9797
logging.exception("fail")
9898
failure = exception
9999
if failure:

src/virtualenv/seed/wheels/periodic_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def _pypi_get_distribution_info(distribution):
350350
with urlopen(url, context=context) as file_handler: # noqa: S310
351351
content = json.load(file_handler)
352352
break
353-
except URLError as exception:
353+
except URLError as exception: # noqa: PERF203
354354
logging.error("failed to access %s because %r", url, exception) # noqa: TRY400
355355
except Exception as exception: # noqa: BLE001
356356
logging.error("failed to access %s because %r", url, exception) # noqa: TRY400

src/virtualenv/seed/wheels/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def as_version_tuple(version):
3535
for part in version.split(".")[0:3]:
3636
try:
3737
result.append(int(part))
38-
except ValueError:
38+
except ValueError: # noqa: PERF203
3939
break
4040
if not result:
4141
raise ValueError(version)

src/virtualenv/util/path/_permission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def make_exe(filename):
1414
mode |= level
1515
filename.chmod(mode)
1616
break
17-
except OSError:
17+
except OSError: # noqa: PERF203
1818
continue
1919

2020

0 commit comments

Comments
 (0)