tensorflow/tensorflow

View on GitHub
tensorflow/python/feature_column/feature_column.py

Summary

Maintainability
F
1 mo
Test Coverage

File feature_column.py has 2592 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in tensorflow/python/feature_column/feature_column.py - About 1 wk to fix

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

    def _internal_input_layer(features,
                              feature_columns,
                              weight_collections=None,
                              trainable=True,
                              cols_to_vars=None,
    Severity: Minor
    Found in tensorflow/python/feature_column/feature_column.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 _categorical_column_with_vocabulary_file has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _categorical_column_with_vocabulary_file(key,
                                                 vocabulary_file,
                                                 vocabulary_size=None,
                                                 num_oov_buckets=0,
                                                 default_value=None,
    Severity: Minor
    Found in tensorflow/python/feature_column/feature_column.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 _get_dense_tensor_internal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def _get_dense_tensor_internal(self,
                                     inputs,
                                     weight_collections=None,
                                     trainable=None):
        """Private method that follows the signature of _get_dense_tensor."""
    Severity: Minor
    Found in tensorflow/python/feature_column/feature_column.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 _embedding_column has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _embedding_column(categorical_column,
    Severity: Major
    Found in tensorflow/python/feature_column/feature_column.py - About 1 hr to fix

      Function __new__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def __new__(cls,
      Severity: Major
      Found in tensorflow/python/feature_column/feature_column.py - About 1 hr to fix

        Function _normalize_feature_columns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def _normalize_feature_columns(feature_columns):
          """Normalizes the `feature_columns` input.
        
          This method converts the `feature_columns` to list type as best as it can. In
          addition, verifies the type and other parts of feature_columns, required by
        Severity: Minor
        Found in tensorflow/python/feature_column/feature_column.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 _categorical_column_with_vocabulary_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def _categorical_column_with_vocabulary_list(key,
                                                     vocabulary_list,
                                                     dtype=None,
                                                     default_value=-1,
                                                     num_oov_buckets=0):
        Severity: Minor
        Found in tensorflow/python/feature_column/feature_column.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 _internal_input_layer has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _internal_input_layer(features,
        Severity: Major
        Found in tensorflow/python/feature_column/feature_column.py - About 1 hr to fix

          Function make_parse_example_spec has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def make_parse_example_spec(feature_columns):
            """Creates parsing spec dictionary from input feature_columns.
          
            The returned dictionary can be used as arg 'features' in
            `tf.io.parse_example`.
          Severity: Minor
          Found in tensorflow/python/feature_column/feature_column.py - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function _add_to_collections has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _add_to_collections(var, weight_collections):
            """Adds a var to the list of weight_collections provided.
          
            Handles the case for partitioned and non-partitioned variables.
          
          
          Severity: Minor
          Found in tensorflow/python/feature_column/feature_column.py - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          def linear_model(features,
          Severity: Major
          Found in tensorflow/python/feature_column/feature_column.py - About 50 mins to fix

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

            def _create_weighted_sum(column,
            Severity: Major
            Found in tensorflow/python/feature_column/feature_column.py - About 50 mins to fix

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

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

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

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

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

                  def _create_categorical_column_weighted_sum(column,
                  Severity: Major
                  Found in tensorflow/python/feature_column/feature_column.py - About 50 mins to fix

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

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

                      Function _transform_feature has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def _transform_feature(self, inputs):
                          feature_tensors = []
                          for key in _collect_leaf_level_keys(self):
                            if isinstance(key, six.string_types):
                              feature_tensors.append(inputs.get(key))
                      Severity: Minor
                      Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

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

                      def _categorical_column_with_vocabulary_file(key,
                      Severity: Minor
                      Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

                        Function _crossed_column has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def _crossed_column(keys, hash_bucket_size, hash_key=None):
                          """Returns a column for performing crosses of categorical features.
                        
                          Crossed features are hashed according to `hash_bucket_size`. Conceptually,
                          the transformation can be thought of as:
                        Severity: Minor
                        Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Function _get_raw_feature_as_tensor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def _get_raw_feature_as_tensor(self, key):
                            """Gets the raw_feature (keyed by `key`) as `tensor`.
                        
                            The raw feature is converted to (sparse) tensor and maybe expand dim.
                        
                        
                        Severity: Minor
                        Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                        def _create_dense_column_weighted_sum(column,
                        Severity: Minor
                        Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

                          Function _bucketized_column has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def _bucketized_column(source_column, boundaries):
                            """Represents discretized dense input.
                          
                            Buckets include the left boundary, and exclude the right boundary. Namely,
                            `boundaries=[0., 1., 2.]` generates buckets `(-inf, 0.)`, `[0., 1.)`,
                          Severity: Minor
                          Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

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

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

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

                            def input_layer(features,
                            Severity: Minor
                            Found in tensorflow/python/feature_column/feature_column.py - About 45 mins to fix

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

                              def _categorical_column_with_vocabulary_list(key,
                              Severity: Minor
                              Found in tensorflow/python/feature_column/feature_column.py - About 35 mins to fix

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

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

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

                                  def _numeric_column(key,
                                  Severity: Minor
                                  Found in tensorflow/python/feature_column/feature_column.py - About 35 mins to fix

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

                                    def _verify_static_batch_size_equality(tensors, columns):
                                      """Validates that the first dim (batch size) of all tensors are equal or None.
                                    
                                      Args:
                                        tensors: list of tensors to check.
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py - About 35 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Function _check_shape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    def _check_shape(shape, key):
                                      """Returns shape if it's valid, raises error otherwise."""
                                      assert shape is not None
                                      if not nest.is_nested(shape):
                                        shape = [shape]
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Function _to_sparse_input_and_drop_ignore_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    def _to_sparse_input_and_drop_ignore_values(input_tensor, ignore_value=None):
                                      """Converts a `Tensor` to a `SparseTensor`, dropping ignore_value cells.
                                    
                                      If `input_tensor` is already a `SparseTensor`, just return it.
                                    
                                    
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Function _embedding_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    def _embedding_column(categorical_column,
                                                          dimension,
                                                          combiner='mean',
                                                          initializer=None,
                                                          ckpt_to_load_from=None,
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py - About 25 mins to fix

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

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

                                    def _categorical_column_with_vocabulary_list(key,
                                                                                 vocabulary_list,
                                                                                 dtype=None,
                                                                                 default_value=-1,
                                                                                 num_oov_buckets=0):
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 days to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1322..1435

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

                                    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 _get_raw_feature_as_tensor(self, key):
                                        """Gets the raw_feature (keyed by `key`) as `tensor`.
                                    
                                        The raw feature is converted to (sparse) tensor and maybe expand dim.
                                    
                                    
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 days to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2062..2109

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

                                    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 _to_sparse_input_and_drop_ignore_values(input_tensor, ignore_value=None):
                                      """Converts a `Tensor` to a `SparseTensor`, dropping ignore_value cells.
                                    
                                      If `input_tensor` is already a `SparseTensor`, just return it.
                                    
                                    
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 day to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2113..2157

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

                                    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 _numeric_column(key,
                                                        shape=(1,),
                                                        default_value=None,
                                                        dtype=dtypes.float32,
                                                        normalizer_fn=None):
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 day to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 817..909

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

                                    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 _get_sequence_dense_tensor(self,
                                                                     inputs,
                                                                     weight_collections=None,
                                                                     trainable=None):
                                        if not isinstance(self.categorical_column, _SequenceCategoricalColumn):
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 7 hrs to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2468..2488

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

                                    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 _get_sequence_dense_tensor(self,
                                                                     inputs,
                                                                     weight_collections=None,
                                                                     trainable=None):
                                        if not isinstance(self.categorical_column, _SequenceCategoricalColumn):
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 7 hrs to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2619..2638

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

                                    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 _categorical_column_with_identity(key, num_buckets, default_value=None):
                                      """A `_CategoricalColumn` that returns identity values.
                                    
                                      Use this when your inputs are integers in the range `[0, num_buckets)`, and
                                      you want to use the input value itself as the categorical ID. Values outside
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 6 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1441..1515

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

                                    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 _categorical_column_with_hash_bucket(key,
                                                                             hash_bucket_size,
                                                                             dtype=dtypes.string):
                                      """Represents sparse feature where ids are set by hashing.
                                    
                                    
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 5 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1004..1073

                                    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

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

                                      @property
                                      def _parse_example_spec(self):
                                        config = self.categorical_column._parse_example_spec  # pylint: disable=protected-access
                                        if self.weight_feature_key in config:
                                          raise ValueError('Parse config {} already exists for {}.'.format(
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 3 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3512..3521

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

                                    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

                                          values = array_ops.where(
                                              math_ops.logical_or(
                                                  values < zero, values >= num_buckets, name='out_of_range'),
                                              array_ops.fill(
                                                  dims=array_ops.shape(values),
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 3 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3412..3418

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

                                    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 _get_dense_tensor(self, inputs, weight_collections=None, trainable=None):
                                        if isinstance(self.categorical_column, _SequenceCategoricalColumn):
                                          raise ValueError(
                                              'In embedding_column: {}. '
                                              'categorical_column must not be of type _SequenceCategoricalColumn. '
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 3 hrs to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2452..2463

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

                                    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 _get_dense_tensor(self, inputs, weight_collections=None, trainable=None):
                                        if isinstance(self.categorical_column, _SequenceCategoricalColumn):
                                          raise ValueError(
                                              'In embedding_column: {}. '
                                              'categorical_column must not be of type _SequenceCategoricalColumn. '
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 3 hrs to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2603..2614

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

                                    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 key, value in six.iteritems(config):
                                          if key in result and value != result[key]:
                                            raise ValueError('feature_columns contain different parse_spec for key '
                                                             '{}. Given {} and {}'.format(key, value, result[key]))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 3 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 427..430

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

                                    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 _weighted_categorical_column(categorical_column,
                                                                     weight_feature_key,
                                                                     dtype=dtypes.float32):
                                      """Applies weight values to a `_CategoricalColumn`.
                                    
                                    
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1564..1636

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

                                    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 __new__(cls,
                                                  categorical_column,
                                                  dimension,
                                                  combiner,
                                                  layer_creator,
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2502..2512

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

                                    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 _collect_leaf_level_keys(cross):
                                      """Collects base keys by expanding all nested crosses.
                                    
                                      Args:
                                        cross: A `_CrossedColumn`.
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3755..3770

                                    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

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

                                      for i in range(len(boundaries) - 1):
                                        if boundaries[i] >= boundaries[i + 1]:
                                          raise ValueError('boundaries must be a sorted list.')
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 998..1000

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

                                    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

                                        if self.ckpt_to_load_from is not None:
                                          to_restore = embedding_weights
                                          if isinstance(to_restore, variables.PartitionedVariable):
                                            to_restore = to_restore._get_variable_list()  # pylint: disable=protected-access
                                          checkpoint_utils.init_from_checkpoint(
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 3 other locations - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2581..2586
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2589..2594
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2806..2811

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

                                    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

                                          if self.ckpt_to_load_from is not None:
                                            to_restore = embedding_weights
                                            if isinstance(to_restore, variables.PartitionedVariable):
                                              to_restore = to_restore._get_variable_list()  # pylint: disable=protected-access
                                            checkpoint_utils.init_from_checkpoint(
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 3 other locations - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2430..2435
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2589..2594
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2806..2811

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

                                    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 column in feature_columns:
                                        if column.name in name_to_column:
                                          raise ValueError('Duplicate feature column name found for columns: {} '
                                                           'and {}. This usually means that these columns refer to '
                                                           'same base feature. Either one must be discarded or a '
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2192..2200

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

                                    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 num_oov_buckets:
                                        if default_value is not None:
                                          raise ValueError(
                                              'Can\'t specify both num_oov_buckets and default_value in {}.'.format(
                                                  key))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1302..1309

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

                                    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

                                          elif isinstance(key, _CategoricalColumn):
                                            ids_and_weights = key._get_sparse_tensors(inputs)  # pylint: disable=protected-access
                                            if ids_and_weights.weight_tensor is not None:
                                              raise ValueError(
                                                  'crossed_column does not support weight_tensor, but the given '
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 2 hrs to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3688..3695

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

                                    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

                                      @property
                                      def _variable_shape(self):
                                        if not hasattr(self, '_shape'):
                                          self._shape = tensor_shape.TensorShape([self.dimension])
                                        return self._shape
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2526..2530

                                    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

                                      @property
                                      def _variable_shape(self):
                                        if not hasattr(self, '_shape'):
                                          self._shape = tensor_shape.TensorShape([self.dimension])
                                        return self._shape
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2407..2411

                                    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

                                      @property
                                      def name(self):
                                        if not hasattr(self, '_name'):
                                          self._name = '{}_shared_embedding'.format(self.categorical_column.name)
                                        return self._name
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2394..2398

                                    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

                                      @property
                                      def name(self):
                                        if not hasattr(self, '_name'):
                                          self._name = '{}_embedding'.format(self.categorical_column.name)
                                        return self._name
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2509..2513

                                    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

                                        return array_ops.one_hot(
                                            indices=math_ops.cast(input_tensor, dtypes.int64),
                                            depth=len(self.boundaries) + 1,
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2393..2396

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

                                    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 _get_sparse_tensors(self,
                                                              inputs,
                                                              weight_collections=None,
                                                              trainable=None):
                                        del weight_collections
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3572..3581

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

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

                                        if self.dtype.is_integer != input_tensor.dtype.is_integer:
                                          raise ValueError(
                                              'Column dtype and SparseTensors dtype must be compatible. '
                                              'key: {}, column dtype: {}, tensor dtype: {}'.format(
                                                  self.key, self.dtype, input_tensor.dtype))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 5 other locations - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2728..2732
                                    tensorflow/python/feature_column/feature_column.py on lines 2783..2787
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3011..3015
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3173..3177
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3280..3284

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

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

                                        if self.dtype.is_integer != input_tensor.dtype.is_integer:
                                          raise ValueError(
                                              'Column dtype and SparseTensors dtype must be compatible. '
                                              'key: {}, column dtype: {}, tensor dtype: {}'.format(
                                                  self.key, self.dtype, input_tensor.dtype))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 5 other locations - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2681..2685
                                    tensorflow/python/feature_column/feature_column.py on lines 2783..2787
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3011..3015
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3173..3177
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3280..3284

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

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

                                        if self.dtype.is_integer != input_tensor.dtype.is_integer:
                                          raise ValueError(
                                              'Column dtype and SparseTensors dtype must be compatible. '
                                              'key: {}, column dtype: {}, tensor dtype: {}'.format(
                                                  self.key, self.dtype, input_tensor.dtype))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 5 other locations - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2681..2685
                                    tensorflow/python/feature_column/feature_column.py on lines 2728..2732
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3011..3015
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3173..3177
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3280..3284

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

                                    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

                                            embedding_weights = variable_scope.get_variable(
                                                name='embedding_weights',
                                                shape=embedding_shape,
                                                dtype=dtypes.float32,
                                                initializer=self.initializer,
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2625..2630

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

                                    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 key in self._features:
                                          feature_tensor = self._get_raw_feature_as_tensor(key)
                                          self._feature_tensors[key] = feature_tensor
                                          return feature_tensor
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2034..2037

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

                                    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 (initializer is not None) and (not callable(initializer)):
                                        raise ValueError('initializer must be callable if specified. '
                                                         'Embedding of column_name: {}'.format(
                                                             categorical_column.name))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 498..501

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

                                      if initializer is None:
                                        initializer = init_ops.truncated_normal_initializer(
                                            mean=0.0, stddev=1 / math.sqrt(dimension))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 3 other locations - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 502..504
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 609..611
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 767..769

                                    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

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

                                        i1 = array_ops.reshape(
                                            array_ops.tile(
                                                array_ops.expand_dims(math_ops.range(0, batch_size), 1),
                                                [1, source_dimension]), (-1,))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2430..2433

                                    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

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

                                        bucket_indices = (
                                            array_ops.reshape(input_tensor,
                                                              (-1,)) + (len(self.boundaries) + 1) * i2)
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 1 hr to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2437..2439

                                    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

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

                                      @property
                                      def _variable_shape(self):
                                        return tensor_shape.TensorShape(
                                            tuple(self.source_column.shape) + (len(self.boundaries) + 1,))
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 55 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2384..2385

                                    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

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

                                      if weight_tensor is not None:
                                        weight_tensor = sparse_ops.sparse_reshape(
                                            weight_tensor, [array_ops.shape(weight_tensor)[0], -1])
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 55 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1928..1930

                                    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

                                      for column in feature_columns:
                                        if not isinstance(column, _FeatureColumn):
                                          raise ValueError('Items of feature_columns must be a _FeatureColumn. '
                                                           'Given (type {}): {}.'.format(type(column), column))
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 55 mins to fix
                                    tensorflow/python/data/util/options.py on lines 144..148

                                    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

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

                                      if not keys or len(keys) < 2:
                                        raise ValueError(
                                            'keys must be a list with length > 1. Given: {}'.format(keys))
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 50 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1756..1758

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

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

                                        if (not self.use_safe_embedding_lookup and sparse_id_rank is not None and
                                            sparse_id_rank <= 2):
                                          embedding_lookup_sparse = embedding_ops.embedding_lookup_sparse_v2
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 3 other locations - About 45 mins to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2591..2593
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2599..2601
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2898..2900

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

                                          if (not self.use_safe_embedding_lookup and sparse_id_rank is not None and
                                              sparse_id_rank <= 2):
                                            embedding_lookup_sparse = embedding_ops.embedding_lookup_sparse_v2
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 3 other locations - About 45 mins to fix
                                    tensorflow/python/feature_column/feature_column.py on lines 2440..2442
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2599..2601
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 2898..2900

                                    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

                                        if self.dtype == dtypes.string:
                                          sparse_values = input_tensor.values
                                        else:
                                          sparse_values = string_ops.as_string(input_tensor.values)
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 45 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3017..3020

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

                                      if (dimension is None) or (dimension < 1):
                                        raise ValueError('Invalid dimension {}.'.format(dimension))
                                    Severity: Major
                                    Found in tensorflow/python/feature_column/feature_column.py and 3 other locations - About 40 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 492..493
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 601..602
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 759..760

                                    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

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

                                        if input_tensor.values.dtype != dtypes.int64:
                                          values = math_ops.cast(values, dtypes.int64, name='values')
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 40 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3404..3405

                                    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

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

                                        if self.dtype != weight_tensor.dtype.base_dtype:
                                          raise ValueError('Bad dtype, expected {}, but got {}.'.format(
                                              self.dtype, weight_tensor.dtype))
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 40 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 3539..3541

                                    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

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

                                        target_shape = [shape[0], shape[1], math_ops.reduce_prod(shape[2:])]
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 35 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 4113..4113

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

                                    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

                                      return _EmbeddingColumn(
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 35 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 506..506

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

                                    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 not hash_bucket_size or hash_bucket_size < 1:
                                        raise ValueError('hash_bucket_size must be > 1. '
                                    Severity: Minor
                                    Found in tensorflow/python/feature_column/feature_column.py and 1 other location - About 30 mins to fix
                                    tensorflow/python/feature_column/feature_column_v2.py on lines 1753..1754

                                    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