|
|
@ -29,7 +29,6 @@ except ImportError: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_from_import_re = re.compile(r'^\s*from flask import\s+') |
|
|
|
_from_import_re = re.compile(r'^\s*from flask import\s+') |
|
|
|
_direct_module_usage_re = re.compile(r'flask\.Module') |
|
|
|
|
|
|
|
_string_re_part = r"('([^'\\]*(?:\\.[^'\\]*)*)'" \ |
|
|
|
_string_re_part = r"('([^'\\]*(?:\\.[^'\\]*)*)'" \ |
|
|
|
r'|"([^"\\]*(?:\\.[^"\\]*)*)")' |
|
|
|
r'|"([^"\\]*(?:\\.[^"\\]*)*)")' |
|
|
|
_url_for_re = re.compile(r'\b(url_for\()(%s)' % _string_re_part) |
|
|
|
_url_for_re = re.compile(r'\b(url_for\()(%s)' % _string_re_part) |
|
|
@ -164,8 +163,8 @@ def rewrite_blueprint_imports(contents): |
|
|
|
new_file.extend(rewrite_from_imports(match.group(), |
|
|
|
new_file.extend(rewrite_from_imports(match.group(), |
|
|
|
line[match.end():], |
|
|
|
line[match.end():], |
|
|
|
lineiter)) |
|
|
|
lineiter)) |
|
|
|
continue |
|
|
|
else: |
|
|
|
new_file.append(_direct_module_usage_re.sub('flask.Blueprint', line)) |
|
|
|
new_file.append(line) |
|
|
|
return ''.join(new_file) |
|
|
|
return ''.join(new_file) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|