MCPcopy Index your code
hub / github.com/RustPython/RustPython / _resolve_filename

Method _resolve_filename

Lib/importlib/_bootstrap.py:1107–1129  ·  view source on GitHub ↗
(cls, fullname, alias=None, ispkg=False)

Source from the content-addressed store, hash-verified

1105
1106 @classmethod
1107 def _resolve_filename(cls, fullname, alias=None, ispkg=False):
1108 if not fullname or not getattr(sys, '_stdlib_dir', None):
1109 return None, None
1110 try:
1111 sep = cls._SEP
1112 except AttributeError:
1113 sep = cls._SEP = '\\' if sys.platform == 'win32' else '/'
1114
1115 if fullname != alias:
1116 if fullname.startswith('<'):
1117 fullname = fullname[1:]
1118 if not ispkg:
1119 fullname = f'{fullname}.__init__'
1120 else:
1121 ispkg = False
1122 relfile = fullname.replace('.', sep)
1123 if ispkg:
1124 pkgdir = f'{sys._stdlib_dir}{sep}{relfile}'
1125 filename = f'{pkgdir}{sep}__init__.py'
1126 else:
1127 pkgdir = None
1128 filename = f'{sys._stdlib_dir}{sep}{relfile}.py'
1129 return filename, pkgdir
1130
1131 @classmethod
1132 def find_spec(cls, fullname, path=None, target=None):

Callers 2

_fix_up_moduleMethod · 0.45
find_specMethod · 0.45

Calls 3

getattrFunction · 0.85
startswithMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected