Skip to content

Commit 8430468

Browse files
committed
remove all kinds of mangling
1 parent ac75f15 commit 8430468

File tree

4 files changed

+78
-77
lines changed

4 files changed

+78
-77
lines changed

Diff for: testgres/backup.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
from six import raise_from
88

99
from .consts import \
10-
DATA_DIR as _DATA_DIR, \
11-
PG_CONF_FILE as _PG_CONF_FILE, \
12-
BACKUP_LOG_FILE as _BACKUP_LOG_FILE, \
13-
DEFAULT_XLOG_METHOD as _DEFAULT_XLOG_METHOD
10+
DATA_DIR, \
11+
PG_CONF_FILE, \
12+
BACKUP_LOG_FILE, \
13+
DEFAULT_XLOG_METHOD
1414

1515
from .exceptions import BackupException
1616

1717
from .utils import \
1818
get_bin_path, \
19-
default_username as _default_username, \
20-
execute_utility as _execute_utility
19+
default_username, \
20+
execute_utility
2121

2222

2323
class NodeBackup(object):
@@ -27,13 +27,13 @@ class NodeBackup(object):
2727

2828
@property
2929
def log_file(self):
30-
return os.path.join(self.base_dir, _BACKUP_LOG_FILE)
30+
return os.path.join(self.base_dir, BACKUP_LOG_FILE)
3131

3232
def __init__(self,
3333
node,
3434
base_dir=None,
3535
username=None,
36-
xlog_method=_DEFAULT_XLOG_METHOD):
36+
xlog_method=DEFAULT_XLOG_METHOD):
3737
"""
3838
Create a new backup.
3939
@@ -48,7 +48,7 @@ def __init__(self,
4848
raise BackupException('Node must be running')
4949

5050
# Set default arguments
51-
username = username or _default_username()
51+
username = username or default_username()
5252
base_dir = base_dir or tempfile.mkdtemp()
5353

5454
# public
@@ -59,7 +59,7 @@ def __init__(self,
5959
# private
6060
self._available = True
6161

62-
data_dir = os.path.join(self.base_dir, _DATA_DIR)
62+
data_dir = os.path.join(self.base_dir, DATA_DIR)
6363

6464
# yapf: disable
6565
_params = [
@@ -70,7 +70,7 @@ def __init__(self,
7070
"-D", data_dir,
7171
"-X", xlog_method
7272
]
73-
_execute_utility(_params, self.log_file)
73+
execute_utility(_params, self.log_file)
7474

7575
def __enter__(self):
7676
return self
@@ -98,8 +98,8 @@ def _prepare_dir(self, destroy):
9898
if available:
9999
dest_base_dir = tempfile.mkdtemp()
100100

101-
data1 = os.path.join(self.base_dir, _DATA_DIR)
102-
data2 = os.path.join(dest_base_dir, _DATA_DIR)
101+
data1 = os.path.join(self.base_dir, DATA_DIR)
102+
data2 = os.path.join(dest_base_dir, DATA_DIR)
103103

104104
try:
105105
# Copy backup to new data dir
@@ -140,8 +140,8 @@ def spawn_primary(self, name=None, destroy=True, use_logging=False):
140140
# New nodes should always remove dir tree
141141
node._should_rm_dirs = True
142142

143-
node.append_conf(_PG_CONF_FILE, "\n")
144-
node.append_conf(_PG_CONF_FILE, "port = {}".format(node.port))
143+
node.append_conf(PG_CONF_FILE, "\n")
144+
node.append_conf(PG_CONF_FILE, "port = {}".format(node.port))
145145

146146
return node
147147

Diff for: testgres/cache.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from .utils import \
1717
get_bin_path, \
18-
execute_utility as _execute_utility
18+
execute_utility
1919

2020

2121
def cached_initdb(data_dir, initdb_logfile, initdb_params=[]):
@@ -26,7 +26,7 @@ def cached_initdb(data_dir, initdb_logfile, initdb_params=[]):
2626
def call_initdb(initdb_dir):
2727
try:
2828
_params = [get_bin_path("initdb"), "-D", initdb_dir, "-N"]
29-
_execute_utility(_params + initdb_params, initdb_logfile)
29+
execute_utility(_params + initdb_params, initdb_logfile)
3030
except ExecUtilException as e:
3131
raise_from(InitNodeException("Failed to run initdb"), e)
3232

Diff for: testgres/connection.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
from .exceptions import QueryException
1515

1616
from .utils import \
17-
default_dbname as _default_dbname, \
18-
default_username as _default_username
17+
default_dbname, \
18+
default_username
19+
1920

2021
# export these exceptions
2122
InternalError = pglib.InternalError
@@ -37,9 +38,9 @@ class NodeConnection(object):
3738

3839
def __init__(self, node, dbname=None, username=None, password=None):
3940

40-
# Use default user if not specified
41-
dbname = dbname or _default_dbname()
42-
username = username or _default_username()
41+
# Set default arguments
42+
dbname = dbname or default_dbname()
43+
username = username or default_username()
4344

4445
self._node = node
4546

0 commit comments

Comments
 (0)