Use generator expressions where possible.
This commit is contained in:
parent
ba3a56989e
commit
e49a0aa0ed
@ -92,7 +92,7 @@ def _is_url_naive(url):
|
||||
"""Naive check if given url (QUrl) is really an url."""
|
||||
PROTOCOLS = ['http://', 'https://']
|
||||
u = urlstring(url)
|
||||
return (any([u.startswith(proto) for proto in PROTOCOLS]) or '.' in u or
|
||||
return (any(u.startswith(proto) for proto in PROTOCOLS) or '.' in u or
|
||||
is_about_url(url) or u == 'localhost')
|
||||
|
||||
|
||||
|
@ -398,7 +398,7 @@ class TabbedBrowser(TabWidget):
|
||||
# - Switch back to #1 when loading finished
|
||||
# - It seems loadingStarted is before loadingFinished
|
||||
dbgstr = "{} ({})".format(
|
||||
signal.signal, ','.join([str(e) for e in args]))
|
||||
signal.signal, ','.join(str(e) for e in args))
|
||||
sender = self.sender()
|
||||
if not isinstance(sender, BrowserTab):
|
||||
# FIXME why does this happen?
|
||||
@ -427,7 +427,7 @@ class TabbedBrowser(TabWidget):
|
||||
|
||||
"""
|
||||
for (sigstr, (signal, args)) in self.widget(idx).signal_cache.items():
|
||||
dbgstr = "{} ({})".format(sigstr, ','.join([str(e) for e in args]))
|
||||
dbgstr = "{} ({})".format(sigstr, ','.join(str(e) for e in args))
|
||||
logging.debug('signal cache: emitting {}'.format(dbgstr))
|
||||
signal.emit(*args)
|
||||
|
||||
|
@ -119,7 +119,7 @@ def check_line():
|
||||
ret = []
|
||||
try:
|
||||
for (dirpath, dirnames, filenames) in os.walk(options['target']):
|
||||
for name in [e for e in filenames if e.endswith('.py')]:
|
||||
for name in (e for e in filenames if e.endswith('.py')):
|
||||
fn = os.path.join(dirpath, name)
|
||||
ret.append(_check_line(fn))
|
||||
status['line'] = all(ret)
|
||||
@ -134,7 +134,7 @@ def _check_line(fn):
|
||||
if b'\r\n' in line:
|
||||
print('Found CRLF in {}'.format(fn))
|
||||
return False
|
||||
elif any([line.decode('UTF-8').startswith(c * 7) for c in "<>=|"]):
|
||||
elif any(line.decode('UTF-8').startswith(c * 7) for c in "<>=|"):
|
||||
print('Found conflict marker in {}'.format(fn))
|
||||
return False
|
||||
elif any([line.decode('UTF-8').rstrip('\r\n').endswith(c)
|
||||
@ -182,7 +182,7 @@ print('Exit status values:')
|
||||
for (k, v) in status.items():
|
||||
print(' {} - {}'.format(k, v))
|
||||
|
||||
if all([val in [True, 0] for val in status]):
|
||||
if all(val in [True, 0] for val in status):
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user