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

Conversation

rodsenra
Copy link
Contributor

@rodsenra rodsenra commented Mar 20, 2020

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 Mar 20, 2020
@rodsenra rodsenra force-pushed the fix_parse_return_typing branch from 7368f1e to 13654e1 Compare Mar 20, 2020
@bryanforbes
Copy link
Contributor

bryanforbes commented Apr 7, 2020

@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]

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

traviscook21 commented Jun 5, 2020

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 sdispater:master Jul 13, 2020
20 checks passed
@sdispater
Copy link
Owner

sdispater commented Jul 13, 2020

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.

None yet

4 participants