Skip to content

Commit 19d1c85

Browse files
committed
re-run formatter, but with docstring code snippet formatting enabled
1 parent b911e9a commit 19d1c85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+11966
-7587
lines changed

Lib/_pydatetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ def __repr__(self):
25882588
>>> tz = timezone.utc
25892589
>>> repr(tz)
25902590
'datetime.timezone.utc'
2591-
>>> tz = timezone(timedelta(hours=-5), 'EST')
2591+
>>> tz = timezone(timedelta(hours=-5), "EST")
25922592
>>> repr(tz)
25932593
"datetime.timezone(datetime.timedelta(-1, 68400), 'EST')"
25942594
"""

Lib/_pydecimal.py

Lines changed: 304 additions & 306 deletions
Large diffs are not rendered by default.

Lib/antigravity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def geohash(latitude, longitude, datedow):
88
"""Compute geohash() using the Munroe algorithm.
99
10-
>>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
10+
>>> geohash(37.421542, -122.085589, b"2005-05-26-10458.68")
1111
37.857713 -122.544543
1212
1313
"""

Lib/collections/__init__.py

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -359,23 +359,23 @@ def __ror__(self, other):
359359
def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None):
360360
"""Returns a new subclass of tuple with named fields.
361361
362-
>>> Point = namedtuple('Point', ['x', 'y'])
363-
>>> Point.__doc__ # docstring for the new class
362+
>>> Point = namedtuple("Point", ["x", "y"])
363+
>>> Point.__doc__ # docstring for the new class
364364
'Point(x, y)'
365-
>>> p = Point(11, y=22) # instantiate with positional args or keywords
366-
>>> p[0] + p[1] # indexable like a plain tuple
365+
>>> p = Point(11, y=22) # instantiate with positional args or keywords
366+
>>> p[0] + p[1] # indexable like a plain tuple
367367
33
368-
>>> x, y = p # unpack like a regular tuple
368+
>>> x, y = p # unpack like a regular tuple
369369
>>> x, y
370370
(11, 22)
371-
>>> p.x + p.y # fields also accessible by name
371+
>>> p.x + p.y # fields also accessible by name
372372
33
373-
>>> d = p._asdict() # convert to a dictionary
374-
>>> d['x']
373+
>>> d = p._asdict() # convert to a dictionary
374+
>>> d["x"]
375375
11
376-
>>> Point(**d) # convert from a dictionary
376+
>>> Point(**d) # convert from a dictionary
377377
Point(x=11, y=22)
378-
>>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
378+
>>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
379379
Point(x=100, y=22)
380380
381381
"""
@@ -562,42 +562,42 @@ class Counter(dict):
562562
or multiset. Elements are stored as dictionary keys and their counts
563563
are stored as dictionary values.
564564
565-
>>> c = Counter('abcdeabcdabcaba') # count elements from a string
565+
>>> c = Counter("abcdeabcdabcaba") # count elements from a string
566566
567-
>>> c.most_common(3) # three most common elements
567+
>>> c.most_common(3) # three most common elements
568568
[('a', 5), ('b', 4), ('c', 3)]
569-
>>> sorted(c) # list all unique elements
569+
>>> sorted(c) # list all unique elements
570570
['a', 'b', 'c', 'd', 'e']
571-
>>> ''.join(sorted(c.elements())) # list elements with repetitions
571+
>>> "".join(sorted(c.elements())) # list elements with repetitions
572572
'aaaaabbbbcccdde'
573-
>>> sum(c.values()) # total of all counts
573+
>>> sum(c.values()) # total of all counts
574574
15
575575
576-
>>> c['a'] # count of letter 'a'
576+
>>> c["a"] # count of letter 'a'
577577
5
578-
>>> for elem in 'shazam': # update counts from an iterable
579-
... c[elem] += 1 # by adding 1 to each element's count
580-
>>> c['a'] # now there are seven 'a'
578+
>>> for elem in "shazam": # update counts from an iterable
579+
... c[elem] += 1 # by adding 1 to each element's count
580+
>>> c["a"] # now there are seven 'a'
581581
7
582-
>>> del c['b'] # remove all 'b'
583-
>>> c['b'] # now there are zero 'b'
582+
>>> del c["b"] # remove all 'b'
583+
>>> c["b"] # now there are zero 'b'
584584
0
585585
586-
>>> d = Counter('simsalabim') # make another counter
587-
>>> c.update(d) # add in the second counter
588-
>>> c['a'] # now there are nine 'a'
586+
>>> d = Counter("simsalabim") # make another counter
587+
>>> c.update(d) # add in the second counter
588+
>>> c["a"] # now there are nine 'a'
589589
9
590590
591-
>>> c.clear() # empty the counter
591+
>>> c.clear() # empty the counter
592592
>>> c
593593
Counter()
594594
595595
Note: If a count is set to zero or reduced to zero, it will remain
596596
in the counter until the entry is deleted or the counter is cleared:
597597
598-
>>> c = Counter('aaabbc')
599-
>>> c['b'] -= 2 # reduce the count of 'b' by two
600-
>>> c.most_common() # 'b' is still in, but its count is zero
598+
>>> c = Counter("aaabbc")
599+
>>> c["b"] -= 2 # reduce the count of 'b' by two
600+
>>> c.most_common() # 'b' is still in, but its count is zero
601601
[('a', 3), ('c', 1), ('b', 0)]
602602
603603
"""
@@ -614,10 +614,10 @@ def __init__(self, iterable=None, /, **kwds):
614614
from an input iterable. Or, initialize the count from another mapping
615615
of elements to their counts.
616616
617-
>>> c = Counter() # a new, empty counter
618-
>>> c = Counter('gallahad') # a new counter from an iterable
619-
>>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
620-
>>> c = Counter(a=4, b=2) # a new counter from keyword args
617+
>>> c = Counter() # a new, empty counter
618+
>>> c = Counter("gallahad") # a new counter from an iterable
619+
>>> c = Counter({"a": 4, "b": 2}) # a new counter from a mapping
620+
>>> c = Counter(a=4, b=2) # a new counter from keyword args
621621
622622
"""
623623
super().__init__()
@@ -636,7 +636,7 @@ def most_common(self, n=None):
636636
"""List the n most common elements and their counts from the most
637637
common to the least. If n is None, then list all element counts.
638638
639-
>>> Counter('abracadabra').most_common(3)
639+
>>> Counter("abracadabra").most_common(3)
640640
[('a', 5), ('b', 2), ('r', 2)]
641641
642642
"""
@@ -652,7 +652,7 @@ def most_common(self, n=None):
652652
def elements(self):
653653
"""Iterator over elements repeating each as many times as its count.
654654
655-
>>> c = Counter('ABCABC')
655+
>>> c = Counter("ABCABC")
656656
>>> sorted(c.elements())
657657
['A', 'A', 'B', 'B', 'C', 'C']
658658
@@ -689,11 +689,11 @@ def update(self, iterable=None, /, **kwds):
689689
690690
Source can be an iterable, a dictionary, or another Counter instance.
691691
692-
>>> c = Counter('which')
693-
>>> c.update('witch') # add elements from another iterable
694-
>>> d = Counter('watch')
695-
>>> c.update(d) # add elements from another counter
696-
>>> c['h'] # four 'h' in which, witch, and watch
692+
>>> c = Counter("which")
693+
>>> c.update("witch") # add elements from another iterable
694+
>>> d = Counter("watch")
695+
>>> c.update(d) # add elements from another counter
696+
>>> c["h"] # four 'h' in which, witch, and watch
697697
4
698698
699699
"""
@@ -725,12 +725,12 @@ def subtract(self, iterable=None, /, **kwds):
725725
726726
Source can be an iterable, a dictionary, or another Counter instance.
727727
728-
>>> c = Counter('which')
729-
>>> c.subtract('witch') # subtract elements from another iterable
730-
>>> c.subtract(Counter('watch')) # subtract elements from another counter
731-
>>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch
728+
>>> c = Counter("which")
729+
>>> c.subtract("witch") # subtract elements from another iterable
730+
>>> c.subtract(Counter("watch")) # subtract elements from another counter
731+
>>> c["h"] # 2 in which, minus 1 in witch, minus 1 in watch
732732
0
733-
>>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch
733+
>>> c["w"] # 1 in which, minus 1 in witch, minus 1 in watch
734734
-1
735735
736736
"""
@@ -841,7 +841,7 @@ def __gt__(self, other):
841841
def __add__(self, other):
842842
"""Add counts from two counters.
843843
844-
>>> Counter('abbb') + Counter('bcc')
844+
>>> Counter("abbb") + Counter("bcc")
845845
Counter({'b': 4, 'c': 2, 'a': 1})
846846
847847
"""
@@ -860,7 +860,7 @@ def __add__(self, other):
860860
def __sub__(self, other):
861861
"""Subtract count, but keep only results with positive counts.
862862
863-
>>> Counter('abbbc') - Counter('bccd')
863+
>>> Counter("abbbc") - Counter("bccd")
864864
Counter({'b': 2, 'a': 1})
865865
866866
"""
@@ -879,7 +879,7 @@ def __sub__(self, other):
879879
def __or__(self, other):
880880
"""Union is the maximum of value in either of the input counters.
881881
882-
>>> Counter('abbb') | Counter('bcc')
882+
>>> Counter("abbb") | Counter("bcc")
883883
Counter({'b': 3, 'c': 2, 'a': 1})
884884
885885
"""
@@ -899,7 +899,7 @@ def __or__(self, other):
899899
def __and__(self, other):
900900
"""Intersection is the minimum of corresponding counts.
901901
902-
>>> Counter('abbb') & Counter('bcc')
902+
>>> Counter("abbb") & Counter("bcc")
903903
Counter({'b': 1})
904904
905905
"""
@@ -942,8 +942,8 @@ def _keep_positive(self):
942942
def __iadd__(self, other):
943943
"""Inplace add from another counter, keeping only positive counts.
944944
945-
>>> c = Counter('abbb')
946-
>>> c += Counter('bcc')
945+
>>> c = Counter("abbb")
946+
>>> c += Counter("bcc")
947947
>>> c
948948
Counter({'b': 4, 'c': 2, 'a': 1})
949949
@@ -955,8 +955,8 @@ def __iadd__(self, other):
955955
def __isub__(self, other):
956956
"""Inplace subtract counter, but keep only results with positive counts.
957957
958-
>>> c = Counter('abbbc')
959-
>>> c -= Counter('bccd')
958+
>>> c = Counter("abbbc")
959+
>>> c -= Counter("bccd")
960960
>>> c
961961
Counter({'b': 2, 'a': 1})
962962
@@ -968,8 +968,8 @@ def __isub__(self, other):
968968
def __ior__(self, other):
969969
"""Inplace union is the maximum of value from either counter.
970970
971-
>>> c = Counter('abbb')
972-
>>> c |= Counter('bcc')
971+
>>> c = Counter("abbb")
972+
>>> c |= Counter("bcc")
973973
>>> c
974974
Counter({'b': 3, 'c': 2, 'a': 1})
975975
@@ -983,8 +983,8 @@ def __ior__(self, other):
983983
def __iand__(self, other):
984984
"""Inplace intersection is the minimum of corresponding counts.
985985
986-
>>> c = Counter('abbb')
987-
>>> c &= Counter('bcc')
986+
>>> c = Counter("abbb")
987+
>>> c &= Counter("bcc")
988988
>>> c
989989
Counter({'b': 1})
990990

0 commit comments

Comments
 (0)