add comments to suppress useless warnings from LGTM

This commit is contained in:
Axel Kohlmeyer 2021-05-15 23:35:14 -04:00
parent 185664824e
commit fde2295685
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
5 changed files with 20 additions and 20 deletions

View File

@ -123,7 +123,7 @@ try:
sys.argv = ["setup.py","install"] # as if had run "python setup.py install"
setup_kwargs['data_files']=[(os.path.join(get_python_lib(), 'lammps'), [args.lib])]
setup(**setup_kwargs)
except:
except: # lgtm [py/catch-base-exception]
tryuser=True
print ("Installation into global site-packages folder failed.\nTrying user folder %s now." % site.USER_SITE)
@ -132,5 +132,5 @@ if tryuser:
sys.argv = ["setup.py","install","--user"] # as if had run "python setup.py install --user"
setup_kwargs['data_files']=[(os.path.join(site.USER_SITE, 'lammps'), [args.lib])]
setup(**setup_kwargs)
except:
except: # lgtm [py/catch-base-exception]
print("Installation into user site package folder failed.")

View File

@ -8,10 +8,10 @@ LAMMPS module global members:
result of :py:func:`lammps.version`.
"""
from .constants import *
from .core import *
from .data import *
from .pylammps import *
from .constants import * # lgtm [py/polluting-import]
from .core import * # lgtm [py/polluting-import]
from .data import * # lgtm [py/polluting-import]
from .pylammps import * # lgtm [py/polluting-import]
# convert installed module string version to numeric version
def get_version_number():
@ -28,7 +28,7 @@ def get_version_number():
from importlib.metadata import version
try:
vstring = version('lammps')
except:
except: # lgtm [py/catch-base-exception]
# nothing to do, ignore
pass
@ -36,7 +36,7 @@ def get_version_number():
from pkg_resources import get_distribution
try:
vstring = get_distribution('lammps').version
except:
except: # lgtm [py/catch-base-exception]
# nothing to do, ignore
pass

View File

@ -18,12 +18,12 @@ from __future__ import print_function
import os
import sys
from ctypes import *
from ctypes import * # lgtm [py/polluting-import]
from os.path import dirname,abspath,join
from inspect import getsourcefile
from .constants import *
from .data import *
from .constants import * # lgtm [py/polluting-import]
from .data import * # lgtm [py/polluting-import]
# -------------------------------------------------------------------------
@ -100,7 +100,7 @@ class lammps(object):
try:
if ptr: self.lib = CDLL("",RTLD_GLOBAL)
except:
except: # lgtm [py/catch-base-exception]
self.lib = None
# load liblammps.so unless name is given
@ -307,7 +307,7 @@ class lammps(object):
from mpi4py import __version__ as mpi4py_version
# tested to work with mpi4py versions 2 and 3
self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3']
except:
except: # lgtm [py/catch-base-exception]
# ignore failing import
pass
@ -1352,7 +1352,7 @@ class lammps(object):
id_lmp = (self.c_tagint*n)()
try:
id_lmp[:] = id[0:n]
except:
except: # lgtm [py/catch-base-exception]
return 0
else:
id_lmp = None
@ -1360,21 +1360,21 @@ class lammps(object):
type_lmp = (c_int*n)()
try:
type_lmp[:] = type[0:n]
except:
except: # lgtm [py/catch-base-exception]
return 0
three_n = 3*n
x_lmp = (c_double*three_n)()
try:
x_lmp[:] = x[0:three_n]
except:
except: # lgtm [py/catch-base-exception]
return 0
if v:
v_lmp = (c_double*(three_n))()
try:
v_lmp[:] = v[0:three_n]
except:
except: # lgtm [py/catch-base-exception]
return 0
else:
v_lmp = None
@ -1383,7 +1383,7 @@ class lammps(object):
img_lmp = (self.c_imageint*n)()
try:
img_lmp[:] = image[0:n]
except:
except: # lgtm [py/catch-base-exception]
return 0
else:
img_lmp = None

View File

@ -20,7 +20,7 @@ import warnings
from ctypes import POINTER, c_double, c_int, c_int32, c_int64, cast
from .constants import *
from .constants import * # lgtm [py/polluting-import]
from .data import NeighList

View File

@ -31,7 +31,7 @@ if not tests_dir:
try:
src_dir = os.path.abspath(os.path.expanduser(src_dir))
tests_dir = os.path.abspath(os.path.expanduser(tests_dir))
except:
except: # lgtm [py/catch-base-exception]
parser.print_help()
sys.exit(1)