Skip to content
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

Fix RawConfigParser.readfp() annotation #2443

Merged
merged 1 commit into from
Sep 11, 2018
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
6 changes: 4 additions & 2 deletions stdlib/2/ConfigParser.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, IO, Sequence, Tuple, Union, List, Dict
from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Protocol

DEFAULTSECT = ... # type: str
MAX_INTERPOLATION_DEPTH = ... # type: int
Expand Down Expand Up @@ -50,6 +50,8 @@ class MissingSectionHeaderError(ParsingError):
line = ... # type: Any
def __init__(self, filename: str, lineno: Any, line: Any) -> None: ...

class _Readable(Protocol):
def readline(self) -> str: ...

class RawConfigParser:
_dict = ... # type: Any
Expand All @@ -66,7 +68,7 @@ class RawConfigParser:
def has_section(self, section: str) -> bool: ...
def options(self, section: str) -> List[str]: ...
def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
def readfp(self, fp: IO[str], filename: str = ...) -> None: ...
def readfp(self, fp: _Readable, filename: str = ...) -> None: ...
def get(self, section: str, option: str) -> str: ...
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
def _get(self, section: str, conv: type, option: str) -> Any: ...
Expand Down
6 changes: 1 addition & 5 deletions stdlib/3/configparser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ class RawConfigParser(_parser):

def read(self, filenames: Union[_Path, Iterable[_Path]],
encoding: Optional[str] = ...) -> List[str]: ...

def readfp(self, fp: IO[str], filename: Optional[str] = ...) -> None: ...

def read_file(self, f: Iterable[str], source: Optional[str] = ...) -> None: ...

def read_string(self, string: str, source: str = ...) -> None: ...

def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]],
source: str = ...) -> None: ...
def readfp(self, fp: Iterable[str], filename: Optional[str] = ...) -> None: ...

# These get* methods are partially applied (with the same names) in
# SectionProxy; the stubs should be kept updated together
Expand Down