Родитель
571b4578b1
Коммит
4d020983a3
|
@ -0,0 +1,11 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
from ._version import __version__
|
||||
from .api import get, now, utcnow
|
||||
from .arrow import Arrow
|
||||
from .factory import ArrowFactory
|
||||
from .formatter import FORMAT_ATOM, FORMAT_COOKIE, FORMAT_RFC1036, FORMAT_RFC1123, FORMAT_RFC2822, FORMAT_RFC3339, FORMAT_RFC822, FORMAT_RFC850, FORMAT_RSS, FORMAT_W3C
|
||||
from .parser import ParserError
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
__version__ = "0.15.8"
|
|
@ -0,0 +1,41 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
from arrow.factory import ArrowFactory
|
||||
from typing import Any, Optional
|
||||
|
||||
"""
|
||||
Provides the default implementation of :class:`ArrowFactory <arrow.factory.ArrowFactory>`
|
||||
methods for use as a module API.
|
||||
|
||||
"""
|
||||
_factory = ArrowFactory()
|
||||
def get(*args, **kwargs):
|
||||
""" Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``get`` method.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def utcnow():
|
||||
""" Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``utcnow`` method.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def now(tz: Optional[Any] = ...):
|
||||
""" Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``now`` method.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def factory(type):
|
||||
""" Returns an :class:`.ArrowFactory` for the specified :class:`Arrow <arrow.arrow.Arrow>`
|
||||
or derived type.
|
||||
|
||||
:param type: the type, :class:`Arrow <arrow.arrow.Arrow>` or derived.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
__all__ = ["get", "utcnow", "now", "factory"]
|
|
@ -0,0 +1,863 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from typing import Any, Optional, Union, Iterator, Tuple, Object, List, Sequence
|
||||
from datetime import timedelta, tzinfo, relativedelta
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
"""
|
||||
Provides the :class:`Arrow <arrow.arrow.Arrow>` class, an enhanced ``datetime``
|
||||
replacement.
|
||||
|
||||
"""
|
||||
if sys.version_info[: 2] < (3, 6):
|
||||
...
|
||||
class Arrow(object):
|
||||
"""An :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
|
||||
Implements the ``datetime`` interface, behaving as an aware ``datetime`` while implementing
|
||||
additional functionality.
|
||||
|
||||
:param year: the calendar year.
|
||||
:param month: the calendar month.
|
||||
:param day: the calendar day.
|
||||
:param hour: (optional) the hour. Defaults to 0.
|
||||
:param minute: (optional) the minute, Defaults to 0.
|
||||
:param second: (optional) the second, Defaults to 0.
|
||||
:param microsecond: (optional) the microsecond. Defaults 0.
|
||||
:param tzinfo: (optional) A timezone expression. Defaults to UTC.
|
||||
|
||||
.. _tz-expr:
|
||||
|
||||
Recognized timezone expressions:
|
||||
|
||||
- A ``tzinfo`` object.
|
||||
- A ``str`` describing a timezone, similar to 'US/Pacific', or 'Europe/Berlin'.
|
||||
- A ``str`` in ISO 8601 style, as in '+07:00'.
|
||||
- A ``str``, one of the following: 'local', 'utc', 'UTC'.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import arrow
|
||||
>>> arrow.Arrow(2013, 5, 5, 12, 30, 45)
|
||||
<Arrow [2013-05-05T12:30:45+00:00]>
|
||||
|
||||
"""
|
||||
resolution = ...
|
||||
_ATTRS = ...
|
||||
_ATTRS_PLURAL = ...
|
||||
_MONTHS_PER_QUARTER = ...
|
||||
_SECS_PER_MINUTE = ...
|
||||
_SECS_PER_HOUR = ...
|
||||
_SECS_PER_DAY = ...
|
||||
_SECS_PER_WEEK = ...
|
||||
_SECS_PER_MONTH = ...
|
||||
_SECS_PER_YEAR = ...
|
||||
def __init__(self, year, month, day, hour=..., minute=..., second=..., microsecond=..., tzinfo: Optional[Any] = ...):
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def now(cls, tzinfo: Optional[tzinfo] = ...) -> Arrow:
|
||||
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object, representing "now" in the given
|
||||
timezone.
|
||||
|
||||
:param tzinfo: (optional) a ``tzinfo`` object. Defaults to local time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.now('Asia/Baku')
|
||||
<Arrow [2019-01-24T20:26:31.146412+04:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def utcnow(cls) -> Arrow:
|
||||
""" Constructs an :class:`Arrow <arrow.arrow.Arrow>` object, representing "now" in UTC
|
||||
time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow()
|
||||
<Arrow [2019-01-24T16:31:40.651108+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def fromtimestamp(cls, timestamp: Union[int, float], tzinfo: Optional[tzinfo] = ...) -> Arrow:
|
||||
""" Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a timestamp, converted to
|
||||
the given timezone.
|
||||
|
||||
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
|
||||
:param tzinfo: (optional) a ``tzinfo`` object. Defaults to local time.
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls, timestamp: Union[int, float]) -> Arrow:
|
||||
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a timestamp, in UTC time.
|
||||
|
||||
:param timestamp: an ``int`` or ``float`` timestamp, or a ``str`` that converts to either.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def fromdatetime(cls, dt: datetime, tzinfo: Optional[tzinfo] = ...) -> Arrow:
|
||||
""" Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a ``datetime`` and
|
||||
optional replacement timezone.
|
||||
|
||||
:param dt: the ``datetime``
|
||||
:param tzinfo: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to ``dt``'s
|
||||
timezone, or UTC if naive.
|
||||
|
||||
If you only want to replace the timezone of naive datetimes::
|
||||
|
||||
>>> dt
|
||||
datetime.datetime(2013, 5, 5, 0, 0, tzinfo=tzutc())
|
||||
>>> arrow.Arrow.fromdatetime(dt, dt.tzinfo or 'US/Pacific')
|
||||
<Arrow [2013-05-05T00:00:00+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def fromdate(cls, date: date, tzinfo: Optional[tzinfo] = ...) -> Arrow:
|
||||
""" Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a ``date`` and optional
|
||||
replacement timezone. Time values are set to 0.
|
||||
|
||||
:param date: the ``date``
|
||||
:param tzinfo: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to UTC.
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def strptime(cls, date_str: str, fmt: str, tzinfo: Optional[tzinfo] = ...) -> Arrow:
|
||||
""" Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a date string and format,
|
||||
in the style of ``datetime.strptime``. Optionally replaces the parsed timezone.
|
||||
|
||||
:param date_str: the date string.
|
||||
:param fmt: the format string.
|
||||
:param tzinfo: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to the parsed
|
||||
timezone if ``fmt`` contains a timezone directive, otherwise UTC.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.Arrow.strptime('20-01-2019 15:49:10', '%d-%m-%Y %H:%M:%S')
|
||||
<Arrow [2019-01-20T15:49:10+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def range(cls, frame: int, start: datetime, end: Optional[datetime] = ..., tz: Optional[Union[tzinfo, str]] = ..., limit: Optional[int] = ...) -> Iterator[Arrow]:
|
||||
""" Returns an iterator of :class:`Arrow <arrow.arrow.Arrow>` objects, representing
|
||||
points in time between two inputs.
|
||||
|
||||
:param frame: The timeframe. Can be any ``datetime`` property (day, hour, minute...).
|
||||
:param start: A datetime expression, the start of the range.
|
||||
:param end: (optional) A datetime expression, the end of the range.
|
||||
:param tz: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to
|
||||
``start``'s timezone, or UTC if ``start`` is naive.
|
||||
:param limit: (optional) A maximum number of tuples to return.
|
||||
|
||||
**NOTE**: The ``end`` or ``limit`` must be provided. Call with ``end`` alone to
|
||||
return the entire range. Call with ``limit`` alone to return a maximum # of results from
|
||||
the start. Call with both to cap a range at a maximum # of results.
|
||||
|
||||
**NOTE**: ``tz`` internally **replaces** the timezones of both ``start`` and ``end`` before
|
||||
iterating. As such, either call with naive objects and ``tz``, or aware objects from the
|
||||
same timezone and no ``tz``.
|
||||
|
||||
Supported frame values: year, quarter, month, week, day, hour, minute, second.
|
||||
|
||||
Recognized datetime expressions:
|
||||
|
||||
- An :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
- A ``datetime`` object.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> start = datetime(2013, 5, 5, 12, 30)
|
||||
>>> end = datetime(2013, 5, 5, 17, 15)
|
||||
>>> for r in arrow.Arrow.range('hour', start, end):
|
||||
... print(repr(r))
|
||||
...
|
||||
<Arrow [2013-05-05T12:30:00+00:00]>
|
||||
<Arrow [2013-05-05T13:30:00+00:00]>
|
||||
<Arrow [2013-05-05T14:30:00+00:00]>
|
||||
<Arrow [2013-05-05T15:30:00+00:00]>
|
||||
<Arrow [2013-05-05T16:30:00+00:00]>
|
||||
|
||||
**NOTE**: Unlike Python's ``range``, ``end`` *may* be included in the returned iterator::
|
||||
|
||||
>>> start = datetime(2013, 5, 5, 12, 30)
|
||||
>>> end = datetime(2013, 5, 5, 13, 30)
|
||||
>>> for r in arrow.Arrow.range('hour', start, end):
|
||||
... print(repr(r))
|
||||
...
|
||||
<Arrow [2013-05-05T12:30:00+00:00]>
|
||||
<Arrow [2013-05-05T13:30:00+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def span_range(cls, frame: int, start: datetime, end: Optional[datetime], tz: Optional[Union[tzinfo, str]] = ..., limit: Optional[int] = ..., bounds: Optional[str] = ...) -> Iterator[Tuple[Arrow, Arrow]]:
|
||||
""" Returns an iterator of tuples, each :class:`Arrow <arrow.arrow.Arrow>` objects,
|
||||
representing a series of timespans between two inputs.
|
||||
|
||||
:param frame: The timeframe. Can be any ``datetime`` property (day, hour, minute...).
|
||||
:param start: A datetime expression, the start of the range.
|
||||
:param end: (optional) A datetime expression, the end of the range.
|
||||
:param tz: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to
|
||||
``start``'s timezone, or UTC if ``start`` is naive.
|
||||
:param limit: (optional) A maximum number of tuples to return.
|
||||
:param bounds: (optional) a ``str`` of either '()', '(]', '[)', or '[]' that specifies
|
||||
whether to include or exclude the start and end values in each span in the range. '(' excludes
|
||||
the start, '[' includes the start, ')' excludes the end, and ']' includes the end.
|
||||
If the bounds are not specified, the default bound '[)' is used.
|
||||
|
||||
**NOTE**: The ``end`` or ``limit`` must be provided. Call with ``end`` alone to
|
||||
return the entire range. Call with ``limit`` alone to return a maximum # of results from
|
||||
the start. Call with both to cap a range at a maximum # of results.
|
||||
|
||||
**NOTE**: ``tz`` internally **replaces** the timezones of both ``start`` and ``end`` before
|
||||
iterating. As such, either call with naive objects and ``tz``, or aware objects from the
|
||||
same timezone and no ``tz``.
|
||||
|
||||
Supported frame values: year, quarter, month, week, day, hour, minute, second.
|
||||
|
||||
Recognized datetime expressions:
|
||||
|
||||
- An :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
- A ``datetime`` object.
|
||||
|
||||
**NOTE**: Unlike Python's ``range``, ``end`` will *always* be included in the returned
|
||||
iterator of timespans.
|
||||
|
||||
Usage:
|
||||
|
||||
>>> start = datetime(2013, 5, 5, 12, 30)
|
||||
>>> end = datetime(2013, 5, 5, 17, 15)
|
||||
>>> for r in arrow.Arrow.span_range('hour', start, end):
|
||||
... print(r)
|
||||
...
|
||||
(<Arrow [2013-05-05T12:00:00+00:00]>, <Arrow [2013-05-05T12:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T13:00:00+00:00]>, <Arrow [2013-05-05T13:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T14:00:00+00:00]>, <Arrow [2013-05-05T14:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T15:00:00+00:00]>, <Arrow [2013-05-05T15:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T16:00:00+00:00]>, <Arrow [2013-05-05T16:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T17:00:00+00:00]>, <Arrow [2013-05-05T17:59:59.999999+00:00]>)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def interval(cls, frame: int, start: datetime, end: Optional[datetime], interval: Optional[int] = ..., tz: Optional[Union[tzinfo, str]] = ..., bounds: Optional[str] = ...) -> Iterator[Tuple[Arrow, Arrow]]:
|
||||
""" Returns an iterator of tuples, each :class:`Arrow <arrow.arrow.Arrow>` objects,
|
||||
representing a series of intervals between two inputs.
|
||||
|
||||
:param frame: The timeframe. Can be any ``datetime`` property (day, hour, minute...).
|
||||
:param start: A datetime expression, the start of the range.
|
||||
:param end: (optional) A datetime expression, the end of the range.
|
||||
:param interval: (optional) Time interval for the given time frame.
|
||||
:param tz: (optional) A timezone expression. Defaults to UTC.
|
||||
:param bounds: (optional) a ``str`` of either '()', '(]', '[)', or '[]' that specifies
|
||||
whether to include or exclude the start and end values in the intervals. '(' excludes
|
||||
the start, '[' includes the start, ')' excludes the end, and ']' includes the end.
|
||||
If the bounds are not specified, the default bound '[)' is used.
|
||||
|
||||
Supported frame values: year, quarter, month, week, day, hour, minute, second
|
||||
|
||||
Recognized datetime expressions:
|
||||
|
||||
- An :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
- A ``datetime`` object.
|
||||
|
||||
Recognized timezone expressions:
|
||||
|
||||
- A ``tzinfo`` object.
|
||||
- A ``str`` describing a timezone, similar to 'US/Pacific', or 'Europe/Berlin'.
|
||||
- A ``str`` in ISO 8601 style, as in '+07:00'.
|
||||
- A ``str``, one of the following: 'local', 'utc', 'UTC'.
|
||||
|
||||
Usage:
|
||||
|
||||
>>> start = datetime(2013, 5, 5, 12, 30)
|
||||
>>> end = datetime(2013, 5, 5, 17, 15)
|
||||
>>> for r in arrow.Arrow.interval('hour', start, end, 2):
|
||||
... print r
|
||||
...
|
||||
(<Arrow [2013-05-05T12:00:00+00:00]>, <Arrow [2013-05-05T13:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T14:00:00+00:00]>, <Arrow [2013-05-05T15:59:59.999999+00:00]>)
|
||||
(<Arrow [2013-05-05T16:00:00+00:00]>, <Arrow [2013-05-05T17:59:59.999999+00:0]>)
|
||||
"""
|
||||
...
|
||||
|
||||
def __repr__(self) -> str:
|
||||
...
|
||||
|
||||
def __str__(self) -> str:
|
||||
...
|
||||
|
||||
def __format__(self, formatstr: str) -> str:
|
||||
...
|
||||
|
||||
def __hash__(self) -> int:
|
||||
...
|
||||
|
||||
def __getattr__(self, name: str) -> Object:
|
||||
...
|
||||
|
||||
@property
|
||||
def tzinfo(self) -> tzinfo:
|
||||
""" Gets the ``tzinfo`` of the :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arw=arrow.utcnow()
|
||||
>>> arw.tzinfo
|
||||
tzutc()
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@tzinfo.setter
|
||||
def tzinfo(self, tzinfo) -> None:
|
||||
""" Sets the ``tzinfo`` of the :class:`Arrow <arrow.arrow.Arrow>` object. """
|
||||
...
|
||||
|
||||
@property
|
||||
def datetime(self) -> datetime:
|
||||
""" Returns a datetime representation of the :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arw=arrow.utcnow()
|
||||
>>> arw.datetime
|
||||
datetime.datetime(2019, 1, 24, 16, 35, 27, 276649, tzinfo=tzutc())
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def naive(self) -> datetime:
|
||||
""" Returns a naive datetime representation of the :class:`Arrow <arrow.arrow.Arrow>`
|
||||
object.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> nairobi = arrow.now('Africa/Nairobi')
|
||||
>>> nairobi
|
||||
<Arrow [2019-01-23T19:27:12.297999+03:00]>
|
||||
>>> nairobi.naive
|
||||
datetime.datetime(2019, 1, 23, 19, 27, 12, 297999)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def timestamp(self) -> int:
|
||||
""" Returns a timestamp representation of the :class:`Arrow <arrow.arrow.Arrow>` object, in
|
||||
UTC time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().timestamp
|
||||
1548260567
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@property
|
||||
def float_timestamp(self) -> float:
|
||||
""" Returns a floating-point representation of the :class:`Arrow <arrow.arrow.Arrow>`
|
||||
object, in UTC time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().float_timestamp
|
||||
1548260516.830896
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def clone(self) -> Arrow:
|
||||
""" Returns a new :class:`Arrow <arrow.arrow.Arrow>` object, cloned from the current one.
|
||||
|
||||
Usage:
|
||||
|
||||
>>> arw = arrow.utcnow()
|
||||
>>> cloned = arw.clone()
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def replace(self, **kwargs: Any) -> Arrow:
|
||||
""" Returns a new :class:`Arrow <arrow.arrow.Arrow>` object with attributes updated
|
||||
according to inputs.
|
||||
|
||||
Use property names to set their value absolutely::
|
||||
|
||||
>>> import arrow
|
||||
>>> arw = arrow.utcnow()
|
||||
>>> arw
|
||||
<Arrow [2013-05-11T22:27:34.787885+00:00]>
|
||||
>>> arw.replace(year=2014, month=6)
|
||||
<Arrow [2014-06-11T22:27:34.787885+00:00]>
|
||||
|
||||
You can also replace the timezone without conversion, using a
|
||||
:ref:`timezone expression <tz-expr>`::
|
||||
|
||||
>>> arw.replace(tzinfo=tz.tzlocal())
|
||||
<Arrow [2013-05-11T22:27:34.787885-07:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def shift(self, **kwargs: Any) -> Arrow:
|
||||
""" Returns a new :class:`Arrow <arrow.arrow.Arrow>` object with attributes updated
|
||||
according to inputs.
|
||||
|
||||
Use pluralized property names to relatively shift their current value:
|
||||
|
||||
>>> import arrow
|
||||
>>> arw = arrow.utcnow()
|
||||
>>> arw
|
||||
<Arrow [2013-05-11T22:27:34.787885+00:00]>
|
||||
>>> arw.shift(years=1, months=-1)
|
||||
<Arrow [2014-04-11T22:27:34.787885+00:00]>
|
||||
|
||||
Day-of-the-week relative shifting can use either Python's weekday numbers
|
||||
(Monday = 0, Tuesday = 1 .. Sunday = 6) or using dateutil.relativedelta's
|
||||
day instances (MO, TU .. SU). When using weekday numbers, the returned
|
||||
date will always be greater than or equal to the starting date.
|
||||
|
||||
Using the above code (which is a Saturday) and asking it to shift to Saturday:
|
||||
|
||||
>>> arw.shift(weekday=5)
|
||||
<Arrow [2013-05-11T22:27:34.787885+00:00]>
|
||||
|
||||
While asking for a Monday:
|
||||
|
||||
>>> arw.shift(weekday=0)
|
||||
<Arrow [2013-05-13T22:27:34.787885+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def to(self, tz: Optional[Union[tzinfo, str]]) -> Arrow:
|
||||
""" Returns a new :class:`Arrow <arrow.arrow.Arrow>` object, converted
|
||||
to the target timezone.
|
||||
|
||||
:param tz: A :ref:`timezone expression <tz-expr>`.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> utc = arrow.utcnow()
|
||||
>>> utc
|
||||
<Arrow [2013-05-09T03:49:12.311072+00:00]>
|
||||
|
||||
>>> utc.to('US/Pacific')
|
||||
<Arrow [2013-05-08T20:49:12.311072-07:00]>
|
||||
|
||||
>>> utc.to(tz.tzlocal())
|
||||
<Arrow [2013-05-08T20:49:12.311072-07:00]>
|
||||
|
||||
>>> utc.to('-07:00')
|
||||
<Arrow [2013-05-08T20:49:12.311072-07:00]>
|
||||
|
||||
>>> utc.to('local')
|
||||
<Arrow [2013-05-08T20:49:12.311072-07:00]>
|
||||
|
||||
>>> utc.to('local').to('utc')
|
||||
<Arrow [2013-05-09T03:49:12.311072+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def _validate_bounds(cls, bounds):
|
||||
...
|
||||
|
||||
def span(self, frame: int, count: Optional[int] = ..., bounds: Optional[str] = ...) -> Tuple[Arrow, Arrow]:
|
||||
""" Returns two new :class:`Arrow <arrow.arrow.Arrow>` objects, representing the timespan
|
||||
of the :class:`Arrow <arrow.arrow.Arrow>` object in a given timeframe.
|
||||
|
||||
:param frame: the timeframe. Can be any ``datetime`` property (day, hour, minute...).
|
||||
:param count: (optional) the number of frames to span.
|
||||
:param bounds: (optional) a ``str`` of either '()', '(]', '[)', or '[]' that specifies
|
||||
whether to include or exclude the start and end values in the span. '(' excludes
|
||||
the start, '[' includes the start, ')' excludes the end, and ']' includes the end.
|
||||
If the bounds are not specified, the default bound '[)' is used.
|
||||
|
||||
Supported frame values: year, quarter, month, week, day, hour, minute, second.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow()
|
||||
<Arrow [2013-05-09T03:32:36.186203+00:00]>
|
||||
|
||||
>>> arrow.utcnow().span('hour')
|
||||
(<Arrow [2013-05-09T03:00:00+00:00]>, <Arrow [2013-05-09T03:59:59.999999+00:00]>)
|
||||
|
||||
>>> arrow.utcnow().span('day')
|
||||
(<Arrow [2013-05-09T00:00:00+00:00]>, <Arrow [2013-05-09T23:59:59.999999+00:00]>)
|
||||
|
||||
>>> arrow.utcnow().span('day', count=2)
|
||||
(<Arrow [2013-05-09T00:00:00+00:00]>, <Arrow [2013-05-10T23:59:59.999999+00:00]>)
|
||||
|
||||
>>> arrow.utcnow().span('day', bounds='[]')
|
||||
(<Arrow [2013-05-09T00:00:00+00:00]>, <Arrow [2013-05-10T00:00:00+00:00]>)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def floor(self, frame: int) -> Arrow:
|
||||
""" Returns a new :class:`Arrow <arrow.arrow.Arrow>` object, representing the "floor"
|
||||
of the timespan of the :class:`Arrow <arrow.arrow.Arrow>` object in a given timeframe.
|
||||
Equivalent to the first element in the 2-tuple returned by
|
||||
:func:`span <arrow.arrow.Arrow.span>`.
|
||||
|
||||
:param frame: the timeframe. Can be any ``datetime`` property (day, hour, minute...).
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().floor('hour')
|
||||
<Arrow [2013-05-09T03:00:00+00:00]>
|
||||
"""
|
||||
...
|
||||
|
||||
def ceil(self, frame: int) -> Arrow:
|
||||
""" Returns a new :class:`Arrow <arrow.arrow.Arrow>` object, representing the "ceiling"
|
||||
of the timespan of the :class:`Arrow <arrow.arrow.Arrow>` object in a given timeframe.
|
||||
Equivalent to the second element in the 2-tuple returned by
|
||||
:func:`span <arrow.arrow.Arrow.span>`.
|
||||
|
||||
:param frame: the timeframe. Can be any ``datetime`` property (day, hour, minute...).
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().ceil('hour')
|
||||
<Arrow [2013-05-09T03:59:59.999999+00:00]>
|
||||
"""
|
||||
...
|
||||
|
||||
def format(self, fmt: Optional[str] = ..., locale: Optional[str] = ...) -> str:
|
||||
""" Returns a string representation of the :class:`Arrow <arrow.arrow.Arrow>` object,
|
||||
formatted according to a format string.
|
||||
|
||||
:param fmt: the format string.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().format('YYYY-MM-DD HH:mm:ss ZZ')
|
||||
'2013-05-09 03:56:47 -00:00'
|
||||
|
||||
>>> arrow.utcnow().format('X')
|
||||
'1368071882'
|
||||
|
||||
>>> arrow.utcnow().format('MMMM DD, YYYY')
|
||||
'May 09, 2013'
|
||||
|
||||
>>> arrow.utcnow().format()
|
||||
'2013-05-09 03:56:47 -00:00'
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def humanize(self, other: Optional[Union[Arrow, datetime]] = ..., locale: Optional[str] = ..., only_distance: Optional[bool] = ..., granularity: Optional[Union[str, Sequence[str]]] = ...) -> str:
|
||||
""" Returns a localized, humanized representation of a relative difference in time.
|
||||
|
||||
:param other: (optional) an :class:`Arrow <arrow.arrow.Arrow>` or ``datetime`` object.
|
||||
Defaults to now in the current :class:`Arrow <arrow.arrow.Arrow>` object's timezone.
|
||||
:param locale: (optional) a ``str`` specifying a locale. Defaults to 'en_us'.
|
||||
:param only_distance: (optional) returns only time difference eg: "11 seconds" without "in" or "ago" part.
|
||||
:param granularity: (optional) defines the precision of the output. Set it to strings 'second', 'minute',
|
||||
'hour', 'day', 'week', 'month' or 'year' or a list of any combination of these strings
|
||||
|
||||
Usage::
|
||||
|
||||
>>> earlier = arrow.utcnow().shift(hours=-2)
|
||||
>>> earlier.humanize()
|
||||
'2 hours ago'
|
||||
|
||||
>>> later = earlier.shift(hours=4)
|
||||
>>> later.humanize(earlier)
|
||||
'in 4 hours'
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def is_between(self, start: Arrow, end: Arrow, bounds: Optional[str] = ...) -> bool:
|
||||
""" Returns a boolean denoting whether the specified date and time is between
|
||||
the start and end dates and times.
|
||||
|
||||
:param start: an :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
:param end: an :class:`Arrow <arrow.arrow.Arrow>` object.
|
||||
:param bounds: (optional) a ``str`` of either '()', '(]', '[)', or '[]' that specifies
|
||||
whether to include or exclude the start and end values in the range. '(' excludes
|
||||
the start, '[' includes the start, ')' excludes the end, and ']' includes the end.
|
||||
If the bounds are not specified, the default bound '()' is used.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> start = arrow.get(datetime(2013, 5, 5, 12, 30, 10))
|
||||
>>> end = arrow.get(datetime(2013, 5, 5, 12, 30, 36))
|
||||
>>> arrow.get(datetime(2013, 5, 5, 12, 30, 27)).is_between(start, end)
|
||||
True
|
||||
|
||||
>>> start = arrow.get(datetime(2013, 5, 5))
|
||||
>>> end = arrow.get(datetime(2013, 5, 8))
|
||||
>>> arrow.get(datetime(2013, 5, 8)).is_between(start, end, '[]')
|
||||
True
|
||||
|
||||
>>> start = arrow.get(datetime(2013, 5, 5))
|
||||
>>> end = arrow.get(datetime(2013, 5, 8))
|
||||
>>> arrow.get(datetime(2013, 5, 8)).is_between(start, end, '[)')
|
||||
False
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def __add__(self, other: Union[timedelta, relativedelta]) -> Arrow:
|
||||
...
|
||||
|
||||
def __radd__(self, other: Union[timedelta, relativedelta]) -> Arrow:
|
||||
...
|
||||
|
||||
def __sub__(self, other: Union[timedelta, relativedelta, datetime, Arrow]) -> Arrow:
|
||||
...
|
||||
|
||||
def __rsub__(self, other: datetime) -> Arrow:
|
||||
...
|
||||
|
||||
def __eq__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def __ne__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def __gt__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def __ge__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def __lt__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def __le__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def __cmp__(self, other: Union[Arrow, datetime]) -> bool:
|
||||
...
|
||||
|
||||
def date(self) -> date:
|
||||
""" Returns a ``date`` object with the same year, month and day.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().date()
|
||||
datetime.date(2019, 1, 23)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def time(self) -> time:
|
||||
""" Returns a ``time`` object with the same hour, minute, second, microsecond.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().time()
|
||||
datetime.time(12, 15, 34, 68352)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def timetz(self) -> time:
|
||||
""" Returns a ``time`` object with the same hour, minute, second, microsecond and
|
||||
tzinfo.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().timetz()
|
||||
datetime.time(12, 5, 18, 298893, tzinfo=tzutc())
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def astimezone(self, tz: tzinfo) -> datetime:
|
||||
""" Returns a ``datetime`` object, converted to the specified timezone.
|
||||
|
||||
:param tz: a ``tzinfo`` object.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> pacific=arrow.now('US/Pacific')
|
||||
>>> nyc=arrow.now('America/New_York').tzinfo
|
||||
>>> pacific.astimezone(nyc)
|
||||
datetime.datetime(2019, 1, 20, 10, 24, 22, 328172, tzinfo=tzfile('/usr/share/zoneinfo/America/New_York'))
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def utcoffset(self) -> timedelta:
|
||||
""" Returns a ``timedelta`` object representing the whole number of minutes difference from
|
||||
UTC time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.now('US/Pacific').utcoffset()
|
||||
datetime.timedelta(-1, 57600)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def dst(self) -> timedelta:
|
||||
""" Returns the daylight savings time adjustment.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().dst()
|
||||
datetime.timedelta(0)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def timetuple(self) -> struct_time:
|
||||
""" Returns a ``time.struct_time``, in the current timezone.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().timetuple()
|
||||
time.struct_time(tm_year=2019, tm_mon=1, tm_mday=20, tm_hour=15, tm_min=17, tm_sec=8, tm_wday=6, tm_yday=20, tm_isdst=0)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def utctimetuple(self) -> struct_time:
|
||||
""" Returns a ``time.struct_time``, in UTC time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().utctimetuple()
|
||||
time.struct_time(tm_year=2019, tm_mon=1, tm_mday=19, tm_hour=21, tm_min=41, tm_sec=7, tm_wday=5, tm_yday=19, tm_isdst=0)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def toordinal(self) -> int:
|
||||
""" Returns the proleptic Gregorian ordinal of the date.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().toordinal()
|
||||
737078
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def weekday(self) -> int:
|
||||
""" Returns the day of the week as an integer (0-6).
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().weekday()
|
||||
5
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def isoweekday(self) -> int:
|
||||
""" Returns the ISO day of the week as an integer (1-7).
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().isoweekday()
|
||||
6
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def isocalendar(self) -> Tuple(int, int, int):
|
||||
""" Returns a 3-tuple, (ISO year, ISO week number, ISO weekday).
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().isocalendar()
|
||||
(2019, 3, 6)
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def isoformat(self, sep: Optional[str] = ...) -> str:
|
||||
"""Returns an ISO 8601 formatted representation of the date and time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().isoformat()
|
||||
'2019-01-19T18:30:52.442118+00:00'
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def ctime(self) -> str:
|
||||
""" Returns a ctime formatted representation of the date and time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().ctime()
|
||||
'Sat Jan 19 18:26:50 2019'
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def strftime(self, format: str) -> str:
|
||||
""" Formats in the style of ``datetime.strftime``.
|
||||
|
||||
:param format: the format string.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().strftime('%d-%m-%Y %H:%M:%S')
|
||||
'23-01-2019 12:28:17'
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def for_json(self) -> str:
|
||||
"""Serializes for the ``for_json`` protocol of simplejson.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> arrow.utcnow().for_json()
|
||||
'2019-01-19T18:25:36.760079+00:00'
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def _get_tzinfo(tz_expr: Optional[Union[str, tzinfo]]) -> tzinfo:
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def _get_datetime(cls, expr: Union[Arrow, datetime, int, float, str]) -> datetime:
|
||||
"""Get datetime object for a specified expression."""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def _get_frames(cls, name: str) -> str:
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def _get_iteration_params(cls, end: Optional[Object], limit: Optional[Object]):
|
||||
...
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
MAX_TIMESTAMP = 253402318799
|
||||
MAX_TIMESTAMP_MS = MAX_TIMESTAMP * 1000
|
||||
MAX_TIMESTAMP_US = MAX_TIMESTAMP * 1000000
|
|
@ -0,0 +1,166 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
"""
|
||||
Implements the :class:`ArrowFactory <arrow.factory.ArrowFactory>` class,
|
||||
providing factory methods for common :class:`Arrow <arrow.arrow.Arrow>`
|
||||
construction scenarios.
|
||||
|
||||
"""
|
||||
class ArrowFactory(object):
|
||||
""" A factory for generating :class:`Arrow <arrow.arrow.Arrow>` objects.
|
||||
|
||||
:param type: (optional) the :class:`Arrow <arrow.arrow.Arrow>`-based class to construct from.
|
||||
Defaults to :class:`Arrow <arrow.arrow.Arrow>`.
|
||||
|
||||
"""
|
||||
def __init__(self, type=...):
|
||||
self.type = ...
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
""" Returns an :class:`Arrow <arrow.arrow.Arrow>` object based on flexible inputs.
|
||||
|
||||
:param locale: (optional) a ``str`` specifying a locale for the parser. Defaults to
|
||||
'en_us'.
|
||||
:param tzinfo: (optional) a :ref:`timezone expression <tz-expr>` or tzinfo object.
|
||||
Replaces the timezone unless using an input form that is explicitly UTC or specifies
|
||||
the timezone in a positional argument. Defaults to UTC.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import arrow
|
||||
|
||||
**No inputs** to get current UTC time::
|
||||
|
||||
>>> arrow.get()
|
||||
<Arrow [2013-05-08T05:51:43.316458+00:00]>
|
||||
|
||||
**None** to also get current UTC time::
|
||||
|
||||
>>> arrow.get(None)
|
||||
<Arrow [2013-05-08T05:51:49.016458+00:00]>
|
||||
|
||||
**One** :class:`Arrow <arrow.arrow.Arrow>` object, to get a copy.
|
||||
|
||||
>>> arw = arrow.utcnow()
|
||||
>>> arrow.get(arw)
|
||||
<Arrow [2013-10-23T15:21:54.354846+00:00]>
|
||||
|
||||
**One** ``float`` or ``int``, convertible to a floating-point timestamp, to get
|
||||
that timestamp in UTC::
|
||||
|
||||
>>> arrow.get(1367992474.293378)
|
||||
<Arrow [2013-05-08T05:54:34.293378+00:00]>
|
||||
|
||||
>>> arrow.get(1367992474)
|
||||
<Arrow [2013-05-08T05:54:34+00:00]>
|
||||
|
||||
**One** ISO 8601-formatted ``str``, to parse it::
|
||||
|
||||
>>> arrow.get('2013-09-29T01:26:43.830580')
|
||||
<Arrow [2013-09-29T01:26:43.830580+00:00]>
|
||||
|
||||
**One** ISO 8601-formatted ``str``, in basic format, to parse it::
|
||||
|
||||
>>> arrow.get('20160413T133656.456289')
|
||||
<Arrow [2016-04-13T13:36:56.456289+00:00]>
|
||||
|
||||
**One** ``tzinfo``, to get the current time **converted** to that timezone::
|
||||
|
||||
>>> arrow.get(tz.tzlocal())
|
||||
<Arrow [2013-05-07T22:57:28.484717-07:00]>
|
||||
|
||||
**One** naive ``datetime``, to get that datetime in UTC::
|
||||
|
||||
>>> arrow.get(datetime(2013, 5, 5))
|
||||
<Arrow [2013-05-05T00:00:00+00:00]>
|
||||
|
||||
**One** aware ``datetime``, to get that datetime::
|
||||
|
||||
>>> arrow.get(datetime(2013, 5, 5, tzinfo=tz.tzlocal()))
|
||||
<Arrow [2013-05-05T00:00:00-07:00]>
|
||||
|
||||
**One** naive ``date``, to get that date in UTC::
|
||||
|
||||
>>> arrow.get(date(2013, 5, 5))
|
||||
<Arrow [2013-05-05T00:00:00+00:00]>
|
||||
|
||||
**One** time.struct time::
|
||||
|
||||
>>> arrow.get(gmtime(0))
|
||||
<Arrow [1970-01-01T00:00:00+00:00]>
|
||||
|
||||
**One** iso calendar ``tuple``, to get that week date in UTC::
|
||||
|
||||
>>> arrow.get((2013, 18, 7))
|
||||
<Arrow [2013-05-05T00:00:00+00:00]>
|
||||
|
||||
**Two** arguments, a naive or aware ``datetime``, and a replacement
|
||||
:ref:`timezone expression <tz-expr>`::
|
||||
|
||||
>>> arrow.get(datetime(2013, 5, 5), 'US/Pacific')
|
||||
<Arrow [2013-05-05T00:00:00-07:00]>
|
||||
|
||||
**Two** arguments, a naive ``date``, and a replacement
|
||||
:ref:`timezone expression <tz-expr>`::
|
||||
|
||||
>>> arrow.get(date(2013, 5, 5), 'US/Pacific')
|
||||
<Arrow [2013-05-05T00:00:00-07:00]>
|
||||
|
||||
**Two** arguments, both ``str``, to parse the first according to the format of the second::
|
||||
|
||||
>>> arrow.get('2013-05-05 12:30:45 America/Chicago', 'YYYY-MM-DD HH:mm:ss ZZZ')
|
||||
<Arrow [2013-05-05T12:30:45-05:00]>
|
||||
|
||||
**Two** arguments, first a ``str`` to parse and second a ``list`` of formats to try::
|
||||
|
||||
>>> arrow.get('2013-05-05 12:30:45', ['MM/DD/YYYY', 'YYYY-MM-DD HH:mm:ss'])
|
||||
<Arrow [2013-05-05T12:30:45+00:00]>
|
||||
|
||||
**Three or more** arguments, as for the constructor of a ``datetime``::
|
||||
|
||||
>>> arrow.get(2013, 5, 5, 12, 30, 45)
|
||||
<Arrow [2013-05-05T12:30:45+00:00]>
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def utcnow(self):
|
||||
"""Returns an :class:`Arrow <arrow.arrow.Arrow>` object, representing "now" in UTC time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import arrow
|
||||
>>> arrow.utcnow()
|
||||
<Arrow [2013-05-08T05:19:07.018993+00:00]>
|
||||
"""
|
||||
...
|
||||
|
||||
def now(self, tz: Optional[Any] = ...):
|
||||
"""Returns an :class:`Arrow <arrow.arrow.Arrow>` object, representing "now" in the given
|
||||
timezone.
|
||||
|
||||
:param tz: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to local time.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import arrow
|
||||
>>> arrow.now()
|
||||
<Arrow [2013-05-07T22:19:11.363410-07:00]>
|
||||
|
||||
>>> arrow.now('US/Pacific')
|
||||
<Arrow [2013-05-07T22:19:15.251821-07:00]>
|
||||
|
||||
>>> arrow.now('+02:00')
|
||||
<Arrow [2013-05-08T07:19:25.618646+02:00]>
|
||||
|
||||
>>> arrow.now('local')
|
||||
<Arrow [2013-05-07T22:19:39.130059-07:00]>
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
FORMAT_ATOM = "YYYY-MM-DD HH:mm:ssZZ"
|
||||
FORMAT_COOKIE = "dddd, DD-MMM-YYYY HH:mm:ss ZZZ"
|
||||
FORMAT_RFC822 = "ddd, DD MMM YY HH:mm:ss Z"
|
||||
FORMAT_RFC850 = "dddd, DD-MMM-YY HH:mm:ss ZZZ"
|
||||
FORMAT_RFC1036 = "ddd, DD MMM YY HH:mm:ss Z"
|
||||
FORMAT_RFC1123 = "ddd, DD MMM YYYY HH:mm:ss Z"
|
||||
FORMAT_RFC2822 = "ddd, DD MMM YYYY HH:mm:ss Z"
|
||||
FORMAT_RFC3339 = "YYYY-MM-DD HH:mm:ssZZ"
|
||||
FORMAT_RSS = "ddd, DD MMM YYYY HH:mm:ss Z"
|
||||
FORMAT_W3C = "YYYY-MM-DD HH:mm:ssZZ"
|
||||
class DateTimeFormatter(object):
|
||||
_FORMAT_RE = ...
|
||||
def __init__(self, locale=...):
|
||||
self.locale = ...
|
||||
|
||||
def format(cls, dt, fmt):
|
||||
...
|
||||
|
||||
def _format_token(self, dt, token):
|
||||
...
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,906 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
def get_locale(name):
|
||||
"""Returns an appropriate :class:`Locale <arrow.locales.Locale>`
|
||||
corresponding to an inpute locale name.
|
||||
|
||||
:param name: the name of the locale.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def get_locale_by_class_name(name):
|
||||
"""Returns an appropriate :class:`Locale <arrow.locales.Locale>`
|
||||
corresponding to an locale class name.
|
||||
|
||||
:param name: the name of the locale class.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
class Locale(object):
|
||||
""" Represents locale-specific data and functionality. """
|
||||
names = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
ordinal_day_re = ...
|
||||
def __init__(self):
|
||||
...
|
||||
|
||||
def describe(self, timeframe, delta=..., only_distance: bool = ...):
|
||||
""" Describes a delta within a timeframe in plain language.
|
||||
|
||||
:param timeframe: a string representing a timeframe.
|
||||
:param delta: a quantity representing a delta in a timeframe.
|
||||
:param only_distance: return only distance eg: "11 seconds" without "in" or "ago" keywords
|
||||
"""
|
||||
...
|
||||
|
||||
def describe_multi(self, timeframes, only_distance: bool = ...):
|
||||
""" Describes a delta within multiple timeframes in plain language.
|
||||
|
||||
:param timeframes: a list of string, quantity pairs each representing a timeframe and delta.
|
||||
:param only_distance: return only distance eg: "2 hours and 11 seconds" without "in" or "ago" keywords
|
||||
"""
|
||||
...
|
||||
|
||||
def day_name(self, day):
|
||||
""" Returns the day name for a specified day of the week.
|
||||
|
||||
:param day: the ``int`` day of the week (1-7).
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def day_abbreviation(self, day):
|
||||
""" Returns the day abbreviation for a specified day of the week.
|
||||
|
||||
:param day: the ``int`` day of the week (1-7).
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def month_name(self, month):
|
||||
""" Returns the month name for a specified month of the year.
|
||||
|
||||
:param month: the ``int`` month of the year (1-12).
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def month_abbreviation(self, month):
|
||||
""" Returns the month abbreviation for a specified month of the year.
|
||||
|
||||
:param month: the ``int`` month of the year (1-12).
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def month_number(self, name):
|
||||
""" Returns the month number for a month specified by name or abbreviation.
|
||||
|
||||
:param name: the month name or abbreviation.
|
||||
|
||||
"""
|
||||
...
|
||||
|
||||
def year_full(self, year):
|
||||
""" Returns the year for specific locale if available
|
||||
|
||||
:param name: the ``int`` year (4-digit)
|
||||
"""
|
||||
...
|
||||
|
||||
def year_abbreviation(self, year):
|
||||
""" Returns the year for specific locale if available
|
||||
|
||||
:param name: the ``int`` year (4-digit)
|
||||
"""
|
||||
...
|
||||
|
||||
def meridian(self, hour, token):
|
||||
""" Returns the meridian indicator for a specified hour and format token.
|
||||
|
||||
:param hour: the ``int`` hour of the day.
|
||||
:param token: the format token.
|
||||
"""
|
||||
...
|
||||
|
||||
def ordinal_number(self, n):
|
||||
""" Returns the ordinal format of a given integer
|
||||
|
||||
:param n: an integer
|
||||
"""
|
||||
...
|
||||
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
def _name_to_ordinal(self, lst):
|
||||
...
|
||||
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
def _format_relative(self, humanized, timeframe, delta):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class EnglishLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
ordinal_day_re = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
def describe(self, timeframe, delta=..., only_distance: bool = ...):
|
||||
""" Describes a delta within a timeframe in plain language.
|
||||
|
||||
:param timeframe: a string representing a timeframe.
|
||||
:param delta: a quantity representing a delta in a timeframe.
|
||||
:param only_distance: return only distance eg: "11 seconds" without "in" or "ago" keywords
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class ItalianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
ordinal_day_re = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class SpanishLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
ordinal_day_re = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class FrenchBaseLocale(Locale):
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
ordinal_day_re = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class FrenchLocale(FrenchBaseLocale, Locale):
|
||||
names = ...
|
||||
month_abbreviations = ...
|
||||
|
||||
|
||||
class FrenchCanadianLocale(FrenchBaseLocale, Locale):
|
||||
names = ...
|
||||
month_abbreviations = ...
|
||||
|
||||
|
||||
class GreekLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class JapaneseLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class SwedishLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class FinnishLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
def _format_relative(self, humanized, timeframe, delta):
|
||||
...
|
||||
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class ChineseCNLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class ChineseTWLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class HongKongLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class KoreanLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
special_dayframes = ...
|
||||
special_yearframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
def _format_relative(self, humanized, timeframe, delta):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class DutchLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class SlavicBaseLocale(Locale):
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class BelarusianLocale(SlavicBaseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class PolishLocale(SlavicBaseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class RussianLocale(SlavicBaseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class AfrikaansLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class BulgarianLocale(SlavicBaseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class UkrainianLocale(SlavicBaseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class MacedonianLocale(SlavicBaseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class GermanBaseLocale(Locale):
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
timeframes_only_distance = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
def describe(self, timeframe, delta=..., only_distance: bool = ...):
|
||||
""" Describes a delta within a timeframe in plain language.
|
||||
|
||||
:param timeframe: a string representing a timeframe.
|
||||
:param delta: a quantity representing a delta in a timeframe.
|
||||
:param only_distance: return only distance eg: "11 seconds" without "in" or "ago" keywords
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class GermanLocale(GermanBaseLocale, Locale):
|
||||
names = ...
|
||||
|
||||
|
||||
class SwissLocale(GermanBaseLocale, Locale):
|
||||
names = ...
|
||||
|
||||
|
||||
class AustrianLocale(GermanBaseLocale, Locale):
|
||||
names = ...
|
||||
month_names = ...
|
||||
|
||||
|
||||
class NorwegianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class NewNorwegianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class PortugueseLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class BrazilianPortugueseLocale(PortugueseLocale):
|
||||
names = ...
|
||||
past = ...
|
||||
|
||||
|
||||
class TagalogLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class VietnameseLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class TurkishLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class AzerbaijaniLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class ArabicLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class LevantArabicLocale(ArabicLocale):
|
||||
names = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
|
||||
|
||||
class AlgeriaTunisiaArabicLocale(ArabicLocale):
|
||||
names = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
|
||||
|
||||
class MauritaniaArabicLocale(ArabicLocale):
|
||||
names = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
|
||||
|
||||
class MoroccoArabicLocale(ArabicLocale):
|
||||
names = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
|
||||
|
||||
class IcelandicLocale(Locale):
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class DanishLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class MalayalamLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class HindiLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class CzechLocale(Locale):
|
||||
names = ...
|
||||
timeframes = ...
|
||||
past = ...
|
||||
future = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
"""Czech aware time frame format function, takes into account
|
||||
the differences between past and future forms."""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class SlovakLocale(Locale):
|
||||
names = ...
|
||||
timeframes = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
"""Slovak aware time frame format function, takes into account
|
||||
the differences between past and future forms."""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class FarsiLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class HebrewLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
"""Hebrew couple of <timeframe> aware"""
|
||||
...
|
||||
|
||||
def describe_multi(self, timeframes, only_distance: bool = ...):
|
||||
""" Describes a delta within multiple timeframes in plain language.
|
||||
In Hebrew, the and word behaves a bit differently.
|
||||
|
||||
:param timeframes: a list of string, quantity pairs each representing a timeframe and delta.
|
||||
:param only_distance: return only distance eg: "2 hours and 11 seconds" without "in" or "ago" keywords
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class MarathiLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
def _map_locales():
|
||||
...
|
||||
|
||||
class CatalanLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class BasqueLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class HungarianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
meridians = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class EsperantoLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
meridians = ...
|
||||
ordinal_day_re = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class ThaiLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
meridians = ...
|
||||
BE_OFFSET = ...
|
||||
def year_full(self, year):
|
||||
"""Thai always use Buddhist Era (BE) which is CE + 543"""
|
||||
...
|
||||
|
||||
def year_abbreviation(self, year):
|
||||
"""Thai always use Buddhist Era (BE) which is CE + 543"""
|
||||
...
|
||||
|
||||
def _format_relative(self, humanized, timeframe, delta):
|
||||
"""Thai normally doesn't have any space between words"""
|
||||
...
|
||||
|
||||
|
||||
|
||||
class BengaliLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _ordinal_number(self, n):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class RomanshLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class RomanianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class SlovenianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class IndonesianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class NepaliLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
class EstonianLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
def _format_timeframe(self, timeframe, delta):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class SwahiliLocale(Locale):
|
||||
names = ...
|
||||
past = ...
|
||||
future = ...
|
||||
and_word = ...
|
||||
timeframes = ...
|
||||
meridians = ...
|
||||
month_names = ...
|
||||
month_abbreviations = ...
|
||||
day_names = ...
|
||||
day_abbreviations = ...
|
||||
|
||||
|
||||
_locales = _map_locales()
|
|
@ -0,0 +1,66 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
class ParserError(ValueError):
|
||||
...
|
||||
|
||||
|
||||
class ParserMatchError(ParserError):
|
||||
...
|
||||
|
||||
|
||||
class DateTimeParser(object):
|
||||
_FORMAT_RE = ...
|
||||
_ESCAPE_RE = ...
|
||||
_ONE_OR_TWO_DIGIT_RE = ...
|
||||
_ONE_OR_TWO_OR_THREE_DIGIT_RE = ...
|
||||
_ONE_OR_MORE_DIGIT_RE = ...
|
||||
_TWO_DIGIT_RE = ...
|
||||
_THREE_DIGIT_RE = ...
|
||||
_FOUR_DIGIT_RE = ...
|
||||
_TZ_Z_RE = ...
|
||||
_TZ_ZZ_RE = ...
|
||||
_TZ_NAME_RE = ...
|
||||
_TIMESTAMP_RE = ...
|
||||
_TIMESTAMP_EXPANDED_RE = ...
|
||||
_TIME_RE = ...
|
||||
_WEEK_DATE_RE = ...
|
||||
_BASE_INPUT_RE_MAP = ...
|
||||
SEPARATORS = ...
|
||||
def __init__(self, locale=..., cache_size=...):
|
||||
self.locale = ...
|
||||
|
||||
def parse_iso(self, datetime_string):
|
||||
...
|
||||
|
||||
def parse(self, datetime_string, fmt):
|
||||
...
|
||||
|
||||
def _generate_pattern_re(self, fmt):
|
||||
...
|
||||
|
||||
def _parse_token(self, token, value, parts):
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def _build_datetime(parts):
|
||||
...
|
||||
|
||||
def _parse_multiformat(self, string, formats):
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def _generate_choice_re(choices, flags=...):
|
||||
...
|
||||
|
||||
|
||||
|
||||
class TzinfoParser(object):
|
||||
_TZINFO_RE = ...
|
||||
@classmethod
|
||||
def parse(cls, tzinfo_string):
|
||||
...
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
"""
|
||||
This type stub file was generated by pyright.
|
||||
"""
|
||||
|
||||
def next_weekday(start_date, weekday):
|
||||
"""Get next weekday from the specified start date.
|
||||
|
||||
:param start_date: Datetime object representing the start date.
|
||||
:param weekday: Next weekday to obtain. Can be a value between 0 (Monday) and 6 (Sunday).
|
||||
:return: Datetime object corresponding to the next weekday after start_date.
|
||||
|
||||
Usage::
|
||||
|
||||
# Get first Monday after epoch
|
||||
>>> next_weekday(datetime(1970, 1, 1), 0)
|
||||
1970-01-05 00:00:00
|
||||
|
||||
# Get first Thursday after epoch
|
||||
>>> next_weekday(datetime(1970, 1, 1), 3)
|
||||
1970-01-01 00:00:00
|
||||
|
||||
# Get first Sunday after epoch
|
||||
>>> next_weekday(datetime(1970, 1, 1), 6)
|
||||
1970-01-04 00:00:00
|
||||
"""
|
||||
...
|
||||
|
||||
def total_seconds(td):
|
||||
"""Get total seconds for timedelta."""
|
||||
...
|
||||
|
||||
def is_timestamp(value):
|
||||
"""Check if value is a valid timestamp."""
|
||||
...
|
||||
|
||||
def normalize_timestamp(timestamp):
|
||||
"""Normalize millisecond and microsecond timestamps into normal timestamps."""
|
||||
...
|
||||
|
||||
def iso_to_gregorian(iso_year, iso_week, iso_day):
|
||||
"""Converts an ISO week date tuple into a datetime object."""
|
||||
...
|
||||
|
||||
__all__ = ["next_weekday", "total_seconds", "is_timestamp", "isstr", "iso_to_gregorian"]
|
Загрузка…
Ссылка в новой задаче