Showing 134 of 224 total issues
File pdf_visual_parser.py
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Fonduer visual parser that parses visual information from PDF."""
import logging
import os
import re
import shutil
Function get_head_ngrams
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get_head_ngrams(
mention: Union[Candidate, Mention, TemporarySpanMention],
axis: Optional[str] = None,
attrib: str = "words",
n_min: int = 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
File featurizer.py
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Fonduer featurizer."""
import itertools
import logging
from collections import defaultdict
from typing import (
File implicit_span_mention.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Fonduer implicit span mention model."""
from typing import Any, Dict, List, Optional, Type
from sqlalchemy import Column, ForeignKey, Integer, String, UniqueConstraint
from sqlalchemy.dialects import postgresql
Function save_model
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def save_model(
fonduer_model: FonduerModel,
path: str,
preprocessor: DocPreprocessor,
parser: Parser,
- 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 create_task
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create_task(
task_names: Union[str, List[str]],
n_arities: Union[int, List[int]],
n_features: int,
n_classes: Union[int, List[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 f
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def f(self, m: TemporaryContext) -> bool:
"""Non-composed version of filter function f."""
if not isinstance(m, TemporarySpanMention):
raise ValueError(
f"{self.__class__.__name__} only supports TemporarySpanMention"
- 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 candidates.py
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Fonduer candidate."""
import logging
from builtins import range
from itertools import product
from typing import (
Function __init__
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 18 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
File sentence.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Fonduer sentence context model."""
from builtins import object
from typing import Any, Dict
from sqlalchemy import Column, ForeignKey, Integer, String, Text, UniqueConstraint
TemporarySpanMention
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class TemporarySpanMention(TemporaryContext):
"""The TemporaryContext version of Span."""
def __init__(
self,
File spacy_parser.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Fonduer Spacy parser."""
import importlib
import logging
from collections import defaultdict
from pathlib import Path
Function corenlp_to_xmltree_sub
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def corenlp_to_xmltree_sub(
s: Dict[str, Any], dep_parents: List[int], rid: int = 0
) -> _Element:
"""Construct XMLTree with CoreNLP information.
- 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 save_model
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
def save_model(
Function _coordinates_from_HTML
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _coordinates_from_HTML(
self, page: Tag, page_num: int
) -> Tuple[List[PdfWord], Dict[PdfWordId, Bbox]]:
pdf_word_list: List[PdfWord] = []
coordinate_map: Dict[PdfWordId, Bbox] = {}
- 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 log_model
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def log_model(
Function get_mentions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_mentions(
self, docs: Union[Document, Iterable[Document], None] = None, sort: bool = False
) -> List[List[Mention]]:
"""Return a list of lists of the mentions associated with this extractor.
- 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 get_candidates
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_candidates(
self,
docs: Union[Document, Iterable[Document], None] = None,
split: int = 0,
sort: bool = 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
Function _apply
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _apply(
self, doc_loader: Collection[Document], parallelism: int, **kwargs: Any
) -> None:
"""Run the UDF multi-threaded using python multiprocessing."""
if not Meta.postgres:
- 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"