mfinzi/pristine-ml

View on GitHub

Showing 72 of 97 total issues

Function _sample_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _sample_config(config_spec,cfg_all):
    cfg = {}
    more_work = False
    for k,v in config_spec.items():
        if isinstance(v,dict):
Severity: Minor
Found in oil/tuning/configGenerator.py - About 1 hr 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 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, numClasses=10):
        super().__init__()
        self.numClasses = numClasses
        self.activation = nn.LeakyReLU(0.1)
        self.conv1a = nn.Conv2d(3, 96, 3, padding=1)
Severity: Minor
Found in oil/architectures/img_classifiers/networkparts.py - About 1 hr to fix

    Function __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, num_targets=10):
            super().__init__()
            self.numClasses = num_targets
            self.activation = nn.LeakyReLU(0.1)
            self.conv1a = weight_norm(nn.Conv2d(3, 128, 3, padding=1))
    Severity: Minor
    Found in oil/architectures/img_classifiers/networkparts.py - About 1 hr to fix

      Function __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self, numClasses=10):
              super().__init__()
              self.numClasses = numClasses
              self.activation = nn.LeakyReLU(0.1)
              self.conv1a = weight_norm(nn.Conv2d(3, 96, 3, padding=1))
      Severity: Minor
      Found in oil/architectures/img_classifiers/networkparts.py - About 1 hr to fix

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

            def __init__(self, model, dataloaders, opt_constr=optim.Adam, lr_sched = lambda e: 1, 
        Severity: Major
        Found in oil/model_trainers/trainer.py - About 1 hr to fix

          Function _add_call_item_to_queue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _add_call_item_to_queue(pending_work_items,
                                      work_ids,
                                      call_queue):
              """Fills call_queue with _WorkItems from pending_work_items.
              This function never blocks.
          Severity: Minor
          Found in oil/tuning/localGpuExecutor.py - About 55 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 process_user_input has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_user_input(self,executor):
                  inp = maybe_get_input()
                  if inp is None: return
                  if inp[:4]=="halt":pass
                  elif inp[:3]=="add":
          Severity: Minor
          Found in oil/tuning/study.py - About 55 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 argupdated_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def argupdated_config(cfg,parser=None, namespace=None):
              """ Uses the cfg to generate a parser spec which parses the command line arguments
                  and outputs the updated config. An existing argparser can be specified."""
              # TODO: throw error for clobbered names
              flat_cfg = flatten(cfg)
          Severity: Minor
          Found in oil/tuning/args.py - About 55 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 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1, bias=False):
          Severity: Major
          Found in oil/architectures/img_classifiers/transformer.py - About 50 mins to fix

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

                def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1,bias=False):
            Severity: Major
            Found in oil/architectures/parts/deconv.py - About 50 mins to fix

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

                  def __init__(self,in_channels,out_channels,ksize=3,drop_rate=0,stride=1,gn=False,**kwargs):
              Severity: Major
              Found in oil/architectures/parts/blocks.py - About 50 mins to fix

                Function getLabLoader has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def getLabLoader(trainset, lab_BS, amnt_lab=1, amnt_dev=0, dataseed=0, balanced=True,**kwargs):
                Severity: Major
                Found in oil/datasetup/dataloaders.py - About 50 mins to fix

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

                      def __init__(self, root, split='train', joint_transform=None,
                  Severity: Minor
                  Found in oil/datasetup/camvid.py - About 45 mins to fix

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

                        def __init__(self, depth=22, block=Bottleneck, 
                    Severity: Minor
                    Found in oil/architectures/img_classifiers/densenet.py - About 45 mins to fix

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

                          def __init__(self, block, layers, channels, groups=1, num_targets=1000, downsample='basic'):
                      Severity: Minor
                      Found in oil/architectures/img_classifiers/shake_shake.py - About 45 mins to fix

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

                            def __init__(self, block, layers, channels, groups=1, num_targets=1000, downsample='basic'):
                        Severity: Minor
                        Found in oil/architectures/img_classifiers/shake_shake.py - About 45 mins to fix

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

                              def __init__(self, *args,D=None,opt_constr=None,lr_sched=lambda e:1,
                          Severity: Minor
                          Found in oil/model_trainers/gan.py - About 45 mins to fix

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

                                def __init__(self,  num_groups, eps=1e-2,n_iter=5,momentum=0.1,sampling_stride=3,debug=False):
                            Severity: Minor
                            Found in oil/architectures/parts/deconv.py - About 45 mins to fix

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

                                  def __init__(self,k=64,ksize=7,drop_rate=0,stride=1,gn=False,num_heads=8):
                              Severity: Minor
                              Found in oil/architectures/img_classifiers/transformer.py - About 45 mins to fix

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

                                    def __init__(self, num_targets=10, depth=28, widen_factor=10, drop_rate=0.3,in_channels=3,initial_stride=1):
                                Severity: Minor
                                Found in oil/architectures/img_classifiers/wide_resnet.py - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language