Skip to content

Commit d362993

Browse files
[typing] PostgresNode: pid, auxiliary_pids, auxiliary_processes (#306)
1 parent 9515b02 commit d362993

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/node.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def ssh_key(self) -> typing.Optional[str]:
364364
return self._os_ops.ssh_key
365365

366366
@property
367-
def pid(self):
367+
def pid(self) -> int:
368368
"""
369369
Return postmaster's PID if node is running, else 0.
370370
"""
@@ -381,14 +381,15 @@ def pid(self):
381381
return x.pid
382382

383383
@property
384-
def auxiliary_pids(self):
384+
def auxiliary_pids(self) -> typing.Dict[ProcessType, typing.List[int]]:
385385
"""
386386
Returns a dict of { ProcessType : PID }.
387387
"""
388388

389389
result = {}
390390

391391
for process in self.auxiliary_processes:
392+
assert type(process) == ProcessProxy # noqa: E721
392393
if process.ptype not in result:
393394
result[process.ptype] = []
394395

@@ -397,12 +398,13 @@ def auxiliary_pids(self):
397398
return result
398399

399400
@property
400-
def auxiliary_processes(self):
401+
def auxiliary_processes(self) -> typing.List[ProcessProxy]:
401402
"""
402403
Returns a list of auxiliary processes.
403404
Each process is represented by :class:`.ProcessProxy` object.
404405
"""
405-
def is_aux(process):
406+
def is_aux(process: ProcessProxy) -> bool:
407+
assert type(process) == ProcessProxy # noqa: E721
406408
return process.ptype != ProcessType.Unknown
407409

408410
return list(filter(is_aux, self.child_processes))

0 commit comments

Comments
 (0)