[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-10-01 08:03:15 +00:00
parent 02ff53c1e8
commit a696268791

View File

@ -1,13 +1,13 @@
def is_upper(string: str) -> bool:
"""
Check if all characters in the string are uppercase letters.
Args:
string (str): The input string.
Returns:
bool: True if all characters in the string are uppercase letters, False otherwise.
Examples:
>>> is_upper("HELLO")
True
@ -16,16 +16,17 @@ def is_upper(string: str) -> bool:
"""
return all(ord(char) >= 65 and ord(char) <= 90 for char in string)
def is_lower(string: str) -> bool:
"""
Check if all characters in the string are lowercase letters.
Args:
string (str): The input string.
Returns:
bool: True if all characters in the string are lowercase letters, False otherwise.
Examples:
>>> is_lower("hello")
True
@ -34,16 +35,17 @@ def is_lower(string: str) -> bool:
"""
return all(ord(char) >= 97 and ord(char) <= 122 for char in string)
def is_alpha(string: str) -> bool:
"""
Check if all characters in the string are alphabetical (letters).
Args:
string (str): The input string.
Returns:
bool: True if all characters in the string are letters, False otherwise.
Examples:
>>> is_alpha("Hello")
True
@ -52,16 +54,17 @@ def is_alpha(string: str) -> bool:
"""
return all(char.isalpha() for char in string)
def is_alnum(string: str) -> bool:
"""
Check if all characters in the string are alphanumeric (letters or digits).
Args:
string (str): The input string.
Returns:
bool: True if all characters in the string are letters or digits, False otherwise.
Examples:
>>> is_alnum("Hello123")
True
@ -70,16 +73,17 @@ def is_alnum(string: str) -> bool:
"""
return all(char.isalnum() for char in string)
def is_decimal(string: str) -> bool:
"""
Check if all characters in the string are decimal digits.
Args:
string (str): The input string.
Returns:
bool: True if all characters in the string are decimal digits, False otherwise.
Examples:
>>> is_decimal("12345")
True
@ -88,16 +92,17 @@ def is_decimal(string: str) -> bool:
"""
return all(char.isdigit() for char in string)
def is_space(string: str) -> bool:
"""
Check if all characters in the string are whitespace characters.
Args:
string (str): The input string.
Returns:
bool: True if all characters in the string are whitespace characters, False otherwise.
Examples:
>>> is_space(" \\t\\n")
True
@ -106,16 +111,17 @@ def is_space(string: str) -> bool:
"""
return all(char.isspace() for char in string)
def is_title(string: str) -> bool:
"""
Check if the string is in title case (first letter of each word is capital).
Args:
string (str): The input string.
Returns:
bool: True if the string is in title case, False otherwise.
Examples:
>>> is_title("This Is A Title Case String")
True
@ -124,6 +130,8 @@ def is_title(string: str) -> bool:
"""
return string.istitle()
if __name__ == "__main__":
import doctest
doctest.testmod()
doctest.testmod()