Skip to content

Commit e4822ec

Browse files
committed
env var STAGPY_DEBUG enabled if it is set
StagPy would previously check that it is set to a "truthy" value, which added unneeded complexity.
1 parent bf048d6 commit e4822ec

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

stagpy/__init__.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
documentation at
55
https://stagpy.readthedocs.io/en/stable/
66
7-
When using the CLI interface, if the environment variable STAGPY_DEBUG is set
8-
to a truthy value, warnings are issued normally and StagpyError are raised.
9-
Otherwise, warnings are ignored and only a short form of encountered
10-
StagpyErrors is printed.
11-
12-
Truthy values for environment variables are 'true', 't', 'yes', 'y', 'on', '1',
13-
and uppercase versions of those.
7+
When using the CLI interface, warnings are ignored and only a short form of
8+
encountered StagpyErrors is printed. Set the environment variable STAGPY_DEBUG
9+
to issue warnings normally and raise StagpyError.
1410
"""
1511

1612
from __future__ import annotations
@@ -24,13 +20,7 @@
2420
from typing import Any, NoReturn
2521

2622

27-
def _env(var: str) -> bool:
28-
"""Return whether var is set to True."""
29-
val = os.getenv(var, default="").lower()
30-
return val in ("true", "t", "yes", "y", "on", "1")
31-
32-
33-
DEBUG = _env("STAGPY_DEBUG")
23+
DEBUG = os.getenv("STAGPY_DEBUG") is not None
3424

3525

3626
def sigint_handler(*_: Any) -> NoReturn:

0 commit comments

Comments
 (0)