mirror of https://github.com/commaai/tinygrad.git
update pylint path to check indent/space for all (#6022)
also fixed many errors. it was not checking nested dirs. exclude autogen for now. can we use ruff for this?
This commit is contained in:
parent
cfb04c67d1
commit
e6c7c3e499
|
@ -87,8 +87,8 @@ jobs:
|
|||
key: linting-packages-${{ hashFiles('**/setup.py') }}-3.8
|
||||
- name: Install dependencies
|
||||
run: pip install -e '.[linting,testing,docs]' --extra-index-url https://download.pytorch.org/whl/cpu
|
||||
- name: Lint with pylint
|
||||
run: python -m pylint --disable=all -e W0311 -e C0303 --jobs=0 --indent-string=' ' **/*.py
|
||||
- name: Lint bad-indentation and trailing-whitespace with pylint
|
||||
run: python -m pylint --disable=all -e W0311 -e C0303 --jobs=0 --indent-string=' ' --recursive=y .
|
||||
- name: Lint with ruff
|
||||
run: |
|
||||
pip3 install --upgrade --force-reinstall ruff
|
||||
|
|
|
@ -7,7 +7,7 @@ extension-pkg-whitelist=scipy,cereal.messaging.messaging_pyx,PyQt5,av
|
|||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
ignore=CVS,autogen,msm_kgsl.py
|
||||
|
||||
# Add files or directories matching the regex patterns to the blacklist. The
|
||||
# regex matches against base names, not paths.
|
||||
|
|
|
@ -148,7 +148,7 @@ class BertPredictionHeadTransform:
|
|||
self.LayerNorm = LayerNorm(hidden_size, eps=1e-12)
|
||||
|
||||
def __call__(self, hidden_states:Tensor):
|
||||
return self.LayerNorm(gelu(self.dense(hidden_states)))
|
||||
return self.LayerNorm(gelu(self.dense(hidden_states)))
|
||||
|
||||
class BertPooler:
|
||||
def __init__(self, hidden_size:int):
|
||||
|
|
|
@ -21,7 +21,7 @@ if __name__ == '__main__':
|
|||
ast_strs = [args.ast]
|
||||
elif args.file is not None:
|
||||
with open(args.file, 'r') as file:
|
||||
ast_strs = file.readlines()
|
||||
ast_strs = file.readlines()
|
||||
|
||||
for i, ast_str in enumerate(ast_strs):
|
||||
print(f"optimizing {i}/{len(ast_strs)}\nast={ast_str}")
|
||||
|
|
|
@ -908,10 +908,10 @@ class TestIndexing(unittest.TestCase):
|
|||
numpy_testing_assert_equal_helper(out, ref)
|
||||
|
||||
def test_int_indices(self):
|
||||
v = Tensor.randn(5, 7, 3)
|
||||
numpy_testing_assert_equal_helper(v[[0, 4, 2]].shape, (3, 7, 3))
|
||||
numpy_testing_assert_equal_helper(v[:, [0, 4, 2]].shape, (5, 3, 3))
|
||||
numpy_testing_assert_equal_helper(v[:, [[0, 1], [4, 3]]].shape, (5, 2, 2, 3))
|
||||
v = Tensor.randn(5, 7, 3)
|
||||
numpy_testing_assert_equal_helper(v[[0, 4, 2]].shape, (3, 7, 3))
|
||||
numpy_testing_assert_equal_helper(v[:, [0, 4, 2]].shape, (5, 3, 3))
|
||||
numpy_testing_assert_equal_helper(v[:, [[0, 1], [4, 3]]].shape, (5, 2, 2, 3))
|
||||
|
||||
# TODO fancy setitem
|
||||
'''
|
||||
|
@ -983,7 +983,7 @@ class TestIndexing(unittest.TestCase):
|
|||
numpy_testing_assert_equal_helper(x[[1, 2]].shape, (2, 0))
|
||||
numpy_testing_assert_equal_helper(x[[], []].shape, (0,))
|
||||
with self.assertRaises(IndexError):
|
||||
x[:, [0, 1]]
|
||||
x[:, [0, 1]]
|
||||
|
||||
def test_empty_slice(self):
|
||||
x = Tensor.randn(2, 3, 4, 5)
|
||||
|
@ -1036,8 +1036,8 @@ class TestIndexing(unittest.TestCase):
|
|||
a[...] = neg_ones_expanded * 4
|
||||
numpy_testing_assert_equal_helper(a, neg_ones * 4)
|
||||
if a.dim() == 0:
|
||||
with self.assertRaises(IndexError):
|
||||
a[:] = neg_ones_expanded * 5
|
||||
with self.assertRaises(IndexError):
|
||||
a[:] = neg_ones_expanded * 5
|
||||
|
||||
@unittest.skip("bool indexing not supported")
|
||||
def test_index_scalar_with_bool_mask(self):
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestSymbolic(unittest.TestCase):
|
|||
self.helper_test_variable(expr, 0, 1, "(((idx1*4)+FLOAT4_INDEX)<512)")
|
||||
|
||||
def test_div_reduction(self):
|
||||
self.helper_test_variable(Variable("a", 2, 3)//2, 1, 1, "1")
|
||||
self.helper_test_variable(Variable("a", 2, 3)//2, 1, 1, "1")
|
||||
|
||||
def test_var_becomes_num(self):
|
||||
assert isinstance(Variable("a", 2, 2), NumNode)
|
||||
|
|
|
@ -100,7 +100,7 @@ class TestSymbolic(unittest.TestCase):
|
|||
self.helper_test_variable(expr, 0, 1, "(((idx1*4)+FLOAT4_INDEX)<512)")
|
||||
|
||||
def test_div_reduction(self):
|
||||
self.helper_test_variable(Variable("a", 2, 3)//2, 1, 1, "1")
|
||||
self.helper_test_variable(Variable("a", 2, 3)//2, 1, 1, "1")
|
||||
|
||||
#def test_var_becomes_num(self):
|
||||
# assert isinstance(Variable("a", 2, 2), NumNode)
|
||||
|
|
Loading…
Reference in New Issue