Skip to content
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

bpo-43848: explain optional argument mtime in gzip.py. #25410

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jwuttke
Copy link

@jwuttke jwuttke commented Apr 14, 2021

@the-knights-who-say-ni
Copy link

the-knights-who-say-ni commented Apr 14, 2021

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@jwuttke

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@jwuttke jwuttke changed the title gzip.py: Explain mtime; recommend mtime = 0 to generate deterministic stream bpo-43848: explain optional argument mtime in gzip.py. Apr 14, 2021
@github-actions
Copy link

github-actions bot commented Jun 3, 2021

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jun 3, 2021
@JelleZijlstra
Copy link
Member

JelleZijlstra commented May 3, 2022

Explaining the format is good. Could you also add it to the docs at https://docs.python.org/3.11/library/gzip.html#gzip.GzipFile.mtime, which is what most people will see? (Doc/library/gzip.rst in the source.)

@jwuttke
Copy link
Author

jwuttke commented May 4, 2022

Explaining the format is good. Could you also add it to the docs at https://docs.python.org/3.11/library/gzip.html#gzip.GzipFile.mtime, which is what most people will see? (Doc/library/gzip.rst in the source.)

Good suggestion. Thanks. Is done now. I edited the descriptions of both the argument and the attribute mtime. In the latter, I removed a paragraph that was more confusing than helpful.

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Thanks! A few small suggestions.

should only be provided in compression mode. If omitted or ``None``, the
current time is used. See the :attr:`mtime` attribute for more details.
The optional *mtime* argument is the timestamp requested by gzip. The time
is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970.
Copy link
Member

@JelleZijlstra JelleZijlstra May 4, 2022

Choose a reason for hiding this comment

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

Suggested change
is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970.
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970.

Avoid abbreviations, and UTC is both more recognizable and more precise.

current time is used. See the :attr:`mtime` attribute for more details.
The optional *mtime* argument is the timestamp requested by gzip. The time
is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970.
If mtime is omitted or None, the current time is used. Use mtime = 0
Copy link
Member

@JelleZijlstra JelleZijlstra May 4, 2022

Choose a reason for hiding this comment

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

Suggested change
If mtime is omitted or None, the current time is used. Use mtime = 0
If *mtime* is omitted or None, the current time is used. Use *mtime* = 0

When decompressing, this attribute is set to last timestamp in the most
recently read header. It is an integer, holding the number of seconds
since the Unix epoch (00:00:00 GMT, Jan. 1, 1970).
Copy link
Member

@JelleZijlstra JelleZijlstra May 4, 2022

Choose a reason for hiding this comment

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

Suggested change
When decompressing, this attribute is set to last timestamp in the most
recently read header. It is an integer, holding the number of seconds
since the Unix epoch (00:00:00 GMT, Jan. 1, 1970).
When decompressing, this attribute is set to the last timestamp in the most
recently read header. It is an integer, holding the number of seconds
since the Unix epoch (00:00:00 UTC, January 1, 1970).

to the last modification time field in the stream when compressing.
If omitted or None, the current time is used.
The optional mtime argument is the timestamp requested by gzip. The time
is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970.
Copy link
Member

@JelleZijlstra JelleZijlstra May 4, 2022

Choose a reason for hiding this comment

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

Suggested change
is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970.
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970.

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants