Skip to content

Conversation

@simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Jul 19, 2020

eg. compresslevel for GzipFile is an int and compression in get_handle is Optional[Union[str, Mapping[str, Any]]] = None

once we adopt TypedDict, then maybe we could be more explicit here, but for now Any is appropriate.

the ignored message for GZipFile is error: Argument 2 to "GzipFile" has incompatible type **Dict[str, str]"; expected "int"

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Jul 19, 2020
@simonjayhawkins simonjayhawkins mentioned this pull request Jul 21, 2020
5 tasks
@WillAyd WillAyd added this to the 1.2 milestone Jul 21, 2020
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm; these are just kwargs that get passed to zip file .write correct?

@simonjayhawkins
Copy link
Member Author

lgtm; these are just kwargs that get passed to zip file .write correct?

you mean .open?

@simonjayhawkins
Copy link
Member Author

from https://docs.python.org/3/library/gzip.html?highlight=gzipfile#module-gzip

Changed in version 3.3: Added support for filename being a file object, support for text mode, and the encoding, errors and newline arguments.

so maybe (in a followon) remove the if is_path for compression == "gzip"

@simonjayhawkins simonjayhawkins merged commit a95e680 into pandas-dev:master Jul 29, 2020
@simonjayhawkins simonjayhawkins deleted the compression-args branch July 29, 2020 10:42
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