Skip to content

Commit a0e0e46

Browse files
committed
[dateparser] Update to ~=1.4.1
Finish `dateparser.parser` Closes: #15917
1 parent c0826a2 commit a0e0e46

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

stubs/dateparser/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "~=1.4.0"
1+
version = "~=1.4.1"
22
upstream-repository = "https://github.com/scrapinghub/dateparser"
33

44
[tool.stubtest]

stubs/dateparser/dateparser/parser.pyi

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import datetime
22
import re
3-
from _typeshed import Incomplete
43
from collections import OrderedDict
54
from collections.abc import Callable, Iterable, Iterator
65
from io import StringIO
7-
from typing import Final, Literal, overload
6+
from typing import ClassVar, Final, Literal, TypeAlias, overload
87

98
from dateparser.conf import Settings
109

10+
_TokenType: TypeAlias = Literal[0, 1, 2]
11+
_Component: TypeAlias = Literal["year", "month", "day"]
12+
1113
NSP_COMPATIBLE: Final[re.Pattern[str]]
1214
MERIDIAN: Final[re.Pattern[str]]
1315
MICROSECOND: Final[re.Pattern[str]]
@@ -17,12 +19,12 @@ HOUR_MINUTE_REGEX: Final[re.Pattern[str]]
1719
def no_space_parser_eligibile(datestring: str) -> bool: ...
1820
def get_unresolved_attrs(
1921
parser_object: object,
20-
) -> tuple[list[Literal["year", "month", "day"]], list[Literal["year", "month", "day"]]]: ...
22+
) -> tuple[list[_Component], list[_Component]]: ...
2123

22-
date_order_chart: Final[dict[str, str]]
24+
date_order_chart: Final[dict[_Component, str]]
2325

2426
@overload
25-
def resolve_date_order(order: str, lst: Literal[True]) -> list[str]: ...
27+
def resolve_date_order(order: str, lst: Literal[True]) -> list[_Component]: ...
2628
@overload
2729
def resolve_date_order(order: str, lst: Literal[False] | None = None) -> str: ...
2830

@@ -40,19 +42,21 @@ class _no_spaces_parser:
4042
def parse(cls, datestring: str, settings: Settings) -> tuple[datetime.datetime, str]: ...
4143

4244
class _parser:
43-
alpha_directives: OrderedDict[str, list[str]]
44-
num_directives: dict[str, list[str]]
45+
alpha_directives: ClassVar[dict[str, list[str]]]
46+
num_directives: ClassVar[dict[str, list[str]]]
47+
4548
settings: Settings
46-
tokens: list[tuple[Incomplete, Incomplete]]
47-
filtered_tokens: list[tuple[Incomplete, Incomplete, int]]
48-
unset_tokens: list[tuple[Incomplete, Incomplete, Incomplete]]
49+
tokens: list[tuple[str, _TokenType]]
50+
filtered_tokens: list[tuple[str, _TokenType, int]]
51+
unset_tokens: list[tuple[str, _TokenType, _Component]]
4952
day: int | None
5053
month: int | None
5154
year: int | None
5255
time: Callable[[], datetime.time] | None
5356
auto_order: list[str]
5457
ordered_num_directives: OrderedDict[str, list[str]]
55-
def __init__(self, tokens: Iterable[Incomplete], settings: Settings) -> None: ...
58+
59+
def __init__(self, tokens: Iterable[tuple[str, _TokenType]], settings: Settings) -> None: ...
5660
@classmethod
5761
def parse(
5862
cls, datestring: str, settings: Settings, tz: datetime.tzinfo | None = None
@@ -63,4 +67,4 @@ class tokenizer:
6367
letters: Literal["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
6468
instream: StringIO
6569
def __init__(self, ds: str) -> None: ...
66-
def tokenize(self) -> Iterator[tuple[str, Literal[0, 1, 2]]]: ...
70+
def tokenize(self) -> Iterator[tuple[str, _TokenType]]: ...

0 commit comments

Comments
 (0)