summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-09 19:27:45 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-05-09 19:27:45 +0200
commit14d0d376af1ddf1694536084e63ab9096f3484b5 (patch)
tree15db09fd2fd229ec422e8690962e610216cc7140
parent89b7e8a0ddcc569d52ecc1880e172c530338559c (diff)
downloadpsutil-14d0d376af1ddf1694536084e63ab9096f3484b5.tar.gz
update docstrings
-rw-r--r--psutil/_common.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/psutil/_common.py b/psutil/_common.py
index 9be96fe2..d58dac6b 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -63,7 +63,7 @@ __all__ = [
# utility functions
'conn_tmap', 'deprecated_method', 'isfile_strict', 'memoize',
'parse_environ_block', 'path_exists_strict', 'usage_percent',
- 'supports_ipv6', 'sockfam_to_enum', 'socktype_to_enum',
+ 'supports_ipv6', 'sockfam_to_enum', 'socktype_to_enum', "wrap_numbers",
]
@@ -470,7 +470,9 @@ def deprecated_method(replacement):
class _WrapNumbers:
- """Watches numbers so that they don't overlap."""
+ """Watches numbers so that they don't overflow and wrap
+ (reset to zero).
+ """
def __init__(self):
self.lock = threading.Lock()
@@ -498,6 +500,9 @@ class _WrapNumbers:
del self.reminder_keys[name][gone_key]
def run(self, input_dict, name):
+ """Cache dict and sum numbers which overflow and wrap.
+ Return an updated copy of `input_dict`
+ """
if name not in self.cache:
# This was the first call.
self._add_dict(input_dict, name)
@@ -554,7 +559,7 @@ class _WrapNumbers:
def wrap_numbers(input_dict, name):
"""Given an `input_dict` and a function `name`, adjust the numbers
which "wrap" (restart from zero) across different calls by adding
- "old value" to "new value".
+ "old value" to "new value" and return an updated dict.
"""
with _wn.lock:
return _wn.run(input_dict, name)