From 416c2b3df0839fabce47cc202de0014942fc5ed2 Mon Sep 17 00:00:00 2001 From: muupan Date: Wed, 9 Jan 2019 13:26:21 +0900 Subject: [PATCH 1/4] Drop hacking --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 1b8dfc87c..71c935d7c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ -r requirements.txt autopep8 atari_py -hacking +flake8 mock opencv-python pytest From d4edb047c37b4bf828a3646294497c0bcb5eeaf1 Mon Sep 17 00:00:00 2001 From: muupan Date: Wed, 9 Jan 2019 13:42:07 +0900 Subject: [PATCH 2/4] Update the contribution guide --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 849715b7c..bc7b20f35 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,9 +22,9 @@ To test examples, run `test_examples.sh [gpu device id]`. `-1` would run example ## Coding style -We use PEP8. To check your code, use `autopep8` and `flake8` command installed by `hacking` package. +We use PEP8. To check your code, use `autopep8` and `flake8` packages. ``` -$ pip install autopep8 hacking +$ pip install autopep8 flake8 $ autopep8 --diff path/to/your/code.py $ flake8 path/to/your/code.py ``` From eb848e5438b73853e68c3300779b7de3ab043b49 Mon Sep 17 00:00:00 2001 From: muupan Date: Wed, 9 Jan 2019 13:42:47 +0900 Subject: [PATCH 3/4] Update travis ci config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f3cc89c22..77e21cea0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ install: # atari_py==0.1.4 causes an error - pip install atari_py==0.1.1 - pip install autopep8 - - pip install hacking + - pip install flake8 - pip install coveralls - pip install opencv-python - pip install pybullet From 92bc897bae085a57a26c99276536734cbf00f563 Mon Sep 17 00:00:00 2001 From: muupan Date: Wed, 9 Jan 2019 14:33:39 +0900 Subject: [PATCH 4/4] Address E741 ambiguous variable name 'l' --- tests/links_tests/test_noisy_linear.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/links_tests/test_noisy_linear.py b/tests/links_tests/test_noisy_linear.py index cb9390faa..c0cb95edb 100644 --- a/tests/links_tests/test_noisy_linear.py +++ b/tests/links_tests/test_noisy_linear.py @@ -21,34 +21,34 @@ class TestFactorizedNoisyLinear(unittest.TestCase): def setUp(self): mu = chainer.links.Linear(*self.size_args, nobias=self.nobias) - self.l = noisy_linear.FactorizedNoisyLinear(mu) + self.linear = noisy_linear.FactorizedNoisyLinear(mu) def _test_calls(self, xp): x_data = xp.arange(12).astype(numpy.float32).reshape((2, 6)) x = chainer.Variable(x_data) - self.l(x) - self.l(x_data + 1) - self.l(x_data.reshape((2, 3, 2))) + self.linear(x) + self.linear(x_data + 1) + self.linear(x_data.reshape((2, 3, 2))) def test_calls_cpu(self): self._test_calls(numpy) @attr.gpu def test_calls_gpu(self): - self.l.to_gpu(0) + self.linear.to_gpu(0) self._test_calls(cuda.cupy) @attr.gpu def test_calls_gpu_after_to_gpu(self): - mu = self.l.mu + mu = self.linear.mu mu.to_gpu(0) - self.l = noisy_linear.FactorizedNoisyLinear(mu) + self.linear = noisy_linear.FactorizedNoisyLinear(mu) self._test_calls(cuda.cupy) def _test_randomness(self, xp): x = xp.random.standard_normal((10, 6)).astype(numpy.float32) - y1 = self.l(x).array - y2 = self.l(x).array + y1 = self.linear(x).array + y2 = self.linear(x).array d = float(xp.mean(xp.square(y1 - y2))) # The parameter name suggests that @@ -72,14 +72,14 @@ def test_randomness_cpu(self): @attr.gpu @condition.retry(3) def test_randomness_gpu(self): - self.l.to_gpu(0) + self.linear.to_gpu(0) self._test_randomness(cuda.cupy) def _test_non_randomness(self, xp): # Noises should be the same in a batch x0 = xp.random.standard_normal((1, 6)).astype(numpy.float32) x = xp.broadcast_to(x0, (2, 6)) - y = self.l(x).array + y = self.linear(x).array xp.testing.assert_allclose(y[0], y[1], rtol=1e-4) def test_non_randomness_cpu(self): @@ -87,5 +87,5 @@ def test_non_randomness_cpu(self): @attr.gpu def test_non_randomness_gpu(self): - self.l.to_gpu(0) + self.linear.to_gpu(0) self._test_non_randomness(cuda.cupy)