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
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 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 preprocess
has 37 lines of code (exceeds 25 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[
Function configure_product
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure_product(self) -> None:
# populate product with configs
i = 0
for label in ["entailment", "contradiction"]:
# argument_mask specifies which part of argument will be dropped in source text:
- 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"