Skip to content

TYP: check_untyped_defs arrays.sparse.array #32099

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 3 commits into from
Feb 20, 2020

Conversation

simonjayhawkins
Copy link
Member

pandas\core\arrays\sparse\array.py:807: error: Need type annotation for 'result' (hint: "result: List[] = ...")

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Feb 19, 2020
if is_scalar(indices):
raise ValueError(f"'indices' must be an array, not a scalar '{indices}'.")
indices = np.asarray(indices, dtype=np.int32)

result: Union[List[Any], np.ndarray]
Copy link
Member

Choose a reason for hiding this comment

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

this is just the empty list we get on 808 right? would it make sense to define result = np.array([], dtype=something) there?

Copy link
Member Author

@simonjayhawkins simonjayhawkins Feb 20, 2020

Choose a reason for hiding this comment

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

this is just the empty list we get on 808 right?

yes. AFAIK we can't type 'builtins.list[<nothing>]' so List[Any] used instead.

would it make sense to define result = np.array([], dtype=something) there?

done.

@WillAyd
Copy link
Member

WillAyd commented Feb 20, 2020

lgtm outside of @jbrockmendel question

@WillAyd WillAyd added this to the 1.1 milestone Feb 20, 2020
@WillAyd WillAyd merged commit 2c1c36f into pandas-dev:master Feb 20, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 20, 2020

Thanks @simonjayhawkins

@simonjayhawkins simonjayhawkins deleted the arrays.sparse.array branch February 21, 2020 08:16
roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
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.

3 participants