Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _missing_(cls, value):
"""Lookup function used when value is not found."""
if not (isinstance(value, int) and 0 <= value <= 1):
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
return cls(value)
if 61634 <= value <= 61696:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 61698 <= value <= 63660:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 63662 <= value <= 63424:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 63426 <= value <= 63997:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 63999 <= value <= 64001:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 64003 <= value <= 64010:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 64012 <= value <= 64016:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 64018 <= value <= 65497:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return RouterAlert(key)
if key not in RouterAlert._member_map_: # pylint: disable=no-member
extend_enum(RouterAlert, key, default)
return RouterAlert[key]
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return Operation(key)
if key not in Operation._member_map_: # pylint: disable=no-member
extend_enum(Operation, key, default)
return Operation[key]
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return Routing(key)
if key not in Routing._member_map_: # pylint: disable=no-member
extend_enum(Routing, key, default)
return Routing[key]
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return HIAlgorithm(key)
if key not in HIAlgorithm._member_map_: # pylint: disable=no-member
extend_enum(HIAlgorithm, key, default)
return HIAlgorithm[key]
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return ToSThroughput(key)
if key not in ToSThroughput._member_map_: # pylint: disable=no-member
extend_enum(ToSThroughput, key, default)
return ToSThroughput[key]
def _missing_(cls, value):
"""Lookup function used when value is not found."""
if not (isinstance(value, int) and 0 <= value <= 7):
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return ReturnCode(key)
if key not in ReturnCode._member_map_: # pylint: disable=no-member
extend_enum(ReturnCode, key, default)
return ReturnCode[key]
def _missing_(cls, value):
"""Lookup function used when value is not found."""
if not (isinstance(value, int) and 0 <= value <= 65535):
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
if 70 <= value <= 65502:
#: Unassigned
extend_enum(cls, 'Unassigned_%d' % value, value)
return cls(value)
if 65503 <= value <= 65534:
#: Reserved for experimental use [:rfc:`5350`]
extend_enum(cls, 'Reserved for experimental use_%d' % value, value)
return cls(value)
return super()._missing_(value)