Content-Length: 310422 | pFad | https://github.com/python/cpython/issues/123424

BA Extract ZipInfo for archive functionality · Issue #123424 · python/cpython · GitHub
Skip to content

Extract ZipInfo for archive functionality #123424

@jaraco

Description

@jaraco

In #123354, I found the need to copy code from zipfile into the test:

def for_name(cls, name, archive):
"""
Construct the same way that ZipFile.writestr does.
TODO: extract this functionality and re-use
"""
self = cls(filename=name, date_time=time.localtime(time.time())[:6])
self.compress_type = archive.compression
self.compress_level = archive.compresslevel
if self.filename.endswith('/'): # pragma: no cover
self.external_attr = 0o40775 << 16 # drwxrwxr-x
self.external_attr |= 0x10 # MS-DOS directory flag
else:
self.external_attr = 0o600 << 16 # ?rw-------
return self

Let's instead extract that functionality in the zipfile module for re-use in the test (before it starts diverging).

Linked PRs

Metadata

Metadata

Assignees

Labels

easystdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    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/issues/123424

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy