diff --git a/docs/source/ext.rst b/docs/source/ext.rst index b7bd0ffba4..817964ce48 100644 --- a/docs/source/ext.rst +++ b/docs/source/ext.rst @@ -241,14 +241,14 @@ The following code snippet shows how to create a new protocol class: silently wrong field. The accepted set is read from :func:`inspect.signature` -- the union of every keyword-taking parameter of ``make``, ``read``, ``pack``, ``unpack``, ``__post_init__`` and ``__init__`` anywhere in the class's MRO -- which is - wider than ``make`` alone because :meth:`ProtocolBase.__post_init__ - ` hands the same + wider than ``make`` alone because :meth:`Protocol.__post_init__ + ` hands the same ``**kwargs`` to the construction and to the parse, so a keyword only ``read`` declares still travels through ``make``. Shapes a signature cannot express are declared on the class instead, via - :attr:`ProtocolBase.__keywords__ - `: + :attr:`Protocol.__keywords__ + `: .. code-block:: python @@ -271,8 +271,8 @@ The following code snippet shows how to create a new protocol class: subclass of a dispatcher is checked normally. Prefer a declared parameter to either: it is also what documents the keyword to your callers. - Parsing is unaffected. :meth:`ProtocolBase.from_data - ` checks the keywords its + Parsing is unaffected. :meth:`Protocol.from_data + ` checks the keywords its caller passes just as strictly, raising :exc:`~pcapkit.utilities.exceptions.UnsupportedCall`, but only warns with :exc:`~pcapkit.utilities.warnings.UnknownFieldWarning` for a key that comes @@ -281,8 +281,8 @@ The following code snippet shows how to create a new protocol class: .. warning:: - The check lives in :meth:`ProtocolBase.__init__ - `, where every producer's + The check lives in :meth:`Protocol.__init__ + `, where every producer's keywords converge, so it covers ``SomeProtocol(...)`` and the ``pack`` it leads to -- but **not** a direct ``SomeProtocol.make(...)`` call, which still discards an undeclared keyword in silence. ``object.__new__(cls).make(...)`` diff --git a/docs/source/pcapkit/protocols/internet/ipv6_ext.rst b/docs/source/pcapkit/protocols/internet/ipv6_ext.rst index 72775bc357..9d8cf30bfa 100644 --- a/docs/source/pcapkit/protocols/internet/ipv6_ext.rst +++ b/docs/source/pcapkit/protocols/internet/ipv6_ext.rst @@ -141,7 +141,7 @@ This class is reached in these ways: ``IPv6-Route``, ``IPv6-Opts``, ``MH``, ``HIP``, ``IPv6-Frag`` and ``AH`` all have dedicated classes. When one of *those* raises, :func:`~pcapkit.corekit.decorators.beholder` - (:meth:`ProtocolBase._import_next_layer `) + (:meth:`Protocol._import_next_layer `) would substitute plain :class:`~pcapkit.protocols.misc.raw.Raw`, which loses ``next`` and crashes the walk as in path 1. :meth:`IPv6._import_next_layer ` catches diff --git a/docs/source/pcapkit/utilities/chardet.rst b/docs/source/pcapkit/utilities/chardet.rst index 1514e6653b..7983a9f2b4 100644 --- a/docs/source/pcapkit/utilities/chardet.rst +++ b/docs/source/pcapkit/utilities/chardet.rst @@ -7,7 +7,7 @@ Character Set Detection turning the bytes of a text field into a :obj:`str`. It is shared by :meth:`StringField.post_process ` and -:meth:`ProtocolBase.decode `, +:meth:`Protocol.decode `, which is why it lives here rather than beside either of them. .. autofunction:: pcapkit.utilities.chardet.detect diff --git a/pcapkit/corekit/decorators.py b/pcapkit/corekit/decorators.py index 633e86aae6..f0093ae40b 100644 --- a/pcapkit/corekit/decorators.py +++ b/pcapkit/corekit/decorators.py @@ -56,8 +56,8 @@ #: contextvars.ContextVar[bool]: Whether a call :func:`beholder` wraps is under #: way, so that an :exc:`Exception` raised inside it ends with the layer that -#: raised replaced; see :meth:`ProtocolBase._parse_next_layer -#: ` (:issue:`2308`). +#: raised replaced; see :meth:`Protocol._parse_next_layer +#: ` (:issue:`2308`). _beholding = contextvars.ContextVar('_beholding', default=False) @@ -116,8 +116,8 @@ def beholder( :class:`~pcapkit.protocols.misc.null.NoPayload`, if the error is an end-of-file :exc:`~pcapkit.utilities.exceptions.StructError`. - When :meth:`ProtocolBase._parse_next_layer - ` held the + When :meth:`Protocol._parse_next_layer + ` held the warnings of the layer that raised, they are dropped with it: they describe a layer the result does not have, and the replacement's ``error`` reports the failure (:issue:`2308`). diff --git a/pcapkit/corekit/fields/numbers.py b/pcapkit/corekit/fields/numbers.py index 81dee09dd7..5001257f9a 100644 --- a/pcapkit/corekit/fields/numbers.py +++ b/pcapkit/corekit/fields/numbers.py @@ -730,8 +730,8 @@ def post_process(self, value: 'int | bytes', packet: 'dict[str, Any]') -> 'Stdli the registry with ``aenum.extend_enum``, for two reasons: a capture carrying many distinct unassigned codes would otherwise grow a process-global registry without bound, which is the growth - :meth:`ProtocolBase._lookup_registry - ` exists + :meth:`Protocol._lookup_registry + ` exists to avoid; and a stdlib :class:`enum.IntEnum` registry is then handled exactly like an ``aenum.IntEnum`` one. diff --git a/pcapkit/corekit/module.py b/pcapkit/corekit/module.py index e5ce8c9583..65e276c33e 100644 --- a/pcapkit/corekit/module.py +++ b/pcapkit/corekit/module.py @@ -60,8 +60,8 @@ def klass(self) -> 'Type[_T]': The module is read from :data:`sys.modules` first, and :func:`importlib.import_module` is entered only when it is not loaded yet. That matters because this property is on a *per-frame* - dispatch path: :meth:`ProtocolBase._lookup_next_layer - ` + dispatch path: :meth:`Protocol._lookup_next_layer + ` deliberately writes no resolved class back, so every next layer lookup resolves its descriptor again -- the one registered for the code, or the fallback for :class:`~pcapkit.protocols.misc.raw.Raw` diff --git a/pcapkit/corekit/sentinels.py b/pcapkit/corekit/sentinels.py index 80e12f6dc8..19f87a9690 100644 --- a/pcapkit/corekit/sentinels.py +++ b/pcapkit/corekit/sentinels.py @@ -571,8 +571,8 @@ def __bool__(self) -> 'Literal[False]': #: own ``__keywords__`` out of its :attr:`~object.__dict__`, where #: :obj:`None` is itself a meaningful value -- the opt-out that says the #: class cannot enumerate its keywords, cf. -#: :attr:`ProtocolBase.__keywords__ -#: `. Never leaves +#: :attr:`Protocol.__keywords__ +#: `. Never leaves #: :mod:`pcapkit.protocols.protocol`, which imports it from here for exactly #: that one read. Private by documentation rather than by a #: leading underscore -- see :class:`AbsentType`'s own docstring. diff --git a/pcapkit/foundation/engines/dpkt.py b/pcapkit/foundation/engines/dpkt.py index a95e04ae02..577b8fb7c3 100644 --- a/pcapkit/foundation/engines/dpkt.py +++ b/pcapkit/foundation/engines/dpkt.py @@ -551,8 +551,8 @@ def read_frame(self) -> 'DPKTPacket': try: packet = protocol(pkt) # type: DPKTPacket except Exception as exc: # pylint: disable=broad-except - # NOTE: Caught broadly, as :meth:`ProtocolBase.analyze - # ` does: dpkt raises + # NOTE: Caught broadly, as :meth:`Protocol.analyze + # ` does: dpkt raises # more than its own ``UnpackError`` while parsing -- dpkt 1.9.8 reads # ``frag_off`` from whatever header follows an IPv6 Fragment header, # so a Fragment header followed by ESP or Destination Options raises diff --git a/pcapkit/protocols/application/application.py b/pcapkit/protocols/application/application.py index f33d1050de..22475bde88 100644 --- a/pcapkit/protocols/application/application.py +++ b/pcapkit/protocols/application/application.py @@ -121,8 +121,8 @@ def from_data(cls, data: '_PT | dict[str, Any]', **kwargs: 'Any') -> 'Self': Args: data: Protocol data. - **kwargs: Construction keywords, as for :meth:`ProtocolBase.from_data - `. + **kwargs: Construction keywords, as for :meth:`Protocol.from_data + `. Returns: Protocol instance, cut back to what was captured when the header diff --git a/pcapkit/protocols/application/http.py b/pcapkit/protocols/application/http.py index d7942cff48..562bb69656 100644 --- a/pcapkit/protocols/application/http.py +++ b/pcapkit/protocols/application/http.py @@ -404,8 +404,8 @@ def from_data(cls, data: '_PT | dict[str, Any]', **kwargs: 'Any') -> 'Self': into the versioned data model its keys belong to -- ``receipt`` is HTTP/1.*'s and ``sid`` HTTP/2's -- since this class's own data model carries no version. - **kwargs: As :meth:`ProtocolBase.from_data - `. + **kwargs: As :meth:`Protocol.from_data + `. Returns: Protocol instance. diff --git a/pcapkit/protocols/application/httpv2.py b/pcapkit/protocols/application/httpv2.py index 1b1b0b667a..b22bc0a192 100644 --- a/pcapkit/protocols/application/httpv2.py +++ b/pcapkit/protocols/application/httpv2.py @@ -234,8 +234,8 @@ def unpack(self, length: 'Optional[int]' = None, **kwargs: 'Any') -> 'Data_HTTP' ``length`` is resolved against :func:`len` only for *this* method's own check, and the *original* argument -- ``None`` - included -- is what is forwarded to :meth:`ProtocolBase.unpack - `. Collapsing + included -- is what is forwarded to :meth:`Protocol.unpack + `. Collapsing ``None`` to a concrete ``0`` would change what :meth:`Schema.unpack `'s own ``prepare`` decorator does with an @@ -251,7 +251,7 @@ def unpack(self, length: 'Optional[int]' = None, **kwargs: 'Any') -> 'Data_HTTP' if length is None: # ``0 < ... < 9`` rather than ``... < 9``: an exhausted stream # (``len(self) == 0``) is left alone, so ``length`` reaches - # :meth:`ProtocolBase.unpack ` + # :meth:`Protocol.unpack ` # still ``None`` and its ``prepare`` decorator raises # :exc:`StreamEOFError` as documented above; only a *non-empty* # short stream is rejected as malformed here. diff --git a/pcapkit/protocols/internet/ah.py b/pcapkit/protocols/internet/ah.py index 873f102c65..c4ca82ebdc 100644 --- a/pcapkit/protocols/internet/ah.py +++ b/pcapkit/protocols/internet/ah.py @@ -86,7 +86,7 @@ def alias(self) -> 'Literal["AH"]': """Acronym of corresponding protocol. Spelled out rather than left to - :attr:`ProtocolBase.alias `'s + :attr:`Protocol.alias `'s class-name default, because :class:`~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext` sits between this class and that default in the MRO and carries its own diff --git a/pcapkit/protocols/internet/esp.py b/pcapkit/protocols/internet/esp.py index e7eb6a2637..22e23ebddb 100644 --- a/pcapkit/protocols/internet/esp.py +++ b/pcapkit/protocols/internet/esp.py @@ -1022,7 +1022,7 @@ def alias(self) -> 'Literal["ESP"]': """Acronym of corresponding protocol. Spelled out rather than left to - :attr:`ProtocolBase.alias `'s + :attr:`Protocol.alias `'s class-name default, because :class:`~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext` sits between this class and that default in the MRO and carries a concrete diff --git a/pcapkit/protocols/internet/hopopt.py b/pcapkit/protocols/internet/hopopt.py index 6681df50c6..78da396c2a 100644 --- a/pcapkit/protocols/internet/hopopt.py +++ b/pcapkit/protocols/internet/hopopt.py @@ -249,7 +249,7 @@ def alias(self) -> 'Literal["HOPOPT"]': """Acronym of corresponding protocol. Spelled out rather than left to - :attr:`ProtocolBase.alias `'s + :attr:`Protocol.alias `'s class-name default, because :class:`~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext` sits between this class and that default in the MRO and carries its own diff --git a/pcapkit/protocols/internet/internet.py b/pcapkit/protocols/internet/internet.py index a64b5c769e..6d9e66ef15 100644 --- a/pcapkit/protocols/internet/internet.py +++ b/pcapkit/protocols/internet/internet.py @@ -192,8 +192,8 @@ def register(cls, code: 'Enum_TransType', protocol: 'ModuleDescriptor[ProtocolBa pcapkit.utilities.warnings.RegistryWarning: If this protocol number is already registered, naming the displaced entry and its replacement so a caller can tell *what* was lost. Fires only - when the incumbent differs from the replacement; see :meth:`ProtocolBase.register - ` for the + when the incumbent differs from the replacement; see :meth:`Protocol.register + ` for the guard this shares with ``register_protocol``, and for the shipped descriptor a restore puts back (:issue:`1504`). @@ -220,8 +220,8 @@ def from_data(cls, data: '_PT | dict[str, Any]', **kwargs: 'Any') -> 'Self': Args: data: Protocol data. - **kwargs: Construction keywords, as for :meth:`ProtocolBase.from_data - `. + **kwargs: Construction keywords, as for :meth:`Protocol.from_data + `. Returns: Protocol instance, cut back to what was captured when the header @@ -343,8 +343,8 @@ def _rebuilt_exthdr_depth(cls) -> 'int': def _make_payload(cls, data: 'Data') -> 'ProtocolBase': """Create payload from ``data`` for protocol construction. - As :meth:`ProtocolBase._make_payload - `, but the payload + As :meth:`Protocol._make_payload + `, but the payload is built at its place in its chain of IPv6 extension headers, one past this layer's, since it parses its own octets again. So rebuilding a frame stops at :data:`~pcapkit.utilities.config.EXTENSION_HEADER_LIMIT` where parsing it did, rather diff --git a/pcapkit/protocols/internet/ipv6_ext.py b/pcapkit/protocols/internet/ipv6_ext.py index 3c36e311c1..ee1ddc391a 100644 --- a/pcapkit/protocols/internet/ipv6_ext.py +++ b/pcapkit/protocols/internet/ipv6_ext.py @@ -108,7 +108,7 @@ class for that code instead (see the bottom of the module), so dispatch ``IPv6-Route``, ``IPv6-Opts``, ``MH``, ``HIP``, ``IPv6-Frag`` and ``AH`` all have dedicated classes. When one of *those* raises, :func:`~pcapkit.corekit.decorators.beholder` - (:meth:`ProtocolBase._import_next_layer `) + (:meth:`Protocol._import_next_layer `) would substitute plain :class:`~pcapkit.protocols.misc.raw.Raw`, which loses ``next`` and crashes the walk as in path 1. :meth:`IPv6._import_next_layer ` @@ -299,7 +299,7 @@ def protocol(self) -> 'Optional[Enum_ExtensionHeader] | Optional[str]': In the *fallback* role (this instance parsed this module's own schema) this is **not** the base - :attr:`ProtocolBase.protocol ` + :attr:`Protocol.protocol ` meaning ("name of next layer protocol"). On the owner's ruling for GitHub issue :issue:`891` it is deliberately repointed at this instance's *own* identity, i.e. which header's format it parsed, such as @@ -327,7 +327,7 @@ class sits between them and :attr:`~pcapkit.protocols.protocol.Protocol.__data__` rather than an :func:`isinstance` test on ``self._info``, because a ``make``-only instance has no ``_info`` at all. Reading it would turn - :attr:`ProtocolBase.protocol `, + :attr:`Protocol.protocol `, which only needs ``self._protos``, into an ``AttributeError``; ``tests/protocols/internet/test_ipv6_extension_unit.py`` constructs exactly that instance. diff --git a/pcapkit/protocols/internet/mh.py b/pcapkit/protocols/internet/mh.py index b4b3fb8d32..f28046f4f4 100644 --- a/pcapkit/protocols/internet/mh.py +++ b/pcapkit/protocols/internet/mh.py @@ -1290,7 +1290,7 @@ def alias(self) -> 'Literal["MH"]': """Acronym of corresponding protocol. Spelled out rather than left to - :attr:`ProtocolBase.alias `'s + :attr:`Protocol.alias `'s class-name default, because :class:`~pcapkit.protocols.internet.ipv6_ext.IPv6_Ext` sits between this class and that default in the MRO and carries a concrete diff --git a/pcapkit/protocols/link/link.py b/pcapkit/protocols/link/link.py index 3b6a580571..3f08c70544 100644 --- a/pcapkit/protocols/link/link.py +++ b/pcapkit/protocols/link/link.py @@ -149,8 +149,8 @@ def register(cls, code: 'Enum_EtherType', protocol: 'ModuleDescriptor[ProtocolBa already registered, naming the displaced entry and its replacement so a caller can tell *what* was lost. Fires only when the incumbent differs from the replacement -- see - :meth:`ProtocolBase.register - ` for the + :meth:`Protocol.register + ` for the guard this shares with ``register_protocol``, and for the shipped descriptor that a restore puts back (:issue:`1504`). @@ -177,7 +177,7 @@ def from_data(cls, data: '_PT | dict[str, Any]', **kwargs: 'Any') -> 'Self': Args: data: Protocol data. - **kwargs: Construction keywords, as for :meth:`ProtocolBase.from_data + **kwargs: Construction keywords, as for :meth:`Protocol.from_data `. Returns: diff --git a/pcapkit/protocols/misc/null.py b/pcapkit/protocols/misc/null.py index ef093cc18d..63246f00d6 100644 --- a/pcapkit/protocols/misc/null.py +++ b/pcapkit/protocols/misc/null.py @@ -72,8 +72,8 @@ def protochain(self) -> 'None': # type: ignore[override] .. versionchanged:: 1.5.0 - Narrows :attr:`ProtocolBase.protochain - `'s declared + Narrows :attr:`Protocol.protochain + `'s declared type from :class:`~pcapkit.corekit.protochain.ProtoChain` to :obj:`None`, the value ``self._protos`` already held here; the fix is to the declaration, not the runtime value (:issue:`2317`). diff --git a/pcapkit/protocols/misc/pcap/frame.py b/pcapkit/protocols/misc/pcap/frame.py index b8e52b8e10..3f429dd082 100644 --- a/pcapkit/protocols/misc/pcap/frame.py +++ b/pcapkit/protocols/misc/pcap/frame.py @@ -172,8 +172,8 @@ def register(cls, code: 'Enum_LinkType', protocol: 'ModuleDescriptor[ProtocolBas already registered against PCAP frames, naming the displaced entry and its replacement so a caller can tell *what* was lost. Fires only when the incumbent differs from the replacement -- - see :meth:`ProtocolBase.register - ` for the + see :meth:`Protocol.register + ` for the guard this shares with ``register_protocol``, and for the shipped descriptor a restore puts back (:issue:`1504`). diff --git a/pcapkit/protocols/misc/pcap/header.py b/pcapkit/protocols/misc/pcap/header.py index 00b33d4556..f8cba67577 100644 --- a/pcapkit/protocols/misc/pcap/header.py +++ b/pcapkit/protocols/misc/pcap/header.py @@ -287,8 +287,8 @@ def from_data(cls, data: 'Data_Header | dict[str, Any]', **kwargs: 'Any') -> 'Se Args: data: Protocol data. - **kwargs: Construction keywords, as for :meth:`ProtocolBase.from_data - `. + **kwargs: Construction keywords, as for :meth:`Protocol.from_data + `. Returns: Protocol instance, cut back to what was captured when the header diff --git a/pcapkit/protocols/misc/pcapng.py b/pcapkit/protocols/misc/pcapng.py index 634c558e3b..282f5d09cf 100644 --- a/pcapkit/protocols/misc/pcapng.py +++ b/pcapkit/protocols/misc/pcapng.py @@ -908,7 +908,7 @@ def length(self) -> 'int': length field included -- and not a header length. The two are the same thing for a protocol whose payload runs to the end of its buffer, which is why - :attr:`ProtocolBase.length ` + :attr:`Protocol.length ` does not distinguish them, but a PCAP-NG block carries a trailer. :attr:`self.packet ` is overridden accordingly. @@ -938,7 +938,7 @@ def packet(self) -> 'Data_Packet': octets sit in the *middle* of a packet block, ahead of the option list and the trailing Block Total Length, so no single split point expresses the shape and the inherited - :attr:`ProtocolBase.packet ` + :attr:`Protocol.packet ` -- which reads :attr:`self.length ` octets of header and takes everything after as payload -- cannot produce it. Since :attr:`self.length ` is the Block Total Length, that split would @@ -1110,8 +1110,8 @@ class it names; handing back the stored entry, or a descriptor equal to it, is a silent no-op that keeps it. This registry is separate from the PCAP one, so :func:`~pcapkit.foundation.registry.protocols.register_linktype` writing to both cannot make either warn about the other. See - :meth:`ProtocolBase.register - ` for the + :meth:`Protocol.register + ` for the shipped descriptor a restore puts back (:issue:`1504`). """ diff --git a/pcapkit/protocols/protocol.py b/pcapkit/protocols/protocol.py index e17bc274a7..915eda4e86 100644 --- a/pcapkit/protocols/protocol.py +++ b/pcapkit/protocols/protocol.py @@ -426,13 +426,16 @@ def _check_construction_keywords(cls: 'type', kwargs: 'dict[str, Any]', #: contextvars.ContextVar[int]: How many layers of the frame being dissected -#: come before the next one :meth:`ProtocolBase._parse_next_layer` parses; see +#: come before the next one :meth:`Protocol._parse_next_layer +#: ` parses; see #: :data:`~pcapkit.utilities.config.FRAME_LAYER_LIMIT`. _frame_depth = contextvars.ContextVar('_frame_depth', default=0) #: contextvars.ContextVar[bool]: Whether a payload is being rebuilt by -#: :meth:`ProtocolBase._make_payload`, so that the layer it is rebuilt for -#: parses the same octets again; see :data:`~pcapkit.utilities.config.FRAME_LAYER_LIMIT`. +#: :meth:`Protocol._make_payload +#: `, so that the layer +#: it is rebuilt for parses the same octets again; see +#: :data:`~pcapkit.utilities.config.FRAME_LAYER_LIMIT`. _rebuilding = contextvars.ContextVar('_rebuilding', default=False) @@ -446,7 +449,9 @@ def _short_of_hint(klass: 'Type[ProtocolBase]', captured: 'int') -> 'bool': Returns: Whether a next layer of ``klass`` parsed from ``captured`` octets may be replaced with :class:`~pcapkit.protocols.misc.raw.Raw` by - :meth:`ProtocolBase._parse_next_layer`, and so has its warnings held. + :meth:`Protocol._parse_next_layer + `, and so has + its warnings held. The hint is read from the class, before there is an instance to ask, which is enough for every protocol shipped: each returns a constant. A hint that diff --git a/pcapkit/protocols/schema/link/ethernet.py b/pcapkit/protocols/schema/link/ethernet.py index 02221eeaf6..a99871c8f7 100644 --- a/pcapkit/protocols/schema/link/ethernet.py +++ b/pcapkit/protocols/schema/link/ethernet.py @@ -29,7 +29,7 @@ def callback_payload(self: 'PayloadField', packet: 'dict[str, Any]') -> 'None': :obj:`None`; the resolved class is assigned to ``self.protocol``. Important: - The lookup goes through :meth:`ProtocolBase._lookup_next_layer + The lookup goes through :meth:`Protocol._lookup_next_layer ` rather than subscripting the registry. :attr:`Ethernet.__proto__ ` *is* diff --git a/pcapkit/protocols/schema/schema.py b/pcapkit/protocols/schema/schema.py index 0bbf3e1045..6d79c11507 100644 --- a/pcapkit/protocols/schema/schema.py +++ b/pcapkit/protocols/schema/schema.py @@ -1231,7 +1231,7 @@ class _EnumRegistry(collections.defaultdict): The fallback itself is deliberate -- it is how an unknown option, chunk or block falls back to its ``Unknown*``/``Unassigned*`` schema -- so this subclass keeps returning it and just stops recording it. - :meth:`ProtocolBase._lookup_registry + :meth:`Protocol._lookup_registry ` does the same for the protocol-layer ``__proto__`` family. diff --git a/pcapkit/protocols/transport/sctp.py b/pcapkit/protocols/transport/sctp.py index 041411cfd1..53362c4069 100644 --- a/pcapkit/protocols/transport/sctp.py +++ b/pcapkit/protocols/transport/sctp.py @@ -999,9 +999,9 @@ def _decode_next_layer(self, dict_: 'Data_SCTP', proto: 'Optional[int]' = None, ` does for an unregistered transport type. Resolving it to :class:`~pcapkit.protocols.misc.raw.Raw` is - :meth:`ProtocolBase._import_next_layer + :meth:`Protocol._import_next_layer `'s job, - through :meth:`ProtocolBase._lookup_next_layer + through :meth:`Protocol._lookup_next_layer `, which leaves :attr:`self.__proto__ ` untouched. diff --git a/pcapkit/protocols/transport/transport.py b/pcapkit/protocols/transport/transport.py index efb96647e1..baea808d50 100644 --- a/pcapkit/protocols/transport/transport.py +++ b/pcapkit/protocols/transport/transport.py @@ -98,8 +98,8 @@ def register(cls, code: 'int', protocol: 'ModuleDescriptor[ProtocolBase] | Type[ message names both. An unresolved :class:`~pcapkit.corekit.module.ModuleDescriptor` counts as different from the class it names. See - :meth:`ProtocolBase.register - ` for the + :meth:`Protocol.register + ` for the guard this shares with ``register_protocol``, and for the shipped descriptor that a restore puts back (:issue:`1504`). @@ -170,7 +170,7 @@ def from_data(cls, data: '_PT | dict[str, Any]', **kwargs: 'Any') -> 'Self': Args: data: Protocol data. - **kwargs: Construction keywords, as for :meth:`ProtocolBase.from_data + **kwargs: Construction keywords, as for :meth:`Protocol.from_data `. Returns: @@ -261,7 +261,7 @@ def _decode_next_layer(self, dict_: '_PT', ports: 'tuple[int, int]', length: 'Op Important: The port is forwarded **whether or not it is registered**: - :meth:`ProtocolBase._import_next_layer + :meth:`Protocol._import_next_layer ` passes it on as ``alias`` and :class:`~pcapkit.protocols.misc.raw.Raw` records it as :attr:`Data_Raw.protocol diff --git a/pcapkit/utilities/chardet.py b/pcapkit/utilities/chardet.py index d3685836f2..793b891a6f 100644 --- a/pcapkit/utilities/chardet.py +++ b/pcapkit/utilities/chardet.py @@ -37,7 +37,7 @@ def detect(value: 'bytes') -> 'str': equality on a hash collision. Measured, feeding 20 distinct 1 MB values retains 19.1 MB. :data:`~pcapkit.utilities.config.DETECT_CACHE_SIZE` therefore caps the entries rather than the footprint, which matters because - :meth:`ProtocolBase.decode + :meth:`Protocol.decode ` is public and a caller may hand it a whole payload. Use :meth:`detect.cache_clear ` to release it in a long-running diff --git a/pcapkit/utilities/warnings.py b/pcapkit/utilities/warnings.py index cce34c1cc8..9a851733d5 100644 --- a/pcapkit/utilities/warnings.py +++ b/pcapkit/utilities/warnings.py @@ -252,8 +252,8 @@ class hold_warnings: # pylint: disable=invalid-name error is then raised where the block that kept them is left -- the end of the trial parse, inside the guard it was raised in when nothing was held. - :meth:`ProtocolBase._parse_next_layer - ` uses this for the + :meth:`Protocol._parse_next_layer + ` uses this for the trial parse it replaces with :class:`~pcapkit.protocols.misc.raw.Raw` when the header was not captured, or that :func:`~pcapkit.corekit.decorators.beholder` replaces when it raises: the warnings describe a layer the result does not