# -*- coding: utf-8 -*-# pylint: disable=line-too-long,consider-using-f-string"""TS Flag=============.. module:: pcapkit.const.ipv4.ts_flagThis module contains the constant enumeration for **TS Flag**,which is automatically generated from :class:`pcapkit.vendor.ipv4.ts_flag.TSFlag`."""fromaenumimportIntEnum,extend_enum__all__=['TSFlag']
[docs]classTSFlag(IntEnum):"""[TSFlag] TS Flag"""Timestamp_Only=0IP_with_Timestamp=1Prespecified_IP_with_Timestamp=3@staticmethoddefget(key:'int | str',default:'int'=-1)->'TSFlag':"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: """ifisinstance(key,int):returnTSFlag(key)ifkeynotinTSFlag._member_map_:# pylint: disable=no-memberreturnextend_enum(TSFlag,key,default)returnTSFlag[key]# type: ignore[misc]
[docs]@classmethoddef_missing_(cls,value:'int')->'TSFlag':"""Lookup function used when value is not found. Args: value: Value to get enum item. """ifnot(isinstance(value,int)and0b0000<=value<=0b1111):raiseValueError('%r is not a valid %s'%(value,cls.__name__))returnextend_enum(cls,'Unassigned_%d'%value,value)