From e96e3a376b1589b9d8b3358fbd6a6ce9abcc745e Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 30 Apr 2023 17:33:43 -0400 Subject: [PATCH] reformat --- sachet/server/__init__.py | 4 +++- sachet/server/models.py | 4 +++- sachet/server/views_common.py | 13 +++++++++---- sachet/storage/filesystem.py | 4 +++- tests/test_files.py | 1 - 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/sachet/server/__init__.py b/sachet/server/__init__.py index 0c55c42..e713702 100644 --- a/sachet/server/__init__.py +++ b/sachet/server/__init__.py @@ -14,7 +14,9 @@ with app.app_context(): overlay_config(TestingConfig, "./config-testing.yml") elif app.config["DEBUG"]: overlay_config(DevelopmentConfig) - app.logger.warning("Running in DEVELOPMENT MODE; do NOT use this in production!") + app.logger.warning( + "Running in DEVELOPMENT MODE; do NOT use this in production!" + ) else: overlay_config(ProductionConfig) diff --git a/sachet/server/models.py b/sachet/server/models.py index 291de02..2f24634 100644 --- a/sachet/server/models.py +++ b/sachet/server/models.py @@ -100,7 +100,9 @@ class User(db.Model): "sub": self.username, "jti": jti, } - return jwt.encode(payload, current_app.config.get("SECRET_KEY"), algorithm="HS256") + return jwt.encode( + payload, current_app.config.get("SECRET_KEY"), algorithm="HS256" + ) def read_token(token): """Read a JWT and validate it. diff --git a/sachet/server/views_common.py b/sachet/server/views_common.py index e87ac22..2f5ced5 100644 --- a/sachet/server/views_common.py +++ b/sachet/server/views_common.py @@ -270,10 +270,15 @@ class ModelListAPI(MethodView): per_page = int(json_data.get("per_page", 15)) page = int(json_data.get("page", 1)) except ValueError as e: - return jsonify(dict( - status="fail", - message=str(e), - )), 400 + return ( + jsonify( + dict( + status="fail", + message=str(e), + ) + ), + 400, + ) page_data = ModelClass.query.paginate(page=page, per_page=per_page) data = [model.get_schema().dump(model) for model in page_data] diff --git a/sachet/storage/filesystem.py b/sachet/storage/filesystem.py index b0710f7..d8502ae 100644 --- a/sachet/storage/filesystem.py +++ b/sachet/storage/filesystem.py @@ -18,7 +18,9 @@ class FileSystem(Storage): self._files_directory.mkdir(mode=0o700, exist_ok=True, parents=True) if not self._directory.is_dir(): - raise OSError(f"'{current_app.config['SACHET_FILE_DIR']}' is not a directory.") + raise OSError( + f"'{current_app.config['SACHET_FILE_DIR']}' is not a directory." + ) def _get_path(self, name): name = secure_filename(name) diff --git a/tests/test_files.py b/tests/test_files.py index 014a892..4b5456a 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -253,7 +253,6 @@ class TestSuite: ) assert resp.status_code == 423 - # unlock share resp = client.post( url + "/unlock",