# -*- coding: utf-8 -*-# pylint: disable=line-too-long,consider-using-f-string"""Priority levels defined in IEEE 802.1p============================================.. module:: pcapkit.const.vlan.priority_levelThis module contains the constant enumeration for **Priority levels defined in IEEE 802.1p**,which is automatically generated from :class:`pcapkit.vendor.vlan.priority_level.PriorityLevel`."""fromaenumimportIntEnum,extend_enum__all__=['PriorityLevel']
[docs]classPriorityLevel(IntEnum):"""[PriorityLevel] Priority levels defined in IEEE 802.1p"""#: Background (lowest)BK=0b001#: Best effort (default)BE=0b000#: Excellent effortEE=0b010#: Critical applicationsCA=0b011#: Video, < 100 ms latency and jitterVI=0b100#: Voice, < 10 ms latency and jitterVO=0b101#: Internetwork controlIC=0b110#: Network control (highest)NC=0b111@staticmethoddefget(key:'int | str',default:'int'=-1)->'PriorityLevel':"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: """ifisinstance(key,int):returnPriorityLevel(key)ifkeynotinPriorityLevel._member_map_:# pylint: disable=no-memberreturnextend_enum(PriorityLevel,key,default)returnPriorityLevel[key]# type: ignore[misc]
[docs]@classmethoddef_missing_(cls,value:'int')->'PriorityLevel':"""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 [0b%s]'%bin(value)[2:].zfill(3),value)