Common Utilities

pcapkit.dumpkit.common is the collection of common utility functions for pcapkit.dumpkit implementation, which is generally the customised hooks for dictdumper.Dumper classes.

pcapkit.dumpkit.common.make_dumper(output)[source]

Create a customised Dumper object.

Parameters:

output (Type[Dumper]) – Output class to customise.

Return type:

Type[Dumper]

Returns:

Customised Dumper object.

class pcapkit.dumpkit.common.Dumper(fname, **kwargs)[source]

Bases: DumperBase

Base Dumper object.

This class is a customised Dumper for the pcapkit.dumpkit implementation, which is generally customised for automatic registration to the Extractor and TraceFlow output dumper registries.

classmethod __init_subclass__(fmt=None, ext=None, *args, **kwargs)[source]

Initialise subclass.

This method is used to register the subclass to the Extraction and TraceFlow output dumper registries.

Parameters:
  • fmt (Optional[str]) – Output format to register.

  • ext (Optional[str]) – Output file extension.

  • *args (Any) – Arbitrary positional arguments.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

None

If the fmt is not provided, we will try to get it from the kind property of the subclass. And if the ext is not provided, we will infer it from the fmt.

Internal Definitions

class pcapkit.dumpkit.common.DumperBase(fname, **kwargs)[source]

Bases: Dumper

Base Dumper object.

Note

This class is for internal use only. For customisation, please use Dumper instead.