From 4ed6c2272fc12e91301d159b0b655c9208c78962 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:33:32 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.5.0) - [github.com/hadialqattan/pycln: v1.3.5 → v2.4.0](https://github.com/hadialqattan/pycln/compare/v1.3.5...v2.4.0) - [github.com/asottile/yesqa: v1.3.0 → v1.5.0](https://github.com/asottile/yesqa/compare/v1.3.0...v1.5.0) - [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2) - [github.com/psf/black: 22.6.0 → 24.1.1](https://github.com/psf/black/compare/22.6.0...24.1.1) - [github.com/asottile/pyupgrade: v2.34.0 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v2.34.0...v3.15.0) - https://github.com/pre-commit/mirrors-autopep8 → https://github.com/hhatto/autopep8 - [github.com/hhatto/autopep8: v1.6.0 → v2.0.4](https://github.com/hhatto/autopep8/compare/v1.6.0...v2.0.4) - [github.com/PyCQA/flake8: 4.0.1 → 7.0.0](https://github.com/PyCQA/flake8/compare/4.0.1...7.0.0) - [github.com/adrienverge/yamllint: v1.26.3 → v1.33.0](https://github.com/adrienverge/yamllint/compare/v1.26.3...v1.33.0) --- .pre-commit-config.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d79957ab..58cfe63b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: "v4.3.0" + rev: "v4.5.0" hooks: - id: check-merge-conflict - id: end-of-file-fixer @@ -24,34 +24,34 @@ repos: - id: detect-private-key exclude: ^examples|(?:tests/ssl)/ - repo: https://github.com/hadialqattan/pycln - rev: v1.3.5 + rev: v2.4.0 hooks: - id: pycln args: ["--all"] - repo: https://github.com/asottile/yesqa - rev: v1.3.0 + rev: v1.5.0 hooks: - id: yesqa - repo: https://github.com/pycqa/isort - rev: "5.12.0" + rev: "5.13.2" hooks: - id: isort args: ["--profile", "black"] - repo: https://github.com/psf/black - rev: "22.6.0" + rev: "24.1.1" hooks: - id: black - repo: https://github.com/asottile/pyupgrade - rev: "v2.34.0" + rev: "v3.15.0" hooks: - id: pyupgrade args: ["--py37-plus", "--keep-mock"] - - repo: https://github.com/pre-commit/mirrors-autopep8 - rev: "v1.6.0" + - repo: https://github.com/hhatto/autopep8 + rev: "v2.0.4" hooks: - id: autopep8 - repo: https://github.com/PyCQA/flake8 - rev: "4.0.1" + rev: "7.0.0" hooks: - id: flake8 exclude: "^docs/" @@ -61,6 +61,6 @@ repos: - id: rst-linter files: ^[^/]+[.]rst$ - repo: https://github.com/adrienverge/yamllint - rev: "v1.26.3" + rev: "v1.33.0" hooks: - id: yamllint From 555fed08bba84d8e1b672d6c60115778409aab52 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:33:53 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dbbackup/db/base.py | 1 + dbbackup/management/commands/_base.py | 1 + dbbackup/management/commands/mediarestore.py | 1 + dbbackup/storage.py | 1 + dbbackup/tests/commands/test_base.py | 1 + dbbackup/tests/commands/test_dbbackup.py | 1 + dbbackup/tests/commands/test_dbrestore.py | 1 + dbbackup/tests/settings.py | 1 + dbbackup/utils.py | 2 +- 9 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dbbackup/db/base.py b/dbbackup/db/base.py index e67d3c44..5f28e66e 100644 --- a/dbbackup/db/base.py +++ b/dbbackup/db/base.py @@ -1,6 +1,7 @@ """ Base database connectors """ + import logging import os import shlex diff --git a/dbbackup/management/commands/_base.py b/dbbackup/management/commands/_base.py index 48b88578..9149742b 100644 --- a/dbbackup/management/commands/_base.py +++ b/dbbackup/management/commands/_base.py @@ -1,6 +1,7 @@ """ Abstract Command. """ + import logging import sys from optparse import make_option as optparse_make_option diff --git a/dbbackup/management/commands/mediarestore.py b/dbbackup/management/commands/mediarestore.py index 3e135ace..d353be6c 100644 --- a/dbbackup/management/commands/mediarestore.py +++ b/dbbackup/management/commands/mediarestore.py @@ -1,6 +1,7 @@ """ Restore media files. """ + import tarfile from django.core.files.storage import get_storage_class diff --git a/dbbackup/storage.py b/dbbackup/storage.py index 24fa9ab8..52c46540 100644 --- a/dbbackup/storage.py +++ b/dbbackup/storage.py @@ -1,6 +1,7 @@ """ Utils for handle files. """ + import logging from django.core.exceptions import ImproperlyConfigured diff --git a/dbbackup/tests/commands/test_base.py b/dbbackup/tests/commands/test_base.py index f1fd1490..322564ba 100644 --- a/dbbackup/tests/commands/test_base.py +++ b/dbbackup/tests/commands/test_base.py @@ -1,6 +1,7 @@ """ Tests for base command class. """ + import logging import os from io import BytesIO diff --git a/dbbackup/tests/commands/test_dbbackup.py b/dbbackup/tests/commands/test_dbbackup.py index c18fec6e..11fbaedf 100644 --- a/dbbackup/tests/commands/test_dbbackup.py +++ b/dbbackup/tests/commands/test_dbbackup.py @@ -1,6 +1,7 @@ """ Tests for dbbackup command. """ + import os from django.test import TestCase diff --git a/dbbackup/tests/commands/test_dbrestore.py b/dbbackup/tests/commands/test_dbrestore.py index ec0a3d65..7c115c7d 100644 --- a/dbbackup/tests/commands/test_dbrestore.py +++ b/dbbackup/tests/commands/test_dbrestore.py @@ -1,6 +1,7 @@ """ Tests for dbrestore command. """ + from shutil import copyfileobj from tempfile import mktemp diff --git a/dbbackup/tests/settings.py b/dbbackup/tests/settings.py index fd596801..e4870263 100644 --- a/dbbackup/tests/settings.py +++ b/dbbackup/tests/settings.py @@ -1,6 +1,7 @@ """ Configuration and launcher for dbbackup tests. """ + import os import sys import tempfile diff --git a/dbbackup/utils.py b/dbbackup/utils.py index e7cf3109..19edb12b 100644 --- a/dbbackup/utils.py +++ b/dbbackup/utils.py @@ -20,7 +20,7 @@ from django.utils import timezone try: - from pipes import quote + from shlex import quote except ImportError: from shlex import quote From a2460843e2ea8a8848a954d4662ece915ec9c458 Mon Sep 17 00:00:00 2001 From: Archmonger <16909269+Archmonger@users.noreply.github.com> Date: Mon, 29 Jan 2024 14:20:48 -0800 Subject: [PATCH 3/3] simplify shlex import --- dbbackup/utils.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dbbackup/utils.py b/dbbackup/utils.py index 19edb12b..ed4b4520 100644 --- a/dbbackup/utils.py +++ b/dbbackup/utils.py @@ -12,6 +12,7 @@ from datetime import datetime from functools import wraps from getpass import getpass +from shlex import quote from shutil import copyfileobj from django.core.mail import EmailMultiAlternatives @@ -19,11 +20,6 @@ from django.http import HttpRequest from django.utils import timezone -try: - from shlex import quote -except ImportError: - from shlex import quote - from . import settings FAKE_HTTP_REQUEST = HttpRequest()