Bump mypy to 1.9, add to json.encoder, small fixups (#11549)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Shantanu
2024-03-09 14:25:00 -08:00
committed by GitHub
parent 5b1fd121e0
commit 4d8ae17776
40 changed files with 71 additions and 90 deletions

View File

@@ -17,3 +17,5 @@ async def samefile(
f1: FileDescriptorOrPath, f2: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> bool: ...
async def sameopenfile(fp1: int, fp2: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ...
async def islink(path: FileDescriptorOrPath) -> bool: ...
async def ismount(path: FileDescriptorOrPath) -> bool: ...

View File

@@ -5,6 +5,18 @@ boltons.strutils.int_list_to_int_tuples
# Internal compatibility aliases
boltons.cacheutils.basestring
boltons.funcutils.basestring
boltons.funcutils.inspect_formatargspec
boltons.funcutils.make_method
boltons.iterutils.basestring
boltons.cacheutils.bytes
boltons.cacheutils.str
boltons.cacheutils.unicode
boltons.cacheutils.xrange
boltons.deprutils.ModuleType.__dict__
boltons.deprutils.ModuleType.__getattr__
boltons.iterutils.unicode
boltons.iterutils.xrange
boltons.mathutils.unicode
boltons.urlutils.OMD
boltons.urlutils.unichr
boltons.urlutils.unicode

View File

@@ -4,6 +4,8 @@ from typing import Any, Literal
g_token_cache: dict[str, list[tuple[str, str]]] # undocumented
python3: Literal[True]
string_type = str
unicode_type = str
def unicode(x: str, y: str) -> str: ...
def render(

View File

@@ -2,6 +2,3 @@
colorama.winterm.WinColor
colorama.winterm.WinStyle
colorama.winterm.WinTerm
# A re-export that's an implementation detail:
colorama.winterm.get_osfhandle

View File

@@ -7,3 +7,4 @@ decorator.FunctionMaker.varkw
decorator.decorate
decorator.decorator
decorator.get_init
decorator.EMPTY

View File

@@ -14,6 +14,8 @@ fanstatic.core.DummyNeededResources.clear
fanstatic.core.DummyNeededResources.library_url
fanstatic.core.DummyNeededResources.resources
fanstatic.compiler.mtime
# Error: is inconsistent
# ======================
# The core API for Dependable is a bit annoying, since the base class

View File

@@ -12,8 +12,3 @@ fpdf.fonts.HarfBuzzFont
# fixed in later versions.
fpdf.FPDF.set_encryption
fpdf.fpdf.FPDF.set_encryption
# Runtime has some internal arguments.
fpdf.syntax.build_obj_dict
fpdf.ViewerPreferences.serialize
fpdf\.[a-z]+\.[A-Za-z]+\.serialize

View File

@@ -74,7 +74,6 @@ gevent.ssl.base64
gevent.ssl.create_connection
gevent.ssl.errno
gevent.ssl.os
gevent.ssl.socket_error
gevent.ssl.warnings
gevent\.subprocess\._[A-Za-z0-9]\w*
@@ -147,11 +146,7 @@ gevent.Greenlet.link_value
gevent.greenlet.Greenlet.link
gevent.greenlet.Greenlet.link_exception
gevent.greenlet.Greenlet.link_value
gevent._ffi.watcher.IoMixin.__init__
gevent._threading.Queue.qsize
gevent.monkey.patch_module
gevent.monkey.patch_ssl
gevent.monkey.patch_thread
# removed deprecated argument
gevent._hub_primitives.wait_readwrite
@@ -195,22 +190,10 @@ gevent.ssl.get_server_certificate
# for now we ignore that fact, most of the ways to call Popen should be compatible
gevent.subprocess.Popen.__init__
# we exclude the undocumented internal argument _raise_exc from the stubs
gevent.subprocess.Popen.wait
# we exclude the undocumented internal argument _format_hub from the stubs
gevent.threadpool.ThreadPool.__repr__
# gevent overwrites with a named parameter for fd, but we're fine with only
# supporting the API of the superclass
gevent.threadpool.ThreadPoolExecutor.submit
# we exclude the undocumented internal argument _one_shot from the stubs
gevent.Timeout.__init__
gevent.Timeout.start_new
gevent.timeout.Timeout.__init__
gevent.timeout.Timeout.start_new
# Error: is not a type/function
# =====================
# zope.interface related errors, these shouldn't matter

View File

@@ -4,3 +4,7 @@ hdbcli.dbapi.Error.errortext
hdbcli.dbapi.Warning.errorcode
hdbcli.dbapi.Warning.errortext
hdbcli.dbapi.ExecuteManyErrorEntry.rownumber
hdbcli.dbapi.buffer
hdbcli.dbapi.long
hdbcli.dbapi.unicode

View File

@@ -13,3 +13,4 @@ scheme: Any
challenge: Any
authentication_info: Any
www_authenticate: Any
downcaseTokens: Any

View File

@@ -6,6 +6,7 @@ inifile.iter_from_file
inifile.iteritems
inifile.reraise
inifile.string_types
inifile.text_type
# Attributes that should be treated as read-only and thus are annotated
# with @property

View File

@@ -3,3 +3,6 @@ keyboard.KeyboardEvent.scan_code
keyboard._keyboard_event.KeyboardEvent.scan_code
# TODO: Should this be allowlisted?
keyboard.__main__
keyboard._canonical_names.basestring
keyboard._keyboard_event.basestring

View File

@@ -26,35 +26,16 @@ jks.MAGIC_NUMBER_JCEKS
jks.MAGIC_NUMBER_JKS
jks.RSA_ENCRYPTION_OID
jks.SIGNATURE_WHITENING
jks.b1
jks.b2
jks.b4
jks.b8
jks.py23basestring
jks.bks.DSA_OID
jks.bks.DSA_WITH_SHA1_OID
jks.bks.RSA_ENCRYPTION_OID
jks.bks.b1
jks.bks.b2
jks.bks.b4
jks.bks.b8
jks.bks.py23basestring
jks.jks.DSA_OID
jks.jks.DSA_WITH_SHA1_OID
jks.jks.RSA_ENCRYPTION_OID
jks.jks.b1
jks.jks.b2
jks.jks.b4
jks.jks.b8
jks.jks.py23basestring
jks.sun_crypto.DSA_OID
jks.sun_crypto.DSA_WITH_SHA1_OID
jks.sun_crypto.RSA_ENCRYPTION_OID
jks.sun_crypto.b1
jks.sun_crypto.b2
jks.sun_crypto.b4
jks.sun_crypto.b8
jks.sun_crypto.py23basestring
# Unintended reexports due to `from .utils import *` imports at runtime
jks\..*print_function

View File

@@ -26,6 +26,11 @@ serial.basestring
serial.serialutil.basestring
serial.serialutil.iterbytes
serial.serialutil.to_bytes
serial.serialutil.unicode
serial.tools.hexlify_codec.unicode
serial.tools.miniterm.raw_input
serial.tools.miniterm.unichr
serial.urlhandler.protocol_hwgrep.basestring
# Deprecated aliases
serial.SerialBase.applySettingsDict

View File

@@ -10,3 +10,4 @@ pytest_lazyfixture.copy_metafunc
# Compat:
pytest_lazyfixture.PY3
pytest_lazyfixture.string_type

View File

@@ -1,2 +1 @@
slugify.__main__
slugify.annotations # __future__.annotations is not public API

View File

@@ -73,6 +73,3 @@ win32com.axdebug.gateways
win32comext.axdebug.gateways
# failed to import, ModuleNotFoundError: No module named 'win32comext.axdebug.axdebug'
win32comext.axdebug.axdebug
# Stubtest doesn't agree with win32.lib.pywintypes.error.__init__ being positional-only
.+?\.error.__init__

View File

@@ -8,6 +8,8 @@ CONTENT_TYPE_FORM_URLENCODED: str
CONTENT_TYPE_MULTI_PART: str
log: Logger
unicode = str
class OAuth1(AuthBase):
client_class: type[Client]
client: Client

View File

@@ -36,6 +36,7 @@ get_auth_from_url = utils.get_auth_from_url
codes = status_codes.codes
REDIRECT_STATI = models.REDIRECT_STATI
def preferred_clock() -> float: ...
def merge_setting(request_setting, session_setting, dict_class=...): ...
def merge_hooks(request_hooks, session_hooks, dict_class=...): ...

View File

@@ -3,3 +3,5 @@ seaborn.external.docscrape.ClassDoc.__init__ # stubtest doesn't like ABC class
seaborn.external.docscrape.NumpyDocString.__str__ # weird signature
seaborn.axisgrid.Grid.tight_layout # the method doesn't really take pos args but runtime has *args
seaborn.external.appdirs.unicode

View File

@@ -1,2 +0,0 @@
# Mock
setuptools.msvc.winreg

View File

@@ -2,6 +2,9 @@
simplejson.scanner.make_scanner
simplejson.scanner.JSONDecodeError.__init__
simplejson.JSONDecodeError.__init__
simplejson.encoder.c_make_encoder
simplejson.encoder.c_encode_basestring_ascii
simplejson.encoder.py_encode_basestring_ascii
# Tests are not included:
simplejson.tests.*

View File

@@ -57,4 +57,4 @@ class JSONEncoder:
class JSONEncoderForHTML(JSONEncoder): ...
def encode_basestring(s: str | bytes, _PY3: Literal[True] = ..., _q: str = ...) -> str: ...
def py_encode_basestring_ascii(s: str | bytes, _PY3: Literal[True] = ...) -> str: ...
def encode_basestring_ascii(s: str | bytes, _PY3: Literal[True] = ...) -> str: ...

View File

@@ -114,3 +114,5 @@ class MovedAttribute(_LazyDescr):
def add_move(move: MovedModule | MovedAttribute) -> None: ...
def remove_move(name: str) -> None: ...
advance_iterator = next

View File

@@ -0,0 +1,4 @@
toml.decoder.basestring
toml.decoder.unichr
toml.decoder.unicode
toml.encoder.unicode

View File

@@ -8,7 +8,6 @@ vobject.win32tz
# dependencies
vobject.icalendar.Pytz
vobject.icalendar.pytz
# python2 compat
vobject.base.basestring
@@ -16,6 +15,7 @@ vobject.base.str_
vobject.base.to_unicode
vobject.base.to_basestring
vobject.vcard.basestring
vobject.base.unicode_type
# implementation details that users shouldn't depend on
vobject.base.formatter