From 897f3c57f8182271aacbb1c614c8617b6a00145b Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 2 Nov 2023 18:47:46 +0100 Subject: [PATCH] Use ruff --- README.md | 4 ---- advlabdb/actions.py | 3 +++ pyproject.toml | 6 +++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c0d19bc..3b069bf 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # AdvLabDB -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) -[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) - ## About AdvLabDB is a database with a web interface for labs. diff --git a/advlabdb/actions.py b/advlabdb/actions.py index 20c4312..19cc2ba 100644 --- a/advlabdb/actions.py +++ b/advlabdb/actions.py @@ -14,6 +14,7 @@ def update_final_experiment_and_part_marks(): flash("Manually updated all final experiment and part marks.", "success") + def backup(backup_prefix): db_path = data_dir / "db/advlabdb.sqlite" @@ -29,9 +30,11 @@ def backup(backup_prefix): else: flash("Failed to create a database backup! Make sure that `sqlite3` is installed on your system!", "danger") + def manual_backup(): backup("manual") + def deactivate_assistants(): user_ids_to_deactivate = db.session.scalars( select(Assistant.user_id) diff --git a/pyproject.toml b/pyproject.toml index d581525..c87c860 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,9 +26,13 @@ sqlalchemy = "<2" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.black] +[tool.ruff] +select = ["E1", "E4", "E7", "E9", "W", "F", "I", "UP"] line-length = 120 +[tool.ruff.per-file-ignores] +"__init__.py" = ["I"] + [tool.isort] profile = "black" skip = ["__init__.py"]