gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / pylint / test / functional / too_many_locals.py @ 745
History | View | Annotate | Download (1.63 KB)
1 |
# pylint: disable=missing-docstring
|
---|---|
2 |
from __future__ import print_function |
3 |
|
4 |
def function(arg1, arg2, arg3, arg4, arg5): # [too-many-locals] |
5 |
arg6, arg7, arg8, arg9 = arg1, arg2, arg3, arg4 |
6 |
print(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) |
7 |
loc1, loc2, loc3, loc4, loc5, loc6, loc7 = arg1, arg2, arg3, arg4, arg5, \ |
8 |
arg6, arg7 |
9 |
print(loc1, loc2, loc3, loc4, loc5, loc6, loc7) |
10 |
|
11 |
|
12 |
def too_many_locals_function(): # [too-many-locals] |
13 |
"""pylint will complains about too many local variables"""
|
14 |
args0 = 0
|
15 |
args1 = args0 * 1
|
16 |
args2 = args1 * 2
|
17 |
args3 = args2 * 3
|
18 |
args4 = args3 * 4
|
19 |
args5 = args4 * 5
|
20 |
args6 = args5 * 6
|
21 |
args7 = args6 * 7
|
22 |
args8 = args7 * 8
|
23 |
args9 = args8 * 9
|
24 |
args10 = args9 * 10
|
25 |
args11 = args10 * 11
|
26 |
args12 = args11 * 12
|
27 |
args13 = args12 * 13
|
28 |
args14 = args13 * 14
|
29 |
args15 = args14 * 15
|
30 |
return args15
|
31 |
|
32 |
def too_many_arguments_function(arga, argu, argi, arge, argt, args): # [too-many-arguments] |
33 |
"""pylint will complains about too many arguments."""
|
34 |
arga = argu |
35 |
arga += argi |
36 |
arga += arge |
37 |
arga += argt |
38 |
arga += args |
39 |
return arga
|
40 |
|
41 |
def ignored_arguments_function(arga, argu, argi, |
42 |
_arge=0, _argt=1, _args=None): |
43 |
"""pylint will ignore _arge, _argt, _args.
|
44 |
|
45 |
Consequently pylint will only coun 13 arguments.
|
46 |
"""
|
47 |
arg0 = 0
|
48 |
arg1 = arg0 * 1 + arga
|
49 |
arg2 = arg1 * 2 + argu
|
50 |
arg3 = arg2 * 3 + argi
|
51 |
arg4 = arg3 * 4 + _arge
|
52 |
arg5 = arg4 * 5 + _argt
|
53 |
arg6 = arg5 * 6
|
54 |
arg7 = arg6 * 7
|
55 |
arg8 = arg7 * 8
|
56 |
arg9 = arg8 * 9
|
57 |
arg9 += arg0 |
58 |
if _args:
|
59 |
arg9 += sum(_args)
|
60 |
return arg9
|