Automatically sort Python imports in code.
This commit is contained in:
commit
99522234ea
37 changed files with 56 additions and 54 deletions
|
@ -5,7 +5,6 @@ import subprocess
|
|||
from borgmatic.borg import extract
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
DEFAULT_CHECKS = ('repository', 'archives')
|
||||
DEFAULT_PREFIX = '{hostname}-'
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import tempfile
|
|||
from borgmatic.borg.execute import execute_command
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import subprocess
|
|||
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import logging
|
||||
import sys
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
|||
from borgmatic.borg.execute import execute_command
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
|||
from borgmatic.borg.execute import execute_command
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import subprocess
|
|||
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -1,31 +1,28 @@
|
|||
from argparse import ArgumentParser
|
||||
import collections
|
||||
import colorama
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from subprocess import CalledProcessError
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
from subprocess import CalledProcessError
|
||||
|
||||
import colorama
|
||||
import pkg_resources
|
||||
|
||||
from borgmatic.borg import (
|
||||
check as borg_check,
|
||||
create as borg_create,
|
||||
environment as borg_environment,
|
||||
prune as borg_prune,
|
||||
extract as borg_extract,
|
||||
list as borg_list,
|
||||
info as borg_info,
|
||||
init as borg_init,
|
||||
)
|
||||
from borgmatic.borg import check as borg_check
|
||||
from borgmatic.borg import create as borg_create
|
||||
from borgmatic.borg import environment as borg_environment
|
||||
from borgmatic.borg import extract as borg_extract
|
||||
from borgmatic.borg import info as borg_info
|
||||
from borgmatic.borg import init as borg_init
|
||||
from borgmatic.borg import list as borg_list
|
||||
from borgmatic.borg import prune as borg_prune
|
||||
from borgmatic.commands import hook
|
||||
from borgmatic.config import checks, collect, convert, validate
|
||||
from borgmatic.logger import should_do_markup, get_logger
|
||||
from borgmatic.logger import get_logger, should_do_markup
|
||||
from borgmatic.signals import configure_signals
|
||||
from borgmatic.verbosity import verbosity_to_log_level
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
LEGACY_CONFIG_PATH = '/etc/borgmatic/config'
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
from argparse import ArgumentParser
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from ruamel import yaml
|
||||
|
||||
from borgmatic.config import convert, generate, legacy, validate
|
||||
|
||||
|
||||
DEFAULT_SOURCE_CONFIG_FILENAME = '/etc/borgmatic/config'
|
||||
DEFAULT_SOURCE_EXCLUDES_FILENAME = '/etc/borgmatic/excludes'
|
||||
DEFAULT_DESTINATION_CONFIG_FILENAME = '/etc/borgmatic/config.yaml'
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
from argparse import ArgumentParser
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from borgmatic.config import generate, validate
|
||||
|
||||
|
||||
DEFAULT_DESTINATION_CONFIG_FILENAME = '/etc/borgmatic/config.yaml'
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import subprocess
|
|||
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from argparse import ArgumentParser
|
||||
import sys
|
||||
import logging
|
||||
import sys
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from borgmatic.config import collect, validate
|
||||
from borgmatic.logger import get_logger
|
||||
|
|
|
@ -2,7 +2,6 @@ import os
|
|||
|
||||
from ruamel import yaml
|
||||
|
||||
|
||||
INDENT = 4
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from collections import OrderedDict, namedtuple
|
||||
from configparser import RawConfigParser
|
||||
|
||||
|
||||
Section_format = namedtuple('Section_format', ('name', 'options'))
|
||||
Config_option = namedtuple('Config_option', ('name', 'value_type', 'required'))
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import ruamel.yaml
|
|||
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import ruamel.yaml
|
|||
from borgmatic.config import load
|
||||
from borgmatic.logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import logging
|
||||
|
||||
|
||||
VERBOSITY_WARNING = 0
|
||||
VERBOSITY_SOME = 1
|
||||
VERBOSITY_LOTS = 2
|
||||
|
|
3
scripts/isort
Executable file
3
scripts/isort
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
isort --recursive --check-only --settings-path setup.cfg .
|
|
@ -8,3 +8,11 @@ addopts = --cov-report term-missing:skip-covered --cov=borgmatic --ignore=tests/
|
|||
[flake8]
|
||||
ignore = E501,W503
|
||||
exclude = *.*/*
|
||||
|
||||
[tool:isort]
|
||||
force_single_line = False
|
||||
include_trailing_comma = True
|
||||
known_first_party = borgmatic
|
||||
line_length = 100
|
||||
multi_line_output = 3
|
||||
skip = .tox
|
||||
|
|
3
setup.py
3
setup.py
|
@ -1,5 +1,4 @@
|
|||
from setuptools import setup, find_packages
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
VERSION = '1.3.4.dev0'
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ coverage==4.5.1
|
|||
docopt==0.6.2
|
||||
flake8==3.5.0
|
||||
flexmock==0.10.2
|
||||
isort==4.3.19
|
||||
mccabe==0.6.1
|
||||
more-itertools==4.3.0
|
||||
pluggy==0.7.1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import subprocess
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.commands import borgmatic as module
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.commands import convert_config as module
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from io import StringIO
|
||||
import os
|
||||
import sys
|
||||
from io import StringIO
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.config import generate as module
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from io import StringIO
|
||||
|
||||
from collections import OrderedDict
|
||||
import string
|
||||
from collections import OrderedDict
|
||||
from io import StringIO
|
||||
|
||||
from borgmatic.config import legacy as module
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import io
|
|||
import string
|
||||
import sys
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.config import validate as module
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
from subprocess import STDOUT
|
||||
import logging
|
||||
import sys
|
||||
from subprocess import STDOUT
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import check as module
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import logging
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import create as module
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import execute as module
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import sys
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import extract as module
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import info as module
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
INFO_COMMAND = ('borg', 'info', 'repo')
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import init as module
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
INFO_REPOSITORY_EXISTS_RESPONSE_CODE = 0
|
||||
INFO_REPOSITORY_NOT_FOUND_RESPONSE_CODE = 2
|
||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import list as module
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
LIST_COMMAND = ('borg', 'list', 'repo')
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from collections import OrderedDict
|
|||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.borg import prune as module
|
||||
|
||||
from ..test_verbosity import insert_logging_mock
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
from collections import defaultdict, OrderedDict, namedtuple
|
||||
import os
|
||||
from collections import OrderedDict, defaultdict, namedtuple
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.config import convert as module
|
||||
|
||||
|
||||
Parsed_config = namedtuple('Parsed_config', ('location', 'storage', 'retention', 'consistency'))
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
from flexmock import flexmock
|
||||
import pytest
|
||||
from flexmock import flexmock
|
||||
|
||||
from borgmatic.config import legacy as module
|
||||
|
||||
|
|
6
tox.ini
6
tox.ini
|
@ -13,6 +13,7 @@ install_command =
|
|||
commands =
|
||||
pytest
|
||||
sh scripts/black
|
||||
sh scripts/isort
|
||||
flake8 .
|
||||
|
||||
[testenv:black]
|
||||
|
@ -24,3 +25,8 @@ commands =
|
|||
deps = -rtest_requirements.txt
|
||||
commands =
|
||||
pytest tests/end-to-end
|
||||
|
||||
[testenv:isort]
|
||||
deps = {[testenv]deps}
|
||||
commands =
|
||||
isort {posargs:--recursive} --settings-path setup.cfg .
|
||||
|
|
Loading…
Reference in a new issue