Files
typeshed/stdlib
Jukka Lehtosalo 2b20b70cf2 Revert "Use Literal for compression in zipfile (#9346)" (#9367)
This reverts commit 034cfab4d6.

The commit exposed the value of the compression constants, which seem
to be implementation details, in the public API. I don't see anything
in the documentation about the values of the constants such as
`ZIP_STORED`:
https://docs.python.org/3/library/zipfile.html?highlight=zipfile#zipfile.ZipFile

Example where this makes a difference:
```
from typing import Literal
import zipfile

def f1(p: str, compression: int) -> None:
    """Error: compression should have the type Literal[0, 8, 12, 14]"""
    zipfile.ZipFile(p, compression=compression)

def f2(p: str, compression: Literal[0, 8, 12, 14]) -> None:
    """Works, but cryptic and exposes internal implementation details"""
    zipfile.ZipFile(p, compression=compression)
```

The values are of constants need to be explicitly specified if somebody
wants to wrap `zipfipe.ZipFile`, which arguably exposes implementation
details in a problematic fashion.

Here is a real-world example where this caused a regression:
https://github.com/pytorch/vision/blob/main/torchvision/datasets/utils.py#L301
2022-12-16 13:49:16 +00:00
..
2022-11-01 10:10:37 +01:00
2022-11-07 11:20:47 -08:00
2022-10-30 16:26:48 -07:00
2022-11-06 21:32:46 -08:00
2022-11-03 15:32:10 +00:00
2021-05-06 18:57:33 +03:00
2022-10-28 15:36:57 +02:00
2022-10-28 11:07:56 +02:00
2022-08-04 23:51:42 +02:00
2022-10-28 11:01:03 +02:00
2022-02-19 12:26:45 -08:00
2022-09-30 13:08:41 +01:00
2022-10-28 17:51:29 -07:00
2022-10-31 23:14:12 -07:00
2022-04-18 21:21:19 +03:00
2022-01-30 16:27:06 -08:00
2022-10-14 22:36:07 +01:00
2022-11-03 11:37:59 +01:00
2021-12-22 20:18:19 -08:00
2022-01-01 14:19:05 +02:00
2022-03-03 15:25:30 -08:00
2022-06-28 14:30:50 +02:00
2022-08-23 12:22:12 -07:00
2022-11-05 13:52:31 -07:00
2022-10-30 06:39:59 -07:00