tensorflow/tensorflow

View on GitHub
tensorflow/lite/python/lite.py

Summary

Maintainability
F
1 wk
Test Coverage

File lite.py has 2796 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2023 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in tensorflow/lite/python/lite.py - About 1 wk to fix

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

      def __init__(
    Severity: Major
    Found in tensorflow/lite/python/lite.py - About 1 hr to fix

      Function _quantize has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def _quantize(
      Severity: Major
      Found in tensorflow/lite/python/lite.py - About 1 hr to fix

        Function _validate_int8_required has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def _validate_int8_required(self):
            """Int8 mode requires certain parameters to exist and be compatible."""
            # Validate target_spec attibute.
            if set(self._target_spec.supported_ops) == {
                OpsSet.TFLITE_BUILTINS_INT8
        Severity: Minor
        Found in tensorflow/lite/python/lite.py - About 55 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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def __init__(
        Severity: Major
        Found in tensorflow/lite/python/lite.py - About 50 mins to fix

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

            def __init__(
          Severity: Major
          Found in tensorflow/lite/python/lite.py - About 50 mins to fix

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

              def from_saved_model(
            Severity: Major
            Found in tensorflow/lite/python/lite.py - About 50 mins to fix

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

                def from_saved_model(
              Severity: Major
              Found in tensorflow/lite/python/lite.py - About 50 mins to fix

                Function converter_flags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def converter_flags(self, inference_ty=None, inference_input_ty=None):
                    """Flags to the converter."""
                
                    if self.is_integer_quantization():
                      is_low_bit_qat = self.is_low_bit_quantize_aware_training()
                Severity: Minor
                Found in tensorflow/lite/python/lite.py - About 45 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 from_keras_model_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def from_keras_model_file(
                Severity: Minor
                Found in tensorflow/lite/python/lite.py - About 45 mins to fix

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

                    def __init__(
                  Severity: Minor
                  Found in tensorflow/lite/python/lite.py - About 45 mins to fix

                    Function from_frozen_graph has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def from_frozen_graph(
                    Severity: Minor
                    Found in tensorflow/lite/python/lite.py - About 35 mins to fix

                      Function _optimize_tf_model has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def _optimize_tf_model(
                      Severity: Minor
                      Found in tensorflow/lite/python/lite.py - About 35 mins to fix

                        Function from_frozen_graph has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def from_frozen_graph(
                        Severity: Minor
                        Found in tensorflow/lite/python/lite.py - About 35 mins to fix

                          Function from_keras_model_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            def from_keras_model_file(
                          Severity: Minor
                          Found in tensorflow/lite/python/lite.py - About 35 mins to fix

                            Function _optimize_tf_model has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              def _optimize_tf_model(
                            Severity: Minor
                            Found in tensorflow/lite/python/lite.py - About 35 mins to fix

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

                                def __init__(
                              Severity: Minor
                              Found in tensorflow/lite/python/lite.py - About 35 mins to fix

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

                                  def __init__(
                                Severity: Minor
                                Found in tensorflow/lite/python/lite.py - About 35 mins to fix

                                  There are no issues that match your filters.

                                  Category
                                  Status