| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 88557bc commit 7204c13
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,19 +107,12 @@ | |||
| 107 | 107 | _logger = logging.getLogger(__name__) | |
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | - def _read_win_env_flag(name: str, default: bool) -> bool: | ||
| 111 | - """Read a boolean flag from an environment variable on Windows. | ||
| 110 | + def _read_env_flag(name: str, default: bool) -> bool: | ||
| 111 | + """Read a boolean flag from an environment variable. | ||
| 112 | 112 | ||
| 113 | 113 | :return: | |
| 114 | - On Windows, the flag, or the `default` value if absent or ambiguous. | ||
| 115 | - On all other operating systems, ``False``. | ||
| 116 | - | ||
| 117 | - :note: | ||
| 118 | - This only accesses the environment on Windows. | ||
| 114 | + The flag, or the `default` value if absent or ambiguous. | ||
| 119 | 115 | """ | |
| 120 | - if sys.platform != "win32": | ||
| 121 | - return False | ||
| 122 | - | ||
| 123 | 116 | try: | |
| 124 | 117 | value = os.environ[name] | |
| 125 | 118 | except KeyError: | |
@@ -140,6 +133,19 @@ def _read_win_env_flag(name: str, default: bool) -> bool: | |||
| 140 | 133 | return default | |
| 141 | 134 | ||
| 142 | 135 | ||
| 136 | + def _read_win_env_flag(name: str, default: bool) -> bool: | ||
| 137 | + """Read a boolean flag from an environment variable on Windows. | ||
| 138 | + | ||
| 139 | + :return: | ||
| 140 | + On Windows, the flag, or the `default` value if absent or ambiguous. | ||
| 141 | + On all other operating systems, ``False``. | ||
| 142 | + | ||
| 143 | + :note: | ||
| 144 | + This only accesses the environment on Windows. | ||
| 145 | + """ | ||
| 146 | + return sys.platform == "win32" and _read_env_flag(name, default) | ||
| 147 | + | ||
| 148 | + | ||
| 143 | 149 | #: We need an easy way to see if Appveyor TCs start failing, | |
| 144 | 150 | #: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy, | |
| 145 | 151 | #: till then, we wish to hide them. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments