ConfigField

class tfsnippet.utils.ConfigField(type, default=None, description=None, nullable=False, choices=None)

Bases: object

A config field.

Attributes Summary

choices Get the valid choices of the config value.
default_value Get the default config value.
description Get the config description.
nullable Whether or not None is a valid value?
type Get the value type.

Methods Summary

validate(value[, strict]) Validate the config value.

Attributes Documentation

choices

Get the valid choices of the config value.

default_value

Get the default config value.

description

Get the config description.

nullable

Whether or not None is a valid value?

type

Get the value type.

Methods Documentation

validate(value, strict=False)

Validate the config value.

Parameters:
  • value – The value to be validated.
  • strict (bool) – If True, disable type conversion. If False, the validator will try its best to convert the input value into desired type.
Returns:

The validated value.