Back to Prefect

names

docs/v3/api-ref/python/prefect-utilities-names.mdx

3.6.30.dev31.3 KB
Original Source

prefect.utilities.names

Functions

generate_slug <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/names.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
generate_slug(n_words: int) -> str

Generates a random slug.

Args:

  • - n_words: the number of words in the slug

obfuscate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/names.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
obfuscate(s: Any, show_tail: bool = False) -> str

Obfuscates any data type's string representation. See obfuscate_string.

obfuscate_string <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/names.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
obfuscate_string(s: str, show_tail: bool = False) -> str

Obfuscates a string by returning a new string of 8 characters. If the input string is longer than 10 characters and show_tail is True, then up to 4 of its final characters will become final characters of the obfuscated string; all other characters are "*".

"abc" -> "" "abcdefgh" -> "" "abcdefghijk" -> "*******k" "abcdefghijklmnopqrs" -> "****pqrs"