Safe Module¶
This section documents the safe components of the Nextmv Python SDK.
safe
¶
The safe module contains utilities for generating “safe” IDs and human-readable names.
FUNCTION | DESCRIPTION |
---|---|
safe_name_and_id |
Generate a safe ID and human-readable name from a prefix and user-supplied identifier. |
safe_id |
Generate a safe ID from a prefix. |
safe_id
¶
safe_id(prefix: str) -> str
Generate a safe ID from a prefix.
You can import the safe_id
function directly from nextmv
:
PARAMETER | DESCRIPTION |
---|---|
|
Prefix to use for the ID.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
A safe ID. |
Examples:
Source code in nextmv/nextmv/safe.py
safe_name_and_id
¶
Generate a safe ID and human-readable name from a prefix and user-supplied identifier.
You can import the safe_name_and_id
function directly from nextmv
:
PARAMETER | DESCRIPTION |
---|---|
|
Prefix to use for the ID.
TYPE:
|
|
User-supplied identifier. This will be converted to
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[str, str]
|
A tuple containing the human-readable name and the safe ID. |
Examples:
>>> safe_name_and_id("app", "My Application 123!")
('App My Application 123', 'app-my-application-123-4f5g6h7j')