Skip to content
Snippets Groups Projects
Commit 12ea2929 authored by Andrew Maclean's avatar Andrew Maclean
Browse files

Move regexp compiles out of the loop

parent fcfada7d
No related branches found
No related tags found
No related merge requests found
......@@ -53,13 +53,15 @@ def get_classes_constants(paths):
:param paths: The path(s) to the Python file(s).
:return: The file name, the VTK classes and any VTK constants.
"""
vtk_class_pattern = re.compile(r'(vtk[a-zA-Z]+\S+\()')
vtk_class_pattern1 = re.compile(r'[^\(]+')
vtk_constants_pattern = re.compile(r'(VTK_[A-Z_]+)')
res = collections.defaultdict(set)
for path in paths:
content = path.read_text().split('\n')
for line in content:
vtk_class_pattern = re.compile(r'(vtk[a-zA-Z]+\S+\()')
vtk_class_pattern1 = re.compile(r'[^\(]+')
vtk_constants_pattern = re.compile(r'(VTK_[A-Z_]+)')
m = vtk_class_pattern.search(line)
if m:
for g in m.groups():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment