• Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.4
    • Affects Version/s: None
    • Component/s: None
    • None

      mypy 1.0 was released back in February: https://mypy-lang.blogspot.com/2023/02/mypy-10-released.html

      pymongo fails type checking with mypy 1.2.0:

       
      mypy --install-types --non-interactive bson gridfs tools pymongo
      bson/son.py: note: In member "__new__" of class "SON":
      bson/son.py:69: error: Value of type variable "Self" of "__new__" of "dict" cannot be "SON[_Key, _Value]"  [type-var]
                  instance = super(SON, cls).__new__(cls, *args, **kwargs)
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bson/son.py: note: At top level:
      bson/son.py:118: error: Unused "type: ignore" comment
              def setdefault(self, key: _Key, default: _Value) -> _Value:  # type: ignore[override]
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      bson/decimal128.py: note: In function "_decimal_to_128":
      bson/decimal128.py:103: error: Unsupported operand types for + ("Literal['n']" and "int")  [operator]
              biased_exponent = exponent + _EXPONENT_BIAS
                                           ^~~~~~~~~~~~~~
      bson/decimal128.py:103: error: Unsupported operand types for + ("Literal['N']" and "int")  [operator]
              biased_exponent = exponent + _EXPONENT_BIAS
                                           ^~~~~~~~~~~~~~
      bson/decimal128.py:103: error: Unsupported operand types for + ("Literal['F']" and "int")  [operator]
              biased_exponent = exponent + _EXPONENT_BIAS
                                           ^~~~~~~~~~~~~~
      bson/decimal128.py:103: note: Left operand is of type "Union[int, Literal['n', 'N', 'F']]"
      Found 5 errors in 2 files (checked 84 source files)
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: