ottowayi / pycomm3

A Python Ethernet/IP library for communicating with Allen-Bradley PLCs.
MIT License
406 stars 88 forks source link

[BUG] - incorrect type hint in CIPDriver.list_identity #262

Closed jamesbraza closed 1 year ago

jamesbraza commented 1 year ago

Pre-checks

Description

In pycomm3==1.2.11:

class CIPDriver:

    @classmethod
    def list_identity(cls, path) -> Optional[str]:
        ...

However, this is incorrect, it should be:

class CIPDriver:

    @classmethod
    def list_identity(cls, path) -> Optional[dict[str, Any]]:
        ...

Thanks!

Code Sample

In [1]: from pycomm3 import CIPDriver

In [2]: MOTOR_IP_ADDRESS = "10.4.1.46"

In [3]: with CIPDriver(MOTOR_IP_ADDRESS) as driver:
   ...:     identity_obj = driver._list_identity()
   ...: print(type(identity_obj), identity_obj)
<class 'dict'> {'encap_protocol_version': 1, 'ip_address': '10.4.1.46', ...}
ottowayi commented 1 year ago

merged, thank you!