Skip to content

CLN: add typing to dtype arg in selection of files in core/arrays (GH38808) #38826

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 4 commits into from
Dec 31, 2020

Conversation

avinashpancham
Copy link
Contributor

@avinashpancham avinashpancham commented Dec 30, 2020

Follow on PR for #38808

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@avinashpancham avinashpancham changed the title CLN: add typing to dtype arg in selection of files in core/arrays CLN: add typing to dtype arg in selection of files in core/arrays (GH38808) Dec 30, 2020
@jreback jreback added the Typing type annotations, mypy/pyright type checking label Dec 30, 2020
@@ -273,7 +273,7 @@ def dtype(self) -> BooleanDtype:

@classmethod
def _from_sequence(
cls, scalars, *, dtype=None, copy: bool = False
cls, scalars, *, dtype: Optional[DtypeArg] = None, copy: bool = False
Copy link
Contributor

Choose a reason for hiding this comment

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

most of these are Optional[Dtype} NOT DtypeArg (eg. only a single dtype and not a dict of them). The only things that take DtypeArg are things like astype and the I/O methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it. I did it right last time, but I think I was a bit too quick with submitting this PR. Thanks for the review.

@avinashpancham
Copy link
Contributor Author

Some checks are failing, will look at it tomorrow.

@@ -1294,7 +1297,7 @@ def _validate_fill_value(self, fill_value):

# -------------------------------------------------------------

def __array__(self, dtype=None) -> np.ndarray:
def __array__(self, dtype: Optional[Dtype] = None) -> np.ndarray:
Copy link
Contributor

Choose a reason for hiding this comment

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

these should be NpDtype (this is a numpy protocol)

@@ -265,7 +265,7 @@ def _formatter(self, boxed=False):
# ----------------------------------------------------------------
# Array-Like / EA-Interface Methods

def __array__(self, dtype=None) -> np.ndarray:
def __array__(self, dtype: Optional[Dtype] = None) -> np.ndarray:
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@jreback jreback added this to the 1.3 milestone Dec 30, 2020
@jreback
Copy link
Contributor

jreback commented Dec 30, 2020

lgtm ping on green

@jreback jreback merged commit 72ad717 into pandas-dev:master Dec 31, 2020
@jreback
Copy link
Contributor

jreback commented Dec 31, 2020

thanks @avinashpancham

luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants