Showing 11,634 of 11,634 total issues
Avoid deeply nested control flow statements. Open
for tensor in tensor_dict.values():
self.assertAllEqual(tensor, np.arange(1, 13).reshape((4, 3)) * i)
i += 1
with self.assertRaises(tf.errors.OutOfRangeError):
Function sample_episodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sample_episodes(self, sess, greedy=False):
"""Sample steps from the environment until we have enough for a batch."""
# check if last batch ended with episode that was not terminated
if self.unify_episodes:
- 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
Avoid deeply nested control flow statements. Open
if global_step.value() - logged_step >= LOG_EVERY:
logged_dict_np = {name: value.numpy() for name, value in
logged_dict.items()}
tf.logging.info(
'Step {} per-step time {:.3f}s'.format(
Function setup
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def setup(self, var_list, values, targets, pads,
Function sample_actions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sample_actions(self, output, actions=None, greedy=False):
"""Sample all actions given output of core network."""
sampled_actions = []
logits = []
log_probs = []
- 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 setup
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def setup(self, var_list, values, targets, pads,
Function to_absolute_coordinates
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def to_absolute_coordinates(boxlist,
Function graph_fn
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def graph_fn(anchor_means, groundtruth_boxlist1, groundtruth_boxlist2,
Avoid deeply nested control flow statements. Open
for _ in tf.range(num_steps_per_iteration - 1):
# Following suggestion on yaqs/5402607292645376
with tf.name_scope(''):
_sample_and_train(strategy, train_step_fn, data_iterator)
Function convert_action_to_gym
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert_action_to_gym(self, action):
if len(action) == 1:
return action[0]
else:
return list(action)
- 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 multi_step
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def multi_step(self, all_obs, initial_state, all_actions):
"""Calculate log-probs and other calculations on batch of episodes."""
batch_size = tf.shape(initial_state)[0]
time_length = tf.shape(all_obs[0])[0]
- 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 convert_from_batched_episodes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def convert_from_batched_episodes(
Function add_to_replay_buffer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_to_replay_buffer(self, initial_state,
Avoid deeply nested control flow statements. Open
for tensor in tensor_dict.values():
self.assertAllEqual(tensor, np.tile(np.arange(4), (i, 1)))
i += 1
with self.assertRaises(tf.errors.OutOfRangeError):
Function eager_eval_loop
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def eager_eval_loop(
Function reshape_batched_inputs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reshape_batched_inputs(self, all_obs, all_actions,
internal_policy_states, policy_logits):
"""Reshape inputs from [time_length, batch_size, ...] to
[time_length * batch_size, ...].
- 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
Avoid deeply nested control flow statements. Open
for tensor in tensor_dict.values():
self.assertAllEqual(tensor, np.arange(i * i).reshape((i, i)))
i += 1
with self.assertRaises(tf.errors.OutOfRangeError):
Function optimize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def optimize(self, sess, feed_dict):
old_theta = sess.run(self.flat_vars)
loss_flat_grad = sess.run(self.loss_flat_gradient,
feed_dict=feed_dict)
- 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 setup
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def setup(self, var_list, values, targets, pads,
Function boolean_mask
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def boolean_mask(boxlist, indicator, fields=None, scope=None,