From 591f456def2674f828f47eabd058778283f7870c Mon Sep 17 00:00:00 2001 From: carlocamilloni <carlo.camilloni@gmail.com> Date: Thu, 11 Apr 2019 16:49:12 +0200 Subject: [PATCH] some lgtm fixes for python scripts --- .../TUTORIAL_SAXS-AACG/martiniFormFactor_p2.py | 13 +++---------- .../TUTORIAL_SAXS-AACG/martiniFormFactor_p3.py | 11 +++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p2.py b/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p2.py index 71ffd26f0..162fdabe4 100644 --- a/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p2.py +++ b/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p2.py @@ -7,9 +7,6 @@ from __future__ import division import sys,logging logging.basicConfig(format='%(levelname)-7s %(message)s',level=9) -import os.path -import re - # This is a simple and versatily option class that allows easy # definition and parsing of options. @@ -286,7 +283,6 @@ def aver(b): # [ name, resname, resid, chain, x, y, z ] def mapCG(r): p = CoarseGrained.mapping[r[0][1]] # Mapping for this residue - flat_p = [item for sublist in p for item in sublist] # Get the atom_name, mass, coordinates (x,y,z), atom id for all atoms in the residue a = [(i[0],CoarseGrained.mass.get(i[0][0],0),i[4:7],i[7]) for i in r] # Store weight, coordinate and index for atoms that match a bead @@ -301,7 +297,7 @@ def mapCG(r): ####################### ## 4 # STRUCTURE I/O ## -> @IO <- ####################### -import logging,math,random,sys +import math,sys #----+---------+ ## A | PDB I/O | @@ -534,8 +530,6 @@ class Residue(list): for i in self: if i[0] == tag: return i - else: - return if tag[1]: return [i for i in self if tag[0] in i[0]] # Return partial matches else: @@ -826,7 +820,7 @@ class Chain: ############# ## 8 # MAIN # -> @MAIN <- ############# -import sys,logging,random,math,os,re +import sys,math def main(options): # Check whether to read from a gro/pdb file or from stdin @@ -1049,7 +1043,7 @@ def main(options): if __name__ == '__main__': - import sys,logging,time + import sys,time start = time.time() stloc = time.localtime(start) @@ -1060,7 +1054,6 @@ if __name__ == '__main__': logging.error("NO INPUT! Try to use the option -h for help.") sys.exit(1) - options = options options = option_parser(args,options) diff --git a/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p3.py b/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p3.py index 5830224dd..145fd540c 100644 --- a/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p3.py +++ b/user-doc/tutorials/others/isdb-2/TUTORIAL_SAXS-AACG/martiniFormFactor_p3.py @@ -7,8 +7,6 @@ import sys,logging logging.basicConfig(format='%(levelname)-7s %(message)s',level=9) -import os.path -import re # This is a simple and versatily option class that allows easy @@ -283,7 +281,6 @@ def aver(b): # [ name, resname, resid, chain, x, y, z ] def mapCG(r): p = CoarseGrained.mapping[r[0][1]] # Mapping for this residue - flat_p = [item for sublist in p for item in sublist] # Get the atom_name, mass, coordinates (x,y,z), atom id for all atoms in the residue a = [(i[0],CoarseGrained.mass.get(i[0][0],0),i[4:7],i[7]) for i in r] # Store weight, coordinate and index for atoms that match a bead @@ -298,7 +295,7 @@ def mapCG(r): ####################### ## 4 # STRUCTURE I/O ## -> @IO <- ####################### -import logging,math,random,sys +import math,sys #----+---------+ ## A | PDB I/O | @@ -671,7 +668,6 @@ class Chain: # Return the chain slice return newchain return self.sequence[other] - return self.sequence[other] # Extract a piece of a chain as a new chain def __getslice__(self,i,j): @@ -839,7 +835,7 @@ class Chain: ############# ## 8 # MAIN # -> @MAIN <- ############# -import sys,logging,random,math,os,re +import sys,math def main(options): # Check whether to read from a gro/pdb file or from stdin @@ -1062,7 +1058,7 @@ def main(options): if __name__ == '__main__': - import sys,logging,time + import sys,time start = time.time() stloc = time.localtime(start) @@ -1073,7 +1069,6 @@ if __name__ == '__main__': logging.error("NO INPUT! Try to use the option -h for help.") sys.exit(1) - options = options options = option_parser(args,options) if options["-f"].value is None: -- GitLab