@@ -471,22 +471,23 @@ async def get_libdoc(self) -> VariablesDoc:
471
471
class LibraryMetaData :
472
472
meta_version : str
473
473
name : Optional [str ]
474
+ member_name : Optional [str ]
474
475
origin : Optional [str ]
475
476
submodule_search_locations : Optional [List [str ]]
476
477
by_path : bool
477
478
478
479
mtimes : Optional [Dict [str , int ]] = None
479
480
480
481
@property
481
- def filepath_base (self ) -> Path :
482
+ def filepath_base (self ) -> str :
482
483
if self .by_path :
483
484
if self .origin is not None :
484
485
p = Path (self .origin )
485
486
486
- return Path ( f"{ zlib .adler32 (str (p .parent ).encode ('utf-8' )):08x} _{ p .stem } " )
487
+ return f"{ zlib .adler32 (str (p .parent ).encode ('utf-8' )):08x} _{ p .stem } "
487
488
else :
488
489
if self .name is not None :
489
- return Path ( self .name .replace ("." , "/" ))
490
+ return self .name .replace ("." , "/" ) + ( f". { self . member_name } " if self . member_name else "" )
490
491
491
492
raise ValueError ("Cannot determine filepath base." )
492
493
@@ -832,13 +833,14 @@ async def get_library_meta(
832
833
module_spec : Optional [ModuleSpec ] = None
833
834
if is_library_by_path (import_name ):
834
835
if (p := Path (import_name )).exists ():
835
- result = LibraryMetaData (__version__ , p .stem , import_name , None , True )
836
+ result = LibraryMetaData (__version__ , p .stem , None , import_name , None , True )
836
837
else :
837
838
module_spec = get_module_spec (import_name )
838
839
if module_spec is not None and module_spec .origin is not None :
839
840
result = LibraryMetaData (
840
841
__version__ ,
841
842
module_spec .name ,
843
+ module_spec .member_name ,
842
844
module_spec .origin ,
843
845
module_spec .submodule_search_locations ,
844
846
False ,
@@ -900,13 +902,14 @@ async def get_variables_meta(
900
902
module_spec : Optional [ModuleSpec ] = None
901
903
if is_variables_by_path (import_name ):
902
904
if (p := Path (import_name )).exists ():
903
- result = LibraryMetaData (__version__ , p .stem , import_name , None , True )
905
+ result = LibraryMetaData (__version__ , p .stem , None , import_name , None , True )
904
906
else :
905
907
module_spec = get_module_spec (import_name )
906
908
if module_spec is not None and module_spec .origin is not None :
907
909
result = LibraryMetaData (
908
910
__version__ ,
909
911
module_spec .name ,
912
+ module_spec .member_name ,
910
913
module_spec .origin ,
911
914
module_spec .submodule_search_locations ,
912
915
False ,
@@ -1059,15 +1062,16 @@ async def _get_libdoc(name: str, args: Tuple[Any, ...], working_dir: str, base_d
1059
1062
)
1060
1063
1061
1064
self ._logger .debug (lambda : f"Load Library { source } { args !r} " )
1065
+
1062
1066
if meta is not None :
1063
- meta_file = Path (self .lib_doc_cache_path , meta .filepath_base . with_suffix ( ".meta.json" ) )
1067
+ meta_file = Path (self .lib_doc_cache_path , meta .filepath_base + ".meta.json" )
1064
1068
if meta_file .exists ():
1065
1069
try :
1066
1070
try :
1067
1071
saved_meta = from_json (meta_file .read_text ("utf-8" ), LibraryMetaData )
1068
1072
spec_path = None
1069
1073
if saved_meta == meta :
1070
- spec_path = Path (self .lib_doc_cache_path , meta .filepath_base . with_suffix ( ".spec.json" ) )
1074
+ spec_path = Path (self .lib_doc_cache_path , meta .filepath_base + ".spec.json" )
1071
1075
return from_json (
1072
1076
spec_path .read_text ("utf-8" ),
1073
1077
LibraryDoc ,
@@ -1110,8 +1114,8 @@ async def _get_libdoc(name: str, args: Tuple[Any, ...], working_dir: str, base_d
1110
1114
self ._logger .warning (lambda : f"stdout captured at loading library { name } { args !r} :\n { result .stdout } " )
1111
1115
try :
1112
1116
if meta is not None :
1113
- meta_file = Path (self .lib_doc_cache_path , meta .filepath_base . with_suffix ( ".meta.json" ) )
1114
- spec_file = Path (self .lib_doc_cache_path , meta .filepath_base . with_suffix ( ".spec.json" ) )
1117
+ meta_file = Path (self .lib_doc_cache_path , meta .filepath_base + ".meta.json" )
1118
+ spec_file = Path (self .lib_doc_cache_path , meta .filepath_base + ".spec.json" )
1115
1119
spec_file .parent .mkdir (parents = True , exist_ok = True )
1116
1120
1117
1121
try :
@@ -1202,16 +1206,14 @@ async def _get_libdoc(name: str, args: Tuple[Any, ...], working_dir: str, base_d
1202
1206
1203
1207
self ._logger .debug (lambda : f"Load variables { source } { args !r} " )
1204
1208
if meta is not None :
1205
- meta_file = Path (self .variables_doc_cache_path , meta .filepath_base . with_suffix ( ".meta.json" ) )
1209
+ meta_file = Path (self .variables_doc_cache_path , meta .filepath_base + ".meta.json" )
1206
1210
if meta_file .exists ():
1207
1211
try :
1208
1212
try :
1209
1213
saved_meta = from_json (meta_file .read_text ("utf-8" ), LibraryMetaData )
1210
1214
spec_path = None
1211
1215
if saved_meta == meta :
1212
- spec_path = Path (
1213
- self .variables_doc_cache_path , meta .filepath_base .with_suffix (".spec.json" )
1214
- )
1216
+ spec_path = Path (self .variables_doc_cache_path , meta .filepath_base + ".spec.json" )
1215
1217
return from_json (
1216
1218
spec_path .read_text ("utf-8" ),
1217
1219
VariablesDoc ,
@@ -1255,8 +1257,8 @@ async def _get_libdoc(name: str, args: Tuple[Any, ...], working_dir: str, base_d
1255
1257
1256
1258
try :
1257
1259
if meta is not None :
1258
- meta_file = Path (self .variables_doc_cache_path , meta .filepath_base . with_suffix ( ".meta.json" ) )
1259
- spec_file = Path (self .variables_doc_cache_path , meta .filepath_base . with_suffix ( ".spec.json" ) )
1260
+ meta_file = Path (self .variables_doc_cache_path , meta .filepath_base + ".meta.json" )
1261
+ spec_file = Path (self .variables_doc_cache_path , meta .filepath_base + ".spec.json" )
1260
1262
spec_file .parent .mkdir (parents = True , exist_ok = True )
1261
1263
1262
1264
try :
0 commit comments