@@ -91,7 +91,6 @@ class ProcessProxy(object):
9191 process: wrapped psutill.Process object
9292 ptype: instance of ProcessType
9393 """
94-
9594 def __init__ (self , process , ptype = None ):
9695 self .process = process
9796 self .ptype = ptype or ProcessType .from_process (process )
@@ -196,7 +195,6 @@ def auxiliary_processes(self):
196195 Returns a list of auxiliary processes.
197196 Each process is represented by :class:`.ProcessProxy` object.
198197 """
199-
200198 def is_aux (process ):
201199 return process .ptype != ProcessType .Unknown
202200
@@ -430,10 +428,9 @@ def init(self, initdb_params=None, **kwargs):
430428 """
431429
432430 # 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 )
437434
438435 # initialize default config files
439436 self .default_conf (** kwargs )
@@ -480,8 +477,8 @@ def default_conf(self,
480477 if allow_streaming :
481478 # get auth method for host or local users
482479 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' )
485482
486483 # get auth methods
487484 auth_local = get_auth_method ('local' )
@@ -760,12 +757,11 @@ def promote(self, dbname=None, username=None):
760757 if self ._pg_version < '10' :
761758 check_query = "SELECT pg_is_in_recovery()"
762759
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
769765
770766 # node becomes master itself
771767 self ._master = None
@@ -884,11 +880,10 @@ def psql(self,
884880 psql_params .append (dbname )
885881
886882 # 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 )
892887
893888 # wait until it finishes and get stdout and stderr
894889 out , err = process .communicate (input = input )
@@ -1043,11 +1038,10 @@ def poll_query_until(self,
10431038 attempts = 0
10441039 while max_attempts == 0 or attempts < max_attempts :
10451040 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 )
10511045
10521046 if expected is None and res is None :
10531047 return # done
@@ -1165,8 +1159,8 @@ def set_synchronous_standbys(self, standbys):
11651159 standbys = First (1 , standbys )
11661160 else :
11671161 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 )
11701164 else :
11711165 raise TestgresException ("Feature isn't supported in "
11721166 "Postgres 9.5 and below" )
@@ -1195,11 +1189,10 @@ def catchup(self, dbname=None, username=None):
11951189 username = username )[0 ][0 ] # yapf: disable
11961190
11971191 # 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
12031196 except Exception as e :
12041197 raise_from (CatchUpException ("Failed to catch up" , poll_lsn ), e )
12051198
@@ -1215,7 +1208,11 @@ def publish(self, name, **kwargs):
12151208 """
12161209 return Publication (name = name , node = self , ** kwargs )
12171210
1218- def subscribe (self , publication , name , dbname = None , username = None ,
1211+ def subscribe (self ,
1212+ publication ,
1213+ name ,
1214+ dbname = None ,
1215+ username = None ,
12191216 ** params ):
12201217 """
12211218 Create subscription for logical replication
0 commit comments