From 85ac7096419a03d3d62a9f3b20a38f3c43b05601 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 6 Jan 2017 11:00:10 +1030 Subject: [PATCH] tools/extract-formats.py: neaten a little. If we hand an arg, we should use it. Signed-off-by: Rusty Russell --- tools/extract-formats.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/extract-formats.py b/tools/extract-formats.py index cd0d7ff..9809128 100755 --- a/tools/extract-formats.py +++ b/tools/extract-formats.py @@ -16,27 +16,27 @@ def guess_alignment(message,name,sizestr): # - node_announcement.ipv6 has size 16, but alignment 4 (to align IPv4 addr). # - node_announcement.alias is a string, so alignment 1 # - signatures have no alignment requirement. - if match.group('name').startswith('pad'): + if name.startswith('pad'): return 1 - if match.group('name') == 'channel-id': + if name == 'channel-id': return 4 - if message == 'node_announcement' and match.group('name') == 'ipv6': + if message == 'node_announcement' and name == 'ipv6': return 4 - if message == 'node_announcement' and match.group('name') == 'alias': + if message == 'node_announcement' and name == 'alias': return 1 - if 'signature' in match.group('name'): + if 'signature' in name: return 1 # Size can be variable. try: - size = int(match.group('size')) + size = int(sizestr) except ValueError: # If it contains a "*xxx" factor, that's our per-unit size. - s = re.search('\*([0-9]*)$', match.group('size')) + s = re.search('\*([0-9]*)$', sizestr) if s is None: size = 1 else: