# -*- coding: utf-8 -*-# pylint: disable=line-too-long,consider-using-f-string"""Option Actions====================.. module:: pcapkit.const.ipv6.option_actionThis module contains the constant enumeration for **Option Actions**,which is automatically generated from :class:`pcapkit.vendor.ipv6.option_action.OptionAction`."""fromaenumimportIntEnum,extend_enum__all__=['OptionAction']
[docs]classOptionAction(IntEnum):"""[OptionAction] Option Actions"""skip=0discard=1discard_icmp_any=2discard_icmp_unicast=3@staticmethoddefget(key:'int | str',default:'int'=-1)->'OptionAction':"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: """ifisinstance(key,int):returnOptionAction(key)ifkeynotinOptionAction._member_map_:# pylint: disable=no-memberreturnextend_enum(OptionAction,key,default)returnOptionAction[key]# type: ignore[misc]
[docs]@classmethoddef_missing_(cls,value:'int')->'OptionAction':"""Lookup function used when value is not found. Args: value: Value to get enum item. """ifnot(isinstance(value,int)and0<=value<=3):raiseValueError('%r is not a valid %s'%(value,cls.__name__))returnextend_enum(cls,'Unassigned_%d'%value,value)