diff options
author | David Robertson <davidr@element.io> | 2022-04-01 14:05:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 13:05:21 +0000 |
commit | 21351820e01e4ec1095707d3b9b34746429d9828 (patch) | |
tree | d04ea89ca69fbbc1fe6c30d1d69742f1dc433a9b | |
parent | Move single-use methods out of `TestCase` (#12348) (diff) | |
download | synapse-21351820e01e4ec1095707d3b9b34746429d9828.tar.xz |
Remove `list_url_patterns` dev script (#12349)
-rw-r--r-- | changelog.d/12349.misc | 1 | ||||
-rw-r--r-- | mypy.ini | 1 | ||||
-rwxr-xr-x | scripts-dev/list_url_patterns.py | 60 |
3 files changed, 1 insertions, 61 deletions
diff --git a/changelog.d/12349.misc b/changelog.d/12349.misc new file mode 100644 index 0000000000..2b96e2d938 --- /dev/null +++ b/changelog.d/12349.misc @@ -0,0 +1 @@ +Remove unused and broken dev script `list_url_patterns.py`. \ No newline at end of file diff --git a/mypy.ini b/mypy.ini index d371886a8d..33c7d3e638 100644 --- a/mypy.ini +++ b/mypy.ini @@ -28,7 +28,6 @@ exclude = (?x) |scripts-dev/definitions.py |scripts-dev/federation_client.py |scripts-dev/hash_history.py - |scripts-dev/list_url_patterns.py |scripts-dev/release.py |scripts-dev/tail-synapse.py diff --git a/scripts-dev/list_url_patterns.py b/scripts-dev/list_url_patterns.py deleted file mode 100755 index e85420dea8..0000000000 --- a/scripts-dev/list_url_patterns.py +++ /dev/null @@ -1,60 +0,0 @@ -#! /usr/bin/python - -import argparse -import ast -import os -import sys - -import yaml - -PATTERNS_V1 = [] -PATTERNS_V2 = [] - -RESULT = {"v1": PATTERNS_V1, "v2": PATTERNS_V2} - - -class CallVisitor(ast.NodeVisitor): - def visit_Call(self, node): - if isinstance(node.func, ast.Name): - name = node.func.id - else: - return - - if name == "client_patterns": - PATTERNS_V2.append(node.args[0].s) - - -def find_patterns_in_code(input_code): - input_ast = ast.parse(input_code) - visitor = CallVisitor() - visitor.visit(input_ast) - - -def find_patterns_in_file(filepath): - with open(filepath) as f: - find_patterns_in_code(f.read()) - - -parser = argparse.ArgumentParser(description="Find url patterns.") - -parser.add_argument( - "directories", - nargs="+", - metavar="DIR", - help="Directories to search for definitions", -) - -args = parser.parse_args() - - -for directory in args.directories: - for root, _, files in os.walk(directory): - for filename in files: - if filename.endswith(".py"): - filepath = os.path.join(root, filename) - find_patterns_in_file(filepath) - -PATTERNS_V1.sort() -PATTERNS_V2.sort() - -yaml.dump(RESULT, sys.stdout, default_flow_style=False) |