class documentation

class CompressionRegistry(object):

Constructor: CompressionRegistry()

View In Hierarchy

The CompressionRegistry manages the mapping of pyzim.compression.CompressionType -> pyzim.compression.BaseCompressionInterface.

It allows compression interfaces to dynamically register themselves to this class. Multiple interfaces can be registered for each compression type.

Class Method get Return a compression interface for the specified compression type.
Class Method has Check if a compression interface has been registered for the specfied compression type.
Class Method iter_for Iterate over each registered compression interface for the specified compression type.
Class Method register Register a new interface for the specified compression type.
Class Method unregister Unregister a interface for the specified compression type.
Method __init__ A fake constructor. Do not instantiate this class.
Class Variable _interfaces Undocumented
def get(cls, compression_type):

Return a compression interface for the specified compression type.

Parameters
compression_type:pyzim.compression.CompressionTypecompression type to get an interface for.
Returns
a subclass of pyzim.compression.BaseCompressionInterfacethe interface for that compression type
Raises
pyzim.exceptions.UnsupportedCompressionTypeif no compression interface know the specified compression type.
def has(cls, compression_type):

Check if a compression interface has been registered for the specfied compression type.

Parameters
compression_type:pyzim.compression.CompressionTypecompression type to check.
Returns
boolTrue if an interface has been registered for the specified compression type
def iter_for(cls, compression_type):

Iterate over each registered compression interface for the specified compression type.

Yields
a subclass of pyzim.compression.BaseCompressionInterfacethe registered compression interfaces for the specified compression type
def register(cls, compression_type, interface):

Register a new interface for the specified compression type.

Parameters
compression_type:pyzim.compression.CompressionTypecompression type to register the interface for.
interface:a subclass of pyzim.compression.BaseCompressionInterfacethe interface that should be registered.
def unregister(cls, compression_type, interface):

Unregister a interface for the specified compression type.

If compression_type is None, unregister for all interfaces. If interface is None, unregister all interfaces for the compression type.

Parameters
compression_type:pyzim.compression.CompressionType or Nonecompression type to unregister the interface from.
interface:a subclass of pyzim.compression.BaseCompressionInterface or Nonethe interface that should be unregistered.
def __init__(self):

A fake constructor. Do not instantiate this class.

Raises
RuntimeErroralways
_interfaces: dict =

Undocumented