Skip to content

Commit 1b2a86a

Browse files
committed
Fix #95: Resolve E741 errors
The E741 (Ambiguous variable name) error has been enabled in flake8 3.5.0, which imports pycodestyle 2.1.0 [1]. Resolve the warnings. [1] PyCQA/pycodestyle#598 Signed-off-by: Stephen Finucane <[email protected]>
1 parent 4fb708b commit 1b2a86a

File tree

5 files changed

+95
-95
lines changed

5 files changed

+95
-95
lines changed

testing/test_hookrelay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def hello(self, arg):
2424

2525
plugin = Plugin()
2626
pm.register(plugin)
27-
l = hook.hello(arg=3)
28-
assert l == [4]
27+
out = hook.hello(arg=3)
28+
assert out == [4]
2929
assert not hasattr(hook, 'world')
3030
pm.unregister(plugin)
3131
assert hook.hello(arg=3) == []

testing/test_method_ordering.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,42 +215,42 @@ def test_load_setuptools_not_installed(monkeypatch, pm):
215215

216216

217217
def test_add_tracefuncs(he_pm):
218-
l = []
218+
out = []
219219

220220
class api1(object):
221221
@hookimpl
222222
def he_method1(self):
223-
l.append("he_method1-api1")
223+
out.append("he_method1-api1")
224224

225225
class api2(object):
226226
@hookimpl
227227
def he_method1(self):
228-
l.append("he_method1-api2")
228+
out.append("he_method1-api2")
229229

230230
he_pm.register(api1())
231231
he_pm.register(api2())
232232

233233
def before(hook_name, hook_impls, kwargs):
234-
l.append((hook_name, list(hook_impls), kwargs))
234+
out.append((hook_name, list(hook_impls), kwargs))
235235

236236
def after(outcome, hook_name, hook_impls, kwargs):
237-
l.append((outcome, hook_name, list(hook_impls), kwargs))
237+
out.append((outcome, hook_name, list(hook_impls), kwargs))
238238

239239
undo = he_pm.add_hookcall_monitoring(before, after)
240240

241241
he_pm.hook.he_method1(arg=1)
242-
assert len(l) == 4
243-
assert l[0][0] == "he_method1"
244-
assert len(l[0][1]) == 2
245-
assert isinstance(l[0][2], dict)
246-
assert l[1] == "he_method1-api2"
247-
assert l[2] == "he_method1-api1"
248-
assert len(l[3]) == 4
249-
assert l[3][1] == l[0][0]
242+
assert len(out) == 4
243+
assert out[0][0] == "he_method1"
244+
assert len(out[0][1]) == 2
245+
assert isinstance(out[0][2], dict)
246+
assert out[1] == "he_method1-api2"
247+
assert out[2] == "he_method1-api1"
248+
assert len(out[3]) == 4
249+
assert out[3][1] == out[0][0]
250250

251251
undo()
252252
he_pm.hook.he_method1(arg=1)
253-
assert len(l) == 4 + 2
253+
assert len(out) == 4 + 2
254254

255255

256256
def test_hook_tracing(he_pm):
@@ -268,18 +268,18 @@ def he_method1(self):
268268
raise ValueError()
269269

270270
he_pm.register(api1())
271-
l = []
272-
he_pm.trace.root.setwriter(l.append)
271+
out = []
272+
he_pm.trace.root.setwriter(out.append)
273273
undo = he_pm.enable_tracing()
274274
try:
275275
indent = he_pm.trace.root.indent
276276
he_pm.hook.he_method1(arg=1)
277277
assert indent == he_pm.trace.root.indent
278-
assert len(l) == 2
279-
assert 'he_method1' in l[0]
280-
assert 'finish' in l[1]
278+
assert len(out) == 2
279+
assert 'he_method1' in out[0]
280+
assert 'finish' in out[1]
281281

282-
l[:] = []
282+
out[:] = []
283283
he_pm.register(api2())
284284

285285
with pytest.raises(ValueError):

testing/test_multicall.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111

1212
def test_uses_copy_of_methods():
13-
l = [lambda: 42]
14-
mc = _LegacyMultiCall(l, {})
13+
out = [lambda: 42]
14+
mc = _LegacyMultiCall(out, {})
1515
repr(mc)
16-
l[:] = []
16+
out[:] = []
1717
res = mc.execute()
1818
return res == 42
1919

@@ -112,46 +112,46 @@ def m2():
112112

113113

114114
def test_hookwrapper():
115-
l = []
115+
out = []
116116

117117
@hookimpl(hookwrapper=True)
118118
def m1():
119-
l.append("m1 init")
119+
out.append("m1 init")
120120
yield None
121-
l.append("m1 finish")
121+
out.append("m1 finish")
122122

123123
@hookimpl
124124
def m2():
125-
l.append("m2")
125+
out.append("m2")
126126
return 2
127127

128128
res = MC([m2, m1], {})
129129
assert res == [2]
130-
assert l == ["m1 init", "m2", "m1 finish"]
131-
l[:] = []
130+
assert out == ["m1 init", "m2", "m1 finish"]
131+
out[:] = []
132132
res = MC([m2, m1], {}, {"firstresult": True})
133133
assert res == 2
134-
assert l == ["m1 init", "m2", "m1 finish"]
134+
assert out == ["m1 init", "m2", "m1 finish"]
135135

136136

137137
def test_hookwrapper_order():
138-
l = []
138+
out = []
139139

140140
@hookimpl(hookwrapper=True)
141141
def m1():
142-
l.append("m1 init")
142+
out.append("m1 init")
143143
yield 1
144-
l.append("m1 finish")
144+
out.append("m1 finish")
145145

146146
@hookimpl(hookwrapper=True)
147147
def m2():
148-
l.append("m2 init")
148+
out.append("m2 init")
149149
yield 2
150-
l.append("m2 finish")
150+
out.append("m2 finish")
151151

152152
res = MC([m2, m1], {})
153153
assert res == []
154-
assert l == ["m1 init", "m2 init", "m2 finish", "m1 finish"]
154+
assert out == ["m1 init", "m2 init", "m2 finish", "m1 finish"]
155155

156156

157157
def test_hookwrapper_not_yield():
@@ -177,18 +177,18 @@ def m1():
177177

178178
@pytest.mark.parametrize("exc", [ValueError, SystemExit])
179179
def test_hookwrapper_exception(exc):
180-
l = []
180+
out = []
181181

182182
@hookimpl(hookwrapper=True)
183183
def m1():
184-
l.append("m1 init")
184+
out.append("m1 init")
185185
yield None
186-
l.append("m1 finish")
186+
out.append("m1 finish")
187187

188188
@hookimpl
189189
def m2():
190190
raise exc
191191

192192
with pytest.raises(exc):
193193
MC([m2, m1], {})
194-
assert l == ["m1 init", "m1 finish"]
194+
assert out == ["m1 init", "m1 finish"]

testing/test_pluginmanager.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ class A(object):
2525
assert pm.is_registered(a1)
2626
pm.register(a2, "hello")
2727
assert pm.is_registered(a2)
28-
l = pm.get_plugins()
29-
assert a1 in l
30-
assert a2 in l
28+
out = pm.get_plugins()
29+
assert a1 in out
30+
assert a2 in out
3131
assert pm.get_plugin('hello') == a2
3232
assert pm.unregister(a1) == a1
3333
assert not pm.is_registered(a1)
3434

35-
l = pm.list_name_plugin()
36-
assert len(l) == 1
37-
assert l == [("hello", a2)]
35+
out = pm.list_name_plugin()
36+
assert len(out) == 1
37+
assert out == [("hello", a2)]
3838

3939

4040
def test_has_plugin(pm):
@@ -162,25 +162,25 @@ def he_method1(self, arg):
162162
pm.add_hookspecs(Hooks)
163163

164164
pm.hook.he_method1.call_historic(kwargs=dict(arg=1))
165-
l = []
165+
out = []
166166

167167
class Plugin(object):
168168
@hookimpl
169169
def he_method1(self, arg):
170-
l.append(arg)
170+
out.append(arg)
171171

172172
pm.register(Plugin())
173-
assert l == [1]
173+
assert out == [1]
174174

175175
class Plugin2(object):
176176
@hookimpl
177177
def he_method1(self, arg):
178-
l.append(arg * 10)
178+
out.append(arg * 10)
179179

180180
pm.register(Plugin2())
181-
assert l == [1, 10]
181+
assert out == [1, 10]
182182
pm.hook.he_method1.call_historic(kwargs=dict(arg=12))
183-
assert l == [1, 10, 120, 12]
183+
assert out == [1, 10, 120, 12]
184184

185185

186186
def test_with_result_memorized(pm):
@@ -191,16 +191,16 @@ def he_method1(self, arg):
191191
pm.add_hookspecs(Hooks)
192192

193193
he_method1 = pm.hook.he_method1
194-
he_method1.call_historic(lambda res: l.append(res), dict(arg=1))
195-
l = []
194+
he_method1.call_historic(lambda res: out.append(res), dict(arg=1))
195+
out = []
196196

197197
class Plugin(object):
198198
@hookimpl
199199
def he_method1(self, arg):
200200
return arg * 10
201201

202202
pm.register(Plugin())
203-
assert l == [10]
203+
assert out == [10]
204204

205205

206206
def test_with_callbacks_immediately_executed(pm):
@@ -225,15 +225,15 @@ class Plugin3(object):
225225
def he_method1(self, arg):
226226
return arg * 30
227227

228-
l = []
228+
out = []
229229
pm.register(Plugin1())
230230
pm.register(Plugin2())
231231

232232
he_method1 = pm.hook.he_method1
233-
he_method1.call_historic(lambda res: l.append(res), dict(arg=1))
234-
assert l == [20, 10]
233+
he_method1.call_historic(lambda res: out.append(res), dict(arg=1))
234+
assert out == [20, 10]
235235
pm.register(Plugin3())
236-
assert l == [20, 10, 30]
236+
assert out == [20, 10, 30]
237237

238238

239239
def test_register_historic_incompat_hookwrapper(pm):
@@ -244,12 +244,12 @@ def he_method1(self, arg):
244244

245245
pm.add_hookspecs(Hooks)
246246

247-
l = []
247+
out = []
248248

249249
class Plugin(object):
250250
@hookimpl(hookwrapper=True)
251251
def he_method1(self, arg):
252-
l.append(arg)
252+
out.append(arg)
253253

254254
with pytest.raises(PluginValidationError):
255255
pm.register(Plugin())
@@ -266,8 +266,8 @@ def he_method1(self, arg):
266266
def he_method1(arg):
267267
return arg * 10
268268

269-
l = pm.hook.he_method1.call_extra([he_method1], dict(arg=1))
270-
assert l == [10]
269+
out = pm.hook.he_method1.call_extra([he_method1], dict(arg=1))
270+
assert out == [10]
271271

272272

273273
def test_call_with_too_few_args(pm):
@@ -296,17 +296,17 @@ def he_method1(self, arg):
296296

297297
pm.add_hookspecs(Hooks)
298298

299-
l = []
299+
out = []
300300

301301
class Plugin1(object):
302302
@hookimpl
303303
def he_method1(self, arg):
304-
l.append(arg)
304+
out.append(arg)
305305

306306
class Plugin2(object):
307307
@hookimpl
308308
def he_method1(self, arg):
309-
l.append(arg * 10)
309+
out.append(arg * 10)
310310

311311
class PluginNo(object):
312312
pass
@@ -316,26 +316,26 @@ class PluginNo(object):
316316
pm.register(plugin2)
317317
pm.register(plugin3)
318318
pm.hook.he_method1(arg=1)
319-
assert l == [10, 1]
320-
l[:] = []
319+
assert out == [10, 1]
320+
out[:] = []
321321

322322
hc = pm.subset_hook_caller("he_method1", [plugin1])
323323
hc(arg=2)
324-
assert l == [20]
325-
l[:] = []
324+
assert out == [20]
325+
out[:] = []
326326

327327
hc = pm.subset_hook_caller("he_method1", [plugin2])
328328
hc(arg=2)
329-
assert l == [2]
330-
l[:] = []
329+
assert out == [2]
330+
out[:] = []
331331

332332
pm.unregister(plugin1)
333333
hc(arg=2)
334-
assert l == []
335-
l[:] = []
334+
assert out == []
335+
out[:] = []
336336

337337
pm.hook.he_method1(arg=1)
338-
assert l == [10]
338+
assert out == [10]
339339

340340

341341
def test_multicall_deprecated(pm):

0 commit comments

Comments
 (0)