Skip to content

Commit

Permalink
Merge af5ca6e into c616328
Browse files Browse the repository at this point in the history
  • Loading branch information
jugmac00 authored May 21, 2021
2 parents c616328 + af5ca6e commit 872f74a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/flask_uploads/flask_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def configure_uploads(app: Flask, upload_sets: Iterable['UploadSet']) -> None:
upload_sets = (upload_sets,)

if not hasattr(app, 'upload_set_config'):
app.upload_set_config = {}
set_config = app.upload_set_config
app.upload_set_config = {} # type: ignore
set_config = app.upload_set_config # type: ignore
defaults = dict(
dest=app.config.get('UPLOADS_DEFAULT_DEST'),
url=app.config.get('UPLOADS_DEFAULT_URL')
Expand Down Expand Up @@ -214,7 +214,7 @@ def config(self) -> 'UploadConfiguration':
return self._config
try:
upload_configuration = (
current_app.upload_set_config[self.name]
current_app.upload_set_config[self.name] # type: ignore
) # type: UploadConfiguration
return upload_configuration
except AttributeError:
Expand Down Expand Up @@ -368,7 +368,7 @@ def resolve_conflict(self, target_folder: str, basename: str) -> str:

@uploads_mod.route('/<setname>/<path:filename>')
def uploaded_file(setname: UploadSet, filename: str) -> Any:
config = current_app.upload_set_config.get(setname)
config = current_app.upload_set_config.get(setname) # type: ignore
if config is None:
abort(404)
return send_from_directory(config.destination, filename)
4 changes: 2 additions & 2 deletions src/flask_uploads/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
- it has to be importable
- it can't be moved in the tests directory
"""
from typing import IO
from typing import Any
from typing import BinaryIO
from typing import Optional

from werkzeug.datastructures import FileStorage
Expand All @@ -32,7 +32,7 @@ class TestingFileStorage(FileStorage):
"""
def __init__(
self,
stream: Optional[IO[bytes]] = None,
stream: Optional[BinaryIO] = None,
filename: Optional[str] = None,
name: Optional[str] = None,
content_type: str = 'application/octet-stream',
Expand Down

0 comments on commit 872f74a

Please sign in to comment.