Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the typing annotation for the return of parse() #452

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Changes from all commits
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
7 changes: 6 additions & 1 deletion pendulum/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

import pendulum

from .date import Date
from .parsing import _Interval
from .parsing import parse as base_parse
from .time import Duration
from .time import Time
from .tz import UTC


Expand All @@ -16,7 +19,9 @@
CDuration = None


def parse(text, **options): # type: (str, **typing.Any) -> str
def parse(
text, **options
): # type: (str, **typing.Any) -> typing.Union[Date, Time, Duration]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DateTime also possible, right?

# Use the mock now value if it exists
options["now"] = options.get("now", pendulum.get_test_now())

Expand Down