@@ -178,46 +178,46 @@ def __init__(
178178 )
179179
180180 def _get_xpehh_gwss_cache_name (self ):
181- """Safe resolver for xpehh gwss cache name.
181+ """Safely resolve the xpehh gwss cache name.
182182
183- Subclasses may define _xpehh_gwss_cache_name as a class attribute.
184- This method safely retrieves it or returns a default if unavailable.
183+ Supports class attribute, property, or legacy method override.
184+ Falls back to the default "xpehh_gwss_v1" if resolution fails.
185+
186+ See also: https://github.com/malariagen/malariagen-data-python/issues/1151
185187 """
186188 try :
187- # Try to get the cache name from the instance (respects MRO)
188- cache_name = getattr (self , "_xpehh_gwss_cache_name" )
189- # Validate it's actually a string, not a descriptor or other object
190- if not isinstance (cache_name , str ):
191- raise TypeError (
192- f"_xpehh_gwss_cache_name must resolve to a string, "
193- f"got { type (cache_name ).__name__ } "
194- )
195- return cache_name
196- except (AttributeError , TypeError ):
197- # Fallback to a generic cache name if subclass hasn't defined one
198- # or if the attribute isn't a proper string
199- return "xpehh_gwss_v1"
189+ name = self ._xpehh_gwss_cache_name
190+ # Handle legacy case where _xpehh_gwss_cache_name might be a
191+ # callable method rather than a property or class attribute.
192+ if callable (name ):
193+ name = name ()
194+ if isinstance (name , str ) and len (name ) > 0 :
195+ return name
196+ except NotImplementedError :
197+ pass
198+ # Fallback to default.
199+ return "xpehh_gwss_v1"
200200
201201 def _get_ihs_gwss_cache_name (self ):
202- """Safe resolver for ihs gwss cache name.
202+ """Safely resolve the ihs gwss cache name.
203203
204- Subclasses may define _ihs_gwss_cache_name as a class attribute.
205- This method safely retrieves it or returns a default if unavailable.
204+ Supports class attribute, property, or legacy method override.
205+ Falls back to the default "ihs_gwss_v1" if resolution fails.
206+
207+ See also: https://github.com/malariagen/malariagen-data-python/issues/1151
206208 """
207209 try :
208- # Try to get the cache name from the instance (respects MRO)
209- cache_name = getattr (self , "_ihs_gwss_cache_name" )
210- # Validate it's actually a string, not a descriptor or other object
211- if not isinstance (cache_name , str ):
212- raise TypeError (
213- f"_ihs_gwss_cache_name must resolve to a string, "
214- f"got { type (cache_name ).__name__ } "
215- )
216- return cache_name
217- except (AttributeError , TypeError ):
218- # Fallback to a generic cache name if subclass hasn't defined one
219- # or if the attribute isn't a proper string
220- return "ihs_gwss_v1"
210+ name = self ._ihs_gwss_cache_name
211+ # Handle legacy case where _ihs_gwss_cache_name might be a
212+ # callable method rather than a property or class attribute.
213+ if callable (name ):
214+ name = name ()
215+ if isinstance (name , str ) and len (name ) > 0 :
216+ return name
217+ except NotImplementedError :
218+ pass
219+ # Fallback to default.
220+ return "ihs_gwss_v1"
221221
222222 @staticmethod
223223 def _make_gene_cnv_label (gene_id , gene_name , cnv_type ):
0 commit comments