我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用socket.AddressType()。
def socktype_to_enum(num): """Convert a numeric socket type value to an IntEnum member. If it's not a known member, return the numeric value itself. """ if enum is None: return num else: # pragma: no cover try: return socket.AddressType(num) except (ValueError, AttributeError): return num
def socktype_to_enum(num): """Convert a numeric socket type value to an IntEnum member. If it's not a known member, return the numeric value itself. """ if enum is None: return num try: return socket.AddressType(num) except (ValueError, AttributeError): return num # --- Process.connections() 'kind' parameter mapping