cidc_schemas/prism/pipelines.py
File pipelines.py
has 685 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Analysis pipeline configuration generators."""
from collections import defaultdict
from datetime import datetime
from io import BytesIO
import logging
Function _pair_all_samples
has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring. Open
Open
def _pair_all_samples(
self, partic_map: Dict[str, Dict[str, Dict[str, str]]]
) -> List[_PairingEntry]:
"""
(Semi)automated pairing of tumor and normal samples
- 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 _generate_partic_map
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
Open
def _generate_partic_map(
self,
full_ct: dict,
) -> Dict[str, Dict[str, Dict[str, 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
Avoid deeply nested control flow statements. Open
Open
if other_cimac_id:
cimac_id = self._choose_which_normal(
full_ct, cimac_ids=[cimac_id, other_cimac_id]
)
partic_map[cimac_participant_id]["normals"][
Avoid deeply nested control flow statements. Open
Open
if collection_event in normals.keys():
tumor_pair_list.append(
_PairingEntry(
tumor_cimac_id=sample,
tumor_collection_event=collection_event,