enable 'ANN001' for reflex folder (ignore tests and benchmarks)

This commit is contained in:
Lendemor 2024-11-22 17:01:45 +01:00
parent 598a500c7c
commit 4178103baf
2 changed files with 6 additions and 4 deletions

View File

@ -92,14 +92,16 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff] [tool.ruff]
target-version = "py39" target-version = "py39"
output-format="concise"
lint.isort.split-on-trailing-comma = false lint.isort.split-on-trailing-comma = false
lint.select = ["B", "D", "E", "F", "I", "SIM", "W"] lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "ANN001"]
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"] lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"]
lint.pydocstyle.convention = "google" lint.pydocstyle.convention = "google"
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] "__init__.py" = ["F401"]
"tests/*.py" = ["D100", "D103", "D104", "B018"] "tests/*.py" = ["D100", "D103", "D104", "B018", "ANN001"]
"benchmarks/*.py" = ["ANN001"]
"reflex/.templates/*.py" = ["D100", "D103", "D104"] "reflex/.templates/*.py" = ["D100", "D103", "D104"]
"*.pyi" = ["D301", "D415", "D417", "D418", "E742"] "*.pyi" = ["D301", "D415", "D417", "D418", "E742"]
"*/blank.py" = ["I001"] "*/blank.py" = ["I001"]

View File

@ -14,7 +14,7 @@ from typing import Tuple
import psutil import psutil
def _pid_exists(pid): def _pid_exists(pid: int):
# os.kill(pid, 0) doesn't work on Windows (actually kills the PID) # os.kill(pid, 0) doesn't work on Windows (actually kills the PID)
# psutil.pid_exists() doesn't work on Windows (does os.kill underneath) # psutil.pid_exists() doesn't work on Windows (does os.kill underneath)
# psutil.pids() seems to return the right thing. Inefficient but doesn't matter - keeps things simple. # psutil.pids() seems to return the right thing. Inefficient but doesn't matter - keeps things simple.
@ -23,7 +23,7 @@ def _pid_exists(pid):
return pid in psutil.pids() return pid in psutil.pids()
def _wait_for_port(port, server_pid, timeout) -> Tuple[bool, str]: def _wait_for_port(port: int, server_pid: int, timeout: float) -> Tuple[bool, str]:
start = time.time() start = time.time()
print(f"Waiting for up to {timeout} seconds for port {port} to start listening.") print(f"Waiting for up to {timeout} seconds for port {port} to start listening.")
while True: while True: