autodetect print/breakpoints (#4581)

* catch stray breakpoints and prints

* autodetect debug prints and breakpoints in main code

* readd hacky print in pyi_generator?
This commit is contained in:
Thomas Brandého 2025-01-03 12:51:02 -08:00 committed by GitHub
parent 97fb157b25
commit 53f09756b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 10 deletions

View File

@ -21,7 +21,7 @@ def get_package_size(venv_path: Path, os_name):
ValueError: when venv does not exist or python version is None.
"""
python_version = get_python_version(venv_path, os_name)
print("Python version:", python_version)
print("Python version:", python_version) # noqa: T201
if python_version is None:
raise ValueError("Error: Failed to determine Python version.")

View File

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

View File

@ -52,6 +52,7 @@ from reflex.state import (
StateManagerRedis,
reload_state_module,
)
from reflex.utils import console
try:
from selenium import webdriver # pyright: ignore [reportMissingImports]
@ -385,7 +386,7 @@ class AppHarness:
)
if not line:
break
print(line) # for pytest diagnosis
print(line) # for pytest diagnosis #noqa: T201
m = re.search(reflex.constants.Next.FRONTEND_LISTENING_REGEX, line)
if m is not None:
self.frontend_url = m.group(1)
@ -403,11 +404,10 @@ class AppHarness:
)
# catch I/O operation on closed file.
except ValueError as e:
print(e)
console.error(str(e))
break
if not line:
break
print(line)
self.frontend_output_thread = threading.Thread(target=consume_frontend_output)
self.frontend_output_thread.start()

View File

@ -1202,4 +1202,4 @@ class PyiGenerator:
or "Var[Template]" in line
):
line = line.rstrip() + " # type: ignore\n"
print(line, end="")
print(line, end="") # noqa: T201

View File

@ -25,7 +25,7 @@ def _pid_exists(pid):
def _wait_for_port(port, server_pid, timeout) -> Tuple[bool, str]:
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.") # noqa: T201
while True:
if not _pid_exists(server_pid):
return False, f"Server PID {server_pid} is not running."
@ -56,9 +56,9 @@ def main():
for f in as_completed(futures):
ok, msg = f.result()
if ok:
print(f"OK: {msg}")
print(f"OK: {msg}") # noqa: T201
else:
print(f"FAIL: {msg}")
print(f"FAIL: {msg}") # noqa: T201
exit(1)