Skip to content

Commit e52c040

Browse files
committed
[chore] lint tools/generate-inherit.py
Part-of: odoo/upgrade#5330
1 parent 7b3e880 commit e52c040

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tools/generate-inherit.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
# ruff: noqa: ERA001
23

34
import io
45
import itertools
@@ -210,7 +211,7 @@ def _read_python_source(filename):
210211
Do our best to decode a Python source file correctly.
211212
"""
212213
try:
213-
f = open(filename, "rb")
214+
f = open(filename, "rb") # noqa: SIM115
214215
except OSError:
215216
return None, None
216217
try:
@@ -286,7 +287,7 @@ def visit_classdef(self, node):
286287
elif attr == "_inherits":
287288
val = literal_eval(self.to_str(expr_stmt.children[2]))
288289
inh.extend(val.items())
289-
else:
290+
else: # noqa: PLR5501
290291
# handle Many2one with delegate=True attribute
291292
if (
292293
len(expr_stmt.children) == 3
@@ -342,7 +343,9 @@ def init_repos(path: Path) -> None:
342343
def checkout(wd: Path, repo: Repo, version: Version) -> bool:
343344
gitdir = str(wd / repo.name)
344345

345-
hasref = subprocess.run(["git", "show-ref", "-q", "--verify", f"refs/remotes/origin/{version.name}"], cwd=gitdir)
346+
hasref = subprocess.run(
347+
["git", "show-ref", "-q", "--verify", f"refs/remotes/origin/{version.name}"], cwd=gitdir, check=False
348+
)
346349
if hasref.returncode != 0:
347350
return False # unknow branch
348351
subprocess.run(
@@ -448,7 +451,7 @@ def main(options: Namespace):
448451
with open(pyproject, "rb") as fp:
449452
line_length = tomli.load(fp)["tool"]["black"]["line-length"]
450453
mode = black.FileMode(target_versions={black.TargetVersion.PY27}, line_length=line_length)
451-
print(black.format_str(output, mode=mode), end="")
454+
print(black.format_str(output, mode=mode), end="") # noqa: T201
452455

453456

454457
# def debug(options: Namespace):

0 commit comments

Comments
 (0)