Showing 102 of 320 total issues
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes the task.
.. warning::
- 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 name, param in self.pipeline.named_parameters():
try:
self.training_batch_writer.add_histogram(name + '/grad',
param.grad.data.cpu().numpy(), self.app_state.episode, bins='doane')
Function cuda
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cuda(self):
"""
Moves all models to GPU.
"""
self.logger.info("Moving model(s) to GPU(s)")
- 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 name, param in self.pipeline.named_parameters():
try:
self.training_batch_writer.add_histogram(name,
param.data.cpu().numpy(), self.app_state.episode, bins='doane')
Function setup_experiment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_experiment(self):
"""
Sets up experiment for episode trainer:
- Calls base class setup_experiment to parse the command line arguments,
- 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_experiment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup_experiment(self):
"""
Sets up experiment for episode trainer:
- Calls base class setup_experiment to parse the command line arguments,
- 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 (validation_batch_loss < self.loss_stop_threshold):
# Change the status.
training_status = "Converged (Partial Validation Loss went below " \
"Loss Stop threshold {})".format(self.loss_stop_threshold)
Avoid deeply nested control flow statements. Open
for name, param in self.pipeline.named_parameters():
try:
self.training_batch_writer.add_histogram(name,
param.data.cpu().numpy(), self.app_state.episode, bins='doane')
Function backward
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def backward(self, data_streams):
"""
Propagates gradients backwards, starting from losses returned by every loss component in the pipeline.
If using many losses the components derived from loss must overwrite the ''loss_keys()'' method.
- 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 __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes object. Loads keys and values of variables and adds them to globals.
:param name: Loss name.
- 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 __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, class_type, config):
"""
Initializes the component. This constructor:
- sets the access to ``AppState`` (for dtypes, settings, globals etc.)
- 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 export_experiment_configuration_to_yml
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def export_experiment_configuration_to_yml(logger, log_dir, filename, config_interface_obj, user_confirm):
Function preprocess_text
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def preprocess_text(self, text, lowercase = False, remove_punctuation = False, tokenize = False, remove_stop_words = False):
Function save_word_mappings_to_csv_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save_word_mappings_to_csv_file(logger, folder, filename, word_to_ix, fieldnames = ["word","index"]):
Function load_pretrained_embeddings
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def load_pretrained_embeddings(logger, folder, embeddings_name, word_to_ix, embeddings_size):
Function load_dataset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_dataset(self, source_files):
"""
Loads the dataset from source files.
:param source_files: list of jSON file with image ids, questions, answers, scene graphs, etc.
- 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 export_output_definitions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def export_output_definitions(self, all_definitions, log_errors=True):
"""
Exports output definitions to all_definitions, checking errors (e.g. if output field is already present in all_definitions).
:param all_definitions: dictionary containing output data definitions (each of type :py:class:`ptp.configuration.DataDefinition`).
- 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 export_to_tensorboard
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def export_to_tensorboard(self, tb_writer = None):
"""
Method exports current statistical aggregators values to TensorBoard.
:param tb_writer: TensorBoard writer, optional
- 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_global_experiment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def setup_global_experiment(self):
"""
Sets up the global test experiment for the ``Processor``:
- Checks that the model to use exists
- 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 preprocess_text
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def preprocess_text(self, text, lowercase = False, remove_punctuation = False, tokenize = False, remove_stop_words = False):
"""
Function that preprocesses questions/answers as suggested by ImageCLEF VQA challenge organizers:
* lowercases all words (optional)
* removes punctuation (optional)
- 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"