OpenQuizz
Une application de gestion des contenus pédagogiques
ParamType Class Reference
Inheritance diagram for ParamType:
Collaboration diagram for ParamType:

Public Member Functions

def __call__ (self, value, param=None, ctx=None)
 
def get_metavar (self, param)
 
def get_missing_message (self, param)
 
def convert (self, value, param, ctx)
 
def split_envvar_value (self, rv)
 
def fail (self, message, param=None, ctx=None)
 

Static Public Attributes

bool is_composite = False
 
 name = None
 
 envvar_list_splitter = None
 

Detailed Description

Helper for converting values through types.  The following is
necessary for a valid type:

*   it needs a name
*   it needs to pass through None unchanged
*   it needs to convert from a string
*   it needs to convert its result type through unchanged
    (eg: needs to be idempotent)
*   it needs to be able to deal with param and context being `None`.
    This can be the case when the object is used with prompt
    inputs.

Member Function Documentation

◆ __call__()

def __call__ (   self,
  value,
  param = None,
  ctx = None 
)

◆ convert()

def convert (   self,
  value,
  param,
  ctx 
)
Converts the value.  This is not invoked for values that are
`None` (the missing value).

Reimplemented in SeparatedPathType, CertParamType, Tuple, Path, File, UUIDParameterType, BoolParamType, FloatRange, FloatParamType, IntRange, IntParamType, DateTime, Choice, StringParamType, UnprocessedParamType, and FuncParamType.

◆ fail()

def fail (   self,
  message,
  param = None,
  ctx = None 
)
Helper method to fail with an invalid value message.

◆ get_metavar()

def get_metavar (   self,
  param 
)
Returns the metavar default for this param if it provides one.

Reimplemented in DateTime, and Choice.

◆ get_missing_message()

def get_missing_message (   self,
  param 
)
Optionally might return extra information about a missing
parameter.

.. versionadded:: 2.0

Reimplemented in Choice.

◆ split_envvar_value()

def split_envvar_value (   self,
  rv 
)
Given a value from an environment variable this splits it up
into small chunks depending on the defined envvar list splitter.

If the splitter is set to `None`, which means that whitespace splits,
then leading and trailing whitespace is ignored.  Otherwise, leading
and trailing splitters usually lead to empty items being included.

Field Documentation

◆ envvar_list_splitter

envvar_list_splitter = None
static

◆ is_composite

bool is_composite = False
static

◆ name

name = None
static

The documentation for this class was generated from the following file: