Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/265100
Change subject: ganglia compat.py: couple of pep8 fixes, mostly whitespace
......................................................................
ganglia compat.py: couple of pep8 fixes, mostly whitespace
Change-Id: Ib23c4e803da5dfe7bc1845ffcfee3495b286c5da
---
M modules/ganglia/files/plugins/compat.py
1 file changed, 13 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/00/265100/1
diff --git a/modules/ganglia/files/plugins/compat.py
b/modules/ganglia/files/plugins/compat.py
index cdd0a4e..f8272e3 100644
--- a/modules/ganglia/files/plugins/compat.py
+++ b/modules/ganglia/files/plugins/compat.py
@@ -3,7 +3,8 @@
from operator import itemgetter
from heapq import nlargest
from itertools import repeat, ifilter
-
+
+
class Counter(dict):
'''Dict subclass for counting hashable objects. Sometimes called a bag
or multiset. Elements are stored as dictionary keys and their counts
@@ -19,12 +20,12 @@
from an input iterable. Or, initialize the count from another mapping
of elements to their counts.
- >>> c = Counter() # a new, empty counter
- >>> c = Counter('gallahad') # a new counter from an
iterable
- >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a
mapping
- >>> c = Counter(a=4, b=2) # a new counter from
keyword args
+ >>> c = Counter() # a new, empty counter
+ >>> c = Counter('gallahad') # a new counter from an iterable
+ >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
+ >>> c = Counter(a=4, b=2) # a new counter from keyword args
- '''
+ '''
self.update(iterable, **kwds)
def __missing__(self, key):
@@ -37,7 +38,7 @@
>>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]
- '''
+ '''
if n is None:
return sorted(self.iteritems(), key=itemgetter(1), reverse=True)
return nlargest(n, self.iteritems(), key=itemgetter(1))
@@ -76,7 +77,7 @@
>>> c['h'] # four 'h' in which, witch, and watch
4
- '''
+ '''
if iterable is not None:
if hasattr(iterable, 'iteritems'):
if self:
@@ -84,7 +85,8 @@
for elem, count in iterable.iteritems():
self[elem] = self_get(elem, 0) + count
else:
- dict.update(self, iterable) # fast path when counter is
empty
+ # fast path when counter is empty
+ dict.update(self, iterable)
else:
self_get = self.get
for elem in iterable:
@@ -97,7 +99,8 @@
return Counter(self)
def __delitem__(self, elem):
- 'Like dict.__delitem__() but does not raise KeyError for missing
values.'
+ """Like dict.__delitem__() but does not raise KeyError for missing
+ values."""
if elem in self:
dict.__delitem__(self, elem)
--
To view, visit https://gerrit.wikimedia.org/r/265100
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib23c4e803da5dfe7bc1845ffcfee3495b286c5da
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits