MCPcopy
hub / github.com/huggingface/transformers / find_spec

Method find_spec

utils/check_import_complexity.py:89–109  ·  view source on GitHub ↗
(self, fullname: str, path=None, target=None)

Source from the content-addressed store, hash-verified

87 self._original = list(original_meta_path)
88
89 def find_spec(self, fullname: str, path=None, target=None):
90 if self._tracer.is_seen(fullname):
91 return None
92
93 for finder in self._original:
94 try:
95 spec = finder.find_spec(fullname, path, target) if hasattr(finder, "find_spec") else None
96 except Exception:
97 continue
98
99 if spec is None:
100 continue
101
102 self._tracer.record(fullname)
103
104 if spec.loader is not None:
105 spec.loader = LoaderProxy(spec.loader, self._tracer, fullname)
106
107 return spec
108
109 return None
110
111
112class ImportTreeTracer:

Callers 15

_is_package_availableFunction · 0.80
is_torch_tpu_availableFunction · 0.80
is_ipython_availableFunction · 0.80
is_in_notebookFunction · 0.80
is_wandb_availableFunction · 0.80
is_trackio_availableFunction · 0.80
is_clearml_availableFunction · 0.80
is_tensorboard_availableFunction · 0.80

Calls 3

LoaderProxyClass · 0.85
is_seenMethod · 0.80
recordMethod · 0.80

Tested by 2

test_module_specMethod · 0.64