(cls, fullname, alias=None, ispkg=False)
| 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): |
no test coverage detected