24
24
from .jargon import Jargon
25
25
from .resources import DEFAULT_DATA , DEFAULT_HEADER
26
26
27
- JARGON_PATH = os .path .join (config .savePath , 'jargon.yaml' )
27
+ JARGON_PATH = os .path .join (config .savePath , 'jargon.yaml' ) if config . savePath is not None else None
28
28
29
29
30
30
class JargonLoader :
@@ -44,14 +44,15 @@ def _is_stale(self):
44
44
45
45
def _load_jargon (self ):
46
46
jargondata = yaml .load (DEFAULT_DATA , Loader = yaml .SafeLoader )
47
- with open (JARGON_PATH ) as f :
48
- userdata = yaml .load (f , Loader = yaml .SafeLoader )
49
- jargondata .update (userdata )
47
+ if JARGON_PATH is not None :
48
+ with open (JARGON_PATH ) as f :
49
+ userdata = yaml .load (f , Loader = yaml .SafeLoader )
50
+ jargondata .update (userdata )
50
51
self .jargon_mtime = self ._get_jargon_file_mtime ()
51
52
self ._jargon = Jargon (jargondata )
52
53
53
54
def _get_jargon_file_mtime (self ) -> int :
54
- if not os .path .exists (self .jargon_path ):
55
+ if self . jargon_path is None or not os .path .exists (self .jargon_path ):
55
56
return 0
56
57
return os .stat (self .jargon_path ).st_mtime
57
58
@@ -82,4 +83,5 @@ def instance(jargon_path=None):
82
83
return JargonLoader ._instance
83
84
84
85
85
- JargonLoader .init_user_jargon (JARGON_PATH )
86
+ if JARGON_PATH is not None :
87
+ JargonLoader .init_user_jargon (JARGON_PATH )
0 commit comments