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
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,
- 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
DistributedIteratorTest
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class DistributedIteratorTest(DistributedIteratorTestBase,
parameterized.TestCase):
@combinations.generate(
combinations.combine(
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")
- 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 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
- 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 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.
- 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 _test_input_iteration
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def _test_input_iteration(self,
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
- 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 _wrap_iterator
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _wrap_iterator(self,
Function _wrap_dataset
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _wrap_dataset(self,
Function testBatchSplitting
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBatchSplitting(self, input_type, api_type, iteration_type,
Function testBatchSplittingMultiWorker
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBatchSplittingMultiWorker(self, input_type, api_type, iteration_type,
Function _assert_iterator_values
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _assert_iterator_values(self,
Function testUnevenDatasetBatchesMultiWorkerFourReplicas
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testUnevenDatasetBatchesMultiWorkerFourReplicas(self, input_type,
Function testTwoDevicesOneGPUOneCPU
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testTwoDevicesOneGPUOneCPU(self, input_type, api_type, iteration_type,
Function testUnevenDatasetBatchesMultiWorker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testUnevenDatasetBatchesMultiWorker(self, input_type, api_type,
Function testMWMSWithDataSharding
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testMWMSWithDataSharding(self, input_type, api_type, iteration_type,
Function testOneDeviceCPU
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testOneDeviceCPU(self, input_type, api_type, iteration_type, distribution,
Function testUnevenDatasetBatches
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testUnevenDatasetBatches(self, input_type, api_type, iteration_type,
Function testTPU
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testTPU(self, input_type, api_type, iteration_type, distribution,
Function testTupleDatasetMultiworker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testTupleDatasetMultiworker(self, input_type, api_type, iteration_type,
Function testRaggedSparseGetNextAsOptional
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testRaggedSparseGetNextAsOptional(self, distribution, input_type,
Function testOneDeviceCPUMultiWorker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testOneDeviceCPUMultiWorker(self, input_type, api_type, iteration_type,
Function testTupleDataset
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testTupleDataset(self, input_type, api_type, iteration_type, distribution,
Function testAutoshardingOption
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testAutoshardingOption(self, distribution, input_type, api_type,
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():
- 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 _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,
- 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 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
- 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 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)
- 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 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,
)]
- 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"