From 67a3336b49d8ec76fd500aa632465a4fe500235b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Wed, 20 Jul 2022 17:32:17 -0400 Subject: [PATCH 1/2] CI/TYP: bump mypy and pyright --- .pre-commit-config.yaml | 2 +- doc/source/whatsnew/v1.5.0.rst | 2 +- environment.yml | 2 +- requirements-dev.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92f3b3ce83297..f8cb869e6ed89 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -93,7 +93,7 @@ repos: types: [python] stages: [manual] additional_dependencies: &pyright_dependencies - - pyright@1.1.258 + - pyright@1.1.262 - id: pyright_reportGeneralTypeIssues name: pyright reportGeneralTypeIssues entry: pyright --skipunannotated -p pyright_reportGeneralTypeIssues.json diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index 090fea57872c5..6cdaf971a0902 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -418,7 +418,7 @@ If installed, we now require: +=================+=================+==========+=========+ | numpy | 1.19.5 | X | X | +-----------------+-----------------+----------+---------+ -| mypy (dev) | 0.960 | | X | +| mypy (dev) | 0.971 | | X | +-----------------+-----------------+----------+---------+ | beautifulsoup4 | 4.9.3 | | X | +-----------------+-----------------+----------+---------+ diff --git a/environment.yml b/environment.yml index 0a6055d80c071..cdd5dc3d0e05f 100644 --- a/environment.yml +++ b/environment.yml @@ -88,7 +88,7 @@ dependencies: - flake8-bugbear=21.3.2 # used by flake8, find likely bugs - flake8-comprehensions=3.7.0 # used by flake8, linting of unnecessary comprehensions - isort>=5.2.1 # check that imports are in the right order - - mypy=0.960 + - mypy=0.971 - pre-commit>=2.15.0 - pycodestyle # used by flake8 - pyupgrade diff --git a/requirements-dev.txt b/requirements-dev.txt index f5dfeb8e7ff30..ea1240d8308df 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -67,7 +67,7 @@ flake8==4.0.1 flake8-bugbear==21.3.2 flake8-comprehensions==3.7.0 isort>=5.2.1 -mypy==0.960 +mypy==0.971 pre-commit>=2.15.0 pycodestyle pyupgrade From 2af532bf40ae1256e685a8dbd68deddced48e612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20W=C3=B6rtwein?= Date: Fri, 29 Jul 2022 21:14:08 -0400 Subject: [PATCH 2/2] pyright 1.1.264 --- .pre-commit-config.yaml | 2 +- pandas/core/computation/expr.py | 4 +++- pandas/core/computation/ops.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f65c42dab1852..1810f12b65f07 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -93,7 +93,7 @@ repos: types: [python] stages: [manual] additional_dependencies: &pyright_dependencies - - pyright@1.1.262 + - pyright@1.1.264 - id: pyright_reportGeneralTypeIssues name: pyright reportGeneralTypeIssues entry: pyright --skipunannotated -p pyright_reportGeneralTypeIssues.json diff --git a/pandas/core/computation/expr.py b/pandas/core/computation/expr.py index 90824ce8d856f..ff3f259f49955 100644 --- a/pandas/core/computation/expr.py +++ b/pandas/core/computation/expr.py @@ -774,7 +774,9 @@ def __init__( @disallow(_unsupported_nodes | _python_not_supported | frozenset(["Not"])) class PythonExprVisitor(BaseExprVisitor): - def __init__(self, env, engine, parser, preparser=lambda x: x) -> None: + def __init__( + self, env, engine, parser, preparser=lambda source, f=None: source + ) -> None: super().__init__(env, engine, parser, preparser=preparser) diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py index db5f28e2ae6c1..e331fc89f69b7 100644 --- a/pandas/core/computation/ops.py +++ b/pandas/core/computation/ops.py @@ -10,6 +10,7 @@ from typing import ( Callable, Iterable, + Literal, ) import numpy as np @@ -552,7 +553,7 @@ class UnaryOp(Op): * If no function associated with the passed operator token is found. """ - def __init__(self, op: str, operand) -> None: + def __init__(self, op: Literal["+", "-", "~", "not"], operand) -> None: super().__init__(op, (operand,)) self.operand = operand