mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 21:12:25 +08:00
Using precise code for pyright: ignore and re-enabling various pyright tests (#12576)
This commit is contained in:
@@ -12,7 +12,7 @@ from numpy.typing import NDArray
|
||||
# Actual type: _cffi_backend.__CDataOwn <cdata 'struct _jack_position *'>
|
||||
# This is not a real subclassing. Just ensuring type-checkers sees this type as compatible with _CDataBase
|
||||
# pyright has no error code for subclassing final
|
||||
class _JackPositionT(_CDataBase): # type: ignore[misc] # pyright: ignore
|
||||
class _JackPositionT(_CDataBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||
audio_frames_per_video_frame: float
|
||||
bar: int
|
||||
bar_start_tick: float
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
# Verify that ImageTK images are valid to pass to TK code.
|
||||
from __future__ import annotations
|
||||
|
||||
# The following tests don't work at the moment, due to pyright getting
|
||||
# The following tests don't work on pyright at the moment, due to it getting
|
||||
# confused by the existence of these stubs and annotations in the actual
|
||||
# Pillow package.
|
||||
# https://github.com/python/typeshed/issues/11688
|
||||
# pyright: reportArgumentType=false
|
||||
import tkinter
|
||||
|
||||
# import tkinter
|
||||
from PIL import ImageTk
|
||||
|
||||
# from PIL import ImageTk
|
||||
photo = ImageTk.PhotoImage()
|
||||
bitmap = ImageTk.BitmapImage()
|
||||
|
||||
# photo = ImageTk.PhotoImage()
|
||||
# bitmap = ImageTk.BitmapImage()
|
||||
tkinter.Label(image=photo)
|
||||
tkinter.Label(image=bitmap)
|
||||
|
||||
# tkinter.Label(image=photo)
|
||||
# tkinter.Label(image=bitmap)
|
||||
|
||||
# tkinter.Label().configure(image=photo)
|
||||
# tkinter.Label().configure(image=bitmap)
|
||||
tkinter.Label().configure(image=photo)
|
||||
tkinter.Label().configure(image=bitmap)
|
||||
|
||||
@@ -59,10 +59,7 @@ application = app
|
||||
assert_type(app, "wsgify[Request, []]")
|
||||
assert_type(app(env, start_response), "Iterable[bytes]")
|
||||
assert_type(app(request), _AnyResponse)
|
||||
# FIXME: For some reason pyright complains here with
|
||||
# mismatch: expected "wsgify[Request, ()]" but received "wsgify[Request, ()]"
|
||||
# can you spot the difference?
|
||||
# assert_type(app(application), "wsgify[Request, []]")
|
||||
assert_type(app(application), "wsgify[Request, []]")
|
||||
application = app(application)
|
||||
|
||||
|
||||
@@ -78,13 +75,10 @@ def m_app(request: Request) -> str:
|
||||
|
||||
|
||||
application = m_app
|
||||
# FIXME: same weird pyright error where it complains about the types
|
||||
# being the same
|
||||
# assert_type(m_app, "wsgify[Request, [WSGIApplication]]")
|
||||
assert_type(m_app, "wsgify[Request, [WSGIApplication]]")
|
||||
assert_type(m_app(env, start_response), "Iterable[bytes]")
|
||||
assert_type(m_app(request), _AnyResponse)
|
||||
# FIXME: and also here
|
||||
# assert_type(m_app(application), "wsgify[Request, [WSGIApplication]]")
|
||||
assert_type(m_app(application), "wsgify[Request, [WSGIApplication]]")
|
||||
application = m_app(application)
|
||||
|
||||
|
||||
@@ -109,7 +103,7 @@ def valid_request_app(request: Request) -> None:
|
||||
|
||||
|
||||
# but the opposite is not allowed
|
||||
@wsgify # type:ignore
|
||||
@wsgify # type: ignore
|
||||
def invalid_request_app(request: MyRequest) -> None:
|
||||
pass
|
||||
|
||||
@@ -117,5 +111,5 @@ def invalid_request_app(request: MyRequest) -> None:
|
||||
# we can't really make passing extra arguments directly work
|
||||
# otherwise we have to give up most of our type safety for
|
||||
# something that should only be used through wsgify.middleware
|
||||
wsgify(args=(1,)) # type:ignore
|
||||
wsgify(kwargs={"ips": ["127.0.0.1"]}) # type:ignore
|
||||
wsgify(args=(1,)) # type: ignore
|
||||
wsgify(kwargs={"ips": ["127.0.0.1"]}) # type: ignore
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Needed until mypy issues are solved
|
||||
# Needed until mypy issues are solved or https://github.com/python/mypy/issues/12358
|
||||
# pyright: reportUnnecessaryTypeIgnoreComment=false
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Needed until mypy issues are solved
|
||||
# Needed until mypy issues are solved or https://github.com/python/mypy/issues/12358
|
||||
# pyright: reportUnnecessaryTypeIgnoreComment=false
|
||||
|
||||
# These tests are essentially a mirror of check_base_descriptors
|
||||
|
||||
@@ -351,7 +351,7 @@ class Blob(Object):
|
||||
# This is not a real subclassing. Just ensuring type-checkers sees this type as compatible with _CDataBase
|
||||
# pyright has no error code for subclassing final
|
||||
@final
|
||||
class Branch(Reference): # type: ignore[misc] # pyright: ignore
|
||||
class Branch(Reference): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||
branch_name: str
|
||||
raw_branch_name: bytes
|
||||
remote_name: str
|
||||
|
||||
@@ -18,7 +18,7 @@ def strarray_to_strings(arr: _GitStrArray) -> list[str]: ...
|
||||
# Actual type: _cffi_backend.__CDataOwn <cdata 'struct git_strarray *'>
|
||||
# This is not a real subclassing. Just ensuring type-checkers sees this type as compatible with _CDataBase
|
||||
# pyright has no error code for subclassing final
|
||||
class _GitStrArray(_CDataBase): # type: ignore[misc] # pyright: ignore
|
||||
class _GitStrArray(_CDataBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||
count: int
|
||||
strings: _CDataBase # <cdata 'char * *'>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class DebugDocumentProvider(gateways.DebugDocumentProvider):
|
||||
|
||||
# error: Cannot determine consistent method resolution order (MRO) for "DebugDocumentText"
|
||||
# pyright doesn't have a specific error code for MRO error!
|
||||
class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc] # pyright: ignore
|
||||
class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
|
||||
codeContainer: Incomplete
|
||||
def __init__(self, codeContainer) -> None: ...
|
||||
def GetName(self, dnt): ...
|
||||
|
||||
Reference in New Issue
Block a user