utils.aind_validators¶
get_aind_rig_name ¶
Return the AIND rig name from the aibs_comp_id environment variable.
Single source of truth for reading the rig identifier from the environment; prefer this
over reading aibs_comp_id directly so the variable name lives in exactly one place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
required
|
bool
|
When True, raise :class: |
False
|
Returns:
| Type | Description |
|---|---|
str | None
|
The rig name, or |
Source code in src/clabe/utils/aind_validators.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
validate_username ¶
Validates if the given username exists in the AIND Active Directory.
Queries the AIND metadata service to verify the username exists. Returns False (instead of raising) on network errors so callers can decide how to handle the degraded state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
The username to validate. |
required |
timeout
|
float | None
|
Timeout in seconds for the HTTP request. Defaults to 2. |
2
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the username was found, False otherwise. |
Example
is_valid = validate_username("j.doe")
Source code in src/clabe/utils/aind_validators.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
validate_rig_computer_name ¶
validate_rig_computer_name(rig: TRig) -> TRig
Ensures rig and computer name are set from environment variables if available, otherwise defaults to rig configuration values.
Source code in src/clabe/utils/aind_validators.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |