summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-04-11 12:06:02 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2016-04-11 12:06:02 +0200
commitdc2a3a89eb5fd5010c12d71f444c76ade875f9fb (patch)
tree7183fd22339a10c9ad2cb3194c94690ff3922e52
parent1fa17b6618283d55978ad6a1a0f4da56efded75f (diff)
downloadpsutil-dc2a3a89eb5fd5010c12d71f444c76ade875f9fb.tar.gz
update doc
-rw-r--r--README.rst11
-rw-r--r--docs/index.rst7
-rw-r--r--psutil/_pswindows.py14
3 files changed, 16 insertions, 16 deletions
diff --git a/README.rst b/README.rst
index 7bf8959d..ffe35144 100644
--- a/README.rst
+++ b/README.rst
@@ -338,12 +338,11 @@ Windows services
.. code-block:: python
>>> list(psutil.win_service_iter())
- [<WindowsService(name=AeLookupSvc, display_name=Application Experience) at 38850096>,
- <WindowsService(name=ALG, display_name=Application Layer Gateway Service) at 38850128>,
- <WindowsService(name=APNMCP, display_name=Ask Update Service) at 38850160>,
- <WindowsService(name=AppIDSvc, display_name=Application Identity) at 38850192>,
- ...
- ]
+ [<WindowsService(name='AeLookupSvc', display_name='Application Experience') at 38850096>,
+ <WindowsService(name='ALG', display_name='Application Layer Gateway Service') at 38850128>,
+ <WindowsService(name='APNMCP', display_name='Ask Update Service') at 38850160>,
+ <WindowsService(name='AppIDSvc', display_name='Application Identity') at 38850192>,
+ ...]
>>> s = psutil.win_service_get('alg')
>>> s.as_dict()
{'binpath': 'C:\\Windows\\System32\\alg.exe',
diff --git a/docs/index.rst b/docs/index.rst
index 5b3824ed..18733665 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1511,11 +1511,12 @@ Windows services
The service name. This string is how a service is referenced and can be
passed to :func:`win_service_get` to get a new :class:`WindowsService`
- instance. The return value is cached on instantiation.
+ instance.
.. method:: display_name()
- The service display name. The return value is cached on instantiation.
+ The service display name. The value is cached when this class is
+ instantiated.
.. method:: binpath()
@@ -1524,7 +1525,7 @@ Windows services
.. method:: username()
- The name of the user that owns the service.
+ The name of the user that owns this service.
.. method:: start_type()
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py
index d4c27784..a7ca5be1 100644
--- a/psutil/_pswindows.py
+++ b/psutil/_pswindows.py
@@ -305,7 +305,7 @@ class WindowsService(object):
self._display_name = display_name
def __str__(self):
- details = "(name=%s, display_name=%s)" % (
+ details = "(name=%r, display_name=%r)" % (
self._name, self._display_name)
return "%s%s" % (self.__class__.__name__, details)
@@ -326,6 +326,7 @@ class WindowsService(object):
with self._wrap_exceptions():
display_name, binpath, username, start_type = \
cext.winservice_query_config(self._name)
+ # XXX - update _self.display_name?
return dict(
display_name=display_name,
binpath=binpath,
@@ -365,14 +366,13 @@ class WindowsService(object):
def name(self):
"""The service name. This string is how a service is referenced
and can be passed to win_service_get() to get a new
- WindowsService instance. The return value is cached on
- instantiation.
+ WindowsService instance.
"""
return self._name
def display_name(self):
- """The service display name. The return value is cached on
- instantiation.
+ """The service display name. The value is cached when this class
+ is instantiated.
"""
return self._display_name
@@ -383,7 +383,7 @@ class WindowsService(object):
return self._query_config()['binpath']
def username(self):
- """The name of the user that owns the service."""
+ """The name of the user that owns this service."""
return self._query_config()['username']
def start_type(self):
@@ -395,7 +395,7 @@ class WindowsService(object):
# status query
def pid(self):
- """The process PID, if any, else `None`. This can be passed
+ """The process PID, if any, else None. This can be passed
to Process class to control the service's process.
"""
return self._query_status()['pid']