Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions stubs/python-dateutil/dateutil/parser/_parser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from _typeshed import SupportsRead
from collections.abc import Callable, Mapping
from datetime import _TzInfo, datetime
from io import StringIO
from typing import IO, Any
from typing import IO, Any, Literal, overload
from typing_extensions import Self, TypeAlias

_FileOrStr: TypeAlias = bytes | str | IO[str] | IO[Any]
Expand Down Expand Up @@ -77,6 +77,7 @@ class _ymd(list[int]):
class parser:
info: parserinfo
def __init__(self, info: parserinfo | None = None) -> None: ...
@overload
def parse(
self,
timestr: _FileOrStr,
Expand All @@ -87,11 +88,25 @@ class parser:
dayfirst: bool | None = ...,
yearfirst: bool | None = ...,
fuzzy: bool = ...,
fuzzy_with_tokens: bool = ...,
fuzzy_with_tokens: Literal[False] = ...,
Comment thread
ellieayla marked this conversation as resolved.
Outdated
) -> datetime: ...
@overload
def parse(
self,
timestr: _FileOrStr,
default: datetime | None = None,
ignoretz: bool = False,
tzinfos: _TzInfos | None = None,
*,
dayfirst: bool | None = ...,
yearfirst: bool | None = ...,
fuzzy: bool = ...,
fuzzy_with_tokens: Literal[True] = ...,
Comment thread
ellieayla marked this conversation as resolved.
Outdated
) -> tuple[datetime, tuple[str]]: ...
Comment thread
ellieayla marked this conversation as resolved.
Outdated

DEFAULTPARSER: parser

@overload
def parse(
timestr: _FileOrStr,
parserinfo: parserinfo | None = None,
Expand All @@ -100,10 +115,23 @@ def parse(
yearfirst: bool | None = ...,
ignoretz: bool = ...,
fuzzy: bool = ...,
fuzzy_with_tokens: bool = ...,
fuzzy_with_tokens: Literal[False] = ...,
Comment thread
ellieayla marked this conversation as resolved.
Outdated
default: datetime | None = ...,
tzinfos: _TzInfos | None = ...,
) -> datetime: ...
@overload
def parse(
timestr: _FileOrStr,
parserinfo: parserinfo | None = None,
*,
dayfirst: bool | None = ...,
yearfirst: bool | None = ...,
ignoretz: bool = ...,
fuzzy: bool = ...,
fuzzy_with_tokens: Literal[True] = ...,
Comment thread
ellieayla marked this conversation as resolved.
Outdated
default: datetime | None = ...,
tzinfos: _TzInfos | None = ...,
) -> tuple[datetime, tuple[str]]: ...
Comment thread
ellieayla marked this conversation as resolved.
Outdated

class _tzparser:
class _result(_resultbase):
Expand Down