diff --git a/PYTHON/lichess_bot/main.py b/PYTHON/lichess_bot/main.py index 77cadd0..1efb900 100644 --- a/PYTHON/lichess_bot/main.py +++ b/PYTHON/lichess_bot/main.py @@ -295,7 +295,9 @@ def run_bot(log_level: str = "INFO", decline_correspondence: bool = False) -> No lines: list[str] = [] ply_line_re = __import__("re").compile(r"^\s*(\d+)\s") # Read stdout line by line - assert proc.stdout is not None + if proc.stdout is None: + msg = "subprocess stdout is None" + raise RuntimeError(msg) for line in proc.stdout: lines.append(line) m = ply_line_re.match(line) @@ -321,7 +323,9 @@ def run_bot(log_level: str = "INFO", decline_correspondence: bool = False) -> No ) # Capture any remaining stderr and ensure process ends - assert proc.stderr is not None + if proc.stderr is None: + msg = "subprocess stderr is None" + raise RuntimeError(msg) stderr_text = proc.stderr.read() or "" ret = proc.wait() analysis_text = "".join(lines) diff --git a/pyproject.toml b/pyproject.toml index 7d07335..f420d20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ ignore = [ "COM812", # Trailing comma missing (conflicts with formatter) "ISC001", # Implicit string concatenation (conflicts with formatter) # Relaxed for script-heavy repository - "S101", # Use of assert - acceptable in this codebase "ANN001", # Missing type annotation for function argument "ANN002", # Missing type annotation for *args "ANN003", # Missing type annotation for **kwargs @@ -102,6 +101,9 @@ unfixable = [] "S101", # Allow assert in tests "PLR2004", # Allow magic values in tests ] +"**/test_*.py" = [ + "S101", # Allow assert in tests +] "**/conftest.py" = [ "D100", # Allow missing module docstring "D103", # Allow missing function docstring