@@ -91,7 +91,6 @@ class ProcessProxy(object):
91
91
process: wrapped psutill.Process object
92
92
ptype: instance of ProcessType
93
93
"""
94
-
95
94
def __init__ (self , process , ptype = None ):
96
95
self .process = process
97
96
self .ptype = ptype or ProcessType .from_process (process )
@@ -196,7 +195,6 @@ def auxiliary_processes(self):
196
195
Returns a list of auxiliary processes.
197
196
Each process is represented by :class:`.ProcessProxy` object.
198
197
"""
199
-
200
198
def is_aux (process ):
201
199
return process .ptype != ProcessType .Unknown
202
200
@@ -430,10 +428,9 @@ def init(self, initdb_params=None, **kwargs):
430
428
"""
431
429
432
430
# initialize this PostgreSQL node
433
- cached_initdb (
434
- data_dir = self .data_dir ,
435
- logfile = self .utils_log_file ,
436
- params = initdb_params )
431
+ cached_initdb (data_dir = self .data_dir ,
432
+ logfile = self .utils_log_file ,
433
+ params = initdb_params )
437
434
438
435
# initialize default config files
439
436
self .default_conf (** kwargs )
@@ -480,8 +477,8 @@ def default_conf(self,
480
477
if allow_ :
481
478
# get auth method for host or local users
482
479
def get_auth_method (t ):
483
- return next ((s .split ()[- 1 ] for s in lines
484
- if s .startswith (t )), 'trust' )
480
+ return next ((s .split ()[- 1 ]
481
+ for s in lines if s .startswith (t )), 'trust' )
485
482
486
483
# get auth methods
487
484
auth_local = get_auth_method ('local' )
@@ -760,12 +757,11 @@ def promote(self, dbname=None, username=None):
760
757
if self ._pg_version < '10' :
761
758
check_query = "SELECT pg_is_in_recovery()"
762
759
763
- self .poll_query_until (
764
- query = check_query ,
765
- expected = False ,
766
- dbname = dbname ,
767
- username = username ,
768
- max_attempts = 0 ) # infinite
760
+ self .poll_query_until (query = check_query ,
761
+ expected = False ,
762
+ dbname = dbname ,
763
+ username = username ,
764
+ max_attempts = 0 ) # infinite
769
765
770
766
# node becomes master itself
771
767
self ._master = None
@@ -884,11 +880,10 @@ def psql(self,
884
880
psql_params .append (dbname )
885
881
886
882
# start psql process
887
- process = subprocess .Popen (
888
- psql_params ,
889
- stdin = subprocess .PIPE ,
890
- stdout = subprocess .PIPE ,
891
- stderr = subprocess .PIPE )
883
+ process = subprocess .Popen (psql_params ,
884
+ stdin = subprocess .PIPE ,
885
+ stdout = subprocess .PIPE ,
886
+ stderr = subprocess .PIPE )
892
887
893
888
# wait until it finishes and get stdout and stderr
894
889
out , err = process .communicate (input = input )
@@ -1043,11 +1038,10 @@ def poll_query_until(self,
1043
1038
attempts = 0
1044
1039
while max_attempts == 0 or attempts < max_attempts :
1045
1040
try :
1046
- res = self .execute (
1047
- dbname = dbname ,
1048
- query = query ,
1049
- username = username ,
1050
- commit = commit )
1041
+ res = self .execute (dbname = dbname ,
1042
+ query = query ,
1043
+ username = username ,
1044
+ commit = commit )
1051
1045
1052
1046
if expected is None and res is None :
1053
1047
return # done
@@ -1165,8 +1159,8 @@ def set_synchronous_standbys(self, standbys):
1165
1159
standbys = First (1 , standbys )
1166
1160
else :
1167
1161
if isinstance (standbys , Iterable ):
1168
- standbys = u", " .join (
1169
- u" \" {} \" " . format ( r . name ) for r in standbys )
1162
+ standbys = u", " .join (u" \" {} \" " . format ( r . name )
1163
+ for r in standbys )
1170
1164
else :
1171
1165
raise TestgresException ("Feature isn't supported in "
1172
1166
"Postgres 9.5 and below" )
@@ -1195,11 +1189,10 @@ def catchup(self, dbname=None, username=None):
1195
1189
username = username )[0 ][0 ] # yapf: disable
1196
1190
1197
1191
# wait until this LSN reaches replica
1198
- self .poll_query_until (
1199
- query = wait_lsn .format (lsn ),
1200
- dbname = dbname ,
1201
- username = username ,
1202
- max_attempts = 0 ) # infinite
1192
+ self .poll_query_until (query = wait_lsn .format (lsn ),
1193
+ dbname = dbname ,
1194
+ username = username ,
1195
+ max_attempts = 0 ) # infinite
1203
1196
except Exception as e :
1204
1197
raise_from (CatchUpException ("Failed to catch up" , poll_lsn ), e )
1205
1198
@@ -1215,7 +1208,11 @@ def publish(self, name, **kwargs):
1215
1208
"""
1216
1209
return Publication (name = name , node = self , ** kwargs )
1217
1210
1218
- def subscribe (self , publication , name , dbname = None , username = None ,
1211
+ def subscribe (self ,
1212
+ publication ,
1213
+ name ,
1214
+ dbname = None ,
1215
+ username = None ,
1219
1216
** params ):
1220
1217
"""
1221
1218
Create subscription for logical replication
0 commit comments