From 0a16e3c97d7f0e692428126ae1759fe0f925bf8f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 13 Oct 2016 19:04:44 -0400 Subject: [PATCH] Fix two more pylint bad-variable-name warnings. --- makefile | 5 +---- src/dunshire/errors.py | 3 ++- src/dunshire/games.py | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/makefile b/makefile index 813d728..1f991d2 100644 --- a/makefile +++ b/makefile @@ -11,10 +11,7 @@ check: .PHONY: lint lint: - PYTHONPATH="$(SRCDIR)" pylint \ - --reports=n \ - --good-names='b,c,e1,e2,h,A,C,G,K,_K,L,L_matrix,_L,indented_L,M' \ - $(SRCS) + PYTHONPATH="$(SRCDIR)" pylint --rcfile=./.pylintrc $(SRCS) .PHONY: clean clean: diff --git a/src/dunshire/errors.py b/src/dunshire/errors.py index 4e292ac..99df2a1 100644 --- a/src/dunshire/errors.py +++ b/src/dunshire/errors.py @@ -70,7 +70,8 @@ class GameUnsolvableException(Exception): ... 'dual objective': 1.0, ... 'primal objective': None, ... 'gap': None, - ... 'residual as primal infeasibility certificate': 3.986246886102996e-09} + ... 'residual as primal infeasibility certificate': + ... 3.986246886102996e-09} >>> print(GameUnsolvableException(d)) Solution failed with result "primal infeasible." CVXOPT returned: diff --git a/src/dunshire/games.py b/src/dunshire/games.py index 3d4b09a..10a5eee 100644 --- a/src/dunshire/games.py +++ b/src/dunshire/games.py @@ -545,10 +545,10 @@ def _random_skew_symmetric_matrix(dims): """ strict_ut = [[uniform(-10, 10)*int(i < j) for i in range(dims)] - for j in range(dims)] + for j in range(dims)] - strict_ut = matrix(strict_ut, (dims,dims)) - return (strict_ut - strict_ut.trans()) + strict_ut = matrix(strict_ut, (dims, dims)) + return strict_ut - strict_ut.trans() def _random_lyapunov_like_icecream(dims): @@ -556,12 +556,12 @@ def _random_lyapunov_like_icecream(dims): Generate a random Lyapunov-like matrix over the ice-cream cone in ``dims`` dimensions. """ - a = matrix([uniform(-10,10)], (1,1)) - b = matrix([uniform(-10,10) for idx in range(dims-1)], (dims-1, 1)) + a = matrix([uniform(-10, 10)], (1, 1)) + b = matrix([uniform(-10, 10) for idx 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) - return append_row(row1,row2) + return append_row(row1, row2) def _random_orthant_params(): @@ -868,14 +868,15 @@ class SymmetricLinearGameTest(TestCase): # We only check for positive/negative stability if the game # value is not basically zero. If the value is that close to # zero, we just won't check any assertions. + eigs = eigenvalues_re(L) if soln.game_value() > options.ABS_TOL: # L should be positive stable - ps = all([eig > -options.ABS_TOL for eig in eigenvalues_re(L)]) - self.assertTrue(ps) + positive_stable = all([eig > -options.ABS_TOL for eig in eigs]) + self.assertTrue(positive_stable) elif soln.game_value() < -options.ABS_TOL: # L should be negative stable - ns = all([eig < options.ABS_TOL for eig in eigenvalues_re(L)]) - self.assertTrue(ns) + negative_stable = all([eig < options.ABS_TOL for eig in eigs]) + self.assertTrue(negative_stable) # The dual game's value should always equal the primal's. dualsoln = game.dual().solution() -- 2.44.2