datalad_next.utils
Assorted utility functions
- class datalad_next.utils.ParamDictator(params: Dict)[source]
Bases:
object
Parameter dict access helper
This class can be used to wrap a dict containing function parameter name-value mapping, and get/set values by parameter name attribute rather than via the
__getitem__
dict API.
- datalad_next.utils.get_specialremote_credential_envpatch(remote_type, cred)[source]
Create an environment path for a particular remote type and credential
- Returns:
A dict with all required items to patch the environment, or None if not enough information is available, or nothing needs to be patched.
- Return type:
dict or None
- datalad_next.utils.get_specialremote_credential_properties(params)[source]
Determine properties of credentials special remote configuration
The input is a parameterization as it would be given to git annex initremote|enableremote <name> ..., or as stored in remote.log. These parameters are inspected and a dictionary of credential properties, suitable for CredentialManager.query() is returned. This inspection may involve network activity, e.g. HTTP requests.
- Parameters:
params (list or dict) -- Either a list of strings of the format 'param=value', or a dictionary with parameter names as keys.
- Returns:
Credential property name-value mapping. This mapping can be passed to CredentialManager.query(). If no credential properties could be inferred, for example, because the special remote type is not recognized None is returned.
- Return type:
dict or None
- datalad_next.utils.get_specialremote_param_dict(params)[source]
- Parameters:
params (list) --
- Return type:
dict
- datalad_next.utils.needs_specialremote_credential_envpatch(remote_type)[source]
Returns whether the environment needs to be patched with credentials
- Returns:
False, if the special remote type is not recognized as one needing credentials, or if there are credentials already present. True, otherwise.
- Return type:
bool
- datalad_next.utils.update_specialremote_credential(srtype, credman, credname, credprops, credtype_hint=None, duplicate_hint=None)[source]
- Parameters:
srtype (str) --
credman (CredentialManager) --
credname (str or Name) --
credprops (dict) --