8000 MAINT: Removed suitable unused variables shown in LGTM by ajayd-san · Pull Request #19102 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Removed suitable unused variables shown in LGTM #19102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions numpy/core/code_generators/generate_numpy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ def do_generate_api(targets, sources):
numpyapi_list = genapi.get_api_functions('NUMPY_API',
multiarray_funcs)

# FIXME: ordered_funcs_api is unused
ordered_funcs_api = genapi.order_dict(multiarray_funcs)

# Create dict name -> *Api instance
api_name = 'PyArray_API'
multiarray_api_dict = {}
Expand Down
7 changes: 3 additions & 4 deletions numpy/distutils/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,8 +1342,6 @@ def calc_info(self):
lapack = None
atlas_1 = None
for d in lib_dirs:
# FIXME: lapack_atlas is unused
lapack_atlas = self.check_libs2(d, ['lapack_atlas'], [])
atlas = self.check_libs2(d, atlas_libs, [])
if atlas is not None:
lib_dirs2 = [d] + self.combine_paths(d, ['atlas*', 'ATLAS*'])
Expand Down Expand Up @@ -3107,8 +3105,9 @@ def show_all(argv=None):
del show_only[show_only.index(name)]
conf = c()
conf.verbosity = 2
# FIXME: r not used
r = conf.get_info()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this has side effects based on the verbosity settings above, so the conf.get_info call is still needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I'll reflect that change in a new commit.

# we don't need the result, but we want
# the side effect of printing diagnostics
conf.get_info()
if show_only:
log.info('Info classes not defined: %s', ','.join(show_only))

Expand Down
8 changes: 3 additions & 5 deletions numpy/f2py/crackfortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -2551,10 +2551,8 @@ def get_parameters(vars, global_params={}):
v = ''.join(tt)

elif iscomplex(vars[n]):
# FIXME complex numbers may also have exponents
if v[0] == '(' and v[-1] == ')':
# FIXME, unused l looks like potential bug
l = markoutercomma(v[1:-1]).split('@,@')
outmess(f'get_parameters[TODO]: '
f'implement evaluation of complex expression {v}')

try:
params[n] = eval(v, g_params, params)
Expand Down Expand Up @@ -2985,7 +2983,7 @@ def expr2name(a, block, args=[]):

def analyzeargs(block):
setmesstext(block)
implicitrules, attrrules = buildimplicitrules(block)
implicitrules, _ = buildimplicitrules(block)
if 'args' not in block:
block['args'] = []
args = []
Expand Down
2 changes: 1 addition & 1 deletion numpy/lib/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def _read_array_header(fp, version):
if EXPECTED_KEYS != d.keys():
keys = sorted(d.keys())
msg = "Header does not contain the correct keys: {!r}"
raise ValueError(msg.format(d.keys()))
raise ValueError(msg.format(keys))

# Sanity-check the values.
if (not isinstance(d['shape'], tuple) or
Expand Down
1 change: 0 additions & 1 deletion numpy/lib/index_tricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def __getitem__(self, key):
length = int(step)
if step != 1:
step = (key.stop-start)/float(step-1)
stop = key.stop + step
return _nx.arange(0, length, 1, float)*step + start
else:
return _nx.arange(start, stop, step)
Expand Down
2 changes: 1 addition & 1 deletion numpy/linalg/lapack_lite/fortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def getDependencies(filename):
for lineno, line in fortranSourceLines(fo):
m = external_pat.match(line)
if m:
names = line = line[m.end():].strip().split(',')
names = line[m.end():].strip().split(',')
names = [n.strip().lower() for n in names]
names = [n for n in names if n]
routines.extend(names)
Expand Down
6 changes: 0 additions & 6 deletions numpy/linalg/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ def _realType(t, default=double):
def _complexType(t, default=cdouble):
return _complex_types_map.get(t, default)

def _linalgRealType(t):
"""Cast the type t to either double or cdouble."""
return double

def _commonType(*arrays):
# in lite version, use higher precision (always double or cdouble)
result_type = single
Expand Down Expand Up @@ -2275,8 +2271,6 @@ def lstsq(a, b, rcond="warn"):
raise LinAlgError('Incompatible dimensions')

t, result_t = _commonType(a, b)
# FIXME: real_t is unused
real_t = _linalgRealType(t)
result_real_t = _realType(result_t)

# Determine default rcond value
Expand Down
5 changes: 0 additions & 5 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2839,11 +2839,6 @@ def __new__(cls, data=None, mask=nomask, dtype=None, copy=False,
_data = ndarray.view(_data, type(data))
else:
_data = ndarray.view(_data, cls)
# Backwards compatibility w/ numpy.core.ma.
if hasattr(data, '_mask') and not isinstance(data, ndarray):
_data._mask = data._mask
# FIXME _sharedmask is never used.
_sharedmask = True
# Process mask.
# Type of the mask
mdtype = make_mask_descr(_data.dtype)
Expand Down
1 change: 0 additions & 1 deletion numpy/ma/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ def _median(a, axis=None, out=None, overwrite_input=False):
return np.ma.mean(asorted[indexer], axis=axis, out=out)

if asorted.ndim == 1:
counts = count(asorted)
idx, odd = divmod(count(asorted), 2)
mid = asorted[idx + odd - 1:idx + 1]
if np.issubdtype(asorted.dtype, np.inexact) and asorted.size > 0:
Expand Down
2 changes: 0 additions & 2 deletions numpy/ma/mrecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def __new__(cls, shape, dtype=None, buf=None, offset=0, strides=None,
msg = "Mask and data not compatible: data size is %i, " + \
"mask size is %i."
raise MAError(msg % (nd, nm))
copy = True
if not keep_mask:
self.__setmask__(mask)
self._sharedmask = True
Expand Down Expand Up @@ -376,7 +375,6 @@ def view(self, dtype=None, type=None):
try:
if issubclass(dtype, ndarray):
output = ndarray.view(self, dtype)
dtype = None
else:
output = ndarray.view(self, dtype)
# OK, there's the change
Expand Down
0