Skip to content

Conversation

@twoertwein
Copy link
Member

No description provided.

@twoertwein twoertwein added the Typing type annotations, mypy/pyright type checking label Dec 7, 2021
def to_clipboard(obj, excel=True, sep=None, **kwargs): # pragma: no cover
def to_clipboard(
obj, excel: bool | None = True, sep: str | None = None, **kwargs
) -> None: # pragma: no cover
Copy link
Member Author

Choose a reason for hiding this comment

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

is # pragma: no cover for codecov? Does it need to be on the def to_clipboard-line?



def validate_header_arg(header) -> None:
def validate_header_arg(header: object) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

should be Any?

Copy link
Member Author

Choose a reason for hiding this comment

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

Typeshed recommends to use Any when it is too difficult to create a type annotations. object should be used if literally any object can be accepted.

https://github.com/python/typeshed/blob/master/CONTRIBUTING.md#conventions

Note that Any is not the correct type to use if you want to indicate that some function can accept literally anything: in those cases use object instead.

start, step = skiprows.start or 0, skiprows.step or 1
return list(range(start, skiprows.stop, step))
elif isinstance(skiprows, numbers.Integral) or is_list_like(skiprows):
assert skiprows is not None
Copy link
Member

Choose a reason for hiding this comment

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

can you make this a cast? that way mypy will alert us once it is unnecessary

@jreback jreback added this to the 1.4 milestone Dec 28, 2021
@jreback jreback merged commit 4b77cbe into pandas-dev:master Dec 28, 2021
@twoertwein twoertwein deleted the typi_io branch March 9, 2022 02:56
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