(cls, fullname, alias=None, ispkg=False)
| 1021 | |
| 1022 | @classmethod |
| 1023 | def _resolve_filename(cls, fullname, alias=None, ispkg=False): |
| 1024 | if not fullname or not getattr(sys, '_stdlib_dir', None): |
| 1025 | return None, None |
| 1026 | try: |
| 1027 | sep = cls._SEP |
| 1028 | except AttributeError: |
| 1029 | sep = cls._SEP = '\\' if sys.platform == 'win32' else '/' |
| 1030 | |
| 1031 | if fullname != alias: |
| 1032 | if fullname.startswith('<'): |
| 1033 | fullname = fullname[1:] |
| 1034 | if not ispkg: |
| 1035 | fullname = f'{fullname}.__init__' |
| 1036 | else: |
| 1037 | ispkg = False |
| 1038 | relfile = fullname.replace('.', sep) |
| 1039 | if ispkg: |
| 1040 | pkgdir = f'{sys._stdlib_dir}{sep}{relfile}' |
| 1041 | filename = f'{pkgdir}{sep}__init__.py' |
| 1042 | else: |
| 1043 | pkgdir = None |
| 1044 | filename = f'{sys._stdlib_dir}{sep}{relfile}.py' |
| 1045 | return filename, pkgdir |
| 1046 | |
| 1047 | @classmethod |
| 1048 | def find_spec(cls, fullname, path=None, target=None): |
no test coverage detected