Showing 18 of 300 total issues
File train_config.py
has 434 lines of code (exceeds 250 allowed). Consider refactoring. Open
from abc import ABCMeta, abstractmethod
from torch import Tensor
from torch.optim import Optimizer
from torch.nn import Module
Function _update_metrics
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def _update_metrics(self, metrics: [AbstractMetric], metrics_groups: [MetricsGroup]) -> None:
"""
Update console
:param metrics: metrics
- 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
File train.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
The main module for training process
"""
import json
import os
File fsm.py
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
This module contains all classes, that work with file structure
* :class:`FileStructManager` provide all modules registration
* :class:`CheckpointsManager` provide checkpoints management
Function train
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def train(self) -> None:
"""
Run training process
"""
if len(self._train_config.stages()) < 1:
- 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 load_weights
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def load_weights(self, weights_file: str = None) -> None:
"""
Load weight from checkpoint
"""
if weights_file is not None:
- 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 register_dir
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def register_dir(self, obj: FolderRegistrable, check_name_registered: bool = False, check_dir_registered: bool = True) -> None:
"""
Register directory in file structure
:param obj: object to registration
- 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 _process_metric
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _process_metric(self, cur_metric, parent_tag: str = None):
if isinstance(cur_metric, MetricsGroup):
for m in cur_metric.metrics():
names = self._compile_names(parent_tag, [cur_metric.name(), m.name()])
plot = self._cur_plot(names)
- 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 _process_metric
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _process_metric(self, cur_metric, parent_tag: str = None) -> None:
"""
Internal method for processing metrics or metrics groups
:param cur_metric: :class:`AbstractMetric` or :class:`MetricsGroup` object
- 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 _cur_storage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _cur_storage(self, names: [str]) -> [] or {}:
"""
Get current substorage by path of names
:param names: list on names (path to target substorage)
:return: substorage
- 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_state
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _save_state(self, ckpts_manager: CheckpointsManager, best_ckpts_manager: CheckpointsManager or None,
cur_best_state: float or None, epoch_idx: int) -> float or None:
"""
Internal method used for save states after epoch end
- 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, fsm: FileStructManager, is_continue: bool, network_name: str = None):
super().__init__()
self.__writer = None
self.__txt_log_file = None
- 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_state
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _save_state(self, ckpts_manager: CheckpointsManager, best_ckpts_manager: CheckpointsManager or None,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, train_configs: [ComparableTrainConfig], workdir: str, device: torch.device = None, is_continue: bool = False):
Function train
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def train(self):
if os.path.exists(self._workdir) or not os.path.isdir(self._workdir):
os.makedirs(self._workdir)
with open(self.__state_file_path(), 'w') as file:
- 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 too many return
statements within this function. Open
return encoder.layer4
Function update_metrics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_metrics(self, metrics: {}) -> None:
for metric in metrics['metrics']:
self._process_metric(metric)
for metrics_group in metrics['groups']:
- 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 update_metrics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_metrics(self, metrics: {}) -> None:
for metric in metrics['metrics']:
self._process_metric(metric)
for metrics_group in metrics['groups']:
- 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"