Skip to content

Commit 1e97834

Browse files
nuztalgiaDaniel Gillet
authored andcommitted
Improve grammar and consistency in some internal docstrings/comments.
1 parent e9df3f7 commit 1e97834

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/humanize/time.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -348,25 +348,25 @@ def _quotient_and_remainder(
348348
minimum_unit: Unit,
349349
suppress: Iterable[Unit],
350350
) -> tuple[float, float]:
351-
"""Divide `value` by `divisor` returning the quotient and remainder.
351+
"""Divide `value` by `divisor`, returning the quotient and remainder.
352352
353-
If `unit` is `minimum_unit`, makes the quotient a float number and the remainder
354-
will be zero. The rational is that if `unit` is the unit of the quotient, we cannot
353+
If `unit` is `minimum_unit`, the quotient will be a float number and the remainder
354+
will be zero. The rationale is that if `unit` is the unit of the quotient, we cannot
355355
represent the remainder because it would require a unit smaller than the
356356
`minimum_unit`.
357357
358358
>>> from humanize.time import _quotient_and_remainder, Unit
359359
>>> _quotient_and_remainder(36, 24, Unit.DAYS, Unit.DAYS, [])
360360
(1.5, 0)
361361
362-
If unit is in `suppress`, the quotient will be zero and the remainder will be the
362+
If `unit` is in `suppress`, the quotient will be zero and the remainder will be the
363363
initial value. The idea is that if we cannot use `unit`, we are forced to use a
364-
lower unit so we cannot do the division.
364+
lower unit, so we cannot do the division.
365365
366366
>>> _quotient_and_remainder(36, 24, Unit.DAYS, Unit.HOURS, [Unit.DAYS])
367367
(0, 36)
368368
369-
In other case return quotient and remainder as `divmod` would do it.
369+
In other cases, return the quotient and remainder as `divmod` would do it.
370370
371371
>>> _quotient_and_remainder(36, 24, Unit.DAYS, Unit.HOURS, [])
372372
(1, 12)
@@ -391,16 +391,16 @@ def _carry(
391391
) -> tuple[float, float]:
392392
"""Return a tuple with two values.
393393
394-
If the unit is in `suppress`, multiply `value1` by `ratio` and add it to `value2`
395-
(carry to right). The idea is that if we cannot represent `value1` we need to
394+
If `unit` is in `suppress`, multiply `value1` by `ratio` and add it to `value2`
395+
(carry to right). The idea is that if we cannot represent `value1`, we need to
396396
represent it in a lower unit.
397397
398398
>>> from humanize.time import _carry, Unit
399399
>>> _carry(2, 6, 24, Unit.DAYS, Unit.SECONDS, [Unit.DAYS])
400400
(0, 54)
401401
402-
If the unit is the minimum unit, `value2` is divided by `ratio` and added to
403-
`value1` (carry to left). We assume that `value2` has a lower unit so we need to
402+
If `unit` is the minimum unit, divide `value2` by `ratio` and add it to `value1`
403+
(carry to left). We assume that `value2` has a lower unit, so we need to
404404
carry it to `value1`.
405405
406406
>>> _carry(2, 6, 24, Unit.DAYS, Unit.DAYS, [])
@@ -471,7 +471,7 @@ def precisedelta(
471471
suppress: Iterable[str] = (),
472472
format: str = "%0.2f",
473473
) -> str:
474-
"""Return a precise representation of a timedelta.
474+
"""Return a precise representation of a timedelta or number of seconds.
475475
476476
```pycon
477477
>>> import datetime as dt
@@ -543,8 +543,8 @@ def precisedelta(
543543

544544
suppress_set = {Unit[s.upper()] for s in suppress}
545545

546-
# Find a suitable minimum unit (it can be greater the one that the
547-
# user gave us if it is suppressed).
546+
# Find a suitable minimum unit (it can be greater than the one that the
547+
# user gave us, if that one is suppressed).
548548
min_unit = Unit[minimum_unit.upper()]
549549
min_unit = _suitable_minimum_unit(min_unit, suppress_set)
550550
del minimum_unit
@@ -593,7 +593,7 @@ def precisedelta(
593593
usecs, 1000, MILLISECONDS, min_unit, suppress_set
594594
)
595595

596-
# if _unused != 0 we had lost some precision
596+
# if _unused != 0 we have lost some precision
597597
usecs, _unused = _carry(usecs, 0, 1, MICROSECONDS, min_unit, suppress_set)
598598

599599
fmts = [

0 commit comments

Comments
 (0)