From bc9029a22879c772e6049b962435fd563636ea92 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Fri, 28 Apr 2023 14:27:06 -0700 Subject: [PATCH] PYTHON-3679 Support mypy 1.2 (#1194) --- .github/workflows/test-python.yml | 2 +- bson/decimal128.py | 2 +- bson/son.py | 4 ++-- test/test_encryption.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 2941f9c3ab..bb0b836788 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -58,7 +58,7 @@ jobs: cache-dependency-path: 'setup.py' - name: Install dependencies run: | - python -m pip install -U pip mypy==0.990 + python -m pip install -U pip mypy==1.2 pip install -e ".[zstd, encryption, ocsp]" - name: Run mypy run: | diff --git a/bson/decimal128.py b/bson/decimal128.py index ab2d1a24ac..bce5b251e9 100644 --- a/bson/decimal128.py +++ b/bson/decimal128.py @@ -100,7 +100,7 @@ def _decimal_to_128(value: _VALUE_OPTIONS) -> Tuple[int, int]: if significand & (1 << i): high |= 1 << (i - 64) - biased_exponent = exponent + _EXPONENT_BIAS + biased_exponent = exponent + _EXPONENT_BIAS # type: ignore[operator] if high >> 49 == 1: high = high & 0x7FFFFFFFFFFF diff --git a/bson/son.py b/bson/son.py index e4238b4058..bba108aa80 100644 --- a/bson/son.py +++ b/bson/son.py @@ -66,7 +66,7 @@ def __init__( self.update(kwargs) def __new__(cls: Type["SON[_Key, _Value]"], *args: Any, **kwargs: Any) -> "SON[_Key, _Value]": - instance = super(SON, cls).__new__(cls, *args, **kwargs) + instance = super(SON, cls).__new__(cls, *args, **kwargs) # type: ignore[type-var] instance.__keys = [] return instance @@ -115,7 +115,7 @@ def clear(self) -> None: self.__keys = [] super(SON, self).clear() - def setdefault(self, key: _Key, default: _Value) -> _Value: # type: ignore[override] + def setdefault(self, key: _Key, default: _Value) -> _Value: try: return self[key] except KeyError: diff --git a/test/test_encryption.py b/test/test_encryption.py index 6cdc8da3b6..872e0356ad 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -2162,7 +2162,7 @@ def test_05_tlsDisableOCSPEndpointCheck_is_permitted(self): self.addCleanup(encryption.close) ctx = encryption._io_callbacks.opts._kms_ssl_contexts["aws"] if not hasattr(ctx, "check_ocsp_endpoint"): - raise self.skipTest("OCSP not enabled") # type:ignore + raise self.skipTest("OCSP not enabled") self.assertFalse(ctx.check_ocsp_endpoint)