Skip to content

Commit

Permalink
doc(format): fix some doc error
Browse files Browse the repository at this point in the history
  • Loading branch information
litlighilit committed Jul 13, 2024
1 parent 9ec5bd0 commit cbf9ed3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/pylib/Lib/datetime_impl/timedelta_impl/getter.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func secondsImpl*(parts): int64 =
## result is never negative. In Python, only timedelta.days may be negative
# do not use `.inSeconds()`, as that's a sum
result = parts[Seconds]
result.inc convert(Hours, Seconds, parts[Hours])
result.inc convert(Minutes, Seconds, parts[Minutes])
result += convert(Hours, Seconds, parts[Hours])
result += convert(Minutes, Seconds, parts[Minutes])
if result <= 0:
result.inc convert(Days, Seconds, 1)
if parts[Microseconds] < 0:
Expand All @@ -33,8 +33,8 @@ func microsecondsImpl*(parts): int64 =
# do not use .inMicroseconds
# nanoseconds part is always 0 for timedelta's Duration attr
result = parts[Microseconds]
result.inc convert(Milliseconds, Microseconds, parts[Milliseconds])
result += convert(Milliseconds, Microseconds, parts[Milliseconds])
if result <= 0:
result.inc 1_000_000
result += 1_000_000

func microseconds*(self): int64 = self.asDuration.toParts.microsecondsImpl()
4 changes: 2 additions & 2 deletions src/pylib/Lib/datetime_impl/timezone_impl/decl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func repr*(self: timezone): string =
result.add self.name
result.add ')'

func format_utcoffset(hours, minutes, seconds, microseconds: int,
func format_utcoffset(hours, minutes, seconds, microseconds: int64,
sep: char|string = ':', prefix="UTC"): string =
var
hours = hours
Expand Down Expand Up @@ -124,7 +124,7 @@ func format_utcoffset(hours, minutes, seconds, microseconds: int,
func format_utcoffset*(parts: DurationParts, sep: string|char = ':',
prefix="UTC"): string =
## common code of CPython C-API `timezone_str` and `format_utcoffset`
## in `_datetimemodule.c
## in `_datetimemodule.c`
when not defined(release):
let days = parts[Days] + parts[Weeks] * 7
assert days == 0, "timezone's init shall check its offset is within one day"
Expand Down
10 changes: 5 additions & 5 deletions src/pylib/Python/fileutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ proc Py_DecodeLocaleEx*(arg: cstring, wstr: var ptr wchar_t, wlen: ptr csize_t,
surrogateescape error handler instead of decoding them.
On success, return 0 and write the newly allocated wide character string into
*wstr (use PyMem_RawFree() to free the memory). If wlen is not NULL, write
the number of wide characters excluding the null character into *wlen.
`wstr` (use PyMem_RawFree() to free the memory). If wlen is not NULL, write
the number of wide characters excluding the null character into `wlen`.
On memory allocation failure, return -1.
On decoding error, return -2. If wlen is not NULL, write the start of
invalid byte sequence in the input string into *wlen. If reason is not NULL,
write the decoding error message into *reason.
On decoding error, return -2. Write the start of
invalid byte sequence in the input string into `wlen`. If reason is not NULL,
write the decoding error message into `reason`.
Return -3 if the error handler 'errors' is not supported.
Expand Down
8 changes: 4 additions & 4 deletions src/pylib/Python/unicodeobject/utf8_codec.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ proc Py_DecodeUTF8Ex*(orig_s: cstring, size: csize_t,
non-zero, use strict error handler otherwise.
On success, write a pointer to a newly allocated wide character string into
*wstr (use PyMem_RawFree() to free the memory) and write the output length
(in number of wchar_t units) into *wlen (if wlen is set).
`wstr` (use PyMem_RawFree() to free the memory) and write the output length
(in number of wchar_t units) into `wlen` (if wlen is set).
On memory allocation failure, return -1.
On decoding error (if surrogateescape is zero), return -2. If wlen is
non-NULL, write the start of the illegal byte sequence into *wlen. If reason
is not NULL, write the decoding error message into *reason.]##
non-NULL, write the start of the illegal byte sequence into `wlen`. If reason
is not NULL, write the decoding error message into `reason`.]##

var surrogateescape, surrogatepass: bool

Expand Down

0 comments on commit cbf9ed3

Please sign in to comment.