Skip to content

Commit

Permalink
document default encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Dec 21, 2024
1 parent 73294c9 commit 8bc0763
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/monty/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ def zopen(
This function wraps around `[bz2/gzip/lzma].open` and `open`
to deal intelligently with compressed or uncompressed files.
Supports context manager:
`with zopen(filename, mode="rt", ...)`.
`with zopen(filename, mode="rt", ...)`
Important Notes:
- Default `mode` should not be used, and would not be allow
in future versions.
- Always explicitly specify binary/text in `mode`, i.e.
always pass `t` or `b` in `mode`, implicit binary/text
mode would not be allow in future versions.
- Always provide an explicit `encoding` in text mode.
- Always provide an explicit `encoding` in text mode, it would
be set to UTF-8 by default otherwise.
Args:
filename (str | Path): The file to open.
mode (str): The mode in which the file is opened, you MUST
mode (str): The mode in which the file is opened, you should
explicitly specify "b" for binary or "t" for text.
**kwargs: Additional keyword arguments to pass to `open`.
Expand Down

0 comments on commit 8bc0763

Please sign in to comment.