graphqler/utils/objects_bucket.py
ObjectsBucket
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ObjectsBucket:
def __init__(self, api: API):
self.api = api
# Stores {object_name: {type: str, results: dict}} where list is a result with the scalar fields of the object
Function find_key_in_dict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def find_key_in_dict(self, dictionary: dict, key: str) -> tuple[str, str | int | float | bool | None]:
"""Recursively searches for the key in a nested dictionary and returns its full path and value.
Args:
dictionary (dict): The dictionary to search
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parse_as_scalar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_as_scalar(self, method_name: str, method_data: dict | list | str | int | float | bool | None):
"""Parses the data as a scalar (can be a list, dict, or any of the base GraphQL types
Args:
method_name (str): The method name
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"