Showing 44 of 44 total issues
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 _format_field
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _format_field( # pylint: disable=too-many-return-statements
self, data: Any, field: dataclasses.Field
) -> Optional[str]:
"""formats field"""
if data is 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 compute_metrics
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def compute_metrics(self, predictions: List[str], references: List[str]):
"""
compute da2 metrics of predictions given references
Args:
- 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_textfile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _read_textfile(textfile: Path) -> str:
"""tries to read text file"""
lines: List[str] = []
if textfile.exists():
for enc in ["utf8", "ascii", "windows-1252", "cp500"]:
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def serve( # pylint: disable=too-many-arguments
Function parse_argdown_block
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_argdown_block(self, ad_raw: str) -> Optional[List[ArgumentStatement]]:
"""parses argdown block"""
# preprocess
ad_raw = self.preprocess_ad(ad_raw)
regex = self.INFERENCE_PATTERN_REGEX
- 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 from_batch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def from_batch(cls, batched_data: Dict[str, List]):
"""Unbatches data and returns a DeepA2Item"""
unbatched_data = {k: v[0] for k, v in batched_data.items()}
for field in dataclasses.fields(cls):
- 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 bake
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def bake( # noqa: C901 pylint: disable=too-many-arguments,too-many-branches,too-many-statements
Function process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process(self, batched_input: Dict[str, List]) -> Dict[str, List]:
"""
The Director provides a function that can be mapped over a dataset
(requiring batches of size 1).
"""
- 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 consistent_usage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def consistent_usage(parsed_pred: Optional[Argument]) -> Optional[int]:
"""checks if info about used statements is consistent"""
if parsed_pred is None:
return 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 score
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def score(
self,
pred_as_formulae: Optional[List[Optional[Formalization]]],
ref_as_formulae: Optional[List[Optional[Formalization]]],
):
- 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_source
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_source(
Function _generate_source
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _generate_source(
Function transform
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def transform(
Function _generate_source
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _generate_source(
self,
triples: Dict[str, str],
question_text: str,
answer_text: 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 __init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, **config) -> None:
self._sources: Dict = config["sources"]
self._export_path: str = config["export_path"]
self._export_format: str = config["export_format"]
self._mask_probability: float = config["mask_probability"]
- 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 too many return
statements within this function. Open
return self._format_list(da2list)
Avoid too many return
statements within this function. Open
return self._MIN_SCORES
Avoid too many return
statements within this function. Open
return scores
Avoid too many return
statements within this function. Open
return self._format_dict(dictdata)