TianyuDu/AnnEconForecast

View on GitHub

Showing 43 of 45 total issues

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Minor
Found in pytorch/lstm_models.py - About 45 mins to fix

    Function get_tensors has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get_tensors(
    Severity: Minor
    Found in pytorch/SlpGenerator.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for batch_idx, (data, target) in enumerate(val_dl):
                              # data, target = map(torch.Tensor, (data, target))
                              # data, target = data.double(), target.double()
                              data = data.to(device).float()
                              target = target.to(device).float()
      Severity: Major
      Found in pytorch/lstm_controls.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Minor
        Found in pytorch/lstm_models.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              for batch_idx, (data, target) in enumerate(val_dl):
                                  data = data.to(device).float()
                                  target = target.to(device).float()
                                  out = net(data)
                                  loss = criterion(out, target)
          Severity: Major
          Found in pytorch/nnar_controls.py - About 45 mins to fix

            Function eval_net has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def eval_net(
            Severity: Minor
            Found in core/genetic/control.py - About 35 mins to fix

              Function save_generation has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def save_generation(
              Severity: Minor
              Found in core/genetic/control.py - About 35 mins to fix

                Function split_dataset has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def split_dataset(
                Severity: Minor
                Found in standalone_dev/df_methods.py - About 35 mins to fix

                  Function gen_supervised_sequence has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def gen_supervised_sequence(
                  Severity: Minor
                  Found in core/tools/time_series.py - About 35 mins to fix

                    Function progbar has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def progbar(curr, total, full_progbar, net_size, max_ep, lr):
                    Severity: Minor
                    Found in core/genetic/tuner.py - About 35 mins to fix

                      Function prepare_dataset has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def prepare_dataset(
                      Severity: Minor
                      Found in core/tools/rnn_prepare.py - About 35 mins to fix

                        Function split_dataset has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def split_dataset(
                        Severity: Minor
                        Found in core/tools/rnn_prepare.py - About 35 mins to fix

                          Function create_population has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def create_population(
                                  self,
                                  gene_pool: dict,
                                  pop_size: int
                              ) -> List[dict]:
                          Severity: Minor
                          Found in core/genetic/optimizer.py - About 35 mins to fix

                          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 series_to_supervised has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def series_to_supervised(data, n_in=1, n_out=1, dropnan=True):
                              n_vars = 1 if type(data) is list else data.shape[1]
                              df = pd.DataFrame(data)
                              cols, names = list(), list()
                              # input seq. (t-n, ..., t-1)
                          Severity: Minor
                          Found in keras_based/exchange/tutorial.py - About 35 mins to fix

                          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 get_many_to_one has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def get_many_to_one(
                                  self,
                                  lag: int=6
                              ) -> (pd.DataFrame, pd.DataFrame):
                                  """
                          Severity: Minor
                          Found in pytorch/SlpGenerator.py - About 35 mins to fix

                          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 gen_hparam_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def gen_hparam_set(
                              src_dict: Dict[str, Union[List[object], object]]
                          ) -> List[Dict[str, object]]:
                              """
                              Generate a collection of hyperparameters for hyparam searching.
                          Severity: Minor
                          Found in core/tools/param_set_generator.py - About 25 mins to fix

                          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 uni_visualize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def uni_visualize(
                                  actual_val: np.ndarray,
                                  pred_val: np.ndarray,
                                  break_point: int,
                                  dir: str=None) -> None:
                          Severity: Minor
                          Found in keras_based/exchange/methods.py - About 25 mins to fix

                          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 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def __init__(
                                  self,
                                  file_dir: Union[str, None] = None,
                                  verbose: bool = False
                              ) -> None:
                          Severity: Minor
                          Found in core/tools/json_rec.py - About 25 mins to fix

                          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 evaluate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def evaluate(
                                  self,
                                  verbose: bool = False
                              ) -> None:
                                  """
                          Severity: Minor
                          Found in core/genetic/tuner.py - About 25 mins to fix

                          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_generation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def save_generation(
                              population: List[dict],
                              scores: list,
                              generation: int,
                              file_dir: str,
                          Severity: Minor
                          Found in core/genetic/control.py - About 25 mins to fix

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language