diff --git a/setup.py b/setup.py index 2d91a6a47..feed325ca 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ except ImportError: multiprocessing = None from setuptools.command.build_ext import build_ext -from setuptools import setup, find_packages, Extension, Command +from setuptools import setup, Extension, Command from setuptools.command.sdist import sdist try: diff --git a/src/borg/_hashindex.c b/src/borg/_hashindex.c index 7cd4cf31a..dd704d2de 100644 --- a/src/borg/_hashindex.c +++ b/src/borg/_hashindex.c @@ -1,4 +1,3 @@ - #include #include #include diff --git a/src/borg/archive.py b/src/borg/archive.py index 2c49c18fd..584f5f030 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -1,7 +1,6 @@ import base64 import json import os -import socket import stat import sys import time @@ -32,7 +31,7 @@ from .helpers import HardLinkManager from .helpers import ChunkIteratorFileWrapper, open_item from .helpers import Error, IntegrityError, set_ec from .platform import uid2user, user2uid, gid2group, group2gid -from .helpers import parse_timestamp, to_localtime +from .helpers import parse_timestamp from .helpers import OutputTimestamp, format_timedelta, format_file_size, file_status, FileSize from .helpers import safe_encode, make_path_safe, remove_surrogates from .helpers import StableDict diff --git a/src/borg/chunker.pyx b/src/borg/chunker.pyx index ee9773be4..d9c31d3e3 100644 --- a/src/borg/chunker.pyx +++ b/src/borg/chunker.pyx @@ -6,7 +6,7 @@ import errno import os from collections import namedtuple -from .constants import CH_DATA, CH_ALLOC, CH_HOLE, MAX_DATA_SIZE, zeros +from .constants import CH_DATA, CH_ALLOC, CH_HOLE, zeros from libc.stdlib cimport free diff --git a/src/borg/crypto/key.py b/src/borg/crypto/key.py index cd1fd9324..94f824942 100644 --- a/src/borg/crypto/key.py +++ b/src/borg/crypto/key.py @@ -1,4 +1,3 @@ -import configparser import hmac import os import textwrap @@ -26,7 +25,7 @@ from ..item import Key, EncryptedKey, want_bytes from ..platform import SaveFile from .nonces import NonceManager -from .low_level import AES, bytes_to_long, long_to_bytes, bytes_to_int, num_cipher_blocks, hmac_sha256, blake2b_256, hkdf_hmac_sha512 +from .low_level import AES, bytes_to_int, num_cipher_blocks, hmac_sha256, blake2b_256, hkdf_hmac_sha512 from .low_level import AES256_CTR_HMAC_SHA256, AES256_CTR_BLAKE2b, AES256_OCB, CHACHA20_POLY1305 from . import low_level diff --git a/src/borg/crypto/keymanager.py b/src/borg/crypto/keymanager.py index db5eb23c7..715d451a1 100644 --- a/src/borg/crypto/keymanager.py +++ b/src/borg/crypto/keymanager.py @@ -7,7 +7,7 @@ from hashlib import sha256 from ..helpers import Manifest, NoManifestError, Error, yes, bin_to_hex, dash_open from ..repository import Repository -from .key import CHPOKeyfileKey, KeyfileNotFoundError, RepoKeyNotFoundError, KeyBlobStorage, identify_key +from .key import CHPOKeyfileKey, RepoKeyNotFoundError, KeyBlobStorage, identify_key class UnencryptedRepo(Error): diff --git a/src/borg/crypto/low_level.pyx b/src/borg/crypto/low_level.pyx index d44160b50..c5b8c7c3f 100644 --- a/src/borg/crypto/low_level.pyx +++ b/src/borg/crypto/low_level.pyx @@ -40,7 +40,6 @@ from math import ceil from cpython cimport PyMem_Malloc, PyMem_Free from cpython.buffer cimport PyBUF_SIMPLE, PyObject_GetBuffer, PyBuffer_Release -from cpython.bytes cimport PyBytes_FromStringAndSize API_VERSION = '1.3_01' diff --git a/src/borg/hashindex.pyx b/src/borg/hashindex.pyx index 3cb8d5a4d..15b59b5da 100644 --- a/src/borg/hashindex.pyx +++ b/src/borg/hashindex.pyx @@ -1,13 +1,9 @@ # -*- coding: utf-8 -*- from collections import namedtuple -import locale -import os cimport cython from libc.stdint cimport uint32_t, UINT32_MAX, uint64_t -from libc.errno cimport errno from libc.string cimport memcpy -from cpython.exc cimport PyErr_SetFromErrnoWithFilename from cpython.buffer cimport PyBUF_SIMPLE, PyObject_GetBuffer, PyBuffer_Release from cpython.bytes cimport PyBytes_FromStringAndSize, PyBytes_CheckExact, PyBytes_GET_SIZE, PyBytes_AS_STRING diff --git a/src/borg/helpers/checks.py b/src/borg/helpers/checks.py index 316368b0c..26a6c0129 100644 --- a/src/borg/helpers/checks.py +++ b/src/borg/helpers/checks.py @@ -1,5 +1,4 @@ import os -import sys from .errors import Error from ..platformflags import is_win32, is_linux, is_freebsd, is_darwin diff --git a/src/borg/helpers/parseformat.py b/src/borg/helpers/parseformat.py index 808466776..a9d2ac960 100644 --- a/src/borg/helpers/parseformat.py +++ b/src/borg/helpers/parseformat.py @@ -20,7 +20,7 @@ logger = create_logger() from .errors import Error from .fs import get_keys_dir from .msgpack import Timestamp -from .time import OutputTimestamp, format_time, to_localtime, safe_timestamp, safe_s +from .time import OutputTimestamp, format_time, to_localtime, safe_timestamp from .. import __version__ as borg_version from .. import __version_tuple__ as borg_version_tuple from ..constants import * # NOQA diff --git a/src/borg/platform/linux.pyx b/src/borg/platform/linux.pyx index 01fe409fb..5fc37680d 100644 --- a/src/borg/platform/linux.pyx +++ b/src/borg/platform/linux.pyx @@ -1,7 +1,6 @@ import os import re import stat -import subprocess from .posix import posix_acl_use_stored_uid_gid from .posix import user2uid, group2gid @@ -17,7 +16,6 @@ except ImportError: SYNC_FILE_RANGE_LOADED = False from libc cimport errno -from libc.stdint cimport int64_t API_VERSION = '1.2_05' diff --git a/src/borg/testsuite/__init__.py b/src/borg/testsuite/__init__.py index 307798e64..0ad942482 100644 --- a/src/borg/testsuite/__init__.py +++ b/src/borg/testsuite/__init__.py @@ -12,7 +12,6 @@ import sys import sysconfig import tempfile import time -import uuid import unittest from ..xattr import get_all diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index d568d2a9c..4a29440d4 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -35,7 +35,6 @@ from ..archiver import Archiver, parse_storage_quota, PURE_PYTHON_MSGPACK_WARNIN from ..cache import Cache, LocalCache from ..chunker import has_seek_hole from ..constants import * # NOQA -from ..crypto.low_level import bytes_to_long, num_cipher_blocks from ..crypto.key import FlexiKey, AESOCBRepoKey, AESOCBKeyfileKey, CHPOKeyfileKey, Passphrase, TAMRequiredError from ..crypto.keymanager import RepoIdMismatch, NotABorgKeyFile from ..crypto.file_integrity import FileIntegrityError @@ -43,7 +42,6 @@ from ..helpers import Location, get_security_dir from ..helpers import Manifest, MandatoryFeatureUnsupported from ..helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR from ..helpers import bin_to_hex -from ..helpers import MAX_S from ..helpers import msgpack from ..helpers import flags_noatime, flags_normal from ..nanorst import RstToTextLazy, rst_to_terminal diff --git a/src/borg/testsuite/hashindex.py b/src/borg/testsuite/hashindex.py index b05ff77fd..b98444c3a 100644 --- a/src/borg/testsuite/hashindex.py +++ b/src/borg/testsuite/hashindex.py @@ -9,7 +9,6 @@ import tempfile import zlib from ..hashindex import NSIndex, ChunkIndex, ChunkIndexEntry -from .. import hashindex from ..crypto.file_integrity import IntegrityCheckedFile, FileIntegrityError from . import BaseTestCase, unopened_tempfile diff --git a/src/borg/testsuite/helpers.py b/src/borg/testsuite/helpers.py index ca2b89bf1..7a532c9d6 100644 --- a/src/borg/testsuite/helpers.py +++ b/src/borg/testsuite/helpers.py @@ -7,7 +7,6 @@ import sys from argparse import ArgumentTypeError from datetime import datetime, timezone, timedelta from io import StringIO, BytesIO -from time import sleep import pytest diff --git a/src/borg/testsuite/key.py b/src/borg/testsuite/key.py index b202d1078..2b69e73b0 100644 --- a/src/borg/testsuite/key.py +++ b/src/borg/testsuite/key.py @@ -1,5 +1,3 @@ -import getpass -import os.path import re import tempfile from binascii import hexlify, unhexlify, a2b_base64 @@ -15,12 +13,10 @@ from ..crypto.key import Blake2AESOCBRepoKey, Blake2AESOCBKeyfileKey, Blake2CHPO from ..crypto.key import ID_HMAC_SHA_256, ID_BLAKE2b_256 from ..crypto.key import TAMRequiredError, TAMInvalid, TAMUnsupportedSuiteError, UnsupportedManifestError, UnsupportedKeyFormatError from ..crypto.key import identify_key -from ..crypto.low_level import bytes_to_long from ..crypto.low_level import IntegrityError as IntegrityErrorBase from ..helpers import IntegrityError from ..helpers import Location from ..helpers import StableDict -from ..helpers import get_security_dir from ..helpers import msgpack from ..constants import KEY_ALGORITHMS diff --git a/src/borg/testsuite/locking.py b/src/borg/testsuite/locking.py index 7a0f219cd..656909ac5 100644 --- a/src/borg/testsuite/locking.py +++ b/src/borg/testsuite/locking.py @@ -5,7 +5,6 @@ from traceback import format_exc import pytest -from ..helpers import daemonize from ..platform import get_process_id, process_alive from ..locking import TimeoutTimer, ExclusiveLock, Lock, LockRoster, \ ADD, REMOVE, SHARED, EXCLUSIVE, LockTimeout, NotLocked, NotMyLock diff --git a/src/borg/testsuite/platform.py b/src/borg/testsuite/platform.py index 659e4376e..35d444845 100644 --- a/src/borg/testsuite/platform.py +++ b/src/borg/testsuite/platform.py @@ -1,6 +1,5 @@ import functools import os -import random import shutil import sys import tempfile diff --git a/src/borg/testsuite/repository.py b/src/borg/testsuite/repository.py index a794f98ec..9248e5d8f 100644 --- a/src/borg/testsuite/repository.py +++ b/src/borg/testsuite/repository.py @@ -13,7 +13,7 @@ from ..helpers import Location from ..helpers import IntegrityError from ..helpers import msgpack from ..locking import Lock, LockFailed -from ..remote import RemoteRepository, InvalidRPCMethod, PathNotAllowed, ConnectionClosedWithHint, handle_remote_line +from ..remote import RemoteRepository, InvalidRPCMethod, PathNotAllowed, handle_remote_line from ..repository import Repository, LoggedIO, MAGIC, MAX_DATA_SIZE, TAG_DELETE, TAG_PUT2, TAG_PUT, TAG_COMMIT from . import BaseTestCase from .hashindex import H diff --git a/src/borg/upgrader.py b/src/borg/upgrader.py deleted file mode 100644 index e69de29bb..000000000