Showing 44 of 44 total issues
File parsers.py
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Parsers and formatters for DA2 data structures"""
import dataclasses
import logging
import re
File nli_builder.py
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Defines Builders for creating DeepA2 datasets from NLI-type data."""
from __future__ import annotations
import dataclasses
File aifdb_builder.py
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Defines Builders for creating DeepA2 datasets from AIFdb corpora."""
from __future__ import annotations
import dataclasses
File entailmentbank_builder.py
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Defines Builder for creating DeepA2 datasets from Entailment bank data."""
from __future__ import annotations
import dataclasses
Function split_nodeset_per_inference
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def split_nodeset_per_inference( # pylint: disable=too-many-locals, too-many-statements
examples: Dict[str, List]
) -> Dict[str, List]:
"""extracts individual inferences from nodesets, and splits nodesets accordingly"""
- 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 core.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Defines core abstract classes and data structures for DeepA2 datasets.
This module defines core abstract classes and data structures for building
DeepA2 datasets. The core classess follow the director-builder design pattern.
The `Director` sets up a universal pipeline for transforming a raw dataset.
File metric_handler.py
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""metric handlers and basic class for calculating metrics"""
from __future__ import annotations
from abc import ABC, abstractmethod
import re
Function transform
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def transform(self) -> None:
"""transforms sources"""
logging.info(
"#################################################################"
- 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 map_to_t2t
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def map_to_t2t(self, da2_dict: Dict[str, Any]) -> Dict[str, List[str]]:
"""create multiple t2t items from a single Deep A2 item"""
t2t_item: Dict[str, List[str]] = {}
da2_item = DeepA2Item.from_batch(da2_dict)
da2_item = self._layouter.format(da2_item)
- 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 transform
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def transform(
self,
export_path: Optional[str] = None,
active_features: Optional[List[str]] = None,
debug_size: Optional[int] = 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
File datastructures.py
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Basic data structures"""
from abc import ABC
import dataclasses
import logging
File arg_kp_builder.py
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Defines Builder for creating DeepA2 datasets from IBM Argument Key Point data."""
from __future__ import annotations
import dataclasses
Function bake
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def bake( # noqa: C901 pylint: disable=too-many-arguments,too-many-branches,too-many-statements
source_type: Optional[str] = typer.Option(
None,
help="type of the source dataset, used to"
"choose a compatible Builder; currently supported source types:"
- 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 populate_record
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def populate_record( # pylint: disable=too-many-statements, too-many-locals
self, idx: int
) -> None:
"""populates record at product index `int`"""
- 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 load_dataset
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def load_dataset(self) -> datasets.DatasetDict:
splits = self._aifdb_config.splits
# download and unpack corpora
aifdb_dir = Path(self._aifdb_config.cache_dir)
- 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_proposition_block
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_proposition_block(ad_raw: str, **inf_args) -> List[ArgumentStatement]:
"""parses proposition block"""
statement_list: List[ArgumentStatement] = []
if not ad_raw:
return statement_list
- 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 preprocess
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def preprocess(dataset: datasets.Dataset) -> datasets.Dataset:
df_esnli = pd.DataFrame(dataset.to_pandas())
df_esnli = df_esnli.drop_duplicates()
# count explanations per row
df_esnli["n_explanations"] = 3 - df_esnli[
- 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 populate_record
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def populate_record( # pylint: disable=too-many-statements, too-many-locals
self, idx: int
) -> None:
"""populates record at product index `int`"""
Function no_petitio
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def no_petitio(parsed_pred: Optional[Argument]) -> Optional[int]:
"""checks if a reconstruction is no petitio
i.e. no conclusion is a premise,
petitio is a special case of redundancy"""
- 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 serve
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def serve( # pylint: disable=too-many-arguments
path: Optional[str] = typer.Option(None, help="path to DeepA2 dataset"),
revision: Optional[str] = typer.Option(
None, help="version of the dataset (script) to load"
),
- 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"