You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/07/12 00:11:19 UTC

[GitHub] [tvm] alanmacd opened a new pull request, #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

alanmacd opened a new pull request, #12063:
URL: https://github.com/apache/tvm/pull/12063

   Apply Pylint to the following files:
   
   - tests/python/unittest/test_crt.py
   - tests/python/unittest/test_micro_model_library_format.py
   - tests/python/unittest/test_micro_project_api.py
   - tests/python/unittest/test_micro_transport.py
   - tests/python/unittest/test_node_reflection.py
   - tests/python/unittest/test_runtime_container.py
   - tests/python/unittest/test_runtime_error.py
   - tests/python/unittest/test_runtime_extension.py
   - tests/python/unittest/test_runtime_graph.py
   - tests/python/unittest/test_runtime_graph_cuda_graph.py 
   - tests/python/unittest/test_runtime_graph_debug.py
   - tests/python/unittest/test_runtime_measure.py
   - tests/python/unittest/test_runtime_module_based_interface.py
   - tests/python/unittest/test_runtime_module_export.py
   - tests/python/unittest/test_runtime_module_load.py
   - tests/python/unittest/test_runtime_profiling.py
   - tests/python/unittest/test_runtime_rpc.py
   - tests/python/unittest/test_runtime_trace.py
   - tests/python/unittest/test_runtime_vm_profiler.py
   
   Notes:
   - retained some variable names when it would either make code less readable or there were confusing redundant names that need deeper level of inspection or refactoring
   - some tvm.testing functions remain problematic
   - whitelisted variable names seem arbitrary, e.g. **x** & **y** are allowed but not **z**?
   - some of these files require much more effort than anticipated, (apologies for the monster-PR), I wonder if we should scan them all and rank from least to most issues to maximize efforts
   
   @areusch @Mousius 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923691418


##########
tests/python/unittest/test_runtime_trace.py:
##########
@@ -61,8 +67,10 @@ def check_assign(dtype):
 
 
 def test_trace_expr_sum_generated():
+    """Test trace expression sum generated"""
+
     @tvm.register_func("tvm.tir.trace_callback3")
-    def trace_buffer(x):
+    def trace_buffer(_):  # pylint: disable=unused-variable

Review Comment:
   I believe these cases are for the local function



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923799063


##########
tests/python/unittest/test_runtime_graph.py:
##########
@@ -82,6 +87,7 @@ def check_remote(server):
         np.testing.assert_equal(out.numpy(), a + 1)
 
     def check_sharing():
+        # pylint: disable=invalid-name

Review Comment:
   updated `good-names` as follows:
   ```
   - good-names=i,j,_,a,b,op,x,y,wd,lr,kv,k,v,s,p,h,c,m,n,X,t,g,f
   + good-names=a,b,c,d,e,f,g,h,i,j,k,m,n,p,s,t,v,w,x,y,z,_,kv,lr,op,wd,X
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923692304


##########
tests/python/unittest/test_runtime_module_export.py:
##########
@@ -153,13 +158,13 @@ def verify_json_import_dso(obj_format):
             f.write(subgraph_json)
 
         # Get Json and module.
-        A = te.placeholder((1024,), name="A")
-        B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name="B")
-        s = te.create_schedule(B.op)
-        f = tvm.build(s, [A, B], "llvm", name="myadd")
+        a = te.placeholder((1024,), name="a")
+        b = te.compute(a.shape, lambda *i: a(*i) + 1.0, name="b")
+        s = te.create_schedule(b.op)
+        f = tvm.build(s, [a, b], "llvm", name="myadd")
         try:
             ext_lib = tvm.runtime.load_module(subgraph_path, "examplejson")
-        except:
+        except:  # pylint: disable=bare-except

Review Comment:
   I didn't know what to add.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923717944


##########
tests/python/unittest/test_runtime_trace.py:
##########
@@ -87,11 +95,14 @@ def check_expr_sum(dtype):
 
 
 def test_trace_expr_sum_args():
+    """Test trace expression sum arguments"""
+
     @tvm.register_func("tvm.tir.trace_silent")
-    def silent(*args):
+    def silent(*_args):  # pylint: disable=unused-variable
         return
 
     def check_expr_sum(dtype):
+        # pylint: disable=invalid-name

Review Comment:
   the unused variable is silent() 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923713946


##########
tests/python/unittest/test_runtime_rpc.py:
##########
@@ -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

Review Comment:
   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?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923691418


##########
tests/python/unittest/test_runtime_trace.py:
##########
@@ -61,8 +67,10 @@ def check_assign(dtype):
 
 
 def test_trace_expr_sum_generated():
+    """Test trace expression sum generated"""
+
     @tvm.register_func("tvm.tir.trace_callback3")
-    def trace_buffer(x):
+    def trace_buffer(_):  # pylint: disable=unused-variable

Review Comment:
   Confirmed, the unused variable is trace_buffer() not _



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923718575


##########
tests/python/unittest/test_runtime_rpc.py:
##########
@@ -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

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923708441


##########
tests/python/unittest/test_runtime_extension.py:
##########
@@ -32,17 +34,18 @@ def _tvm_handle(self):
 
 
 def test_dltensor_compatible():
+    "Test DLTensor compatibility"

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r918452702


##########
tests/python/unittest/test_runtime_graph.py:
##########
@@ -14,21 +14,26 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+"""Test runtime graph"""
+
+import json
+import numpy as np
+
 import tvm
 import tvm.testing
 from tvm import te, runtime
-import numpy as np
-import json
 from tvm import rpc
 from tvm import relay
 from tvm.contrib import utils, graph_executor
 
 
 @tvm.testing.requires_llvm
 def test_graph_simple():
+    """Test simple graph"""
+    # pylint: disable:invalid-name

Review Comment:
   fix redundant disables



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923799063


##########
tests/python/unittest/test_runtime_graph.py:
##########
@@ -82,6 +87,7 @@ def check_remote(server):
         np.testing.assert_equal(out.numpy(), a + 1)
 
     def check_sharing():
+        # pylint: disable=invalid-name

Review Comment:
   updated good-names as follows:
   ```
   - good-names=i,j,_,a,b,op,x,y,wd,lr,kv,k,v,s,p,h,c,m,n,X,t,g,f
   + good-names=a,b,c,d,e,f,g,h,i,j,k,m,n,p,s,t,v,w,x,y,z,_,kv,lr,op,wd,X
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923704330


##########
tests/lint/pylint.sh:
##########
@@ -19,8 +19,29 @@ set -euxo pipefail
 
 python3 -m pylint python/tvm --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint vta/python/vta --rcfile="$(dirname "$0")"/pylintrc
-python3 -m pylint tests/python/unittest/test_tvmscript_type.py --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/contrib/test_cmsisnn --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/relay/aot/*.py --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/ci --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/integration/ --rcfile="$(dirname "$0")"/pylintrc
+
+# tests/python/unitest/
+python3 -m pylint tests/python/unittest/test_crt.py --rcfile="$(dirname "$0")"/pylintrc

Review Comment:
   good idea, fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] areusch commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
areusch commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923678344


##########
tests/python/unittest/test_crt.py:
##########
@@ -210,28 +200,26 @@ def do_test():
         assert aot_executor.get_num_inputs() == 2
         assert aot_executor.get_num_outputs() == 1
 
-        A_np = np.array([[2, 3]], dtype="uint8")
-        B_np = np.array([[4, 7]], dtype="uint8")
+        a_np = np.array([[2, 3]], dtype="uint8")
+        b_np = np.array([[4, 7]], dtype="uint8")
 
-        A_data = aot_executor.get_input("a").copyfrom(A_np)
-        B_data = aot_executor.get_input("b").copyfrom(B_np)
+        aot_executor.get_input("a").copyfrom(a_np)
+        b_data = aot_executor.get_input("b").copyfrom(b_np)
 
         aot_executor.run()
 
         out = aot_executor.get_output(0)
         assert (out.numpy() == np.array([6, 10])).all()
 
-        B_np_new = np.array([[5, 8]])
-        aot_executor.set_input("b", B_np_new)
-        assert (B_data.numpy() == B_np_new).all()
+        b_np_new = np.array([[5, 8]])
+        aot_executor.set_input("b", b_np_new)
+        assert (b_data.numpy() == b_np_new).all()
 
     with _make_session(temp_dir, factory) as sess:
         do_test()
 
 
-enable_usmp, expect_exception = tvm.testing.parameters((True, True), (False, False))
-
-
+@pytest.mark.parametrize("enable_usmp,expect_exception", [(True, True), (False, False)])

Review Comment:
   @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.



##########
tests/python/unittest/test_micro_transport.py:
##########
@@ -18,39 +18,45 @@
 """Tests for common micro transports."""
 
 import logging
-import sys
-import unittest
-
 import pytest
 
+import tvm
 import tvm.testing
 
+# Currently, there isn't a reasonable way to use @tvm.testing.fixture and not

Review Comment:
   possible to put this on line 36 to tie to just to transport?



##########
tests/lint/pylint.sh:
##########
@@ -19,8 +19,29 @@ set -euxo pipefail
 
 python3 -m pylint python/tvm --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint vta/python/vta --rcfile="$(dirname "$0")"/pylintrc
-python3 -m pylint tests/python/unittest/test_tvmscript_type.py --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/contrib/test_cmsisnn --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/relay/aot/*.py --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/ci --rcfile="$(dirname "$0")"/pylintrc
 python3 -m pylint tests/python/integration/ --rcfile="$(dirname "$0")"/pylintrc
+
+# tests/python/unitest/
+python3 -m pylint tests/python/unittest/test_crt.py --rcfile="$(dirname "$0")"/pylintrc

Review Comment:
   just curious, can we create a single pylint command? e.g.
   ```
   python3 -m pylint \
       tests/python/unittest/test_micro_model_library_format.py \
       ... \
       --rcfile="$(dirname "$0")"/pylintrc



##########
tests/python/unittest/test_runtime_rpc.py:
##########
@@ -412,13 +430,14 @@ def check_error_handling():
 
 @tvm.testing.requires_rpc
 def test_rpc_return_ndarray():
+    """Test RPC return NDArray"""
     # 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

Review Comment:
   consider removing ref_count =



##########
tests/python/unittest/test_runtime_extension.py:
##########
@@ -32,17 +34,18 @@ def _tvm_handle(self):
 
 
 def test_dltensor_compatible():
+    "Test DLTensor compatibility"

Review Comment:
   nit: i think taht should be """ """-style comment, could you see if we're missing a pylint rule?



##########
tests/python/unittest/test_runtime_graph.py:
##########
@@ -82,6 +87,7 @@ def check_remote(server):
         np.testing.assert_equal(out.numpy(), a + 1)
 
     def check_sharing():
+        # pylint: disable=invalid-name

Review Comment:
   what if we just adjust good-names in pylintrc?



##########
tests/python/unittest/test_runtime_trace.py:
##########
@@ -61,8 +67,10 @@ def check_assign(dtype):
 
 
 def test_trace_expr_sum_generated():
+    """Test trace expression sum generated"""
+
     @tvm.register_func("tvm.tir.trace_callback3")
-    def trace_buffer(x):
+    def trace_buffer(_):  # pylint: disable=unused-variable

Review Comment:
   this is for the _?



##########
tests/python/unittest/test_runtime_rpc.py:
##########
@@ -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

Review Comment:
   can we just delete the func3 =?



##########
tests/python/unittest/test_runtime_trace.py:
##########
@@ -87,11 +95,14 @@ def check_expr_sum(dtype):
 
 
 def test_trace_expr_sum_args():
+    """Test trace expression sum arguments"""
+
     @tvm.register_func("tvm.tir.trace_silent")
-    def silent(*args):
+    def silent(*_args):  # pylint: disable=unused-variable
         return
 
     def check_expr_sum(dtype):
+        # pylint: disable=invalid-name

Review Comment:
   consider removing in favor of updating good-names



##########
tests/python/unittest/test_runtime_module_export.py:
##########
@@ -153,13 +158,13 @@ def verify_json_import_dso(obj_format):
             f.write(subgraph_json)
 
         # Get Json and module.
-        A = te.placeholder((1024,), name="A")
-        B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name="B")
-        s = te.create_schedule(B.op)
-        f = tvm.build(s, [A, B], "llvm", name="myadd")
+        a = te.placeholder((1024,), name="a")
+        b = te.compute(a.shape, lambda *i: a(*i) + 1.0, name="b")
+        s = te.create_schedule(b.op)
+        f = tvm.build(s, [a, b], "llvm", name="myadd")
         try:
             ext_lib = tvm.runtime.load_module(subgraph_path, "examplejson")
-        except:
+        except:  # pylint: disable=bare-except

Review Comment:
   possible to add at least Exception here?



##########
tests/python/unittest/test_node_reflection.py:
##########
@@ -70,35 +74,40 @@ def test_make_smap():
 
 
 def test_make_node():
+    """Test make node"""
+    # pylint: disable=invalid-name
     x = tvm.ir.make_node("IntImm", dtype="int32", value=10, span=None)
     assert isinstance(x, tvm.tir.IntImm)
     assert x.value == 10
-    A = te.placeholder((10,), name="A")
-    AA = tvm.ir.make_node(
-        "Tensor", shape=A.shape, dtype=A.dtype, op=A.op, value_index=A.value_index
+    a = te.placeholder((10,), name="a")
+    aa = tvm.ir.make_node(
+        "Tensor", shape=a.shape, dtype=a.dtype, op=a.op, value_index=a.value_index
     )
-    assert AA.op == A.op
-    assert AA.value_index == A.value_index
+    assert aa.op == a.op
+    assert aa.value_index == a.value_index
 
-    y = tvm.ir.make_node("IntImm", dtype=tvm.runtime.String("int32"), value=10, span=None)
+    tvm.ir.make_node("IntImm", dtype=tvm.runtime.String("int32"), value=10, span=None)
 
 
 def test_make_sum():
-    A = te.placeholder((2, 10), name="A")
+    # pylint: disable=invalid-name
+    a = te.placeholder((2, 10), name="a")
     k = te.reduce_axis((0, 10), "k")
-    B = te.compute((2,), lambda i: te.sum(A[i, k], axis=k), name="B")
-    json_str = tvm.ir.save_json(B)
-    BB = tvm.ir.load_json(json_str)
-    assert B.op.body[0].combiner is not None
-    assert BB.op.body[0].combiner is not None
+    b = te.compute((2,), lambda i: te.sum(a[i, k], axis=k), name="b")
+    json_str = tvm.ir.save_json(b)
+    bb = tvm.ir.load_json(json_str)
+    assert b.op.body[0].combiner is not None
+    assert bb.op.body[0].combiner is not None
 
 
 def test_env_func():
+    """Test environment function"""
+
     @tvm.register_func("test.env_func")
-    def test(x):
+    def test(x):  # pylint: disable=unused-variable

Review Comment:
   why's this needed?



##########
tests/python/unittest/test_runtime_rpc.py:
##########
@@ -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

Review Comment:
   can we just rm cost =?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923797786


##########
tests/python/unittest/test_node_reflection.py:
##########
@@ -70,35 +74,40 @@ def test_make_smap():
 
 
 def test_make_node():
+    """Test make node"""
+    # pylint: disable=invalid-name
     x = tvm.ir.make_node("IntImm", dtype="int32", value=10, span=None)
     assert isinstance(x, tvm.tir.IntImm)
     assert x.value == 10
-    A = te.placeholder((10,), name="A")
-    AA = tvm.ir.make_node(
-        "Tensor", shape=A.shape, dtype=A.dtype, op=A.op, value_index=A.value_index
+    a = te.placeholder((10,), name="a")
+    aa = tvm.ir.make_node(
+        "Tensor", shape=a.shape, dtype=a.dtype, op=a.op, value_index=a.value_index
     )
-    assert AA.op == A.op
-    assert AA.value_index == A.value_index
+    assert aa.op == a.op
+    assert aa.value_index == a.value_index
 
-    y = tvm.ir.make_node("IntImm", dtype=tvm.runtime.String("int32"), value=10, span=None)
+    tvm.ir.make_node("IntImm", dtype=tvm.runtime.String("int32"), value=10, span=None)
 
 
 def test_make_sum():
-    A = te.placeholder((2, 10), name="A")
+    # pylint: disable=invalid-name
+    a = te.placeholder((2, 10), name="a")
     k = te.reduce_axis((0, 10), "k")
-    B = te.compute((2,), lambda i: te.sum(A[i, k], axis=k), name="B")
-    json_str = tvm.ir.save_json(B)
-    BB = tvm.ir.load_json(json_str)
-    assert B.op.body[0].combiner is not None
-    assert BB.op.body[0].combiner is not None
+    b = te.compute((2,), lambda i: te.sum(a[i, k], axis=k), name="b")
+    json_str = tvm.ir.save_json(b)
+    bb = tvm.ir.load_json(json_str)
+    assert b.op.body[0].combiner is not None
+    assert bb.op.body[0].combiner is not None
 
 
 def test_env_func():
+    """Test environment function"""
+
     @tvm.register_func("test.env_func")
-    def test(x):
+    def test(x):  # pylint: disable=unused-variable

Review Comment:
   test() is seen as "unused"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923712084


##########
tests/python/unittest/test_runtime_extension.py:
##########
@@ -32,17 +34,18 @@ def _tvm_handle(self):
 
 
 def test_dltensor_compatible():
+    "Test DLTensor compatibility"

Review Comment:
   It may be only in a newer version of pylint?
   https://pylint.pycqa.org/en/latest/user_guide/messages/convention/bad-docstring-quotes.html



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] alanmacd commented on a diff in pull request #12063: [Pylint][microTVM] Applying Pylint rules to unittest folder

Posted by GitBox <gi...@apache.org>.
alanmacd commented on code in PR #12063:
URL: https://github.com/apache/tvm/pull/12063#discussion_r923799063


##########
tests/python/unittest/test_runtime_graph.py:
##########
@@ -82,6 +87,7 @@ def check_remote(server):
         np.testing.assert_equal(out.numpy(), a + 1)
 
     def check_sharing():
+        # pylint: disable=invalid-name

Review Comment:
   update good-names as follows:
   ```
   - good-names=i,j,_,a,b,op,x,y,wd,lr,kv,k,v,s,p,h,c,m,n,X,t,g,f
   + good-names=a,b,c,d,e,f,g,h,i,j,k,m,n,p,s,t,v,w,x,y,z,_,kv,lr,op,wd,X
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org