Showing 102 of 320 total issues
Function get_value_list_from_dictionary
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_value_list_from_dictionary(key, parameter_dict, accepted_values = []):
"""
Parses parameter values retrieved from a given parameter dictionary using key.
Optionally, checks is all values are accepted.
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes task object. Calls base constructor. Downloads the dataset if not present and loads the adequate files depending on the mode.
:param name: Name of the component.
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
The init method downloads the required files, loads the file associated with a given subset (train/valid/test),
concatenates all sencentes and tokenizes them using NLTK's WhitespaceTokenizer.
- 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_individual_experiment
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_individual_experiment(self):
"""
Setup individual test experiment in the case of multiple tests, or the main experiment in the case of \
one test experiment.
Function __call__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, data_streams):
"""
Encodes "inputs" in the format of a single tensor.
Stores reshaped tensor in "outputs" field of in data_streams.
- 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 forward
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def forward(self, data_streams):
"""
Forward pass of the model.
:param data_streams: DataStreams({'inputs', 'predictions ...}), where:
- 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 random_remove_stop_words
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def random_remove_stop_words(self, words):
"""
Function removes random stop words, each with 0.5 probability.
:param words: tokenized text
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes task object. Calls base constructor. Downloads the dataset if not present and loads the adequate files depending on the mode.
:param name: Name of the component.
Function __init__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes task object. Calls base constructor. Downloads the dataset if not present and loads the adequate files depending on the mode.
:param name: Name of the component.
Function __init__
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes the model.
:param config: Dictionary of parameters (read from configuration ``.yaml`` file).
Function __init__
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, name, config):
"""
Initializes the task.
.. warning::
Function export_to_csv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def export_to_csv(self, csv_file=None):
"""
Method writes current statistics to csv using the possessed formatting.
:param csv_file: File stream opened for writing, 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 freeze_models
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def freeze_models(self):
"""
Method analyses the configuration and freezes:
- all models when 'freeze' flag for whoe pipeline is set,
- individual models when their 'freeze' flags are set.
- 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 set_leaf
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_leaf(self, leaf_key, leaf_value):
"""
Update the value of the specified ``leaf_key`` of the current :py:class:`ConfigInterface` \
with the specified ``leaf_value``.
- 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 forward
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def forward(self, data_streams):
"""
Method responsible for processing the data dict, using all components in the components queue.
:param data_streams: :py:class:`ptp.utils.DataStreams` object containing both input data to be processed and that will be extended by the results.
- 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 log_errors:
self.logger.error("Input definition: field '{}' in DataStreams has type {} different from expected (expected {} while received {})".format(key,index, id.types, dd.types))
errors += 1
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')
Avoid deeply nested control flow statements. Open
if log_errors:
self.logger.error("Input definition: field '{}' in DataStreams has dimension {} different from expected (expected {} while received {})".format(key,index, id.dimensions, dd.dimensions))
errors += 1
Function update_dict_recursively
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_dict_recursively(self, current_node, update_node):
"""
Recursively update the ``current_node`` of the :py:class:`ConfigRegistry` with the values of \
the ``update_node``.
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, weights, num_samples, num_folds, epochs_per_fold = 1, all_but_current_fold = True, replacement=True):