update editorconfig, enforce via CI (#1343)

* update editorconfig to set unix-style newlines and trim whitespace

* add editorconfig github action to the CI

* fix whitespace
This commit is contained in:
Pavol Rusnak
2023-07-31 03:44:30 +02:00
committed by GitHub
parent c2b82ea8ac
commit da2efecbe2
23 changed files with 182 additions and 158 deletions

View File

@@ -6,7 +6,7 @@ from unittest.mock import patch, MagicMock
import torch
import numpy as np
from tinygrad.helpers import getenv
from tinygrad.helpers import getenv
from extra.utils import fetch, temp, download_file
from tinygrad.state import torch_load
from PIL import Image
@@ -33,7 +33,7 @@ class TestFetchRelative(unittest.TestCase):
os.chdir(self.tempdir.name)
with open('test_file.txt', 'x') as f:
f.write("12345")
def tearDown(self):
os.chdir(self.working_dir)
self.tempdir.cleanup()
@@ -41,7 +41,7 @@ class TestFetchRelative(unittest.TestCase):
#test ./
def test_fetch_relative_dotslash(self):
self.assertEqual(b'12345', fetch("./test_file.txt"))
#test ../
def test_fetch_relative_dotdotslash(self):
os.mkdir('test_file_path')
@@ -92,7 +92,7 @@ class TestUtils(unittest.TestCase):
)
if isfloat16: model = model.half()
path = temp(f"test_load_{isfloat16}.pt")
path = temp(f"test_load_{isfloat16}.pt")
torch.save(model.state_dict(), path)
model2 = torch_load(path)
@@ -102,5 +102,6 @@ class TestUtils(unittest.TestCase):
assert a.shape == b.shape
assert a.dtype == b.dtype
assert np.array_equal(a, b)
if __name__ == '__main__':
unittest.main()
unittest.main()