MCPcopy Create free account
hub / github.com/modelscope/modelscope / __getattr__

Method __getattr__

modelscope/hub/api.py:306–324  ·  view source on GitHub ↗

Transparent proxy to the internal ``modelscope_hub.HubApi``. Only invoked when normal attribute lookup (instance dict, class hierarchy including :class:`LegacyHubApi`) fails. Private names are excluded to avoid recursion during ``__init__``.

(self, name: str)

Source from the content-addressed store, hash-verified

304 return out_path
305
306 def __getattr__(self, name: str):
307 """Transparent proxy to the internal ``modelscope_hub.HubApi``.
308
309 Only invoked when normal attribute lookup (instance dict, class
310 hierarchy including :class:`LegacyHubApi`) fails. Private names are
311 excluded to avoid recursion during ``__init__``.
312 """
313 if name.startswith('_'):
314 raise AttributeError(name)
315 try:
316 inner = object.__getattribute__(self, '_api')
317 except AttributeError as exc:
318 raise AttributeError(name) from exc
319 try:
320 return getattr(inner, name)
321 except AttributeError:
322 raise AttributeError(
323 f"'{type(self).__name__}' object has no attribute '{name}'"
324 ) from None
325
326
327class ModelScopeConfig:

Callers 8

forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
forwardMethod · 0.45
backboneMethod · 0.45
headMethod · 0.45
encoderMethod · 0.45
headMethod · 0.45

Calls 1

__getattribute__Method · 0.80

Tested by

no test coverage detected