Info Class

pcapkit.corekit.infoclass contains dict like class Info only, which is originally designed to work alike dataclasses.dataclass() as introduced in PEP 557.

class pcapkit.corekit.infoclass.Info(dict_=None, **kwargs)[source]

Bases: collections.abc.Mapping

Turn dictionaries into object like instances.

Notes

  • Info objects inherit from dict type

  • Info objects are iterable, and support all functions as dict

  • Info objects are one-time-modeling, thus cannot set or delete attributes after initialisation

static __new__(cls, dict_=None, **kwargs)[source]

Create a new instance.

Parameters

dict (Dict[str, Any]) – Source dict data.

Keyword Arguments

**kwargs – Arbitrary keyword arguments.

Notes

Keys with the same names as the builtin methods will be renamed with 2 suffix implicitly and internally.

info2dict()[source]

Convert Info into dict.

Returns

Converted dict.

Return type

Dict[str, Any]