From: Michael Orlitzky Date: Wed, 26 Oct 2016 18:31:34 +0000 (-0400) Subject: Clean up a few pylint warnings and make "doc" a phony target. X-Git-Tag: 0.1.0~116 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=59a1dcf2bf416a2527f9fdfb377afbbfa6cef696;p=dunshire.git Clean up a few pylint warnings and make "doc" a phony target. --- diff --git a/makefile b/makefile index 0cd5182..aedc342 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,11 @@ PN := dunshire SRCS := $(PN)/*.py test/*.py -doc: $(SRCS) doc/source/conf.py doc/makefile +# Sphinx tries to keep track of which docs need to be built on its +# own. We could do better, but we would have to duplicate all of the +# information that we already gave Sphinx to make it work. +.PHONY: doc +doc: cd doc && $(MAKE) html .PHONY: doctest diff --git a/test/__init__.py b/test/__init__.py index 6942bf2..4241453 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -30,10 +30,10 @@ def build_suite(): suite.addTest(slg_tests) return suite -def run_suite(s): +def run_suite(suite): """ Run all of the unit and doctests for the ``dunshire`` and ``test`` packages. """ runner = TextTestRunner(verbosity=1) - runner.run(s) + runner.run(suite) diff --git a/test/__main__.py b/test/__main__.py index 175c884..6a8af8a 100644 --- a/test/__main__.py +++ b/test/__main__.py @@ -1,3 +1,6 @@ +""" +An implementation of __main__() that allows us to "run this module." +""" from test import build_suite, run_suite run_suite(build_suite()) diff --git a/test/symmetric_linear_game_test.py b/test/symmetric_linear_game_test.py index f61356d..69c352a 100644 --- a/test/symmetric_linear_game_test.py +++ b/test/symmetric_linear_game_test.py @@ -39,8 +39,8 @@ def random_matrix(dims): (3, 3) """ - return matrix([[uniform(-10, 10) for i in range(dims)] - for j in range(dims)]) + return matrix([[uniform(-10, 10) for _ in range(dims)] + for _ in range(dims)]) def random_nonnegative_matrix(dims): @@ -194,7 +194,7 @@ def random_lyapunov_like_icecream(dims): """ a = matrix([uniform(-10, 10)], (1, 1)) - b = matrix([uniform(-10, 10) for idx in range(dims-1)], (dims-1, 1)) + b = matrix([uniform(-10, 10) for _ in range(dims-1)], (dims-1, 1)) D = random_skew_symmetric_matrix(dims-1) + a*identity(dims-1) row1 = append_col(a, b.trans()) row2 = append_col(b, D) @@ -208,8 +208,8 @@ def random_orthant_params(): """ ambient_dim = randint(1, 10) K = NonnegativeOrthant(ambient_dim) - e1 = [uniform(0.5, 10) for idx in range(K.dimension())] - e2 = [uniform(0.5, 10) for idx in range(K.dimension())] + e1 = [uniform(0.5, 10) for _ in range(K.dimension())] + e2 = [uniform(0.5, 10) for _ in range(K.dimension())] L = random_matrix(K.dimension()) return (L, K, matrix(e1), matrix(e2)) @@ -234,8 +234,8 @@ def random_icecream_params(): # non-height part is sqrt(dim(K) - 1), and we can divide by # twice that. fudge_factor = 1.0 / (2.0*sqrt(K.dimension() - 1.0)) - e1 += [fudge_factor*uniform(0, 1) for idx in range(K.dimension() - 1)] - e2 += [fudge_factor*uniform(0, 1) for idx in range(K.dimension() - 1)] + e1 += [fudge_factor*uniform(0, 1) for _ in range(K.dimension() - 1)] + e2 += [fudge_factor*uniform(0, 1) for _ in range(K.dimension() - 1)] L = random_matrix(K.dimension()) return (L, K, matrix(e1), matrix(e2))