File dynamic_ragged_shape_test.py
has 3693 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2021 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
DynamicRaggedShapeTest
has 133 functions (exceeds 20 allowed). Consider refactoring. Open
class DynamicRaggedShapeTest(test_util.TensorFlowTestCase,
parameterized.TestCase):
def assertRowPartitionEq(self,
x: RowPartition,
DynamicRaggedShapeSpecTest
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class DynamicRaggedShapeSpecTest(parameterized.TestCase):
def assertRowPartitionSpecEqual(self,
a: RowPartitionSpec,
b: RowPartitionSpec,
Function testAddShape
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testAddShape(self,
Function test_merge_dims
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_merge_dims(self, lengths, num_row_partitions, outer_axis, inner_axis,
Function testBroadcastDynamicShapeNextLayerBothUniformRaises
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcastDynamicShapeNextLayerBothUniformRaises(
Function testBroadcastDynamicShapeNextLayerHalfRaggedRaises
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcastDynamicShapeNextLayerHalfRaggedRaises(
Function testBroadcastDynamicShapeExtended
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcastDynamicShapeExtended(self,
Function testAdd
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testAdd(self,
Function testConstructorRaisesStatic
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testConstructorRaisesStatic(self,
Function testBroadcasterInitRaises
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcasterInitRaises(self, source_shape, target_shape,
Function testAdd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def testAdd(self,
lengths_a,
lengths_b,
new_impl,
max_num_ops,
- 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 testBroadcastDynamicShapeNextLayerRaises
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcastDynamicShapeNextLayerRaises(self, ac_0, bc_0, a_1, b_1,
Function testBroadcastDynamicShapeStatic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcastDynamicShapeStatic(self,
Function test_from_tensor_shape_raises
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_from_tensor_shape_raises(self, shape, num_row_partitions, dtype,
Function testBroadcaster
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testBroadcaster(self,
Function testConstructorRaisesDynamic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testConstructorRaisesDynamic(self,
Function test_constructor_raises
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_constructor_raises(self, row_partitions, static_inner_shape,
Function testGetItemRaisesStatic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testGetItemRaisesStatic(self,
Function testIsUniformRaises
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def testIsUniformRaises(self, lengths, num_row_partitions, axis, error_type,
Function testAddShape
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def testAddShape(self,
lengths_a,
lengths_b,
shape_e,
new_impl=False,
- 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 testAddSelf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def testAddSelf(self, lengths_a, new_impl, op_max, num_row_partitions_a=None):
if context.executing_eagerly():
return
shape_a0 = DynamicRaggedShape.from_lengths(
lengths_a, num_row_partitions=num_row_partitions_a)
- 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"