Apply Python 3 futurize transform lib2to3.fixes.fix_ws_comma

This commit is contained in:
Eklavya Sharma 2016-03-10 21:03:07 +05:30 committed by Tim Abbott
parent 4fb549abe8
commit e2d5ec1868
7 changed files with 17 additions and 17 deletions

View File

@ -189,7 +189,7 @@ def since():
timestamp = float(datestring)
max_timestamp_processed = datetime.fromtimestamp(timestamp)
logging.info("Reading from resume file: " + datestring)
except (ValueError,IOError) as e:
except (ValueError, IOError) as e:
logging.warn("Could not open resume file: %s" % (
e.message or e.strerror,))
max_timestamp_processed = default_since()

View File

@ -92,7 +92,7 @@ def build_message(event):
action = htmlParser.unescape(re.sub(r"<[^<>]+>", "", event.get('action', '')))
target = htmlParser.unescape(event.get('target', ''))
# Some events have "excerpts", which we blockquote
excerpt = htmlParser.unescape(event.get('excerpt',''))
excerpt = htmlParser.unescape(event.get('excerpt', ''))
if excerpt.strip() == "":
message = '**%s** %s [%s](%s).' % (event['creator']['name'], action, target, event['html_url'])
else:
@ -116,7 +116,7 @@ def run_mirror():
since = re.search(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}-\d{2}:\d{2}", since)
assert since, "resume file does not meet expected format"
since = since.string
except (AssertionError,IOError) as e:
except (AssertionError, IOError) as e:
logging.warn("Could not open resume file: %s" % (e.message or e.strerror,))
since = (datetime.utcnow() - timedelta(hours=config.BASECAMP_INITIAL_HISTORY_HOURS)).isoformat() + "-00:00"
try:

View File

@ -271,7 +271,7 @@ def run_mirror():
else:
timestamp = int(timestamp, 10)
since = datetime.fromtimestamp(timestamp)
except (ValueError,IOError) as e:
except (ValueError, IOError) as e:
logging.warn("Could not open resume file: %s" % (e.message or e.strerror,))
since = default_since()

View File

@ -10,7 +10,7 @@ elems = [tree.getroot().findall(
".//*[@id='%s']/{http://www.w3.org/2000/svg}tspan" % (name,))[0]
for name in ('number_back', 'number_front')]
for i in xrange(1,100):
for i in xrange(1, 100):
# Prepare a modified SVG
s = '%2d' % (i,)
for e in elems:

View File

@ -25,7 +25,7 @@ def get_loc_over_ssh(host, func):
'psql -t -c "SELECT %s()"' % (func,)],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
report('CRITICAL', 'ssh failed: %s: %s' % (str(e),e.output))
report('CRITICAL', 'ssh failed: %s: %s' % (str(e), e.output))
def loc_to_abs_offset(loc_str):
m = re.match(r'^\s*([0-9a-fA-F]+)/([0-9a-fA-F]+)\s*$', loc_str)

View File

@ -56,7 +56,7 @@ f = codecs.open("output-candidate.html", encoding='utf-8', mode="wb")
def uniwrite(f, s):
f.write(s)
uniwrite(f,"""
uniwrite(f, """
<html>
<head>
@ -148,19 +148,19 @@ for msg in result['messages']:
# Don't put tweets in the iframe
continue
uniwrite(f,'<div class="message">')
uniwrite(f, '<div class="message">')
uniwrite(f,'<img class="avatar" src="%s" />' % msg['avatar_url'])
uniwrite(f, '<img class="avatar" src="%s" />' % msg['avatar_url'])
uniwrite(f,'<div class="sender-bar">')
uniwrite(f,'<div class="recipient" style="background-color: %s;">%s &gt; %s</div>' % (color[msg['display_recipient']], msg['display_recipient'], msg['subject']))
uniwrite(f,'<span class="sender">%s</span>' % msg['sender_full_name'])
uniwrite(f,'</div>')
uniwrite(f, '<div class="sender-bar">')
uniwrite(f, '<div class="recipient" style="background-color: %s;">%s &gt; %s</div>' % (color[msg['display_recipient']], msg['display_recipient'], msg['subject']))
uniwrite(f, '<span class="sender">%s</span>' % msg['sender_full_name'])
uniwrite(f, '</div>')
uniwrite(f,'<div class="content">%s</div>' % msg['content'])
uniwrite(f,"</div>")
uniwrite(f, '<div class="content">%s</div>' % msg['content'])
uniwrite(f, "</div>")
uniwrite(f,"""
uniwrite(f, """
</div>
</body>
</html>

View File

@ -270,7 +270,7 @@ def edit(repo, opts, revs, headers):
# Open EDITOR to edit buffer.
editor = os.getenv('EDITOR','emacs')
editor = os.getenv('EDITOR', 'emacs')
subprocess.check_call(shlex.split(editor) + [temp.name])
# Check if buffer is empty, and if so abort.