Skip to content

Commit 4b1c3bd

Browse files
committed
Update 3rd lib
1 parent badbf12 commit 4b1c3bd

File tree

22 files changed

+4191
-1125
lines changed

22 files changed

+4191
-1125
lines changed

Update3rdLib.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pip install -U --target=. Alfred-Workflow
2-
pip install -U --target=. arrow==0.17
1+
pip install -U --target=. ualfred
2+
pip install -U --target=. arrow

arrow/__init__.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from ._version import __version__
32
from .api import get, now, utcnow
43
from .arrow import Arrow
@@ -16,3 +15,25 @@
1615
FORMAT_W3C,
1716
)
1817
from .parser import ParserError
18+
19+
# https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport
20+
# Mypy with --strict or --no-implicit-reexport requires an explicit reexport.
21+
__all__ = [
22+
"__version__",
23+
"get",
24+
"now",
25+
"utcnow",
26+
"Arrow",
27+
"ArrowFactory",
28+
"FORMAT_ATOM",
29+
"FORMAT_COOKIE",
30+
"FORMAT_RFC822",
31+
"FORMAT_RFC850",
32+
"FORMAT_RFC1036",
33+
"FORMAT_RFC1123",
34+
"FORMAT_RFC2822",
35+
"FORMAT_RFC3339",
36+
"FORMAT_RSS",
37+
"FORMAT_W3C",
38+
"ParserError",
39+
]

arrow/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.17.0"
1+
__version__ = "1.2.3"

arrow/api.py

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,91 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Provides the default implementation of :class:`ArrowFactory <arrow.factory.ArrowFactory>`
43
methods for use as a module API.
54
65
"""
76

8-
from __future__ import absolute_import
7+
from datetime import date, datetime
8+
from datetime import tzinfo as dt_tzinfo
9+
from time import struct_time
10+
from typing import Any, List, Optional, Tuple, Type, Union, overload
911

12+
from arrow.arrow import TZ_EXPR, Arrow
13+
from arrow.constants import DEFAULT_LOCALE
1014
from arrow.factory import ArrowFactory
1115

1216
# internal default factory.
1317
_factory = ArrowFactory()
1418

15-
16-
def get(*args, **kwargs):
19+
# TODO: Use Positional Only Argument (https://www.python.org/dev/peps/pep-0570/)
20+
# after Python 3.7 deprecation
21+
22+
23+
@overload
24+
def get(
25+
*,
26+
locale: str = DEFAULT_LOCALE,
27+
tzinfo: Optional[TZ_EXPR] = None,
28+
normalize_whitespace: bool = False,
29+
) -> Arrow:
30+
... # pragma: no cover
31+
32+
33+
@overload
34+
def get(
35+
*args: int,
36+
locale: str = DEFAULT_LOCALE,
37+
tzinfo: Optional[TZ_EXPR] = None,
38+
normalize_whitespace: bool = False,
39+
) -> Arrow:
40+
... # pragma: no cover
41+
42+
43+
@overload
44+
def get(
45+
__obj: Union[
46+
Arrow,
47+
datetime,
48+
date,
49+
struct_time,
50+
dt_tzinfo,
51+
int,
52+
float,
53+
str,
54+
Tuple[int, int, int],
55+
],
56+
*,
57+
locale: str = DEFAULT_LOCALE,
58+
tzinfo: Optional[TZ_EXPR] = None,
59+
normalize_whitespace: bool = False,
60+
) -> Arrow:
61+
... # pragma: no cover
62+
63+
64+
@overload
65+
def get(
66+
__arg1: Union[datetime, date],
67+
__arg2: TZ_EXPR,
68+
*,
69+
locale: str = DEFAULT_LOCALE,
70+
tzinfo: Optional[TZ_EXPR] = None,
71+
normalize_whitespace: bool = False,
72+
) -> Arrow:
73+
... # pragma: no cover
74+
75+
76+
@overload
77+
def get(
78+
__arg1: str,
79+
__arg2: Union[str, List[str]],
80+
*,
81+
locale: str = DEFAULT_LOCALE,
82+
tzinfo: Optional[TZ_EXPR] = None,
83+
normalize_whitespace: bool = False,
84+
) -> Arrow:
85+
... # pragma: no cover
86+
87+
88+
def get(*args: Any, **kwargs: Any) -> Arrow:
1789
"""Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``get`` method."""
1890

1991
return _factory.get(*args, **kwargs)
@@ -22,7 +94,7 @@ def get(*args, **kwargs):
2294
get.__doc__ = _factory.get.__doc__
2395

2496

25-
def utcnow():
97+
def utcnow() -> Arrow:
2698
"""Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``utcnow`` method."""
2799

28100
return _factory.utcnow()
@@ -31,7 +103,7 @@ def utcnow():
31103
utcnow.__doc__ = _factory.utcnow.__doc__
32104

33105

34-
def now(tz=None):
106+
def now(tz: Optional[TZ_EXPR] = None) -> Arrow:
35107
"""Calls the default :class:`ArrowFactory <arrow.factory.ArrowFactory>` ``now`` method."""
36108

37109
return _factory.now(tz)
@@ -40,7 +112,7 @@ def now(tz=None):
40112
now.__doc__ = _factory.now.__doc__
41113

42114

43-
def factory(type):
115+
def factory(type: Type[Arrow]) -> ArrowFactory:
44116
"""Returns an :class:`.ArrowFactory` for the specified :class:`Arrow <arrow.arrow.Arrow>`
45117
or derived type.
46118

0 commit comments

Comments
 (0)