mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-11-11 00:41:34 +08:00
updates docstring for check_for_attribute
This commit is contained in:
parent
6ec6cff115
commit
7176e7d3c8
1 changed files with 25 additions and 1 deletions
|
|
@ -153,7 +153,31 @@ class check:
|
||||||
save=True,
|
save=True,
|
||||||
make_dirs=False,
|
make_dirs=False,
|
||||||
):
|
):
|
||||||
"""Check for attribute in config."""
|
"""
|
||||||
|
Check for attribute in config.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
data (dict): The configuration data to search.
|
||||||
|
attribute (str): The name of the attribute key to search for.
|
||||||
|
parent (str, optional): The name of the top level attribute to search under. Defaults to None.
|
||||||
|
subparent (str, optional): The name of the second level attribute to search under. Defaults to None.
|
||||||
|
test_list (dict, optional): A dictionary of valid values for the attribute. Defaults to None.
|
||||||
|
default (any, optional): The default value to use if the attribute is not found. Defaults to None.
|
||||||
|
do_print (bool, optional): Whether to print warning messages. Defaults to True.
|
||||||
|
default_is_none (bool, optional): Whether to treat a None value as a valid default. Defaults to False.
|
||||||
|
req_default (bool, optional): Whether to raise an error if no default value is provided. Defaults to False.
|
||||||
|
var_type (str, optional): The expected type of the attribute value. Defaults to "str".
|
||||||
|
min_int (int, optional): The minimum value for an integer attribute. Defaults to 0.
|
||||||
|
throw (bool, optional): Whether to raise an error if the attribute value is invalid. Defaults to False.
|
||||||
|
save (bool, optional): Whether to save the default value to the config if it is used. Defaults to True.
|
||||||
|
make_dirs (bool, optional): Whether to create directories for path attributes if they do not exist. Defaults to False.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
any: The value of the attribute, or the default value if it is not found.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
Failed: If the attribute value is invalid or a required default value is missing.
|
||||||
|
"""
|
||||||
endline = ""
|
endline = ""
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
if subparent is not None:
|
if subparent is not None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue