Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06ce6e2

Browse files
committed
fix ProcessProxy's __repr__() according to guidelines
1 parent 71e487e commit 06ce6e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

testgres/node.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,17 @@ class ProcessProxy(object):
7575
ptype: instance of ProcessType
7676
"""
7777

78-
def __init__(self, process):
78+
def __init__(self, process, ptype=None):
7979
self.process = process
80-
self.ptype = ProcessType.from_process(process)
80+
self.ptype = ptype or ProcessType.from_process(process)
8181

8282
def __getattr__(self, name):
8383
return getattr(self.process, name)
8484

8585
def __repr__(self):
86-
return '{} : {}'.format(str(self.ptype), repr(self.process))
86+
return '{}(ptype={}, process={})'.format(self.__class__.__name__,
87+
str(self.ptype),
88+
repr(self.process))
8789

8890

8991
class PostgresNode(object):
@@ -980,9 +982,7 @@ def replicate(self, name=None, slot=None, **kwargs):
980982
backup = self.backup(**kwargs)
981983

982984
# transform backup into a replica
983-
return backup.spawn_replica(name=name,
984-
destroy=True,
985-
slot=slot)
985+
return backup.spawn_replica(name=name, destroy=True, slot=slot)
986986

987987
def catchup(self, dbname=None, username=None):
988988
"""

0 commit comments

Comments
 (0)