Source code for pcapkit.const.ipv4.protection_authority
# -*- coding: utf-8 -*-# pylint: disable=line-too-long,consider-using-f-string"""Protection Authority Bit Assignments==========================================.. module:: pcapkit.const.ipv4.protection_authorityThis module contains the constant enumeration for **Protection Authority Bit Assignments**,which is automatically generated from :class:`pcapkit.vendor.ipv4.protection_authority.ProtectionAuthority`."""fromaenumimportIntEnum,extend_enum__all__=['ProtectionAuthority']
[docs]classProtectionAuthority(IntEnum):"""[ProtectionAuthority] Protection Authority Bit Assignments"""GENSER=0SIOP_ESI=1SCI=2NSA=3DOE=4Unassigned_5=5Unassigned_6=6Field_Termination_Indicator=7@staticmethoddefget(key:'int | str',default:'int'=-1)->'ProtectionAuthority':"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: """ifisinstance(key,int):returnProtectionAuthority(key)ifkeynotinProtectionAuthority._member_map_:# pylint: disable=no-memberreturnextend_enum(ProtectionAuthority,key,default)returnProtectionAuthority[key]# type: ignore[misc]
[docs]@classmethoddef_missing_(cls,value:'int')->'ProtectionAuthority':"""Lookup function used when value is not found. Args: value: Value to get enum item. """ifnot(isinstance(value,int)andvalue>=0):raiseValueError('%r is not a valid %s'%(value,cls.__name__))returnextend_enum(cls,'Unassigned_%d'%value,value)