Module: check_mk
Branch: master
Commit: 43bbfbaba03ca323f0fedaf0aabc27c0eb5345fe
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43bbfbaba03ca3…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jul 26 14:14:22 2018 +0200
Fixed and enabled redefined-argument-from-local warning.
Change-Id: I3842db6f105d83805a690c4ddb2ea6ab600ac567
---
checks/ps.include | 8 ++++----
cmk/gui/bi.py | 4 ++--
cmk/gui/forms.py | 4 ++--
cmk/gui/plugins/views/layouts.py | 4 ++--
cmk/gui/valuespec.py | 18 +++++++++---------
cmk/gui/visuals.py | 14 +++++++-------
cmk/gui/wato/__init__.py | 6 +++---
cmk/gui/watolib.py | 4 ++--
cmk/man_pages.py | 4 ++--
cmk_base/prediction.py | 2 +-
tests/pylint/pylintrc | 1 -
11 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/checks/ps.include b/checks/ps.include
index 707befc..ced3786 100644
--- a/checks/ps.include
+++ b/checks/ps.include
@@ -549,12 +549,12 @@ def check_ps_common(item, params, parsed, cpu_cores = 1, info_name =
"processes"
for p in processes:
cpu_usage, name, pid = 0.0, None, None
- for item, (value, _unit) in p:
- if item == "name":
+ for the_item, (value, _unit) in p:
+ if the_item == "name":
name = value
- if item == "pid":
+ if the_item == "pid":
pid = value
- elif item.startswith("cpu usage"):
+ elif the_item.startswith("cpu usage"):
cpu_usage += value
if cpu_usage >= warn_cpu_single:
diff --git a/cmk/gui/bi.py b/cmk/gui/bi.py
index 680ae8c..a749d52 100644
--- a/cmk/gui/bi.py
+++ b/cmk/gui/bi.py
@@ -1877,8 +1877,8 @@ def render_tree(node, indent = ""):
h += indent + "Needed Hosts: %s\n" % "
".join([("%s/%s" % h_s) for h_s in node["reqhosts"]])
h += indent + "Aggregation: %s\n" % node["func"]
h += indent + "Nodes:\n"
- for node in node["nodes"]:
- h += render_tree(node, indent + " ")
+ for n in node["nodes"]:
+ h += render_tree(n, indent + " ")
h += "\n"
return h
diff --git a/cmk/gui/forms.py b/cmk/gui/forms.py
index 6cd5424..e2b3efc 100644
--- a/cmk/gui/forms.py
+++ b/cmk/gui/forms.py
@@ -128,10 +128,10 @@ def edit_dictionaries(dictionaries, value, focus=None,
hover_help=True,
html.begin_form(formname, method=method)
- for keyname, title, entries in sections:
+ for keyname, title1, entries in sections:
subvalue = value.get(keyname, {})
if type(entries) == list:
- header(title)
+ header(title1)
first = True
for name, vs in entries:
section(vs.title())
diff --git a/cmk/gui/plugins/views/layouts.py b/cmk/gui/plugins/views/layouts.py
index 34e06ce..af2ee71 100644
--- a/cmk/gui/plugins/views/layouts.py
+++ b/cmk/gui/plugins/views/layouts.py
@@ -578,8 +578,8 @@ def render_grouped_list(rows, view, group_cells, cells, num_columns,
show_checkb
def count_group_members(row, rows):
this_group = group_value(row, group_cells)
members = 1
- for row in rows[1:]:
- that_group = group_value(row, group_cells)
+ for r in rows[1:]:
+ that_group = group_value(r, group_cells)
if that_group == this_group:
members += 1
else:
diff --git a/cmk/gui/valuespec.py b/cmk/gui/valuespec.py
index 9d18ec0..8ea125e 100644
--- a/cmk/gui/valuespec.py
+++ b/cmk/gui/valuespec.py
@@ -236,18 +236,18 @@ class Age(ValueSpec):
takeover = 0
first = True
- for uid, title, value, tkovr_fac in [ ("days", _("days"),
days, 24),
- ("hours", _("hours"),
hours, 60),
- ("minutes", _("mins"),
minutes, 60),
- ("seconds", _("secs"),
seconds, 60) ]:
+ for uid, title, val, tkovr_fac in [ ("days", _("days"),
days, 24),
+ ("hours", _("hours"),
hours, 60),
+ ("minutes", _("mins"),
minutes, 60),
+ ("seconds", _("secs"),
seconds, 60) ]:
if uid in self._display:
- value += takeover
+ val += takeover
takeover = 0
- html.number_input(varprefix + "_" + uid, value, 3 if first else
2)
+ html.number_input(varprefix + "_" + uid, val, 3 if first else
2)
html.write(" %s " % title)
first = False
else:
- takeover = (takeover + value) * tkovr_fac
+ takeover = (takeover + val) * tkovr_fac
html.close_div()
def from_html_vars(self, varprefix):
@@ -4549,8 +4549,8 @@ class CAorCAChain(UploadOrPasteTextFile):
( "subject", _("Subject") ),
]:
text += "<tr><td>%s:</td><td>" % title
- for title, value in sorted(cert_info[what].items()):
- text += "%s: %s<br>" % (title, value)
+ for title1, val in sorted(cert_info[what].items()):
+ text += "%s: %s<br>" % (title1, val)
text += "</tr>"
text += "</table>"
return text
diff --git a/cmk/gui/visuals.py b/cmk/gui/visuals.py
index 4a7695e..9c34f78 100644
--- a/cmk/gui/visuals.py
+++ b/cmk/gui/visuals.py
@@ -431,11 +431,11 @@ def page_list(what, title, visuals, custom_columns = None,
config.user.may("general.edit_foreign_%s" % what):
foreign_visuals.append((owner, visual_name, visual))
- for title, items in [(_('Customized'), my_visuals),
+ for title1, items in [(_('Customized'), my_visuals),
(_("Owned by other users"), foreign_visuals),
(_('Builtin'), builtin_visuals)]:
html.open_h3()
- html.write(title)
+ html.write(title1)
html.close_h3()
table.begin(css = 'data', limit = None)
@@ -477,16 +477,16 @@ def page_list(what, title, visuals, custom_columns = None,
# Title
table.cell(_('Title'))
- title = _u(visual['title'])
+ title2 = _u(visual['title'])
if _visual_can_be_linked(what, visual_name, visuals, visual, owner):
- html.a(title, href="%s.py?%s=%s" % (what_s,
visual_types[what]['ident_attr'], visual_name))
+ html.a(title2, href="%s.py?%s=%s" % (what_s,
visual_types[what]['ident_attr'], visual_name))
else:
- html.write_text(title)
+ html.write_text(title2)
html.help(_u(visual['description']))
# Custom cols
- for title, renderer in custom_columns:
- table.cell(title, renderer(visual))
+ for title3, renderer in custom_columns:
+ table.cell(title3, renderer(visual))
# Owner
if owner == "":
diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py
index 560d800..01efc21 100644
--- a/cmk/gui/wato/__init__.py
+++ b/cmk/gui/wato/__init__.py
@@ -11948,7 +11948,7 @@ def change_host_tags_in_rules(folder, operations, mode):
for varname, ruleset in rulesets.get_rulesets().items():
rules_to_delete = set([])
- for folder, rulenr, rule in ruleset.get_rules():
+ for _folder, _rulenr, rule in ruleset.get_rules():
# Handle deletion of complete tag group
if type(operations) == list: # this list of tags to remove
for tag in operations:
@@ -15222,8 +15222,8 @@ class ModeCheckPlugins(WatoMode):
handled_check_names.add(name)
elif type(entries) == dict:
- for key, subentries in entries.items():
- check_entries( key, subentries )
+ for k, subentries in entries.items():
+ check_entries( k, subentries )
for key, entries in self._manpages.items():
check_entries( key, entries )
diff --git a/cmk/gui/watolib.py b/cmk/gui/watolib.py
index 314e7a4..4a20203 100644
--- a/cmk/gui/watolib.py
+++ b/cmk/gui/watolib.py
@@ -2678,10 +2678,10 @@ class SearchFolder(BaseFolder):
def move_hosts(self, host_names, target_folder):
auth_errors = []
- for folder, host_names in self._group_hostnames_by_folder(host_names):
+ for folder, host_names1 in self._group_hostnames_by_folder(host_names):
try:
# FIXME: this is not transaction safe, might get partially finished...
- folder.move_hosts(host_names, target_folder)
+ folder.move_hosts(host_names1, target_folder)
except MKAuthException, e:
auth_errors.append(_("<li>Cannot move hosts from folder %s:
%s</li>") % (folder.alias_path(), e))
self._invalidate_search()
diff --git a/cmk/man_pages.py b/cmk/man_pages.py
index 55eb41d..f2c703f 100644
--- a/cmk/man_pages.py
+++ b/cmk/man_pages.py
@@ -401,8 +401,8 @@ def _dialog_menu(title, text, choices, defvalue, oktext, canceltext):
if defvalue != None:
args += [ "--default-item", defvalue ]
args += [ "--title", title, "--menu", text, "0",
"0", "0" ] # "20", "60", "17" ]
- for text, value in choices:
- args += [ text, value ]
+ for txt, value in choices:
+ args += [ txt, value ]
return _run_dialog(args)
diff --git a/cmk_base/prediction.py b/cmk_base/prediction.py
index ee57d51..67b5633 100644
--- a/cmk_base/prediction.py
+++ b/cmk_base/prediction.py
@@ -168,7 +168,7 @@ def compute_prediction(hostname, service_description, pred_file,
timegroup, para
consolidated = []
for i in xrange(num_points):
point_line = []
- for from_time, scale, data in slices:
+ for _from_time, scale, data in slices:
idx = int(i / float(scale))
if idx < len(data):
d = data[idx]
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index fc2291e..601d132 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -20,7 +20,6 @@ disable=
no-else-return,
no-self-use,
protected-access,
- redefined-argument-from-local,
reimported,
relative-import,
ungrouped-imports,