Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
... which came along new flake8 version.

modified:   src/zope/testbrowser/browser.py
  • Loading branch information
jugmac00 committed May 17, 2020
1 parent efb83e8 commit 194236b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/zope/testbrowser/browser.py
Expand Up @@ -431,8 +431,8 @@ def _findByLabel(self, label, forms, include_subcontrols=False):
control = getattr(wtcontrol, 'control', wtcontrol)
if control.type == 'hidden':
continue
for l in wtcontrol.labels:
if matches(l):
for label in wtcontrol.labels:
if matches(label):
found.append(wtcontrol)
break
return found
Expand Down Expand Up @@ -742,8 +742,8 @@ def __repr__(self):

@Lazy
def labels(self):
return [self.browser.toStr(l)
for l in getControlLabels(self._elem, self._form.html)]
return [self.browser.toStr(label)
for label in getControlLabels(self._elem, self._form.html)]

@property
def controls(self):
Expand Down Expand Up @@ -789,7 +789,7 @@ def labels(self):
labels.append(self._control.value_if_submitted())
if self._elem.text:
labels.append(normalizeWhitespace(self._elem.text))
return [l for l in labels if l]
return [label for label in labels if label]

def mechRepr(self):
name = self.name if self.name is not None else "<None>"
Expand Down Expand Up @@ -1166,8 +1166,8 @@ def optionValue(self):

@Lazy
def labels(self):
return [self.browser.toStr(l)
for l in getControlLabels(self._elem, self._form.html)]
return [self.browser.toStr(label)
for label in getControlLabels(self._elem, self._form.html)]

def __repr__(self):
return (
Expand Down Expand Up @@ -1226,8 +1226,8 @@ def optionValue(self):

@Lazy
def labels(self):
return [self.browser.toStr(l)
for l in getControlLabels(self._elem, self._form.html)]
return [self.browser.toStr(label)
for label in getControlLabels(self._elem, self._form.html)]

def __repr__(self):
return (
Expand Down Expand Up @@ -1375,7 +1375,8 @@ def getControl(controls, label=None, value=None, index=None):

if label is not None:
options = [c for c in controls
if any(isMatching(l, label) for l in c.labels)]
if any(isMatching(control_label, label)
for control_label in c.labels)]
msg = 'label %r' % label
elif value is not None:
options = [c for c in controls if isMatching(c.value, value)]
Expand All @@ -1397,9 +1398,9 @@ def getControlLabels(celem, html):
controlid = celem.attrs.get('id')
if controlid:
forlbls = html.select('label[for="%s"]' % controlid)
labels.extend([normalizeWhitespace(l.text) for l in forlbls])
labels.extend([normalizeWhitespace(label.text) for label in forlbls])

return [l for l in labels if l is not None]
return [label for label in labels if label is not None]


def normalizeWhitespace(string):
Expand Down

0 comments on commit 194236b

Please sign in to comment.