MCPcopy Index your code
hub / github.com/python/cpython / _split_addr_prefix

Method _split_addr_prefix

Lib/ipaddress.py:526–547  ·  view source on GitHub ↗

Helper function to parse address of Network/Interface. Arg: address: Argument of Network/Interface. Returns: (addr, prefix) tuple.

(cls, address)

Source from the content-addressed store, hash-verified

524
525 @classmethod
526 def _split_addr_prefix(cls, address):
527 """Helper function to parse address of Network/Interface.
528
529 Arg:
530 address: Argument of Network/Interface.
531
532 Returns:
533 (addr, prefix) tuple.
534 """
535 # a packed address or integer
536 if isinstance(address, (bytes, int)):
537 return address, cls.max_prefixlen
538
539 if not isinstance(address, tuple):
540 # Assume input argument to be string or any object representation
541 # which converts into a formatted IP prefix string.
542 address = _split_optional_netmask(address)
543
544 # Constructing from a tuple (addr, [mask])
545 if len(address) > 1:
546 return address
547 return address[0], cls.max_prefixlen
548
549 def __reduce__(self):
550 return self.__class__, (str(self),)

Callers 4

__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 1

_split_optional_netmaskFunction · 0.85

Tested by

no test coverage detected