Passed
Push — master ( ffbe9f...5c3c8b )
by Konrad
01:19
created

db_sync_tool.sync.Sync.get_arguments()   A

Complexity

Conditions 1

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 22
rs 9.6
c 0
b 0
f 0
cc 1
nop 1
1
#!/usr/bin/env python3
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# -*- coding: utf-8 -*-
3
4
import sys
5
from db_sync_tool.utility import system, helper, output, info
6
from db_sync_tool.database import process
7
from db_sync_tool.remote import transfer, client as remote_client
8
9
# Check Python version
10
assert sys.version_info >= (3, 7), sys.exit(output.message(output.Subject.ERROR, 'Python 3.7 or higher required'))
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (114/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
11
12
13
class Sync:
14
    """
15
    Synchronize a target database from an origin system
16
    """
17
18
    def __init__(self,
0 ignored issues
show
Bug Best Practice introduced by
The default value {} might cause unintended side-effects.

Objects as default values are only created once in Python and not on each invocation of the function. If the default object is modified, this modification is carried over to the next invocation of the method.

# Bad:
# If array_param is modified inside the function, the next invocation will
# receive the modified object.
def some_function(array_param=[]):
    # ...

# Better: Create an array on each invocation
def some_function(array_param=None):
    array_param = array_param or []
    # ...
Loading history...
best-practice introduced by
Too many arguments (9/5)
Loading history...
19
                 config_file=None,
20
                 verbose=False,
21
                 mute=False,
22
                 import_file=None,
23
                 dump_name=None,
24
                 keep_dump=None,
25
                 host_file=None,
26
                 config={}):
27
        """
28
        Initialization
29
        :param config_file:
30
        :param verbose:
31
        :param mute:
32
        :param import_file:
33
        :param dump_name:
34
        :param keep_dump:
35
        :param host_file:
36
        :param config:
37
        """
38
        info.print_header(mute)
39
        system.check_args_options(
40
            config_file,
41
            verbose,
42
            mute,
43
            import_file,
44
            dump_name,
45
            keep_dump,
46
            host_file
47
        )
48
        system.get_configuration(config)
49
        process.create_origin_database_dump()
50
        transfer.transfer_origin_database_dump()
51
        process.import_database_dump()
52
        helper.clean_up()
53
        remote_client.close_ssh_clients()
54
        info.print_footer()
55