Skip to content

Commit 8819ece

Browse files
author
Carl
committed
testing/docs: fixed whitespace issues in docstrings
1 parent ddb3bac commit 8819ece

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/humanize/filesize.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def naturalsize(value, binary=False, gnu=False, format="%.1f"):
1515
By default, decimal suffixes (kB, MB) are used.
1616
1717
Non-GNU modes are compatible with jinja2's `filesizeformat` filter.
18+
1819
Examples:
1920
```pycon
2021
>>> naturalsize(3000000)

src/humanize/number.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def ordinal(value):
3333
'101st'
3434
>>> ordinal(111)
3535
'111th'
36-
>>> ordinal('something else')
36+
>>> ordinal("something else")
3737
'something else'
3838
>>> ordinal(None) is None
3939
True
@@ -71,6 +71,7 @@ def intcomma(value, ndigits=None):
7171
7272
For example, 3000 becomes "3,000" and 45000 becomes "45,000". To maintain some
7373
compatibility with Django's `intcomma`, this function also accepts floats.
74+
7475
Examples:
7576
``pycon
7677
>>> intcomma(100)
@@ -138,6 +139,7 @@ def intword(value, format="%.1f"):
138139
Works best for numbers over 1 million. For example, 1_000_000 becomes "1.0 million",
139140
1200000 becomes "1.2 million" and "1_200_000_000" becomes "1.2 billion". Supports up
140141
to decillion (33 digits) and googol (100 digits).
142+
141143
Examples:
142144
```pycon
143145
>>> intword("100")
@@ -184,24 +186,25 @@ def intword(value, format="%.1f"):
184186
def apnumber(value):
185187
"""Converts an integer to Associated Press style.
186188
189+
Examples:
190+
```pycon
191+
>>> apnumber(0)
192+
'zero'
193+
>>> apnumber(5)
194+
'five'
195+
>>> apnumber(10)
196+
'10'
197+
>>> apnumber("7")
198+
'seven'
199+
>>> apnumber("foo")
200+
'foo'
201+
>>> apnumber(None) is None
202+
True
203+
204+
```
187205
Args:
188206
value (int, float, str): Integer to convert.
189-
Examples:
190-
```pycon
191-
>>> apnumber(0)
192-
'zero'
193-
>>> apnumber(5)
194-
'five'
195-
>>> apnumber(10)
196-
'10'
197-
>>> apnumber("7")
198-
'seven'
199-
>>> apnumber("foo")
200-
'foo'
201-
>>> apnumber(None) is None
202-
True
203207
204-
```
205208
Returns:
206209
str: For numbers 0-9, the number spelled out. Otherwise, the number. This always
207210
returns a string unless the value was not `int`-able, unlike the Django filter.
@@ -243,7 +246,6 @@ def fractional(value):
243246
244247
Examples:
245248
```pycon
246-
247249
>>> fractional(0.3)
248250
'3/10'
249251
>>> fractional(1.3)

src/humanize/time.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ def naturalday(value, format="%b %d"):
214214
present day return representing string. Otherwise, return a string
215215
formatted according to `format`.
216216
217-
Examples:
218-
219-
220217
"""
221218
try:
222219
value = dt.date(value.year, value.month, value.day)

0 commit comments

Comments
 (0)