mirror of
https://github.com/django/django.git
synced 2025-07-23 21:25:40 +00:00
Fixed the remaining E302 violations int eh django package
This commit is contained in:
parent
393cdbfaa2
commit
fe995e6cbd
19 changed files with 199 additions and 0 deletions
|
@ -137,6 +137,7 @@ _POST_FORM_RE = \
|
|||
_FORM_CLOSE_RE = re.compile(r'</form\s*>')
|
||||
_TOKEN_RE = re.compile('\{% csrf_token')
|
||||
|
||||
|
||||
def get_template_dirs():
|
||||
"""
|
||||
Returns a set of all directories that contain project templates.
|
||||
|
@ -153,6 +154,7 @@ def get_template_dirs():
|
|||
dirs.update(app_template_dirs)
|
||||
return dirs
|
||||
|
||||
|
||||
def make_template_info(filename, root_dirs):
|
||||
"""
|
||||
Creates a Template object for a filename, calculating the possible
|
||||
|
@ -241,6 +243,7 @@ class Template(object):
|
|||
def __hash__(self):
|
||||
return hash(self.absolute_filename)
|
||||
|
||||
|
||||
def get_templates(dirs):
|
||||
"""
|
||||
Returns all files in dirs that have template extensions, as Template
|
||||
|
@ -257,6 +260,7 @@ def get_templates(dirs):
|
|||
templates.add(t)
|
||||
return templates
|
||||
|
||||
|
||||
def get_python_code(paths):
|
||||
"""
|
||||
Returns all Python code, as a list of tuples, each one being:
|
||||
|
@ -275,6 +279,7 @@ def get_python_code(paths):
|
|||
retval.append((fn, content))
|
||||
return retval
|
||||
|
||||
|
||||
def search_python_list(python_code, template_names):
|
||||
"""
|
||||
Searches python code for a list of template names.
|
||||
|
@ -286,6 +291,7 @@ def search_python_list(python_code, template_names):
|
|||
retval.update(search_python(python_code, tn))
|
||||
return sorted(retval)
|
||||
|
||||
|
||||
def search_python(python_code, template_name):
|
||||
"""
|
||||
Searches Python code for a template name.
|
||||
|
@ -300,6 +306,7 @@ def search_python(python_code, template_name):
|
|||
retval.append((fn, ln + 1))
|
||||
return retval
|
||||
|
||||
|
||||
def main(pythonpaths):
|
||||
template_dirs = get_template_dirs()
|
||||
templates = get_templates(template_dirs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue