# -*- coding: utf-8 -*-# pylint: disable=line-too-long,consider-using-f-string"""ToS (DS Field) Precedence===============================.. module:: pcapkit.const.ipv4.tos_preThis module contains the constant enumeration for **ToS (DS Field) Precedence**,which is automatically generated from :class:`pcapkit.vendor.ipv4.tos_pre.ToSPrecedence`."""fromaenumimportIntEnum,extend_enum__all__=['ToSPrecedence']
[docs]classToSPrecedence(IntEnum):"""[ToSPrecedence] ToS (DS Field) Precedence"""Network_Control=7Internetwork_Control=6CRITIC_ECP=5Flash_Override=4Flash=3Immediate=2Priority=1Routine=0@staticmethoddefget(key:'int | str',default:'int'=-1)->'ToSPrecedence':"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: """ifisinstance(key,int):returnToSPrecedence(key)ifkeynotinToSPrecedence._member_map_:# pylint: disable=no-memberreturnextend_enum(ToSPrecedence,key,default)returnToSPrecedence[key]# type: ignore[misc]
[docs]@classmethoddef_missing_(cls,value:'int')->'ToSPrecedence':"""Lookup function used when value is not found. Args: value: Value to get enum item. """ifnot(isinstance(value,int)and0b000<=value<=0b111):raiseValueError('%r is not a valid %s'%(value,cls.__name__))returnextend_enum(cls,'Unassigned_%d'%value,value)