-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
When trying to use the @overload pattern for type stubs, it seems that the type system is resolving CodecOptions[_CodecDocumentType] as Any in the second signature, which supersedes Optional[CodecOptions[_CodecDocumentType]] :
motor/core.pyi:264: error: Overloaded function signature 3 will never be matched: signature 2's parameter type(s) are the same or broader [misc] async def command(
The full signatures:
@overload async def command( self, conn: Connection, command: Union[str, MutableMapping[str, Any]], value: int = 1, check: bool = True, allowable_errors: Optional[Sequence[Union[str, int]]] = None, read_preference: Optional[_ServerMode] = ReadPreference.PRIMARY, codec_options: CodecOptions[Dict[str, Any]] = DEFAULT_CODEC_OPTIONS, write_concern: Optional[WriteConcern] = None, parse_write_concern_error: bool = False, session: Optional[AgnosticClientSession] = None, **kwargs: Any, ) -> Dict[str, Any]: ... @overload async def command( self, conn: Connection, command: Union[str, MutableMapping[str, Any]], value: int = 1, check: bool = True, allowable_errors: Optional[Sequence[Union[str, int]]] = None, read_preference: Optional[_ServerMode] = ReadPreference.PRIMARY, codec_options: CodecOptions[_CodecDocumentType] = ..., write_concern: Optional[WriteConcern] = None, parse_write_concern_error: bool = False, session: Optional[AgnosticClientSession] = None, **kwargs: Any, ) -> _CodecDocumentType: ... @overload async def command( self, conn: Connection, command: Union[str, MutableMapping[str, Any]], value: int = 1, check: bool = True, allowable_errors: Optional[Sequence[Union[str, int]]] = None, read_preference: Optional[_ServerMode] = ReadPreference.PRIMARY, codec_options: Union[ CodecOptions[Dict[str, Any]], CodecOptions[_CodecDocumentType] ] = DEFAULT_CODEC_OPTIONS, write_concern: Optional[WriteConcern] = None, parse_write_concern_error: bool = False, session: Optional[AgnosticClientSession] = None, **kwargs: Any, ) -> Union[Dict[str, Any], _CodecDocumentType]: ...
- split from
-
MOTOR-331 Add python 3 type annotations
- Closed