1717"""
1818
1919from __future__ import annotations
20+
2021import importlib .resources as imlr
2122import os
2223import shutil
2627
2728from setuptools_scm import get_version
2829
29- from . import config , _styles
30+ from . import _styles , config
3031
3132if typing .TYPE_CHECKING :
32- from typing import NoReturn , Any , Iterator
33+ from typing import Any , Iterator , NoReturn
3334
3435
3536def _env (var : str ) -> bool :
3637 """Return whether var is set to True."""
37- val = os .getenv (var , default = '' ).lower ()
38- return val in (' true' , 't' , ' yes' , 'y' , 'on' , '1' )
38+ val = os .getenv (var , default = "" ).lower ()
39+ return val in (" true" , "t" , " yes" , "y" , "on" , "1" )
3940
4041
41- DEBUG = _env (' STAGPY_DEBUG' )
42- ISOLATED = _env (' STAGPY_ISOLATED' )
42+ DEBUG = _env (" STAGPY_DEBUG" )
43+ ISOLATED = _env (" STAGPY_ISOLATED" )
4344
4445
4546def sigint_handler (* _ : Any ) -> NoReturn :
@@ -48,7 +49,7 @@ def sigint_handler(*_: Any) -> NoReturn:
4849 It is set when you use StagPy as a command line tool to handle gracefully
4950 keyboard interruption.
5051 """
51- print (' \n So long, and thanks for all the fish.' )
52+ print (" \n So long, and thanks for all the fish." )
5253 sys .exit ()
5354
5455
@@ -61,7 +62,7 @@ def _iter_styles() -> Iterator[str]:
6162def _check_config () -> None :
6263 """Create config files as necessary."""
6364 config .CONFIG_DIR .mkdir (parents = True , exist_ok = True )
64- verfile = config .CONFIG_DIR / ' .version'
65+ verfile = config .CONFIG_DIR / " .version"
6566 uptodate = verfile .is_file () and verfile .read_text () == __version__
6667 if not uptodate :
6768 verfile .write_text (__version__ )
@@ -75,13 +76,17 @@ def _check_config() -> None:
7576
7677
7778if DEBUG :
78- print ('StagPy runs in DEBUG mode because the environment variable' ,
79- 'STAGPY_DEBUG is set to "True"' , sep = '\n ' , end = '\n \n ' )
79+ print (
80+ "StagPy runs in DEBUG mode because the environment variable" ,
81+ 'STAGPY_DEBUG is set to "True"' ,
82+ sep = "\n " ,
83+ end = "\n \n " ,
84+ )
8085else :
8186 _PREV_INT = signal .signal (signal .SIGINT , sigint_handler )
8287
8388try :
84- __version__ = get_version (root = '..' , relative_to = __file__ )
89+ __version__ = get_version (root = ".." , relative_to = __file__ )
8590except LookupError :
8691 try :
8792 from ._version import version as __version__
0 commit comments