polyswarmclient.bloom

Module Contents

polyswarmclient.bloom.FILTER_BITS[source]
polyswarmclient.bloom.HASH_FUNCS = 8[source]
polyswarmclient.bloom.logger[source]
polyswarmclient.bloom.w3[source]
polyswarmclient.bloom.get_chunks_for_bloom(value_hash)[source]
Bloom filter helper function. Turn a value hash into
a series of chunks.
Parameters

value_hash (bytes) – Hash of to be encoded into the Bloom filter.

Yields

chunk (bytes) – Chunks of the value hash.

polyswarmclient.bloom.chunk_to_bloom_bits(chunk)[source]
Bloom filter helper function. Turn a chunk into a series of
actual bytes.
Parameters

chunk (bytes) – Byte encoded chunk.

polyswarmclient.bloom.get_bloom_bits(value)[source]
Bloom filter helper function. Get the Bloom bits of a
given value.
Parameters

value (bytes) – Value to be encoded into the Bloom filter.

class polyswarmclient.bloom.BloomFilter(value=0)[source]

Bases: numbers.Number

value[source]
__int__(self)[source]
add(self, value)[source]

Add a single byte value to the Bloom filter.

Parameters

value (bytes) – Byte encoded value to add to Bloom filter.

extend(self, iterable)[source]

Add an iterable of byte values to the bloom filter.

Parameters

iterable (Iterable[bytes]) – Iterable of byte values.

classmethod from_iterable(cls, iterable)[source]

Instantiate a bloom filter from a given iterable.

Parameters

iterable (Iterable[bytes]) – Iterable of byte values.

Returns

Instantiated BloomFilter.

Return type

BloomFilter

__contains__(self, value)[source]
__index__(self)[source]
_combine(self, other)[source]
__or__(self, other)[source]
__add__(self, other)[source]
_icombine(self, other)[source]
__ior__(self, other)[source]
__iadd__(self, other)[source]