Skip to content
Myr

Direct rewrites are unnecessary, constructor calls are enough

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 5e91b0c · Browse files · 1 file+2 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−3 removed

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:scripts/flask-07-upgrade.py+2 added-3 removed
27 unmodified lines
28 ast = None293031_from_import_re = re.compile(r'^\s*from flask import\s+')32_direct_module_usage_re = re.compile(r'flask\.Module')32_string_re_part = r"('([^'\\]*(?:\\.[^'\\]*)*)'" \33 r'|"([^"\\]*(?:\\.[^"\\]*)*)")'34_url_for_re = re.compile(r'\b(url_for\()(%s)' % _string_re_part)35_after_request_re = re.compile(r'((?:@\S+\.(?:app_)?))(after_request)(\b\s*$)(?m)')
126 unmodified lines
162 if match is not None:163 new_file.extend(rewrite_from_imports(match.group(),164 line[match.end():],165 lineiter))167 continue168 new_file.append(_direct_module_usage_re.sub('flask.Blueprint', line))166 else:167 new_file.append(line)168 return ''.join(new_file)169170171def rewrite_for_blueprints(contents, filename):
63 unmodified lines