Skip to content

Direct import for metaclass ABCMeta #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/3/_importlib_modulespec.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# - Loader in importlib.abc
# - ModuleSpec in importlib.machinery (3.4 and later only)

import abc
from abc import ABCMeta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I'd say add abstractmethod too and get rid of the previous line (import abc), and modify all @abc.abstractmethod to @abstractmethod.

import sys
from typing import Any, Optional

Expand Down Expand Up @@ -33,7 +33,7 @@ class ModuleType:
__spec__ = ... # type: Optional[ModuleSpec]
def __init__(self, name: str, doc: str) -> None: ...

class Loader(metaclass=abc.ABCMeta):
class Loader(metaclass=ABCMeta):
def load_module(self, fullname: str) -> ModuleType: ...
if sys.version_info >= (3, 3):
def module_repr(self, module: ModuleType) -> str: ...
Expand Down
12 changes: 6 additions & 6 deletions stdlib/3/importlib/abc.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import abc
from abc import ABCMeta, abstractmethod
if sys.version_info >= (3, 4):
from _importlib_modulespec import ModuleSpec
import sys
Expand All @@ -11,23 +11,23 @@ _Path = Union[bytes, str]
# exists in its own stub file (with ModuleSpec and ModuleType).
from _importlib_modulespec import Loader as Loader # Exported

class Finder(metaclass=abc.ABCMeta): ...
class Finder(metaclass=ABCMeta): ...
# Technically this class defines the following method, but its subclasses
# in this module violate its signature. Since this class is deprecated, it's
# easier to simply ignore that this method exists.
#@abc.abstractmethod
#@abstractmethod
#def find_module(self, fullname: str,
# path: Sequence[_Path] = None) -> Optional[Loader]: ...

class ResourceLoader(Loader):
@abc.abstractmethod
@abstractmethod
def get_data(self, path: _Path) -> bytes: ...

class InspectLoader(Loader):
def is_package(self, fullname: str) -> bool: ...
def get_code(self, fullname: str) -> Optional[types.CodeType]: ...
def load_module(self, fullname: str) -> types.ModuleType: ...
@abc.abstractmethod
@abstractmethod
def get_source(self, fullname: str) -> Optional[str]: ...
if sys.version_info >= (3, 4):
def exec_module(self, module: types.ModuleType) -> None: ...
Expand All @@ -40,7 +40,7 @@ class InspectLoader(Loader):
path: str = '<string>') -> types.CodeType: ...

class ExecutionLoader(InspectLoader):
@abc.abstractmethod
@abstractmethod
def get_filename(self, fullname: str) -> _Path: ...
def get_code(self, fullname: str) -> Optional[types.CodeType]: ...

Expand Down