diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6660d270c45a..af66891790f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -115,6 +115,39 @@ jobs: - name: Run ty on all stubs run: python tests/ty_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }} --python=.venv + pyrefly: + name: "pyrefly: Check stubs" + runs-on: ubuntu-latest + strategy: + matrix: + platform: ["linux", "win32", "darwin"] + # TODO: Add 3.15 once third-party runtime dependencies provide compatible wheels. + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + fail-fast: false + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-python@v6 + with: + python-version: "3.14" + - uses: astral-sh/setup-uv@v8.2.0 + with: + version-file: "requirements-tests.txt" + - name: Install typeshed test-suite requirements + run: uv pip install -r requirements-tests.txt --system + - name: Create an isolated venv for testing + run: uv venv .venv + - name: Install third-party stub dependencies + run: | + PACKAGES=$(python tests/get_external_stub_requirements.py) + if [ -n "$PACKAGES" ]; then + uv pip install --python-version ${{ matrix.python-version }} $PACKAGES + fi + # Published stub packages can shadow the checked-in stubs when pyrefly + # resolves their relative imports. + uv pip uninstall types-PyYAML types-pytz + - name: Run pyrefly on all stubs + run: python tests/pyrefly_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }} --python=.venv/bin/python + pyright: name: "pyright: Run test cases" runs-on: ubuntu-latest diff --git a/pyrefly.toml b/pyrefly.toml new file mode 100644 index 000000000000..8db32aa4e3a3 --- /dev/null +++ b/pyrefly.toml @@ -0,0 +1,21 @@ +# typeshed uses `# type: ignore` comments to silence mypy and pyright; pyrefly +# should not treat them as suppressing its own errors. Keep in sync with the +# `respect-type-ignore-comments` setting in ty.toml. +enabled-ignores = ["pyrefly"] + +# These imports are intentionally optional and are also ignored by mypy and pyright. +ignore-missing-imports = [ + "branca", + "folium", + "pydot", + "pygraphviz.*", + "scipy.*", + "twisted.*", + "xyzservices", +] + +[errors] +# Incompatible overrides and deprecations are inherited from the implementation +# and are not actionable in typeshed. Keep in sync with pyrightconfig.json. +deprecated = false +bad-override = false diff --git a/requirements-tests.txt b/requirements-tests.txt index 4672a004e702..be05979a7d0d 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,6 +1,7 @@ # Type checkers that we test our stubs against. These should always # be pinned to a specific version to make failure reproducible. mypy==2.3.0 +pyrefly==1.3.0.dev1 pyright==1.1.411 ty==0.0.59 diff --git a/stdlib/_asyncio.pyi b/stdlib/_asyncio.pyi index 242093e1ec79..641c152d985b 100644 --- a/stdlib/_asyncio.pyi +++ b/stdlib/_asyncio.pyi @@ -53,7 +53,7 @@ else: # since the only reason why `asyncio.Future` is invariant is the `set_result()` method, # and `asyncio.Task.set_result()` always raises. @disjoint_base -class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-generic-class] +class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-generic-class] # pyrefly: ignore [invalid-variance] if sys.version_info >= (3, 12): def __init__( self, diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 36ea1981af3f..9377497c0766 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -322,8 +322,8 @@ class HelpFormatter: _current_indent: int _level: int _action_max_length: int - _root_section: _Section - _current_section: _Section + _root_section: _Section # pyrefly: ignore [unknown-name] + _current_section: _Section # pyrefly: ignore [unknown-name] _whitespace_matcher: Pattern[str] _long_break_matcher: Pattern[str] diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index bea145e424dd..3e2e838eaa26 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -365,17 +365,17 @@ class _OrderedDictValuesView(ValuesView[_VT_co]): # pyright doesn't have a specific error code for subclassing error! @final @type_check_only -class _odict_keys(dict_keys[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] +class _odict_keys(dict_keys[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] # pyrefly: ignore [invalid-inheritance] def __reversed__(self) -> Iterator[_KT_co]: ... @final @type_check_only -class _odict_items(dict_items[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] +class _odict_items(dict_items[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] # pyrefly: ignore [invalid-inheritance] def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... @final @type_check_only -class _odict_values(dict_values[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] +class _odict_values(dict_values[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] # pyrefly: ignore [invalid-inheritance] def __reversed__(self) -> Iterator[_VT_co]: ... @disjoint_base diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index dd601675265c..c286514af229 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -43,7 +43,7 @@ _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc) # At runtime it inherits from ABC and is not a Protocol, but it is on the # allowlist for use as a Protocol. @runtime_checkable -class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] +class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] # pyrefly: ignore [invalid-inheritance] __slots__ = () def __enter__(self) -> _T_co: ... @abstractmethod @@ -55,7 +55,7 @@ class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[m # At runtime it inherits from ABC and is not a Protocol, but it is on the # allowlist for use as a Protocol. @runtime_checkable -class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] +class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] # pyrefly: ignore [invalid-inheritance] __slots__ = () async def __aenter__(self) -> _T_co: ... @abstractmethod diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index fd5588e03490..abe1f8457434 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -298,7 +298,7 @@ def fields(class_or_instance: DataclassInstance | type[DataclassInstance]) -> tu # HACK: `obj: Never` typing matches if object argument is using `Any` type. @overload -def is_dataclass(obj: Never) -> TypeIs[DataclassInstance | type[DataclassInstance]]: ... # type: ignore[narrowed-type-not-subtype] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-type-guard-definition] +def is_dataclass(obj: Never) -> TypeIs[DataclassInstance | type[DataclassInstance]]: ... # type: ignore[narrowed-type-not-subtype] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-type-guard-definition] # pyrefly: ignore [bad-function-definition] @overload def is_dataclass(obj: type) -> TypeIs[type[DataclassInstance]]: ... @overload diff --git a/stdlib/encodings/big5.pyi b/stdlib/encodings/big5.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/big5.pyi +++ b/stdlib/encodings/big5.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/big5hkscs.pyi b/stdlib/encodings/big5hkscs.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/big5hkscs.pyi +++ b/stdlib/encodings/big5hkscs.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/cp932.pyi b/stdlib/encodings/cp932.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/cp932.pyi +++ b/stdlib/encodings/cp932.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/cp949.pyi b/stdlib/encodings/cp949.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/cp949.pyi +++ b/stdlib/encodings/cp949.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/cp950.pyi b/stdlib/encodings/cp950.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/cp950.pyi +++ b/stdlib/encodings/cp950.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/euc_jis_2004.pyi b/stdlib/encodings/euc_jis_2004.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/euc_jis_2004.pyi +++ b/stdlib/encodings/euc_jis_2004.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/euc_jisx0213.pyi b/stdlib/encodings/euc_jisx0213.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/euc_jisx0213.pyi +++ b/stdlib/encodings/euc_jisx0213.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/euc_jp.pyi b/stdlib/encodings/euc_jp.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/euc_jp.pyi +++ b/stdlib/encodings/euc_jp.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/euc_kr.pyi b/stdlib/encodings/euc_kr.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/euc_kr.pyi +++ b/stdlib/encodings/euc_kr.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/gb18030.pyi b/stdlib/encodings/gb18030.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/gb18030.pyi +++ b/stdlib/encodings/gb18030.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/gb2312.pyi b/stdlib/encodings/gb2312.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/gb2312.pyi +++ b/stdlib/encodings/gb2312.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/gbk.pyi b/stdlib/encodings/gbk.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/gbk.pyi +++ b/stdlib/encodings/gbk.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/hz.pyi b/stdlib/encodings/hz.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/hz.pyi +++ b/stdlib/encodings/hz.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_jp.pyi b/stdlib/encodings/iso2022_jp.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_jp.pyi +++ b/stdlib/encodings/iso2022_jp.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_jp_1.pyi b/stdlib/encodings/iso2022_jp_1.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_jp_1.pyi +++ b/stdlib/encodings/iso2022_jp_1.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_jp_2.pyi b/stdlib/encodings/iso2022_jp_2.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_jp_2.pyi +++ b/stdlib/encodings/iso2022_jp_2.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_jp_2004.pyi b/stdlib/encodings/iso2022_jp_2004.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_jp_2004.pyi +++ b/stdlib/encodings/iso2022_jp_2004.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_jp_3.pyi b/stdlib/encodings/iso2022_jp_3.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_jp_3.pyi +++ b/stdlib/encodings/iso2022_jp_3.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_jp_ext.pyi b/stdlib/encodings/iso2022_jp_ext.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_jp_ext.pyi +++ b/stdlib/encodings/iso2022_jp_ext.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/iso2022_kr.pyi b/stdlib/encodings/iso2022_kr.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/iso2022_kr.pyi +++ b/stdlib/encodings/iso2022_kr.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/johab.pyi b/stdlib/encodings/johab.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/johab.pyi +++ b/stdlib/encodings/johab.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/shift_jis.pyi b/stdlib/encodings/shift_jis.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/shift_jis.pyi +++ b/stdlib/encodings/shift_jis.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/shift_jis_2004.pyi b/stdlib/encodings/shift_jis_2004.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/shift_jis_2004.pyi +++ b/stdlib/encodings/shift_jis_2004.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/encodings/shift_jisx0213.pyi b/stdlib/encodings/shift_jisx0213.pyi index d613026a5a86..be96a1ba3ad8 100644 --- a/stdlib/encodings/shift_jisx0213.pyi +++ b/stdlib/encodings/shift_jisx0213.pyi @@ -14,7 +14,7 @@ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.IncrementalEnco class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, codecs.IncrementalDecoder): codec: ClassVar[mbc._MultibyteCodec] = ... -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] +class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] codec: ClassVar[mbc._MultibyteCodec] = ... class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 5619a64f6ed2..c1d31dd18d20 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -257,7 +257,7 @@ class cached_property(Generic[_T_co]): def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T_co) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __set__(self, instance: object, value: _T_co) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-variance] def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... def cache(user_function: Callable[..., _T], /) -> _lru_cache_wrapper[_T]: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 5f99c35132ed..63af29cccff8 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -939,7 +939,7 @@ In the future, this property will contain the last metadata change time.""") # At runtime it inherits from ABC and is not a Protocol, but it will be # on the allowlist for use as a Protocol starting in 3.14. @runtime_checkable -class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] +class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] # pyrefly: ignore [invalid-inheritance] __slots__ = () @abstractmethod def __fspath__(self) -> AnyStr_co: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 34b2e656f435..dd9a365dff0b 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -90,8 +90,8 @@ class HTMLRepr(Repr): class HTMLDoc(Doc): _repr_instance: HTMLRepr - repr = _repr_instance.repr - escape = _repr_instance.escape + repr = _repr_instance.repr # pyrefly: ignore [unknown-name] + escape = _repr_instance.escape # pyrefly: ignore [unknown-name] def page(self, title: str, contents: str) -> str: ... if sys.version_info >= (3, 11): def heading(self, title: str, extras: str = "") -> str: ... @@ -197,7 +197,7 @@ class TextRepr(Repr): class TextDoc(Doc): _repr_instance: TextRepr - repr = _repr_instance.repr + repr = _repr_instance.repr # pyrefly: ignore [unknown-name] def bold(self, text: str) -> str: ... def indent(self, text: str, prefix: str = " ") -> str: ... def section(self, title: str, contents: str) -> str: ... diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index b1f5198a89c0..1152e9603335 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -197,7 +197,7 @@ else: def rotate(self, angle: float) -> Vec2D: ... # Does not actually inherit from Canvas, but dynamically gets all methods of Canvas -class ScrolledCanvas(Canvas, Frame): # type: ignore[misc] +class ScrolledCanvas(Canvas, Frame): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] bg: str hscroll: Scrollbar vscroll: Scrollbar @@ -436,7 +436,7 @@ class TPen: st = showturtle ht = hideturtle -class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods in base classes +class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods in base classes # pyrefly: ignore [inconsistent-inheritance] screen: TurtleScreen screens: ClassVar[list[TurtleScreen]] def __init__( diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 328bb7552538..ccd0d5930cdd 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -268,10 +268,10 @@ class CodeType: __replace__ = replace @final -class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-generic-class] +class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-generic-class] # pyrefly: ignore [invalid-variance] __hash__: ClassVar[None] # type: ignore[assignment] def __new__(cls, mapping: SupportsKeysAndGetItem[_KT_co, _VT_co]) -> Self: ... - def __getitem__(self, key: _KT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def __getitem__(self, key: _KT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-variance] def __iter__(self) -> Iterator[_KT_co]: ... def __len__(self) -> int: ... def __eq__(self, value: object, /) -> bool: ... @@ -281,11 +281,11 @@ class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # py def items(self) -> ItemsView[_KT_co, _VT_co]: ... @overload - def get(self, key: _KT_co, /) -> _VT_co | None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter + def get(self, key: _KT_co, /) -> _VT_co | None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter # pyrefly: ignore [invalid-variance] @overload - def get(self, key: _KT_co, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter + def get(self, key: _KT_co, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter # pyrefly: ignore [invalid-variance] @overload - def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter + def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter # pyrefly: ignore [invalid-variance] def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... def __reversed__(self) -> Iterator[_KT_co]: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 35031a27445b..14f3df9b59d2 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -814,7 +814,7 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]): @overload def get(self, key: _KT, /) -> _VT_co | None: ... @overload - def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter + def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter # pyrefly: ignore [invalid-variance] @overload def get(self, key: _KT, default: _T, /) -> _VT_co | _T: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index b89d96b2be9c..d1f27b8e6fe5 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -389,7 +389,7 @@ else: # At runtime it inherits from ABC and is not a Protocol, but it is on the # allowlist for use as a Protocol. @runtime_checkable - class Buffer(Protocol, abc.ABC): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] + class Buffer(Protocol, abc.ABC): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol] # pyrefly: ignore [invalid-inheritance] # Not actually a Protocol at runtime; see # https://github.com/python/typeshed/issues/10224 for why we're defining it this way def __buffer__(self, flags: int, /) -> memoryview: ... diff --git a/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi b/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi index fcfe58ec2c44..ba5f1fd456e6 100644 --- a/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi +++ b/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi @@ -8,7 +8,7 @@ class ECKey(AsymmetricKey): DSS_CURVES: dict[str, type] CURVES_DSS: dict[property, str] REQUIRED_JSON_FIELDS: ClassVar[list[str]] - PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS + PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS # pyrefly: ignore [unknown-name] PRIVATE_KEY_FIELDS: ClassVar[list[str]] PUBLIC_KEY_CLS: ClassVar[type] PRIVATE_KEY_CLS: ClassVar[type] diff --git a/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi b/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi index d85297a1bf2a..f6a39d28e8a9 100644 --- a/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi +++ b/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi @@ -12,7 +12,7 @@ PRIVATE_KEYS_MAP: Final[dict[str, type]] class OKPKey(AsymmetricKey): kty: str REQUIRED_JSON_FIELDS: ClassVar[list[str]] - PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS + PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS # pyrefly: ignore [unknown-name] PRIVATE_KEY_FIELDS: ClassVar[list[str]] PUBLIC_KEY_CLS: ClassVar[tuple[type, ...]] PRIVATE_KEY_CLS: ClassVar[tuple[type, ...]] diff --git a/stubs/JACK-Client/jack/__init__.pyi b/stubs/JACK-Client/jack/__init__.pyi index d577f8f2742d..18a33f2cc219 100644 --- a/stubs/JACK-Client/jack/__init__.pyi +++ b/stubs/JACK-Client/jack/__init__.pyi @@ -12,7 +12,7 @@ from numpy.typing import NDArray # 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 @type_check_only -class _JackPositionT(_CDataBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] +class _JackPositionT(_CDataBase): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class] # pyrefly: ignore [invalid-inheritance] audio_frames_per_video_frame: float bar: int bar_start_tick: float diff --git a/stubs/PyMySQL/pymysql/cursors.pyi b/stubs/PyMySQL/pymysql/cursors.pyi index 2df8877356d7..ce6471711868 100644 --- a/stubs/PyMySQL/pymysql/cursors.pyi +++ b/stubs/PyMySQL/pymysql/cursors.pyi @@ -51,8 +51,8 @@ class SSCursor(Cursor): def fetchall_unbuffered(self) -> Iterator[tuple[Any, ...]]: ... def scroll(self, value: int, mode: str = "relative") -> None: ... -class DictCursor(DictCursorMixin, Cursor): ... # type: ignore[misc] +class DictCursor(DictCursorMixin, Cursor): ... # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] -class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore[misc] +class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] def fetchall_unbuffered(self) -> Iterator[dict[str, Any]]: ... # type: ignore[override] def read_next(self) -> dict[str, Any] | None: ... # type: ignore[override] diff --git a/stubs/WebOb/webob/cachecontrol.pyi b/stubs/WebOb/webob/cachecontrol.pyi index 94434539a213..d86d481d1b6f 100644 --- a/stubs/WebOb/webob/cachecontrol.pyi +++ b/stubs/WebOb/webob/cachecontrol.pyi @@ -100,7 +100,7 @@ class CacheControl(Generic[_ScopeT]): proxy_revalidate: exists_property[Literal["response"]] max_age: value_property[int, None, Literal[-1], None] s_maxage: value_property[int, None, None, Literal["response"]] - s_max_age = s_maxage + s_max_age = s_maxage # pyrefly: ignore [unknown-name] stale_while_revalidate: value_property[int, None, None, Literal["response"]] stale_if_error: value_property[int, None, None, Literal["response"]] def copy(self) -> Self: ... diff --git a/stubs/WebOb/webob/request.pyi b/stubs/WebOb/webob/request.pyi index a10e3c7a135e..e0135b3f1c74 100644 --- a/stubs/WebOb/webob/request.pyi +++ b/stubs/WebOb/webob/request.pyi @@ -85,8 +85,8 @@ class BaseRequest: server_port: SymmetricProperty[int] script_name: AsymmetricPropertyWithDelete[str, str | None] path_info: SymmetricProperty[str] - uscript_name = script_name # bw compat - upath_info = path_info # bw compat + uscript_name = script_name # bw compat # pyrefly: ignore [unknown-name] + upath_info = path_info # bw compat # pyrefly: ignore [unknown-name] content_type: AsymmetricPropertyWithDelete[str, str | None] headers: AsymmetricProperty[EnvironHeaders, SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]] @property @@ -167,7 +167,7 @@ class BaseRequest: pragma: SymmetricPropertyWithDelete[str | None] range: AsymmetricPropertyWithDelete[Range | None, tuple[int, int | None] | list[int | None] | list[int] | str | None] referer: SymmetricPropertyWithDelete[str | None] - referrer = referer + referrer = referer # pyrefly: ignore [unknown-name] user_agent: SymmetricPropertyWithDelete[str | None] def as_bytes(self, skip_body: bool = False) -> bytes: ... def as_text(self) -> str: ... diff --git a/stubs/antlr4-python3-runtime/antlr4/PredictionContext.pyi b/stubs/antlr4-python3-runtime/antlr4/PredictionContext.pyi index 93fe47f89eb5..e2b27608f629 100644 --- a/stubs/antlr4-python3-runtime/antlr4/PredictionContext.pyi +++ b/stubs/antlr4-python3-runtime/antlr4/PredictionContext.pyi @@ -8,7 +8,7 @@ class PredictionContext: EMPTY: Incomplete EMPTY_RETURN_STATE: int globalNodeCount: int - id = globalNodeCount + id = globalNodeCount # pyrefly: ignore [unknown-name] cachedHashCode: Incomplete def __init__(self, cachedHashCode: int) -> None: ... def __len__(self) -> int: ... diff --git a/stubs/braintree/braintree/dispute.pyi b/stubs/braintree/braintree/dispute.pyi index fe129e8c17cc..338e7101a613 100644 --- a/stubs/braintree/braintree/dispute.pyi +++ b/stubs/braintree/braintree/dispute.pyi @@ -70,10 +70,10 @@ class Dispute(AttributeGetter): amount_won: Decimal | None protection_level: Incomplete transaction_details: TransactionDetails - transaction = transaction_details + transaction = transaction_details # pyrefly: ignore [unknown-name] evidence: list[DisputeEvidence] | None paypal_messages: list[DisputePayPalMessage] | None status_history: list[DisputeStatusHistory] | None processor_comments: Incomplete - forwarded_comments: processor_comments + forwarded_comments: processor_comments # pyrefly: ignore [unknown-name] def __init__(self, attributes) -> None: ... diff --git a/stubs/braintree/braintree/errors.pyi b/stubs/braintree/braintree/errors.pyi index 84c2ffb55742..fa8d6b33ab48 100644 --- a/stubs/braintree/braintree/errors.pyi +++ b/stubs/braintree/braintree/errors.pyi @@ -5,7 +5,7 @@ from braintree.validation_error_collection import ValidationErrorCollection class Errors: errors: ValidationErrorCollection - size = errors.deep_size + size = errors.deep_size # pyrefly: ignore [unknown-name] def __init__(self, data: dict[str, Incomplete]) -> None: ... @property def deep_errors(self) -> list[ValidationError]: ... diff --git a/stubs/braintree/braintree/graphql/inputs/create_customer_session_input.pyi b/stubs/braintree/braintree/graphql/inputs/create_customer_session_input.pyi index b15c7227ea6a..28d6ab5385ed 100644 --- a/stubs/braintree/braintree/graphql/inputs/create_customer_session_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/create_customer_session_input.pyi @@ -29,7 +29,7 @@ class CreateCustomerSessionInput: ) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder() -> Builder: ... + def builder() -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self) -> None: ... diff --git a/stubs/braintree/braintree/graphql/inputs/customer_recommendations_input.pyi b/stubs/braintree/braintree/graphql/inputs/customer_recommendations_input.pyi index e9fdf7817cd1..2869cfd04ff1 100644 --- a/stubs/braintree/braintree/graphql/inputs/customer_recommendations_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/customer_recommendations_input.pyi @@ -29,7 +29,7 @@ class CustomerRecommendationsInput: ) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder() -> Builder: ... + def builder() -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self) -> None: ... diff --git a/stubs/braintree/braintree/graphql/inputs/customer_session_input.pyi b/stubs/braintree/braintree/graphql/inputs/customer_session_input.pyi index f237a875cf85..91f694b892c2 100644 --- a/stubs/braintree/braintree/graphql/inputs/customer_session_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/customer_session_input.pyi @@ -28,7 +28,7 @@ class CustomerSessionInput: ) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder() -> Builder: ... + def builder() -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self) -> None: ... diff --git a/stubs/braintree/braintree/graphql/inputs/paypal_payee_input.pyi b/stubs/braintree/braintree/graphql/inputs/paypal_payee_input.pyi index a2e3ddbb74cf..92d40b81a679 100644 --- a/stubs/braintree/braintree/graphql/inputs/paypal_payee_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/paypal_payee_input.pyi @@ -10,7 +10,7 @@ class PayPalPayeeInput: def __init__(self, email_address: str | None = None, client_id: str | None = None) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder() -> Builder: ... + def builder() -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self) -> None: ... diff --git a/stubs/braintree/braintree/graphql/inputs/paypal_purchase_unit_input.pyi b/stubs/braintree/braintree/graphql/inputs/paypal_purchase_unit_input.pyi index 3b47082f1a24..4f4db97adc29 100644 --- a/stubs/braintree/braintree/graphql/inputs/paypal_purchase_unit_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/paypal_purchase_unit_input.pyi @@ -16,7 +16,7 @@ class PayPalPurchaseUnitInput: def __init__(self, amount: MonetaryAmountInput | None = None, payee: PayPalPayeeInput | None = None) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder(amount: MonetaryAmountInput) -> Builder: ... + def builder(amount: MonetaryAmountInput) -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self, amount: MonetaryAmountInput) -> None: ... diff --git a/stubs/braintree/braintree/graphql/inputs/phone_input.pyi b/stubs/braintree/braintree/graphql/inputs/phone_input.pyi index 826be0708c00..667c1d531809 100644 --- a/stubs/braintree/braintree/graphql/inputs/phone_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/phone_input.pyi @@ -13,7 +13,7 @@ class PhoneInput: ) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder() -> Builder: ... + def builder() -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self) -> None: ... diff --git a/stubs/braintree/braintree/graphql/inputs/update_customer_session_input.pyi b/stubs/braintree/braintree/graphql/inputs/update_customer_session_input.pyi index b8aea510803f..a8b580e70b2c 100644 --- a/stubs/braintree/braintree/graphql/inputs/update_customer_session_input.pyi +++ b/stubs/braintree/braintree/graphql/inputs/update_customer_session_input.pyi @@ -27,7 +27,7 @@ class UpdateCustomerSessionInput: ) -> None: ... def to_graphql_variables(self) -> _GraphqlVariables: ... @staticmethod - def builder(session_id: str) -> Builder: ... + def builder(session_id: str) -> Builder: ... # pyrefly: ignore [unknown-name] class Builder: def __init__(self, session_id: str) -> None: ... diff --git a/stubs/geopandas/geopandas/geodataframe.pyi b/stubs/geopandas/geopandas/geodataframe.pyi index 9e672c5aee32..f51ba3119945 100644 --- a/stubs/geopandas/geopandas/geodataframe.pyi +++ b/stubs/geopandas/geopandas/geodataframe.pyi @@ -31,7 +31,7 @@ from .plotting import GeoplotAccessor crs_mismatch_error: str -class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] +class GeoDataFrame(GeoPandasBase, pd.DataFrame): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] # Override the weird annotation of DataFrame.__new__ in pandas-stubs @overload def __new__( diff --git a/stubs/geopandas/geopandas/geoseries.pyi b/stubs/geopandas/geopandas/geoseries.pyi index b5a156cb7874..764fdb0a79a6 100644 --- a/stubs/geopandas/geopandas/geoseries.pyi +++ b/stubs/geopandas/geopandas/geoseries.pyi @@ -19,7 +19,7 @@ from .explore import _explore_geoseries from .io._geoarrow import GeoArrowArray from .plotting import plot_series -class GeoSeries(GeoPandasBase, pd.Series[BaseGeometry]): # type: ignore[type-var,misc] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-type-arguments] +class GeoSeries(GeoPandasBase, pd.Series[BaseGeometry]): # type: ignore[type-var,misc] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-type-arguments] # pyrefly: ignore [bad-specialization, inconsistent-inheritance] # Override the weird annotation of Series.__new__ in pandas-stubs def __new__( self, diff --git a/stubs/geopandas/geopandas/plotting.pyi b/stubs/geopandas/geopandas/plotting.pyi index e8c7c85c545c..4d08e752d64c 100644 --- a/stubs/geopandas/geopandas/plotting.pyi +++ b/stubs/geopandas/geopandas/plotting.pyi @@ -193,7 +193,7 @@ class GeoplotAccessor(PlotAccessor): include_bool: bool = False, backend: str | None = None, **kwargs, - ) -> pd.Series[Axes]: ... # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-type-arguments] + ) -> pd.Series[Axes]: ... # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-type-arguments] # pyrefly: ignore [bad-specialization] @overload def __call__( self, diff --git a/stubs/gevent/gevent/events.pyi b/stubs/gevent/gevent/events.pyi index 22e0338690e1..ff6fc39f082a 100644 --- a/stubs/gevent/gevent/events.pyi +++ b/stubs/gevent/gevent/events.pyi @@ -125,7 +125,7 @@ class GeventDidPatchModuleEvent(GeventDidPatchEvent): class IGeventWillPatchAllEvent(IGeventWillPatchEvent): patch_all_arguments: Mapping[str, Any] patch_all_kwargs: Mapping[str, Any] - def will_patch_module(module_name: str) -> bool: ... + def will_patch_module(module_name: str) -> bool: ... # pyrefly: ignore [invalid-annotation] class _PatchAllMixin: def __init__(self, patch_all_arguments: Mapping[str, Any], patch_all_kwargs: Mapping[str, Any]) -> None: ... diff --git a/stubs/gunicorn/gunicorn/config.pyi b/stubs/gunicorn/gunicorn/config.pyi index 8a8640204da6..8eabbee8eddd 100644 --- a/stubs/gunicorn/gunicorn/config.pyi +++ b/stubs/gunicorn/gunicorn/config.pyi @@ -782,7 +782,7 @@ class OnStarting(Setting): default: ClassVar[_OnStartingHookType] desc: ClassVar[str] - def on_starting(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def on_starting(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class OnReload(Setting): name: ClassVar[str] @@ -792,7 +792,7 @@ class OnReload(Setting): default: ClassVar[_OnReloadHookType] desc: ClassVar[str] - def on_reload(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def on_reload(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class WhenReady(Setting): name: ClassVar[str] @@ -802,7 +802,7 @@ class WhenReady(Setting): default: ClassVar[_WhenReadyHookType] desc: ClassVar[str] - def when_ready(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def when_ready(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class Prefork(Setting): name: ClassVar[str] @@ -812,7 +812,7 @@ class Prefork(Setting): default: ClassVar[_PreForkHookType] desc: ClassVar[str] - def pre_fork(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def pre_fork(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class Postfork(Setting): name: ClassVar[str] @@ -822,7 +822,7 @@ class Postfork(Setting): default: ClassVar[_PostForkHookType] desc: ClassVar[str] - def post_fork(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def post_fork(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class PostWorkerInit(Setting): name: ClassVar[str] @@ -832,7 +832,7 @@ class PostWorkerInit(Setting): default: ClassVar[_PostWorkerInitHookType] desc: ClassVar[str] - def post_worker_init(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def post_worker_init(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class WorkerInt(Setting): name: ClassVar[str] @@ -842,7 +842,7 @@ class WorkerInt(Setting): default: ClassVar[_WorkerIntHookType] desc: ClassVar[str] - def worker_int(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def worker_int(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class WorkerAbort(Setting): name: ClassVar[str] @@ -852,7 +852,7 @@ class WorkerAbort(Setting): default: ClassVar[_WorkerAbortHookType] desc: ClassVar[str] - def worker_abort(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def worker_abort(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class PreExec(Setting): name: ClassVar[str] @@ -862,7 +862,7 @@ class PreExec(Setting): default: ClassVar[_PreExecHookType] desc: ClassVar[str] - def pre_exec(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def pre_exec(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class PreRequest(Setting): name: ClassVar[str] @@ -872,7 +872,7 @@ class PreRequest(Setting): default: ClassVar[_PreRequestHookType] desc: ClassVar[str] - def pre_request(worker: Worker, req: Request) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def pre_request(worker: Worker, req: Request) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class PostRequest(Setting): name: ClassVar[str] @@ -882,7 +882,7 @@ class PostRequest(Setting): default: ClassVar[_PostRequestHookType] desc: ClassVar[str] - def post_request(worker: Worker, req: Request, environ: _EnvironType, resp: Response) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def post_request(worker: Worker, req: Request, environ: _EnvironType, resp: Response) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class ChildExit(Setting): name: ClassVar[str] @@ -892,7 +892,7 @@ class ChildExit(Setting): default: ClassVar[_ChildExitHookType] desc: ClassVar[str] - def child_exit(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def child_exit(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class WorkerExit(Setting): name: ClassVar[str] @@ -902,7 +902,7 @@ class WorkerExit(Setting): default: ClassVar[_WorkerExitHookType] desc: ClassVar[str] - def worker_exit(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def worker_exit(server: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class NumWorkersChanged(Setting): name: ClassVar[str] @@ -912,7 +912,7 @@ class NumWorkersChanged(Setting): default: ClassVar[_NumWorkersChangedHookType] desc: ClassVar[str] - def nworkers_changed(server: Arbiter, new_value: int, old_value: int | None) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def nworkers_changed(server: Arbiter, new_value: int, old_value: int | None) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class OnExit(Setting): name: ClassVar[str] @@ -921,7 +921,7 @@ class OnExit(Setting): default: ClassVar[_OnExitHookType] desc: ClassVar[str] - def on_exit(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def on_exit(server: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class NewSSLContext(Setting): name: ClassVar[str] @@ -931,7 +931,7 @@ class NewSSLContext(Setting): default: ClassVar[_SSLContextHookType] desc: ClassVar[str] - def ssl_context(config: Config, default_ssl_context_factory: Callable[[], SSLContext]) -> SSLContext: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def ssl_context(config: Config, default_ssl_context_factory: Callable[[], SSLContext]) -> SSLContext: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] def validate_proxy_protocol(val: str | bool | None) -> str: ... @@ -1273,7 +1273,7 @@ class OnDirtyStarting(Setting): default: ClassVar[_OnDirtyStartingHookType] desc: ClassVar[str] - def on_dirty_starting(arbiter: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def on_dirty_starting(arbiter: Arbiter) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class DirtyPostFork(Setting): name: ClassVar[str] @@ -1283,7 +1283,7 @@ class DirtyPostFork(Setting): default: ClassVar[_DirtyPostForkHookType] desc: ClassVar[str] - def dirty_post_fork(arbiter: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def dirty_post_fork(arbiter: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class DirtyWorkerInit(Setting): name: ClassVar[str] @@ -1293,7 +1293,7 @@ class DirtyWorkerInit(Setting): default: ClassVar[_DirtyWorkerInitHookType] desc: ClassVar[str] - def dirty_worker_init(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def dirty_worker_init(worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class DirtyWorkerExit(Setting): name: ClassVar[str] @@ -1303,7 +1303,7 @@ class DirtyWorkerExit(Setting): default: ClassVar[_DirtyWorkerExitHookType] desc: ClassVar[str] - def dirty_worker_exit(arbiter: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def dirty_worker_exit(arbiter: Arbiter, worker: Worker) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] class ControlSocket(Setting): name: ClassVar[str] diff --git a/stubs/kafka-python/kafka/coordinator/assignors/sticky/sticky_assignor.pyi b/stubs/kafka-python/kafka/coordinator/assignors/sticky/sticky_assignor.pyi index 837dd5fabf3e..ad40223ebbfd 100644 --- a/stubs/kafka-python/kafka/coordinator/assignors/sticky/sticky_assignor.pyi +++ b/stubs/kafka-python/kafka/coordinator/assignors/sticky/sticky_assignor.pyi @@ -46,7 +46,7 @@ class StickyPartitionAssignor(AbstractPartitionAssignor): name: str version: int member_assignment: Incomplete - generation = DEFAULT_GENERATION_ID + generation = DEFAULT_GENERATION_ID # pyrefly: ignore [unknown-name] @classmethod def assign(cls, cluster, members): ... @classmethod diff --git a/stubs/openpyxl/openpyxl/descriptors/nested.pyi b/stubs/openpyxl/openpyxl/descriptors/nested.pyi index b2167ac7366d..4a785b94720f 100644 --- a/stubs/openpyxl/openpyxl/descriptors/nested.pyi +++ b/stubs/openpyxl/openpyxl/descriptors/nested.pyi @@ -200,7 +200,7 @@ class NestedNoneSet(Nested[_T | None], NoneSet[_T]): class NestedSet(Nested[_T], Set[_T]): def __init__(self, name: str | None = None, *, values: Iterable[_T]) -> None: ... -class NestedMinMax(Nested[_M], MinMax[_M, _N]): # type: ignore[misc] +class NestedMinMax(Nested[_M], MinMax[_M, _N]): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] @overload def __init__( self: NestedMinMax[int, Literal[True]], @@ -269,7 +269,7 @@ class NestedMinMax(Nested[_M], MinMax[_M, _N]): # type: ignore[misc] value: _HasTagAndGet[ConvertibleToFloat] | ConvertibleToFloat, ) -> None: ... -class EmptyTag(Nested[bool], Bool[_N]): # type: ignore[misc] +class EmptyTag(Nested[bool], Bool[_N]): # type: ignore[misc] # pyrefly: ignore [inconsistent-inheritance] @overload def __init__(self: EmptyTag[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ... @overload diff --git a/stubs/openpyxl/openpyxl/workbook/workbook.pyi b/stubs/openpyxl/openpyxl/workbook/workbook.pyi index dc56df61beb4..3a2851da1574 100644 --- a/stubs/openpyxl/openpyxl/workbook/workbook.pyi +++ b/stubs/openpyxl/openpyxl/workbook/workbook.pyi @@ -25,7 +25,7 @@ _WorkbookSheet: TypeAlias = _WorkbookWorksheet | Chartsheet # from Worksheet works great here. Allowing instance type check, even if direct # type comparison might be wrong. @type_check_only -class _WorksheetLike( # type: ignore[misc] # Incompatible definitions, favor Worksheet +class _WorksheetLike( # type: ignore[misc] # Incompatible definitions, favor Worksheet # pyrefly: ignore [inconsistent-inheritance] Worksheet, WriteOnlyWorksheet, ReadOnlyWorksheet ): ... diff --git a/stubs/peewee/peewee.pyi b/stubs/peewee/peewee.pyi index df34d586f5bb..10a6657b00ab 100644 --- a/stubs/peewee/peewee.pyi +++ b/stubs/peewee/peewee.pyi @@ -857,7 +857,7 @@ class Database(_callable_context_manager): def execute_sql(self, sql, params=None): ... def execute(self, query, **context_options): ... def get_context_options(self) -> dict[str, Incomplete]: ... - def get_sql_context(self, **context_options) -> context_class: ... + def get_sql_context(self, **context_options) -> context_class: ... # pyrefly: ignore [unknown-name] def conflict_statement(self, on_conflict, query): ... def conflict_update(self, on_conflict, query): ... def last_insert_id(self, cursor, query_type=None): ... diff --git a/stubs/pony/pony/orm/decompiling.pyi b/stubs/pony/pony/orm/decompiling.pyi index 83f56630b590..4fe1eb5a6280 100644 --- a/stubs/pony/pony/orm/decompiling.pyi +++ b/stubs/pony/pony/orm/decompiling.pyi @@ -37,7 +37,7 @@ class Decompiler: BINARY_AND: Incomplete BINARY_XOR: Incomplete BINARY_OR: Incomplete - BINARY_TRUE_DIVIDE = BINARY_DIVIDE + BINARY_TRUE_DIVIDE = BINARY_DIVIDE # pyrefly: ignore [unknown-name] BINARY_MODULO: Incomplete def BINARY_OP(decompiler, opcode): ... def BINARY_SLICE(decompiler): ... diff --git a/stubs/pony/pony/orm/sqltranslation.pyi b/stubs/pony/pony/orm/sqltranslation.pyi index 98b5a66b0bc1..e2454f8d81df 100644 --- a/stubs/pony/pony/orm/sqltranslation.pyi +++ b/stubs/pony/pony/orm/sqltranslation.pyi @@ -468,7 +468,7 @@ class DatetimeExprMonad(DatetimeMixin, ExprMonad): ... class JsonExprMonad(JsonMixin, ExprMonad): ... class ArrayExprMonad(ArrayMixin, ExprMonad): ... -class JsonItemMonad(JsonMixin, Monad): +class JsonItemMonad(JsonMixin, Monad): # pyrefly: ignore [inconsistent-inheritance] def __init__(monad, parent, key) -> None: ... def get_path(monad): ... def to_int(monad): ... diff --git a/stubs/pyogrio/pyogrio/raw.pyi b/stubs/pyogrio/pyogrio/raw.pyi index cc55e91ddc1a..2271f506f985 100644 --- a/stubs/pyogrio/pyogrio/raw.pyi +++ b/stubs/pyogrio/pyogrio/raw.pyi @@ -3,7 +3,7 @@ from contextlib import AbstractContextManager from typing import Any, Literal, TypedDict, overload, type_check_only import numpy as np -import pyarrow as pa # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import pyarrow as pa # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly: ignore [missing-import] import shapely as shp from ._typing import Array1D, ArrayLikeInt, ReadPathOrBuffer, SupportsArrowCStream, WritePathOrBuffer diff --git a/stubs/python-dateutil/dateutil/parser/_parser.pyi b/stubs/python-dateutil/dateutil/parser/_parser.pyi index e25d466f2e2c..700b9fad63c1 100644 --- a/stubs/python-dateutil/dateutil/parser/_parser.pyi +++ b/stubs/python-dateutil/dateutil/parser/_parser.pyi @@ -141,8 +141,8 @@ class _tzparser: stdoffset: int | None dstabbr: str | None dstoffset: int | None - start: _attr - end: _attr + start: _attr # pyrefly: ignore [unknown-name] + end: _attr # pyrefly: ignore [unknown-name] class _attr(_resultbase): __slots__ = ["month", "week", "weekday", "yday", "jyday", "day", "time"] diff --git a/stubs/reportlab/reportlab/graphics/barcode/lto.pyi b/stubs/reportlab/reportlab/graphics/barcode/lto.pyi index 27cfc80368d0..dde1e45e2e4a 100644 --- a/stubs/reportlab/reportlab/graphics/barcode/lto.pyi +++ b/stubs/reportlab/reportlab/graphics/barcode/lto.pyi @@ -10,7 +10,7 @@ class BaseLTOLabel(Standard39): CODENOMINALWIDTH: Incomplete CODEBARHEIGHT: Incomplete CODEBARWIDTH: Incomplete - CODEGAP = CODEBARWIDTH + CODEGAP = CODEBARWIDTH # pyrefly: ignore [unknown-name] CODELQUIET: Incomplete CODERQUIET: Incomplete height: Incomplete diff --git a/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi b/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi index d0526fe64953..27cc2bc543ea 100644 --- a/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi +++ b/stubs/reportlab/reportlab/pdfbase/pdfdoc.pyi @@ -228,7 +228,7 @@ class PDFCatalog(PDFObject): __RefOnly__: int __Defaults__: dict[str, str | None] __NoDefault__: list[str] - __Refs__ = __NoDefault__ + __Refs__ = __NoDefault__ # pyrefly: ignore [unknown-name] def format(self, document) -> bytes: ... def showOutline(self) -> None: ... def showFullScreen(self) -> None: ... diff --git a/stubs/reportlab/reportlab/platypus/flowables.pyi b/stubs/reportlab/reportlab/platypus/flowables.pyi index 1cb252411155..893d705c3b0d 100644 --- a/stubs/reportlab/reportlab/platypus/flowables.pyi +++ b/stubs/reportlab/reportlab/platypus/flowables.pyi @@ -248,12 +248,12 @@ class _Container(_ContainerSpace): def drawOn(self, canv: Canvas, x: float, y: float) -> None: ... def copyContent(self, content: _FlowableSublist | None = None) -> None: ... -class PTOContainer(_Container, Flowable): +class PTOContainer(_Container, Flowable): # pyrefly: ignore [inconsistent-inheritance] def __init__( self, content: _FlowableSublist | None, trailer: _FlowableSublist | None = None, header: _FlowableSublist | None = None ) -> None: ... -class KeepInFrame(_Container, Flowable): +class KeepInFrame(_Container, Flowable): # pyrefly: ignore [inconsistent-inheritance] name: str maxWidth: float maxHeight: float @@ -296,7 +296,7 @@ class PlacedStory(Flowable): class _FindSplitterMixin: ... -class ImageAndFlowables(_Container, _FindSplitterMixin, Flowable): +class ImageAndFlowables(_Container, _FindSplitterMixin, Flowable): # pyrefly: ignore [inconsistent-inheritance] imageHref: str | None def __init__( self, @@ -411,7 +411,7 @@ class ListItem: # TODO: Use Unpack for kwds with the ListStyle properties + value/spaceBefore/spaceAfter def __init__(self, flowables: _FlowableSublist, style: PropertySet | None = None, **kwds) -> None: ... -class ListFlowable(_Container, Flowable, _FindSplitterMixin): +class ListFlowable(_Container, Flowable, _FindSplitterMixin): # pyrefly: ignore [inconsistent-inheritance] style: ListStyle # NOTE: style has to be a ListStyle, but this will be annoying with sheet["ul"] # TODO: Use Unpack for kwds with the ListStyle properties + spaceBefore/spaceAfter diff --git a/stubs/reportlab/reportlab/platypus/multicol.pyi b/stubs/reportlab/reportlab/platypus/multicol.pyi index 76a6329965a8..09fe9cdb8e31 100644 --- a/stubs/reportlab/reportlab/platypus/multicol.pyi +++ b/stubs/reportlab/reportlab/platypus/multicol.pyi @@ -2,7 +2,7 @@ from collections.abc import Sequence from .flowables import Flowable, _Container, _FindSplitterMixin -class MultiCol(_Container, _FindSplitterMixin, Flowable): +class MultiCol(_Container, _FindSplitterMixin, Flowable): # pyrefly: ignore [inconsistent-inheritance] contents: Sequence[Flowable] widths: Sequence[float | str] minHeightNeeded: float diff --git a/stubs/setuptools/setuptools/_distutils/command/bdist.pyi b/stubs/setuptools/setuptools/_distutils/command/bdist.pyi index 95944c0c9750..4c95b17011b1 100644 --- a/stubs/setuptools/setuptools/_distutils/command/bdist.pyi +++ b/stubs/setuptools/setuptools/_distutils/command/bdist.pyi @@ -19,7 +19,7 @@ class bdist(Command): no_format_option: ClassVar[tuple[str, ...]] default_format: ClassVar[dict[str, str]] format_commands: ClassVar[ListCompat] - format_command = format_commands + format_command = format_commands # pyrefly: ignore [unknown-name] def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi index a882dd2c57ed..ef06b85f4d74 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi @@ -13,7 +13,7 @@ class Compiler(base.Compiler): static_lib_extension: ClassVar[str] shared_lib_extension: ClassVar[str] shared_lib_format: ClassVar[str] - static_lib_format = shared_lib_format + static_lib_format = shared_lib_format # pyrefly: ignore [unknown-name] exe_extension: ClassVar[str] initialized: bool plat_name: str | None diff --git a/stubs/workalendar/workalendar/europe/scotland/mixins/__init__.pyi b/stubs/workalendar/workalendar/europe/scotland/mixins/__init__.pyi index 0c07a387747b..db24b35f5af5 100644 --- a/stubs/workalendar/workalendar/europe/scotland/mixins/__init__.pyi +++ b/stubs/workalendar/workalendar/europe/scotland/mixins/__init__.pyi @@ -49,7 +49,7 @@ __all__ = [ "SpringHolidayFirstMondayJune", "VictoriaDayFourthMondayMay", "VictoriaDayLastMondayMay", - "VictoriaDayTuesdayAfterFirstMondayMay", # noqa: F822 # pyright: ignore[reportUnsupportedDunderAll] see https://github.com/workalendar/workalendar/pull/778 + "VictoriaDayTuesdayAfterFirstMondayMay", # noqa: F822 # pyright: ignore[reportUnsupportedDunderAll] see https://github.com/workalendar/workalendar/pull/778 # pyrefly: ignore [bad-dunder-all] "VictoriaDayFirstMondayJune", "FairHolidayLastMondayJune", "FairHolidayFirstMondayJuly", diff --git a/stubs/yt-dlp/yt_dlp/downloader/common.pyi b/stubs/yt-dlp/yt_dlp/downloader/common.pyi index 80e60660f067..c71cae83914b 100644 --- a/stubs/yt-dlp/yt_dlp/downloader/common.pyi +++ b/stubs/yt-dlp/yt_dlp/downloader/common.pyi @@ -67,7 +67,7 @@ class FileDownloader: def undo_temp_name(self, filename: str) -> str: ... def ytdl_filename(self, filename: str) -> str: ... # Wrapper that can accept arbitrary function. - def wrap_file_access(action: str, *, fatal: bool = False) -> Any: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] + def wrap_file_access(action: str, *, fatal: bool = False) -> Any: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # pyrefly: ignore [invalid-annotation] def sanitize_open(self, filename: str, open_mode: OpenTextMode | OpenBinaryMode) -> tuple[IO[Any], str]: ... def try_remove(self, filename: str) -> None: ... def try_rename(self, old_filename: str, new_filename: str) -> None: ... diff --git a/stubs/yt-dlp/yt_dlp/extractor/common.pyi b/stubs/yt-dlp/yt_dlp/extractor/common.pyi index 20394eb26203..6922f697c4ee 100644 --- a/stubs/yt-dlp/yt_dlp/extractor/common.pyi +++ b/stubs/yt-dlp/yt_dlp/extractor/common.pyi @@ -943,7 +943,7 @@ class InfoExtractor: self, url: str, *args: Unused, - info_dict: _InfoDict = {}, # type: ignore[typeddict-item] # pyright: ignore[reportArgumentType] # ty:ignore[missing-typed-dict-key] + info_dict: _InfoDict = {}, # type: ignore[typeddict-item] # pyright: ignore[reportArgumentType] # ty:ignore[missing-typed-dict-key] # pyrefly: ignore [bad-typed-dict-key] note: str = "Extracting generic embeds", **kwargs: Unused, ) -> list[dict[str, Any]]: ... diff --git a/tests/README.md b/tests/README.md index f64fe02059ee..2df18286d043 100644 --- a/tests/README.md +++ b/tests/README.md @@ -4,6 +4,8 @@ tests the stubs with [mypy](https://github.com/python/mypy/) - `tests/pyright_test.py` tests the stubs with [pyright](https://github.com/microsoft/pyright). - `tests/ty_test.py` tests the stubs with [ty](https://github.com/astral-sh/ty). +- `tests/pyrefly_test.py` tests the stubs with +[pyrefly](https://github.com/facebook/pyrefly). - `tests/regr_test.py` runs mypy against the test cases for typeshed's stubs, guarding against accidental regressions. - `tests/check_typeshed_structure.py` checks that typeshed's directory @@ -98,6 +100,23 @@ every target version; only the obsolete `requests` and legacy `distutils` stubs are excluded. Run `python tests/ty_test.py --help` for the supported options. +## pyrefly\_test.py + +Run using: +```bash +(.venv)$ python3 tests/pyrefly_test.py --python=.venv/bin/python +(.venv)$ python3 tests/pyrefly_test.py stubs/PySocks --python=.venv/bin/python +``` + +This test checks the stdlib and third-party stubs with pyrefly, using the +configuration in `pyrefly.toml`. Like `ty_test.py`, it selects the stdlib modules +supported by the requested Python version using `stdlib/VERSIONS` and adds the +third-party stub roots to pyrefly's search path; only the obsolete `requests` and +legacy `distutils` stubs are excluded. The `--python` argument is passed to +pyrefly as `--python-interpreter-path`, so it should point at an interpreter +rather than an environment directory. Run +`python tests/pyrefly_test.py --help` for the supported options. + ## regr\_test.py This test runs mypy against the test cases for typeshed's stdlib and third-party diff --git a/tests/pyrefly_test.py b/tests/pyrefly_test.py new file mode 100755 index 000000000000..6d7b0cd4d002 --- /dev/null +++ b/tests/pyrefly_test.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""Run pyrefly on typeshed's stdlib and third-party stubs.""" + +from __future__ import annotations + +import argparse +import subprocess +from pathlib import Path + +from ts_utils.paths import STDLIB_PATH, STUBS_PATH, TS_BASE_PATH +from ts_utils.stubs import path_stubs, stdlib_stubs, third_party_stubs + +SUPPORTED_VERSIONS = ("3.10", "3.11", "3.12", "3.13", "3.14", "3.15") +SUPPORTED_PLATFORMS = ("linux", "darwin", "win32") +# requests is obsolete and the typed runtime package is installed instead. +EXCLUDED_STUBS = {"requests"} + + +def stdlib_files(version: str) -> list[Path]: + """Return the stdlib stubs available in the requested Python version.""" + # pyrefly cannot resolve relative imports in the legacy distutils stubs. + return [stub.path for stub in stdlib_stubs(version) if stub.module_parts[0] != "distutils"] + + +def third_party_files() -> list[Path]: + return [stub.path for stub in third_party_stubs() if stub.upstream_distribution not in EXCLUDED_STUBS] + + +def _filter_files(files: list[Path], paths: list[Path], root: Path) -> list[Path]: + selected_paths = [path if path.is_absolute() else TS_BASE_PATH / path for path in paths] + selected_files = {file for path in selected_paths if path.is_relative_to(root) for file in path_stubs(path)} + return [file for file in files if file in selected_files] + + +def main() -> int: + parser = argparse.ArgumentParser(description="Typecheck typeshed's stdlib and third-party stubs with pyrefly.") + parser.add_argument("paths", nargs="*", type=Path, help="Specific stdlib or third-party stubs to check") + parser.add_argument("--python", type=Path, help="Python interpreter used to resolve third-party imports") + parser.add_argument("--python-version", choices=SUPPORTED_VERSIONS, default=SUPPORTED_VERSIONS[0]) + parser.add_argument("--platform", choices=SUPPORTED_PLATFORMS, default="linux") + args = parser.parse_args() + + stdlib = stdlib_files(args.python_version) + third_party = third_party_files() + if args.paths: + stdlib = _filter_files(stdlib, args.paths, STDLIB_PATH) + third_party = _filter_files(third_party, args.paths, STUBS_PATH) + files = [*stdlib, *third_party] + if not files: + print("No stubs to check with pyrefly.", flush=True) + return 0 + command = [ + "pyrefly", + "check", + "--config", + str(TS_BASE_PATH / "pyrefly.toml"), + "--typeshed-path", + str(TS_BASE_PATH), + "--python-version", + args.python_version, + "--python-platform", + args.platform, + "--output-format", + "min-text", + ] + if args.python is not None: + command.extend(("--python-interpreter-path", str(args.python))) + + for path in sorted(STUBS_PATH.iterdir()): + # requests is obsolete and the typed runtime package provides requests._types. + if path.is_dir() and path.name != "requests": + command.extend(("--search-path", str(path))) + command.extend(map(str, files)) + + print(f"Checking {len(files)} stubs with pyrefly ({args.python_version}, {args.platform})...", flush=True) + return subprocess.run(command, check=False).returncode + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/runtests.py b/tests/runtests.py index 1ae28ea3f786..3b99cc5f5a2d 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -29,7 +29,7 @@ def _pythonpath_env() -> dict[str, str]: return env -def _ty_platform() -> str: +def _checker_platform() -> str: if sys.platform.startswith("win"): return "win32" return sys.platform @@ -123,7 +123,24 @@ def main() -> None: "--python-version", python_version, "--platform", - _ty_platform(), + _checker_platform(), + "--python", + sys.executable, + ], + env=_pythonpath_env(), + check=False, + ) + + print(f"\nRunning pyrefly for Python {python_version}...") + pyrefly_result = subprocess.run( + [ + sys.executable, + "tests/pyrefly_test.py", + path, + "--python-version", + python_version, + "--platform", + _checker_platform(), "--python", sys.executable, ], @@ -203,6 +220,7 @@ def main() -> None: check_structure_result.returncode, pyright_returncode, ty_result.returncode, + pyrefly_result.returncode, mypy_result.returncode, getattr(stubtest_result, "returncode", 0), pyright_testcases_returncode, @@ -230,6 +248,7 @@ def main() -> None: else: print("Pyright:", _SUCCESS if pyright_returncode == 0 else _FAILED) print("ty:", _SUCCESS if ty_result.returncode == 0 else _FAILED) + print("pyrefly:", _SUCCESS if pyrefly_result.returncode == 0 else _FAILED) print("mypy:", _SUCCESS if mypy_result.returncode == 0 else _FAILED) if stubtest_result is None: print("stubtest:", _SKIPPED)