Skip to content

CLN: annotation in reshape.merge #29490

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

Merged
merged 9 commits into from
Nov 12, 2019
8 changes: 4 additions & 4 deletions pandas/core/reshape/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import datetime
from functools import partial
import string
from typing import TYPE_CHECKING, Optional, Tuple
from typing import TYPE_CHECKING, Optional, Tuple, Union
import warnings

import numpy as np
Expand Down Expand Up @@ -49,7 +49,7 @@
from pandas.core.sorting import is_int64_overflow_possible

if TYPE_CHECKING:
from pandas import DataFrame
from pandas import DataFrame, Series


@Substitution("\nleft : DataFrame")
Expand Down Expand Up @@ -552,8 +552,8 @@ class _MergeOperation:

def __init__(
self,
left: FrameOrSeries,
right: FrameOrSeries,
left: "Union[Series, DataFrame]",
right: "Union[Series, DataFrame]",
Copy link
Member

Choose a reason for hiding this comment

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

needs quotes?

Copy link
Member

Choose a reason for hiding this comment

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

"Union[Series, DataFrame]" -> Union["Series", "DataFrame"]

I think is clearer. not sure if we have a preferred style here. @WillAyd ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree that having the quotes inside the union would be nicer, but doing so gave flake8 complaints about Series being unused.

Copy link
Member

Choose a reason for hiding this comment

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

adding # noqa: F401 to the imports inside the TYPE_CHECKING block I think is acceptable and not uncommon in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

how: str = "inner",
on=None,
left_on=None,
Expand Down