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
[Pylint][microTVM] Applying Pylint rules to unittest folder #12063
base: main
Are you sure you want to change the base?
Conversation
c3a31ca
to
3f4487f
Compare
777ac36
to
eeef2b6
Compare
eeef2b6
to
032271c
Compare
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.
thanks @alanmacd , left some comments
enable_usmp, expect_exception = tvm.testing.parameters((True, True), (False, False)) | ||
|
||
|
||
@pytest.mark.parametrize("enable_usmp,expect_exception", [(True, True), (False, False)]) |
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.
@Lunderberg here's an instance where we needed to undo tvm.testing.parameters. i'd love to find way around doing that. we could consider making tvm.testing.parameters mutate the scope of its caller...i don't love that but it does handily solve the lint problems.
import tvm.testing | ||
|
||
# Currently, there isn't a reasonable way to use @tvm.testing.fixture and not |
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.
possible to put this on line 36 to tie to just to transport?
@@ -32,17 +34,18 @@ def _tvm_handle(self): | |||
|
|||
|
|||
def test_dltensor_compatible(): | |||
"Test DLTensor compatibility" |
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.
nit: i think taht should be """ """-style comment, could you see if we're missing a pylint rule?
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 catch, yes that was a typo. I also confirmed pylint doesn't catch triple quote vs one quote strings, only catches if docstring is missing.
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.
It may be only in a newer version of pylint?
https://pylint.pycqa.org/en/latest/user_guide/messages/convention/bad-docstring-quotes.html
@@ -191,9 +204,9 @@ def check(remote): | |||
|
|||
remote.cpu().sync() | |||
with pytest.raises(AttributeError): | |||
f3 = remote.system_lib()["notexist"] | |||
func3 = remote.system_lib()["notexist"] # pylint: disable=unused-variable |
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.
can we just delete the func3 =?
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 didn't know if we wanted to change functionality of test, i.e. why is this here, would that throw an exception if something was broken? or is it just abandoned code?
@@ -302,15 +318,15 @@ def check_minrpc(): | |||
a = tvm.nd.array(np.random.uniform(size=102).astype(A.dtype), dev) | |||
b = tvm.nd.array(np.zeros(102, dtype=A.dtype), dev) | |||
time_f = f1.time_evaluator("myadd", remote.cpu(0), number=1) | |||
cost = time_f(a, b).mean | |||
cost = time_f(a, b).mean # pylint: disable=unused-variable |
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.
can we just rm cost =?
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.
yes, I wasn't sure whether to change functionality of test, although in this case probably fine to do so, I figured marking it will flag it for future test developers who are more familiar with code to decide. This one's probably pretty safe to delete though.
# start server | ||
server = rpc.Server(key="x1") | ||
client = rpc.connect("127.0.0.1", server.port, key="x1") | ||
|
||
m = client.get_function("rpc.test.remote_return_nd") | ||
get_arr = m("get_arr") | ||
ref_count = m("ref_count") | ||
ref_count = m("ref_count") # pylint: disable=unused-variable |
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.
consider removing ref_count =
…ower-case single-letter entries; remove related pylint disables;
Apply Pylint to the following files for issue #11414
Notes:
@areusch @Mousius
cc @gromero @mehrdadh