From a13e622f7ae573bd6a96410fa321f0f97219c7d5 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 21 Jun 2017 01:45:39 -0700 Subject: [PATCH] Fix type annotations and docs. --- mem_edit/abstract.py | 3 ++- mem_edit/linux.py | 4 +--- mem_edit/windows.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mem_edit/abstract.py b/mem_edit/abstract.py index d31f8bf..9dca6ec 100644 --- a/mem_edit/abstract.py +++ b/mem_edit/abstract.py @@ -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 diff --git a/mem_edit/linux.py b/mem_edit/linux.py index 459c191..4dafd1c 100644 --- a/mem_edit/linux.py +++ b/mem_edit/linux.py @@ -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 - - diff --git a/mem_edit/windows.py b/mem_edit/windows.py index 3f79b2d..1c19546 100644 --- a/mem_edit/windows.py +++ b/mem_edit/windows.py @@ -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))