whylabs/whylogs-python

View on GitHub

Showing 236 of 3,918 total issues

DatasetProfile has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class DatasetProfile(_Writable):
    """
    Dataset profile represents a collection of in-memory profiling stats for a dataset.

    Args:
Severity: Minor
Found in python/whylogs/core/dataset_profile.py - About 2 hrs to fix

    Function add_drift_config has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_drift_config(
            self, column_names: List[str], algorithm: column_drift_algorithms.ColumnDriftAlgorithm
        ) -> None:
            """Add drift configuration.
            The algorithms and thresholds added through this method will be used to calculate drift scores in the `summary_drift_report()` method.
    Severity: Minor
    Found in python/whylogs/viz/extensions/reports/summary_drift.py - About 2 hrs 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 get_writables has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_writables(self) -> Optional[List[_Writable]]:
            results: Optional[List[_Writable]] = None
            if self._segments:
                results = []
                logger.info(f"Building list of: {self.count} SegmentedDatasetProfileViews in SegmentedResultSet.")
    Severity: Minor
    Found in python/whylogs/api/logger/result_set.py - About 2 hrs 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 _resolve has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def _resolve(self, name: str, why_type: DataType, config: Optional[MetricConfig]) -> Dict[str, Metric]:
            result: Dict[str, Metric] = {}
            for resolver_spec in self._resolvers:
                col_name, col_type = resolver_spec.column_name, resolver_spec.column_type
                if col_name == name or (col_name is None and isinstance(why_type, col_type)):  # type: ignore
    Severity: Minor
    Found in python/whylogs/core/resolvers.py - About 2 hrs 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 generate_constraints_from_reference_profile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_constraints_from_reference_profile(
        reference_profile_view: DatasetProfileView,
        included_columns: Optional[List[str]] = None,
        excluded_columns: Optional[List[str]] = None,
    ) -> List[MetricConstraint]:
    Severity: Minor
    Found in python/whylogs/experimental/constraints_generation/__init__.py - About 2 hrs 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 add_drift_config has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_drift_config(
            self, column_names: List[str], algorithm: column_drift_algorithms.ColumnDriftAlgorithm
        ) -> None:
            """Add drift configuration.
            The algorithms and thresholds added through this method will be used to calculate drift scores in the `summary_drift_report()` method.
    Severity: Minor
    Found in python/whylogs/viz/notebook_profile_viz.py - About 2 hrs 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 _compute_ks_score has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def _compute_ks_score(self, target_distribution, reference_distribution, with_thresholds=False):
            QUANTILES = self._parameter_config.quantiles
            if reference_distribution.is_empty() or target_distribution.is_empty():
                return None
    
    
    Severity: Minor
    Found in python/whylogs/viz/drift/column_drift_algorithms.py - About 2 hrs 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 submetrics_from_protobuf has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def submetrics_from_protobuf(cls: Type[MULTI_METRIC], msg: MetricMessage) -> Dict[str, Dict[str, Metric]]:
            submetrics: Dict[str, Dict[str, Metric]] = {}
            submetric_msgs: Dict[str, Dict[str, Dict[str, MetricComponentMessage]]] = {}
            for key, comp_msg in msg.metric_components.items():
                sub_name_and_type, comp_name = key.split("/")
    Severity: Minor
    Found in python/whylogs/core/metrics/multimetric.py - About 2 hrs 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 merge has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def merge(self, other) -> "ModelPerformanceMetrics":
            """
            :type other: ModelMetrics
            """
            if other is None or (other.confusion_matrix is None and other.regression_metrics is None):

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

        def columnar_update(self, view: PreprocessedColumn) -> OperationResult:
            successes = 0
            if view.numpy.len > 0:
                if view.numpy.ints is not None:
                    self.hll.value.update_np(view.numpy.ints)
    Severity: Minor
    Found in python/whylogs/core/metrics/metrics.py - About 2 hrs 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 _write_pending has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _write_pending(self) -> None:
            new_state: Dict[Writer, List[PendingWritable]] = {}
            for writer, pending in self._writers.items():
                failures: List[PendingWritable] = []
                self._logger.info(f"Writing out result set with {type(writer).__name__}")

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

    def _compute_ks_test_p_value(
        target_distribution: kll_doubles_sketch,
        reference_distribution: kll_doubles_sketch,
        quantiles: Optional[List[float]] = None,
    ) -> Optional[ColumnDriftValue]:
    Severity: Minor
    Found in python/whylogs/viz/utils/drift_calculations.py - About 2 hrs 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 _deserialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _deserialize(
        token: List[str], i: int, metric: Optional[Metric] = None, profile: Optional[DatasetProfile] = None
    ) -> Tuple[Predicate, int]:
        if token[i] == "~":
            component, i = _get_component(token, i + 1)
    Severity: Minor
    Found in python/whylogs/core/predicate_parser.py - About 2 hrs 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

    ThreadRollingLogger has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ThreadRollingLogger(ThreadActor[LoggerMessage], DataLogger[LoggerStatus]):
        """
        A logger that manages profiles and segments for various dataset timestamps.
    
        This logger manages a map of dataset timestamp to dataset profile/segment and handles proper

      DistributionMetric has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class DistributionMetric(Metric):
          kll: KllComponent
          mean: FractionalComponent
          m2: FractionalComponent
      
      
      Severity: Minor
      Found in python/whylogs/core/metrics/metrics.py - About 2 hrs to fix

        Function log has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def log(
                self,
                obj: Any = None,
                *,
                pandas: Optional[pd.DataFrame] = None,
        Severity: Minor
        Found in python/whylogs/api/logger/logger.py - About 2 hrs 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 pre_install_packages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def pre_install_packages(notebook_path, venv_dir):
            # Read the notebook and extract the pip commands
            with open(notebook_path, "r", encoding="utf-8") as f:
                nb = nbformat.read(f, as_version=4)
            pip_commands = []
        Severity: Minor
        Found in python/test_notebooks/notebook_tests.py - About 2 hrs 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 calculate_drift_scores has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def calculate_drift_scores(
            target_view: DatasetProfileView,
            reference_view: DatasetProfileView,
            drift_map: Optional[Dict[str, ColumnDriftAlgorithm]] = None,
            with_thresholds=False,
        Severity: Minor
        Found in python/whylogs/viz/drift/column_drift_algorithms.py - About 2 hrs 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 from_protobuf has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_protobuf(cls, msg: ColumnMessage) -> "ColumnProfileView":
                # importing to trigger registration of non-standard metrics
                import whylogs.experimental.core.metrics.udf_metric  # noqa
        
                # These require numpy & PIL, but we assume users will install
        Severity: Minor
        Found in python/whylogs/core/view/column_profile_view.py - About 2 hrs 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

        Method apply has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          public static PreprocessedColumn apply(Collection<?> data) {
            PreprocessedColumn result = new PreprocessedColumn();
            result.setOriginalColumn(data);
        
            result.length = data.size();
        Severity: Minor
        Found in java/core/src/main/java/com/whylogs/core/PreprocessedColumn.java - About 1 hr 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

        Severity
        Category
        Status
        Source
        Language