bpo-34097: Polish API design (GH-8725) · python/cpython@77b112c
@@ -131,7 +131,7 @@ ZipFile Objects
131131132132133133.. class:: ZipFile(file, mode='r', compression=ZIP_STORED, allowZip64=True, \
134- compresslevel=None)
134+ compresslevel=None, *, strict_timestamps=True)
135135136136 Open a ZIP file, where *file* can be a path to a file (a string), a
137137 file-like object or a :term:`path-like object`.
@@ -169,6 +169,12 @@ ZipFile Objects
169169 When using :const:`ZIP_BZIP2` integers ``1`` through ``9`` are accepted
170170 (see :class:`bz2 <bz2.BZ2File>` for more information).
171171172+ The *strict_timestamps* argument, when set to ``False``, allows to
173+ zip files older than 1980-01-01 at the cost of setting the
174+ timestamp to 1980-01-01.
175+ Similar behavior occurs with files newer than 2107-12-31,
176+ the timestamp is also set to the limit.
177+172178 If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then
173179:meth:`closed <close>` without adding any files to the archive, the appropriate
174180 ZIP structures for an empty archive will be written to the file.
@@ -203,6 +209,9 @@ ZipFile Objects
203209 .. versionchanged:: 3.7
204210 Add the *compresslevel* parameter.
205211212+ .. versionadded:: 3.8
213+ The *strict_timestamps* keyword-only argument
214+206215207216.. method:: ZipFile.close()
208217@@ -368,7 +377,7 @@ ZipFile Objects
368377369378370379.. method:: ZipFile.write(filename, arcname=None, compress_type=None, \
371- compresslevel=None, *, strict_timestamps=True)
380+ compresslevel=None)
372381373382 Write the file named *filename* to the archive, giving it the archive name
374383 *arcname* (by default, this will be the same as *filename*, but without a drive
@@ -377,11 +386,6 @@ ZipFile Objects
377386 the new entry. Similarly, *compresslevel* will override the constructor if
378387 given.
379388 The archive must be open with mode ``'w'``, ``'x'`` or ``'a'``.
380- The *strict_timestamps* argument, when set to ``False``, allows to
381- zip files older than 1980-01-01 at the cost of setting the
382- timestamp to 1980-01-01.
383- Similar behavior occurs with files newer than 2107-12-31,
384- the timestamp is also set to the limit.
385389386390 .. note::
387391@@ -405,9 +409,6 @@ ZipFile Objects
405409 a closed ZipFile will raise a :exc:`ValueError`. Previously,
406410 a :exc:`RuntimeError` was raised.
407411408- .. versionadded:: 3.8
409- The *strict_timestamps* keyword-only argument
410-411412412413.. method:: ZipFile.writestr(zinfo_or_arcname, data, compress_type=None, \
413414 compresslevel=None)