Skip to content

Commit 5753d03

Browse files
authored
docs(corekit,const,vendor): seventh whole-repo pass over corekit, const and vendor (#1103) (#2264)
Full read of pcapkit/corekit, the vendor crawlers and templates, the hand-written const prose and their API pages. - corekit: FieldBase.unpack example, _nested_types target, EnumRegistry covers open enums only, parse_ip_address claim narrowed, NoDefaultType and parse_ip_address change-relative wording. - vendor: Method.get and _sanitize_identifier template text (mirrored into the generated const modules), TLSKeyLabel, AppType Record/svc, mh flag process Returns, L2TP process, ipx RFC sections by name, PCAP-NG Hash Algorithms anchor, ExtensionHeader/EtherType comments. - const: index page raise bands and source data, PCAP-NG anchor, VLAN class role, OSPF title underline.
1 parent 689d02e commit 5753d03

34 files changed

Lines changed: 94 additions & 96 deletions

‎docs/source/pcapkit/const/index.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Unrecognised Values
1414
Nearly every :term:`registry` below departs from :mod:`enum` in one deliberate way, and it
1515
is the behaviour to know about before using any of them: looking one up by a value
1616
it does not define does **not** raise. Its ``_missing_`` override returns a
17-
member-like object for a value inside the registry's valid range, named for the
18-
unassigned or reserved band it falls in. Only a value outside that range, or of the
19-
wrong type, raises :exc:`ValueError`.
17+
member-like object for a value that falls in one of the registry's unassigned or
18+
reserved bands, named for that band. Only a value no band covers, or of the wrong
19+
type, raises :exc:`ValueError`.
2020

2121
In almost every registry that object is **not** installed: the registry does not
2222
grow, and a second lookup of the same value returns an equal but distinct object.
@@ -38,15 +38,15 @@ Some behave otherwise, and :ref:`mint-criterion` gives the full split:
3838

3939
That is what makes the enumerations usable against live capture data, where a
4040
protocol number assigned after this release was generated is a routine
41-
occurrence rather than an error. It also means an enumeration member is not a
41+
occurrence rather than an error. It also means an enumeration is not a
4242
closed set: an unassigned value resolves to a member that is, apart from
4343
:class:`~pcapkit.const.mh.cga_type.CGAType`, absent from iteration and ``__members__``,
4444
and whether a repeat lookup returns the same object varies by registry, so compare such
4545
members by value, not identity.
4646

4747
The common form of the override is generated -- see :mod:`pcapkit.vendor.default`,
4848
whose template emits it -- while the valid range and the names of the unassigned
49-
bands are per-registry, taken from that registry's own IANA data. The individual
49+
bands are per-registry, taken from that registry's own source data. The individual
5050
overrides are therefore not documented per class.
5151

5252
.. seealso::

‎docs/source/pcapkit/const/pcapng.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ which is automatically generated from :class:`pcapkit.vendor.pcapng.tls_key_labe
150150

151151
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-standardized-block-type-cod
152152
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-options
153-
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block-flags
153+
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block-optio
154154
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block
155155
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-name-resolution-block
156156
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-decryption-secrets-block

‎docs/source/pcapkit/const/vlan.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enumerations include:
1010

1111
.. list-table::
1212

13-
* - :const:`VLAN_PriorityLevel <pcapkit.const.vlan.priority_level.PriorityLevel>`
13+
* - :class:`VLAN_PriorityLevel <pcapkit.const.vlan.priority_level.PriorityLevel>`
1414
- Priority Levels [*]_
1515

1616
Priority levels defined in IEEE 802.1p

‎docs/source/pcapkit/vendor/pcapng.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ which is automatically generating :class:`pcapkit.const.pcapng.tls_key_label.TLS
139139

140140
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-standardized-block-type-cod
141141
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-options
142-
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block-flags
142+
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block-optio
143143
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block
144144
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-name-resolution-block
145145
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-decryption-secrets-block

‎pcapkit/const/ftp/command.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class FEATCode(EnumRegistry, StrEnum):
3737
:meth:`~pcapkit.vendor.ftp.command.Command.process`) -- rather than
3838
minting the per-command ones at import time as an incidental side
3939
effect of building :class:`Command`'s own rows. GitHub issue :issue:`860`:
40-
that import-time mutation was the same defect shape :issue:`775` removed
41-
from :class:`~pcapkit.const.pcapng.filter_type.FilterType`. ``_missing_``
40+
that import-time mutation is the same defect shape :issue:`775` rules
41+
out on :class:`~pcapkit.const.pcapng.filter_type.FilterType`. ``_missing_``
4242
still unmints for a keyword that
4343
turns up on the wire but names none of these -- the extendability the
4444
owner conditionally asked to keep on GitHub issue :issue:`860`: unsure what a

‎pcapkit/const/http/method.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ def get(cls, key: 'str', default: 'Optional[str]' = None) -> 'Method':
226226
IANA methods whose member *name* differs from their *value* --
227227
``BASELINE_CONTROL`` / ``'BASELINE-CONTROL'`` and
228228
``VERSION_CONTROL`` / ``'VERSION-CONTROL'``, a hyphen being unusable
229-
in a Python identifier -- which :meth:`_missing_` (and so the
230-
constructor) also finds by value.
229+
in a Python identifier -- which the constructor also finds by
230+
value, before it falls back to :meth:`_missing_`.
231231
232232
It is a :class:`classmethod`, as the base is, because a
233233
zero-argument ``super()`` needs a first argument to bind

‎pcapkit/const/ospf/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# pylint: disable=unused-import
33
""":class:`~pcapkit.protocols.application.ospf.OSPF` Constant Enumerations
4-
======================================================================
4+
=======================================================================
55
66
.. module:: pcapkit.const.ospf
77

‎pcapkit/const/pcapng/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-standardized-block-type-cod
3232
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-options
33-
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block-flags
33+
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block-optio
3434
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-enhanced-packet-block
3535
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-name-resolution-block
3636
.. [*] https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng-03.html#name-decryption-secrets-block

‎pcapkit/const/reg/apptype/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
#: Registries imported on first use rather than with this package, as submodule
6161
#: name to class name -- GitHub issue :issue:`1538`. Generated from IANA's
62-
#: registry, the two hold about 49,700 lines of members, about 30% of
62+
#: registry, they hold about 49,700 lines of members, about 30% of
6363
#: ``import pcapkit`` when imported eagerly, while SCTP's and DCCP's cost a few
6464
#: milliseconds and stay eager.
6565
_LAZY = {'tcp': 'TCP', 'udp': 'UDP'}

‎pcapkit/const/reg/apptype/apptype.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,8 @@ def _sanitize_identifier(cls, name: 'str') -> 'str':
27342734
collapsed = '_'.join(stripped.split())
27352735
replaced = re.sub(r'\W', '_', collapsed)
27362736
identifier = '_'.join(filter(None, replaced.split('_')))
2737-
# NOTE: matches process()'s own keyword guard below -- a name that
2737+
# NOTE: matches the keyword guard AppType.process applies at generation
2738+
# time in pcapkit.vendor.reg.apptype.apptype -- a name that
27382739
# sanitises to a reserved word is not usable as an attribute as is,
27392740
# and a trailing underscore is the same fix the generator already
27402741
# applies to a statically declared member with the same problem.

0 commit comments

Comments
 (0)