Showing 57 of 57 total issues
File adi.py
has 680 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import math
import re
from typing import Any, Dict, List
File acdd_global_attrs.py
has 533 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pydantic import (
Field,
HttpUrl,
)
Function perform_data_retrieval
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def perform_data_retrieval(
input_data: Dict[InputKey, xr.Dataset],
coord_rules: Dict[VarName, Dict[Pattern[Any], RetrievedVariable]],
data_var_rules: Dict[VarName, Dict[Pattern[Any], RetrievedVariable]],
) -> Tuple[RetrievedDataset, RetrievalRuleSelections]:
- 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 _rename_variables
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def _rename_variables(
dataset: xr.Dataset,
input_config: InputKeyRetrievalRules,
) -> xr.Dataset:
"""-----------------------------------------------------------------------------
- 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 retrieve
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def retrieve(
self,
input_keys: List[str],
dataset_config: DatasetConfig,
storage: Optional[Storage] = None,
- 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 run
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def run(
self, dataset: xr.Dataset, variable_name: str
) -> Union[NDArray[np.bool_], None]:
variable = dataset[variable_name]
failures = np.full(variable.shape, False)
- 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
File utils.py
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import re
from datetime import datetime
from enum import Enum
from pathlib import Path
Function _write_transform_parameter_row
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _write_transform_parameter_row(
self,
transforms: Dict[str, str],
file_name: str,
base_var_name: str,
- 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 read
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def read(self, input_key: str) -> Dict[str, xr.Dataset]:
"""------------------------------------------------------------------------------------
Extracts the file into memory and uses registered `DataReaders` to read each relevant
extracted file into its own xarray Dataset object. Returns a mapping like
{filename: xr.Dataset}.
- 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
File converters.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime
import warnings
import logging
from typing import TYPE_CHECKING, Any, Dict, Hashable, List, Literal, Optional, Tuple
Function write
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def write(
self, dataset: xr.Dataset, filepath: Optional[Path] = None, **kwargs: Any
) -> None:
to_netcdf_kwargs = copy.deepcopy(self.parameters.to_netcdf_kwargs)
encoding_dict: Dict[str, Dict[str, Any]] = {}
- 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 recursive_instantiate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def recursive_instantiate(model: Any) -> Any:
"""---------------------------------------------------------------------------------
Instantiates all ParametrizedClass components and subcomponents of a given model.
Recursively calls model.instantiate() on all ParameterizedConfigClass instances under
- 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 read
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def read(self, input_key: str) -> Dict[str, xr.Dataset]:
"""------------------------------------------------------------------------------------
Extracts the file into memory and uses registered `DataReaders` to read each relevant
extracted file into its own xarray Dataset object. Returns a mapping like
{filename: xr.Dataset}.
- 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 write
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def write(
self, dataset: xr.Dataset, filepath: Optional[Path] = None, **kwargs: Any
) -> None:
to_netcdf_kwargs = copy.deepcopy(self.parameters.to_netcdf_kwargs)
encoding_dict: Dict[str, Dict[str, Any]] = {}
- 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 __init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
input_key: InputKey,
coord_rules: Dict[VarName, Dict[Pattern[Any], RetrievedVariable]],
data_var_rules: Dict[VarName, Dict[Pattern[Any], RetrievedVariable]],
- 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 _run_data_converters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _run_data_converters(
dataset: xr.Dataset,
dataset_config: DatasetConfig,
input_config: InputKeyRetrievalRules,
) -> xr.Dataset:
- 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 decode_cf
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def decode_cf(dataset: xr.Dataset) -> xr.Dataset:
"""---------------------------------------------------------------------------------
Wrapper around `xarray.decode_cf()` which handles additional edge cases.
This helps ensure that the dataset is formatted and encoded correctly after it has
- 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 _substitute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _substitute(
template: str,
mapping: Mapping[str, str | Callable[[], str] | None] | None = None,
allow_missing: bool = False,
**kwds: str | Callable[[], str] | None,
- 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 write
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def write(
self, dataset: xr.Dataset, filepath: Optional[Path] = None, **kwargs: Any
) -> None:
# QUESTION: Is this format capable of "round-tripping"?
# (i.e., ds != read(write(ds)) for csv format)
- 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 _add_atts_to_adi
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _add_atts_to_adi(self, xr_var: xr.DataArray, adi_obj: CDSObject):
encoding_atts = {
att: xr_var.encoding[att]
for att in ["_FillValue", "source", "units"]
if att in xr_var.encoding
- 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"