8000 csv, ctypes, configparser explanations by hatal175 · Pull Request #5204 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

csv, ctypes, configparser explanations #5204

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
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
csv, ctypes, configparser explanations
  • Loading branch information
hatal175 committed Apr 11, 2021
commit 68036f512d0dd9b87ac5d731cf83c8afd30a7683
6 changes: 4 additions & 2 deletions stdlib/configparser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class Interpolation:

class BasicInterpolation(Interpolation): ...
class ExtendedInterpolation(Interpolation): ...
class LegacyInterpolation(Interpolation): ...

class LegacyInterpolation(Interpolation):
def before_get(self, parser: _parser, section: str, option: str, value: str, vars: _section) -> str: ...

class RawConfigParser(_parser):
_SECT_TMPL: ClassVar[str] = ... # Undocumented
Expand Down Expand Up @@ -188,7 +190,7 @@ class SectionProxy(MutableMapping[str, str]):
def getboolean(
self, option: str, fallback: _T = ..., *, raw: bool = ..., vars: Optional[_section] = ...
) -> Union[bool, _T]: ...
# SectionProxy can have arbitrary attributes when custon converters are used
# SectionProxy can have arbitrary attributes when custom converters are used
def __getattr__(self, key: str) -> Callable[..., Any]: ...

class ConverterMapping(MutableMapping[str, Optional[_converter]]):
Expand Down
30 changes: 20 additions & 10 deletions stdlib/ctypes/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,25 @@ class CDLL(object):
_name: str = ...
_handle: int = ...
_FuncPtr: Type[_FuncPointer] = ...
def __init__(
self,
name: Optional[str],
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
use_last_error: bool = ...,
winmode: Optional[int] = ...,
) -> None: ...
if sys.version_info < (3, 8):
def __init__(
self,
name: Optional[str],
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
use_last_error: bool = ...,
) -> None: ...
else:
def __init__(
self,
name: Optional[str],
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
use_last_error: bool = ...,
winmode: Optional[int] = ...,
) -> None: ...
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
def __getitem__(self, name: str) -> _NamedFuncPointer: ...

Expand Down Expand Up @@ -151,7 +161,7 @@ def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...

_CastT = TypeVar("_CastT", bound=_CanCastTo)

def cast(obj: _UnionT[_CData, _CArgObject, int], type: Type[_CastT]) -> _CastT: ...
def cast(obj: _UnionT[_CData, _CArgObject, int], typ: Type[_CastT]) -> _CastT: ...
def create_string_buffer(init: _UnionT[int, bytes], size: Optional[int] = ...) -> Array[c_char]: ...

c_buffer = create_string_buffer
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_whitelists/py36.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ collections.AsyncGenerator.ag_running
collections.UserString.maketrans
contextlib._GeneratorContextManager.__init__
copy.PyStringMap
ctypes.CDLL.__init__
email.message.MIMEPart.as_string
enum.Enum._generate_next_value_
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_whitelists/py37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ contextvars.Context.get
contextvars.ContextVar.get
contextlib.nullcontext # not a function at runtime
copy.PyStringMap
ctypes.CDLL.__init__
dataclasses.field
email.message.MIMEPart.as_string
enum.Enum._generate_next_value_
Expand Down
20 changes: 10 additions & 10 deletions tests/stubtest_whitelists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,24 @@ collections.abc.Generator.gi_yieldfrom
collections.abc.Mapping.get
collections.abc.Sequence.index
collections.deque.__hash__
configparser.LegacyInterpolation.before_get
configparser.SectionProxy.__getattr__
configparser.SectionProxy.__getattr__ # SectionProxy can have arbitrary attributes when custom converters are used
# SectionProxy get functions are set in __init__
configparser.SectionProxy.getboolean
configparser.SectionProxy.getfloat
configparser.SectionProxy.getint
# The Dialect properties are initialized as None in Dialect but their values are enforced in _Dialect
csv.Dialect.delimiter
csv.Dialect.doublequote
csv.Dialect.lineterminator
csv.Dialect.quoting
csv.Dialect.skipinitialspace
ctypes.Array.__iter__
ctypes.CDLL._FuncPtr
ctypes.cast
ctypes.memmove
ctypes.memset
ctypes.pointer
ctypes.string_at
ctypes.wstring_at
ctypes.Array.__iter__ # mypy doesn't support using __getitem__ instead of __iter__ so this is here https://github.com/python/mypy/issues/2220
ctypes.CDLL._FuncPtr # None at class level but initialized in __init__ to this value
ctypes.memmove # CFunctionType
ctypes.memset # CFunctionType
ctypes.pointer # imported C function
ctypes.string_at # docstring argument name is wrong
Copy link
Member

Choose a reason for hiding this comment

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

Might want to report this as a CPython bug

ctypes.wstring_at # docstring argument name is wrong
dbm.error
difflib.SequenceMatcher.__init__ # mypy default value for generic parameter issues. See https://github.com/python/mypy/issues/3737
distutils.command.bdist_packager # It exists in docs as package name but not in code except as a mention in a comment.
Expand Down
0