File save.py
has 1332 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Function _breadth_first_traversal
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _breadth_first_traversal(self):
"""Returns all trackable objects in the SavedObjectGraph."""
# This method is overriden to merge all equivalent constant tensors and
# Assets in the object graph.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fill_object_graph_proto
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def fill_object_graph_proto(
self, proto: saved_object_graph_pb2.SavedObjectGraph
):
"""Populate the nodes, children and slot_variables of a SavedObjectGraph."""
for node_id, node in enumerate(self.nodes):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function list_children
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list_children(self, obj):
"""Lists children of `obj` for SavedModel."""
if obj not in self._children_cache:
children = self._children_cache[obj] = {}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _fill_meta_graph_def
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _fill_meta_graph_def(
Function map_resources
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def map_resources(self):
"""Makes new resource handle ops corresponding to existing resource tensors.
Creates resource handle ops in the current default graph, whereas
`accessible_objects` will be from an eager context. Resource mapping adds
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function save_and_return_nodes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save_and_return_nodes(
Function _maybe_uncache_variable_captures
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _maybe_uncache_variable_captures(
self, concrete_function: cf.ConcreteFunction
):
if concrete_function in self._wrapped_functions:
return self._wrapped_functions[concrete_function]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _initialize_nodes_and_concrete_functions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _initialize_nodes_and_concrete_functions(self):
"""Creates graph with nodes for trackable objects and functions.
Adds functions for each trackable object to `self.nodes` and associated
concrete functions to `self.concrete_functions` for serialization.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"