[ 
https://issues.apache.org/jira/browse/PROTON-2453?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jiri Daněk updated PROTON-2453:
-------------------------------
    Summary: [proton-python] Fix socket.socket type annotations inconsistency 
found by MyPy  (was: [proton-python] Create MyPy CI job and fix found 
inconsistencies)

> [proton-python] Fix socket.socket type annotations inconsistency found by MyPy
> ------------------------------------------------------------------------------
>
>                 Key: PROTON-2453
>                 URL: https://issues.apache.org/jira/browse/PROTON-2453
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: python-binding
>    Affects Versions: proton-c-0.36.0
>            Reporter: Jiri Daněk
>            Priority: Major
>
> Known issues
> * MyPy cannot handle checking recursive types 
> https://github.com/python/mypy/issues/731
> Most problems involve null-safety. The value will not be null due to context, 
> but it is not (yet) reflected in the types, or not suppressed
> {noformat}
> % python -m mypy -m proton
> proton/_data.py:57: error: Cannot resolve name "PythonAMQPData" (possible 
> cyclic definition)  [misc]
> proton/_data.py:58: error: Cannot resolve name "PythonAMQPData" (possible 
> cyclic definition)  [misc]
> proton/_data.py:59: error: Cannot resolve name "PythonAMQPData" (possible 
> cyclic definition)  [misc]
> proton/_data.py:363: error: Argument 1 has incompatible type "Union[symbol, 
> str]"; expected "_T"  [arg-type]
> proton/_data.py:369: error: Signature of "update" incompatible with supertype 
> "dict"  [override]
> proton/_data.py:369: error: Signature of "update" incompatible with supertype 
> "MutableMapping"  [override]
> proton/_data.py:422: error: Cannot infer type argument 1 of "__init__" of 
> "RestrictedKeyDict"  [misc]
> proton/_data.py:470: error: Cannot infer type argument 1 of "__init__" of 
> "RestrictedKeyDict"  [misc]
> proton/_data.py:540: error: Signatures of "__iadd__" and "__add__" are 
> incompatible  [misc]
> proton/_data.py:544: error: Signature of "__setitem__" incompatible with 
> supertype "list"  [override]
> proton/_data.py:544: error: Signature of "__setitem__" incompatible with 
> supertype "MutableSequence"  [override]
> proton/_data.py:1429: error: Missing return statement  [return]
> proton/_data.py:1465: error: Missing return statement  [return]
> proton/_data.py:1480: error: Missing return statement  [return]
> proton/_data.py:1514: error: Missing return statement  [return]
> proton/_data.py:1625: error: Cannot call function of unknown type  [operator]
> proton/_condition.py:75: error: Argument 1 of "__eq__" is incompatible with 
> supertype "object"; supertype defines the argument type as "object"  
> [override]
> proton/_condition.py:75: note: This violates the Liskov substitution principle
> proton/_condition.py:75: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_condition.py:75: note: It is recommended for "__eq__" to work with 
> arbitrary objects, for example:
> proton/_condition.py:75: note:     def __eq__(self, other: object) -> bool:
> proton/_condition.py:75: note:         if not isinstance(other, Condition):
> proton/_condition.py:75: note:             return NotImplemented
> proton/_condition.py:75: note:         return <logic to compare two Condition 
> instances>
> proton/_io.py:84: error: Need type annotation for "_selectables" (hint: 
> "_selectables: Set[<type>] = ...")  [var-annotated]
> proton/_io.py:85: error: Need type annotation for "_reading" (hint: 
> "_reading: Set[<type>] = ...")  [var-annotated]
> proton/_io.py:86: error: Need type annotation for "_writing" (hint: 
> "_writing: Set[<type>] = ...")  [var-annotated]
> proton/_io.py:97: error: Incompatible types in assignment (expression has 
> type "float", variable has type "None")  [assignment]
> proton/_transport.py:481: error: Incompatible types in assignment (expression 
> has type "SSL", variable has type "None")  [assignment]
> proton/_transport.py:481: error: Argument 2 to "SSL" has incompatible type 
> "Optional[SSLDomain]"; expected "SSLDomain"  [arg-type]
> proton/_transport.py:482: error: Incompatible return value type (got "None", 
> expected "SSL")  [return-value]
> proton/_transport.py:876: error: Incompatible return value type (got "None", 
> expected "SSL")  [return-value]
> proton/_transport.py:890: error: "SSL" has no attribute "_ssl"  [attr-defined]
> proton/_transport.py:907: error: "SSL" has no attribute "_ssl"  [attr-defined]
> proton/_transport.py:960: error: "SSL" has no attribute "_ssl"  [attr-defined]
> proton/_transport.py:969: error: "SSL" has no attribute "_ssl"  [attr-defined]
> proton/_transport.py:974: error: No return value expected  [return-value]
> proton/_transport.py:984: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:993: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:1002: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:1011: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:1020: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:1029: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:1047: error: "SSL" has no attribute "_ssl"  
> [attr-defined]
> proton/_transport.py:1054: error: No return value expected  [return-value]
> proton/_transport.py:1099: error: "SSL" has no attribute "_ssl"  
> [attr-defined]
> proton/_transport.py:1128: error: "SSL" has no attribute "_ssl"  
> [attr-defined]
> proton/_transport.py:1147: error: "SSL" has no attribute "_ssl"  
> [attr-defined]
> proton/_transport.py:1149: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_transport.py:1153: error: "SSL" has no attribute "_ssl"  
> [attr-defined]
> proton/_delivery.py:43: error: The erased type of self 
> "Type[proton._delivery.DispositionType]" is not a supertype of its class 
> "Type[proton._delivery.NamedInt]"  [misc]
> proton/_delivery.py:382: error: Incompatible return value type (got 
> "Union[int, DispositionType]", expected "DispositionType")  [return-value]
> proton/_delivery.py:458: error: Incompatible return value type (got 
> "Optional[Transport]", expected "Transport")  [return-value]
> proton/_endpoints.py:222: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_endpoints.py:272: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_endpoints.py:366: error: Incompatible return value type (got "None", 
> expected "str")  [return-value]
> proton/_endpoints.py:532: error: Incompatible types in assignment (expression 
> has type "Optional[Array]", variable has type "SymbolList")  [assignment]
> proton/_endpoints.py:552: error: Incompatible types in assignment (expression 
> has type "Optional[Array]", variable has type "SymbolList")  [assignment]
> proton/_endpoints.py:570: error: Incompatible types in assignment (expression 
> has type "None", variable has type "PropertyDict")  [assignment]
> proton/_endpoints.py:691: error: Incompatible return value type (got 
> "Optional[Transport]", expected "Transport")  [return-value]
> proton/_endpoints.py:998: error: Incompatible return value type (got 
> "Optional[str]", expected "str")  [return-value]
> proton/_endpoints.py:1162: error: Incompatible types in assignment 
> (expression has type "None", variable has type "PropertyDict")  [assignment]
> proton/_endpoints.py:1199: error: Item "bytes" of "Union[bytes, Message]" has 
> no attribute "send"  [union-attr]
> proton/_endpoints.py:1202: error: Argument 1 to "stream" of "Sender" has 
> incompatible type "Union[bytes, Message]"; expected "bytes"  [arg-type]
> proton/_message.py:105: error: "None" has no attribute "keys"  [attr-defined]
> proton/_message.py:119: error: Unsupported target for indexed assignment 
> ("None")  [index]
> proton/_message.py:119: error: "None" has no attribute "pop"  [attr-defined]
> proton/_message.py:283: error: Argument 1 to "ulong" has incompatible type 
> "Union[str, bytes, UUID, int, None]"; expected "int"  [arg-type]
> proton/_message.py:285: error: Incompatible types in assignment (expression 
> has type "Tuple[Any, bytes]", variable has type "Union[str, bytes, UUID, int, 
> None]")  [assignment]
> proton/_message.py:356: error: Argument 1 to "ulong" has incompatible type 
> "Union[str, bytes, UUID, int, None]"; expected "int"  [arg-type]
> proton/_message.py:358: error: Incompatible types in assignment (expression 
> has type "Tuple[Any, bytes]", variable has type "Union[str, bytes, UUID, int, 
> None]")  [assignment]
> proton/_message.py:464: error: Incompatible types in assignment (expression 
> has type "None", variable has type "AnnotationDict")  [assignment]
> proton/_message.py:485: error: Incompatible types in assignment (expression 
> has type "None", variable has type "AnnotationDict")  [assignment]
> proton/_message.py:521: error: Single overload definition, multiple required  
> [misc]
> proton/_message.py:525: error: Overloaded function implementation does not 
> accept all possible arguments of signature 1  [misc]
> proton/_message.py:548: error: Argument 1 to "decode" of "Message" has 
> incompatible type "Optional[bytes]"; expected "bytes"  [arg-type]
> proton/_events.py:167: error: "EventBase" has no attribute "context"  
> [attr-defined]
> proton/_events.py:583: error: Incompatible return value type (got 
> "Union[Receiver, Sender]", expected "Optional[Sender]")  [return-value]
> proton/_events.py:596: error: Incompatible return value type (got 
> "Union[Receiver, Sender]", expected "Optional[Receiver]")  [return-value]
> proton/_selectable.py:74: error: Incompatible types in assignment (expression 
> has type "float", variable has type "int")  [assignment]
> proton/_handlers.py:62: error: Item "None" of "Union[Receiver, Sender, None]" 
> has no attribute "is_sender"  [union-attr]
> proton/_handlers.py:62: error: Item "None" of "Union[Receiver, Sender, None]" 
> has no attribute "credit"  [union-attr]
> proton/_handlers.py:63: error: Item "None" of "Union[Receiver, Sender, None]" 
> has no attribute "state"  [union-attr]
> proton/_handlers.py:64: error: Item "None" of "Union[Receiver, Sender, None]" 
> has no attribute "state"  [union-attr]
> proton/_handlers.py:69: error: Item "None" of "Optional[Delivery]" has no 
> attribute "link"  [union-attr]
> proton/_handlers.py:69: error: Item "None" of "Optional[Delivery]" has no 
> attribute "updated"  [union-attr]
> proton/_handlers.py:70: error: Item "None" of "Optional[Delivery]" has no 
> attribute "remote_state"  [union-attr]
> proton/_handlers.py:72: error: Item "None" of "Optional[Delivery]" has no 
> attribute "remote_state"  [union-attr]
> proton/_handlers.py:74: error: Item "None" of "Optional[Delivery]" has no 
> attribute "remote_state"  [union-attr]
> proton/_handlers.py:76: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settled"  [union-attr]
> proton/_handlers.py:79: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settle"  [union-attr]
> proton/_handlers.py:139: error: Argument 1 to "decode" of "Message" has 
> incompatible type "Union[bytes, None, Any]"; expected "bytes"  [arg-type]
> proton/_handlers.py:241: error: Item "None" of "Optional[Delivery]" has no 
> attribute "link"  [union-attr]
> proton/_handlers.py:243: error: Item "None" of "Optional[Delivery]" has no 
> attribute "aborted"  [union-attr]
> proton/_handlers.py:245: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settle"  [union-attr]
> proton/_handlers.py:246: error: Item "None" of "Optional[Delivery]" has no 
> attribute "readable"  [union-attr]
> proton/_handlers.py:246: error: Item "None" of "Optional[Delivery]" has no 
> attribute "partial"  [union-attr]
> proton/_handlers.py:247: error: "Event" has no attribute "message"  
> [attr-defined]
> proton/_handlers.py:247: error: Argument 1 to "recv_msg" has incompatible 
> type "Optional[Delivery]"; expected "Delivery"  [arg-type]
> proton/_handlers.py:248: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "state"  [union-attr]
> proton/_handlers.py:250: error: Item "None" of "Optional[Delivery]" has no 
> attribute "update"  [union-attr]
> proton/_handlers.py:251: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settle"  [union-attr]
> proton/_handlers.py:256: error: Item "None" of "Optional[Delivery]" has no 
> attribute "update"  [union-attr]
> proton/_handlers.py:257: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settle"  [union-attr]
> proton/_handlers.py:259: error: Item "None" of "Optional[Delivery]" has no 
> attribute "update"  [union-attr]
> proton/_handlers.py:260: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settle"  [union-attr]
> proton/_handlers.py:262: error: Item "None" of "Optional[Delivery]" has no 
> attribute "update"  [union-attr]
> proton/_handlers.py:263: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settle"  [union-attr]
> proton/_handlers.py:264: error: Item "None" of "Optional[Delivery]" has no 
> attribute "updated"  [union-attr]
> proton/_handlers.py:264: error: Item "None" of "Optional[Delivery]" has no 
> attribute "settled"  [union-attr]
> proton/_handlers.py:334: error: "Endpoint" has no attribute "state"  
> [attr-defined]
> proton/_handlers.py:346: error: "Endpoint" has no attribute "state"  
> [attr-defined]
> proton/_handlers.py:358: error: "Endpoint" has no attribute "state"  
> [attr-defined]
> proton/_handlers.py:370: error: "Endpoint" has no attribute "state"  
> [attr-defined]
> proton/_handlers.py:382: error: "Endpoint" has no attribute "state"  
> [attr-defined]
> proton/_handlers.py:399: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "remote_condition"  [union-attr]
> proton/_handlers.py:401: error: Argument 1 to "is_local_closed" of 
> "EndpointStateHandler" has incompatible type "Union[Receiver, Sender, None]"; 
> expected "Endpoint"  [arg-type]
> proton/_handlers.py:405: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "close"  [union-attr]
> proton/_handlers.py:408: error: Item "None" of "Optional[Session]" has no 
> attribute "remote_condition"  [union-attr]
> proton/_handlers.py:410: error: Argument 1 to "is_local_closed" of 
> "EndpointStateHandler" has incompatible type "Optional[Session]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:414: error: Item "None" of "Optional[Session]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:417: error: Item "None" of "Optional[Connection]" has no 
> attribute "remote_condition"  [union-attr]
> proton/_handlers.py:418: error: Item "None" of "Optional[Connection]" has no 
> attribute "remote_condition"  [union-attr]
> proton/_handlers.py:423: error: Argument 1 to "is_local_closed" of 
> "EndpointStateHandler" has incompatible type "Optional[Connection]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:427: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:430: error: Argument 1 to "is_remote_open" of 
> "EndpointStateHandler" has incompatible type "Optional[Connection]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:434: error: Argument 1 to "is_local_open" of 
> "EndpointStateHandler" has incompatible type "Optional[Connection]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:436: error: Argument 1 to "is_local_uninitialised" of 
> "EndpointStateHandler" has incompatible type "Optional[Connection]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:438: error: Item "None" of "Optional[Connection]" has no 
> attribute "open"  [union-attr]
> proton/_handlers.py:441: error: Argument 1 to "is_remote_open" of 
> "EndpointStateHandler" has incompatible type "Optional[Session]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:445: error: Argument 1 to "is_local_open" of 
> "EndpointStateHandler" has incompatible type "Optional[Session]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:447: error: Argument 1 to "is_local_uninitialised" of 
> "EndpointStateHandler" has incompatible type "Optional[Session]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:449: error: Item "None" of "Optional[Session]" has no 
> attribute "open"  [union-attr]
> proton/_handlers.py:452: error: Argument 1 to "is_remote_open" of 
> "EndpointStateHandler" has incompatible type "Union[Receiver, Sender, None]"; 
> expected "Endpoint"  [arg-type]
> proton/_handlers.py:456: error: Argument 1 to "is_local_open" of 
> "EndpointStateHandler" has incompatible type "Union[Receiver, Sender, None]"; 
> expected "Endpoint"  [arg-type]
> proton/_handlers.py:458: error: Argument 1 to "is_local_uninitialised" of 
> "EndpointStateHandler" has incompatible type "Union[Receiver, Sender, None]"; 
> expected "Endpoint"  [arg-type]
> proton/_handlers.py:460: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "open"  [union-attr]
> proton/_handlers.py:538: error: Argument 1 to "print_error" of 
> "EndpointStateHandler" has incompatible type "Optional[Connection]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:550: error: Argument 1 to "print_error" of 
> "EndpointStateHandler" has incompatible type "Optional[Session]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:551: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:563: error: Argument 1 to "print_error" of 
> "EndpointStateHandler" has incompatible type "Union[Receiver, Sender, None]"; 
> expected "Endpoint"  [arg-type]
> proton/_handlers.py:564: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:700: error: Item "None" of "Optional[Transport]" has no 
> attribute "condition"  [union-attr]
> proton/_handlers.py:701: error: Item "None" of "Optional[Transport]" has no 
> attribute "condition"  [union-attr]
> proton/_handlers.py:702: error: On Python 3 '%s' % b'abc' produces "b'abc'", 
> not 'abc'; use '%r' % b'abc' if this is desired behavior  [str-bytes-safe]
> proton/_handlers.py:703: error: Item "None" of "Optional[Transport]" has no 
> attribute "condition"  [union-attr]
> proton/_handlers.py:704: error: Item "None" of "Optional[Transport]" has no 
> attribute "condition"  [union-attr]
> proton/_handlers.py:706: error: Item "None" of "Optional[Transport]" has no 
> attribute "condition"  [union-attr]
> proton/_handlers.py:707: error: Item "None" of "Optional[Transport]" has no 
> attribute "condition"  [union-attr]
> proton/_handlers.py:708: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:720: error: Argument 1 to "print_error" of 
> "EndpointStateHandler" has incompatible type "Optional[Connection]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:729: error: Argument 1 to "print_error" of 
> "EndpointStateHandler" has incompatible type "Optional[Session]"; expected 
> "Endpoint"  [arg-type]
> proton/_handlers.py:730: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:739: error: Argument 1 to "print_error" of 
> "EndpointStateHandler" has incompatible type "Union[Receiver, Sender, None]"; 
> expected "Endpoint"  [arg-type]
> proton/_handlers.py:740: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:750: error: "Container" has no attribute "subclass"  
> [attr-defined]
> proton/_handlers.py:995: error: Argument 1 to "_flow" of "FlowController" has 
> incompatible type "Union[Receiver, Sender, None]"; expected "Union[Sender, 
> Receiver]"  [arg-type]
> proton/_handlers.py:998: error: Argument 1 to "_flow" of "FlowController" has 
> incompatible type "Union[Receiver, Sender, None]"; expected "Union[Sender, 
> Receiver]"  [arg-type]
> proton/_handlers.py:1001: error: Argument 1 to "_flow" of "FlowController" 
> has incompatible type "Union[Receiver, Sender, None]"; expected 
> "Union[Sender, Receiver]"  [arg-type]
> proton/_handlers.py:1004: error: Argument 1 to "_flow" of "FlowController" 
> has incompatible type "Union[Receiver, Sender, None]"; expected 
> "Union[Sender, Receiver]"  [arg-type]
> proton/_handlers.py:1019: error: Item "None" of "Optional[Connection]" has no 
> attribute "state"  [union-attr]
> proton/_handlers.py:1020: error: Item "None" of "Optional[Connection]" has no 
> attribute "open"  [union-attr]
> proton/_handlers.py:1025: error: Item "None" of "Optional[Session]" has no 
> attribute "state"  [union-attr]
> proton/_handlers.py:1026: error: Item "None" of "Optional[Session]" has no 
> attribute "open"  [union-attr]
> proton/_handlers.py:1031: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "state"  [union-attr]
> proton/_handlers.py:1032: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "source"  [union-attr]
> proton/_handlers.py:1032: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "remote_source"  [union-attr]
> proton/_handlers.py:1033: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "target"  [union-attr]
> proton/_handlers.py:1033: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "remote_target"  [union-attr]
> proton/_handlers.py:1034: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "open"  [union-attr]
> proton/_handlers.py:1039: error: Item "None" of "Optional[Connection]" has no 
> attribute "state"  [union-attr]
> proton/_handlers.py:1040: error: Item "None" of "Optional[Connection]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:1045: error: Item "None" of "Optional[Session]" has no 
> attribute "state"  [union-attr]
> proton/_handlers.py:1046: error: Item "None" of "Optional[Session]" has no 
> attribute "close"  [union-attr]
> proton/_handlers.py:1051: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "state"  [union-attr]
> proton/_handlers.py:1052: error: Item "None" of "Union[Receiver, Sender, 
> None]" has no attribute "close"  [union-attr]
> proton/_handlers.py:1063: error: Need type annotation for "selectables" 
> (hint: "selectables: List[<type>] = ...")  [var-annotated]
> proton/_handlers.py:1238: error: Item "None" of "Optional[Connection]" has no 
> attribute "state"  [union-attr]
> proton/_handlers.py:1245: error: Argument 1 to "bind_nothrow" of "Transport" 
> has incompatible type "Optional[Connection]"; expected "Connection"  
> [arg-type]
> proton/_handlers.py:1251: error: Item "None" of "Optional[Connection]" has no 
> attribute "_reactor"  [union-attr]
> proton/_handlers.py:1254: error: Item "None" of "Optional[Transport]" has no 
> attribute "_reactor"  [union-attr]
> proton/_handlers.py:1256: error: Item "None" of "Optional[Connection]" has no 
> attribute "_acceptor"  [union-attr]
> proton/_handlers.py:1261: error: Item "None" of "Optional[Connection]" has no 
> attribute "url"  [union-attr]
> proton/_handlers.py:1261: error: Item "None" of "Optional[Connection]" has no 
> attribute "hostname"  [union-attr]
> proton/_handlers.py:1267: error: Item "None" of "Optional[Connection]" has no 
> attribute "user"  [union-attr]
> proton/_handlers.py:1270: error: Item "None" of "Optional[Connection]" has no 
> attribute "user"  [union-attr]
> proton/_handlers.py:1273: error: Item "None" of "Optional[Connection]" has no 
> attribute "password"  [union-attr]
> proton/_handlers.py:1285: error: Item "None" of "Optional[Transport]" has no 
> attribute "_selectable"  [union-attr]
> proton/_handlers.py:1295: error: "Selectable" has no attribute "_transport"  
> [attr-defined]
> proton/_handlers.py:1303: error: "Selectable" has no attribute "_transport"  
> [attr-defined]
> proton/_handlers.py:1310: error: Item "None" of "Optional[Transport]" has no 
> attribute "_reactor"  [union-attr]
> proton/_handlers.py:1311: error: Item "None" of "Optional[Transport]" has no 
> attribute "_selectable"  [union-attr]
> proton/_handlers.py:1313: error: Argument 1 to "update" of "IOHandler" has 
> incompatible type "Optional[Transport]"; expected "Transport"  [arg-type]
> proton/_handlers.py:1313: error: Item "None" of "Optional[Any]" has no 
> attribute "now"  [union-attr]
> proton/_handlers.py:1317: error: Item "None" of "Optional[Transport]" has no 
> attribute "_reactor"  [union-attr]
> proton/_handlers.py:1318: error: Item "None" of "Optional[Transport]" has no 
> attribute "_selectable"  [union-attr]
> proton/_handlers.py:1322: error: Item "None" of "Optional[Transport]" has no 
> attribute "_selectable"  [union-attr]
> proton/_handlers.py:1323: error: Item "None" of "Optional[Any]" has no 
> attribute "update"  [union-attr]
> proton/_handlers.py:1324: error: Item "None" of "Optional[Transport]" has no 
> attribute "unbind"  [union-attr]
> proton/_handlers.py:1340: error: Item "EventInjector" of 
> "Union[EventInjector, socket, None]" has no attribute "getsockopt"  
> [union-attr]
> proton/_handlers.py:1340: error: Item "None" of "Union[EventInjector, socket, 
> None]" has no attribute "getsockopt"  [union-attr]
> proton/_handlers.py:1357: error: Argument "delegate" to "selectable" of 
> "Reactor" has incompatible type "Union[EventInjector, socket, None]"; 
> expected "Optional[socket]"  [arg-type]
> proton/_handlers.py:1358: error: "Selectable" has no attribute "_transport"  
> [attr-defined]
> proton/_reactor.py:35: error: Name "Literal" already defined (possibly by an 
> import)  [no-redef]
> proton/_reactor.py:130: error: Need type annotation for "_timerheap" (hint: 
> "_timerheap: List[<type>] = ...")  [var-annotated]
> proton/_reactor.py:132: error: Need type annotation for "errors" (hint: 
> "errors: List[<type>] = ...")  [var-annotated]
> proton/_reactor.py:209: error: Argument 1 to "push_event" of "Reactor" has 
> incompatible type "Reactor"; expected "Union[Task, Container, Selectable]"  
> [arg-type]
> proton/_reactor.py:210: error: Argument 1 to "TimerSelectable" has 
> incompatible type "Reactor"; expected "Container"  [arg-type]
> proton/_reactor.py:266: error: Argument 1 to "push_event" of "Reactor" has 
> incompatible type "Reactor"; expected "Union[Task, Container, Selectable]"  
> [arg-type]
> proton/_reactor.py:275: error: Argument 1 to "push_event" of "Reactor" has 
> incompatible type "Reactor"; expected "Union[Task, Container, Selectable]"  
> [arg-type]
> proton/_reactor.py:295: error: Argument 1 to "Task" has incompatible type 
> "Reactor"; expected "Container"  [arg-type]
> proton/_reactor.py:334: error: Argument 1 to "_make_handler" of "Reactor" has 
> incompatible type "Optional[Handler]"; expected "Handler"  [arg-type]
> proton/_reactor.py:335: error: Argument 1 to "Acceptor" has incompatible type 
> "Reactor"; expected "Container"  [arg-type]
> proton/_reactor.py:335: error: Argument 2 to "Acceptor" has incompatible type 
> "Optional[str]"; expected "str"  [arg-type]
> proton/_reactor.py:344: error: Argument 1 to "_make_handler" of "Reactor" has 
> incompatible type "Optional[Handler]"; expected "Handler"  [arg-type]
> proton/_reactor.py:391: error: Incompatible types in assignment (expression 
> has type "Union[Acceptor, EventInjector, None]", variable has type 
> "Optional[socket]")  [assignment]
> proton/_reactor.py:392: error: Argument 2 to "Selectable" has incompatible 
> type "Reactor"; expected "Container"  [arg-type]
> proton/_reactor.py:393: error: "Selectable" has no attribute "handler"  
> [attr-defined]
> proton/_reactor.py:404: error: Argument 1 to "put" of "Collector" has 
> incompatible type "Union[Task, Container, Selectable]"; expected "Selectable" 
>  [arg-type]
> proton/_reactor.py:418: error: Need type annotation for "queue"  
> [var-annotated]
> proton/_reactor.py:494: error: Incompatible types in assignment (expression 
> has type "EventType", variable has type "<subclass of "str" and 
> "EventType">")  [assignment]
> proton/_reactor.py:551: error: Need type annotation for "_pending" (hint: 
> "_pending: List[<type>] = ...")  [var-annotated]
> proton/_reactor.py:596: error: Item "int" of "Union[int, Delivery]" has no 
> attribute "local"  [union-attr]
> proton/_reactor.py:597: error: Item "int" of "Union[int, Delivery]" has no 
> attribute "update"  [union-attr]
> proton/_reactor.py:598: error: Incompatible return value type (got 
> "Union[int, Delivery]", expected "Delivery")  [return-value]
> proton/_reactor.py:711: error: Argument 1 of "apply" is incompatible with 
> supertype "LinkOption"; supertype defines the argument type as "Link"  
> [override]
> proton/_reactor.py:711: note: This violates the Liskov substitution principle
> proton/_reactor.py:711: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_reactor.py:728: error: Argument 1 of "apply" is incompatible with 
> supertype "LinkOption"; supertype defines the argument type as "Link"  
> [override]
> proton/_reactor.py:728: note: This violates the Liskov substitution principle
> proton/_reactor.py:728: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_reactor.py:781: error: Argument 1 of "apply" is incompatible with 
> supertype "LinkOption"; supertype defines the argument type as "Link"  
> [override]
> proton/_reactor.py:781: note: This violates the Liskov substitution principle
> proton/_reactor.py:781: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_reactor.py:811: error: Argument 1 of "apply" is incompatible with 
> supertype "LinkOption"; supertype defines the argument type as "Link"  
> [override]
> proton/_reactor.py:811: note: This violates the Liskov substitution principle
> proton/_reactor.py:811: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_reactor.py:829: error: Argument 1 of "apply" is incompatible with 
> supertype "LinkOption"; supertype defines the argument type as "Link"  
> [override]
> proton/_reactor.py:829: note: This violates the Liskov substitution principle
> proton/_reactor.py:829: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_reactor.py:846: error: Argument 1 of "apply" is incompatible with 
> supertype "LinkOption"; supertype defines the argument type as "Link"  
> [override]
> proton/_reactor.py:846: note: This violates the Liskov substitution principle
> proton/_reactor.py:846: note: See 
> https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
> proton/_reactor.py:888: error: Incompatible types in assignment (expression 
> has type "Session", variable has type "None")  [assignment]
> proton/_reactor.py:889: error: Incompatible return value type (got "None", 
> expected "Session")  [return-value]
> proton/_reactor.py:901: error: Signature of "on_unhandled" incompatible with 
> supertype "Handler"  [override]
> proton/_reactor.py:907: error: Incompatible return value type (got 
> "Union[Connection, None, bool, Any]", expected "Optional[bool]")  
> [return-value]
> proton/_reactor.py:907: error: "dispatch" of "EventBase" does not return a 
> value  [func-returns-value]
> proton/_reactor.py:919: error: "Selectable" has no attribute "_transport"  
> [attr-defined]
> proton/_reactor.py:924: error: Incompatible types in assignment (expression 
> has type "SSLDomain", variable has type "None")  [assignment]
> proton/_reactor.py:934: error: Argument 1 to "accept" of "IO" has 
> incompatible type "Selectable"; expected "socket"  [arg-type]
> proton/_reactor.py:940: error: Incompatible types in assignment (expression 
> has type "Acceptor", variable has type "None")  [assignment]
> proton/_reactor.py:941: error: Incompatible types in assignment (expression 
> has type "Url", variable has type "None")  [assignment]
> proton/_reactor.py:1047: error: Incompatible types in assignment (expression 
> has type "Url", variable has type "None")  [assignment]
> proton/_reactor.py:1080: error: Incompatible types in assignment (expression 
> has type "Generator[Tuple[float, Any], None, None]", variable has type 
> "None")  [assignment]
> proton/_reactor.py:1080: error: "None" has no attribute "__iter__" (not 
> iterable)  [attr-defined]
> proton/_reactor.py:1085: error: No overload variant of "next" matches 
> argument type "None"  [call-overload]
> proton/_reactor.py:1085: note: Possible overload variant:
> proton/_reactor.py:1085: note:     def [_T] next(Iterator[_T]) -> _T
> proton/_reactor.py:1085: note:     <1 more non-matching overload not shown>
> proton/_reactor.py:1086: error: Argument 1 to "_connect" of "_Connector" has 
> incompatible type "Optional[Connection]"; expected "Connection"  [arg-type]
> proton/_reactor.py:1089: error: Item "None" of "Optional[Connection]" has no 
> attribute "hostname"  [union-attr]
> proton/_reactor.py:1091: error: Incompatible types in assignment (expression 
> has type "Generator[Tuple[float, Any], None, None]", variable has type 
> "None")  [assignment]
> proton/_reactor.py:1091: error: "None" has no attribute "__iter__" (not 
> iterable)  [attr-defined]
> proton/_reactor.py:1108: error: Item "None" of "Optional[Transport]" has no 
> attribute "unbind"  [union-attr]
> proton/_reactor.py:1109: error: No overload variant of "next" matches 
> argument type "None"  [call-overload]
> proton/_reactor.py:1109: note: Possible overload variant:
> proton/_reactor.py:1109: note:     def [_T] next(Iterator[_T]) -> _T
> proton/_reactor.py:1109: note:     <1 more non-matching overload not shown>
> proton/_reactor.py:1123: error: Incompatible types in assignment (expression 
> has type "None", variable has type "Connection")  [assignment]
> proton/_reactor.py:1201: error: Incompatible types in assignment (expression 
> has type "None", variable has type "SSLConfig")  [assignment]
> proton/_reactor.py:1348: error: Argument "heartbeat" to "_connect" of 
> "Container" has incompatible type "Optional[float]"; expected "None"  
> [arg-type]
> proton/_reactor.py:1351: error: Argument "heartbeat" to "_connect" of 
> "Container" has incompatible type "Optional[float]"; expected "None"  
> [arg-type]
> proton/_reactor.py:1384: error: Incompatible types in assignment (expression 
> has type "Urls", variable has type "None")  [assignment]
> proton/_reactor.py:1386: error: Incompatible types in assignment (expression 
> has type "Urls", variable has type "None")  [assignment]
> proton/_reactor.py:1386: error: Argument 1 to "Urls" has incompatible type 
> "List[str]"; expected "List[Union[Url, str]]"  [arg-type]
> proton/_reactor.py:1386: note: "List" is invariant -- see 
> https://mypy.readthedocs.io/en/stable/common_issues.html#variance
> proton/_reactor.py:1386: note: Consider using "Sequence" instead, which is 
> covariant
> proton/_reactor.py:1396: error: Incompatible types in assignment (expression 
> has type "Union[SSLDomain, SSLConfig]", variable has type "None")  
> [assignment]
> proton/_reactor.py:1471: error: Argument 1 to "_get_session" of "Container" 
> has incompatible type "Union[str, Url, Connection]"; expected "Connection"  
> [arg-type]
> proton/_reactor.py:1481: error: Argument 1 to "_apply_link_options" has 
> incompatible type "Union[SenderOption, List[SenderOption], LinkOption, 
> List[LinkOption], None]"; expected "Union[LinkOption, List[LinkOption], 
> None]"  [arg-type]
> proton/_reactor.py:1532: error: Argument 1 to "_get_session" of "Container" 
> has incompatible type "Union[Connection, Url, str]"; expected "Connection"  
> [arg-type]
> proton/_reactor.py:1542: error: Argument 1 to "_apply_link_options" has 
> incompatible type "Union[ReceiverOption, List[ReceiverOption], LinkOption, 
> List[LinkOption], None]"; expected "Union[LinkOption, List[LinkOption], 
> None]"  [arg-type]
> proton/_reactor.py:1577: error: Argument 2 to "Transaction" has incompatible 
> type "Optional[TransactionHandler]"; expected "TransactionHandler"  [arg-type]
> Found 257 errors in 11 files (checked 1 source file)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to