Skip to content

Commit

Permalink
fix ruff errs
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 15, 2024
1 parent 0b0ea8e commit 3c518a3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,14 +1601,14 @@ def check_gone(proc, timeout):
check_gone(proc, timeout)
else:
check_gone(proc, max_timeout)
alive = alive - gone
alive = alive - gone # noqa PLR6104

if alive:
# Last attempt over processes survived so far.
# timeout == 0 won't make this function wait any further.
for proc in alive:
check_gone(proc, 0)
alive = alive - gone
alive = alive - gone # noqa: PLR6104

return (list(gone), list(alive))

Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ ignore = [
"FIX", # Line contains TODO / XXX / ..., consider resolving the issue
"FLY", # flynt (PYTHON2.7 COMPAT)
"FURB101", # `open` and `read` should be replaced by `Path(src).read_text()`
"FURB103", # `open` and `write` should be replaced by `Path(...).write_text(...)`
"FURB113", # Use `x.extend(('a', 'b', 'c'))` instead of repeatedly calling `x.append()`
"FURB116", # [*] Replace `hex` call with `f"{start:x}"`
"FURB118", # [*] Use `operator.add` instead of defining a lambda
"FURB140", # [*] Use `itertools.starmap` instead of the generator
"FURB145", # [*] Prefer `copy` method over slicing (PYTHON2.7 COMPAT)
"FURB192", # [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence
"INP", # flake8-no-pep420
"N801", # Class name `async_chat` should use CapWords convention (ASYNCORE COMPAT)
"N802", # Function name X should be lowercase.
Expand Down Expand Up @@ -108,7 +111,7 @@ ignore = [
"psutil/tests/*" = ["EM101", "TRY003"]
"psutil/tests/runner.py" = ["T201", "T203"]
"scripts/*" = ["T201", "T203"]
"scripts/internal/*" = ["T201", "T203"]
"scripts/internal/*" = ["EM101", "T201", "T203", "TRY003"]
"setup.py" = ["T201", "T203"]

[tool.ruff.lint.isort]
Expand Down
10 changes: 7 additions & 3 deletions scripts/internal/print_announce.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ def get_changes():
block = []

# eliminate the part preceding the first block
for line in lines:
while lines:
line = lines.pop(0)
if line.startswith('===='):
break
lines.pop(0)
else:
raise ValueError("something wrong")

for line in lines:
lines.pop(0)
while lines:
line = lines.pop(0)
line = line.rstrip()
if re.match(r"^- \d+_", line):
Expand All @@ -101,6 +103,8 @@ def get_changes():
if line.startswith('===='):
break
block.append(line)
else:
raise ValueError("something wrong")

# eliminate bottom empty lines
block.pop(-1)
Expand Down

0 comments on commit 3c518a3

Please sign in to comment.