clinput.single module¶
-
clinput.single.
boolean
(message, err='Please enter 1 (True) or 0 (False).')¶ Command line input and error checking for boolean values (1 or 0).
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please enter 1 (True) or 0 (False).”.
Returns: The first sucessfully input boolean value.
Return type: bool
-
clinput.single.
custom
(message, allowed, err='Invalid input.')¶ Command line input and error checking for user-defined allowable inputs.
Parameters: - message (str) – The input message displayed in the command line.
- allowed (tuple of (str,)) – The allowable user inputs.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Invalid input.”.
Returns: The first sucessfully allowed input string.
Return type: str
-
clinput.single.
integer
(message, err='Please enter an integer.')¶ Command line input and error checking for integers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please enter an integer.”.
Returns: The first sucessfully input integer.
Return type: int
-
clinput.single.
natural
(message, err='Please enter an integer greater than zero.', zero=False)¶ Command line input and error checking for natural numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please enter an integer greater than zero.”.
- zero (bool, optional) – Zero status. True includes zero, False excludes zero. Defaults to False.
Returns: The first sucessfully input natural number.
Return type: int
-
clinput.single.
negative
(message, err='Please enter a negative number.', zero=True)¶ Command line input and error checking for negative numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please enter a negative number.”.
- zero (bool, optional) – Zero status. True includes zero, False excludes zero. Defaults to True.
Returns: The first sucessfully input negative number.
Return type: float
-
clinput.single.
number
(message, err='Please enter a number.')¶ Command line input and error checking for numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please enter a number.”.
Returns: The first sucessfully input number.
Return type: float
-
clinput.single.
positive
(message, err='Please enter a positive number.', zero=True)¶ Command line input and error checking for positive numbers.
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please enter a positive number.”.
- zero (bool, optional) – Zero status. True includes zero, False excludes zero. Defaults to True.
Returns: The first sucessfully input positive number.
Return type: float
-
clinput.single.
string
(message, err='Please provide an input.')¶ Command line input and error checking for strings (error if blank).
Parameters: - message (str) – The input message displayed in the command line.
- err (str, optional) – The message displayed for an erroneous input. Defaults to “Please provide an input.”.
Returns: The first sucessfully input string.
Return type: str