forked from jan/mem_edit
Fix type annotations and docs.
This commit is contained in:
parent
61289a6858
commit
a13e622f7a
@ -206,7 +206,7 @@ class Process(metaclass=ABCMeta):
|
||||
def get_pid_by_name(target_name: str) -> int or None:
|
||||
"""
|
||||
Attempt to return the process id (pid) of a process which was run with an executable
|
||||
file with the provided name.
|
||||
file with the provided name. If no process is found, return None.
|
||||
|
||||
This is a convenience method for quickly finding a process which is already known
|
||||
to be unique and has a well-defined executable name.
|
||||
@ -214,6 +214,7 @@ class Process(metaclass=ABCMeta):
|
||||
Don't rely on this method if you can possibly avoid it, since it makes no
|
||||
attempt to confirm that it found a unique process and breaks trivially (e.g. if the
|
||||
executable file is renamed).
|
||||
:return: Process id (pid) of a process with the provided name, or None.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -91,7 +91,7 @@ class Process(AbstractProcess):
|
||||
return pids
|
||||
|
||||
@staticmethod
|
||||
def get_pid_by_name(target_name: str) -> int:
|
||||
def get_pid_by_name(target_name: str) -> int or None:
|
||||
for pid in Process.list_available_pids():
|
||||
try:
|
||||
logger.info('Checking name for pid {}'.format(pid))
|
||||
@ -123,5 +123,3 @@ class Process(AbstractProcess):
|
||||
start, stop = (int(bound, 16) for bound in bounds.split('-'))
|
||||
regions.append((start, stop))
|
||||
return regions
|
||||
|
||||
|
||||
|
@ -193,7 +193,7 @@ class Process(AbstractProcess):
|
||||
return pids[:num_returned]
|
||||
|
||||
@staticmethod
|
||||
def get_pid_by_name(target_name: str) -> int:
|
||||
def get_pid_by_name(target_name: str) -> int or None:
|
||||
for pid in Process.list_available_pids():
|
||||
try:
|
||||
logger.info('Checking name for pid {}'.format(pid))
|
||||
|
Loading…
Reference in New Issue
Block a user