In a google-style docstring, this is problematic:
Returns:
str: Some really long description that requires more
than one line
Since the additional text (i.e., "than one line") is indented,
napolean gets confused and incorrectly formats the description. The
fix is to align subsequent lines with the first:
Returns:
str: Some really long description that requires more
than one line.
Along the way I also added missing return types as needed.
57 lines
1.2 KiB
Python
57 lines
1.2 KiB
Python
"""Time and date utilities.
|
|
|
|
This module provides utility functions and classes for dealing with
|
|
times and dates. These functions are hoisted into the `falcon` module
|
|
for convenience::
|
|
|
|
import falcon
|
|
|
|
tz = falcon.TimezoneGMT()
|
|
|
|
"""
|
|
|
|
import datetime
|
|
|
|
|
|
class TimezoneGMT(datetime.tzinfo):
|
|
"""GMT timezone class implementing the :py:class:`datetime.tzinfo` interface."""
|
|
|
|
GMT_ZERO = datetime.timedelta(hours=0)
|
|
|
|
def utcoffset(self, dt):
|
|
"""Get the offset from UTC.
|
|
|
|
Args:
|
|
dt(datetime.datetime): Ignored
|
|
|
|
Returns:
|
|
datetime.timedelta: GMT offset, which is equivalent to UTC and
|
|
so is aways 0.
|
|
"""
|
|
|
|
return self.GMT_ZERO
|
|
|
|
def tzname(self, dt):
|
|
"""Get the name of this timezone.
|
|
|
|
Args:
|
|
dt(datetime.datetime): Ignored
|
|
|
|
Returns:
|
|
str: "GMT"
|
|
"""
|
|
|
|
return 'GMT'
|
|
|
|
def dst(self, dt):
|
|
"""Return the daylight saving time (DST) adjustment.
|
|
|
|
Args:
|
|
dt(datetime.datetime): Ignored
|
|
|
|
Returns:
|
|
datetime.timedelta: DST adjustment for GMT, which is always 0.
|
|
"""
|
|
|
|
return self.GMT_ZERO
|