IoticAgent.Core.Validation module

class IoticAgent.Core.Validation.Validation

Bases: object

static bool_check_convert(bname, barg)

Currently does no checking - passthrough for now in case people change their minds

static callable_check(func, arg_count=1, arg_value=None, allow_none=False)

Check whether func is callable, with the given number of positional arguments.

Returns:True if check succeeded, False otherwise.
static check_convert_string(obj, name=None, no_leading_trailing_whitespace=True, no_whitespace=False, no_newline=True, as_tag=False, min_len=1, max_len=0)

Ensures the provided object can be interpreted as a unicode string, optionally with additional restrictions imposed. By default this means a non-zero length string which does not begin or end in whitespace.

classmethod comment_check_convert(comment, allow_none=False)
classmethod datetime_check_convert(time, allow_none=False, require_utc=True, to_iso8601=True)
classmethod describe_scope_check_convert(type_)
classmethod description_check_convert(comment, allow_none=False)
static foc_check(foc)
static guid_check_convert(guid, allow_none=False)

Take a GUID in the form of hex string “32” or “8-4-4-4-12”.

Returns:badly formed hexadecimal UUID string
Return type:Hex string “32” or raises ValueError
classmethod label_check_convert(label, allow_none=False)
classmethod lang_check_convert(lang, allow_none=False, default=None)
classmethod lid_check_convert(lid)
static limit_offset_check(limit, offset)
static location_check(lat, lon)

For use by Core client wrappers

static metafmt_check_convert(fmt)
classmethod mime_check_convert(mime, allow_none=False)
static object_type_check_convert(otype)
classmethod pid_check_convert(lid)
classmethod proplist_check_convert(props, for_delete=False)

for_delete allows a completely empty list as well as no value for individual properties. This is for deletion of all properties or removal of all properties with a given predicate respectively.

classmethod search_check_convert(text, lang, location, unit, default_lang)
classmethod search_location_check(location)

Core.Client.request_search location parameter should be a dictionary that contains lat, lon and radius floats

classmethod search_scope_check_convert(type_)
classmethod search_type_check_convert(type_)
classmethod tags_check_convert(tags)

Accept one tag as string or multiple tags in list of strings.

Returns:List (with tags in unicode form) or raises ValueError
static uriref_check_convert(ref, name='uriref')

Performs minimal/sanity validation for RDF URI References.

classmethod value_type_check_convert(vtype)
classmethod value_unit_check_convert(unit)