tensorflow/tensorflow

View on GitHub
tensorflow/tools/compatibility/tf_upgrade_v2_test.py

Summary

Maintainability
F
1 mo
Test Coverage

File tf_upgrade_v2_test.py has 1913 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/tools/compatibility/tf_upgrade_v2_test.py - About 5 days to fix

    TestUpgrade has 135 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TestUpgrade(test_util.TensorFlowTestCase, parameterized.TestCase):
      """Test various APIs that have been changed in 2.0.
    
      We also test whether a converted file is executable. test_file_v1_10.py
      aims to exhaustively test that API changes are convertible and actually
    Severity: Major
    Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py - About 2 days to fix

      Function testV2KeywordArgNames has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

        def testV2KeywordArgNames(self):
          # This test converts a call of the form:
          # tf.foo(arg1=0, arg2=1, ...)
          # to 2.0. Then, checks that converted function has valid argument names.
          if not hasattr(tf.compat, "v2"):
      Severity: Minor
      Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py - About 7 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 test_import_analysis has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def test_import_analysis(self):
          old_symbol = "tf.conj(a)"
          new_symbol = "tf.math.conj(a)"
      
          # We upgrade the base un-versioned tensorflow aliased as tf
      Severity: Major
      Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py - About 2 hrs to fix

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

          def testAllAPIV1(self):
            collect = True
            v1_symbols = set([])
        
            # Converts all symbols in the v1 namespace to the v2 namespace, raising
        Severity: Minor
        Found in tensorflow/tools/compatibility/tf_upgrade_v2_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 setUpClass has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def setUpClass(cls):
            super(TestUpgrade, cls).setUpClass()
            cls.v2_symbols = {}
            cls.v1_symbols = {}
            if hasattr(tf.compat, "v2"):
        Severity: Minor
        Found in tensorflow/tools/compatibility/tf_upgrade_v2_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 test_import_rename_analysis has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def test_import_rename_analysis(self):
            old_symbol = "tf.conj(a)"
            new_symbol = "tf.math.conj(a)"
        
            import_header = "import tensorflow as tf\n"
        Severity: Major
        Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py - About 2 hrs to fix

          Function testV1KeywordArgNames has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def testV1KeywordArgNames(self):
              all_keyword_renames = (
                  tf_upgrade_v2.TFAPIChangeSpec().function_keyword_renames)
          
              # Visitor that verifies V1 argument names.
          Severity: Minor
          Found in tensorflow/tools/compatibility/tf_upgrade_v2_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 testAllAPI has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def testAllAPI(self):
              if not hasattr(tf.compat, "v2"):
                return
          
              # Converts all symbols in the v1 namespace to the v2 namespace, raising
          Severity: Minor
          Found in tensorflow/tools/compatibility/tf_upgrade_v2_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 testPositionsMatchArgGiven has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def testPositionsMatchArgGiven(self):
              full_dict = tf_upgrade_v2.TFAPIChangeSpec().function_arg_warnings
              method_names = list(full_dict.keys())
              for method_name in method_names:
                args = list(full_dict[method_name].keys())
          Severity: Minor
          Found in tensorflow/tools/compatibility/tf_upgrade_v2_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_api_spec_reset_between_files has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def test_api_spec_reset_between_files(self,
          Severity: Minor
          Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py - About 35 mins to fix

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              def testArgmin(self):
                text = "tf.argmin(input, name=n, dimension=1, output_type=type)"
                expected_text = "tf.argmin(input, name=n, axis=1, output_type=type)"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 3 other locations - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 977..996
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1090..1118
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1860..1881

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 150.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              def test_sdca_to_raw_ops(self):
                text = "tf.train.sdca_fprint(input_tensor)"
                expected_text = "tf.raw_ops.SdcaFprint(input_tensor)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 3 other locations - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 956..975
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 977..996
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1090..1118

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 150.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              def testSoftMaxCrossEntropyWithLogitsDoesntNest(self):
                text = ("tf.nn.softmax_cross_entropy_with_logits("
                        "labels=tf.stop_gradient(labels), logits=logits, dim=2)")
                expected_text = (
                    "tf.nn.softmax_cross_entropy_with_logits("
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 3 other locations - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 956..975
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 977..996
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1860..1881

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 150.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

              def testArgmax(self):
                text = "tf.argmax(input, name=n, dimension=1, output_type=type)"
                expected_text = "tf.argmax(input, name=n, axis=1, output_type=type)"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 3 other locations - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 956..975
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1090..1118
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1860..1881

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 150.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                for name in [
                    "assert_greater", "assert_equal", "assert_none_equal", "assert_less",
                    "assert_negative", "assert_positive", "assert_non_negative",
                    "assert_non_positive", "assert_near", "assert_less",
                    "assert_less_equal", "assert_greater", "assert_greater_equal",
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1445..1456

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 129.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                for name in ["assert_rank", "assert_rank_at_least", "assert_rank_in"]:
                  text = "tf.%s(a)" % name
                  expected_text = "tf.compat.v1.%s(a)" % name
                  _, report, unused_errors, new_text = self._upgrade(text)
                  self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1425..1442

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 129.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testContribL2(self):
                text = "tf.contrib.layers.l2_regularizer(scale)\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(
                    new_text,
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 770..798

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 129.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testContribL1(self):
                text = "tf.contrib.layers.l1_regularizer(scale)\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(
                    new_text,
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 800..828

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 129.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if hasattr(tf.compat, "v2"):
            
                  def symbol_collector(unused_path, unused_parent, children):
                    for child in children:
                      _, attr = tf_decorator.unwrap(child[1])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 101..112

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if hasattr(tf.compat, "v1"):
            
                  def symbol_collector_v1(unused_path, unused_parent, children):
                    for child in children:
                      _, attr = tf_decorator.unwrap(child[1])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 day to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 88..99

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 122.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testSparseSplit(self):
                text = (
                    "tf.sparse_split(sp_input=sp_input, num_split=num_split, axis=axis, "
                    "name=name)")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 7 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 107..121
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1010..1026

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 114.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testBatchToSpace(self):
                text = "tf.batch_to_space_nd(input, block_shape, crops, name)"
                expected_text = "tf.batch_to_space(input, block_shape, crops, name)"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 7 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 107..121
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1264..1290

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 114.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testInplaceEmptyOutputOnError(self):
                """In place file becomes empty when parsing error is not handled."""
                temp_file = tempfile.NamedTemporaryFile("w", delete=False)
                original = "print 'a' \n"
                upgraded = ""
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 7 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 132..144
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 2196..2206

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 110.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testInplace(self):
                """Check to make sure we don't have a file system race."""
                temp_file = tempfile.NamedTemporaryFile("w", delete=False)
                original = "tf.conj(a)\n"
                upgraded = "tf.math.conj(a)\n"
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 7 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 132..144
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 2221..2231

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 110.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testCast(self):
                for (name, dtype) in [("int32", "int32"),
                                      ("int64", "int64"),
                                      ("float", "float32"),
                                      ("double", "float64"),
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1368..1379

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testCastPositionalSecondArgument(self):
                for (name, dtype) in [("int32", "int32"),
                                      ("int64", "int64"),
                                      ("float", "float32"),
                                      ("double", "float64"),
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1355..1366

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_summary_image(self):
                text = "tf.contrib.summary.image('foo', myval, red, 3, 'fam', 42)"
                expected = ("tf.compat.v2.summary.image(name='foo', data=myval, "
                            "max_outputs=3, step=42)")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1550..1559
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1598..1606

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 90.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_summary_generic_nostep(self):
                text = "tf.contrib.summary.generic('foo', myval)"
                expected = ("tf.compat.v2.summary.write(tag='foo', data=myval, "
                            "step=tf.compat.v1.train.get_or_create_global_step())")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1550..1559
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1579..1587

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 90.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_summary_generic(self):
                text = "tf.contrib.summary.generic('foo', myval, meta, 'fam', 42)"
                expected = ("tf.compat.v2.summary.write(tag='foo', data=myval, "
                            "metadata=meta, step=42)")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1579..1587
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1598..1606

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 90.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testColocateGradientsWithOpsMinimize(self):
                text = "optimizer.minimize(a, foo=False)\n"
                _, unused_report, errors, new_text = self._upgrade(text)
                self.assertEqual(text, new_text)
                self.assertEqual(errors, [])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 939..948

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testColocateGradientsWithOpsComputeGradients(self):
                text = "optimizer.compute_gradients(a, foo=False)\n"
                _, unused_report, errors, new_text = self._upgrade(text)
                self.assertEqual(text, new_text)
                self.assertEqual(errors, [])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 5 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 928..937

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def testConv2D(self):
                text = (
                    "tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu, "
                    "data_format)")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 998..1008
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1074..1088
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1195..1206
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1762..1773
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1899..1908
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1987..1997

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def testAutograph(self):
                text = "tf.autograph.to_graph(f, True, arg_values=None, arg_types=None)"
                expected_text = "tf.autograph.to_graph(f, True)"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1074..1088
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1156..1172
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1195..1206
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1762..1773
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1899..1908
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1987..1997

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def test_load_variable(self):
                text = "tf.contrib.framework.load_variable('a')"
                expected_text = (
                    "tf.train.load_variable('a')")
                _, _, _, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 998..1008
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1074..1088
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1156..1172
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1195..1206
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1762..1773
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1899..1908

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def test_uniform_unit_scaling_initializer(self):
                text = "tf.uniform_unit_scaling_initializer(0.5)"
                expected_text = ("tf.compat.v1.keras.initializers.VarianceScaling("
                                 "scale=0.5, distribution=\"uniform\")")
                _, _, _, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 998..1008
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1074..1088
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1156..1172
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1195..1206
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1899..1908
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1987..1997

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def testSpacetoBatch(self):
                text = "tf.space_to_batch_nd(input, shape, paddings, name)"
                expected_text = "tf.space_to_batch(input, shape, paddings, name)"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 998..1008
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1074..1088
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1156..1172
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1762..1773
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1899..1908
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1987..1997

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def testXlaExperimental(self):
                text = "tf.xla.experimental.jit_scope(0)"
                expected_text = "tf.xla.experimental.jit_scope(0)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 998..1008
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1074..1088
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1156..1172
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1195..1206
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1762..1773
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1987..1997

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

              def testSoftMaxCrossEntropyWithLogits(self):
                text = ("tf.nn.softmax_cross_entropy_with_logits("
                        "labels=labels, logits=logits, dim=2)")
                expected_text = (
                    "tf.nn.softmax_cross_entropy_with_logits("
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 6 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 998..1008
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1156..1172
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1195..1206
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1762..1773
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1899..1908
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1987..1997

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_audio(self):
                text = "tf.contrib.summary.audio('foo', myval, 44100, 3, 'fam', 42)"
                expected = ("tf.compat.v2.summary.audio(name='foo', data=myval, "
                            "sample_rate=44100, max_outputs=3, step=42)")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def testCond(self):
                text = "tf.cond(a, b, c, True, d)"
                expected_text = "tf.cond(a, b, c, name=d)"
                _, unused_report, errors, new_text = self._upgrade(text)
                self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_audio_nostep(self):
                text = "tf.contrib.summary.audio('foo', myval, 44100)"
                expected = ("tf.compat.v2.summary.audio(name='foo', data=myval, "
                            "sample_rate=44100, "
                            "step=tf.compat.v1.train.get_or_create_global_step())")
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_histogram_nostep(self):
                text = "tf.contrib.summary.histogram('foo', myval)"
                expected = ("tf.compat.v2.summary.histogram(name='foo', data=myval, "
                            "step=tf.compat.v1.train.get_or_create_global_step())")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_histogram(self):
                text = "tf.contrib.summary.histogram('foo', myval, 'fam', 42)"
                expected = ("tf.compat.v2.summary.histogram(name='foo', data=myval, "
                            "step=42)")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_image_nostep(self):
                text = "tf.contrib.summary.image('foo', myval)"
                expected = ("tf.compat.v2.summary.image(name='foo', data=myval, "
                            "step=tf.compat.v1.train.get_or_create_global_step())")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_scalar_nostep(self):
                text = "tf.contrib.summary.scalar('foo', myval)"
                expected = ("tf.compat.v2.summary.scalar(name='foo', data=myval, "
                            "step=tf.compat.v1.train.get_or_create_global_step())")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_scalar(self):
                text = "tf.contrib.summary.scalar('foo', myval, 'fam', 42)"
                expected = ("tf.compat.v2.summary.scalar(name='foo', data=myval, "
                            "step=42)")
                _, _, errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1663..1671

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def test_contrib_summary_create_file_writer(self):
                text = ("tf.contrib.summary.create_file_writer('my_logdir', 0, 1000, "
                        "'.foo', 'shared-name')")
                expected = ("tf.compat.v2.summary.create_file_writer(logdir='my_logdir', "
                            "max_queue=0, flush_millis=1000, filename_suffix='.foo')")
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 4 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1400..1406
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1561..1568
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1570..1577
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1589..1596
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1608..1616
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1618..1625
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1627..1634
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1636..1643

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 74.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_to_addons_move(self):
                small_mapping = {
                    "tf.contrib.layers.poincare_normalize":
                        "tfa.layers.PoincareNormalize",
                    "tf.contrib.layers.maxout":
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 3 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 154..168
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 181..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                for l in losses:
                  text = "tf.losses." + l + "(a, b)"
                  _, report, unused_errors, new_text = self._upgrade(text)
                  self.assertEqual("tf.compat.v1.losses." + l + "(a, b)", new_text)
                  self.assertIn(
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 3 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 653..658

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                for m in metrics:
                  text = "tf.metrics." + m + "(a, b)"
                  _, report, unused_errors, new_text = self._upgrade(text)
                  self.assertEqual("tf.compat.v1.metrics." + m + "(a, b)", new_text)
                  self.assertIn(
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 3 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 679..684

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 71.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testRenameConstant(self):
                text = "tf.MONOLITHIC_BUILD\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, "tf.sysconfig.MONOLITHIC_BUILD\n")
                text = "some_call(tf.MONOLITHIC_BUILD)\n"
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 3 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 61..67
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 155..161

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 68.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testRename(self):
                text = "tf.conj(a)\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, "tf.math.conj(a)\n")
                text = "tf.rsqrt(tf.log_sigmoid(3.8))\n"
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 3 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 61..67
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 403..409

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 68.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_saved_model_loader_load(self):
                text = "tf.saved_model.loader.load(sess, ['foo_graph'])"
                expected = "tf.compat.v1.saved_model.load(sess, ['foo_graph'])"
                _, report, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 2 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1038..1050
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1734..1740

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_saved_model_load(self):
                text = "tf.saved_model.load(sess, ['foo_graph'])"
                expected = "tf.compat.v1.saved_model.load(sess, ['foo_graph'])"
                _, report, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 2 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1038..1050
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1742..1748

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def testKerasSavedModel(self):
                text = (
                    "tf.contrib.saved_model.save_keras_model(model, './saved_models')\n"
                    "tf.contrib.saved_model.load_keras_model(saved_model_path)\n")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 2 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1734..1740
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1742..1748

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                for symbol in api_symbols:
                  text = "tf.contrib.rnn." + symbol
                  expected_text = "tf.compat.v1.nn." + symbol
                  _, _, _, new_text = self._upgrade(text)
                  self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 2 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1535..1539

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 54.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                for symbol in api_symbols:
                  text = "tf.contrib.rnn." + symbol
                  expected_text = "tf.compat.v1.nn.rnn_cell." + symbol
                  _, _, _, new_text = self._upgrade(text)
                  self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 2 hrs to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1544..1548

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 54.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_summary_import_event(self):
                text = "tf.contrib.summary.import_event(my_event)"
                _, _, errors, _ = self._upgrade(text)
                expected_error = "tf.compat.v2.summary.experimental.write_raw_pb"
                self.assertIn(expected_error, errors[0])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1645..1649
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1685..1689

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_summary_graph(self):
                text = "tf.contrib.summary.graph(my_graph)"
                _, _, errors, _ = self._upgrade(text)
                expected_error = "tf.compat.v2.summary.trace"
                self.assertIn(expected_error, errors[0])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1651..1655
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1685..1689

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

              def test_contrib_summary_record_summaries_every_n_global_steps(self):
                text = "tf.contrib.summary.record_summaries_every_n_global_steps(10)"
                _, _, errors, _ = self._upgrade(text)
                expected_error = "replaced by a call to tf.compat.v2.summary.record_if()"
                self.assertIn(expected_error, errors[0])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 2 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1645..1649
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1651..1655

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testDepthToSpace(self):
                text = "tf.nn.depth_to_space(input, block_size, name, data_format)"
                expected_text = (
                    "tf.nn.depth_to_space(input, block_size, name=name, "
                    "data_format=data_format)")
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testInTopK(self):
                text = "tf.math.in_top_k(a, b, c, n)"
                expected_text = (
                    "tf.math.in_top_k(predictions=a, targets=b, k=c, name=n)")
                _, unused_report, unused_errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_is_tensor_upgrade(self):
                text = "tf.contrib.framework.is_tensor(x)"
                expected = "tf.is_tensor(x)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_contrib_summary_always_record_summaries(self):
                text = "tf.contrib.summary.always_record_summaries()"
                expected = "tf.compat.v2.summary.record_if(True)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testSpaceToDepth(self):
                text = "tf.nn.space_to_depth(input, block_size, name, data_format)"
                expected_text = ("tf.nn.space_to_depth(input, block_size, name=name, "
                                 "data_format=data_format)")
                _, unused_report, unused_errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testNnDilation2d(self):
                text = "tf.nn.dilation2d(v, k, s, r, p)"
                expected_text = "tf.nn.dilation2d(v, k, s, r, p, data_format='NHWC')"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testSparseAdd(self):
                text = "tf.sparse.add(a, b, thresh=t)"
                expected_text = "tf.sparse.add(a, b, threshold=t)"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testSparseConcat(self):
                text = "tf.sparse.concat(ax, inp, name, exp, concat)"
                expected_text = (
                    "tf.sparse.concat(ax, inp, name=name, expand_nonconcat_dims=exp, "
                    "axis=concat)")
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testNnInTopK(self):
                text = "tf.nn.in_top_k(predictions, targets, k, name)"
                expected_text = ("tf.nn.in_top_k(predictions=predictions, "
                                 "targets=targets, k=k, name=name)")
                _, unused_report, unused_errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_contrib_summary_never_record_summaries(self):
                text = "tf.contrib.summary.never_record_summaries()"
                expected = "tf.compat.v2.summary.record_if(False)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testConv2DBackpropInput(self):
                text = (
                    "tf.nn.conv2d_backprop_input(input_sizes, filter, out_backprop, "
                    "strides, padding, use_cudnn_on_gpu, data_format)")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_assert_equal_graph_def(self):
                text = ("tf.test.assert_equal_graph_def(a, b, checkpoint_v2=x, "
                        "hash_table_shared_name=y)")
                expected = "tf.test.assert_equal_graph_def(actual=a, expected=b)"
                _, _, _, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testEmbeddingLookupSparse(self):
                text = ("tf.nn.embedding_lookup_sparse(params, sp_ids, sp_weights, "
                        "partition_strategy, name, combiner, max_norm)")
                expected_text = ("tf.nn.embedding_lookup_sparse(params, sp_ids, "
                                 "sp_weights, partition_strategy=partition_strategy, "
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testStatelessMultinomial(self):
                text = (
                    "tf.random.stateless_multinomial(logits, num_samples, seed, "
                    "output_dtype=dtype, name=name)")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_contrib_framework_argsort(self):
                text = "tf.contrib.framework.argsort"
                expected = "tf.argsort"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_contrib_summary_flush(self):
                text = "tf.contrib.summary.flush(writer=foo)"
                expected = "tf.compat.v2.summary.flush(writer=foo)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_avg_pool_2d(self):
                text = "tf.nn.avg_pool(value=4)"
                expected_text = "tf.nn.avg_pool2d(input=4)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testNnErosion2d(self):
                text = "tf.nn.erosion2d(v, k, s, r, p)"
                expected_text = "tf.nn.erosion2d(v, k, s, r, p, data_format='NHWC')"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(new_text, expected_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testSparseMatmul(self):
                text = ("tf.sparse_matmul(a, b, c, d, e, f, g)\n")
                expected_text = ("tf.linalg.matmul(a, b, c, d, a_is_sparse=e, "
                                 "b_is_sparse=f, name=g)\n")
                _, unused_report, unused_errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testConv2DBackpropFilter(self):
                text = (
                    "tf.nn.conv2d_backprop_filter(input, filter_sizes, out_backprop, "
                    "strides, padding, use_cudnn_on_gpu, data_format)")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testEmbeddingLookup(self):
                text = ("tf.nn.embedding_lookup(params, ids, partition_strategy, name, "
                        "validate_indices, max_norm)")
                expected_text = ("tf.nn.embedding_lookup(params, ids, "
                                 "partition_strategy=partition_strategy, name=name, "
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testParens(self):
                text = """
            def _log_prob(self, x):
              return tf.debugging.assert_all_finite(
                  (self.mixture_distribution.logits + self.distribution.log_prob(
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_is_tensor_direct_import_upgrade(self):
                text = "contrib_framework.is_tensor(x)"
                expected = "tf.is_tensor(x)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testExtractImagePatches(self):
                text = (
                    "tf.extract_image_patches(images, ksizes=ksizes, strides=strides,"
                    "rates=rates, padding=padding, name=name)")
                expected_text = (
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testWeightedMoments(self):
                text = "tf.nn.weighted_moments(x, axes, freq, name, kd)"
                expected_text = (
                    "tf.nn.weighted_moments(x, axes, freq, name=name, keepdims=kd)")
                _, unused_report, unused_errors, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_max_pool_2d(self):
                text = "tf.nn.max_pool(value=4)"
                expected_text = "tf.nn.max_pool2d(input=4)"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected_text, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testSeparableConv2D(self):
                text = "tf.nn.separable_conv2d(inp, d, pt, strides, pad, rate, name, fmt)"
                expected_text = (
                    "tf.nn.separable_conv2d(inp, d, pt, strides, pad, dilations=rate, "
                    "name=name, data_format=fmt)")
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_contrib_initialize(self):
                text = "tf.contrib.summary.initialize"
                expected = "tf.compat.v1.summary.initialize"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_app_flags(self):
                text = "flags = tf.app.flags"
                expected = "flags = tf.compat.v1.app.flags"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def testRecomputeGrad(self):
                text = "tf.contrib.layers.recompute_grad()"
                expected = "tf.recompute_grad()"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_contrib_summary_all_summary_ops(self):
                text = "tf.contrib.summary.all_summary_ops()"
                expected = "tf.compat.v1.summary.all_v2_summary_ops()"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_CriticalSection_upgrade(self):
                text = "tf.contrib.framework.CriticalSection(shared_name='blah')"
                expected = "tf.CriticalSection(shared_name='blah')"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_sample_distorted_bounding_box(self):
                text = ("tf.image.sample_distorted_bounding_box(a, b, c, d, e, f, g, h, i, "
                        "j)")
                expected = ("tf.image.sample_distorted_bounding_box(a, b, c, "
                            "min_object_covered=e, aspect_ratio_range=f, area_range=g, "
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_saved_model_load_v2(self):
                text = "tf.saved_model.load_v2('/tmp/blah')"
                expected = "tf.compat.v2.saved_model.load('/tmp/blah')"
                _, _, _, new_text = self._upgrade(text)
                self.assertEqual(expected, new_text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1974..1979
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 36 locations. Consider refactoring.
            Open

              def test_decode_raw(self):
                text = "tf.io.decode_raw(bytes=[1,2,3], output_dtype=tf.int32)"
                expected_text = (
                    "tf.io.decode_raw(input_bytes=[1,2,3], output_dtype=tf.int32)")
                _, _, _, new_text = self._upgrade(text)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 35 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 86..105
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1028..1036
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1052..1060
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1120..1125
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1127..1132
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1134..1138
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1140..1146
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1148..1154
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1174..1182
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1184..1193
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1208..1213
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1215..1221
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1223..1230
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1232..1239
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1241..1246
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1248..1253
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1408..1422
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1458..1463
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1465..1469
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1471..1475
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1477..1481
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1483..1490
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1492..1496
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1498..1502
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1526..1530
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1657..1661
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1673..1677
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1679..1683
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1691..1695
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1728..1732
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1750..1754
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1756..1760
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1910..1914
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1916..1920
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1981..1985

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

              def testConvolutionOpUpdate(self):
                text = (
                    "tf.nn.convolution(input, filter, padding, strides, dilation_rate, "
                    "name, data_format)"
                )
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 5 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 35..39
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 838..848
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 850..860
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1722..1726
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 2187..2191

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

              def test_keras_experimental_export_warning(self):
                text = "tf.keras.experimental.export_saved_model"
                _, report, _, _ = self._upgrade(text)
                expected_info = "Please use model.save"
                self.assertIn(expected_info, report)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 5 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 35..39
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 838..848
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 850..860
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 892..903
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1722..1726

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

              def testMathCountNonZeroChanges(self):
                text = (
                    "tf.math.count_nonzero(input_tensor=input, dtype=dtype, name=name, "
                    "reduction_indices=axis, keep_dims=keepdims)\n"
                    )
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 5 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 35..39
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 850..860
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 892..903
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1722..1726
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 2187..2191

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

              def testCountNonZeroChanges(self):
                text = (
                    "tf.count_nonzero(input_tensor=input, dtype=dtype, name=name, "
                    "reduction_indices=axis, keep_dims=keepdims)\n"
                    )
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 5 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 35..39
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 838..848
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 892..903
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1722..1726
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 2187..2191

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

              def test_summary_api_warning(self):
                text = "tf.summary.scalar('foo', 42)"
                _, report, _, _ = self._upgrade(text)
                expected_info = "TF 1.x summary API cannot be automatically migrated"
                self.assertIn(expected_info, report)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 5 other locations - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_safety_test.py on lines 35..39
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 838..848
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 850..860
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 892..903
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 2187..2191

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def testReport(self):
                text = "tf.angle(a)\n"
                _, report, unused_errors, unused_new_text = self._upgrade(text)
                # This is not a complete test, but it is a sanity test that a report
                # is generating information.
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 49..54

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 42.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

              def testParseError(self):
                _, report, unused_errors, unused_new_text = self._upgrade(
                    "import tensorflow as tf\na + \n")
                self.assertNotEqual(report.find("Failed to parse"), -1)
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 44..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 38.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def test_flags_flags(self):
                _, _, errors, _ = self._upgrade("tf.flags.FLAGS")
                self.assertIn("tf.flags and tf.app.flags have been removed", errors[0])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1504..1506

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 38.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def test_flags_bare(self):
                _, _, errors, _ = self._upgrade("tf.flags")
                self.assertIn("tf.flags and tf.app.flags have been removed", errors[0])
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 1 hr to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1508..1510

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 38.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def testRenameArgs(self):
                text = ("tf.nn.pool(input_a, window_shape_a, pooling_type_a, padding_a, "
                        "dilation_rate_a, strides_a, name_a, data_format_a)\n")
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text,
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 55 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 56..59
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 69..72
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 86..90
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 92..97
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 100..103
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 421..424
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 762..767
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 830..835

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 37.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def testDropoutExpr(self):
                text = "tf.nn.dropout(x, 1 - func(3 + 4.), name=\"foo\")\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(
                    new_text,
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 55 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 56..59
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 69..72
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 86..90
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 92..97
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 100..103
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 411..416
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 421..424
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 830..835

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 37.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def testContribL2Expr(self):
                text = "tf.contrib.layers.l2_regularizer(1 - func(3 + 4.), scope=\"foo\")\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(
                    new_text,
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 55 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 56..59
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 69..72
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 86..90
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 92..97
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 100..103
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 411..416
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 421..424
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 762..767

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 37.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 9 locations. Consider refactoring.
            Open

              def testReorder(self):
                text = "tf.boolean_mask(a, b, c, d)\n"
                _, unused_report, unused_errors, new_text = self._upgrade(text)
                self.assertEqual(new_text, "tf.boolean_mask(a, b, name=c, axis=d)\n")
            Severity: Major
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 8 other locations - About 55 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 56..59
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 69..72
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 86..90
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 92..97
            tensorflow/tools/compatibility/tf_upgrade_test.py on lines 100..103
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 411..416
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 762..767
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 830..835

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 37.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def test_contrib_rnn_deprecation(self):
                _, report, _, _ = self._upgrade("tf.contrib.rnn")
                self.assertIn("tf.contrib.rnn.* has been deprecated", report)
            Severity: Minor
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 30 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1522..1524

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 32.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                      for new_arg in new_args:
                        self.assertIn(
                            new_arg, args_v1,
                            "Invalid argument '%s' in 1.0 when converting\n%s\nto\n%s.\n"
                            "Supported arguments: %s" % (
            Severity: Minor
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 30 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 319..324

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 32.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                      for new_arg in new_args:
                        self.assertIn(
                            new_arg, args_v2,
                            "Invalid argument '%s' in 2.0 when converting\n%s\nto\n%s.\n"
                            "Supported arguments: %s" % (
            Severity: Minor
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 30 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 331..336

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 32.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def test_contrib_cudnn_rnn_deprecation(self):
                _, report, _, _ = self._upgrade("tf.contrib.cudnn_rnn")
                self.assertIn("tf.contrib.cudnn_rnn.* has been deprecated", report)
            Severity: Minor
            Found in tensorflow/tools/compatibility/tf_upgrade_v2_test.py and 1 other location - About 30 mins to fix
            tensorflow/tools/compatibility/tf_upgrade_v2_test.py on lines 1518..1520

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 32.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status