kjappelbaum/pyepal

View on GitHub
src/pyepal/pal/pal_base.py

Summary

Maintainability
D
2 days
Test Coverage

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

            assert measurement_uncertainty.shape == measurements.shape
Severity: Info
Found in src/pyepal/pal/pal_base.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert X_design.ndim == 2, "You must provide a two-dimensional numpy array"

Severity: Info
Found in src/pyepal/pal/pal_base.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(X_design, np.ndarray), "You must provide a two-dimensional numpy array"
Severity: Info
Found in src/pyepal/pal/pal_base.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert measurements.shape[1] == self.ndim
Severity: Info
Found in src/pyepal/pal/pal_base.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert len(indices) == len(measurements)
Severity: Info
Found in src/pyepal/pal/pal_base.py by bandit

File pal_base.py has 607 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# pylint:disable=anomalous-backslash-in-string
# Copyright 2020 PyePAL authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in src/pyepal/pal/pal_base.py - About 1 day to fix

    PALBase has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PALBase:  # pylint:disable=too-many-instance-attributes, too-many-public-methods
        """PAL base class"""
    
        def __init__(  # pylint:disable=too-many-arguments
            self,
    Severity: Minor
    Found in src/pyepal/pal/pal_base.py - About 5 hrs to fix

      Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(  # pylint:disable=too-many-arguments
      Severity: Major
      Found in src/pyepal/pal/pal_base.py - About 1 hr to fix

        Function __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(  # pylint:disable=too-many-arguments
                self,
                X_design: np.array,
                models: list,
                ndim: int,
        Severity: Minor
        Found in src/pyepal/pal/pal_base.py - About 1 hr to fix

          Function run_one_step has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def run_one_step(  # pylint:disable=too-many-arguments
          Severity: Major
          Found in src/pyepal/pal/pal_base.py - About 50 mins to fix

            Function run_one_step has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def run_one_step(  # pylint:disable=too-many-arguments
                    self,
                    batch_size: int = 1,
                    pooling_method: str = "fro",
                    sample_discarded: bool = False,
            Severity: Minor
            Found in src/pyepal/pal/pal_base.py - About 35 mins to fix

            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 sample has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def sample(
                    self,
                    exclude_idx: Union[np.array, None] = None,
                    pooling_method: str = "fro",
                    sample_discarded: bool = False,
            Severity: Minor
            Found in src/pyepal/pal/pal_base.py - About 25 mins to fix

            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 augment_design_space has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def augment_design_space(  # pylint: disable=invalid-name
                    self, X_design: np.ndarray, classify: bool = False, clean_classify: bool = True
                ) -> None:
                    """Add new design points to PAL instance
            
            
            Severity: Minor
            Found in src/pyepal/pal/pal_base.py - About 25 mins to fix

            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 _crossvalidate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _crossvalidate(self):
                    sampled_original = deepcopy(self.sampled)
                    sampled_idx_original = self.sampled_indices
                    errors = []
                    # this step is to make the code not to complicate
            Severity: Minor
            Found in src/pyepal/pal/pal_base.py - About 25 mins to fix

            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

            There are no issues that match your filters.

            Category
            Status