diff options
| author | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-04-10 19:28:43 +0200 |
|---|---|---|
| committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2013-04-10 19:28:43 +0200 |
| commit | 532b77bdb23d211b7e831db461f7f87a2ed92a84 (patch) | |
| tree | 4466aae26a0c13ba234f3645fd957253a301c937 | |
| parent | ce50a1f1602880f0d287904fac5f1acf34046b78 (diff) | |
| download | psutil-532b77bdb23d211b7e831db461f7f87a2ed92a84.tar.gz | |
(minor) move parent method upper so that it's grouped in the utility methos
| -rw-r--r-- | psutil/__init__.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py index 35c505e1..cbc1460f 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -141,6 +141,8 @@ class Process(object): def __repr__(self): return "<%s at %s>" % (self.__str__(), id(self)) + # --- utility methods + def as_dict(self, attrs=[], ad_value=None): """Utility method returning process information as a hashable dictionary. @@ -191,16 +193,6 @@ class Process(object): return retdict @property - def pid(self): - """The process pid.""" - return self._pid - - @cached_property - def ppid(self): - """The process parent pid.""" - return self._platform_impl.get_process_ppid() - - @property def parent(self): """Return the parent process as a Process object. If no parent pid is known return None. @@ -212,6 +204,18 @@ class Process(object): except NoSuchProcess: pass + # --- actual API + + @property + def pid(self): + """The process pid.""" + return self._pid + + @cached_property + def ppid(self): + """The process parent pid.""" + return self._platform_impl.get_process_ppid() + @cached_property def name(self): """The process name.""" |
