Download:
child 62:ec4a88629c6e
parent 60:0d69b4a360dc
61:0d94aa1eb6c7
Anton Shestakov <av6@dwimlabs.net>, Thu, 23 Jun 2016 22:23:39 +0800
incoming: use named groups in start-of-the-string regex

1 файлов изменено, 3 вставок(+), 3 удалений(-) [+]
incoming.py file | annotate | diff | comparison | revisions
--- a/incoming.py Thu Jun 23 17:01:41 2016 +0800
+++ b/incoming.py Thu Jun 23 22:23:39 2016 +0800
@@ -40,10 +40,10 @@
warnings = 0
item = {}
- m = re.match(r'^(.+):(\d+):\d+: ', line)
+ m = re.match(r'^(?P<filename>.+):(?P<fileline>\d+):\d+: ', line)
if m is not None:
- item['filename'] = m.group(1)
- item['fileline'] = int(m.group(2))
+ item['filename'] = m.group('filename')
+ item['fileline'] = int(m.group('fileline'))
rest = line[m.end():]
patterns = (