# -*- coding: utf-8 -*-"""No-Payload Packet=======================.. module:: pcapkit.protocols.misc.null:mod:`pcapkit.protocols.null` contains:class:`~pcapkit.protocols.null.NoPayload` only, whichimplements a :class:`~pcapkit.protocols.protocol.Protocol` likeobject whose payload is recursively:class:`~pcapkit.protocols.null.NoPayload` itself."""importiofromtypingimportTYPE_CHECKING,overloadfrompcapkit.protocols.data.misc.nullimportNoPayloadasData_NoPayloadfrompcapkit.protocols.protocolimportProtocolBaseasProtocolfrompcapkit.protocols.schema.misc.nullimportNoPayloadasSchema_NoPayloadfrompcapkit.utilities.exceptionsimportUnsupportedCallifTYPE_CHECKING:fromtypingimportIO,Any,NoReturn,Optionalfromtyping_extensionsimportLiteral__all__=['NoPayload']
[docs]classNoPayload(Protocol[Data_NoPayload,Schema_NoPayload],schema=Schema_NoPayload,data=Data_NoPayload):"""This class implements no-payload protocol."""########################################################################### Properties.########################################################################### name of current protocol@propertydefname(self)->'Literal["Null"]':"""Name of current protocol."""return'Null'# header length of current protocol@propertydeflength(self)->'Literal[0]':"""Header length of current protocol."""return0# name of next layer protocol@propertydefprotocol(self)->'NoReturn':"""Name of next layer protocol. Raises: UnsupportedCall: This protocol doesn't support :attr:`protocol`. """raiseUnsupportedCall(f"'{self.__class__.__name__}' object has no attribute 'protocol'")########################################################################### Methods.##########################################################################
########################################################################### Data models.##########################################################################@overloaddef__post_init__(self,file:'IO[bytes] | bytes',length:'Optional[int]'=...,**kwargs:'Any')->'None':...@overloaddef__post_init__(self,**kwargs:'Any')->'None':...# pylint: disable=arguments-differ
[docs]def__post_init__(self,file:'Optional[IO[bytes] | bytes]'=None,# pylint: disable=unused-argumentlength:'Optional[int]'=None,**kwargs:'Any')->'None':"""Post initialisation hook. Args: file: Source packet stream. length: Length of packet data. **kwargs: Arbitrary keyword arguments. """#: bytes: Raw packet data.self._data=b''#: io.BytesIO: Source data stream.self._file=io.BytesIO()#: pcapkit.protocols.data.misc.null.NoPayload: Info dict of current instance.self._info=Data_NoPayload()#: pcapkit.protocols.null.NoPayload: Payload of current instance.self._next=self#: pcapkit.corekit.protochain.ProtoChain: Protocol chain of current instance.self._protos=None# type: ignore[assignment]
[docs]@classmethoddef__index__(cls)->'NoReturn':"""Numeral registry index of the protocol. Raises: UnsupportedCall: This protocol has no registry entry. """raiseUnsupportedCall(f'{cls.__name__!r} object cannot be interpreted as an integer')