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

Public Member Functions

None __init__ (self, TextType prompt="", *Optional[Console] console=None, bool password=False, Optional[List[str]] choices=None, bool show_default=True, bool show_choices=True)
 
Union[DefaultType, PromptType] ask (cls, TextType prompt="", *Optional[Console] console=None, bool password=False, Optional[List[str]] choices=None, bool show_default=True, bool show_choices=True, DefaultType default, Optional[TextIO] stream=None)
 
PromptType ask (cls, TextType prompt="", *Optional[Console] console=None, bool password=False, Optional[List[str]] choices=None, bool show_default=True, bool show_choices=True, Optional[TextIO] stream=None)
 
Any ask (cls, TextType prompt="", *Optional[Console] console=None, bool password=False, Optional[List[str]] choices=None, bool show_default=True, bool show_choices=True, Any default=..., Optional[TextIO] stream=None)
 
Text render_default (self, DefaultType default)
 
Text make_prompt (self, DefaultType default)
 
str get_input (cls, Console console, TextType prompt, bool password, Optional[TextIO] stream=None)
 
bool check_choice (self, str value)
 
PromptType process_response (self, str value)
 
None on_validate_error (self, str value, InvalidResponse error)
 
None pre_prompt (self)
 
PromptType __call__ (self, *Optional[TextIO] stream=None)
 
Union[PromptType, DefaultType] __call__ (self, *DefaultType default, Optional[TextIO] stream=None)
 
Any __call__ (self, *Any default=..., Optional[TextIO] stream=None)
 

Public Attributes

 console
 
 prompt
 
 password
 
 choices
 
 show_default
 
 show_choices
 
 response_type
 
 prompt_suffix
 
 validate_error_message
 
 illegal_choice_message
 

Static Public Attributes

type response_type = str
 
str validate_error_message = "[prompt.invalid]Please enter a valid value"
 
tuple illegal_choice_message
 
str prompt_suffix = ": "
 
Optional choices = None
 

Detailed Description

Ask the user for input until a valid response is received. This is the base class, see one of
the concrete classes for examples.

Args:
    prompt (TextType, optional): Prompt text. Defaults to "".
    console (Console, optional): A Console instance or None to use global console. Defaults to None.
    password (bool, optional): Enable password input. Defaults to False.
    choices (List[str], optional): A list of valid choices. Defaults to None.
    show_default (bool, optional): Show default in prompt. Defaults to True.
    show_choices (bool, optional): Show choices in prompt. Defaults to True.

Member Function Documentation

◆ __call__()

Any pip._vendor.rich.prompt.PromptBase.__call__ (   self,
*Any   default = ...,
Optional[TextIO]   stream = None 
)
Run the prompt loop.

Args:
    default (Any, optional): Optional default value.

Returns:
    PromptType: Processed value.

◆ ask()

Any pip._vendor.rich.prompt.PromptBase.ask (   cls,
TextType   prompt = "",
*Optional[Console]   console = None,
bool   password = False,
Optional[List[str]]   choices = None,
bool   show_default = True,
bool   show_choices = True,
Any   default = ...,
Optional[TextIO]   stream = None 
)
Shortcut to construct and run a prompt loop and return the result.

Example:
    >>> filename = Prompt.ask("Enter a filename")

Args:
    prompt (TextType, optional): Prompt text. Defaults to "".
    console (Console, optional): A Console instance or None to use global console. Defaults to None.
    password (bool, optional): Enable password input. Defaults to False.
    choices (List[str], optional): A list of valid choices. Defaults to None.
    show_default (bool, optional): Show default in prompt. Defaults to True.
    show_choices (bool, optional): Show choices in prompt. Defaults to True.
    stream (TextIO, optional): Optional text file open for reading to get input. Defaults to None.

◆ check_choice()

bool pip._vendor.rich.prompt.PromptBase.check_choice (   self,
str  value 
)
Check value is in the list of valid choices.

Args:
    value (str): Value entered by user.

Returns:
    bool: True if choice was valid, otherwise False.

◆ get_input()

str pip._vendor.rich.prompt.PromptBase.get_input (   cls,
Console  console,
TextType  prompt,
bool  password,
Optional[TextIO]   stream = None 
)
Get input from user.

Args:
    console (Console): Console instance.
    prompt (TextType): Prompt text.
    password (bool): Enable password entry.

Returns:
    str: String from user.

◆ make_prompt()

Text pip._vendor.rich.prompt.PromptBase.make_prompt (   self,
DefaultType  default 
)
Make prompt text.

Args:
    default (DefaultType): Default value.

Returns:
    Text: Text to display in prompt.

◆ on_validate_error()

None pip._vendor.rich.prompt.PromptBase.on_validate_error (   self,
str  value,
InvalidResponse  error 
)
Called to handle validation error.

Args:
    value (str): String entered by user.
    error (InvalidResponse): Exception instance the initiated the error.

◆ pre_prompt()

None pip._vendor.rich.prompt.PromptBase.pre_prompt (   self)
Hook to display something before the prompt.

◆ process_response()

PromptType pip._vendor.rich.prompt.PromptBase.process_response (   self,
str  value 
)
Process response from user, convert to prompt type.

Args:
    value (str): String typed by user.

Raises:
    InvalidResponse: If ``value`` is invalid.

Returns:
    PromptType: The value to be returned from ask method.

Reimplemented in pip._vendor.rich.prompt.Confirm.

◆ render_default()

Text pip._vendor.rich.prompt.PromptBase.render_default (   self,
DefaultType  default 
)
Turn the supplied default in to a Text instance.

Args:
    default (DefaultType): Default value.

Returns:
    Text: Text containing rendering of default value.

Reimplemented in pip._vendor.rich.prompt.Confirm.

Member Data Documentation

◆ illegal_choice_message

tuple pip._vendor.rich.prompt.PromptBase.illegal_choice_message
static
Initial value:
= (
"[prompt.invalid.choice]Please select one of the available options"
)

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