-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Conversation
numpy/f2py/crackfortran.py
Outdated
@@ -2553,8 +2552,7 @@ def get_parameters(vars, global_params={}): | |||
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('@,@') | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this reflect a deeper problem? Should the result of markeroutercomma
be used somewhere?
I think this should be left for a future clean-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an unfinished implementation. In short term, replace the block under elif iscomplex(...):
with
outmess(f'get_parameters[TODO]: implement evaluation of complex expression {v}')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is resolved.
Unless one of the f2py people can approve that the unused function call results are indeed not needed, I would suggest removing them for now. @pearu, @melissawm thoughts? |
sure, I'll follow up with a new commit shortly. |
@@ -3107,8 +3105,6 @@ 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() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review covers only the crackfortran.py part.
numpy/f2py/crackfortran.py
Outdated
@@ -1127,7 +1127,6 @@ def analyzeline(m, case, line): | |||
(m.group('this'), ll[:i])) | |||
ll = ll + ','.join(groupcache[groupcounter]['args']) | |||
if i < 0: | |||
i = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is valid removal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, I commited your reviewed changes. Can you tell if you are satisfied ?
The azure lint test seems to fail, reason being outmess(f'get_parameters[TODO]: implement evaluation of complex expression {v}')
, Can you check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a "line too long" error. You'll need to split the line, for instance:
outmess('get_parameters[TODO]:'
f' implement evaluation of complex expression {v}')
(untested).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal looks to be gone, wasn't it valid?
numpy/f2py/crackfortran.py
Outdated
@@ -2553,8 +2552,7 @@ def get_parameters(vars, global_params={}): | |||
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('@,@') | |||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an unfinished implementation. In short term, replace the block under elif iscomplex(...):
with
outmess(f'get_parameters[TODO]: implement evaluation of complex expression {v}')
… in crackfortran.py after review
… added in previous commit
…py - fixed Azure linter 'line too long' error
…ved '_linalgRealType(t)' function from linalg.py
There test failure is unrelated. |
numpy/f2py/crackfortran.py
Outdated
# 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}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is off, should align under first string.
numpy/distutils/system_info.py
Outdated
@@ -3107,7 +3105,8 @@ def show_all(argv=None): | |||
del show_only[show_only.index(name)] | |||
conf = c() | |||
conf.verbosity = 2 | |||
# FIXME: r not used | |||
# we don't need the result, but we want | |||
# the side effect of printing diagnostics | |||
r = conf.get_info() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r = conf.get_info() | |
conf.get_info() |
…les in system_info.py
can anyone review changes ? |
numpy/f2py/crackfortran.py
Outdated
if v[0] == '(' and v[-1] == ')': | ||
# FIXME, unused l looks like potential bug | ||
l = markoutercomma(v[1:-1]).split('@,@') | ||
outmess(f'get_parameters[TODO]:' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outmess(f'get_parameters[TODO]:' | |
outmess(f'get_parameters[TODO]: ' |
Else this will print TODO]:implement
with no space
numpy/f2py/crackfortran.py
Outdated
@@ -2985,7 +2983,7 @@ def expr2name(a, block, args=[]): | |||
|
|||
def analyzeargs(block): | |||
setmesstext(block) | |||
implicitrules, attrrules = buildimplicitrules(block) | |||
implicitrules = buildimplicitrules(block)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implicitrules = buildimplicitrules(block)[0] | |
implicitrules, _ = buildimplicitrules(block) |
Is probably slightly clearer
this seems to be coming from |
Everything besides the f2py seems pretty simple, and I guess Pearu is happy with that. @charris happy to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @default-303 |
Fixes most of the unused variable linting errors shown in LGTM.
partially closes #19077