congress.datalog.builtin module

class congress.datalog.builtin.CongressBuiltinCategoryMap(start_builtin_map)

Bases: object

add_map(newmap)
builtin(table)

Return a CongressBuiltinPred for given Tablename or None.

builtin_is_registered(predtotest)

Given a CongressBuiltinPred, check if it has been registered.

delete_all_in_category(category)
delete_builtin(category, name, inputs)
delete_category(category)
delete_from_category(category, pred)
delete_map(newmap)
dict_predtriple_to_pred(predtriple)
exists_category(category)
get_category_name(predname, predinputs)
insert_category(category)
insert_to_category(category, pred)
is_builtin(table, arity=None)

Given a Tablename and arity, check if it is a builtin.

list_available_builtins()

Print out the list of builtins, by category.

mapequal(othercbc)
sync_with_predlist(predname, pred, category, operation)
class congress.datalog.builtin.CongressBuiltinPred(name, arglist, num_inputs, code)

Bases: object

string_to_pred(predstring)
class congress.datalog.builtin.DatetimeBuiltins

Bases: object

classmethod datetime_equal(x, y)
classmethod datetime_greaterthan(x, y)
classmethod datetime_greaterthanequal(x, y)
classmethod datetime_lessthan(x, y)
classmethod datetime_lessthanequal(x, y)
classmethod datetime_minus(x, y)
classmethod datetime_plus(x, y)
classmethod datetime_to_seconds(x)
classmethod extract_date(x)
classmethod extract_time(x)
classmethod now()
classmethod pack_date(year, month, day)
classmethod pack_datetime(year, month, day, hour, minute, second)
classmethod pack_time(hour, minute, second)
classmethod to_datetime(x)
classmethod to_timedelta(x)
classmethod unpack_date(x)
classmethod unpack_datetime(x)
classmethod unpack_time(x)
class congress.datalog.builtin.NetworkAddressBuiltins

Bases: object

classmethod ip_in_network(ip, cidr)
classmethod ips_equal(ip1, ip2)
classmethod ips_greaterthan(ip1, ip2)
classmethod ips_greaterthan_equal(ip1, ip2)
classmethod ips_lessthan(ip1, ip2)
classmethod ips_lessthan_equal(ip1, ip2)
classmethod networks_equal(cidr1, cidr2)
classmethod networks_overlap(cidr1, cidr2)
class congress.datalog.builtin.OptTypeBuiltins

Bases: object

Builtins to validate option values for config validator.

It leverages oslog_config types module to check values.

classmethod validate_float(minv, maxv, value)

Check that the value is a float

Optionnally checks the float is between given bounds if provided. :param minv: minimal value or empty string :param maxv: maximal value or empty string :param value: value to check :return: an empty string if ok or an error string.

classmethod validate_int(minv, maxv, value)

Check that the value is indeed an integer

Optionnally checks the integer is between given bounds if provided. :param minv: minimal value or empty string :param maxv: maximal value or empty string :param value: value to check :return: an empty string if ok or an error string.

classmethod validate_string(regex, max_length, quotes, ignore_case, value)

Check that the value is a string

Optionnally checks the string against typical requirements. :param regex: a regular expression the value should follow or empty :param max_length: an integer bound on the size of the string or empty :param quotes: whether to include quotes or not :param ignore_case: whether to ignore case or not :param value: the value to check :return: an empty string if ok or an error string.