docs: community docstring updates (#21040)

Added missed docstrings. Updated docstrings to consistent format.
This commit is contained in:
Leonid Ganeline
2024-04-29 14:40:23 -07:00
committed by GitHub
parent 90f19028e5
commit 85094cbb3a
29 changed files with 84 additions and 35 deletions

View File

@@ -196,12 +196,15 @@ def extract_dict_elements_from_component_fields(
def load_query(
query: str, fault_tolerant: bool = False
) -> Tuple[Optional[Dict], Optional[str]]:
"""Attempts to parse a JSON string and return the parsed object.
"""Parse a JSON string and return the parsed object.
If parsing fails, returns an error message.
:param query: The JSON string to parse.
:return: A tuple containing the parsed object or None and an error message or None.
Exceptions:
json.JSONDecodeError: If the input is not a valid JSON string.
"""
try:
return json.loads(query), None