Classes | |
| class | Throttle |
Functions | |
| _U|None | _U (_T|None value, Callable[[_T], _U] to_type, _U|None default=None) |
| str | ensure_unique_string (str preferred_string, Iterable[str]|KeysView[str] current_strings) |
| str | get_random_string (int length=10) |
| None | raise_if_invalid_filename (str filename) |
| None | raise_if_invalid_path (str path) |
| str | repr_helper (Any inp) |
| str | slugify (str|None text, *str separator="_") |
Variables | |
| RE_SANITIZE_FILENAME = re.compile(r"(~|\.\.|/|\\)") | |
| RE_SANITIZE_PATH = re.compile(r"(~|\.(\.)+)") | |
Helper methods for various modules.
|
private |
Convert value to to_type, returns default if fails.
Definition at line 61 of file __init__.py.
| str homeassistant.util.ensure_unique_string | ( | str | preferred_string, |
| Iterable[str] | KeysView[str] | current_strings | ||
| ) |
Return a string that is not present in current_strings. If preferred string exists will append _2, _3, ..
Definition at line 72 of file __init__.py.
| str homeassistant.util.get_random_string | ( | int | length = 10 | ) |
Return a random string with letters and digits.
Definition at line 92 of file __init__.py.
| None homeassistant.util.raise_if_invalid_filename | ( | str | filename | ) |
Check if a filename is valid. Raises a ValueError if the filename is invalid.
Definition at line 23 of file __init__.py.
| None homeassistant.util.raise_if_invalid_path | ( | str | path | ) |
Check if a path is valid. Raises a ValueError if the path is invalid.
Definition at line 32 of file __init__.py.
| str homeassistant.util.repr_helper | ( | Any | inp | ) |
Help creating a more readable string representation of objects.
Definition at line 49 of file __init__.py.
| str homeassistant.util.slugify | ( | str | None | text, |
| *str | separator = "_" |
||
| ) |
Slugify a given text.
Definition at line 41 of file __init__.py.
| homeassistant.util.RE_SANITIZE_FILENAME = re.compile(r"(~|\.\.|/|\\)") |
Definition at line 19 of file __init__.py.
| homeassistant.util.RE_SANITIZE_PATH = re.compile(r"(~|\.(\.)+)") |
Definition at line 20 of file __init__.py.