Content-Length: 423445 | pFad | https://github.com/python/cpython/pull/113969

ad gh-113971: Make `zipfile.ZipInfo._compresslevel` public as `.compress_level` by gpshead · Pull Request #113969 · python/cpython · GitHub
Skip to content

gh-113971: Make zipfile.ZipInfo._compresslevel public as .compress_level - #113969

Merged
gpshead merged 7 commits into
python:mainfrom
gpshead:zipfile/ZipInfo.compress_level
Jan 12, 2024
Merged

gh-113971: Make zipfile.ZipInfo._compresslevel public as .compress_level#113969
gpshead merged 7 commits into
python:mainfrom
gpshead:zipfile/ZipInfo.compress_level

Conversation

@gpshead

@gpshead gpshead commented Jan 12, 2024

Copy link
Copy Markdown
Member

Make zipfile.ZipInfo.compress_level public.

A property is used to retain the behavior of the ._compresslevel.

People constructing zipfile.ZipInfo instances to pass into existing APIs to control per-file compression levels already treat this as public, there was never a reason for it not to be.

I used the more modern name compress_level instead of compresslevel as the keyword argument on other ZipFile APIs is called to be consistent with compress_type and a general long term preference of not runningwordstogether without a separator in names. The zipfile module APIs already have a variety of style inconsistencies, I don't think this makes anything worse. Someone typing the wrong one in either place will get an immediate exception.


📚 Documentation preview 📚: https://cpython-previews--113969.org.readthedocs.build/

Fixes #113971
Closes #113971

A property is used to retain the behavior of the `._compresslevel`.

People constructing ZipInfo instances to pass in to control per-file
compression levels already treat this as public, there was never a
reason for it not to be.
@gpshead gpshead added the type-feature A feature request or enhancement label Jan 12, 2024
@gpshead gpshead self-assigned this Jan 12, 2024
@gpshead gpshead changed the title gh-TODO: Make zipfile.ZipInfo._compresslevel public as .compress_level gh-113971: Make zipfile.ZipInfo._compresslevel public as .compress_level Jan 12, 2024
@gpshead
gpshead marked this pull request as ready for review January 12, 2024 01:14

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does it need a What's New entry?

Comment thread Lib/test/test_zipfile/test_core.py Outdated
@gpshead

gpshead commented Jan 12, 2024

Copy link
Copy Markdown
Member Author

Does it need a What's New entry?

I don't think so for this one, the old way to set this attribute will continue to work forever and ZipInfo isn't even properly fully documented so a what's new entry seems like too much attention.

@gpshead
gpshead enabled auto-merge (squash) January 12, 2024 20:05

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@gpshead
gpshead merged commit b44b9d9 into python:main Jan 12, 2024
@gpshead
gpshead deleted the zipfile/ZipInfo.compress_level branch January 13, 2024 01:53
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
…mpress_level` (python#113969)

Make zipfile.ZipInfo.compress_level public.

A property is used to retain the behavior of the ._compresslevel.

People constructing zipfile.ZipInfo instances to pass into existing APIs to control per-file compression levels already treat this as public, there was never a reason for it not to be.

I used the more modern name compress_level instead of compresslevel as the keyword argument on other ZipFile APIs is called to be consistent with compress_type and a general long term preference of not runningwordstogether without a separator in names.
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…mpress_level` (python#113969)

Make zipfile.ZipInfo.compress_level public.

A property is used to retain the behavior of the ._compresslevel.

People constructing zipfile.ZipInfo instances to pass into existing APIs to control per-file compression levels already treat this as public, there was never a reason for it not to be.

I used the more modern name compress_level instead of compresslevel as the keyword argument on other ZipFile APIs is called to be consistent with compress_type and a general long term preference of not runningwordstogether without a separator in names.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…mpress_level` (python#113969)

Make zipfile.ZipInfo.compress_level public.

A property is used to retain the behavior of the ._compresslevel.

People constructing zipfile.ZipInfo instances to pass into existing APIs to control per-file compression levels already treat this as public, there was never a reason for it not to be.

I used the more modern name compress_level instead of compresslevel as the keyword argument on other ZipFile APIs is called to be consistent with compress_type and a general long term preference of not runningwordstogether without a separator in names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

zipfile.ZipInfo._compresslevel should be public.

3 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/113969

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy