pyzor.engines.common

Common library shared by different engines.

class pyzor.engines.common.DBHandle(single_threaded, multi_threaded, multi_processing, prefork)

Bases: tuple

multi_processing

Alias for field number 2

multi_threaded

Alias for field number 1

prefork

Alias for field number 3

single_threaded

Alias for field number 0

exception pyzor.engines.common.DatabaseError[source]

Bases: exceptions.Exception

class pyzor.engines.common.Record(r_count=0, wl_count=0, r_entered=None, r_updated=None, wl_entered=None, wl_updated=None)[source]

Bases: object

Prefix conventions used in this class: r = report (spam) wl = whitelist

r_increment()[source]
r_update()[source]
wl_increment()[source]
wl_update()[source]
class pyzor.engines.common.BaseEngine[source]

Bases: object

Base class for Pyzor engines.

absolute_source = True
classmethod get_prefork_connections(fn, mode, max_age=None)[source]

Yields an unlimited number of partial functions that return a new engine instance, suitable for using toghether with the Pre-Fork server.

handles_one_step = False
items()[source]

Return a list of (key, record).

iteritems()[source]

Iterate over pairs of (key, record).

report(keys)[source]

Report the corresponding key as spam, incrementing the report count.

Engines that implement don’t implement this method should have handles_one_step set to False.

whitelist(keys)[source]

Report the corresponding key as ham, incrementing the whitelist count.

Engines that implement don’t implement this method should have handles_one_step set to False.