tensorflow/tensorflow

View on GitHub
tensorflow/python/distribute/input_lib_test.py

Summary

Maintainability
F
1 wk
Test Coverage

File input_lib_test.py has 1666 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2018 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/python/distribute/input_lib_test.py - About 4 days to fix

    Function _test_input_iteration has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

      def _test_input_iteration(self,
                                input_type,
                                api_type,
                                iteration_type,
                                dataset_or_input_fn,
    Severity: Minor
    Found in tensorflow/python/distribute/input_lib_test.py - About 5 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

    DistributedIteratorTest has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DistributedIteratorTest(DistributedIteratorTestBase,
                                  parameterized.TestCase):
    
      @combinations.generate(
          combinations.combine(
    Severity: Minor
    Found in tensorflow/python/distribute/input_lib_test.py - About 2 hrs to fix

      Function testRaggedSparse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def testRaggedSparse(self, distribution, input_type, drop_remainder,
                             defun_type):
          """Test with `RaggedTensor`s and `SparseTensor`s."""
          self.skipTest("b/213596871, b/214574707")
      
      
      Severity: Minor
      Found in tensorflow/python/distribute/input_lib_test.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 testRaggedSparseGetNextAsOptionalInLoop has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def testRaggedSparseGetNextAsOptionalInLoop(self, distribution, input_type,
                                                    drop_remainder):
          """Test with `RaggedTensor`s and `SparseTensor`s."""
          global_batch_size = 8
      
      
      Severity: Minor
      Found in tensorflow/python/distribute/input_lib_test.py - 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

      Function testUnevenDatasetBatchesMultiWorker has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def testUnevenDatasetBatchesMultiWorker(self, input_type, api_type,
                                                iteration_type, drop_remainder,
                                                distribution):
          # Actual devices don't matter in this test as long as the number of global
          # repices is 2.
      Severity: Minor
      Found in tensorflow/python/distribute/input_lib_test.py - 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

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

        def _test_input_iteration(self,
      Severity: Major
      Found in tensorflow/python/distribute/input_lib_test.py - About 1 hr to fix

        Function testUnevenDatasetBatchesMultiWorkerFourReplicas has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def testUnevenDatasetBatchesMultiWorkerFourReplicas(self, input_type,
                                                              api_type, iteration_type,
                                                              drop_remainder,
                                                              distribution):
            # Actual devices don't matter in this test as long as the number of global
        Severity: Minor
        Found in tensorflow/python/distribute/input_lib_test.py - 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

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

          def _wrap_iterator(self,
        Severity: Major
        Found in tensorflow/python/distribute/input_lib_test.py - About 50 mins to fix

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

            def _wrap_dataset(self,
          Severity: Minor
          Found in tensorflow/python/distribute/input_lib_test.py - About 45 mins to fix

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

              def testBatchSplitting(self, input_type, api_type, iteration_type,
            Severity: Minor
            Found in tensorflow/python/distribute/input_lib_test.py - About 45 mins to fix

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

                def testBatchSplittingMultiWorker(self, input_type, api_type, iteration_type,
              Severity: Minor
              Found in tensorflow/python/distribute/input_lib_test.py - About 45 mins to fix

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

                  def _assert_iterator_values(self,
                Severity: Minor
                Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                    def testUnevenDatasetBatchesMultiWorkerFourReplicas(self, input_type,
                  Severity: Minor
                  Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                      def testTwoDevicesOneGPUOneCPU(self, input_type, api_type, iteration_type,
                    Severity: Minor
                    Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                        def testUnevenDatasetBatchesMultiWorker(self, input_type, api_type,
                      Severity: Minor
                      Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                          def testMWMSWithDataSharding(self, input_type, api_type, iteration_type,
                        Severity: Minor
                        Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                            def testOneDeviceCPU(self, input_type, api_type, iteration_type, distribution,
                          Severity: Minor
                          Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                              def testUnevenDatasetBatches(self, input_type, api_type, iteration_type,
                            Severity: Minor
                            Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                def testTPU(self, input_type, api_type, iteration_type, distribution,
                              Severity: Minor
                              Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                  def testTupleDatasetMultiworker(self, input_type, api_type, iteration_type,
                                Severity: Minor
                                Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                    def testRaggedSparseGetNextAsOptional(self, distribution, input_type,
                                  Severity: Minor
                                  Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                      def testOneDeviceCPUMultiWorker(self, input_type, api_type, iteration_type,
                                    Severity: Minor
                                    Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                        def testTupleDataset(self, input_type, api_type, iteration_type, distribution,
                                      Severity: Minor
                                      Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                          def testAutoshardingOption(self, distribution, input_type, api_type,
                                        Severity: Minor
                                        Found in tensorflow/python/distribute/input_lib_test.py - About 35 mins to fix

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

                                            def testRaggedSparseGetNextAsOptional(self, distribution, input_type,
                                                                                  drop_remainder, tensor_type,
                                                                                  enable_get_next_as_optional):
                                              """Test with `RaggedTensor`s and `SparseTensor`s."""
                                              if not tf2.enabled():
                                          Severity: Minor
                                          Found in tensorflow/python/distribute/input_lib_test.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 _assert_iterator_values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            def _assert_iterator_values(self,
                                                                        iterator,
                                                                        expected_values,
                                                                        evaluate_fn,
                                                                        devices,
                                          Severity: Minor
                                          Found in tensorflow/python/distribute/input_lib_test.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 testDistributeDatasetFromFunction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            def testDistributeDatasetFromFunction(self, distribution):
                                              worker_device_pairs = [("/device:CPU:0", ["/device:CPU:0"])]
                                              input_workers = input_lib.InputWorkers(worker_device_pairs)
                                              input_contexts = []
                                              num_workers = input_workers.num_workers
                                          Severity: Minor
                                          Found in tensorflow/python/distribute/input_lib_test.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 testTfDataService has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            def testTfDataService(self, distribution):
                                              worker_device_pairs = [("/device:CPU:0", ["/device:CPU:0"])]
                                              input_workers = input_lib.InputWorkers(worker_device_pairs)
                                          
                                              dataset = dataset_ops.Dataset.range(1, 50)
                                          Severity: Minor
                                          Found in tensorflow/python/distribute/input_lib_test.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 testAutoShardExplicit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            def testAutoShardExplicit(self, input_type, distribution):
                                              worker_device_pairs = [(
                                                  "/device:CPU:0",
                                                  distribution.extended.worker_devices,
                                              )]
                                          Severity: Minor
                                          Found in tensorflow/python/distribute/input_lib_test.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