From 80688d3a3d4a61a781b124703ff928790b4d419a Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 16 Mar 2022 10:50:34 +0000 Subject: [PATCH 1/5] Update tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b7182784c1db..cc8c6085d5cb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -72,7 +72,7 @@ jobs: python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] fail-fast: false env: - PYRIGHT_VERSION: 1.1.218 # Must match pyright_test.py. + PYRIGHT_VERSION: 1.1.230 # Must match pyright_test.py. steps: - uses: actions/checkout@v2 - uses: jakebailey/pyright-action@v1 From ffe789dd140956a6116a43c6bfde8dd5e6405be9 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 16 Mar 2022 10:51:04 +0000 Subject: [PATCH 2/5] Update pyright_test.py --- tests/pyright_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pyright_test.py b/tests/pyright_test.py index 07f1c7e84cc6..bfb157f3d924 100755 --- a/tests/pyright_test.py +++ b/tests/pyright_test.py @@ -5,7 +5,7 @@ import sys from pathlib import Path -_PYRIGHT_VERSION = "1.1.218" # Must match .github/workflows/tests.yml. +_PYRIGHT_VERSION = "1.1.230" # Must match .github/workflows/tests.yml. _WELL_KNOWN_FILE = Path("tests", "pyright_test.py") From 449cc92f46e8cc614bc73603bfd11d062cb6e5a6 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 16 Mar 2022 13:40:21 +0000 Subject: [PATCH 3/5] Pin pyright-action to 1.0.5 to check it still fails --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc8c6085d5cb..97c9ee6c6cc9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -75,14 +75,14 @@ jobs: PYRIGHT_VERSION: 1.1.230 # Must match pyright_test.py. steps: - uses: actions/checkout@v2 - - uses: jakebailey/pyright-action@v1 + - uses: jakebailey/pyright-action@v1.0.5 with: version: ${{ env.PYRIGHT_VERSION }} python-platform: ${{ matrix.python-platform }} python-version: ${{ matrix.python-version }} no-comments: ${{ matrix.python-version != '3.9' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. project: ./pyrightconfig.stricter.json - - uses: jakebailey/pyright-action@v1 + - uses: jakebailey/pyright-action@v1.0.5 with: version: ${{ env.PYRIGHT_VERSION }} python-platform: ${{ matrix.python-platform }} From c3cce8e5138def1fdd97adce5d5ebc2a203253a4 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 16 Mar 2022 06:43:30 -0700 Subject: [PATCH 4/5] 1.0.5 is broken, try 1.0.4 --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97c9ee6c6cc9..c38117affc86 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -75,14 +75,14 @@ jobs: PYRIGHT_VERSION: 1.1.230 # Must match pyright_test.py. steps: - uses: actions/checkout@v2 - - uses: jakebailey/pyright-action@v1.0.5 + - uses: jakebailey/pyright-action@v1.0.4 with: version: ${{ env.PYRIGHT_VERSION }} python-platform: ${{ matrix.python-platform }} python-version: ${{ matrix.python-version }} no-comments: ${{ matrix.python-version != '3.9' || matrix.python-platform != 'Linux' }} # Having each job create the same comment is too noisy. project: ./pyrightconfig.stricter.json - - uses: jakebailey/pyright-action@v1.0.5 + - uses: jakebailey/pyright-action@v1.0.4 with: version: ${{ env.PYRIGHT_VERSION }} python-platform: ${{ matrix.python-platform }} From 30fec457bdb5eb56731b5c23d3dd7d62b962dcf7 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 16 Mar 2022 14:05:57 +0000 Subject: [PATCH 5/5] Add `type: ignore`s for pyright --- .../sqlalchemy/dialects/mssql/pyodbc.pyi | 4 +++- .../sqlalchemy/dialects/mysql/pyodbc.pyi | 4 +++- .../sqlalchemy/dialects/postgresql/hstore.pyi | 4 +++- stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi | 22 +++++++++++-------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi index 907824cea6f3..c74dfd499c9f 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mssql/pyodbc.pyi @@ -29,7 +29,9 @@ class MSExecutionContext_pyodbc(MSExecutionContext): def pre_exec(self) -> None: ... def post_exec(self) -> None: ... -class MSDialect_pyodbc(PyODBCConnector, MSDialect): +# pyright complains about incompatible definitions of "supports_sane_rowcount_returning" in the base classes, +# hence the type: ignore +class MSDialect_pyodbc(PyODBCConnector, MSDialect): # type: ignore supports_statement_cache: bool supports_sane_rowcount_returning: bool colspecs: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi index f9363c3cc0b0..79edbf199ad4 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/pyodbc.pyi @@ -10,7 +10,9 @@ class _pyodbcTIME(TIME): class MySQLExecutionContext_pyodbc(MySQLExecutionContext): def get_lastrowid(self): ... -class MySQLDialect_pyodbc(PyODBCConnector, MySQLDialect): +# pyright complains about incompatible definitions of "supports_sane_rowcount_returning" variable in the base classes, +# hence the type: ignore +class MySQLDialect_pyodbc(PyODBCConnector, MySQLDialect): # type: ignore supports_statement_cache: bool colspecs: Any supports_unicode_statements: bool diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi index df92db4558c1..df4bca05ba16 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/hstore.pyi @@ -4,7 +4,9 @@ import sqlalchemy.types as sqltypes from ...sql import functions as sqlfunc -class HSTORE(sqltypes.Indexable, sqltypes.Concatenable, sqltypes.TypeEngine): +# pyright complains that "Comparator" is defined incompatibly in the base classes, +# hence the type: ignore +class HSTORE(sqltypes.Indexable, sqltypes.Concatenable, sqltypes.TypeEngine): # type: ignore __visit_name__: str hashable: bool text_type: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi index 5075c49b91d9..a1b4a0ee5f70 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/sqltypes.pyi @@ -1,3 +1,7 @@ +# pyright complains that several classes in this file +# have incompatible definitions of the "Comparator" variable in their bases, +# meaning there are several type: ignores + from typing import Any from .base import SchemaEventTarget @@ -24,7 +28,7 @@ class Indexable: def __getitem__(self, index): ... comparator_factory: Any -class String(Concatenable, TypeEngine): +class String(Concatenable, TypeEngine): # type: ignore __visit_name__: str RETURNS_UNICODE: Any RETURNS_BYTES: Any @@ -59,7 +63,7 @@ class UnicodeText(Text): __visit_name__: str def __init__(self, length: Any | None = ..., **kwargs) -> None: ... -class Integer(_LookupExpressionAdapter, TypeEngine): +class Integer(_LookupExpressionAdapter, TypeEngine): # type: ignore __visit_name__: str def get_dbapi_type(self, dbapi): ... @property @@ -72,7 +76,7 @@ class SmallInteger(Integer): class BigInteger(Integer): __visit_name__: str -class Numeric(_LookupExpressionAdapter, TypeEngine): +class Numeric(_LookupExpressionAdapter, TypeEngine): # type: ignore __visit_name__: str precision: Any scale: Any @@ -97,7 +101,7 @@ class Float(Numeric): def __init__(self, precision: Any | None = ..., asdecimal: bool = ..., decimal_return_scale: Any | None = ...) -> None: ... def result_processor(self, dialect, coltype): ... -class DateTime(_LookupExpressionAdapter, TypeEngine): +class DateTime(_LookupExpressionAdapter, TypeEngine): # type: ignore __visit_name__: str timezone: Any def __init__(self, timezone: bool = ...) -> None: ... @@ -105,13 +109,13 @@ class DateTime(_LookupExpressionAdapter, TypeEngine): @property def python_type(self): ... -class Date(_LookupExpressionAdapter, TypeEngine): +class Date(_LookupExpressionAdapter, TypeEngine): # type: ignore __visit_name__: str def get_dbapi_type(self, dbapi): ... @property def python_type(self): ... -class Time(_LookupExpressionAdapter, TypeEngine): +class Time(_LookupExpressionAdapter, TypeEngine): # type: ignore __visit_name__: str timezone: Any def __init__(self, timezone: bool = ...) -> None: ... @@ -199,7 +203,7 @@ class Boolean(Emulated, TypeEngine, SchemaType): # type: ignore[misc] def bind_processor(self, dialect): ... def result_processor(self, dialect, coltype): ... -class _AbstractInterval(_LookupExpressionAdapter, TypeEngine): +class _AbstractInterval(_LookupExpressionAdapter, TypeEngine): # type: ignore def coerce_compared_value(self, op, value): ... class Interval(Emulated, _AbstractInterval, TypeDecorator): # type: ignore[misc] @@ -216,7 +220,7 @@ class Interval(Emulated, _AbstractInterval, TypeDecorator): # type: ignore[misc def bind_processor(self, dialect): ... def result_processor(self, dialect, coltype): ... -class JSON(Indexable, TypeEngine): +class JSON(Indexable, TypeEngine): # type: ignore __visit_name__: str hashable: bool NULL: Any @@ -251,7 +255,7 @@ class JSON(Indexable, TypeEngine): def bind_processor(self, dialect): ... def result_processor(self, dialect, coltype): ... -class ARRAY(SchemaEventTarget, Indexable, Concatenable, TypeEngine): +class ARRAY(SchemaEventTarget, Indexable, Concatenable, TypeEngine): # type: ignore __visit_name__: str zero_indexes: bool