Several Python types are wrong in motor

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 3.3.2
    • Affects Version/s: 3.3, 3.3.1
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The following list triggered issues with `mypy` in our codebase. Upon closer inspection of the runtime code these appeared to be wrongly typed:

      • AgnosticBaseCursor.to_list accepts only an int but should take int | None or Optional[int]
      • AgnosticCollection.name is typed as a function but implemented as a property
      • AgnosticDatabase.get_collection is typed as an async method but implemented as a sync method
      • AgnosticClientSession.with_transaction read_preference parameter is typed as Optional[_ServerMode] but takes Optional[pymongo.ReadPreference] type
      • AgnosticCollection needs to inherit from Generic[_DocumentType] in order to properly type AgnosticCollection.find_one and similar methods

              Assignee:
              Steve Silvester
              Reporter:
              Nico Aechtner
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: