mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
add some types to importlib (#340)
This commit is contained in:
committed by
Matthias Kramm
parent
6d8628c247
commit
cf655f6f02
@@ -1,3 +1,4 @@
|
||||
from importlib.abc import Loader
|
||||
import sys
|
||||
import types
|
||||
from typing import Any, Mapping, Optional, Sequence
|
||||
@@ -9,8 +10,7 @@ def __import__(name: str, globals: Mapping[str, Any] = None,
|
||||
def import_module(name: str, package: str = None) -> types.ModuleType: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
# Optionally returns a loader, but importlib.abc doesn't have a stub file.
|
||||
def find_loader(name: str, path: str = None): ...
|
||||
def find_loader(name: str, path: str = None) -> Optional[Loader]: ...
|
||||
|
||||
def invalidate_caches() -> None: ...
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class InspectLoader(Loader):
|
||||
path: str = '<string>') -> types.CodeType: ...
|
||||
elif sys.version_info >= (3, 5):
|
||||
@staticmethod
|
||||
def source_to_code(self, data: Union[bytes, str],
|
||||
def source_to_code(data: Union[bytes, str],
|
||||
path: str = '<string>') -> types.CodeType: ...
|
||||
|
||||
class ExecutionLoader(InspectLoader):
|
||||
|
||||
Reference in New Issue
Block a user