Showing 44 of 55 total issues
File datasets.py
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
import math
import torch
import torchvision.transforms as transforms
import torch.nn as nn
import torch.nn.functional as F
File lieGroups.py
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
import torch
import numpy as np
from lie_conv.utils import export, Named
@export
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,
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,
Function __init__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, data, included_species=None, num_pts=-1, normalize=True, shuffle=True, subtract_thermo=True):
self.data = data
if num_pts < 0:
- 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_xyz_md17
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def process_xyz_md17(datafile):
"""
Read xyz file and return a molecular dict with number of atoms, energy, forces, coordinates and atom-type for the MD-17 dataset.
Parameters
- 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 makeTrainer
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def makeTrainer(*, dataset=MnistRotDataset, network=ImgLieResnet, num_epochs=100,
Function prepare_dataset
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def prepare_dataset(datadir, dataset, subset=None, splits=None, cleanup=True, force_download=False):
"""
Download and process dataset.
Parameters
- 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 makeTrainer
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def makeTrainer(*, task='homo', device='cuda', lr=3e-3, bs=75, num_epochs=500,network=MolecLieResNet,
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,
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,d=2,sys_dim=2,bn=False,num_layers=4,group=T(2),k=384,knn=False,nbhd=100,mean=True,center=True,**kwargs):
Function __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,d=2,sys_dim=2,bn=False,num_layers=4,group=T(2),k=384,knn=False,nbhd=100,mean=True,**kwargs):
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):
Function gen_splits_gdb9
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gen_splits_gdb9(gdb9dir, cleanup=True):
"""
Generate GDB9 training/validation/test splits used.
First, use the file 'uncharacterized.txt' in the GDB9 figshare to find a
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, root_dir=default_root_dir, train=True, download=True, n_systems=100, regen=False,
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:
- 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_xyz_files
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_xyz_files(data, process_file_fn, file_ext=None, file_idx_list=None, stack=True):
"""
Take a set of datafiles and apply a predefined data processing script to each
one. Data can be stored in a directory, tarfile, or zipfile. An optional
file extension can be added.
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, root_dir=default_root_dir, train=True, download=True, n_systems=100, space_dim=2, regen=False,
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):
Function prepare_dataset
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_dataset(datadir, dataset, subset=None, splits=None, cleanup=True, force_download=False):