Skip to content

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

Merged
sdispater merged 1 commit intopython-pendulum:masterfrom
rodsenra:fix_parse_return_typing
Jul 13, 2020
Merged

Fix the typing annotation for the return of parse()#452
sdispater merged 1 commit intopython-pendulum:masterfrom
rodsenra:fix_parse_return_typing

Conversation

@rodsenra
Copy link
Copy Markdown
Contributor

Basically a bug fix PR based on discussion for Issue #450
This PR incorporates a suggestion from @shot in
https://github.com/sdispater/pendulum/pull/320/files#diff-d79c6f58aeecd540ddd61603df9184aaR17

@rodsenra rodsenra force-pushed the fix_parse_return_typing branch 4 times, most recently from 7ce2941 to 7368f1e Compare March 20, 2020 21:04
@rodsenra rodsenra force-pushed the fix_parse_return_typing branch from 7368f1e to 13654e1 Compare March 20, 2020 21:22
@bryanforbes
Copy link
Copy Markdown
Contributor

@sdispater this looks good

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

Choose a reason for hiding this comment

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

DateTime also possible, right?

@traviscook21
Copy link
Copy Markdown

I have code like this all of over some repos I'm working on

dt: pendulum.DateTime = pendulum.parse("2019-12-31")  # type: ignore

I wish it could be as simple as

dt = pendulum.parse("2019-12-31")

Anything I can do to help get this merged / released?

@sdispater sdispater merged commit 1b1784f into python-pendulum:master Jul 13, 2020
@sdispater
Copy link
Copy Markdown
Collaborator

Thanks for your contribution!

@sdispater sdispater mentioned this pull request Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants