-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Fix flakey pylint CI failures #16462
Changes from all commits
0b8356a
cea4ffa
9027fca
e34e599
b28f17d
df2b258
b7958d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
import sys | ||
import warnings | ||
import inspect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for putting the efforts on taming pylint. I'm curious why this reorganization of the code would make the pylint error disappear? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, first I should mention that as I developed the PR on my local machine, I was seeing slightly different pylint output than the upstream CI. This could be due to a different pylint version. In the comment that follows, I'll refer to the pylint command I posted above in the PR description as With the
With the Introducing the line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, pylint is pinned in some cases inside the ci folder: install/requirements We should use just one version of pylint... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI appears to pull in pylint 2.3.1. The most current pylint is 2.4.2. |
||
from . import _numpy_op_doc | ||
from . import numpy as mx_np | ||
from . import numpy_extension as mx_npx | ||
|
@@ -38,13 +39,12 @@ def _get_builtin_op(op_name): | |
return None | ||
|
||
submodule_name = _get_op_submodule_name(op_name, op_name_prefix, submodule_name_list) | ||
op_module = root_module | ||
if len(submodule_name) > 0: | ||
op_module = getattr(root_module, submodule_name[1:-1], None) | ||
if op_module is None: | ||
raise ValueError('Cannot find submodule {} in module {}' | ||
.format(submodule_name[1:-1], root_module.__name__)) | ||
else: | ||
op_module = root_module | ||
|
||
op = getattr(op_module, op_name[(len(op_name_prefix)+len(submodule_name)):], None) | ||
if op is None: | ||
|
@@ -61,7 +61,6 @@ def _register_op_signatures(): | |
.format(str(sys.version))) | ||
return | ||
|
||
import inspect | ||
for op_name in dir(_numpy_op_doc): | ||
op = _get_builtin_op(op_name) | ||
if op is not None: | ||
|
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.
Is cyclic import not a valid thing to consider?
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.
Good point, however there are over 90 cyclic-import errors reported. Analyzing the python software architecture and possibly refactoring it to eliminate cyclic imports is beyond the scope of this PR. I'll file an issue to see if one of the python major code owners will look into this.
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.
Sounds good, thanks