woob.tools.value

class woob.tools.value.Value(*args, **kwargs)

Bases: object

Value.

Parameters
  • label (str) – human readable description of a value

  • required (bool) – if True, the backend can’t load if the key isn’t found in its configuration

  • default – an optional default value, used when the key is not in config. If there is no default value and the key is not found in configuration, the required parameter is implicitly set

  • masked (bool) – if True, the value is masked. It is useful for applications to know if this key is a password

  • regexp (str) – if specified, on load the specified value is checked against this regexp, and an error is raised if it doesn’t match

  • choices ((list,dict)) – if this parameter is set, the value must be in the list

  • aliases (dict) – mapping of old choices values that should be accepted but not presented

  • tiny (bool) – the value of choices can be entered by an user (as they are small)

  • transient (bool) – this value is not persistent (asked only if needed)

check_valid(v)

Check if the given value is valid.

Raises

ValueError

dump()

Dump value to be stored.

get()

Get the value.

static get_normalized_regexp(regexp)

Return normalized regexp adding missing anchors

load(domain, v, requests)

Load value.

Parameters
  • domain (str) – what is the domain of this value

  • v – value to load

  • requests (woob.core.requests.Requests) – list of woob requests

set(v)

Set a value.

show_value(v)
class woob.tools.value.ValueBackendPassword(*args, **kwargs)

Bases: woob.tools.value.Value

check_valid(passwd)

Check if the given value is valid.

Raises

ValueError

dump()

Dump value to be stored.

get()

Get the value.

load(domain, password, requests)

Load value.

Parameters
  • domain (str) – what is the domain of this value

  • v – value to load

  • requests (woob.core.requests.Requests) – list of woob requests

set(passwd)

Set a value.

class woob.tools.value.ValueBool(*args, **kwargs)

Bases: woob.tools.value.Value

check_valid(v)

Check if the given value is valid.

Raises

ValueError

get()

Get the value.

class woob.tools.value.ValueFloat(*args, **kwargs)

Bases: woob.tools.value.Value

check_valid(v)

Check if the given value is valid.

Raises

ValueError

get()

Get the value.

class woob.tools.value.ValueInt(*args, **kwargs)

Bases: woob.tools.value.Value

get()

Get the value.

class woob.tools.value.ValuesDict(*values)

Bases: collections.OrderedDict

Ordered dictionarry which can take values in constructor.

>>> ValuesDict(Value('a', label='Test'), ValueInt('b', label='Test2'))