Skip to content

Commit

Permalink
Run isort on code to remove unused imports and blank lines
Browse files Browse the repository at this point in the history
Execute isort on the whole projet cleaning up and sorting imports
in both tests and code.

References: bar-429

Signed-off-by: Giulio Calacoci <[email protected]>
  • Loading branch information
gcalacoci committed Oct 29, 2024
1 parent 01e7230 commit 58980d5
Show file tree
Hide file tree
Showing 65 changed files with 287 additions and 255 deletions.
1 change: 0 additions & 1 deletion barman/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import errno
import io
import os

from abc import ABCMeta, abstractmethod

from barman.exceptions import ArchivalBackupException
Expand Down
16 changes: 8 additions & 8 deletions barman/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,38 @@
PassiveBackupExecutor,
PostgresBackupExecutor,
RsyncBackupExecutor,
SnapshotBackupExecutor,
SnapshotBackupExecutor
)
from barman.backup_manifest import BackupManifest
from barman.cloud_providers import get_snapshot_interface_from_backup_info
from barman.command_wrappers import PgVerifyBackup
from barman.compression import CompressionManager
from barman.config import BackupOptions
from barman.exceptions import (
AbortedRetryHookScript,
BackupException,
CommandFailedException,
CompressionIncompatibility,
LockFileBusy,
SshCommandException,
UnknownBackupIdException,
CommandFailedException,
UnknownBackupIdException
)
from barman.fs import unix_command_factory
from barman.hooks import HookScriptRunner, RetryHookScriptRunner
from barman.infofile import BackupInfo, LocalBackupInfo, WalFileInfo
from barman.lockfile import ServerBackupIdLock, ServerBackupSyncLock
from barman.recovery_executor import recovery_executor_factory
from barman.remote_status import RemoteStatusMixin
from barman.storage.local_file_manager import LocalFileManager
from barman.utils import (
SHA256,
force_str,
fsync_dir,
fsync_file,
get_backup_info_from_name,
human_readable_timedelta,
pretty_size,
SHA256,
pretty_size
)
from barman.command_wrappers import PgVerifyBackup
from barman.storage.local_file_manager import LocalFileManager
from barman.backup_manifest import BackupManifest

_logger = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions barman/backup_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
BackupException,
CommandFailedException,
DataTransferFailure,
FileNotFoundException,
FsOperationFailed,
PostgresConnectionError,
PostgresConnectionLost,
PostgresIsInRecovery,
SnapshotBackupException,
SshCommandException,
FileNotFoundException,
SshCommandException
)
from barman.fs import UnixLocalCommand, UnixRemoteCommand, unix_command_factory
from barman.infofile import BackupInfo
Expand All @@ -67,7 +67,7 @@
human_readable_timedelta,
mkpath,
total_seconds,
with_metaclass,
with_metaclass
)

_logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion barman/backup_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with Barman. If not, see <http://www.gnu.org/licenses/>.

import os
import json
import os

from barman.exceptions import BackupManifestException

Expand Down
43 changes: 19 additions & 24 deletions barman/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,35 @@
import logging
import os
import sys
from argparse import (
SUPPRESS,
ArgumentTypeError,
ArgumentParser,
HelpFormatter,
)

from barman.lockfile import ConfigUpdateLock

if sys.version_info.major < 3:
from argparse import Action, _SubParsersAction, _ActionsContainer
try:
import argcomplete
except ImportError:
argcomplete = None
from argparse import SUPPRESS, ArgumentParser, ArgumentTypeError, HelpFormatter
from collections import OrderedDict
from contextlib import closing


import barman.config
import barman.diagnose
import barman.utils
from barman import output
from barman.annotations import KeepManager
from barman.backup_manifest import BackupManifest
from barman.config import (
ConfigChangesProcessor,
RecoveryOptions,
parse_staging_path,
parse_staging_path
)
from barman.exceptions import (
BadXlogSegmentName,
LockFileBusy,
RecoveryException,
SyncError,
WalArchiveContentError,
WalArchiveContentError
)
from barman.infofile import BackupInfo, WalFileInfo
from barman.lockfile import ConfigUpdateLock
from barman.server import Server
from barman.storage.local_file_manager import LocalFileManager
from barman.utils import (
RESERVED_BACKUP_IDS,
SHA256,
BarmanEncoder,
check_backup_name,
check_non_negative,
Expand All @@ -72,15 +62,20 @@
configure_logging,
drop_privileges,
force_str,
get_log_levels,
get_backup_id_using_shortcut,
parse_log_level,
RESERVED_BACKUP_IDS,
SHA256,
get_log_levels,
parse_log_level
)
from barman.xlog import check_archive_usable
from barman.backup_manifest import BackupManifest
from barman.storage.local_file_manager import LocalFileManager

if sys.version_info.major < 3:
from argparse import Action, _SubParsersAction, _ActionsContainer
try:
import argcomplete
except ImportError:
argcomplete = None



_logger = logging.getLogger(__name__)

Expand Down
17 changes: 11 additions & 6 deletions barman/clients/cloud_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,33 @@
from shutil import rmtree

from barman.clients.cloud_cli import (
add_tag_argument,
create_argument_parser,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
UrlArgumentType,
add_tag_argument,
create_argument_parser
)
from barman.cloud import (
CloudBackupSnapshot,
CloudBackupUploaderBarman,
CloudBackupUploader,
configure_logging,
CloudBackupUploaderBarman,
configure_logging
)
from barman.cloud_providers import get_cloud_interface, get_snapshot_interface
from barman.exceptions import (
BarmanException,
ConfigurationException,
PostgresConnectionError,
UnrecoverableHookScriptError,
UnrecoverableHookScriptError
)
from barman.postgres import PostgreSQLConnection
from barman.utils import check_backup_name, check_positive, check_size, force_str
from barman.utils import (
check_backup_name,
check_positive,
check_size,
force_str
)

_find_space = re.compile(r"[\s]").search

Expand Down
6 changes: 3 additions & 3 deletions barman/clients/cloud_backup_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
from contextlib import closing
from operator import attrgetter

from barman import xlog
from barman.backup import BackupManager
from barman.clients.cloud_cli import (
create_argument_parser,
CLIErrorExit,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
create_argument_parser
)
from barman.cloud import CloudBackupCatalog, configure_logging
from barman.cloud_providers import (
get_cloud_interface,
get_snapshot_interface_from_backup_info,
get_snapshot_interface_from_backup_info
)
from barman.exceptions import BadXlogPrefix, InvalidRetentionPolicy
from barman.retention_policies import RetentionPolicyFactory
from barman.utils import check_non_negative, force_str
from barman import xlog


def _get_files_for_backup(catalog, backup_info):
Expand Down
2 changes: 1 addition & 1 deletion barman/clients/cloud_backup_keep.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

from barman.annotations import KeepManager
from barman.clients.cloud_cli import (
create_argument_parser,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
create_argument_parser
)
from barman.cloud import CloudBackupCatalog, configure_logging
from barman.cloud_providers import get_cloud_interface
Expand Down
2 changes: 1 addition & 1 deletion barman/clients/cloud_backup_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
from contextlib import closing

from barman.clients.cloud_cli import (
create_argument_parser,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
create_argument_parser
)
from barman.cloud import CloudBackupCatalog, configure_logging
from barman.cloud_providers import get_cloud_interface
Expand Down
2 changes: 1 addition & 1 deletion barman/clients/cloud_backup_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
from contextlib import closing

from barman.clients.cloud_cli import (
create_argument_parser,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
create_argument_parser
)
from barman.cloud import CloudBackupCatalog, configure_logging
from barman.cloud_providers import get_cloud_interface
Expand Down
8 changes: 4 additions & 4 deletions barman/clients/cloud_check_wal_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
import logging

from barman.clients.cloud_cli import (
create_argument_parser,
GeneralErrorExit,
OperationErrorExit,
NetworkErrorExit,
OperationErrorExit,
UrlArgumentType,
create_argument_parser
)
from barman.cloud import configure_logging, CloudBackupCatalog
from barman.cloud import CloudBackupCatalog, configure_logging
from barman.cloud_providers import get_cloud_interface
from barman.exceptions import WalArchiveContentError
from barman.utils import force_str, check_positive
from barman.utils import check_positive, force_str
from barman.xlog import check_archive_usable


Expand Down
1 change: 0 additions & 1 deletion barman/clients/cloud_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with Barman. If not, see <http://www.gnu.org/licenses/>.

import argparse

import csv
import logging

Expand Down
6 changes: 3 additions & 3 deletions barman/clients/cloud_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
#
# You should have received a copy of the GNU General Public License
# along with Barman. If not, see <http://www.gnu.org/licenses/>.
from abc import ABCMeta, abstractmethod
import logging
import os
from abc import ABCMeta, abstractmethod
from contextlib import closing

from barman.clients.cloud_cli import (
CLIErrorExit,
create_argument_parser,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
create_argument_parser
)
from barman.cloud import CloudBackupCatalog, configure_logging
from barman.cloud_providers import (
get_cloud_interface,
get_snapshot_interface_from_backup_info,
get_snapshot_interface_from_backup_info
)
from barman.exceptions import ConfigurationException
from barman.fs import UnixLocalCommand
Expand Down
6 changes: 3 additions & 3 deletions barman/clients/cloud_walarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
from contextlib import closing

from barman.clients.cloud_cli import (
add_tag_argument,
create_argument_parser,
CLIErrorExit,
GeneralErrorExit,
NetworkErrorExit,
UrlArgumentType,
add_tag_argument,
create_argument_parser
)
from barman.cloud import configure_logging
from barman.clients.cloud_compression import compress
from barman.cloud import configure_logging
from barman.cloud_providers import get_cloud_interface
from barman.exceptions import BarmanException
from barman.utils import check_positive, check_size, force_str
Expand Down
11 changes: 8 additions & 3 deletions barman/clients/cloud_walrestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@
from contextlib import closing

from barman.clients.cloud_cli import (
create_argument_parser,
CLIErrorExit,
GeneralErrorExit,
NetworkErrorExit,
OperationErrorExit,
create_argument_parser
)
from barman.cloud import configure_logging, ALLOWED_COMPRESSIONS
from barman.cloud import ALLOWED_COMPRESSIONS, configure_logging
from barman.cloud_providers import get_cloud_interface
from barman.exceptions import BarmanException
from barman.utils import force_str
from barman.xlog import hash_dir, is_any_xlog_file, is_backup_file, is_partial_file
from barman.xlog import (
hash_dir,
is_any_xlog_file,
is_backup_file,
is_partial_file
)


def main(args=None):
Expand Down
Loading

0 comments on commit 58980d5

Please sign in to comment.