@@ -136,15 +136,20 @@ def get_hed_versions(local_hed_directory=None, library_name=None, check_prerelea
136136
137137
138138def get_hed_version_path (xml_version , library_name = None , local_hed_directory = None ) -> Union [str , None ]:
139- """Get HED XML file path in a directory. Only returns filenames that exist.
139+ """Get the HED XML file path for a given version.
140+
141+ Searches the local cache first. If the version is not found and local_hed_directory
142+ is the default HED cache, the cache is refreshed from GitHub before a second lookup.
143+ No network call is made for custom directories.
140144
141145 Parameters:
142- xml_version (str): Returns this version if it exists
143- library_name (str or None): Optional the schema library name.
144- local_hed_directory (str): Path to local HED directory. Defaults to HED_CACHE_DIRECTORY
146+ xml_version (str): The version string to look up.
147+ library_name (str or None): Optional schema library name.
148+ local_hed_directory (str or None): Path to local HED directory. Defaults to HED_CACHE_DIRECTORY.
149+ Passing a custom path disables the automatic GitHub refresh.
145150
146151 Returns:
147- Union[str, None]: The path to the requested HED version the HED directory .
152+ Union[str, None]: The path to the requested HED XML file, or None .
148153
149154 """
150155 if not local_hed_directory :
@@ -154,7 +159,9 @@ def get_hed_version_path(xml_version, library_name=None, local_hed_directory=Non
154159 if result :
155160 return result
156161
157- # Version not found locally — try refreshing cache from GitHub (default cache only)
162+ # Version not found locally — try refreshing cache from GitHub (default cache only).
163+ # cache_xml_versions() returns -1 on failure (network error, lock contention, rate limit).
164+ # In that case the second lookup will return None, which the caller treats as "version not found".
158165 if not xml_version or local_hed_directory != HED_CACHE_DIRECTORY :
159166 return None
160167
0 commit comments