Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-1187

Several Python types are wrong in motor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 3.3.2
    • Affects Version/s: 3.3, 3.3.1
    • Component/s: 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@mongodb.com Steve Silvester
            Reporter:
            na@kialo.com Nico Aechtner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: