mfinzi/LieConv

View on GitHub
lie_conv/lieConv.py

Summary

Maintainability
D
1 day
Test Coverage

File lieConv.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" 
Note to the Reader:

In order to handle the generic spatial data we process features as a tuple: (coordinates,values,mask)
with shapes (bs,n,d), (bs,n,c), (bs,n) where bs is batchsize, n is the maximum number of points in the minibatch,
Severity: Minor
Found in lie_conv/lieConv.py - About 3 hrs to fix

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

        def __init__(self, chin, ds_frac=1, num_outputs=1, k=1536, nbhd=np.inf,
    Severity: Major
    Found in lie_conv/lieConv.py - About 2 hrs to fix

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

          def __init__(self,chin=1,total_ds=1/64,num_layers=6,group=T(2),fill=1/32,k=256,
      Severity: Major
      Found in lie_conv/lieConv.py - About 1 hr to fix

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

            def __init__(self,chin,chout,mc_samples=32,xyz_dim=3,ds_frac=1,knn_channels=None,act='swish',bn=False,mean=False):
        Severity: Major
        Found in lie_conv/lieConv.py - About 1 hr to fix

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

              def forward(self,inp,withquery=False):
                  abq_pairs,vals,mask = inp
                  dist = self.group.distance if self.group else lambda ab: norm(ab,dim=-1)
                  if self.ds_frac!=1:
                      if self.cache and self.cached_indices is None:
          Severity: Minor
          Found in lie_conv/lieConv.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,*args,group=T(3),ds_frac=1,fill=1/3,cache=False,knn=False,**kwargs):
          Severity: Major
          Found in lie_conv/lieConv.py - About 50 mins to fix

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

                def __init__(self,chin,chout,conv,bn=False,act='swish',fill=None):
            Severity: Minor
            Found in lie_conv/lieConv.py - About 45 mins to fix

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

              def pConvBNrelu(in_channels,out_channels,bn=True,act='swish',**kwargs):
              Severity: Minor
              Found in lie_conv/lieConv.py - About 35 mins to fix

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

                def LieConvBNrelu(in_channels,out_channels,bn=True,act='swish',**kwargs):
                Severity: Minor
                Found in lie_conv/lieConv.py - About 35 mins to fix

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

                  def WeightNet(in_dim,out_dim,act,bn,k=32):
                  Severity: Minor
                  Found in lie_conv/lieConv.py - About 35 mins to fix

                    Function extract_neighborhood has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def extract_neighborhood(self,inp,query_indices):
                            """ inputs: [pairs_abq (bs,n,n,d), inp_vals (bs,n,c), mask (bs,n), query_indices (bs,m)]
                                outputs: [neighbor_abq (bs,m,mc_samples,d), neighbor_vals (bs,m,mc_samples,c)]"""
                    
                            # Subsample pairs_ab, inp_vals, mask to the query_indices
                    Severity: Minor
                    Found in lie_conv/lieConv.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

                    There are no issues that match your filters.

                    Category
                    Status