Skip to content

Commit d1070ad

Browse files
committed
removed unused utils
1 parent 4127133 commit d1070ad

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

flaskcode/utils.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
22
import io
33
import shutil
4-
from functools import wraps
5-
6-
from flask import request, make_response
74

85

96
DEFAULT_CHUNK_SIZE = 16 * 1024
@@ -52,29 +49,19 @@ def dir_tree(abs_path, abs_root_path, exclude_names=None, excluded_extensions=No
5249
continue
5350
new_path = os.path.join(abs_path, name)
5451
if os.path.isdir(new_path):
55-
tree['children'].append(dir_tree(new_path, abs_root_path, exclude_names, excluded_extensions, allowed_extensions))
52+
tree['children'].append(
53+
dir_tree(new_path, abs_root_path, exclude_names, excluded_extensions, allowed_extensions)
54+
)
5655
else:
5756
ext = get_file_extension(name)
58-
if (excluded_extensions and ext in excluded_extensions) or (allowed_extensions and ext not in allowed_extensions):
57+
if (
58+
(excluded_extensions and ext in excluded_extensions) or
59+
(allowed_extensions and ext not in allowed_extensions)
60+
):
5961
continue
6062
tree['children'].append(dict(
6163
name=os.path.basename(new_path),
6264
path_name=new_path[len(abs_root_path):].lstrip('/\\'),# TODO: use os.path.relpath
6365
is_file=True,
6466
))
6567
return tree
66-
67-
68-
def head_compatible(route_handler):
69-
"""View decorator to make view handler compatible for `HEAD` method request."""
70-
@wraps(route_handler)
71-
def decorated_function(*args, **kwargs):
72-
if request.method == 'HEAD':
73-
route_response = route_handler(*args, **kwargs)
74-
response = make_response()
75-
response.headers.clear()
76-
response.headers.extend(route_response.headers)
77-
return response
78-
else:
79-
return route_handler(*args, **kwargs)
80-
return decorated_function

0 commit comments

Comments
 (0)