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.borg import extract
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CHECKS = ('repository', 'archives')
|
DEFAULT_CHECKS = ('repository', 'archives')
|
||||||
DEFAULT_PREFIX = '{hostname}-'
|
DEFAULT_PREFIX = '{hostname}-'
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import tempfile
|
||||||
from borgmatic.borg.execute import execute_command
|
from borgmatic.borg.execute import execute_command
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import subprocess
|
||||||
|
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
||||||
from borgmatic.borg.execute import execute_command
|
from borgmatic.borg.execute import execute_command
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
||||||
from borgmatic.borg.execute import execute_command
|
from borgmatic.borg.execute import execute_command
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import subprocess
|
||||||
|
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
from argparse import ArgumentParser
|
|
||||||
import collections
|
import collections
|
||||||
import colorama
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from subprocess import CalledProcessError
|
|
||||||
import sys
|
import sys
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from subprocess import CalledProcessError
|
||||||
|
|
||||||
|
import colorama
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
from borgmatic.borg import (
|
from borgmatic.borg import check as borg_check
|
||||||
check as borg_check,
|
from borgmatic.borg import create as borg_create
|
||||||
create as borg_create,
|
from borgmatic.borg import environment as borg_environment
|
||||||
environment as borg_environment,
|
from borgmatic.borg import extract as borg_extract
|
||||||
prune as borg_prune,
|
from borgmatic.borg import info as borg_info
|
||||||
extract as borg_extract,
|
from borgmatic.borg import init as borg_init
|
||||||
list as borg_list,
|
from borgmatic.borg import list as borg_list
|
||||||
info as borg_info,
|
from borgmatic.borg import prune as borg_prune
|
||||||
init as borg_init,
|
|
||||||
)
|
|
||||||
from borgmatic.commands import hook
|
from borgmatic.commands import hook
|
||||||
from borgmatic.config import checks, collect, convert, validate
|
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.signals import configure_signals
|
||||||
from borgmatic.verbosity import verbosity_to_log_level
|
from borgmatic.verbosity import verbosity_to_log_level
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
LEGACY_CONFIG_PATH = '/etc/borgmatic/config'
|
LEGACY_CONFIG_PATH = '/etc/borgmatic/config'
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
from argparse import ArgumentParser
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
from ruamel import yaml
|
from ruamel import yaml
|
||||||
|
|
||||||
from borgmatic.config import convert, generate, legacy, validate
|
from borgmatic.config import convert, generate, legacy, validate
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_SOURCE_CONFIG_FILENAME = '/etc/borgmatic/config'
|
DEFAULT_SOURCE_CONFIG_FILENAME = '/etc/borgmatic/config'
|
||||||
DEFAULT_SOURCE_EXCLUDES_FILENAME = '/etc/borgmatic/excludes'
|
DEFAULT_SOURCE_EXCLUDES_FILENAME = '/etc/borgmatic/excludes'
|
||||||
DEFAULT_DESTINATION_CONFIG_FILENAME = '/etc/borgmatic/config.yaml'
|
DEFAULT_DESTINATION_CONFIG_FILENAME = '/etc/borgmatic/config.yaml'
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
from argparse import ArgumentParser
|
|
||||||
import sys
|
import sys
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
from borgmatic.config import generate, validate
|
from borgmatic.config import generate, validate
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_DESTINATION_CONFIG_FILENAME = '/etc/borgmatic/config.yaml'
|
DEFAULT_DESTINATION_CONFIG_FILENAME = '/etc/borgmatic/config.yaml'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import subprocess
|
||||||
|
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from argparse import ArgumentParser
|
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
from borgmatic.config import collect, validate
|
from borgmatic.config import collect, validate
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
|
@ -2,7 +2,6 @@ import os
|
||||||
|
|
||||||
from ruamel import yaml
|
from ruamel import yaml
|
||||||
|
|
||||||
|
|
||||||
INDENT = 4
|
INDENT = 4
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from collections import OrderedDict, namedtuple
|
from collections import OrderedDict, namedtuple
|
||||||
from configparser import RawConfigParser
|
from configparser import RawConfigParser
|
||||||
|
|
||||||
|
|
||||||
Section_format = namedtuple('Section_format', ('name', 'options'))
|
Section_format = namedtuple('Section_format', ('name', 'options'))
|
||||||
Config_option = namedtuple('Config_option', ('name', 'value_type', 'required'))
|
Config_option = namedtuple('Config_option', ('name', 'value_type', 'required'))
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import ruamel.yaml
|
||||||
|
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import ruamel.yaml
|
||||||
from borgmatic.config import load
|
from borgmatic.config import load
|
||||||
from borgmatic.logger import get_logger
|
from borgmatic.logger import get_logger
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
VERBOSITY_WARNING = 0
|
VERBOSITY_WARNING = 0
|
||||||
VERBOSITY_SOME = 1
|
VERBOSITY_SOME = 1
|
||||||
VERBOSITY_LOTS = 2
|
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]
|
[flake8]
|
||||||
ignore = E501,W503
|
ignore = E501,W503
|
||||||
exclude = *.*/*
|
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'
|
VERSION = '1.3.4.dev0'
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ coverage==4.5.1
|
||||||
docopt==0.6.2
|
docopt==0.6.2
|
||||||
flake8==3.5.0
|
flake8==3.5.0
|
||||||
flexmock==0.10.2
|
flexmock==0.10.2
|
||||||
|
isort==4.3.19
|
||||||
mccabe==0.6.1
|
mccabe==0.6.1
|
||||||
more-itertools==4.3.0
|
more-itertools==4.3.0
|
||||||
pluggy==0.7.1
|
pluggy==0.7.1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.commands import borgmatic as module
|
from borgmatic.commands import borgmatic as module
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.commands import convert_config as module
|
from borgmatic.commands import convert_config as module
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from io import StringIO
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.config import generate as module
|
from borgmatic.config import generate as module
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from io import StringIO
|
|
||||||
|
|
||||||
from collections import OrderedDict
|
|
||||||
import string
|
import string
|
||||||
|
from collections import OrderedDict
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
from borgmatic.config import legacy as module
|
from borgmatic.config import legacy as module
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ import io
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.config import validate as module
|
from borgmatic.config import validate as module
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
from subprocess import STDOUT
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
from subprocess import STDOUT
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import check as module
|
from borgmatic.borg import check as module
|
||||||
|
|
||||||
from ..test_verbosity import insert_logging_mock
|
from ..test_verbosity import insert_logging_mock
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import logging
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import create as module
|
from borgmatic.borg import create as module
|
||||||
|
|
||||||
from ..test_verbosity import insert_logging_mock
|
from ..test_verbosity import insert_logging_mock
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import execute as module
|
from borgmatic.borg import execute as module
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import sys
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import extract as module
|
from borgmatic.borg import extract as module
|
||||||
|
|
||||||
from ..test_verbosity import insert_logging_mock
|
from ..test_verbosity import insert_logging_mock
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import info as module
|
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')
|
INFO_COMMAND = ('borg', 'info', 'repo')
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import init as module
|
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_EXISTS_RESPONSE_CODE = 0
|
||||||
INFO_REPOSITORY_NOT_FOUND_RESPONSE_CODE = 2
|
INFO_REPOSITORY_NOT_FOUND_RESPONSE_CODE = 2
|
||||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import list as module
|
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')
|
LIST_COMMAND = ('borg', 'list', 'repo')
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ from collections import OrderedDict
|
||||||
from flexmock import flexmock
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.borg import prune as module
|
from borgmatic.borg import prune as module
|
||||||
|
|
||||||
from ..test_verbosity import insert_logging_mock
|
from ..test_verbosity import insert_logging_mock
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
from collections import defaultdict, OrderedDict, namedtuple
|
|
||||||
import os
|
import os
|
||||||
|
from collections import OrderedDict, defaultdict, namedtuple
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.config import convert as module
|
from borgmatic.config import convert as module
|
||||||
|
|
||||||
|
|
||||||
Parsed_config = namedtuple('Parsed_config', ('location', 'storage', 'retention', 'consistency'))
|
Parsed_config = namedtuple('Parsed_config', ('location', 'storage', 'retention', 'consistency'))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from flexmock import flexmock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from flexmock import flexmock
|
||||||
|
|
||||||
from borgmatic.config import legacy as module
|
from borgmatic.config import legacy as module
|
||||||
|
|
||||||
|
|
6
tox.ini
6
tox.ini
|
@ -13,6 +13,7 @@ install_command =
|
||||||
commands =
|
commands =
|
||||||
pytest
|
pytest
|
||||||
sh scripts/black
|
sh scripts/black
|
||||||
|
sh scripts/isort
|
||||||
flake8 .
|
flake8 .
|
||||||
|
|
||||||
[testenv:black]
|
[testenv:black]
|
||||||
|
@ -24,3 +25,8 @@ commands =
|
||||||
deps = -rtest_requirements.txt
|
deps = -rtest_requirements.txt
|
||||||
commands =
|
commands =
|
||||||
pytest tests/end-to-end
|
pytest tests/end-to-end
|
||||||
|
|
||||||
|
[testenv:isort]
|
||||||
|
deps = {[testenv]deps}
|
||||||
|
commands =
|
||||||
|
isort {posargs:--recursive} --settings-path setup.cfg .
|
||||||
|
|
Loading…
Reference in a new issue