(self, fullname, path, target=None)
| 213 | self._globally_enabled = scope is None |
| 214 | |
| 215 | def find_spec(self, fullname, path, target=None): |
| 216 | if _is_torch_proxy_blocked_module(fullname): |
| 217 | return self._find_spec_for_torch_proxy_blocked_module(fullname) |
| 218 | |
| 219 | if _is_torch_proxy_local_enabled_module( |
| 220 | fullname, self._local_enabled_scope |
| 221 | ): |
| 222 | return self._find_spec_for_torch_proxy_local_enabled_module( |
| 223 | fullname |
| 224 | ) |
| 225 | |
| 226 | if not _is_torch_module(fullname): |
| 227 | return None |
| 228 | |
| 229 | if _is_called_by_torch_proxy_blocked_module(): |
| 230 | if fullname in TORCH_MODULES_CACHE: |
| 231 | return self._find_spec_for_cached_torch_module(fullname) |
| 232 | return None |
| 233 | |
| 234 | if ( |
| 235 | not self._globally_enabled |
| 236 | and not _is_called_by_torch_proxy_local_enabled_module() |
| 237 | ): |
| 238 | if fullname in TORCH_MODULES_CACHE: |
| 239 | return self._find_spec_for_cached_torch_module(fullname) |
| 240 | return None |
| 241 | |
| 242 | return self._find_spec_for_torch_module(fullname) |
| 243 | |
| 244 | def _find_spec_for_specific_module( |
| 245 | self, |
no test coverage detected