Skip to content

Commit 36ec551

Browse files
committed
Do not load mplstyle when isolated
1 parent 639ca79 commit 36ec551

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

stagpy/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
http://stagpy.readthedocs.io/en/stable/
66
77
If the environment variable STAGPY_ISOLATED is set to 'True', StagPy does not
8-
attempt to read any configuration file.
8+
attempt to read any configuration file (including mplstyle).
99
1010
When using the CLI interface, if the environment variable STAGPY_DEBUG is set
1111
to 'True', warnings are issued normally and StagpyError are raised. Otherwise,
@@ -33,6 +33,7 @@ def _env(var):
3333

3434

3535
DEBUG = _env('STAGPY_DEBUG')
36+
ISOLATED = _env('STAGPY_ISOLATED')
3637

3738

3839
def sigint_handler(*_):
@@ -70,6 +71,8 @@ def load_mplstyle():
7071
stfile = config.CONFIG_DIR / (style + '.mplstyle')
7172
if stfile.is_file():
7273
style = str(stfile)
74+
if ISOLATED:
75+
break
7376
try:
7477
plt.style.use(style)
7578
except OSError:
@@ -94,10 +97,10 @@ def load_mplstyle():
9497
__version__ = 'unknown'
9598

9699
_CONF_FILES = ([config.CONFIG_FILE, config.CONFIG_LOCAL]
97-
if not _env('STAGPY_ISOLATED') else [])
100+
if not ISOLATED else [])
98101
conf = ConfigurationManager.from_dict_(config.CONF_DEF)
99102
conf.set_config_files_(*_CONF_FILES)
100-
if not _env('STAGPY_ISOLATED'):
103+
if not ISOLATED:
101104
_check_config()
102105
PARSING_OUT = conf.read_configs_()
103106

0 commit comments

Comments
 (0)