tensorflow/tensorflow

View on GitHub
tensorflow/python/training/basic_session_run_hooks_test.py

Summary

Maintainability
F
3 wks
Test Coverage

File basic_session_run_hooks_test.py has 1323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# pylint: disable=g-bad-file-header
# Copyright 2016 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.
Severity: Major
Found in tensorflow/python/training/basic_session_run_hooks_test.py - About 3 days to fix

    CheckpointSaverHookTest has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CheckpointSaverHookTest(test.TestCase):
    
      def setUp(self):
        self.model_dir = tempfile.mkdtemp()
        self.graph = ops.Graph()
    Severity: Minor
    Found in tensorflow/python/training/basic_session_run_hooks_test.py - About 2 hrs to fix

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

        def test_save_steps_saves_periodically(self):
          with self.graph.as_default():
            hook = basic_session_run_hooks.CheckpointSaverHook(
                self.model_dir, save_steps=2, scaffold=self.scaffold)
            hook.begin()
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 2 days to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 677..706

      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 238.

      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 test_save_steps_saves_periodically(self):
          with self.graph.as_default():
            hook = basic_session_run_hooks.CheckpointSaverHook(
                self.model_dir, save_steps=2, scaffold=self.scaffold)
            hook.begin()
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 2 days to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 922..951

      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 238.

      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

        @test.mock.patch.object(time, 'time')
        def test_steps_per_run_equal_every_n_steps(self, mock_time):
          mock_time.return_value = MOCK_START_TIME
          with ops.Graph().as_default() as g, session_lib.Session() as sess:
            self._setup_steps_per_run_test(5, 5, g, sess)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 day to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1136..1158

      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 217.

      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

        @test.mock.patch.object(time, 'time')
        def test_steps_per_run_greater_than_every_n_steps(self, mock_time):
          mock_time.return_value = MOCK_START_TIME
          with ops.Graph().as_default() as g, session_lib.Session() as sess:
            self._setup_steps_per_run_test(5, 10, g, sess)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 day to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1112..1134

      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 217.

      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 test_save_steps(self):
          hook = basic_session_run_hooks.SummarySaverHook(
              save_steps=8,
              summary_writer=self.summary_writer,
              summary_op=self.summary_op)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 day to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1459..1486

      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

        def test_save_steps(self):
          hook = basic_session_run_hooks.SummarySaverHook(
              save_steps=8,
              summary_writer=self.summary_writer,
              summary_op=self.summary_op)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 day to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1198..1225

      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 2 locations. Consider refactoring.
      Open

        def test_save_steps_saves_in_first_step(self):
          with self.graph.as_default():
            hook = basic_session_run_hooks.CheckpointSaverHook(
                self.model_dir, save_steps=2, scaffold=self.scaffold)
            hook.begin()
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 day to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 425..437

      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 125.

      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_save_secs_saves_in_first_step(self):
          with self.graph.as_default():
            hook = basic_session_run_hooks.CheckpointSaverHook(
                self.model_dir, save_secs=2, scaffold=self.scaffold)
            hook.begin()
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 day to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 663..675

      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 125.

      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

            with session_lib.Session() as sess:
              sess.run(self.scaffold.init_op)
              mon_sess = monitored_session._HookedSession(sess, [hook])
              mon_sess.run(self.train_op)
              mon_sess.run(self.train_op)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 900..908

      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 91.

      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

            with session_lib.Session() as sess:
              sess.run(self.scaffold.init_op)
              mon_sess = monitored_session._HookedSession(sess, [hook])
              mon_sess.run(self.train_op)
              mon_sess.run(self.train_op)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 5 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 714..722

      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 91.

      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

          with self.cached_session() as sess:
            hook.begin()
            self.evaluate(variables_lib.global_variables_initializer())
            mon_sess = monitored_session._HookedSession(sess, [hook])
            for _ in range(4):
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1301..1308

      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 83.

      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

          with self.cached_session() as sess:
            hook.begin()
            self.evaluate(variables_lib.global_variables_initializer())
            mon_sess = monitored_session._HookedSession(sess, [hook])
            for _ in range(8):
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1266..1273

      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 83.

      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

        @test.mock.patch.object(time, 'time')
        def test_print_every_n_secs_and_end(self, mock_time):
          with ops.Graph().as_default(), session_lib.Session() as sess:
            mock_time.return_value = MOCK_START_TIME
            self._validate_print_every_n_secs(sess, at_end=True, mock_time=mock_time)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 352..358

      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 81.

      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

        @test.mock.patch.object(time, 'time')
        def test_print_every_n_secs(self, mock_time):
          with ops.Graph().as_default(), session_lib.Session() as sess:
            mock_time.return_value = MOCK_START_TIME
            self._validate_print_every_n_secs(sess, at_end=False, mock_time=mock_time)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 360..366

      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 81.

      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_save_steps_does_not_save_in_first_step(self):
          with self.graph.as_default():
            hook = basic_session_run_hooks.ProfilerHook(
                save_steps=1, output_dir=self.output_dir)
            with monitored_session.SingularMonitoredSession(hooks=[hook]) as sess:
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1533..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 75.

      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_save_secs_does_not_save_in_first_step(self):
          with self.graph.as_default():
            hook = basic_session_run_hooks.ProfilerHook(
                save_secs=2, output_dir=self.output_dir)
            with monitored_session.SingularMonitoredSession(hooks=[hook]) as sess:
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 4 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1568..1574

      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 75.

      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

            with monitored_session.SingularMonitoredSession(
                hooks=[hook],
                checkpoint_dir=self.model_dir) as sess:
              sess.run(train_op)
              sess.run(train_op)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 517..522

      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

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

            with monitored_session.SingularMonitoredSession(
                hooks=[hook],
                checkpoint_dir=self.model_dir) as sess:
              sess.run(train_op)
              sess.run(train_op)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 549..554

      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

        def test_print_every_n_steps_and_end(self):
          with ops.Graph().as_default(), session_lib.Session() as sess:
            self._validate_print_every_n_steps(sess, at_end=True)
            # Verify proper reset.
            self._validate_print_every_n_steps(sess, at_end=True)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 294..298

      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

        def test_print_every_n_steps(self):
          with ops.Graph().as_default(), session_lib.Session() as sess:
            self._validate_print_every_n_steps(sess, at_end=False)
            # Verify proper reset.
            self._validate_print_every_n_steps(sess, at_end=False)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 300..304

      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

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

          with ops.Graph().as_default():
            global_step = training_util.get_or_create_global_step()
            with monitored_session.SingularMonitoredSession(
                checkpoint_dir=self.model_dir) as sess2:
              global_step_saved_val = sess2.run(global_step)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 566..570

      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

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

          with ops.Graph().as_default():
            global_step = training_util.get_or_create_global_step()
            with monitored_session.SingularMonitoredSession(
                checkpoint_dir=self.model_dir) as sess2:
              global_step_saved_val = sess2.run(global_step)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 532..536

      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

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

          if at_end:
            self.assertRegex(str(self.logged_message), t.name)
          else:
            # assertNotRegexpMatches is not supported by python 3.1 and later
            self.assertEqual(str(self.logged_message).find(t.name), -1)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 346..350

      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 47.

      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

          if at_end:
            self.assertRegex(str(self.logged_message), t.name)
          else:
            # assertNotRegexpMatches is not supported by python 3.1 and later
            self.assertEqual(str(self.logged_message).find(t.name), -1)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 288..292

      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 47.

      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 _ in range(3):
              mon_sess.run(train_op)
              # assertNotRegexpMatches is not supported by python 3.1 and later
              self.assertEqual(str(self.logged_message).find(t.name), -1)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 273..276

      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 43.

      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 _ in range(9):
              mon_sess.run(train_op)
              # assertNotRegexpMatches is not supported by python 3.1 and later
              self.assertEqual(str(self.logged_message).find(t.name), -1)
      Severity: Major
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 252..255

      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 43.

      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

            with session_lib.Session() as session:
              hook.end(session)
              self.assertListEqual(expected_values,
                                   hook.final_ops_values.tolist())
      Severity: Minor
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 45 mins to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1402..1405

      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 35.

      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

            with session_lib.Session() as session:
              hook.end(session)
              self.assertListEqual(expected_values,
                                   hook.final_ops_values.tolist())
      Severity: Minor
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 45 mins to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1436..1439

      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 35.

      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

        @test_util.run_deprecated_v1
        def test_raise_in_both_secs_and_steps(self):
          with self.assertRaises(ValueError):
            basic_session_run_hooks.SecondOrStepTimer(every_secs=2.0, every_steps=10)
      Severity: Minor
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 40 mins to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 1523..1526

      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 34.

      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

        @test_util.run_deprecated_v1
        def test_raise_in_both_secs_and_steps(self):
          with self.assertRaises(ValueError):
            basic_session_run_hooks.ProfilerHook(save_secs=10, save_steps=20)
      Severity: Minor
      Found in tensorflow/python/training/basic_session_run_hooks_test.py and 1 other location - About 40 mins to fix
      tensorflow/python/training/basic_session_run_hooks_test.py on lines 90..93

      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 34.

      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