From 77c7ed0e93bff2ef7bb1981bf1b9a996aaca6f19 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 5 Feb 2016 15:43:27 +0000 Subject: [PATCH] Report the v1 and v2 patterns separately --- scripts-dev/list_url_patterns.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts-dev/list_url_patterns.py b/scripts-dev/list_url_patterns.py index 23bcc6b03..58d40c4ff 100755 --- a/scripts-dev/list_url_patterns.py +++ b/scripts-dev/list_url_patterns.py @@ -6,8 +6,13 @@ import os import sys import yaml -PATTERNS = [] +PATTERNS_V1 = [] +PATTERNS_V2 = [] +RESULT = { + "v1": PATTERNS_V1, + "v2": PATTERNS_V2, +} class CallVisitor(ast.NodeVisitor): def visit_Call(self, node): @@ -16,10 +21,11 @@ class CallVisitor(ast.NodeVisitor): else: return + if name == "client_path_patterns": - PATTERNS.append(node.args[0].s) + PATTERNS_V1.append(node.args[0].s) elif name == "client_v2_patterns": - PATTERNS.append(node.args[0].s) + PATTERNS_V2.append(node.args[0].s) def find_patterns_in_code(input_code): @@ -50,5 +56,7 @@ for directory in args.directories: filepath = os.path.join(root, filename) find_patterns_in_file(filepath) +PATTERNS_V1.sort() +PATTERNS_V2.sort() -yaml.dump(sorted(PATTERNS), sys.stdout, default_flow_style=False) +yaml.dump(RESULT, sys.stdout, default_flow_style=False)