Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
click.types.BoolParamType Class Reference
Inheritance diagram for click.types.BoolParamType:
Inheritance graph
[legend]
Collaboration diagram for click.types.BoolParamType:
Collaboration graph
[legend]

Public Member Functions

bool convert (self, t.Any value, Parameter|None param, Context|None ctx)
 
str __repr__ (self)
 
- Public Member Functions inherited from click.types.ParamType
dict[str, t.Any] to_info_dict (self)
 
t.Any __call__ (self, t.Any value, Parameter|None param=None, Context|None ctx=None)
 
str|None get_metavar (self, Parameter param, Context ctx)
 
str|None get_missing_message (self, Parameter param, Context|None ctx)
 
cabc.Sequence[str] split_envvar_value (self, str rv)
 
t.NoReturn fail (self, str message, Parameter|None param=None, Context|None ctx=None)
 
list[CompletionItemshell_complete (self, Context ctx, Parameter param, str incomplete)
 

Static Public Member Functions

bool|None str_to_bool (str|bool value)
 

Static Public Attributes

str name = "boolean"
 
dict bool_states
 
- Static Public Attributes inherited from click.types.ParamType
is_composite = False
 
arity = 1
 
str name
 
envvar_list_splitter = None
 

Additional Inherited Members

- Public Attributes inherited from click.types.ParamType
 envvar_list_splitter
 

Member Function Documentation

◆ convert()

bool click.types.BoolParamType.convert (   self,
t.Any  value,
Parameter | None  param,
Context | None   ctx 
)
Convert the value to the correct type. This is not called if
the value is ``None`` (the missing value).

This must accept string values from the command line, as well as
values that are already the correct type. It may also convert
other compatible types.

The ``param`` and ``ctx`` arguments may be ``None`` in certain
situations, such as when converting prompt input.

If the value cannot be converted, call :meth:`fail` with a
descriptive message.

:param value: The value to convert.
:param param: The parameter that is using this type to convert
    its value. May be ``None``.
:param ctx: The current context that arrived at this value. May
    be ``None``.

Reimplemented from click.types.ParamType.

◆ str_to_bool()

bool | None click.types.BoolParamType.str_to_bool ( str | bool  value)
static
Convert a string to a boolean value.

If the value is already a boolean, it is returned as-is. If the value is a
string, it is stripped of whitespaces and lower-cased, then checked against
the known boolean states pre-defined in the `BoolParamType.bool_states` mapping
above.

Returns `None` if the value does not match any known boolean state.

Member Data Documentation

◆ bool_states

dict click.types.BoolParamType.bool_states
static
Initial value:
= {
"1": True,
"0": False,
"yes": True,
"no": False,
"true": True,
"false": False,
"on": True,
"off": False,
"t": True,
"f": False,
"y": True,
"n": False,
# Absence of value is considered False.
"": False,
}

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