content
stringlengths
1
103k
path
stringlengths
8
216
filename
stringlengths
2
179
language
stringclasses
15 values
size_bytes
int64
2
189k
quality_score
float64
0.5
0.95
complexity
float64
0
1
documentation_ratio
float64
0
1
repository
stringclasses
5 values
stars
int64
0
1k
created_date
stringdate
2023-07-10 19:21:08
2025-07-09 19:11:45
license
stringclasses
4 values
is_test
bool
2 classes
file_hash
stringlengths
32
32
\n\n
.venv\Lib\site-packages\PIL\__pycache__\IcoImagePlugin.cpython-313.pyc
IcoImagePlugin.cpython-313.pyc
Other
15,417
0.8
0.011561
0
node-utils
26
2024-03-03T15:29:04.779929
GPL-3.0
false
5eb7c9d3350841bdc1c2cf88f6cb6e7f
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageChops.cpython-313.pyc
ImageChops.cpython-313.pyc
Other
10,919
0.8
0.150602
0
react-lib
439
2023-09-04T10:32:49.908408
BSD-3-Clause
false
9e46e64b1e5e72d9e80589429690d707
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageCms.cpython-313.pyc
ImageCms.cpython-313.pyc
Other
43,052
0.95
0.157525
0
node-utils
535
2024-07-25T23:57:26.427468
BSD-3-Clause
false
261e7c1aa28f29acbbc14865536e56f2
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageColor.cpython-313.pyc
ImageColor.cpython-313.pyc
Other
12,552
0.95
0.036496
0.038462
python-kit
13
2024-12-01T05:44:56.122290
MIT
false
659f0159480d1c2f2241077a8b086b36
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageDraw.cpython-313.pyc
ImageDraw.cpython-313.pyc
Other
44,063
0.95
0.022388
0.001942
react-lib
585
2025-03-10T06:50:03.239086
GPL-3.0
false
0913e1c6caf537d6e15ba830c2379abb
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageDraw2.cpython-313.pyc
ImageDraw2.cpython-313.pyc
Other
9,693
0.8
0
0.032
node-utils
926
2023-11-26T13:22:42.859823
MIT
false
74824171f03e640dd2f6e1933067858e
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageEnhance.cpython-313.pyc
ImageEnhance.cpython-313.pyc
Other
5,437
0.95
0.076923
0
vue-tools
750
2023-08-07T17:00:16.273610
MIT
false
d85ff37c5192fe263c17d654547887de
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageFile.cpython-313.pyc
ImageFile.cpython-313.pyc
Other
36,394
0.95
0.050761
0.011019
vue-tools
930
2024-05-03T21:55:59.825500
GPL-3.0
false
7afa3e4450efa019aefffbbde96fea53
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageFilter.cpython-313.pyc
ImageFilter.cpython-313.pyc
Other
23,308
0.95
0.05298
0.00365
python-kit
536
2025-01-08T01:31:42.204043
BSD-3-Clause
false
a7dc8b1e5c1a2a70d69d378f87cc55a0
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageFont.cpython-313.pyc
ImageFont.cpython-313.pyc
Other
67,494
0.75
0.053254
0.026258
python-kit
755
2023-12-31T11:24:02.424647
BSD-3-Clause
false
99f178e4add63eb646c59f366dbf66c0
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageGrab.cpython-313.pyc
ImageGrab.cpython-313.pyc
Other
7,206
0.95
0.036145
0.02439
vue-tools
90
2025-03-13T20:57:45.338131
Apache-2.0
false
d63a3cf483b261e0ecb8922adace2567
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageMath.cpython-313.pyc
ImageMath.cpython-313.pyc
Other
16,247
0.95
0.058824
0
awesome-app
754
2023-10-08T02:45:13.077142
Apache-2.0
false
92b0a0e081f1c4a660305df0e3e45aa9
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageMode.cpython-313.pyc
ImageMode.cpython-313.pyc
Other
2,849
0.8
0.04
0
node-utils
115
2024-11-18T16:13:50.107959
GPL-3.0
false
73bc88ccec859642b21715d4fea26b1a
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageMorph.cpython-313.pyc
ImageMorph.cpython-313.pyc
Other
11,328
0.95
0.041667
0
vue-tools
995
2023-11-14T04:13:41.610980
MIT
false
b69018d8305320d0d22c136f523700c6
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageOps.cpython-313.pyc
ImageOps.cpython-313.pyc
Other
29,760
0.95
0.072727
0
awesome-app
901
2023-11-19T21:19:12.272382
Apache-2.0
false
8d72f96501bef76ed16311e68eb1cf7c
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImagePalette.cpython-313.pyc
ImagePalette.cpython-313.pyc
Other
12,360
0.8
0.028369
0.007692
awesome-app
765
2024-12-26T12:57:52.251278
BSD-3-Clause
false
f39691befde5137a9e1689cb6645d581
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImagePath.cpython-313.pyc
ImagePath.cpython-313.pyc
Other
341
0.8
0
0
python-kit
304
2024-03-15T06:17:56.022861
Apache-2.0
false
a93038fb59550034c712ec896646a3f8
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageQt.cpython-313.pyc
ImageQt.cpython-313.pyc
Other
8,697
0.95
0.020202
0.021053
react-lib
74
2024-01-14T09:11:09.526082
BSD-3-Clause
false
b8ccf82128696d23e8f13f4aa13e66cc
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageSequence.cpython-313.pyc
ImageSequence.cpython-313.pyc
Other
3,443
0.95
0.119048
0
react-lib
946
2023-07-25T06:09:05.922530
GPL-3.0
false
86e452b5d83b160749484feb54d20be6
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageShow.cpython-313.pyc
ImageShow.cpython-313.pyc
Other
14,303
0.95
0.064286
0
awesome-app
340
2024-12-22T02:00:51.608397
GPL-3.0
false
901ce0aeef98f2b2e7fa3d4b0ff369c6
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageStat.cpython-313.pyc
ImageStat.cpython-313.pyc
Other
7,331
0.8
0.189873
0
node-utils
827
2024-12-14T17:38:51.484484
Apache-2.0
false
ea7880be05d46d8b922294dd06647e57
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageTk.cpython-313.pyc
ImageTk.cpython-313.pyc
Other
9,348
0.95
0.037736
0.021053
vue-tools
127
2025-04-12T18:35:15.222726
Apache-2.0
false
1540ee891922feff682ee1388847f69c
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageTransform.cpython-313.pyc
ImageTransform.cpython-313.pyc
Other
5,380
0.95
0.061856
0.050633
node-utils
748
2024-07-05T15:09:31.000765
BSD-3-Clause
false
9d4aa8556ad66dc95bd9627be8c3b0ee
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImageWin.cpython-313.pyc
ImageWin.cpython-313.pyc
Other
11,746
0.95
0.005405
0.00625
vue-tools
435
2024-08-20T13:08:46.942472
BSD-3-Clause
false
e6ff5544449d2c649e4433e640b8ecf2
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImImagePlugin.cpython-313.pyc
ImImagePlugin.cpython-313.pyc
Other
13,457
0.8
0
0.012903
node-utils
589
2023-08-09T20:59:55.859358
GPL-3.0
false
09b6fa6f2ff4034f58fe861674310ef1
\n\n
.venv\Lib\site-packages\PIL\__pycache__\ImtImagePlugin.cpython-313.pyc
ImtImagePlugin.cpython-313.pyc
Other
2,646
0.8
0
0
python-kit
322
2024-06-20T00:49:57.105437
Apache-2.0
false
e5d8f306794bc84bdd7604f9e546ae56
\n\n
.venv\Lib\site-packages\PIL\__pycache__\IptcImagePlugin.cpython-313.pyc
IptcImagePlugin.cpython-313.pyc
Other
9,293
0.8
0.010753
0
vue-tools
539
2025-06-11T17:09:56.025002
BSD-3-Clause
false
1966e4753aa44d0b369e1f62147124ce
\n\n
.venv\Lib\site-packages\PIL\__pycache__\Jpeg2KImagePlugin.cpython-313.pyc
Jpeg2KImagePlugin.cpython-313.pyc
Other
18,786
0.95
0.005682
0
react-lib
982
2025-04-09T07:50:47.958315
BSD-3-Clause
false
493e40736c904335138e6464905c3a47
\n\n
.venv\Lib\site-packages\PIL\__pycache__\JpegImagePlugin.cpython-313.pyc
JpegImagePlugin.cpython-313.pyc
Other
34,789
0.8
0
0.011142
python-kit
324
2024-03-22T20:17:23.860151
BSD-3-Clause
false
456188c647e5e30e641fda4729fd947d
\n\n
.venv\Lib\site-packages\PIL\__pycache__\JpegPresets.cpython-313.pyc
JpegPresets.cpython-313.pyc
Other
8,120
0.95
0.051282
0.018519
react-lib
869
2024-06-26T21:57:24.200206
Apache-2.0
false
35c08e6d056796a14e551924fbd958ad
\n\n
.venv\Lib\site-packages\PIL\__pycache__\McIdasImagePlugin.cpython-313.pyc
McIdasImagePlugin.cpython-313.pyc
Other
2,310
0.8
0
0
awesome-app
777
2024-10-17T06:31:00.612307
MIT
false
d5e33d45787f3a0db7ef93a50c6e4b41
\n\n
.venv\Lib\site-packages\PIL\__pycache__\MicImagePlugin.cpython-313.pyc
MicImagePlugin.cpython-313.pyc
Other
3,860
0.8
0
0
awesome-app
767
2024-04-16T02:19:42.843742
MIT
false
0a7551991b8a083719a0531695bd1281
\n\n
.venv\Lib\site-packages\PIL\__pycache__\MpegImagePlugin.cpython-313.pyc
MpegImagePlugin.cpython-313.pyc
Other
3,745
0.8
0
0
vue-tools
729
2024-04-24T01:42:22.873797
MIT
false
48dbb2d52f408c266a3bdc7ff27a45ee
\n\n
.venv\Lib\site-packages\PIL\__pycache__\MpoImagePlugin.cpython-313.pyc
MpoImagePlugin.cpython-313.pyc
Other
8,963
0.8
0.010101
0
python-kit
579
2025-06-01T14:30:29.191792
BSD-3-Clause
false
f125abb0fc175bb0363fbb5996ac6389
\n\n
.venv\Lib\site-packages\PIL\__pycache__\MspImagePlugin.cpython-313.pyc
MspImagePlugin.cpython-313.pyc
Other
6,096
0.8
0
0.06383
react-lib
241
2024-01-29T04:03:44.846063
GPL-3.0
false
bb502ba82a0df50b59685d5c5a881e84
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PaletteFile.cpython-313.pyc
PaletteFile.cpython-313.pyc
Other
2,018
0.8
0.052632
0
vue-tools
167
2024-09-18T06:46:46.650671
GPL-3.0
false
ae808db03cd126cec6831267e4c087ef
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PalmImagePlugin.cpython-313.pyc
PalmImagePlugin.cpython-313.pyc
Other
9,167
0.8
0
0
node-utils
7
2025-06-05T22:35:07.742699
BSD-3-Clause
false
6fce4efbfe8cd6959afe1f0d48246fd7
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PcdImagePlugin.cpython-313.pyc
PcdImagePlugin.cpython-313.pyc
Other
2,164
0.8
0
0
node-utils
196
2024-01-01T23:47:43.402966
GPL-3.0
false
3801da75e9c3a73d4d7a766f3417c48c
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PcfFontFile.cpython-313.pyc
PcfFontFile.cpython-313.pyc
Other
9,947
0.8
0.012048
0.012346
react-lib
949
2024-06-25T10:13:22.048158
Apache-2.0
false
7d3f2d37d7011b87359dbd4d5482b9b4
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PcxImagePlugin.cpython-313.pyc
PcxImagePlugin.cpython-313.pyc
Other
7,446
0.8
0
0
vue-tools
491
2023-07-17T07:07:05.020105
MIT
false
8def6b0ba35711b884b230e0f94423d3
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PdfImagePlugin.cpython-313.pyc
PdfImagePlugin.cpython-313.pyc
Other
9,906
0.8
0
0.008403
vue-tools
641
2023-08-28T04:51:21.983374
MIT
false
02322d117cc1d212cabd31ce62d10175
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PdfParser.cpython-313.pyc
PdfParser.cpython-313.pyc
Other
54,084
0.8
0.002558
0.018919
react-lib
684
2024-12-09T19:23:06.024854
BSD-3-Clause
false
10ff71f844962b344bda935ded58beb6
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PixarImagePlugin.cpython-313.pyc
PixarImagePlugin.cpython-313.pyc
Other
2,042
0.8
0
0
awesome-app
134
2024-12-11T00:26:44.892169
BSD-3-Clause
false
fad47c43364ba31d423939a7b105fb3e
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PngImagePlugin.cpython-313.pyc
PngImagePlugin.cpython-313.pyc
Other
63,887
0.75
0.022044
0.017167
python-kit
810
2025-02-07T11:55:00.400129
GPL-3.0
false
51d94576976292166fd30895b23d5c7a
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PpmImagePlugin.cpython-313.pyc
PpmImagePlugin.cpython-313.pyc
Other
14,501
0.8
0.023622
0.008
vue-tools
329
2025-03-22T11:09:59.784656
BSD-3-Clause
false
1f1591d6e913a2dd53e2a7c31ead3c0e
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PsdImagePlugin.cpython-313.pyc
PsdImagePlugin.cpython-313.pyc
Other
11,310
0.8
0.008772
0.009091
node-utils
476
2025-02-01T04:23:59.810726
Apache-2.0
false
8205628c4afa580a4d460e0323e1f7a4
\n\n
.venv\Lib\site-packages\PIL\__pycache__\PSDraw.cpython-313.pyc
PSDraw.cpython-313.pyc
Other
7,886
0.95
0.170732
0
node-utils
12
2025-03-24T22:41:07.860340
MIT
false
50623ef7626e7d0e33cc13261fbbf9e8
\n\n
.venv\Lib\site-packages\PIL\__pycache__\QoiImagePlugin.cpython-313.pyc
QoiImagePlugin.cpython-313.pyc
Other
11,540
0.8
0
0
awesome-app
20
2024-06-08T23:41:39.073253
GPL-3.0
false
f313c6f59f73d33de1a1fdfc19962765
\n\n
.venv\Lib\site-packages\PIL\__pycache__\report.cpython-313.pyc
report.cpython-313.pyc
Other
313
0.7
0
0
awesome-app
6
2025-01-09T22:03:08.188866
Apache-2.0
false
883dca6c9b144f538ad0c1fd3f65f2b1
\n\n
.venv\Lib\site-packages\PIL\__pycache__\SgiImagePlugin.cpython-313.pyc
SgiImagePlugin.cpython-313.pyc
Other
8,186
0.8
0
0.014085
python-kit
754
2024-02-27T05:27:31.424973
Apache-2.0
false
c61570356fed5f3fdf19dd439cb533b3
\n\n
.venv\Lib\site-packages\PIL\__pycache__\SpiderImagePlugin.cpython-313.pyc
SpiderImagePlugin.cpython-313.pyc
Other
12,780
0.8
0.013889
0.007246
react-lib
69
2024-09-27T05:08:03.792800
GPL-3.0
false
3d42295381af41e53343efdbd6190f33
\n\n
.venv\Lib\site-packages\PIL\__pycache__\SunImagePlugin.cpython-313.pyc
SunImagePlugin.cpython-313.pyc
Other
3,541
0.8
0
0
node-utils
876
2025-01-13T05:22:04.514951
Apache-2.0
false
6cbe5aaa0d42d84ec827e4a8c9f7c64f
\n\n
.venv\Lib\site-packages\PIL\__pycache__\TarIO.cpython-313.pyc
TarIO.cpython-313.pyc
Other
2,072
0.8
0
0
react-lib
806
2024-12-06T20:53:39.358946
Apache-2.0
false
4883b7e0553c82470120666fb7620291
\n\n
.venv\Lib\site-packages\PIL\__pycache__\TgaImagePlugin.cpython-313.pyc
TgaImagePlugin.cpython-313.pyc
Other
8,338
0.8
0
0
vue-tools
917
2025-01-26T19:34:14.942534
MIT
false
ffce63b0ff08d7ef11e1e0fe2450dc08
\n\n
.venv\Lib\site-packages\PIL\__pycache__\TiffImagePlugin.cpython-313.pyc
TiffImagePlugin.cpython-313.pyc
Other
103,271
0.75
0.019427
0.017699
react-lib
583
2025-03-29T03:03:24.418584
GPL-3.0
false
5074bea4490dd619a42ebf32715df05d
\n\n
.venv\Lib\site-packages\PIL\__pycache__\TiffTags.cpython-313.pyc
TiffTags.cpython-313.pyc
Other
18,911
0.8
0.005089
0.005168
awesome-app
699
2023-11-25T02:43:11.275878
GPL-3.0
false
60523094cdf0be806d586b78936a01d7
\n\n
.venv\Lib\site-packages\PIL\__pycache__\WalImageFile.cpython-313.pyc
WalImageFile.cpython-313.pyc
Other
4,144
0.95
0.022727
0.013514
node-utils
835
2023-08-06T20:12:34.188129
GPL-3.0
false
86718d96efff53f42f48bae3c0721a0e
\n\n
.venv\Lib\site-packages\PIL\__pycache__\WebPImagePlugin.cpython-313.pyc
WebPImagePlugin.cpython-313.pyc
Other
13,560
0.8
0
0
vue-tools
885
2023-08-26T17:23:30.698639
GPL-3.0
false
84cc2af44b38c88022ed466fe766882c
\n\n
.venv\Lib\site-packages\PIL\__pycache__\WmfImagePlugin.cpython-313.pyc
WmfImagePlugin.cpython-313.pyc
Other
6,477
0.8
0
0
python-kit
640
2023-12-24T20:09:09.526789
GPL-3.0
false
a30f6b27d94e2744320c99809075baea
\n\n
.venv\Lib\site-packages\PIL\__pycache__\XbmImagePlugin.cpython-313.pyc
XbmImagePlugin.cpython-313.pyc
Other
4,202
0.8
0
0
python-kit
77
2023-10-27T03:56:21.075527
MIT
false
5e0c20f896ddd806e76c42e7bc96f11a
\n\n
.venv\Lib\site-packages\PIL\__pycache__\XpmImagePlugin.cpython-313.pyc
XpmImagePlugin.cpython-313.pyc
Other
6,308
0.8
0
0
vue-tools
803
2024-06-01T18:59:08.614194
Apache-2.0
false
f57657d72f76868c7fe415837b31b517
\n\n
.venv\Lib\site-packages\PIL\__pycache__\XVThumbImagePlugin.cpython-313.pyc
XVThumbImagePlugin.cpython-313.pyc
Other
2,731
0.8
0
0
awesome-app
901
2024-11-21T00:12:28.161018
GPL-3.0
false
df9b10169d1743dcf4d14b3c98a15d68
\n\n
.venv\Lib\site-packages\PIL\__pycache__\_binary.cpython-313.pyc
_binary.cpython-313.pyc
Other
3,356
0.8
0
0
node-utils
344
2024-08-16T18:01:19.020653
BSD-3-Clause
false
7246ea2d1e950741dd9e657a147d1ba2
\n\n
.venv\Lib\site-packages\PIL\__pycache__\_deprecate.cpython-313.pyc
_deprecate.cpython-313.pyc
Other
2,566
0.8
0.020408
0
python-kit
370
2024-10-14T07:37:12.086005
GPL-3.0
false
76fb9d81208effe3f4ebdd6d8785aa74
\n\n
.venv\Lib\site-packages\PIL\__pycache__\_tkinter_finder.cpython-313.pyc
_tkinter_finder.cpython-313.pyc
Other
775
0.8
0
0.090909
vue-tools
273
2024-04-21T22:55:36.919286
BSD-3-Clause
false
d413d59e6b3cce6ac949828f778fd5dc
\n\n
.venv\Lib\site-packages\PIL\__pycache__\_typing.cpython-313.pyc
_typing.cpython-313.pyc
Other
2,232
0.8
0
0
react-lib
323
2024-02-20T09:23:55.534418
GPL-3.0
false
38e843ae12e4b8cf4986898fb85b3966
\n\n
.venv\Lib\site-packages\PIL\__pycache__\_util.cpython-313.pyc
_util.cpython-313.pyc
Other
1,575
0.7
0
0
python-kit
455
2024-07-25T02:31:39.192907
Apache-2.0
false
0853b25272b281c300aa523912e3001c
\n\n
.venv\Lib\site-packages\PIL\__pycache__\_version.cpython-313.pyc
_version.cpython-313.pyc
Other
257
0.7
0
0
awesome-app
677
2023-08-24T00:11:05.059440
BSD-3-Clause
false
59070bfd6e6bead7210b21dc161fecba
\n\n
.venv\Lib\site-packages\PIL\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
2,075
0.8
0.074074
0
python-kit
955
2024-12-11T04:50:43.778493
Apache-2.0
false
00d8378b16e4098ac7c636ab0b5014e2
\n\n
.venv\Lib\site-packages\PIL\__pycache__\__main__.cpython-313.pyc
__main__.cpython-313.pyc
Other
381
0.7
0
0
awesome-app
173
2023-09-17T00:42:37.144204
BSD-3-Clause
false
af7ef32cfc38ef5cef81bbd02b985ff8
pip\n
.venv\Lib\site-packages\pillow-11.3.0.dist-info\INSTALLER
INSTALLER
Other
4
0.5
0
0
python-kit
274
2024-06-17T09:35:48.370918
BSD-3-Clause
false
365c9bfeb7d89244f2ce01c1de44cb85
Metadata-Version: 2.4\nName: pillow\nVersion: 11.3.0\nSummary: Python Imaging Library (Fork)\nAuthor-email: "Jeffrey A. Clark" <aclark@aclark.net>\nLicense-Expression: MIT-CMU\nProject-URL: Changelog, https://github.com/python-pillow/Pillow/releases\nProject-URL: Documentation, https://pillow.readthedocs.io\nProject-URL: Funding, https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=pypi\nProject-URL: Homepage, https://python-pillow.github.io\nProject-URL: Mastodon, https://fosstodon.org/@pillow\nProject-URL: Release notes, https://pillow.readthedocs.io/en/stable/releasenotes/index.html\nProject-URL: Source, https://github.com/python-pillow/Pillow\nKeywords: Imaging\nClassifier: Development Status :: 6 - Mature\nClassifier: Programming Language :: Python :: 3 :: Only\nClassifier: Programming Language :: Python :: 3.9\nClassifier: Programming Language :: Python :: 3.10\nClassifier: Programming Language :: Python :: 3.11\nClassifier: Programming Language :: Python :: 3.12\nClassifier: Programming Language :: Python :: 3.13\nClassifier: Programming Language :: Python :: Implementation :: CPython\nClassifier: Programming Language :: Python :: Implementation :: PyPy\nClassifier: Topic :: Multimedia :: Graphics\nClassifier: Topic :: Multimedia :: Graphics :: Capture :: Digital Camera\nClassifier: Topic :: Multimedia :: Graphics :: Capture :: Screen Capture\nClassifier: Topic :: Multimedia :: Graphics :: Graphics Conversion\nClassifier: Topic :: Multimedia :: Graphics :: Viewers\nClassifier: Typing :: Typed\nRequires-Python: >=3.9\nDescription-Content-Type: text/markdown\nLicense-File: LICENSE\nProvides-Extra: docs\nRequires-Dist: furo; extra == "docs"\nRequires-Dist: olefile; extra == "docs"\nRequires-Dist: sphinx>=8.2; extra == "docs"\nRequires-Dist: sphinx-autobuild; extra == "docs"\nRequires-Dist: sphinx-copybutton; extra == "docs"\nRequires-Dist: sphinx-inline-tabs; extra == "docs"\nRequires-Dist: sphinxext-opengraph; extra == "docs"\nProvides-Extra: fpx\nRequires-Dist: olefile; extra == "fpx"\nProvides-Extra: mic\nRequires-Dist: olefile; extra == "mic"\nProvides-Extra: test-arrow\nRequires-Dist: pyarrow; extra == "test-arrow"\nProvides-Extra: tests\nRequires-Dist: check-manifest; extra == "tests"\nRequires-Dist: coverage>=7.4.2; extra == "tests"\nRequires-Dist: defusedxml; extra == "tests"\nRequires-Dist: markdown2; extra == "tests"\nRequires-Dist: olefile; extra == "tests"\nRequires-Dist: packaging; extra == "tests"\nRequires-Dist: pyroma; extra == "tests"\nRequires-Dist: pytest; extra == "tests"\nRequires-Dist: pytest-cov; extra == "tests"\nRequires-Dist: pytest-timeout; extra == "tests"\nRequires-Dist: pytest-xdist; extra == "tests"\nRequires-Dist: trove-classifiers>=2024.10.12; extra == "tests"\nProvides-Extra: typing\nRequires-Dist: typing-extensions; python_version < "3.10" and extra == "typing"\nProvides-Extra: xmp\nRequires-Dist: defusedxml; extra == "xmp"\nDynamic: license-file\n\n<p align="center">\n <img width="248" height="250" src="https://raw.githubusercontent.com/python-pillow/pillow-logo/main/pillow-logo-248x250.png" alt="Pillow logo">\n</p>\n\n# Pillow\n\n## Python Imaging Library (Fork)\n\nPillow is the friendly PIL fork by [Jeffrey A. Clark and\ncontributors](https://github.com/python-pillow/Pillow/graphs/contributors).\nPIL is the Python Imaging Library by Fredrik Lundh and contributors.\nAs of 2019, Pillow development is\n[supported by Tidelift](https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=readme&utm_campaign=enterprise).\n\n<table>\n <tr>\n <th>docs</th>\n <td>\n <a href="https://pillow.readthedocs.io/?badge=latest"><img\n alt="Documentation Status"\n src="https://readthedocs.org/projects/pillow/badge/?version=latest"></a>\n </td>\n </tr>\n <tr>\n <th>tests</th>\n <td>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/lint.yml"><img\n alt="GitHub Actions build status (Lint)"\n src="https://github.com/python-pillow/Pillow/workflows/Lint/badge.svg"></a>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/test.yml"><img\n alt="GitHub Actions build status (Test Linux and macOS)"\n src="https://github.com/python-pillow/Pillow/workflows/Test/badge.svg"></a>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/test-windows.yml"><img\n alt="GitHub Actions build status (Test Windows)"\n src="https://github.com/python-pillow/Pillow/workflows/Test%20Windows/badge.svg"></a>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/test-mingw.yml"><img\n alt="GitHub Actions build status (Test MinGW)"\n src="https://github.com/python-pillow/Pillow/workflows/Test%20MinGW/badge.svg"></a>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/test-cygwin.yml"><img\n alt="GitHub Actions build status (Test Cygwin)"\n src="https://github.com/python-pillow/Pillow/workflows/Test%20Cygwin/badge.svg"></a>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/test-docker.yml"><img\n alt="GitHub Actions build status (Test Docker)"\n src="https://github.com/python-pillow/Pillow/workflows/Test%20Docker/badge.svg"></a>\n <a href="https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml"><img\n alt="GitHub Actions build status (Wheels)"\n src="https://github.com/python-pillow/Pillow/workflows/Wheels/badge.svg"></a>\n <a href="https://app.codecov.io/gh/python-pillow/Pillow"><img\n alt="Code coverage"\n src="https://codecov.io/gh/python-pillow/Pillow/branch/main/graph/badge.svg"></a>\n <a href="https://issues.oss-fuzz.com/issues?q=title:pillow"><img\n alt="Fuzzing Status"\n src="https://oss-fuzz-build-logs.storage.googleapis.com/badges/pillow.svg"></a>\n </td>\n </tr>\n <tr>\n <th>package</th>\n <td>\n <a href="https://zenodo.org/badge/latestdoi/17549/python-pillow/Pillow"><img\n alt="Zenodo"\n src="https://zenodo.org/badge/17549/python-pillow/Pillow.svg"></a>\n <a href="https://tidelift.com/subscription/pkg/pypi-pillow?utm_source=pypi-pillow&utm_medium=badge"><img\n alt="Tidelift"\n src="https://tidelift.com/badges/package/pypi/pillow?style=flat"></a>\n <a href="https://pypi.org/project/pillow/"><img\n alt="Newest PyPI version"\n src="https://img.shields.io/pypi/v/pillow.svg"></a>\n <a href="https://pypi.org/project/pillow/"><img\n alt="Number of PyPI downloads"\n src="https://img.shields.io/pypi/dm/pillow.svg"></a>\n <a href="https://www.bestpractices.dev/projects/6331"><img\n alt="OpenSSF Best Practices"\n src="https://www.bestpractices.dev/projects/6331/badge"></a>\n </td>\n </tr>\n <tr>\n <th>social</th>\n <td>\n <a href="https://gitter.im/python-pillow/Pillow?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img\n alt="Join the chat at https://gitter.im/python-pillow/Pillow"\n src="https://badges.gitter.im/python-pillow/Pillow.svg"></a>\n <a href="https://fosstodon.org/@pillow"><img\n alt="Follow on https://fosstodon.org/@pillow"\n src="https://img.shields.io/badge/publish-on%20Mastodon-595aff.svg"\n rel="me"></a>\n </td>\n </tr>\n</table>\n\n## Overview\n\nThe Python Imaging Library adds image processing capabilities to your Python interpreter.\n\nThis library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities.\n\nThe core image library is designed for fast access to data stored in a few basic pixel formats. It should provide a solid foundation for a general image processing tool.\n\n## More information\n\n- [Documentation](https://pillow.readthedocs.io/)\n - [Installation](https://pillow.readthedocs.io/en/latest/installation/basic-installation.html)\n - [Handbook](https://pillow.readthedocs.io/en/latest/handbook/index.html)\n- [Contribute](https://github.com/python-pillow/Pillow/blob/main/.github/CONTRIBUTING.md)\n - [Issues](https://github.com/python-pillow/Pillow/issues)\n - [Pull requests](https://github.com/python-pillow/Pillow/pulls)\n- [Release notes](https://pillow.readthedocs.io/en/stable/releasenotes/index.html)\n- [Changelog](https://github.com/python-pillow/Pillow/releases)\n - [Pre-fork](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst#pre-fork)\n\n## Report a vulnerability\n\nTo report a security vulnerability, please follow the procedure described in the [Tidelift security policy](https://tidelift.com/docs/security).\n
.venv\Lib\site-packages\pillow-11.3.0.dist-info\METADATA
METADATA
Other
9,200
0.8
0.011299
0.030488
awesome-app
348
2024-12-03T02:28:24.956900
MIT
false
a7f956981235a8ed7b171d20bbeff1a6
PIL/AvifImagePlugin.py,sha256=-fkL5LJRs9nAmi3gZQOOMjSlIw29aEXBFgvYKNXXKjs,9285\nPIL/BdfFontFile.py,sha256=bApbMl2vYRceQKIkSDFa002Ywr9laVrp2NGK9xzlS_8,3407\nPIL/BlpImagePlugin.py,sha256=GT1ujm8Xwg2OSTfzTdFrhH6mTYG0u6mHjsQN9FIwD6E,17030\nPIL/BmpImagePlugin.py,sha256=qjhwXlKomN-TExyDoI_ud564b1WSwiYslQeyaqBEFyQ,20370\nPIL/BufrStubImagePlugin.py,sha256=5dcwg2o6eh4HZdPihFXqRBaS-H514M-oQrs6iZBDGbY,1805\nPIL/ContainerIO.py,sha256=I6yO_YFEEqMKA1ckgEEzF2r_Ik5p_GjM-RrWOJYjSlY,4777\nPIL/CurImagePlugin.py,sha256=zU9es1wY49NZn9p2UgxFcSi3ERH43C9luys9WK3MTt0,1872\nPIL/DcxImagePlugin.py,sha256=BTWIsAzKuATO640-xC-RQy1Mni1Huwqk7KUuMHO0mzw,2228\nPIL/DdsImagePlugin.py,sha256=tUFTv6GYGos86zwWTJUxqck-2I_T-nGSQpVL5mQhBLc,19530\nPIL/EpsImagePlugin.py,sha256=cUbIQL2BrfJrVB9flwo-Ie_OQZyQOkV0oByNTFjYZH0,16865\nPIL/ExifTags.py,sha256=xG6PuZIJSXk7bfkBfXh11YgKlWVkF1HWQ_I7XywFBMs,10313\nPIL/FitsImagePlugin.py,sha256=v4peLA6wIdySjHBzDMzVI5UWx8zr0jI2A3qYZSaMixs,4796\nPIL/FliImagePlugin.py,sha256=h-RylemfZ05aQSjphswvuA6xO5bMqgGTKz0pCJHr8gM,4964\nPIL/FontFile.py,sha256=iLSV32yQetLnE4SgG8HnHb2FdqkqFBjY9n--E6u5UE0,3711\nPIL/FpxImagePlugin.py,sha256=0XAD64rzIVGTK0qzwp8Tn3pmoAP6Hj7I0Bvgk3MNVEs,7550\nPIL/FtexImagePlugin.py,sha256=MZfpAImS_Tb7xa_sA0N1d_Rt6p8IngWiG9jDEf1VvJk,3649\nPIL/GbrImagePlugin.py,sha256=x49ki3fwwQQre9Gi_Q4xb50ui4o-3TyE9S0mMqHTBR0,3109\nPIL/GdImageFile.py,sha256=LjMalK77Vw9U5pBH4KQlbi2PaIr73u9DqtxN58O1rBs,2890\nPIL/GifImagePlugin.py,sha256=I-Z_1-2zWD0dl-uzQS7ZdhPwakfnPkheS2rCLFl9dwY,43414\nPIL/GimpGradientFile.py,sha256=tcSiN7MwWWJ7BEdk8g_3zefGr1O9fb2sleYw3rJmNsk,4055\nPIL/GimpPaletteFile.py,sha256=F7R4QQqeUyHuFoisPkYLOdulChZ1MXe9XprCqyT7h0U,1887\nPIL/GribStubImagePlugin.py,sha256=xoQxNLKaNfxdxGfYU1rKj8Zr86wl3-_eQvydLgP0zmU,1813\nPIL/Hdf5StubImagePlugin.py,sha256=-Oz4WIQ_oXM_zk7PFpRgfaSHGGEXFTcidCJWg5Vfb5c,1816\nPIL/IcnsImagePlugin.py,sha256=XyEKFLHdVmy9_s7db6HxNr1nUqlkdqwN1h-BxZ_iQxs,13360\nPIL/IcoImagePlugin.py,sha256=3lRMAPIMX68AlDVHXnQ-DHOCsd_4FlPg6HA7m6NR1WI,12872\nPIL/ImImagePlugin.py,sha256=1decJTjz8DGwLl4eHlnh4FRq2J0Y4PLlP4zE0quUrAo,11956\nPIL/Image.py,sha256=aeg__oSAg6glVG45IW71-74SIfiQkN8d3g00IcYyUs0,152577\nPIL/ImageChops.py,sha256=hZ8EPUPlQIzugsEedV8trkKX0jBCDGb6Cszma6ZeMZQ,8257\nPIL/ImageCms.py,sha256=nLrb2iN62ANvZcg9-kp9mhWnQZUVyzsG94-qVRPistQ,43057\nPIL/ImageColor.py,sha256=KV-u7HnZWrrL3zuBAOLqerI-7vFcXTxdLeoaYVjsnwI,9761\nPIL/ImageDraw.py,sha256=x6-XaWLsYPjaox91uE18YF7-oM1CjAa7AtziNstmBYM,44077\nPIL/ImageDraw2.py,sha256=_e6I2nPxeiZwjOjBEJzUvxoyAklzmc-xF6R8z8ieOAA,7470\nPIL/ImageEnhance.py,sha256=ugDU0sljaR_zaTibtumlTvf-qFH1x1W6l2QMpc386XU,3740\nPIL/ImageFile.py,sha256=2aFChKC4nuN1Sb4MSgltp5tNb-MvbEf3CsOkRa1Xdds,30256\nPIL/ImageFilter.py,sha256=52m5fVj9pwCzN2ayyGRy3CxvcbzQ3zOk9evHCQmhA_g,19275\nPIL/ImageFont.py,sha256=B9rvTnmZ97rSivc8CMXju8UQKTTcfH4jfJ3LYUwdng8,65631\nPIL/ImageGrab.py,sha256=iFr90quXDE9p5yicxE09atuixPBGpkvvH358vANLAH4,6667\nPIL/ImageMath.py,sha256=CTITjxiEdaMxJzxDNSbDItO8kS8TXXmkYfUdXiIT52A,12287\nPIL/ImageMode.py,sha256=n4-2kSolyB7v2u6dXyIf3_vDL_LMvSNwhJvd9Do8cc8,2773\nPIL/ImageMorph.py,sha256=E6kZhhpRypnHU8LoFgG4HkUoW3LfTr6rbv-fuFS9fDQ,8828\nPIL/ImageOps.py,sha256=eRYdsbnTLDwMX82aY1ob2GXUSaaXKJMvrCcyfCGzXmo,26270\nPIL/ImagePalette.py,sha256=kv7EuK55y6qYqC_PyFc-jP_fwRzJqwRCNcfuxvIrfXg,9295\nPIL/ImagePath.py,sha256=ZnnJuvQNtbKRhCmr61TEmEh1vVV5_90WMEPL8Opy5l8,391\nPIL/ImageQt.py,sha256=EHgnC27-Ept6Q4Khs7b4Rcz7dRuEns4VEsLTdVc-8pQ,7061\nPIL/ImageSequence.py,sha256=5UohDzcf-2PA3NfGnMRd15zDDA3eD9Wo3SP3DxyRsCU,2286\nPIL/ImageShow.py,sha256=TqO6nzj5EMwp5dExag3jhBJXdHojccnFx59LOnMQao0,10468\nPIL/ImageStat.py,sha256=iA5KJrQeEpbwk-FhczGD8L4TaLWUt4VT_mp4drvMhv8,5485\nPIL/ImageTk.py,sha256=Tx0zf9kTaBuAGvZuo0JAHrNbk3n6ewr4ZndWnWxZK0Q,8398\nPIL/ImageTransform.py,sha256=Zu6oySXENtq712-nkqFLqafYPviRAgsgkzfLWG0K3V8,4052\nPIL/ImageWin.py,sha256=b-fO6kn4icHpy-zk-Xg-nO382zPXl-MKjZcs3vAXl1Q,8332\nPIL/ImtImagePlugin.py,sha256=r-ZDz3Xji6EBF8eUnK6iuCEZEtllp0xLRSIQ0_h14UE,2768\nPIL/IptcImagePlugin.py,sha256=Q9TXBGi7vxByn9OAY4enmtJf_i2CyS9nuxmj3jCW14U,6969\nPIL/Jpeg2KImagePlugin.py,sha256=u1sc7pMDVKIjvVQ-mLHKYYtRu4czfFfKQ5cY7-XRZBU,14307\nPIL/JpegImagePlugin.py,sha256=MGuCHwvWM4Fa6E1CTYC7nTFsHbevC3phKdC0GJhmgms,32688\nPIL/JpegPresets.py,sha256=UUIsKzvyzdPzsndODd90eu_luMqauG1PJh10UOuQvmg,12621\nPIL/McIdasImagePlugin.py,sha256=P9d1kr4Ste0QVkxfqix31sfGD8sWn-eVmYK0wg6DvIw,1955\nPIL/MicImagePlugin.py,sha256=rh_HxdUdd6pYHB7qiMmYLTmD9jlLWnYfQcDx415rcI8,2666\nPIL/MpegImagePlugin.py,sha256=kem9zofsBtIq6xlMJcsFkOXTcJCPEICk9lchTfR9pDI,2094\nPIL/MpoImagePlugin.py,sha256=7ogrGzUL_tC64idGl4OfrcPJ0SAvHMRZw3jv21mvN7c,6924\nPIL/MspImagePlugin.py,sha256=W8ruM60OZUbiPuUBQ7BBkFzkl1fiaPEvsvRMyNrg18A,6092\nPIL/PSDraw.py,sha256=uAr-Mg5j9_G3RLwWx4_J1wutJg_DVeDAE4qWd3Mvi9U,7155\nPIL/PaletteFile.py,sha256=QdEa99jLC-PPhEqGy6_4fDua8TzKSSUzkAeYcClFX7M,1270\nPIL/PalmImagePlugin.py,sha256=fNIhWH06V35uLgwIHUMMc_2xumelIEJsmCwhw2whBxI,8965\nPIL/PcdImagePlugin.py,sha256=W4xMr8ex-K4r2r-1tKlRsI_x4E362PLtVhHAWmOt1pQ,1665\nPIL/PcfFontFile.py,sha256=RkM5wUp3SgRpQhpsTBEtk8uuFrQPnBSYBryOmcoRphQ,7401\nPIL/PcxImagePlugin.py,sha256=DUk8AoXKTmXl5yVknXVOAB6ZU3HWaCDCQ3SKPd3BQmc,6452\nPIL/PdfImagePlugin.py,sha256=-01K9TRr_ekIRxokuBw3N-_t5gQmn23rJXj6-B2-Gpk,9660\nPIL/PdfParser.py,sha256=64t7lZv85TJ6FXLiTIyX5kwCM-LwqceA-2amqBX0MtQ,39061\nPIL/PixarImagePlugin.py,sha256=-RnuJSGhGF8MsUsiHZq3VzBxV-BNnK35kBjJfhYzwXs,1830\nPIL/PngImagePlugin.py,sha256=o_OUyE1dxN0mO3FfLZMl0598fVZVHY76tNvcq-G50Z4,52668\nPIL/PpmImagePlugin.py,sha256=fykSAFcXmPlo2agWtPzr3pWBiU445yOdEalpoyWHJQI,12745\nPIL/PsdImagePlugin.py,sha256=eYQ33CuZDZ_eGw4gJSVsXYw2r8VP8VYlGDroBZOgaSg,9018\nPIL/QoiImagePlugin.py,sha256=3dnB03zEw3swx_o8PHZZw15W7tBdAKv0eQ7FkjOC-gA,8806\nPIL/SgiImagePlugin.py,sha256=w1xV4-ELYBHKL_AaGf9oJSYJzBwTpdJ-rNPqiArKgGs,6620\nPIL/SpiderImagePlugin.py,sha256=6zvFg874J8FU0GDWHrZQP8KEjZnoDjqtqiSpjgfdR5o,10580\nPIL/SunImagePlugin.py,sha256=YKYEvuG4QUkies34OKtXWKTYSZ8U3qzcE_vdTrOuRsw,4734\nPIL/TarIO.py,sha256=K6tLkFDcaar3vb6EyYb7G4oVEB41x_LMuGJeUT9w5DQ,1503\nPIL/TgaImagePlugin.py,sha256=OMvZn_xKjB1dZ1_4MkOquzJBHpSUIpAf5mUEJZiLBTI,7244\nPIL/TiffImagePlugin.py,sha256=s02yD54IKv9qMl6hIb3Z5f9rQYdho3ck_VxU3lfsG9g,87368\nPIL/TiffTags.py,sha256=CmDDo0yRJ4lD-tvB00RWyNlDbSjhQx8QhDzJOr1zoZI,17644\nPIL/WalImageFile.py,sha256=XzvTP_kO_JuumDBXV4FTRJJG1xhx4KqMnXDkStpaYbk,5831\nPIL/WebPImagePlugin.py,sha256=7h1Wz1R5vPV6hOQKgtQ_EtBTASENaZOTGUjG2TJqe0U,10330\nPIL/WmfImagePlugin.py,sha256=-v-G3iEWKdQtAuAuVuip6eeS-dPWkdJ_IALlcod7QQk,5429\nPIL/XVThumbImagePlugin.py,sha256=_sd2nB_kXi9V-4QwRH39qIMjIwrwc2JpP-_xZGO7MFk,2198\nPIL/XbmImagePlugin.py,sha256=wc0NpfTzlShx9Ymi0zwo0aVZjDa4_B7NEiG2TgCO65Q,2767\nPIL/XpmImagePlugin.py,sha256=wYf7Q7TGo4JL6n5ouQx8pbTMnMZVshgp-xwoAMZEUKg,4557\nPIL/__init__.py,sha256=Z-sXBmtIAVmDwqwBdI6L4RWjWxcgVvQ3v4SG0NxKeWU,2118\nPIL/__main__.py,sha256=X8eIpGlmHfnp7zazp5mdav228Itcf2lkiMP0tLU6X9c,140\nPIL/__pycache__/AvifImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/BdfFontFile.cpython-313.pyc,,\nPIL/__pycache__/BlpImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/BmpImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/BufrStubImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/ContainerIO.cpython-313.pyc,,\nPIL/__pycache__/CurImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/DcxImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/DdsImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/EpsImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/ExifTags.cpython-313.pyc,,\nPIL/__pycache__/FitsImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/FliImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/FontFile.cpython-313.pyc,,\nPIL/__pycache__/FpxImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/FtexImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/GbrImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/GdImageFile.cpython-313.pyc,,\nPIL/__pycache__/GifImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/GimpGradientFile.cpython-313.pyc,,\nPIL/__pycache__/GimpPaletteFile.cpython-313.pyc,,\nPIL/__pycache__/GribStubImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/Hdf5StubImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/IcnsImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/IcoImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/ImImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/Image.cpython-313.pyc,,\nPIL/__pycache__/ImageChops.cpython-313.pyc,,\nPIL/__pycache__/ImageCms.cpython-313.pyc,,\nPIL/__pycache__/ImageColor.cpython-313.pyc,,\nPIL/__pycache__/ImageDraw.cpython-313.pyc,,\nPIL/__pycache__/ImageDraw2.cpython-313.pyc,,\nPIL/__pycache__/ImageEnhance.cpython-313.pyc,,\nPIL/__pycache__/ImageFile.cpython-313.pyc,,\nPIL/__pycache__/ImageFilter.cpython-313.pyc,,\nPIL/__pycache__/ImageFont.cpython-313.pyc,,\nPIL/__pycache__/ImageGrab.cpython-313.pyc,,\nPIL/__pycache__/ImageMath.cpython-313.pyc,,\nPIL/__pycache__/ImageMode.cpython-313.pyc,,\nPIL/__pycache__/ImageMorph.cpython-313.pyc,,\nPIL/__pycache__/ImageOps.cpython-313.pyc,,\nPIL/__pycache__/ImagePalette.cpython-313.pyc,,\nPIL/__pycache__/ImagePath.cpython-313.pyc,,\nPIL/__pycache__/ImageQt.cpython-313.pyc,,\nPIL/__pycache__/ImageSequence.cpython-313.pyc,,\nPIL/__pycache__/ImageShow.cpython-313.pyc,,\nPIL/__pycache__/ImageStat.cpython-313.pyc,,\nPIL/__pycache__/ImageTk.cpython-313.pyc,,\nPIL/__pycache__/ImageTransform.cpython-313.pyc,,\nPIL/__pycache__/ImageWin.cpython-313.pyc,,\nPIL/__pycache__/ImtImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/IptcImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/Jpeg2KImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/JpegImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/JpegPresets.cpython-313.pyc,,\nPIL/__pycache__/McIdasImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/MicImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/MpegImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/MpoImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/MspImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PSDraw.cpython-313.pyc,,\nPIL/__pycache__/PaletteFile.cpython-313.pyc,,\nPIL/__pycache__/PalmImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PcdImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PcfFontFile.cpython-313.pyc,,\nPIL/__pycache__/PcxImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PdfImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PdfParser.cpython-313.pyc,,\nPIL/__pycache__/PixarImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PngImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PpmImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/PsdImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/QoiImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/SgiImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/SpiderImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/SunImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/TarIO.cpython-313.pyc,,\nPIL/__pycache__/TgaImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/TiffImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/TiffTags.cpython-313.pyc,,\nPIL/__pycache__/WalImageFile.cpython-313.pyc,,\nPIL/__pycache__/WebPImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/WmfImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/XVThumbImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/XbmImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/XpmImagePlugin.cpython-313.pyc,,\nPIL/__pycache__/__init__.cpython-313.pyc,,\nPIL/__pycache__/__main__.cpython-313.pyc,,\nPIL/__pycache__/_binary.cpython-313.pyc,,\nPIL/__pycache__/_deprecate.cpython-313.pyc,,\nPIL/__pycache__/_tkinter_finder.cpython-313.pyc,,\nPIL/__pycache__/_typing.cpython-313.pyc,,\nPIL/__pycache__/_util.cpython-313.pyc,,\nPIL/__pycache__/_version.cpython-313.pyc,,\nPIL/__pycache__/features.cpython-313.pyc,,\nPIL/__pycache__/report.cpython-313.pyc,,\nPIL/_avif.cp313-win_amd64.pyd,sha256=LGLbv86TMpUlBQ3Chas2TkGuWrMmJhFX1BK1nD8hkkA,7828480\nPIL/_avif.pyi,sha256=zD8vAoPC8aEIVjfckLtFskRW5saiVel3-sJUA2pHaGc,66\nPIL/_binary.py,sha256=cb9p-_mwzBYumlVsWbnoTWsrLo59towA6atLOZvjO3w,2662\nPIL/_deprecate.py,sha256=-UAXsGjFgZP5LWo9n3qtrgSW8w9jZmS8_yBvhYzFX0A,2106\nPIL/_imaging.cp313-win_amd64.pyd,sha256=AQgIzR61ZK6u6Lplqy4grgf5vZy6uNuh2IkxvGhC3g8,2491392\nPIL/_imaging.pyi,sha256=0c3GC20XgHn8HaIrEYPErvCABBq_wibJlRa8A3RsUk8,899\nPIL/_imagingcms.cp313-win_amd64.pyd,sha256=nTE8oMuQ_1oFznJwPYkKjXBbQTg-8UmNkjdDl5m5YGk,266240\nPIL/_imagingcms.pyi,sha256=oB0dV9kzqnZk3CtnVzgZvwpRsPUqbltBZ19xLin7uHo,4532\nPIL/_imagingft.cp313-win_amd64.pyd,sha256=yDAjm5bMRnukyOPzmPlvqAPCVmt_pscVXxn_HG_NmR0,2011136\nPIL/_imagingft.pyi,sha256=EJ7RbmqGSewhT6E5EM1y1dmcOUdhPGP0u4Dub2KZZG0,1875\nPIL/_imagingmath.cp313-win_amd64.pyd,sha256=QDFquCitMW9lMgnXzj4Nl-uwNsuznlf2Exdb4eYdvWs,25088\nPIL/_imagingmath.pyi,sha256=zD8vAoPC8aEIVjfckLtFskRW5saiVel3-sJUA2pHaGc,66\nPIL/_imagingmorph.cp313-win_amd64.pyd,sha256=qaA_Rf6CCnRwoh_aFJFmYqpa_ahSumIPpA7r-sW0D4E,13824\nPIL/_imagingmorph.pyi,sha256=zD8vAoPC8aEIVjfckLtFskRW5saiVel3-sJUA2pHaGc,66\nPIL/_imagingtk.cp313-win_amd64.pyd,sha256=lpLOngYGZHKHKcSTLqQGcB2Mc2MUqffGohm8d7pNtFQ,14848\nPIL/_imagingtk.pyi,sha256=zD8vAoPC8aEIVjfckLtFskRW5saiVel3-sJUA2pHaGc,66\nPIL/_tkinter_finder.py,sha256=H1Uw3dV7gWHIj_osUnJFxWh1aRsQ2MdKpNP3vQwQcW0,558\nPIL/_typing.py,sha256=CN6gMruPZC60YxL7q6GFki1__cnV9pNdjyZ4or8bj1s,1305\nPIL/_util.py,sha256=c1SFb0eh9D_Sho4-YMFDZP5YOlpkOicqY7k5TCSrj_A,661\nPIL/_version.py,sha256=3szxQoJBLuHlwr0BI4V_LdVJDR8BUMLWavUP6suteuw,91\nPIL/_webp.cp313-win_amd64.pyd,sha256=3F6AE9gVwKQ0Z4fPQPWnc4IxAJv4DobZVRhsqs-SC7o,409600\nPIL/_webp.pyi,sha256=zD8vAoPC8aEIVjfckLtFskRW5saiVel3-sJUA2pHaGc,66\nPIL/features.py,sha256=6KvgHmp0TcEJepMBiFBRRaOCtDB8rHfsy_QikEs8Mwg,11840\nPIL/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0\nPIL/report.py,sha256=6m7NOv1a24577ZiJoxX89ip5JeOgf2O1F95f6-1K5aM,105\npillow-11.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4\npillow-11.3.0.dist-info/METADATA,sha256=9kqN5VBRkuotyWIwvRVvOpQAlhPyFhiyFYUBSZbAeu0,9200\npillow-11.3.0.dist-info/RECORD,,\npillow-11.3.0.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101\npillow-11.3.0.dist-info/licenses/LICENSE,sha256=GVRL9Tr2iaMxmk-1BnNw8PDWjSxTAKIVdnT174pP2WU,76724\npillow-11.3.0.dist-info/top_level.txt,sha256=riZqrk-hyZqh5f1Z0Zwii3dKfxEsByhu9cU9IODF-NY,4\npillow-11.3.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2\n
.venv\Lib\site-packages\pillow-11.3.0.dist-info\RECORD
RECORD
Other
14,015
0.7
0
0
python-kit
28
2024-02-29T16:48:08.613367
BSD-3-Clause
false
d63340c028e1a5c7b763904cd9779761
PIL\n
.venv\Lib\site-packages\pillow-11.3.0.dist-info\top_level.txt
top_level.txt
Other
4
0.5
0
0
awesome-app
671
2024-07-23T22:02:23.295446
Apache-2.0
false
d851573b415fac5c5ec32f7150727932
Wheel-Version: 1.0\nGenerator: setuptools (80.9.0)\nRoot-Is-Purelib: false\nTag: cp313-cp313-win_amd64\n\n
.venv\Lib\site-packages\pillow-11.3.0.dist-info\WHEEL
WHEEL
Other
101
0.7
0
0
awesome-app
53
2023-08-08T07:35:04.914661
Apache-2.0
false
eb6c9e665bbbd698545236600675f165
The Python Imaging Library (PIL) is\n\n Copyright © 1997-2011 by Secret Labs AB\n Copyright © 1995-2011 by Fredrik Lundh and contributors\n\nPillow is the friendly PIL fork. It is\n\n Copyright © 2010 by Jeffrey A. Clark and contributors\n\nLike PIL, Pillow is licensed under the open source MIT-CMU License:\n\nBy obtaining, using, and/or copying this software and/or its associated\ndocumentation, you agree that you have read, understood, and will comply\nwith the following terms and conditions:\n\nPermission to use, copy, modify and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted,\nprovided that the above copyright notice appears in all copies, and that\nboth that copyright notice and this permission notice appear in supporting\ndocumentation, and that the name of Secret Labs AB or the author not be\nused in advertising or publicity pertaining to distribution of the software\nwithout specific, written prior permission.\n\nSECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\nSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.\nIN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,\nINDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\nOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n \n===== brotli-1.1.0 ===== \n \nCopyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n \n===== freetype-2.13.3 ===== \n \nFREETYPE LICENSES\n-----------------\n\nThe FreeType 2 font engine is copyrighted work and cannot be used\nlegally without a software license. In order to make this project\nusable to a vast majority of developers, we distribute it under two\nmutually exclusive open-source licenses.\n\nThis means that *you* must choose *one* of the two licenses described\nbelow, then obey all its terms and conditions when using FreeType 2 in\nany of your projects or products.\n\n - The FreeType License, found in the file `docs/FTL.TXT`, which is\n similar to the original BSD license *with* an advertising clause\n that forces you to explicitly cite the FreeType project in your\n product's documentation. All details are in the license file.\n This license is suited to products which don't use the GNU General\n Public License.\n\n Note that this license is compatible to the GNU General Public\n License version 3, but not version 2.\n\n - The GNU General Public License version 2, found in\n `docs/GPLv2.TXT` (any later version can be used also), for\n programs which already use the GPL. Note that the FTL is\n incompatible with GPLv2 due to its advertisement clause.\n\nThe contributed BDF and PCF drivers come with a license similar to\nthat of the X Window System. It is compatible to the above two\nlicenses (see files `src/bdf/README` and `src/pcf/README`). The same\nholds for the source code files `src/base/fthash.c` and\n`include/freetype/internal/fthash.h`; they were part of the BDF driver\nin earlier FreeType versions.\n\nThe gzip module uses the zlib license (see `src/gzip/zlib.h`) which\ntoo is compatible to the above two licenses.\n\nThe files `src/autofit/ft-hb.c` and `src/autofit/ft-hb.h` contain code\ntaken almost verbatim from the HarfBuzz file `hb-ft.cc`, which uses\nthe 'Old MIT' license, compatible to the above two licenses.\n\nThe MD5 checksum support (only used for debugging in development\nbuilds) is in the public domain.\n\n\n--- end of LICENSE.TXT ---\n The FreeType Project LICENSE\n ----------------------------\n\n 2006-Jan-27\n\n Copyright 1996-2002, 2006 by\n David Turner, Robert Wilhelm, and Werner Lemberg\n\n\n\nIntroduction\n============\n\n The FreeType Project is distributed in several archive packages;\n some of them may contain, in addition to the FreeType font engine,\n various tools and contributions which rely on, or relate to, the\n FreeType Project.\n\n This license applies to all files found in such packages, and\n which do not fall under their own explicit license. The license\n affects thus the FreeType font engine, the test programs,\n documentation and makefiles, at the very least.\n\n This license was inspired by the BSD, Artistic, and IJG\n (Independent JPEG Group) licenses, which all encourage inclusion\n and use of free software in commercial and freeware products\n alike. As a consequence, its main points are that:\n\n o We don't promise that this software works. However, we will be\n interested in any kind of bug reports. (`as is' distribution)\n\n o You can use this software for whatever you want, in parts or\n full form, without having to pay us. (`royalty-free' usage)\n\n o You may not pretend that you wrote this software. If you use\n it, or only parts of it, in a program, you must acknowledge\n somewhere in your documentation that you have used the\n FreeType code. (`credits')\n\n We specifically permit and encourage the inclusion of this\n software, with or without modifications, in commercial products.\n We disclaim all warranties covering The FreeType Project and\n assume no liability related to The FreeType Project.\n\n\n Finally, many people asked us for a preferred form for a\n credit/disclaimer to use in compliance with this license. We thus\n encourage you to use the following text:\n\n """\n Portions of this software are copyright © <year> The FreeType\n Project (www.freetype.org). All rights reserved.\n """\n\n Please replace <year> with the value from the FreeType version you\n actually use.\n\n\nLegal Terms\n===========\n\n0. Definitions\n--------------\n\n Throughout this license, the terms `package', `FreeType Project',\n and `FreeType archive' refer to the set of files originally\n distributed by the authors (David Turner, Robert Wilhelm, and\n Werner Lemberg) as the `FreeType Project', be they named as alpha,\n beta or final release.\n\n `You' refers to the licensee, or person using the project, where\n `using' is a generic term including compiling the project's source\n code as well as linking it to form a `program' or `executable'.\n This program is referred to as `a program using the FreeType\n engine'.\n\n This license applies to all files distributed in the original\n FreeType Project, including all source code, binaries and\n documentation, unless otherwise stated in the file in its\n original, unmodified form as distributed in the original archive.\n If you are unsure whether or not a particular file is covered by\n this license, you must contact us to verify this.\n\n The FreeType Project is copyright (C) 1996-2000 by David Turner,\n Robert Wilhelm, and Werner Lemberg. All rights reserved except as\n specified below.\n\n1. No Warranty\n--------------\n\n THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\n WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO\n USE, OF THE FREETYPE PROJECT.\n\n2. Redistribution\n-----------------\n\n This license grants a worldwide, royalty-free, perpetual and\n irrevocable right and license to use, execute, perform, compile,\n display, copy, create derivative works of, distribute and\n sublicense the FreeType Project (in both source and object code\n forms) and derivative works thereof for any purpose; and to\n authorize others to exercise some or all of the rights granted\n herein, subject to the following conditions:\n\n o Redistribution of source code must retain this license file\n (`FTL.TXT') unaltered; any additions, deletions or changes to\n the original files must be clearly indicated in accompanying\n documentation. The copyright notices of the unaltered,\n original files must be preserved in all copies of source\n files.\n\n o Redistribution in binary form must provide a disclaimer that\n states that the software is based in part of the work of the\n FreeType Team, in the distribution documentation. We also\n encourage you to put an URL to the FreeType web page in your\n documentation, though this isn't mandatory.\n\n These conditions apply to any software derived from or based on\n the FreeType Project, not just the unmodified files. If you use\n our work, you must acknowledge us. However, no fee need be paid\n to us.\n\n3. Advertising\n--------------\n\n Neither the FreeType authors and contributors nor you shall use\n the name of the other for commercial, advertising, or promotional\n purposes without specific prior written permission.\n\n We suggest, but do not require, that you use one or more of the\n following phrases to refer to this software in your documentation\n or advertising materials: `FreeType Project', `FreeType Engine',\n `FreeType library', or `FreeType Distribution'.\n\n As you have not signed this license, you are not required to\n accept it. However, as the FreeType Project is copyrighted\n material, only this license, or another one contracted with the\n authors, grants you the right to use, distribute, and modify it.\n Therefore, by using, distributing, or modifying the FreeType\n Project, you indicate that you understand and accept all the terms\n of this license.\n\n4. Contacts\n-----------\n\n There are two mailing lists related to FreeType:\n\n o freetype@nongnu.org\n\n Discusses general use and applications of FreeType, as well as\n future and wanted additions to the library and distribution.\n If you are looking for support, start in this list if you\n haven't found anything to help you in the documentation.\n\n o freetype-devel@nongnu.org\n\n Discusses bugs, as well as engine internals, design issues,\n specific licenses, porting, etc.\n\n Our home page can be found at\n\n https://www.freetype.org\n\n\n--- end of FTL.TXT ---\n GNU GENERAL PUBLIC LICENSE\n Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n The licenses for most software are designed to take away your\nfreedom to share and change it. By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users. This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it. (Some other Free Software Foundation software is covered by\nthe GNU Library General Public License instead.) You can apply it to\nyour programs, too.\n\n When we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have. You must make sure that they, too, receive or can get the\nsource code. And you must show them these terms so they know their\nrights.\n\n We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware. If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n Finally, any free program is threatened constantly by software\npatents. We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary. To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n The precise terms and conditions for copying, distribution and\nmodification follow.\n \n GNU GENERAL PUBLIC LICENSE\n TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n 0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License. The "Program", below,\nrefers to any such program or work, and a "work based on the Program"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage. (Hereinafter, translation is included without limitation in\nthe term "modification".) Each licensee is addressed as "you".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope. The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n 1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n 2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n a) You must cause the modified files to carry prominent notices\n stating that you changed the files and the date of any change.\n\n b) You must cause any work that you distribute or publish, that in\n whole or in part contains or is derived from the Program or any\n part thereof, to be licensed as a whole at no charge to all third\n parties under the terms of this License.\n\n c) If the modified program normally reads commands interactively\n when run, you must cause it, when started running for such\n interactive use in the most ordinary way, to print or display an\n announcement including an appropriate copyright notice and a\n notice that there is no warranty (or else, saying that you provide\n a warranty) and that users may redistribute the program under\n these conditions, and telling the user how to view a copy of this\n License. (Exception: if the Program itself is interactive but\n does not normally print such an announcement, your work based on\n the Program is not required to print an announcement.)\n \nThese requirements apply to the modified work as a whole. If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works. But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n 3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n a) Accompany it with the complete corresponding machine-readable\n source code, which must be distributed under the terms of Sections\n 1 and 2 above on a medium customarily used for software interchange; or,\n\n b) Accompany it with a written offer, valid for at least three\n years, to give any third party, for a charge no more than your\n cost of physically performing source distribution, a complete\n machine-readable copy of the corresponding source code, to be\n distributed under the terms of Sections 1 and 2 above on a medium\n customarily used for software interchange; or,\n\n c) Accompany it with the information you received as to the offer\n to distribute corresponding source code. (This alternative is\n allowed only for noncommercial distribution and only if you\n received the program in object code or executable form with such\n an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it. For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable. However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n \n 4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License. Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n 5. You are not required to accept this License, since you have not\nsigned it. However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works. These actions are\nprohibited by law if you do not accept this License. Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n 6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions. You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n 7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all. For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices. Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n \n 8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded. In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n 9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time. Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number. If the Program\nspecifies a version number of this License which applies to it and "any\nlater version", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation. If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n 10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission. For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this. Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n NO WARRANTY\n\n 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n END OF TERMS AND CONDITIONS\n \n How to Apply These Terms to Your New Programs\n\n If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n To do so, attach the following notices to the program. It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe "copyright" line and a pointer to where the full notice is found.\n\n <one line to give the program's name and a brief idea of what it does.>\n Copyright (C) <year> <name of author>\n\n This program is free software; you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation; either version 2 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program; if not, write to the Free Software\n Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n Gnomovision version 69, Copyright (C) year name of author\n Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n This is free software, and you are welcome to redistribute it\n under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License. Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a "copyright disclaimer" for the program, if\nnecessary. Here is a sample; alter the names:\n\n Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n <signature of Ty Coon>, 1 April 1989\n Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs. If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary. If this is what you want to do, use the GNU Library General\nPublic License instead of this License.\n \n===== harfbuzz-11.2.1 ===== \n \nHarfBuzz is licensed under the so-called "Old MIT" license. Details follow.\nFor parts of HarfBuzz that are licensed under different licenses see individual\nfiles names COPYING in subdirectories where applicable.\n\nCopyright © 2010-2022 Google, Inc.\nCopyright © 2015-2020 Ebrahim Byagowi\nCopyright © 2019,2020 Facebook, Inc.\nCopyright © 2012,2015 Mozilla Foundation\nCopyright © 2011 Codethink Limited\nCopyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)\nCopyright © 2009 Keith Stribley\nCopyright © 2011 Martin Hosken and SIL International\nCopyright © 2007 Chris Wilson\nCopyright © 2005,2006,2020,2021,2022,2023 Behdad Esfahbod\nCopyright © 2004,2007,2008,2009,2010,2013,2021,2022,2023 Red Hat, Inc.\nCopyright © 1998-2005 David Turner and Werner Lemberg\nCopyright © 2016 Igalia S.L.\nCopyright © 2022 Matthias Clasen\nCopyright © 2018,2021 Khaled Hosny\nCopyright © 2018,2019,2020 Adobe, Inc\nCopyright © 2013-2015 Alexei Podtelezhnikov\n\nFor full copyright notices consult the individual files in the package.\n\n\nPermission is hereby granted, without written agreement and without\nlicense or royalty fees, to use, copy, modify, and distribute this\nsoftware and its documentation for any purpose, provided that the\nabove copyright notice and the following two paragraphs appear in\nall copies of this software.\n\nIN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR\nDIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\nARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\nIF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n\nTHE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,\nBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\nON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO\nPROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n \n===== lcms2-2.17 ===== \n \nMIT License\n\nCopyright (c) 2023 Marti Maria Saguer\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the \n"Software"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to \npermit persons to whom the Software is furnished to do so, subject\nto the following conditions:\n\nThe above copyright notice and this permission notice shall be \nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF \nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE \nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n \n===== libavif-1.3.0 ===== \n \nCopyright 2019 Joe Drago. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\nthis list of conditions and the following disclaimer in the documentation\nand/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n------------------------------------------------------------------------------\n\nFiles: src/obu.c\n\nCopyright © 2018-2019, VideoLAN and dav1d authors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n------------------------------------------------------------------------------\n\nFiles: third_party/iccjpeg/*\n\nIn plain English:\n\n1. We don't promise that this software works. (But if you find any bugs,\n please let us know!)\n2. You can use this software for whatever you want. You don't have to pay us.\n3. You may not pretend that you wrote this software. If you use it in a\n program, you must acknowledge somewhere in your documentation that\n you've used the IJG code.\n\nIn legalese:\n\nThe authors make NO WARRANTY or representation, either express or implied,\nwith respect to this software, its quality, accuracy, merchantability, or\nfitness for a particular purpose. This software is provided "AS IS", and you,\nits user, assume the entire risk as to its quality and accuracy.\n\nThis software is copyright (C) 1991-2013, Thomas G. Lane, Guido Vollbeding.\nAll Rights Reserved except as specified below.\n\nPermission is hereby granted to use, copy, modify, and distribute this\nsoftware (or portions thereof) for any purpose, without fee, subject to these\nconditions:\n(1) If any part of the source code for this software is distributed, then this\nREADME file must be included, with this copyright and no-warranty notice\nunaltered; and any additions, deletions, or changes to the original files\nmust be clearly indicated in accompanying documentation.\n(2) If only executable code is distributed, then the accompanying\ndocumentation must state that "this software is based in part on the work of\nthe Independent JPEG Group".\n(3) Permission for use of this software is granted only if the user accepts\nfull responsibility for any undesirable consequences; the authors accept\nNO LIABILITY for damages of any kind.\n\nThese conditions apply to any software derived from or based on the IJG code,\nnot just to the unmodified library. If you use our work, you ought to\nacknowledge us.\n\nPermission is NOT granted for the use of any IJG author's name or company name\nin advertising or publicity relating to this software or products derived from\nit. This software may be referred to only as "the Independent JPEG Group's\nsoftware".\n\nWe specifically permit and encourage the use of this software as the basis of\ncommercial products, provided that all warranty or liability claims are\nassumed by the product vendor.\n\n\nThe Unix configuration script "configure" was produced with GNU Autoconf.\nIt is copyright by the Free Software Foundation but is freely distributable.\nThe same holds for its supporting scripts (config.guess, config.sub,\nltmain.sh). Another support script, install-sh, is copyright by X Consortium\nbut is also freely distributable.\n\nThe IJG distribution formerly included code to read and write GIF files.\nTo avoid entanglement with the Unisys LZW patent, GIF reading support has\nbeen removed altogether, and the GIF writer has been simplified to produce\n"uncompressed GIFs". This technique does not use the LZW algorithm; the\nresulting GIF files are larger than usual, but are readable by all standard\nGIF decoders.\n\nWe are required to state that\n "The Graphics Interchange Format(c) is the Copyright property of\n CompuServe Incorporated. GIF(sm) is a Service Mark property of\n CompuServe Incorporated."\n\n------------------------------------------------------------------------------\n\nFiles: contrib/gdk-pixbuf/*\n\nCopyright 2020 Emmanuel Gil Peyrot. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\nthis list of conditions and the following disclaimer in the documentation\nand/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n------------------------------------------------------------------------------\n\nFiles: android_jni/gradlew*\n\n\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n "License" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n "Licensor" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n "Legal Entity" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n "control" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n "You" (or "Your") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n "Source" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n "Object" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n "Work" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n "Derivative Works" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n "Contribution" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, "submitted"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as "Not a Contribution."\n\n "Contributor" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a "NOTICE" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets "[]"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same "printed page" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n------------------------------------------------------------------------------\n\nFiles: third_party/libyuv/*\n\nCopyright 2011 The LibYuv Project Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the\n distribution.\n\n * Neither the name of Google nor the names of its contributors may\n be used to endorse or promote products derived from this software\n without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n \n===== libjpeg-turbo-3.1.1 ===== \n \nLEGAL ISSUES\n============\n\nIn plain English:\n\n1. We don't promise that this software works. (But if you find any bugs,\n please let us know!)\n2. You can use this software for whatever you want. You don't have to pay us.\n3. You may not pretend that you wrote this software. If you use it in a\n program, you must acknowledge somewhere in your documentation that\n you've used the IJG code.\n\nIn legalese:\n\nThe authors make NO WARRANTY or representation, either express or implied,\nwith respect to this software, its quality, accuracy, merchantability, or\nfitness for a particular purpose. This software is provided "AS IS", and you,\nits user, assume the entire risk as to its quality and accuracy.\n\nThis software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.\nAll Rights Reserved except as specified below.\n\nPermission is hereby granted to use, copy, modify, and distribute this\nsoftware (or portions thereof) for any purpose, without fee, subject to these\nconditions:\n(1) If any part of the source code for this software is distributed, then this\nREADME file must be included, with this copyright and no-warranty notice\nunaltered; and any additions, deletions, or changes to the original files\nmust be clearly indicated in accompanying documentation.\n(2) If only executable code is distributed, then the accompanying\ndocumentation must state that "this software is based in part on the work of\nthe Independent JPEG Group".\n(3) Permission for use of this software is granted only if the user accepts\nfull responsibility for any undesirable consequences; the authors accept\nNO LIABILITY for damages of any kind.\n\nThese conditions apply to any software derived from or based on the IJG code,\nnot just to the unmodified library. If you use our work, you ought to\nacknowledge us.\n\nPermission is NOT granted for the use of any IJG author's name or company name\nin advertising or publicity relating to this software or products derived from\nit. This software may be referred to only as "the Independent JPEG Group's\nsoftware".\n\nWe specifically permit and encourage the use of this software as the basis of\ncommercial products, provided that all warranty or liability claims are\nassumed by the product vendor.\n\nlibjpeg-turbo Licenses\n======================\n\nlibjpeg-turbo is covered by two compatible BSD-style open source licenses:\n\n- The IJG (Independent JPEG Group) License, which is listed in\n [README.ijg](README.ijg)\n\n This license applies to the libjpeg API library and associated programs,\n including any code inherited from libjpeg and any modifications to that\n code. Note that the libjpeg-turbo SIMD source code bears the\n [zlib License](https://opensource.org/licenses/Zlib), but in the context of\n the overall libjpeg API library, the terms of the zlib License are subsumed\n by the terms of the IJG License.\n\n- The Modified (3-clause) BSD License, which is listed below\n\n This license applies to the TurboJPEG API library and associated programs, as\n well as the build system. Note that the TurboJPEG API library wraps the\n libjpeg API library, so in the context of the overall TurboJPEG API library,\n both the terms of the IJG License and the terms of the Modified (3-clause)\n BSD License apply.\n\n\nComplying with the libjpeg-turbo Licenses\n=========================================\n\nThis section provides a roll-up of the libjpeg-turbo licensing terms, to the\nbest of our understanding. This is not a license in and of itself. It is\nintended solely for clarification.\n\n1. If you are distributing a modified version of the libjpeg-turbo source,\n then:\n\n 1. You cannot alter or remove any existing copyright or license notices\n from the source.\n\n **Origin**\n - Clause 1 of the IJG License\n - Clause 1 of the Modified BSD License\n - Clauses 1 and 3 of the zlib License\n\n 2. You must add your own copyright notice to the header of each source\n file you modified, so others can tell that you modified that file. (If\n there is not an existing copyright header in that file, then you can\n simply add a notice stating that you modified the file.)\n\n **Origin**\n - Clause 1 of the IJG License\n - Clause 2 of the zlib License\n\n 3. You must include the IJG README file, and you must not alter any of the\n copyright or license text in that file.\n\n **Origin**\n - Clause 1 of the IJG License\n\n2. If you are distributing only libjpeg-turbo binaries without the source, or\n if you are distributing an application that statically links with\n libjpeg-turbo, then:\n\n 1. Your product documentation must include a message stating:\n\n This software is based in part on the work of the Independent JPEG\n Group.\n\n **Origin**\n - Clause 2 of the IJG license\n\n 2. If your binary distribution includes or uses the TurboJPEG API, then\n your product documentation must include the text of the Modified BSD\n License (see below.)\n\n **Origin**\n - Clause 2 of the Modified BSD License\n\n3. You cannot use the name of the IJG or The libjpeg-turbo Project or the\n contributors thereof in advertising, publicity, etc.\n\n **Origin**\n - IJG License\n - Clause 3 of the Modified BSD License\n\n4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be\n free of defects, nor do we accept any liability for undesirable\n consequences resulting from your use of the software.\n\n **Origin**\n - IJG License\n - Modified BSD License\n - zlib License\n\n\nThe Modified (3-clause) BSD License\n===================================\n\nCopyright (C)2009-2024 D. R. Commander. All Rights Reserved.<br>\nCopyright (C)2015 Viktor Szathmáry. All Rights Reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n- Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n- Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n- Neither the name of the libjpeg-turbo Project nor the names of its\n contributors may be used to endorse or promote products derived from this\n software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n\nWhy Two Licenses?\n=================\n\nThe zlib License could have been used instead of the Modified (3-clause) BSD\nLicense, and since the IJG License effectively subsumes the distribution\nconditions of the zlib License, this would have effectively placed\nlibjpeg-turbo binary distributions under the IJG License. However, the IJG\nLicense specifically refers to the Independent JPEG Group and does not extend\nattribution and endorsement protections to other entities. Thus, it was\ndesirable to choose a license that granted us the same protections for new code\nthat were granted to the IJG for code derived from their software.\n \n===== libpng-1.6.49 ===== \n \nCOPYRIGHT NOTICE, DISCLAIMER, and LICENSE\n=========================================\n\nPNG Reference Library License version 2\n---------------------------------------\n\n * Copyright (c) 1995-2025 The PNG Reference Library Authors.\n * Copyright (c) 2018-2025 Cosmin Truta.\n * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.\n * Copyright (c) 1996-1997 Andreas Dilger.\n * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n\nThe software is supplied "as is", without warranty of any kind,\nexpress or implied, including, without limitation, the warranties\nof merchantability, fitness for a particular purpose, title, and\nnon-infringement. In no event shall the Copyright owners, or\nanyone distributing the software, be liable for any damages or\nother liability, whether in contract, tort or otherwise, arising\nfrom, out of, or in connection with the software, or the use or\nother dealings in the software, even if advised of the possibility\nof such damage.\n\nPermission is hereby granted to use, copy, modify, and distribute\nthis software, or portions hereof, for any purpose, without fee,\nsubject to the following restrictions:\n\n 1. The origin of this software must not be misrepresented; you\n must not claim that you wrote the original software. If you\n use this software in a product, an acknowledgment in the product\n documentation would be appreciated, but is not required.\n\n 2. Altered source versions must be plainly marked as such, and must\n not be misrepresented as being the original software.\n\n 3. This Copyright notice may not be removed or altered from any\n source or altered source distribution.\n\n\nPNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)\n-----------------------------------------------------------------------\n\nlibpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are\nCopyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are\nderived from libpng-1.0.6, and are distributed according to the same\ndisclaimer and license as libpng-1.0.6 with the following individuals\nadded to the list of Contributing Authors:\n\n Simon-Pierre Cadieux\n Eric S. Raymond\n Mans Rullgard\n Cosmin Truta\n Gilles Vollant\n James Yu\n Mandar Sahastrabuddhe\n Google Inc.\n Vadim Barkov\n\nand with the following additions to the disclaimer:\n\n There is no warranty against interference with your enjoyment of\n the library or against infringement. There is no warranty that our\n efforts or the library will fulfill any of your particular purposes\n or needs. This library is provided with all faults, and the entire\n risk of satisfactory quality, performance, accuracy, and effort is\n with the user.\n\nSome files in the "contrib" directory and some configure-generated\nfiles that are distributed with libpng have other copyright owners, and\nare released under other open source licenses.\n\nlibpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are\nCopyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from\nlibpng-0.96, and are distributed according to the same disclaimer and\nlicense as libpng-0.96, with the following individuals added to the\nlist of Contributing Authors:\n\n Tom Lane\n Glenn Randers-Pehrson\n Willem van Schaik\n\nlibpng versions 0.89, June 1996, through 0.96, May 1997, are\nCopyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,\nand are distributed according to the same disclaimer and license as\nlibpng-0.88, with the following individuals added to the list of\nContributing Authors:\n\n John Bowler\n Kevin Bracey\n Sam Bushell\n Magnus Holmgren\n Greg Roelofs\n Tom Tanner\n\nSome files in the "scripts" directory have other copyright owners,\nbut are released under this license.\n\nlibpng versions 0.5, May 1995, through 0.88, January 1996, are\nCopyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n\nFor the purposes of this copyright and license, "Contributing Authors"\nis defined as the following set of individuals:\n\n Andreas Dilger\n Dave Martindale\n Guy Eric Schalnat\n Paul Schmidt\n Tim Wegner\n\nThe PNG Reference Library is supplied "AS IS". The Contributing\nAuthors and Group 42, Inc. disclaim all warranties, expressed or\nimplied, including, without limitation, the warranties of\nmerchantability and of fitness for any purpose. The Contributing\nAuthors and Group 42, Inc. assume no liability for direct, indirect,\nincidental, special, exemplary, or consequential damages, which may\nresult from the use of the PNG Reference Library, even if advised of\nthe possibility of such damage.\n\nPermission is hereby granted to use, copy, modify, and distribute this\nsource code, or portions hereof, for any purpose, without fee, subject\nto the following restrictions:\n\n 1. The origin of this source code must not be misrepresented.\n\n 2. Altered versions must be plainly marked as such and must not\n be misrepresented as being the original source.\n\n 3. This Copyright notice may not be removed or altered from any\n source or altered source distribution.\n\nThe Contributing Authors and Group 42, Inc. specifically permit,\nwithout fee, and encourage the use of this source code as a component\nto supporting the PNG file format in commercial products. If you use\nthis source code in a product, acknowledgment is not required but would\nbe appreciated.\n \n===== libwebp-1.5.0 ===== \n \nCopyright (c) 2010, Google Inc. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the\n distribution.\n\n * Neither the name of Google nor the names of its contributors may\n be used to endorse or promote products derived from this software\n without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n \n===== openjpeg-2.5.3 ===== \n \n/*\n * The copyright in this software is being made available under the 2-clauses \n * BSD License, included below. This software may be subject to other third \n * party and contributor rights, including patent rights, and no such rights\n * are granted under this license.\n *\n * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium\n * Copyright (c) 2002-2014, Professor Benoit Macq\n * Copyright (c) 2003-2014, Antonin Descampe\n * Copyright (c) 2003-2009, Francois-Olivier Devaux\n * Copyright (c) 2005, Herve Drolon, FreeImage Team\n * Copyright (c) 2002-2003, Yannick Verschueren\n * Copyright (c) 2001-2003, David Janssens\n * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France \n * Copyright (c) 2012, CS Systemes d'Information, France\n *\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n \n===== tiff-4.7.0 ===== \n \n# LibTIFF license\n\nCopyright © 1988-1997 Sam Leffler\\nCopyright © 1991-1997 Silicon Graphics, Inc.\n\nPermission to use, copy, modify, distribute, and sell this software and \nits documentation for any purpose is hereby granted without fee, provided\nthat (i) the above copyright notices and this permission notice appear in\nall copies of the software and related documentation, and (ii) the names of\nSam Leffler and Silicon Graphics may not be used in any advertising or\npublicity relating to the software without the specific, prior written\npermission of Sam Leffler and Silicon Graphics.\n\nTHE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, \nEXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY \nWARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. \n\nIN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR\nANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,\nOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF \nLIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE \nOF THIS SOFTWARE.\n \n===== xz-5.8.1 ===== \n \n\nXZ Utils Licensing\n==================\n\n Different licenses apply to different files in this package. Here\n is a summary of which licenses apply to which parts of this package:\n\n - liblzma is under the BSD Zero Clause License (0BSD).\n\n - The command line tools xz, xzdec, lzmadec, and lzmainfo are\n under 0BSD except that, on systems that don't have a usable\n getopt_long, GNU getopt_long is compiled and linked in from the\n 'lib' directory. The getopt_long code is under GNU LGPLv2.1+.\n\n - The scripts to grep, diff, and view compressed files have been\n adapted from GNU gzip. These scripts (xzgrep, xzdiff, xzless,\n and xzmore) are under GNU GPLv2+. The man pages of the scripts\n are under 0BSD; they aren't based on the man pages of GNU gzip.\n\n - Most of the XZ Utils specific documentation that is in\n plain text files (like README, INSTALL, PACKAGERS, NEWS,\n and ChangeLog) are under 0BSD unless stated otherwise in\n the file itself. The files xz-file-format.txt and\n lzma-file-format.xt are in the public domain but may\n be distributed under the terms of 0BSD too.\n\n - Translated messages and man pages are under 0BSD except that\n some old translations are in the public domain.\n\n - Test files and test code in the 'tests' directory, and\n debugging utilities in the 'debug' directory are under\n the BSD Zero Clause License (0BSD).\n\n - The GNU Autotools based build system contains files that are\n under GNU GPLv2+, GNU GPLv3+, and a few permissive licenses.\n These files don't affect the licensing of the binaries being\n built.\n\n - The 'extra' directory contains files that are under various\n free software licenses. These aren't built or installed as\n part of XZ Utils.\n\n The following command may be helpful in finding per-file license\n information. It works on xz.git and on a clean file tree extracted\n from a release tarball.\n\n sh build-aux/license-check.sh -v\n\n For the files under the BSD Zero Clause License (0BSD), if\n a copyright notice is needed, the following is sufficient:\n\n Copyright (C) The XZ Utils authors and contributors\n\n If you copy significant amounts of 0BSD-licensed code from XZ Utils\n into your project, acknowledging this somewhere in your software is\n polite (especially if it is proprietary, non-free software), but\n it is not legally required by the license terms. Here is an example\n of a good notice to put into "about box" or into documentation:\n\n This software includes code from XZ Utils <https://tukaani.org/xz/>.\n\n The following license texts are included in the following files:\n - COPYING.0BSD: BSD Zero Clause License\n - COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1\n - COPYING.GPLv2: GNU General Public License version 2\n - COPYING.GPLv3: GNU General Public License version 3\n\n If you have questions, don't hesitate to ask for more information.\n The contact information is in the README file.\n\n \n===== zlib-ng-2.2.4 ===== \n \n(C) 1995-2024 Jean-loup Gailly and Mark Adler\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n claim that you wrote the original software. If you use this software\n in a product, an acknowledgment in the product documentation would be\n appreciated but is not required.\n\n2. Altered source versions must be plainly marked as such, and must not be\n misrepresented as being the original software.\n\n3. This notice may not be removed or altered from any source distribution.\n
.venv\Lib\site-packages\pillow-11.3.0.dist-info\licenses\LICENSE
LICENSE
Other
76,724
0.75
0.077358
0.046437
react-lib
822
2024-04-25T07:13:35.262762
BSD-3-Clause
false
0948042fec83f862170c1e41cc2412f2
pip is a command line program. While it is implemented in Python, and so is\navailable for import, you must not use pip's internal APIs in this way. Typing\ninformation is provided as a convenience only and is not a guarantee. Expect\nunannounced changes to the API and types in releases.\n
.venv\Lib\site-packages\pip\py.typed
py.typed
Other
286
0.85
0.25
0
node-utils
324
2024-06-18T07:31:20.161126
GPL-3.0
false
c1d1d04b2a337d563ce02adcac204386
from typing import List, Optional\n\n__version__ = "25.1.1"\n\n\ndef main(args: Optional[List[str]] = None) -> int:\n """This is an internal API only meant for use by pip's own console scripts.\n\n For additional details, see https://github.com/pypa/pip/issues/7498.\n """\n from pip._internal.utils.entrypoints import _wrapper\n\n return _wrapper(args)\n
.venv\Lib\site-packages\pip\__init__.py
__init__.py
Python
357
0.95
0.153846
0
react-lib
115
2024-02-07T15:42:05.176245
BSD-3-Clause
false
df4944c6c78c2de07c8e1ee2a99e661b
import os\nimport sys\n\n# Remove '' and current working directory from the first entry\n# of sys.path, if present to avoid using current directory\n# in pip commands check, freeze, install, list and show,\n# when invoked as python -m pip <command>\nif sys.path[0] in ("", os.getcwd()):\n sys.path.pop(0)\n\n# If we are running from a wheel, add the wheel to sys.path\n# This allows the usage python pip-*.whl/pip install pip-*.whl\nif __package__ == "":\n # __file__ is pip-*.whl/pip/__main__.py\n # first dirname call strips of '/__main__.py', second strips off '/pip'\n # Resulting path is the name of the wheel itself\n # Add that to sys.path so we can import pip\n path = os.path.dirname(os.path.dirname(__file__))\n sys.path.insert(0, path)\n\nif __name__ == "__main__":\n from pip._internal.cli.main import main as _main\n\n sys.exit(_main())\n
.venv\Lib\site-packages\pip\__main__.py
__main__.py
Python
854
0.95
0.166667
0.5
awesome-app
138
2025-03-13T06:03:14.767396
GPL-3.0
false
a56e19f54a80e824d64e8f72c9ee78e8
"""Execute exactly this copy of pip, within a different environment.\n\nThis file is named as it is, to ensure that this module can't be imported via\nan import statement.\n"""\n\n# /!\ This version compatibility check section must be Python 2 compatible. /!\\n\nimport sys\n\n# Copied from pyproject.toml\nPYTHON_REQUIRES = (3, 9)\n\n\ndef version_str(version): # type: ignore\n return ".".join(str(v) for v in version)\n\n\nif sys.version_info[:2] < PYTHON_REQUIRES:\n raise SystemExit(\n "This version of pip does not support python {} (requires >={}).".format(\n version_str(sys.version_info[:2]), version_str(PYTHON_REQUIRES)\n )\n )\n\n# From here on, we can use Python 3 features, but the syntax must remain\n# Python 2 compatible.\n\nimport runpy # noqa: E402\nfrom importlib.machinery import PathFinder # noqa: E402\nfrom os.path import dirname # noqa: E402\n\nPIP_SOURCES_ROOT = dirname(dirname(__file__))\n\n\nclass PipImportRedirectingFinder:\n @classmethod\n def find_spec(self, fullname, path=None, target=None): # type: ignore\n if fullname != "pip":\n return None\n\n spec = PathFinder.find_spec(fullname, [PIP_SOURCES_ROOT], target)\n assert spec, (PIP_SOURCES_ROOT, fullname)\n return spec\n\n\nsys.meta_path.insert(0, PipImportRedirectingFinder())\n\nassert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module"\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n
.venv\Lib\site-packages\pip\__pip-runner__.py
__pip-runner__.py
Python
1,450
0.95
0.12
0.121212
node-utils
435
2024-08-27T11:00:46.281326
MIT
false
b26a66b1e8744f47e8aa21dd8038b038
"""Build Environment used for isolation during sdist building"""\n\nimport logging\nimport os\nimport pathlib\nimport site\nimport sys\nimport textwrap\nfrom collections import OrderedDict\nfrom types import TracebackType\nfrom typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Type, Union\n\nfrom pip._vendor.packaging.version import Version\n\nfrom pip import __file__ as pip_location\nfrom pip._internal.cli.spinners import open_spinner\nfrom pip._internal.locations import get_platlib, get_purelib, get_scheme\nfrom pip._internal.metadata import get_default_environment, get_environment\nfrom pip._internal.utils.logging import VERBOSE\nfrom pip._internal.utils.packaging import get_requirement\nfrom pip._internal.utils.subprocess import call_subprocess\nfrom pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds\n\nif TYPE_CHECKING:\n from pip._internal.index.package_finder import PackageFinder\n\nlogger = logging.getLogger(__name__)\n\n\ndef _dedup(a: str, b: str) -> Union[Tuple[str], Tuple[str, str]]:\n return (a, b) if a != b else (a,)\n\n\nclass _Prefix:\n def __init__(self, path: str) -> None:\n self.path = path\n self.setup = False\n scheme = get_scheme("", prefix=path)\n self.bin_dir = scheme.scripts\n self.lib_dirs = _dedup(scheme.purelib, scheme.platlib)\n\n\ndef get_runnable_pip() -> str:\n """Get a file to pass to a Python executable, to run the currently-running pip.\n\n This is used to run a pip subprocess, for installing requirements into the build\n environment.\n """\n source = pathlib.Path(pip_location).resolve().parent\n\n if not source.is_dir():\n # This would happen if someone is using pip from inside a zip file. In that\n # case, we can use that directly.\n return str(source)\n\n return os.fsdecode(source / "__pip-runner__.py")\n\n\ndef _get_system_sitepackages() -> Set[str]:\n """Get system site packages\n\n Usually from site.getsitepackages,\n but fallback on `get_purelib()/get_platlib()` if unavailable\n (e.g. in a virtualenv created by virtualenv<20)\n\n Returns normalized set of strings.\n """\n if hasattr(site, "getsitepackages"):\n system_sites = site.getsitepackages()\n else:\n # virtualenv < 20 overwrites site.py without getsitepackages\n # fallback on get_purelib/get_platlib.\n # this is known to miss things, but shouldn't in the cases\n # where getsitepackages() has been removed (inside a virtualenv)\n system_sites = [get_purelib(), get_platlib()]\n return {os.path.normcase(path) for path in system_sites}\n\n\nclass BuildEnvironment:\n """Creates and manages an isolated environment to install build deps"""\n\n def __init__(self) -> None:\n temp_dir = TempDirectory(kind=tempdir_kinds.BUILD_ENV, globally_managed=True)\n\n self._prefixes = OrderedDict(\n (name, _Prefix(os.path.join(temp_dir.path, name)))\n for name in ("normal", "overlay")\n )\n\n self._bin_dirs: List[str] = []\n self._lib_dirs: List[str] = []\n for prefix in reversed(list(self._prefixes.values())):\n self._bin_dirs.append(prefix.bin_dir)\n self._lib_dirs.extend(prefix.lib_dirs)\n\n # Customize site to:\n # - ensure .pth files are honored\n # - prevent access to system site packages\n system_sites = _get_system_sitepackages()\n\n self._site_dir = os.path.join(temp_dir.path, "site")\n if not os.path.exists(self._site_dir):\n os.mkdir(self._site_dir)\n with open(\n os.path.join(self._site_dir, "sitecustomize.py"), "w", encoding="utf-8"\n ) as fp:\n fp.write(\n textwrap.dedent(\n """\n import os, site, sys\n\n # First, drop system-sites related paths.\n original_sys_path = sys.path[:]\n known_paths = set()\n for path in {system_sites!r}:\n site.addsitedir(path, known_paths=known_paths)\n system_paths = set(\n os.path.normcase(path)\n for path in sys.path[len(original_sys_path):]\n )\n original_sys_path = [\n path for path in original_sys_path\n if os.path.normcase(path) not in system_paths\n ]\n sys.path = original_sys_path\n\n # Second, add lib directories.\n # ensuring .pth file are processed.\n for path in {lib_dirs!r}:\n assert not path in sys.path\n site.addsitedir(path)\n """\n ).format(system_sites=system_sites, lib_dirs=self._lib_dirs)\n )\n\n def __enter__(self) -> None:\n self._save_env = {\n name: os.environ.get(name, None)\n for name in ("PATH", "PYTHONNOUSERSITE", "PYTHONPATH")\n }\n\n path = self._bin_dirs[:]\n old_path = self._save_env["PATH"]\n if old_path:\n path.extend(old_path.split(os.pathsep))\n\n pythonpath = [self._site_dir]\n\n os.environ.update(\n {\n "PATH": os.pathsep.join(path),\n "PYTHONNOUSERSITE": "1",\n "PYTHONPATH": os.pathsep.join(pythonpath),\n }\n )\n\n def __exit__(\n self,\n exc_type: Optional[Type[BaseException]],\n exc_val: Optional[BaseException],\n exc_tb: Optional[TracebackType],\n ) -> None:\n for varname, old_value in self._save_env.items():\n if old_value is None:\n os.environ.pop(varname, None)\n else:\n os.environ[varname] = old_value\n\n def check_requirements(\n self, reqs: Iterable[str]\n ) -> Tuple[Set[Tuple[str, str]], Set[str]]:\n """Return 2 sets:\n - conflicting requirements: set of (installed, wanted) reqs tuples\n - missing requirements: set of reqs\n """\n missing = set()\n conflicting = set()\n if reqs:\n env = (\n get_environment(self._lib_dirs)\n if hasattr(self, "_lib_dirs")\n else get_default_environment()\n )\n for req_str in reqs:\n req = get_requirement(req_str)\n # We're explicitly evaluating with an empty extra value, since build\n # environments are not provided any mechanism to select specific extras.\n if req.marker is not None and not req.marker.evaluate({"extra": ""}):\n continue\n dist = env.get_distribution(req.name)\n if not dist:\n missing.add(req_str)\n continue\n if isinstance(dist.version, Version):\n installed_req_str = f"{req.name}=={dist.version}"\n else:\n installed_req_str = f"{req.name}==={dist.version}"\n if not req.specifier.contains(dist.version, prereleases=True):\n conflicting.add((installed_req_str, req_str))\n # FIXME: Consider direct URL?\n return conflicting, missing\n\n def install_requirements(\n self,\n finder: "PackageFinder",\n requirements: Iterable[str],\n prefix_as_string: str,\n *,\n kind: str,\n ) -> None:\n prefix = self._prefixes[prefix_as_string]\n assert not prefix.setup\n prefix.setup = True\n if not requirements:\n return\n self._install_requirements(\n get_runnable_pip(),\n finder,\n requirements,\n prefix,\n kind=kind,\n )\n\n @staticmethod\n def _install_requirements(\n pip_runnable: str,\n finder: "PackageFinder",\n requirements: Iterable[str],\n prefix: _Prefix,\n *,\n kind: str,\n ) -> None:\n args: List[str] = [\n sys.executable,\n pip_runnable,\n "install",\n "--ignore-installed",\n "--no-user",\n "--prefix",\n prefix.path,\n "--no-warn-script-location",\n "--disable-pip-version-check",\n # As the build environment is ephemeral, it's wasteful to\n # pre-compile everything, especially as not every Python\n # module will be used/compiled in most cases.\n "--no-compile",\n # The prefix specified two lines above, thus\n # target from config file or env var should be ignored\n "--target",\n "",\n ]\n if logger.getEffectiveLevel() <= logging.DEBUG:\n args.append("-vv")\n elif logger.getEffectiveLevel() <= VERBOSE:\n args.append("-v")\n for format_control in ("no_binary", "only_binary"):\n formats = getattr(finder.format_control, format_control)\n args.extend(\n (\n "--" + format_control.replace("_", "-"),\n ",".join(sorted(formats or {":none:"})),\n )\n )\n\n index_urls = finder.index_urls\n if index_urls:\n args.extend(["-i", index_urls[0]])\n for extra_index in index_urls[1:]:\n args.extend(["--extra-index-url", extra_index])\n else:\n args.append("--no-index")\n for link in finder.find_links:\n args.extend(["--find-links", link])\n\n if finder.proxy:\n args.extend(["--proxy", finder.proxy])\n for host in finder.trusted_hosts:\n args.extend(["--trusted-host", host])\n if finder.custom_cert:\n args.extend(["--cert", finder.custom_cert])\n if finder.client_cert:\n args.extend(["--client-cert", finder.client_cert])\n if finder.allow_all_prereleases:\n args.append("--pre")\n if finder.prefer_binary:\n args.append("--prefer-binary")\n args.append("--")\n args.extend(requirements)\n with open_spinner(f"Installing {kind}") as spinner:\n call_subprocess(\n args,\n command_desc=f"pip subprocess to install {kind}",\n spinner=spinner,\n )\n\n\nclass NoOpBuildEnvironment(BuildEnvironment):\n """A no-op drop-in replacement for BuildEnvironment"""\n\n def __init__(self) -> None:\n pass\n\n def __enter__(self) -> None:\n pass\n\n def __exit__(\n self,\n exc_type: Optional[Type[BaseException]],\n exc_val: Optional[BaseException],\n exc_tb: Optional[TracebackType],\n ) -> None:\n pass\n\n def cleanup(self) -> None:\n pass\n\n def install_requirements(\n self,\n finder: "PackageFinder",\n requirements: Iterable[str],\n prefix_as_string: str,\n *,\n kind: str,\n ) -> None:\n raise NotImplementedError()\n
.venv\Lib\site-packages\pip\_internal\build_env.py
build_env.py
Python
10,924
0.95
0.181538
0.081851
python-kit
563
2023-08-12T08:40:37.407861
GPL-3.0
false
19b77e61a2b50b2154bdd75f470125fd
"""Cache Management"""\n\nimport hashlib\nimport json\nimport logging\nimport os\nfrom pathlib import Path\nfrom typing import Any, Dict, List, Optional\n\nfrom pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version\nfrom pip._vendor.packaging.utils import canonicalize_name\n\nfrom pip._internal.exceptions import InvalidWheelFilename\nfrom pip._internal.models.direct_url import DirectUrl\nfrom pip._internal.models.link import Link\nfrom pip._internal.models.wheel import Wheel\nfrom pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds\nfrom pip._internal.utils.urls import path_to_url\n\nlogger = logging.getLogger(__name__)\n\nORIGIN_JSON_NAME = "origin.json"\n\n\ndef _hash_dict(d: Dict[str, str]) -> str:\n """Return a stable sha224 of a dictionary."""\n s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True)\n return hashlib.sha224(s.encode("ascii")).hexdigest()\n\n\nclass Cache:\n """An abstract class - provides cache directories for data from links\n\n :param cache_dir: The root of the cache.\n """\n\n def __init__(self, cache_dir: str) -> None:\n super().__init__()\n assert not cache_dir or os.path.isabs(cache_dir)\n self.cache_dir = cache_dir or None\n\n def _get_cache_path_parts(self, link: Link) -> List[str]:\n """Get parts of part that must be os.path.joined with cache_dir"""\n\n # We want to generate an url to use as our cache key, we don't want to\n # just reuse the URL because it might have other items in the fragment\n # and we don't care about those.\n key_parts = {"url": link.url_without_fragment}\n if link.hash_name is not None and link.hash is not None:\n key_parts[link.hash_name] = link.hash\n if link.subdirectory_fragment:\n key_parts["subdirectory"] = link.subdirectory_fragment\n\n # Include interpreter name, major and minor version in cache key\n # to cope with ill-behaved sdists that build a different wheel\n # depending on the python version their setup.py is being run on,\n # and don't encode the difference in compatibility tags.\n # https://github.com/pypa/pip/issues/7296\n key_parts["interpreter_name"] = interpreter_name()\n key_parts["interpreter_version"] = interpreter_version()\n\n # Encode our key url with sha224, we'll use this because it has similar\n # security properties to sha256, but with a shorter total output (and\n # thus less secure). However the differences don't make a lot of\n # difference for our use case here.\n hashed = _hash_dict(key_parts)\n\n # We want to nest the directories some to prevent having a ton of top\n # level directories where we might run out of sub directories on some\n # FS.\n parts = [hashed[:2], hashed[2:4], hashed[4:6], hashed[6:]]\n\n return parts\n\n def _get_candidates(self, link: Link, canonical_package_name: str) -> List[Any]:\n can_not_cache = not self.cache_dir or not canonical_package_name or not link\n if can_not_cache:\n return []\n\n path = self.get_path_for_link(link)\n if os.path.isdir(path):\n return [(candidate, path) for candidate in os.listdir(path)]\n return []\n\n def get_path_for_link(self, link: Link) -> str:\n """Return a directory to store cached items in for link."""\n raise NotImplementedError()\n\n def get(\n self,\n link: Link,\n package_name: Optional[str],\n supported_tags: List[Tag],\n ) -> Link:\n """Returns a link to a cached item if it exists, otherwise returns the\n passed link.\n """\n raise NotImplementedError()\n\n\nclass SimpleWheelCache(Cache):\n """A cache of wheels for future installs."""\n\n def __init__(self, cache_dir: str) -> None:\n super().__init__(cache_dir)\n\n def get_path_for_link(self, link: Link) -> str:\n """Return a directory to store cached wheels for link\n\n Because there are M wheels for any one sdist, we provide a directory\n to cache them in, and then consult that directory when looking up\n cache hits.\n\n We only insert things into the cache if they have plausible version\n numbers, so that we don't contaminate the cache with things that were\n not unique. E.g. ./package might have dozens of installs done for it\n and build a version of 0.0...and if we built and cached a wheel, we'd\n end up using the same wheel even if the source has been edited.\n\n :param link: The link of the sdist for which this will cache wheels.\n """\n parts = self._get_cache_path_parts(link)\n assert self.cache_dir\n # Store wheels within the root cache_dir\n return os.path.join(self.cache_dir, "wheels", *parts)\n\n def get(\n self,\n link: Link,\n package_name: Optional[str],\n supported_tags: List[Tag],\n ) -> Link:\n candidates = []\n\n if not package_name:\n return link\n\n canonical_package_name = canonicalize_name(package_name)\n for wheel_name, wheel_dir in self._get_candidates(link, canonical_package_name):\n try:\n wheel = Wheel(wheel_name)\n except InvalidWheelFilename:\n continue\n if canonicalize_name(wheel.name) != canonical_package_name:\n logger.debug(\n "Ignoring cached wheel %s for %s as it "\n "does not match the expected distribution name %s.",\n wheel_name,\n link,\n package_name,\n )\n continue\n if not wheel.supported(supported_tags):\n # Built for a different python/arch/etc\n continue\n candidates.append(\n (\n wheel.support_index_min(supported_tags),\n wheel_name,\n wheel_dir,\n )\n )\n\n if not candidates:\n return link\n\n _, wheel_name, wheel_dir = min(candidates)\n return Link(path_to_url(os.path.join(wheel_dir, wheel_name)))\n\n\nclass EphemWheelCache(SimpleWheelCache):\n """A SimpleWheelCache that creates it's own temporary cache directory"""\n\n def __init__(self) -> None:\n self._temp_dir = TempDirectory(\n kind=tempdir_kinds.EPHEM_WHEEL_CACHE,\n globally_managed=True,\n )\n\n super().__init__(self._temp_dir.path)\n\n\nclass CacheEntry:\n def __init__(\n self,\n link: Link,\n persistent: bool,\n ):\n self.link = link\n self.persistent = persistent\n self.origin: Optional[DirectUrl] = None\n origin_direct_url_path = Path(self.link.file_path).parent / ORIGIN_JSON_NAME\n if origin_direct_url_path.exists():\n try:\n self.origin = DirectUrl.from_json(\n origin_direct_url_path.read_text(encoding="utf-8")\n )\n except Exception as e:\n logger.warning(\n "Ignoring invalid cache entry origin file %s for %s (%s)",\n origin_direct_url_path,\n link.filename,\n e,\n )\n\n\nclass WheelCache(Cache):\n """Wraps EphemWheelCache and SimpleWheelCache into a single Cache\n\n This Cache allows for gracefully degradation, using the ephem wheel cache\n when a certain link is not found in the simple wheel cache first.\n """\n\n def __init__(self, cache_dir: str) -> None:\n super().__init__(cache_dir)\n self._wheel_cache = SimpleWheelCache(cache_dir)\n self._ephem_cache = EphemWheelCache()\n\n def get_path_for_link(self, link: Link) -> str:\n return self._wheel_cache.get_path_for_link(link)\n\n def get_ephem_path_for_link(self, link: Link) -> str:\n return self._ephem_cache.get_path_for_link(link)\n\n def get(\n self,\n link: Link,\n package_name: Optional[str],\n supported_tags: List[Tag],\n ) -> Link:\n cache_entry = self.get_cache_entry(link, package_name, supported_tags)\n if cache_entry is None:\n return link\n return cache_entry.link\n\n def get_cache_entry(\n self,\n link: Link,\n package_name: Optional[str],\n supported_tags: List[Tag],\n ) -> Optional[CacheEntry]:\n """Returns a CacheEntry with a link to a cached item if it exists or\n None. The cache entry indicates if the item was found in the persistent\n or ephemeral cache.\n """\n retval = self._wheel_cache.get(\n link=link,\n package_name=package_name,\n supported_tags=supported_tags,\n )\n if retval is not link:\n return CacheEntry(retval, persistent=True)\n\n retval = self._ephem_cache.get(\n link=link,\n package_name=package_name,\n supported_tags=supported_tags,\n )\n if retval is not link:\n return CacheEntry(retval, persistent=False)\n\n return None\n\n @staticmethod\n def record_download_origin(cache_dir: str, download_info: DirectUrl) -> None:\n origin_path = Path(cache_dir) / ORIGIN_JSON_NAME\n if origin_path.exists():\n try:\n origin = DirectUrl.from_json(origin_path.read_text(encoding="utf-8"))\n except Exception as e:\n logger.warning(\n "Could not read origin file %s in cache entry (%s). "\n "Will attempt to overwrite it.",\n origin_path,\n e,\n )\n else:\n # TODO: use DirectUrl.equivalent when\n # https://github.com/pypa/pip/pull/10564 is merged.\n if origin.url != download_info.url:\n logger.warning(\n "Origin URL %s in cache entry %s does not match download URL "\n "%s. This is likely a pip bug or a cache corruption issue. "\n "Will overwrite it with the new value.",\n origin.url,\n cache_dir,\n download_info.url,\n )\n origin_path.write_text(download_info.to_json(), encoding="utf-8")\n
.venv\Lib\site-packages\pip\_internal\cache.py
cache.py
Python
10,368
0.95
0.207612
0.079498
react-lib
498
2024-01-12T08:51:32.674186
MIT
false
8c68061c913be2734016cb4e7cd3bafb
"""Configuration management setup\n\nSome terminology:\n- name\n As written in config files.\n- value\n Value associated with a name\n- key\n Name combined with it's section (section.name)\n- variant\n A single word describing where the configuration key-value pair came from\n"""\n\nimport configparser\nimport locale\nimport os\nimport sys\nfrom typing import Any, Dict, Iterable, List, NewType, Optional, Tuple\n\nfrom pip._internal.exceptions import (\n ConfigurationError,\n ConfigurationFileCouldNotBeLoaded,\n)\nfrom pip._internal.utils import appdirs\nfrom pip._internal.utils.compat import WINDOWS\nfrom pip._internal.utils.logging import getLogger\nfrom pip._internal.utils.misc import ensure_dir, enum\n\nRawConfigParser = configparser.RawConfigParser # Shorthand\nKind = NewType("Kind", str)\n\nCONFIG_BASENAME = "pip.ini" if WINDOWS else "pip.conf"\nENV_NAMES_IGNORED = "version", "help"\n\n# The kinds of configurations there are.\nkinds = enum(\n USER="user", # User Specific\n GLOBAL="global", # System Wide\n SITE="site", # [Virtual] Environment Specific\n ENV="env", # from PIP_CONFIG_FILE\n ENV_VAR="env-var", # from Environment Variables\n)\nOVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR\nVALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE\n\nlogger = getLogger(__name__)\n\n\n# NOTE: Maybe use the optionx attribute to normalize keynames.\ndef _normalize_name(name: str) -> str:\n """Make a name consistent regardless of source (environment or file)"""\n name = name.lower().replace("_", "-")\n if name.startswith("--"):\n name = name[2:] # only prefer long opts\n return name\n\n\ndef _disassemble_key(name: str) -> List[str]:\n if "." not in name:\n error_message = (\n "Key does not contain dot separated section and key. "\n f"Perhaps you wanted to use 'global.{name}' instead?"\n )\n raise ConfigurationError(error_message)\n return name.split(".", 1)\n\n\ndef get_configuration_files() -> Dict[Kind, List[str]]:\n global_config_files = [\n os.path.join(path, CONFIG_BASENAME) for path in appdirs.site_config_dirs("pip")\n ]\n\n site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME)\n legacy_config_file = os.path.join(\n os.path.expanduser("~"),\n "pip" if WINDOWS else ".pip",\n CONFIG_BASENAME,\n )\n new_config_file = os.path.join(appdirs.user_config_dir("pip"), CONFIG_BASENAME)\n return {\n kinds.GLOBAL: global_config_files,\n kinds.SITE: [site_config_file],\n kinds.USER: [legacy_config_file, new_config_file],\n }\n\n\nclass Configuration:\n """Handles management of configuration.\n\n Provides an interface to accessing and managing configuration files.\n\n This class converts provides an API that takes "section.key-name" style\n keys and stores the value associated with it as "key-name" under the\n section "section".\n\n This allows for a clean interface wherein the both the section and the\n key-name are preserved in an easy to manage form in the configuration files\n and the data stored is also nice.\n """\n\n def __init__(self, isolated: bool, load_only: Optional[Kind] = None) -> None:\n super().__init__()\n\n if load_only is not None and load_only not in VALID_LOAD_ONLY:\n raise ConfigurationError(\n "Got invalid value for load_only - should be one of {}".format(\n ", ".join(map(repr, VALID_LOAD_ONLY))\n )\n )\n self.isolated = isolated\n self.load_only = load_only\n\n # Because we keep track of where we got the data from\n self._parsers: Dict[Kind, List[Tuple[str, RawConfigParser]]] = {\n variant: [] for variant in OVERRIDE_ORDER\n }\n self._config: Dict[Kind, Dict[str, Any]] = {\n variant: {} for variant in OVERRIDE_ORDER\n }\n self._modified_parsers: List[Tuple[str, RawConfigParser]] = []\n\n def load(self) -> None:\n """Loads configuration from configuration files and environment"""\n self._load_config_files()\n if not self.isolated:\n self._load_environment_vars()\n\n def get_file_to_edit(self) -> Optional[str]:\n """Returns the file with highest priority in configuration"""\n assert self.load_only is not None, "Need to be specified a file to be editing"\n\n try:\n return self._get_parser_to_modify()[0]\n except IndexError:\n return None\n\n def items(self) -> Iterable[Tuple[str, Any]]:\n """Returns key-value pairs like dict.items() representing the loaded\n configuration\n """\n return self._dictionary.items()\n\n def get_value(self, key: str) -> Any:\n """Get a value from the configuration."""\n orig_key = key\n key = _normalize_name(key)\n try:\n return self._dictionary[key]\n except KeyError:\n # disassembling triggers a more useful error message than simply\n # "No such key" in the case that the key isn't in the form command.option\n _disassemble_key(key)\n raise ConfigurationError(f"No such key - {orig_key}")\n\n def set_value(self, key: str, value: Any) -> None:\n """Modify a value in the configuration."""\n key = _normalize_name(key)\n self._ensure_have_load_only()\n\n assert self.load_only\n fname, parser = self._get_parser_to_modify()\n\n if parser is not None:\n section, name = _disassemble_key(key)\n\n # Modify the parser and the configuration\n if not parser.has_section(section):\n parser.add_section(section)\n parser.set(section, name, value)\n\n self._config[self.load_only][key] = value\n self._mark_as_modified(fname, parser)\n\n def unset_value(self, key: str) -> None:\n """Unset a value in the configuration."""\n orig_key = key\n key = _normalize_name(key)\n self._ensure_have_load_only()\n\n assert self.load_only\n if key not in self._config[self.load_only]:\n raise ConfigurationError(f"No such key - {orig_key}")\n\n fname, parser = self._get_parser_to_modify()\n\n if parser is not None:\n section, name = _disassemble_key(key)\n if not (\n parser.has_section(section) and parser.remove_option(section, name)\n ):\n # The option was not removed.\n raise ConfigurationError(\n "Fatal Internal error [id=1]. Please report as a bug."\n )\n\n # The section may be empty after the option was removed.\n if not parser.items(section):\n parser.remove_section(section)\n self._mark_as_modified(fname, parser)\n\n del self._config[self.load_only][key]\n\n def save(self) -> None:\n """Save the current in-memory state."""\n self._ensure_have_load_only()\n\n for fname, parser in self._modified_parsers:\n logger.info("Writing to %s", fname)\n\n # Ensure directory exists.\n ensure_dir(os.path.dirname(fname))\n\n # Ensure directory's permission(need to be writeable)\n try:\n with open(fname, "w") as f:\n parser.write(f)\n except OSError as error:\n raise ConfigurationError(\n f"An error occurred while writing to the configuration file "\n f"{fname}: {error}"\n )\n\n #\n # Private routines\n #\n\n def _ensure_have_load_only(self) -> None:\n if self.load_only is None:\n raise ConfigurationError("Needed a specific file to be modifying.")\n logger.debug("Will be working with %s variant only", self.load_only)\n\n @property\n def _dictionary(self) -> Dict[str, Any]:\n """A dictionary representing the loaded configuration."""\n # NOTE: Dictionaries are not populated if not loaded. So, conditionals\n # are not needed here.\n retval = {}\n\n for variant in OVERRIDE_ORDER:\n retval.update(self._config[variant])\n\n return retval\n\n def _load_config_files(self) -> None:\n """Loads configuration from configuration files"""\n config_files = dict(self.iter_config_files())\n if config_files[kinds.ENV][0:1] == [os.devnull]:\n logger.debug(\n "Skipping loading configuration files due to "\n "environment's PIP_CONFIG_FILE being os.devnull"\n )\n return\n\n for variant, files in config_files.items():\n for fname in files:\n # If there's specific variant set in `load_only`, load only\n # that variant, not the others.\n if self.load_only is not None and variant != self.load_only:\n logger.debug("Skipping file '%s' (variant: %s)", fname, variant)\n continue\n\n parser = self._load_file(variant, fname)\n\n # Keeping track of the parsers used\n self._parsers[variant].append((fname, parser))\n\n def _load_file(self, variant: Kind, fname: str) -> RawConfigParser:\n logger.verbose("For variant '%s', will try loading '%s'", variant, fname)\n parser = self._construct_parser(fname)\n\n for section in parser.sections():\n items = parser.items(section)\n self._config[variant].update(self._normalized_keys(section, items))\n\n return parser\n\n def _construct_parser(self, fname: str) -> RawConfigParser:\n parser = configparser.RawConfigParser()\n # If there is no such file, don't bother reading it but create the\n # parser anyway, to hold the data.\n # Doing this is useful when modifying and saving files, where we don't\n # need to construct a parser.\n if os.path.exists(fname):\n locale_encoding = locale.getpreferredencoding(False)\n try:\n parser.read(fname, encoding=locale_encoding)\n except UnicodeDecodeError:\n # See https://github.com/pypa/pip/issues/4963\n raise ConfigurationFileCouldNotBeLoaded(\n reason=f"contains invalid {locale_encoding} characters",\n fname=fname,\n )\n except configparser.Error as error:\n # See https://github.com/pypa/pip/issues/4893\n raise ConfigurationFileCouldNotBeLoaded(error=error)\n return parser\n\n def _load_environment_vars(self) -> None:\n """Loads configuration from environment variables"""\n self._config[kinds.ENV_VAR].update(\n self._normalized_keys(":env:", self.get_environ_vars())\n )\n\n def _normalized_keys(\n self, section: str, items: Iterable[Tuple[str, Any]]\n ) -> Dict[str, Any]:\n """Normalizes items to construct a dictionary with normalized keys.\n\n This routine is where the names become keys and are made the same\n regardless of source - configuration files or environment.\n """\n normalized = {}\n for name, val in items:\n key = section + "." + _normalize_name(name)\n normalized[key] = val\n return normalized\n\n def get_environ_vars(self) -> Iterable[Tuple[str, str]]:\n """Returns a generator with all environmental vars with prefix PIP_"""\n for key, val in os.environ.items():\n if key.startswith("PIP_"):\n name = key[4:].lower()\n if name not in ENV_NAMES_IGNORED:\n yield name, val\n\n # XXX: This is patched in the tests.\n def iter_config_files(self) -> Iterable[Tuple[Kind, List[str]]]:\n """Yields variant and configuration files associated with it.\n\n This should be treated like items of a dictionary. The order\n here doesn't affect what gets overridden. That is controlled\n by OVERRIDE_ORDER. However this does control the order they are\n displayed to the user. It's probably most ergonomic to display\n things in the same order as OVERRIDE_ORDER\n """\n # SMELL: Move the conditions out of this function\n\n env_config_file = os.environ.get("PIP_CONFIG_FILE", None)\n config_files = get_configuration_files()\n\n yield kinds.GLOBAL, config_files[kinds.GLOBAL]\n\n # per-user config is not loaded when env_config_file exists\n should_load_user_config = not self.isolated and not (\n env_config_file and os.path.exists(env_config_file)\n )\n if should_load_user_config:\n # The legacy config file is overridden by the new config file\n yield kinds.USER, config_files[kinds.USER]\n\n # virtualenv config\n yield kinds.SITE, config_files[kinds.SITE]\n\n if env_config_file is not None:\n yield kinds.ENV, [env_config_file]\n else:\n yield kinds.ENV, []\n\n def get_values_in_config(self, variant: Kind) -> Dict[str, Any]:\n """Get values present in a config file"""\n return self._config[variant]\n\n def _get_parser_to_modify(self) -> Tuple[str, RawConfigParser]:\n # Determine which parser to modify\n assert self.load_only\n parsers = self._parsers[self.load_only]\n if not parsers:\n # This should not happen if everything works correctly.\n raise ConfigurationError(\n "Fatal Internal error [id=2]. Please report as a bug."\n )\n\n # Use the highest priority parser.\n return parsers[-1]\n\n # XXX: This is patched in the tests.\n def _mark_as_modified(self, fname: str, parser: RawConfigParser) -> None:\n file_parser_tuple = (fname, parser)\n if file_parser_tuple not in self._modified_parsers:\n self._modified_parsers.append(file_parser_tuple)\n\n def __repr__(self) -> str:\n return f"{self.__class__.__name__}({self._dictionary!r})"\n
.venv\Lib\site-packages\pip\_internal\configuration.py
configuration.py
Python
14,005
0.95
0.180157
0.105769
python-kit
565
2025-03-22T18:50:41.100346
BSD-3-Clause
false
efe53e9589f7c6f2bda9324c6b200edb
"""Exceptions used throughout package.\n\nThis module MUST NOT try to import from anything within `pip._internal` to\noperate. This is expected to be importable from any/all files within the\nsubpackage and, thus, should not depend on them.\n"""\n\nimport configparser\nimport contextlib\nimport locale\nimport logging\nimport pathlib\nimport re\nimport sys\nfrom itertools import chain, groupby, repeat\nfrom typing import TYPE_CHECKING, Dict, Iterator, List, Literal, Optional, Union\n\nfrom pip._vendor.packaging.requirements import InvalidRequirement\nfrom pip._vendor.packaging.version import InvalidVersion\nfrom pip._vendor.rich.console import Console, ConsoleOptions, RenderResult\nfrom pip._vendor.rich.markup import escape\nfrom pip._vendor.rich.text import Text\n\nif TYPE_CHECKING:\n from hashlib import _Hash\n\n from pip._vendor.requests.models import Request, Response\n\n from pip._internal.metadata import BaseDistribution\n from pip._internal.models.link import Link\n from pip._internal.req.req_install import InstallRequirement\n\nlogger = logging.getLogger(__name__)\n\n\n#\n# Scaffolding\n#\ndef _is_kebab_case(s: str) -> bool:\n return re.match(r"^[a-z]+(-[a-z]+)*$", s) is not None\n\n\ndef _prefix_with_indent(\n s: Union[Text, str],\n console: Console,\n *,\n prefix: str,\n indent: str,\n) -> Text:\n if isinstance(s, Text):\n text = s\n else:\n text = console.render_str(s)\n\n return console.render_str(prefix, overflow="ignore") + console.render_str(\n f"\n{indent}", overflow="ignore"\n ).join(text.split(allow_blank=True))\n\n\nclass PipError(Exception):\n """The base pip error."""\n\n\nclass DiagnosticPipError(PipError):\n """An error, that presents diagnostic information to the user.\n\n This contains a bunch of logic, to enable pretty presentation of our error\n messages. Each error gets a unique reference. Each error can also include\n additional context, a hint and/or a note -- which are presented with the\n main error message in a consistent style.\n\n This is adapted from the error output styling in `sphinx-theme-builder`.\n """\n\n reference: str\n\n def __init__(\n self,\n *,\n kind: 'Literal["error", "warning"]' = "error",\n reference: Optional[str] = None,\n message: Union[str, Text],\n context: Optional[Union[str, Text]],\n hint_stmt: Optional[Union[str, Text]],\n note_stmt: Optional[Union[str, Text]] = None,\n link: Optional[str] = None,\n ) -> None:\n # Ensure a proper reference is provided.\n if reference is None:\n assert hasattr(self, "reference"), "error reference not provided!"\n reference = self.reference\n assert _is_kebab_case(reference), "error reference must be kebab-case!"\n\n self.kind = kind\n self.reference = reference\n\n self.message = message\n self.context = context\n\n self.note_stmt = note_stmt\n self.hint_stmt = hint_stmt\n\n self.link = link\n\n super().__init__(f"<{self.__class__.__name__}: {self.reference}>")\n\n def __repr__(self) -> str:\n return (\n f"<{self.__class__.__name__}("\n f"reference={self.reference!r}, "\n f"message={self.message!r}, "\n f"context={self.context!r}, "\n f"note_stmt={self.note_stmt!r}, "\n f"hint_stmt={self.hint_stmt!r}"\n ")>"\n )\n\n def __rich_console__(\n self,\n console: Console,\n options: ConsoleOptions,\n ) -> RenderResult:\n colour = "red" if self.kind == "error" else "yellow"\n\n yield f"[{colour} bold]{self.kind}[/]: [bold]{self.reference}[/]"\n yield ""\n\n if not options.ascii_only:\n # Present the main message, with relevant context indented.\n if self.context is not None:\n yield _prefix_with_indent(\n self.message,\n console,\n prefix=f"[{colour}]×[/] ",\n indent=f"[{colour}]│[/] ",\n )\n yield _prefix_with_indent(\n self.context,\n console,\n prefix=f"[{colour}]╰─>[/] ",\n indent=f"[{colour}] [/] ",\n )\n else:\n yield _prefix_with_indent(\n self.message,\n console,\n prefix="[red]×[/] ",\n indent=" ",\n )\n else:\n yield self.message\n if self.context is not None:\n yield ""\n yield self.context\n\n if self.note_stmt is not None or self.hint_stmt is not None:\n yield ""\n\n if self.note_stmt is not None:\n yield _prefix_with_indent(\n self.note_stmt,\n console,\n prefix="[magenta bold]note[/]: ",\n indent=" ",\n )\n if self.hint_stmt is not None:\n yield _prefix_with_indent(\n self.hint_stmt,\n console,\n prefix="[cyan bold]hint[/]: ",\n indent=" ",\n )\n\n if self.link is not None:\n yield ""\n yield f"Link: {self.link}"\n\n\n#\n# Actual Errors\n#\nclass ConfigurationError(PipError):\n """General exception in configuration"""\n\n\nclass InstallationError(PipError):\n """General exception during installation"""\n\n\nclass MissingPyProjectBuildRequires(DiagnosticPipError):\n """Raised when pyproject.toml has `build-system`, but no `build-system.requires`."""\n\n reference = "missing-pyproject-build-system-requires"\n\n def __init__(self, *, package: str) -> None:\n super().__init__(\n message=f"Can not process {escape(package)}",\n context=Text(\n "This package has an invalid pyproject.toml file.\n"\n "The [build-system] table is missing the mandatory `requires` key."\n ),\n note_stmt="This is an issue with the package mentioned above, not pip.",\n hint_stmt=Text("See PEP 518 for the detailed specification."),\n )\n\n\nclass InvalidPyProjectBuildRequires(DiagnosticPipError):\n """Raised when pyproject.toml an invalid `build-system.requires`."""\n\n reference = "invalid-pyproject-build-system-requires"\n\n def __init__(self, *, package: str, reason: str) -> None:\n super().__init__(\n message=f"Can not process {escape(package)}",\n context=Text(\n "This package has an invalid `build-system.requires` key in "\n f"pyproject.toml.\n{reason}"\n ),\n note_stmt="This is an issue with the package mentioned above, not pip.",\n hint_stmt=Text("See PEP 518 for the detailed specification."),\n )\n\n\nclass NoneMetadataError(PipError):\n """Raised when accessing a Distribution's "METADATA" or "PKG-INFO".\n\n This signifies an inconsistency, when the Distribution claims to have\n the metadata file (if not, raise ``FileNotFoundError`` instead), but is\n not actually able to produce its content. This may be due to permission\n errors.\n """\n\n def __init__(\n self,\n dist: "BaseDistribution",\n metadata_name: str,\n ) -> None:\n """\n :param dist: A Distribution object.\n :param metadata_name: The name of the metadata being accessed\n (can be "METADATA" or "PKG-INFO").\n """\n self.dist = dist\n self.metadata_name = metadata_name\n\n def __str__(self) -> str:\n # Use `dist` in the error message because its stringification\n # includes more information, like the version and location.\n return f"None {self.metadata_name} metadata found for distribution: {self.dist}"\n\n\nclass UserInstallationInvalid(InstallationError):\n """A --user install is requested on an environment without user site."""\n\n def __str__(self) -> str:\n return "User base directory is not specified"\n\n\nclass InvalidSchemeCombination(InstallationError):\n def __str__(self) -> str:\n before = ", ".join(str(a) for a in self.args[:-1])\n return f"Cannot set {before} and {self.args[-1]} together"\n\n\nclass DistributionNotFound(InstallationError):\n """Raised when a distribution cannot be found to satisfy a requirement"""\n\n\nclass RequirementsFileParseError(InstallationError):\n """Raised when a general error occurs parsing a requirements file line."""\n\n\nclass BestVersionAlreadyInstalled(PipError):\n """Raised when the most up-to-date version of a package is already\n installed."""\n\n\nclass BadCommand(PipError):\n """Raised when virtualenv or a command is not found"""\n\n\nclass CommandError(PipError):\n """Raised when there is an error in command-line arguments"""\n\n\nclass PreviousBuildDirError(PipError):\n """Raised when there's a previous conflicting build directory"""\n\n\nclass NetworkConnectionError(PipError):\n """HTTP connection error"""\n\n def __init__(\n self,\n error_msg: str,\n response: Optional["Response"] = None,\n request: Optional["Request"] = None,\n ) -> None:\n """\n Initialize NetworkConnectionError with `request` and `response`\n objects.\n """\n self.response = response\n self.request = request\n self.error_msg = error_msg\n if (\n self.response is not None\n and not self.request\n and hasattr(response, "request")\n ):\n self.request = self.response.request\n super().__init__(error_msg, response, request)\n\n def __str__(self) -> str:\n return str(self.error_msg)\n\n\nclass InvalidWheelFilename(InstallationError):\n """Invalid wheel filename."""\n\n\nclass UnsupportedWheel(InstallationError):\n """Unsupported wheel."""\n\n\nclass InvalidWheel(InstallationError):\n """Invalid (e.g. corrupt) wheel."""\n\n def __init__(self, location: str, name: str):\n self.location = location\n self.name = name\n\n def __str__(self) -> str:\n return f"Wheel '{self.name}' located at {self.location} is invalid."\n\n\nclass MetadataInconsistent(InstallationError):\n """Built metadata contains inconsistent information.\n\n This is raised when the metadata contains values (e.g. name and version)\n that do not match the information previously obtained from sdist filename,\n user-supplied ``#egg=`` value, or an install requirement name.\n """\n\n def __init__(\n self, ireq: "InstallRequirement", field: str, f_val: str, m_val: str\n ) -> None:\n self.ireq = ireq\n self.field = field\n self.f_val = f_val\n self.m_val = m_val\n\n def __str__(self) -> str:\n return (\n f"Requested {self.ireq} has inconsistent {self.field}: "\n f"expected {self.f_val!r}, but metadata has {self.m_val!r}"\n )\n\n\nclass MetadataInvalid(InstallationError):\n """Metadata is invalid."""\n\n def __init__(self, ireq: "InstallRequirement", error: str) -> None:\n self.ireq = ireq\n self.error = error\n\n def __str__(self) -> str:\n return f"Requested {self.ireq} has invalid metadata: {self.error}"\n\n\nclass InstallationSubprocessError(DiagnosticPipError, InstallationError):\n """A subprocess call failed."""\n\n reference = "subprocess-exited-with-error"\n\n def __init__(\n self,\n *,\n command_description: str,\n exit_code: int,\n output_lines: Optional[List[str]],\n ) -> None:\n if output_lines is None:\n output_prompt = Text("See above for output.")\n else:\n output_prompt = (\n Text.from_markup(f"[red][{len(output_lines)} lines of output][/]\n")\n + Text("".join(output_lines))\n + Text.from_markup(R"[red]\[end of output][/]")\n )\n\n super().__init__(\n message=(\n f"[green]{escape(command_description)}[/] did not run successfully.\n"\n f"exit code: {exit_code}"\n ),\n context=output_prompt,\n hint_stmt=None,\n note_stmt=(\n "This error originates from a subprocess, and is likely not a "\n "problem with pip."\n ),\n )\n\n self.command_description = command_description\n self.exit_code = exit_code\n\n def __str__(self) -> str:\n return f"{self.command_description} exited with {self.exit_code}"\n\n\nclass MetadataGenerationFailed(InstallationSubprocessError, InstallationError):\n reference = "metadata-generation-failed"\n\n def __init__(\n self,\n *,\n package_details: str,\n ) -> None:\n super(InstallationSubprocessError, self).__init__(\n message="Encountered error while generating package metadata.",\n context=escape(package_details),\n hint_stmt="See above for details.",\n note_stmt="This is an issue with the package mentioned above, not pip.",\n )\n\n def __str__(self) -> str:\n return "metadata generation failed"\n\n\nclass HashErrors(InstallationError):\n """Multiple HashError instances rolled into one for reporting"""\n\n def __init__(self) -> None:\n self.errors: List[HashError] = []\n\n def append(self, error: "HashError") -> None:\n self.errors.append(error)\n\n def __str__(self) -> str:\n lines = []\n self.errors.sort(key=lambda e: e.order)\n for cls, errors_of_cls in groupby(self.errors, lambda e: e.__class__):\n lines.append(cls.head)\n lines.extend(e.body() for e in errors_of_cls)\n if lines:\n return "\n".join(lines)\n return ""\n\n def __bool__(self) -> bool:\n return bool(self.errors)\n\n\nclass HashError(InstallationError):\n """\n A failure to verify a package against known-good hashes\n\n :cvar order: An int sorting hash exception classes by difficulty of\n recovery (lower being harder), so the user doesn't bother fretting\n about unpinned packages when he has deeper issues, like VCS\n dependencies, to deal with. Also keeps error reports in a\n deterministic order.\n :cvar head: A section heading for display above potentially many\n exceptions of this kind\n :ivar req: The InstallRequirement that triggered this error. This is\n pasted on after the exception is instantiated, because it's not\n typically available earlier.\n\n """\n\n req: Optional["InstallRequirement"] = None\n head = ""\n order: int = -1\n\n def body(self) -> str:\n """Return a summary of me for display under the heading.\n\n This default implementation simply prints a description of the\n triggering requirement.\n\n :param req: The InstallRequirement that provoked this error, with\n its link already populated by the resolver's _populate_link().\n\n """\n return f" {self._requirement_name()}"\n\n def __str__(self) -> str:\n return f"{self.head}\n{self.body()}"\n\n def _requirement_name(self) -> str:\n """Return a description of the requirement that triggered me.\n\n This default implementation returns long description of the req, with\n line numbers\n\n """\n return str(self.req) if self.req else "unknown package"\n\n\nclass VcsHashUnsupported(HashError):\n """A hash was provided for a version-control-system-based requirement, but\n we don't have a method for hashing those."""\n\n order = 0\n head = (\n "Can't verify hashes for these requirements because we don't "\n "have a way to hash version control repositories:"\n )\n\n\nclass DirectoryUrlHashUnsupported(HashError):\n """A hash was provided for a version-control-system-based requirement, but\n we don't have a method for hashing those."""\n\n order = 1\n head = (\n "Can't verify hashes for these file:// requirements because they "\n "point to directories:"\n )\n\n\nclass HashMissing(HashError):\n """A hash was needed for a requirement but is absent."""\n\n order = 2\n head = (\n "Hashes are required in --require-hashes mode, but they are "\n "missing from some requirements. Here is a list of those "\n "requirements along with the hashes their downloaded archives "\n "actually had. Add lines like these to your requirements files to "\n "prevent tampering. (If you did not enable --require-hashes "\n "manually, note that it turns on automatically when any package "\n "has a hash.)"\n )\n\n def __init__(self, gotten_hash: str) -> None:\n """\n :param gotten_hash: The hash of the (possibly malicious) archive we\n just downloaded\n """\n self.gotten_hash = gotten_hash\n\n def body(self) -> str:\n # Dodge circular import.\n from pip._internal.utils.hashes import FAVORITE_HASH\n\n package = None\n if self.req:\n # In the case of URL-based requirements, display the original URL\n # seen in the requirements file rather than the package name,\n # so the output can be directly copied into the requirements file.\n package = (\n self.req.original_link\n if self.req.is_direct\n # In case someone feeds something downright stupid\n # to InstallRequirement's constructor.\n else getattr(self.req, "req", None)\n )\n return " {} --hash={}:{}".format(\n package or "unknown package", FAVORITE_HASH, self.gotten_hash\n )\n\n\nclass HashUnpinned(HashError):\n """A requirement had a hash specified but was not pinned to a specific\n version."""\n\n order = 3\n head = (\n "In --require-hashes mode, all requirements must have their "\n "versions pinned with ==. These do not:"\n )\n\n\nclass HashMismatch(HashError):\n """\n Distribution file hash values don't match.\n\n :ivar package_name: The name of the package that triggered the hash\n mismatch. Feel free to write to this after the exception is raise to\n improve its error message.\n\n """\n\n order = 4\n head = (\n "THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS "\n "FILE. If you have updated the package versions, please update "\n "the hashes. Otherwise, examine the package contents carefully; "\n "someone may have tampered with them."\n )\n\n def __init__(self, allowed: Dict[str, List[str]], gots: Dict[str, "_Hash"]) -> None:\n """\n :param allowed: A dict of algorithm names pointing to lists of allowed\n hex digests\n :param gots: A dict of algorithm names pointing to hashes we\n actually got from the files under suspicion\n """\n self.allowed = allowed\n self.gots = gots\n\n def body(self) -> str:\n return f" {self._requirement_name()}:\n{self._hash_comparison()}"\n\n def _hash_comparison(self) -> str:\n """\n Return a comparison of actual and expected hash values.\n\n Example::\n\n Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde\n or 123451234512345123451234512345123451234512345\n Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef\n\n """\n\n def hash_then_or(hash_name: str) -> "chain[str]":\n # For now, all the decent hashes have 6-char names, so we can get\n # away with hard-coding space literals.\n return chain([hash_name], repeat(" or"))\n\n lines: List[str] = []\n for hash_name, expecteds in self.allowed.items():\n prefix = hash_then_or(hash_name)\n lines.extend((f" Expected {next(prefix)} {e}") for e in expecteds)\n lines.append(\n f" Got {self.gots[hash_name].hexdigest()}\n"\n )\n return "\n".join(lines)\n\n\nclass UnsupportedPythonVersion(InstallationError):\n """Unsupported python version according to Requires-Python package\n metadata."""\n\n\nclass ConfigurationFileCouldNotBeLoaded(ConfigurationError):\n """When there are errors while loading a configuration file"""\n\n def __init__(\n self,\n reason: str = "could not be loaded",\n fname: Optional[str] = None,\n error: Optional[configparser.Error] = None,\n ) -> None:\n super().__init__(error)\n self.reason = reason\n self.fname = fname\n self.error = error\n\n def __str__(self) -> str:\n if self.fname is not None:\n message_part = f" in {self.fname}."\n else:\n assert self.error is not None\n message_part = f".\n{self.error}\n"\n return f"Configuration file {self.reason}{message_part}"\n\n\n_DEFAULT_EXTERNALLY_MANAGED_ERROR = f"""\\nThe Python environment under {sys.prefix} is managed externally, and may not be\nmanipulated by the user. Please use specific tooling from the distributor of\nthe Python installation to interact with this environment instead.\n"""\n\n\nclass ExternallyManagedEnvironment(DiagnosticPipError):\n """The current environment is externally managed.\n\n This is raised when the current environment is externally managed, as\n defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked\n and displayed when the error is bubbled up to the user.\n\n :param error: The error message read from ``EXTERNALLY-MANAGED``.\n """\n\n reference = "externally-managed-environment"\n\n def __init__(self, error: Optional[str]) -> None:\n if error is None:\n context = Text(_DEFAULT_EXTERNALLY_MANAGED_ERROR)\n else:\n context = Text(error)\n super().__init__(\n message="This environment is externally managed",\n context=context,\n note_stmt=(\n "If you believe this is a mistake, please contact your "\n "Python installation or OS distribution provider. "\n "You can override this, at the risk of breaking your Python "\n "installation or OS, by passing --break-system-packages."\n ),\n hint_stmt=Text("See PEP 668 for the detailed specification."),\n )\n\n @staticmethod\n def _iter_externally_managed_error_keys() -> Iterator[str]:\n # LC_MESSAGES is in POSIX, but not the C standard. The most common\n # platform that does not implement this category is Windows, where\n # using other categories for console message localization is equally\n # unreliable, so we fall back to the locale-less vendor message. This\n # can always be re-evaluated when a vendor proposes a new alternative.\n try:\n category = locale.LC_MESSAGES\n except AttributeError:\n lang: Optional[str] = None\n else:\n lang, _ = locale.getlocale(category)\n if lang is not None:\n yield f"Error-{lang}"\n for sep in ("-", "_"):\n before, found, _ = lang.partition(sep)\n if not found:\n continue\n yield f"Error-{before}"\n yield "Error"\n\n @classmethod\n def from_config(\n cls,\n config: Union[pathlib.Path, str],\n ) -> "ExternallyManagedEnvironment":\n parser = configparser.ConfigParser(interpolation=None)\n try:\n parser.read(config, encoding="utf-8")\n section = parser["externally-managed"]\n for key in cls._iter_externally_managed_error_keys():\n with contextlib.suppress(KeyError):\n return cls(section[key])\n except KeyError:\n pass\n except (OSError, UnicodeDecodeError, configparser.ParsingError):\n from pip._internal.utils._log import VERBOSE\n\n exc_info = logger.isEnabledFor(VERBOSE)\n logger.warning("Failed to read %s", config, exc_info=exc_info)\n return cls(None)\n\n\nclass UninstallMissingRecord(DiagnosticPipError):\n reference = "uninstall-no-record-file"\n\n def __init__(self, *, distribution: "BaseDistribution") -> None:\n installer = distribution.installer\n if not installer or installer == "pip":\n dep = f"{distribution.raw_name}=={distribution.version}"\n hint = Text.assemble(\n "You might be able to recover from this via: ",\n (f"pip install --force-reinstall --no-deps {dep}", "green"),\n )\n else:\n hint = Text(\n f"The package was installed by {installer}. "\n "You should check if it can uninstall the package."\n )\n\n super().__init__(\n message=Text(f"Cannot uninstall {distribution}"),\n context=(\n "The package's contents are unknown: "\n f"no RECORD file was found for {distribution.raw_name}."\n ),\n hint_stmt=hint,\n )\n\n\nclass LegacyDistutilsInstall(DiagnosticPipError):\n reference = "uninstall-distutils-installed-package"\n\n def __init__(self, *, distribution: "BaseDistribution") -> None:\n super().__init__(\n message=Text(f"Cannot uninstall {distribution}"),\n context=(\n "It is a distutils installed project and thus we cannot accurately "\n "determine which files belong to it which would lead to only a partial "\n "uninstall."\n ),\n hint_stmt=None,\n )\n\n\nclass InvalidInstalledPackage(DiagnosticPipError):\n reference = "invalid-installed-package"\n\n def __init__(\n self,\n *,\n dist: "BaseDistribution",\n invalid_exc: Union[InvalidRequirement, InvalidVersion],\n ) -> None:\n installed_location = dist.installed_location\n\n if isinstance(invalid_exc, InvalidRequirement):\n invalid_type = "requirement"\n else:\n invalid_type = "version"\n\n super().__init__(\n message=Text(\n f"Cannot process installed package {dist} "\n + (f"in {installed_location!r} " if installed_location else "")\n + f"because it has an invalid {invalid_type}:\n{invalid_exc.args[0]}"\n ),\n context=(\n "Starting with pip 24.1, packages with invalid "\n f"{invalid_type}s can not be processed."\n ),\n hint_stmt="To proceed this package must be uninstalled.",\n )\n\n\nclass IncompleteDownloadError(DiagnosticPipError):\n """Raised when the downloader receives fewer bytes than advertised\n in the Content-Length header."""\n\n reference = "incomplete-download"\n\n def __init__(\n self, link: "Link", received: int, expected: int, *, retries: int\n ) -> None:\n # Dodge circular import.\n from pip._internal.utils.misc import format_size\n\n download_status = f"{format_size(received)}/{format_size(expected)}"\n if retries:\n retry_status = f"after {retries} attempts "\n hint = "Use --resume-retries to configure resume attempt limit."\n else:\n retry_status = ""\n hint = "Consider using --resume-retries to enable download resumption."\n message = Text(\n f"Download failed {retry_status}because not enough bytes "\n f"were received ({download_status})"\n )\n\n super().__init__(\n message=message,\n context=f"URL: {link.redacted_url}",\n hint_stmt=hint,\n note_stmt="This is an issue with network connectivity, not pip.",\n )\n\n\nclass ResolutionTooDeepError(DiagnosticPipError):\n """Raised when the dependency resolver exceeds the maximum recursion depth."""\n\n reference = "resolution-too-deep"\n\n def __init__(self) -> None:\n super().__init__(\n message="Dependency resolution exceeded maximum depth",\n context=(\n "Pip cannot resolve the current dependencies as the dependency graph "\n "is too complex for pip to solve efficiently."\n ),\n hint_stmt=(\n "Try adding lower bounds to constrain your dependencies, "\n "for example: 'package>=2.0.0' instead of just 'package'. "\n ),\n link="https://pip.pypa.io/en/stable/topics/dependency-resolution/#handling-resolution-too-deep-errors",\n )\n
.venv\Lib\site-packages\pip\_internal\exceptions.py
exceptions.py
Python
28,464
0.95
0.165893
0.042773
awesome-app
159
2023-07-11T21:20:42.817247
MIT
false
4b563393be0bf74b1f3755480144b89f
from typing import List, Optional\n\n\ndef main(args: Optional[List[str]] = None) -> int:\n """This is preserved for old console scripts that may still be referencing\n it.\n\n For additional details, see https://github.com/pypa/pip/issues/7498.\n """\n from pip._internal.utils.entrypoints import _wrapper\n\n return _wrapper(args)\n
.venv\Lib\site-packages\pip\_internal\main.py
main.py
Python
340
0.95
0.166667
0
node-utils
452
2024-01-21T18:56:04.242646
MIT
false
0bb4fe239f44137d18d96e9ecb11195e
import importlib.util\nimport os\nimport sys\nfrom collections import namedtuple\nfrom typing import Any, List, Optional\n\nif sys.version_info >= (3, 11):\n import tomllib\nelse:\n from pip._vendor import tomli as tomllib\n\nfrom pip._vendor.packaging.requirements import InvalidRequirement\n\nfrom pip._internal.exceptions import (\n InstallationError,\n InvalidPyProjectBuildRequires,\n MissingPyProjectBuildRequires,\n)\nfrom pip._internal.utils.packaging import get_requirement\n\n\ndef _is_list_of_str(obj: Any) -> bool:\n return isinstance(obj, list) and all(isinstance(item, str) for item in obj)\n\n\ndef make_pyproject_path(unpacked_source_directory: str) -> str:\n return os.path.join(unpacked_source_directory, "pyproject.toml")\n\n\nBuildSystemDetails = namedtuple(\n "BuildSystemDetails", ["requires", "backend", "check", "backend_path"]\n)\n\n\ndef load_pyproject_toml(\n use_pep517: Optional[bool], pyproject_toml: str, setup_py: str, req_name: str\n) -> Optional[BuildSystemDetails]:\n """Load the pyproject.toml file.\n\n Parameters:\n use_pep517 - Has the user requested PEP 517 processing? None\n means the user hasn't explicitly specified.\n pyproject_toml - Location of the project's pyproject.toml file\n setup_py - Location of the project's setup.py file\n req_name - The name of the requirement we're processing (for\n error reporting)\n\n Returns:\n None if we should use the legacy code path, otherwise a tuple\n (\n requirements from pyproject.toml,\n name of PEP 517 backend,\n requirements we should check are installed after setting\n up the build environment\n directory paths to import the backend from (backend-path),\n relative to the project root.\n )\n """\n has_pyproject = os.path.isfile(pyproject_toml)\n has_setup = os.path.isfile(setup_py)\n\n if not has_pyproject and not has_setup:\n raise InstallationError(\n f"{req_name} does not appear to be a Python project: "\n f"neither 'setup.py' nor 'pyproject.toml' found."\n )\n\n if has_pyproject:\n with open(pyproject_toml, encoding="utf-8") as f:\n pp_toml = tomllib.loads(f.read())\n build_system = pp_toml.get("build-system")\n else:\n build_system = None\n\n # The following cases must use PEP 517\n # We check for use_pep517 being non-None and falsy because that means\n # the user explicitly requested --no-use-pep517. The value 0 as\n # opposed to False can occur when the value is provided via an\n # environment variable or config file option (due to the quirk of\n # strtobool() returning an integer in pip's configuration code).\n if has_pyproject and not has_setup:\n if use_pep517 is not None and not use_pep517:\n raise InstallationError(\n "Disabling PEP 517 processing is invalid: "\n "project does not have a setup.py"\n )\n use_pep517 = True\n elif build_system and "build-backend" in build_system:\n if use_pep517 is not None and not use_pep517:\n raise InstallationError(\n "Disabling PEP 517 processing is invalid: "\n "project specifies a build backend of {} "\n "in pyproject.toml".format(build_system["build-backend"])\n )\n use_pep517 = True\n\n # If we haven't worked out whether to use PEP 517 yet,\n # and the user hasn't explicitly stated a preference,\n # we do so if the project has a pyproject.toml file\n # or if we cannot import setuptools or wheels.\n\n # We fallback to PEP 517 when without setuptools or without the wheel package,\n # so setuptools can be installed as a default build backend.\n # For more info see:\n # https://discuss.python.org/t/pip-without-setuptools-could-the-experience-be-improved/11810/9\n # https://github.com/pypa/pip/issues/8559\n elif use_pep517 is None:\n use_pep517 = (\n has_pyproject\n or not importlib.util.find_spec("setuptools")\n or not importlib.util.find_spec("wheel")\n )\n\n # At this point, we know whether we're going to use PEP 517.\n assert use_pep517 is not None\n\n # If we're using the legacy code path, there is nothing further\n # for us to do here.\n if not use_pep517:\n return None\n\n if build_system is None:\n # Either the user has a pyproject.toml with no build-system\n # section, or the user has no pyproject.toml, but has opted in\n # explicitly via --use-pep517.\n # In the absence of any explicit backend specification, we\n # assume the setuptools backend that most closely emulates the\n # traditional direct setup.py execution, and require wheel and\n # a version of setuptools that supports that backend.\n\n build_system = {\n "requires": ["setuptools>=40.8.0"],\n "build-backend": "setuptools.build_meta:__legacy__",\n }\n\n # If we're using PEP 517, we have build system information (either\n # from pyproject.toml, or defaulted by the code above).\n # Note that at this point, we do not know if the user has actually\n # specified a backend, though.\n assert build_system is not None\n\n # Ensure that the build-system section in pyproject.toml conforms\n # to PEP 518.\n\n # Specifying the build-system table but not the requires key is invalid\n if "requires" not in build_system:\n raise MissingPyProjectBuildRequires(package=req_name)\n\n # Error out if requires is not a list of strings\n requires = build_system["requires"]\n if not _is_list_of_str(requires):\n raise InvalidPyProjectBuildRequires(\n package=req_name,\n reason="It is not a list of strings.",\n )\n\n # Each requirement must be valid as per PEP 508\n for requirement in requires:\n try:\n get_requirement(requirement)\n except InvalidRequirement as error:\n raise InvalidPyProjectBuildRequires(\n package=req_name,\n reason=f"It contains an invalid requirement: {requirement!r}",\n ) from error\n\n backend = build_system.get("build-backend")\n backend_path = build_system.get("backend-path", [])\n check: List[str] = []\n if backend is None:\n # If the user didn't specify a backend, we assume they want to use\n # the setuptools backend. But we can't be sure they have included\n # a version of setuptools which supplies the backend. So we\n # make a note to check that this requirement is present once\n # we have set up the environment.\n # This is quite a lot of work to check for a very specific case. But\n # the problem is, that case is potentially quite common - projects that\n # adopted PEP 518 early for the ability to specify requirements to\n # execute setup.py, but never considered needing to mention the build\n # tools themselves. The original PEP 518 code had a similar check (but\n # implemented in a different way).\n backend = "setuptools.build_meta:__legacy__"\n check = ["setuptools>=40.8.0"]\n\n return BuildSystemDetails(requires, backend, check, backend_path)\n
.venv\Lib\site-packages\pip\_internal\pyproject.py
pyproject.py
Python
7,286
0.95
0.145946
0.288462
node-utils
905
2025-03-25T02:00:28.918566
Apache-2.0
false
e3d15f571276e6c8466c82409ee2559d
import datetime\nimport functools\nimport hashlib\nimport json\nimport logging\nimport optparse\nimport os.path\nimport sys\nfrom dataclasses import dataclass\nfrom typing import Any, Callable, Dict, Optional\n\nfrom pip._vendor.packaging.version import Version\nfrom pip._vendor.packaging.version import parse as parse_version\nfrom pip._vendor.rich.console import Group\nfrom pip._vendor.rich.markup import escape\nfrom pip._vendor.rich.text import Text\n\nfrom pip._internal.index.collector import LinkCollector\nfrom pip._internal.index.package_finder import PackageFinder\nfrom pip._internal.metadata import get_default_environment\nfrom pip._internal.models.selection_prefs import SelectionPreferences\nfrom pip._internal.network.session import PipSession\nfrom pip._internal.utils.compat import WINDOWS\nfrom pip._internal.utils.entrypoints import (\n get_best_invocation_for_this_pip,\n get_best_invocation_for_this_python,\n)\nfrom pip._internal.utils.filesystem import adjacent_tmp_file, check_path_owner, replace\nfrom pip._internal.utils.misc import (\n ExternallyManagedEnvironment,\n check_externally_managed,\n ensure_dir,\n)\n\n_WEEK = datetime.timedelta(days=7)\n\nlogger = logging.getLogger(__name__)\n\n\ndef _get_statefile_name(key: str) -> str:\n key_bytes = key.encode()\n name = hashlib.sha224(key_bytes).hexdigest()\n return name\n\n\ndef _convert_date(isodate: str) -> datetime.datetime:\n """Convert an ISO format string to a date.\n\n Handles the format 2020-01-22T14:24:01Z (trailing Z)\n which is not supported by older versions of fromisoformat.\n """\n return datetime.datetime.fromisoformat(isodate.replace("Z", "+00:00"))\n\n\nclass SelfCheckState:\n def __init__(self, cache_dir: str) -> None:\n self._state: Dict[str, Any] = {}\n self._statefile_path = None\n\n # Try to load the existing state\n if cache_dir:\n self._statefile_path = os.path.join(\n cache_dir, "selfcheck", _get_statefile_name(self.key)\n )\n try:\n with open(self._statefile_path, encoding="utf-8") as statefile:\n self._state = json.load(statefile)\n except (OSError, ValueError, KeyError):\n # Explicitly suppressing exceptions, since we don't want to\n # error out if the cache file is invalid.\n pass\n\n @property\n def key(self) -> str:\n return sys.prefix\n\n def get(self, current_time: datetime.datetime) -> Optional[str]:\n """Check if we have a not-outdated version loaded already."""\n if not self._state:\n return None\n\n if "last_check" not in self._state:\n return None\n\n if "pypi_version" not in self._state:\n return None\n\n # Determine if we need to refresh the state\n last_check = _convert_date(self._state["last_check"])\n time_since_last_check = current_time - last_check\n if time_since_last_check > _WEEK:\n return None\n\n return self._state["pypi_version"]\n\n def set(self, pypi_version: str, current_time: datetime.datetime) -> None:\n # If we do not have a path to cache in, don't bother saving.\n if not self._statefile_path:\n return\n\n # Check to make sure that we own the directory\n if not check_path_owner(os.path.dirname(self._statefile_path)):\n return\n\n # Now that we've ensured the directory is owned by this user, we'll go\n # ahead and make sure that all our directories are created.\n ensure_dir(os.path.dirname(self._statefile_path))\n\n state = {\n # Include the key so it's easy to tell which pip wrote the\n # file.\n "key": self.key,\n "last_check": current_time.isoformat(),\n "pypi_version": pypi_version,\n }\n\n text = json.dumps(state, sort_keys=True, separators=(",", ":"))\n\n with adjacent_tmp_file(self._statefile_path) as f:\n f.write(text.encode())\n\n try:\n # Since we have a prefix-specific state file, we can just\n # overwrite whatever is there, no need to check.\n replace(f.name, self._statefile_path)\n except OSError:\n # Best effort.\n pass\n\n\n@dataclass\nclass UpgradePrompt:\n old: str\n new: str\n\n def __rich__(self) -> Group:\n if WINDOWS:\n pip_cmd = f"{get_best_invocation_for_this_python()} -m pip"\n else:\n pip_cmd = get_best_invocation_for_this_pip()\n\n notice = "[bold][[reset][blue]notice[reset][bold]][reset]"\n return Group(\n Text(),\n Text.from_markup(\n f"{notice} A new release of pip is available: "\n f"[red]{self.old}[reset] -> [green]{self.new}[reset]"\n ),\n Text.from_markup(\n f"{notice} To update, run: "\n f"[green]{escape(pip_cmd)} install --upgrade pip"\n ),\n )\n\n\ndef was_installed_by_pip(pkg: str) -> bool:\n """Checks whether pkg was installed by pip\n\n This is used not to display the upgrade message when pip is in fact\n installed by system package manager, such as dnf on Fedora.\n """\n dist = get_default_environment().get_distribution(pkg)\n return dist is not None and "pip" == dist.installer\n\n\ndef _get_current_remote_pip_version(\n session: PipSession, options: optparse.Values\n) -> Optional[str]:\n # Lets use PackageFinder to see what the latest pip version is\n link_collector = LinkCollector.create(\n session,\n options=options,\n suppress_no_index=True,\n )\n\n # Pass allow_yanked=False so we don't suggest upgrading to a\n # yanked version.\n selection_prefs = SelectionPreferences(\n allow_yanked=False,\n allow_all_prereleases=False, # Explicitly set to False\n )\n\n finder = PackageFinder.create(\n link_collector=link_collector,\n selection_prefs=selection_prefs,\n )\n best_candidate = finder.find_best_candidate("pip").best_candidate\n if best_candidate is None:\n return None\n\n return str(best_candidate.version)\n\n\ndef _self_version_check_logic(\n *,\n state: SelfCheckState,\n current_time: datetime.datetime,\n local_version: Version,\n get_remote_version: Callable[[], Optional[str]],\n) -> Optional[UpgradePrompt]:\n remote_version_str = state.get(current_time)\n if remote_version_str is None:\n remote_version_str = get_remote_version()\n if remote_version_str is None:\n logger.debug("No remote pip version found")\n return None\n state.set(remote_version_str, current_time)\n\n remote_version = parse_version(remote_version_str)\n logger.debug("Remote version of pip: %s", remote_version)\n logger.debug("Local version of pip: %s", local_version)\n\n pip_installed_by_pip = was_installed_by_pip("pip")\n logger.debug("Was pip installed by pip? %s", pip_installed_by_pip)\n if not pip_installed_by_pip:\n return None # Only suggest upgrade if pip is installed by pip.\n\n local_version_is_older = (\n local_version < remote_version\n and local_version.base_version != remote_version.base_version\n )\n if local_version_is_older:\n return UpgradePrompt(old=str(local_version), new=remote_version_str)\n\n return None\n\n\ndef pip_self_version_check(session: PipSession, options: optparse.Values) -> None:\n """Check for an update for pip.\n\n Limit the frequency of checks to once per week. State is stored either in\n the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix\n of the pip script path.\n """\n installed_dist = get_default_environment().get_distribution("pip")\n if not installed_dist:\n return\n try:\n check_externally_managed()\n except ExternallyManagedEnvironment:\n return\n\n upgrade_prompt = _self_version_check_logic(\n state=SelfCheckState(cache_dir=options.cache_dir),\n current_time=datetime.datetime.now(datetime.timezone.utc),\n local_version=installed_dist.version,\n get_remote_version=functools.partial(\n _get_current_remote_pip_version, session, options\n ),\n )\n if upgrade_prompt is not None:\n logger.warning("%s", upgrade_prompt, extra={"rich": True})\n
.venv\Lib\site-packages\pip\_internal\self_outdated_check.py
self_outdated_check.py
Python
8,318
0.95
0.146825
0.082927
awesome-app
779
2024-06-07T06:19:59.630964
BSD-3-Clause
false
3e27c4499ceaf71ddee4e7cda50ac139
"""Orchestrator for building wheels from InstallRequirements."""\n\nimport logging\nimport os.path\nimport re\nimport shutil\nfrom typing import Iterable, List, Optional, Tuple\n\nfrom pip._vendor.packaging.utils import canonicalize_name, canonicalize_version\nfrom pip._vendor.packaging.version import InvalidVersion, Version\n\nfrom pip._internal.cache import WheelCache\nfrom pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel\nfrom pip._internal.metadata import FilesystemWheel, get_wheel_distribution\nfrom pip._internal.models.link import Link\nfrom pip._internal.models.wheel import Wheel\nfrom pip._internal.operations.build.wheel import build_wheel_pep517\nfrom pip._internal.operations.build.wheel_editable import build_wheel_editable\nfrom pip._internal.operations.build.wheel_legacy import build_wheel_legacy\nfrom pip._internal.req.req_install import InstallRequirement\nfrom pip._internal.utils.logging import indent_log\nfrom pip._internal.utils.misc import ensure_dir, hash_file\nfrom pip._internal.utils.setuptools_build import make_setuptools_clean_args\nfrom pip._internal.utils.subprocess import call_subprocess\nfrom pip._internal.utils.temp_dir import TempDirectory\nfrom pip._internal.utils.urls import path_to_url\nfrom pip._internal.vcs import vcs\n\nlogger = logging.getLogger(__name__)\n\n_egg_info_re = re.compile(r"([a-z0-9_.]+)-([a-z0-9_.!+-]+)", re.IGNORECASE)\n\nBuildResult = Tuple[List[InstallRequirement], List[InstallRequirement]]\n\n\ndef _contains_egg_info(s: str) -> bool:\n """Determine whether the string looks like an egg_info.\n\n :param s: The string to parse. E.g. foo-2.1\n """\n return bool(_egg_info_re.search(s))\n\n\ndef _should_build(\n req: InstallRequirement,\n) -> bool:\n """Return whether an InstallRequirement should be built into a wheel."""\n assert not req.constraint\n\n if req.is_wheel:\n return False\n\n assert req.source_dir\n\n if req.editable:\n # we only build PEP 660 editable requirements\n return req.supports_pyproject_editable\n\n return True\n\n\ndef should_build_for_install_command(\n req: InstallRequirement,\n) -> bool:\n return _should_build(req)\n\n\ndef _should_cache(\n req: InstallRequirement,\n) -> Optional[bool]:\n """\n Return whether a built InstallRequirement can be stored in the persistent\n wheel cache, assuming the wheel cache is available, and _should_build()\n has determined a wheel needs to be built.\n """\n if req.editable or not req.source_dir:\n # never cache editable requirements\n return False\n\n if req.link and req.link.is_vcs:\n # VCS checkout. Do not cache\n # unless it points to an immutable commit hash.\n assert not req.editable\n assert req.source_dir\n vcs_backend = vcs.get_backend_for_scheme(req.link.scheme)\n assert vcs_backend\n if vcs_backend.is_immutable_rev_checkout(req.link.url, req.source_dir):\n return True\n return False\n\n assert req.link\n base, ext = req.link.splitext()\n if _contains_egg_info(base):\n return True\n\n # Otherwise, do not cache.\n return False\n\n\ndef _get_cache_dir(\n req: InstallRequirement,\n wheel_cache: WheelCache,\n) -> str:\n """Return the persistent or temporary cache directory where the built\n wheel need to be stored.\n """\n cache_available = bool(wheel_cache.cache_dir)\n assert req.link\n if cache_available and _should_cache(req):\n cache_dir = wheel_cache.get_path_for_link(req.link)\n else:\n cache_dir = wheel_cache.get_ephem_path_for_link(req.link)\n return cache_dir\n\n\ndef _verify_one(req: InstallRequirement, wheel_path: str) -> None:\n canonical_name = canonicalize_name(req.name or "")\n w = Wheel(os.path.basename(wheel_path))\n if canonicalize_name(w.name) != canonical_name:\n raise InvalidWheelFilename(\n f"Wheel has unexpected file name: expected {canonical_name!r}, "\n f"got {w.name!r}",\n )\n dist = get_wheel_distribution(FilesystemWheel(wheel_path), canonical_name)\n dist_verstr = str(dist.version)\n if canonicalize_version(dist_verstr) != canonicalize_version(w.version):\n raise InvalidWheelFilename(\n f"Wheel has unexpected file name: expected {dist_verstr!r}, "\n f"got {w.version!r}",\n )\n metadata_version_value = dist.metadata_version\n if metadata_version_value is None:\n raise UnsupportedWheel("Missing Metadata-Version")\n try:\n metadata_version = Version(metadata_version_value)\n except InvalidVersion:\n msg = f"Invalid Metadata-Version: {metadata_version_value}"\n raise UnsupportedWheel(msg)\n if metadata_version >= Version("1.2") and not isinstance(dist.version, Version):\n raise UnsupportedWheel(\n f"Metadata 1.2 mandates PEP 440 version, but {dist_verstr!r} is not"\n )\n\n\ndef _build_one(\n req: InstallRequirement,\n output_dir: str,\n verify: bool,\n build_options: List[str],\n global_options: List[str],\n editable: bool,\n) -> Optional[str]:\n """Build one wheel.\n\n :return: The filename of the built wheel, or None if the build failed.\n """\n artifact = "editable" if editable else "wheel"\n try:\n ensure_dir(output_dir)\n except OSError as e:\n logger.warning(\n "Building %s for %s failed: %s",\n artifact,\n req.name,\n e,\n )\n return None\n\n # Install build deps into temporary directory (PEP 518)\n with req.build_env:\n wheel_path = _build_one_inside_env(\n req, output_dir, build_options, global_options, editable\n )\n if wheel_path and verify:\n try:\n _verify_one(req, wheel_path)\n except (InvalidWheelFilename, UnsupportedWheel) as e:\n logger.warning("Built %s for %s is invalid: %s", artifact, req.name, e)\n return None\n return wheel_path\n\n\ndef _build_one_inside_env(\n req: InstallRequirement,\n output_dir: str,\n build_options: List[str],\n global_options: List[str],\n editable: bool,\n) -> Optional[str]:\n with TempDirectory(kind="wheel") as temp_dir:\n assert req.name\n if req.use_pep517:\n assert req.metadata_directory\n assert req.pep517_backend\n if global_options:\n logger.warning(\n "Ignoring --global-option when building %s using PEP 517", req.name\n )\n if build_options:\n logger.warning(\n "Ignoring --build-option when building %s using PEP 517", req.name\n )\n if editable:\n wheel_path = build_wheel_editable(\n name=req.name,\n backend=req.pep517_backend,\n metadata_directory=req.metadata_directory,\n tempd=temp_dir.path,\n )\n else:\n wheel_path = build_wheel_pep517(\n name=req.name,\n backend=req.pep517_backend,\n metadata_directory=req.metadata_directory,\n tempd=temp_dir.path,\n )\n else:\n wheel_path = build_wheel_legacy(\n name=req.name,\n setup_py_path=req.setup_py_path,\n source_dir=req.unpacked_source_directory,\n global_options=global_options,\n build_options=build_options,\n tempd=temp_dir.path,\n )\n\n if wheel_path is not None:\n wheel_name = os.path.basename(wheel_path)\n dest_path = os.path.join(output_dir, wheel_name)\n try:\n wheel_hash, length = hash_file(wheel_path)\n shutil.move(wheel_path, dest_path)\n logger.info(\n "Created wheel for %s: filename=%s size=%d sha256=%s",\n req.name,\n wheel_name,\n length,\n wheel_hash.hexdigest(),\n )\n logger.info("Stored in directory: %s", output_dir)\n return dest_path\n except Exception as e:\n logger.warning(\n "Building wheel for %s failed: %s",\n req.name,\n e,\n )\n # Ignore return, we can't do anything else useful.\n if not req.use_pep517:\n _clean_one_legacy(req, global_options)\n return None\n\n\ndef _clean_one_legacy(req: InstallRequirement, global_options: List[str]) -> bool:\n clean_args = make_setuptools_clean_args(\n req.setup_py_path,\n global_options=global_options,\n )\n\n logger.info("Running setup.py clean for %s", req.name)\n try:\n call_subprocess(\n clean_args, command_desc="python setup.py clean", cwd=req.source_dir\n )\n return True\n except Exception:\n logger.error("Failed cleaning build dir for %s", req.name)\n return False\n\n\ndef build(\n requirements: Iterable[InstallRequirement],\n wheel_cache: WheelCache,\n verify: bool,\n build_options: List[str],\n global_options: List[str],\n) -> BuildResult:\n """Build wheels.\n\n :return: The list of InstallRequirement that succeeded to build and\n the list of InstallRequirement that failed to build.\n """\n if not requirements:\n return [], []\n\n # Build the wheels.\n logger.info(\n "Building wheels for collected packages: %s",\n ", ".join(req.name for req in requirements), # type: ignore\n )\n\n with indent_log():\n build_successes, build_failures = [], []\n for req in requirements:\n assert req.name\n cache_dir = _get_cache_dir(req, wheel_cache)\n wheel_file = _build_one(\n req,\n cache_dir,\n verify,\n build_options,\n global_options,\n req.editable and req.permit_editable_wheels,\n )\n if wheel_file:\n # Record the download origin in the cache\n if req.download_info is not None:\n # download_info is guaranteed to be set because when we build an\n # InstallRequirement it has been through the preparer before, but\n # let's be cautious.\n wheel_cache.record_download_origin(cache_dir, req.download_info)\n # Update the link for this.\n req.link = Link(path_to_url(wheel_file))\n req.local_file_path = req.link.file_path\n assert req.link.is_wheel\n build_successes.append(req)\n else:\n build_failures.append(req)\n\n # notify success/failure\n if build_successes:\n logger.info(\n "Successfully built %s",\n " ".join([req.name for req in build_successes]), # type: ignore\n )\n if build_failures:\n logger.info(\n "Failed to build %s",\n " ".join([req.name for req in build_failures]), # type: ignore\n )\n # Return a list of requirements that failed to build\n return build_successes, build_failures\n
.venv\Lib\site-packages\pip\_internal\wheel_builder.py
wheel_builder.py
Python
11,212
0.95
0.159639
0.051724
python-kit
485
2024-04-12T07:23:59.758668
GPL-3.0
false
7f8b6e91769e37c2fa290e0dce04107b
from typing import List, Optional\n\nfrom pip._internal.utils import _log\n\n# init_logging() must be called before any call to logging.getLogger()\n# which happens at import of most modules.\n_log.init_logging()\n\n\ndef main(args: Optional[List[str]] = None) -> int:\n """This is preserved for old console scripts that may still be referencing\n it.\n\n For additional details, see https://github.com/pypa/pip/issues/7498.\n """\n from pip._internal.utils.entrypoints import _wrapper\n\n return _wrapper(args)\n
.venv\Lib\site-packages\pip\_internal\__init__.py
__init__.py
Python
513
0.95
0.111111
0.166667
awesome-app
647
2023-12-05T11:41:35.834037
GPL-3.0
false
c99b1ac1d271c5a66f9d3ec658e4595f
"""Logic that powers autocompletion installed by ``pip completion``."""\n\nimport optparse\nimport os\nimport sys\nfrom itertools import chain\nfrom typing import Any, Iterable, List, Optional\n\nfrom pip._internal.cli.main_parser import create_main_parser\nfrom pip._internal.commands import commands_dict, create_command\nfrom pip._internal.metadata import get_default_environment\n\n\ndef autocomplete() -> None:\n """Entry Point for completion of main and subcommand options."""\n # Don't complete if user hasn't sourced bash_completion file.\n if "PIP_AUTO_COMPLETE" not in os.environ:\n return\n # Don't complete if autocompletion environment variables\n # are not present\n if not os.environ.get("COMP_WORDS") or not os.environ.get("COMP_CWORD"):\n return\n cwords = os.environ["COMP_WORDS"].split()[1:]\n cword = int(os.environ["COMP_CWORD"])\n try:\n current = cwords[cword - 1]\n except IndexError:\n current = ""\n\n parser = create_main_parser()\n subcommands = list(commands_dict)\n options = []\n\n # subcommand\n subcommand_name: Optional[str] = None\n for word in cwords:\n if word in subcommands:\n subcommand_name = word\n break\n # subcommand options\n if subcommand_name is not None:\n # special case: 'help' subcommand has no options\n if subcommand_name == "help":\n sys.exit(1)\n # special case: list locally installed dists for show and uninstall\n should_list_installed = not current.startswith("-") and subcommand_name in [\n "show",\n "uninstall",\n ]\n if should_list_installed:\n env = get_default_environment()\n lc = current.lower()\n installed = [\n dist.canonical_name\n for dist in env.iter_installed_distributions(local_only=True)\n if dist.canonical_name.startswith(lc)\n and dist.canonical_name not in cwords[1:]\n ]\n # if there are no dists installed, fall back to option completion\n if installed:\n for dist in installed:\n print(dist)\n sys.exit(1)\n\n should_list_installables = (\n not current.startswith("-") and subcommand_name == "install"\n )\n if should_list_installables:\n for path in auto_complete_paths(current, "path"):\n print(path)\n sys.exit(1)\n\n subcommand = create_command(subcommand_name)\n\n for opt in subcommand.parser.option_list_all:\n if opt.help != optparse.SUPPRESS_HELP:\n options += [\n (opt_str, opt.nargs) for opt_str in opt._long_opts + opt._short_opts\n ]\n\n # filter out previously specified options from available options\n prev_opts = [x.split("=")[0] for x in cwords[1 : cword - 1]]\n options = [(x, v) for (x, v) in options if x not in prev_opts]\n # filter options by current input\n options = [(k, v) for k, v in options if k.startswith(current)]\n # get completion type given cwords and available subcommand options\n completion_type = get_path_completion_type(\n cwords,\n cword,\n subcommand.parser.option_list_all,\n )\n # get completion files and directories if ``completion_type`` is\n # ``<file>``, ``<dir>`` or ``<path>``\n if completion_type:\n paths = auto_complete_paths(current, completion_type)\n options = [(path, 0) for path in paths]\n for option in options:\n opt_label = option[0]\n # append '=' to options which require args\n if option[1] and option[0][:2] == "--":\n opt_label += "="\n print(opt_label)\n else:\n # show main parser options only when necessary\n\n opts = [i.option_list for i in parser.option_groups]\n opts.append(parser.option_list)\n flattened_opts = chain.from_iterable(opts)\n if current.startswith("-"):\n for opt in flattened_opts:\n if opt.help != optparse.SUPPRESS_HELP:\n subcommands += opt._long_opts + opt._short_opts\n else:\n # get completion type given cwords and all available options\n completion_type = get_path_completion_type(cwords, cword, flattened_opts)\n if completion_type:\n subcommands = list(auto_complete_paths(current, completion_type))\n\n print(" ".join([x for x in subcommands if x.startswith(current)]))\n sys.exit(1)\n\n\ndef get_path_completion_type(\n cwords: List[str], cword: int, opts: Iterable[Any]\n) -> Optional[str]:\n """Get the type of path completion (``file``, ``dir``, ``path`` or None)\n\n :param cwords: same as the environmental variable ``COMP_WORDS``\n :param cword: same as the environmental variable ``COMP_CWORD``\n :param opts: The available options to check\n :return: path completion type (``file``, ``dir``, ``path`` or None)\n """\n if cword < 2 or not cwords[cword - 2].startswith("-"):\n return None\n for opt in opts:\n if opt.help == optparse.SUPPRESS_HELP:\n continue\n for o in str(opt).split("/"):\n if cwords[cword - 2].split("=")[0] == o:\n if not opt.metavar or any(\n x in ("path", "file", "dir") for x in opt.metavar.split("/")\n ):\n return opt.metavar\n return None\n\n\ndef auto_complete_paths(current: str, completion_type: str) -> Iterable[str]:\n """If ``completion_type`` is ``file`` or ``path``, list all regular files\n and directories starting with ``current``; otherwise only list directories\n starting with ``current``.\n\n :param current: The word to be completed\n :param completion_type: path completion type(``file``, ``path`` or ``dir``)\n :return: A generator of regular files and/or directories\n """\n directory, filename = os.path.split(current)\n current_path = os.path.abspath(directory)\n # Don't complete paths if they can't be accessed\n if not os.access(current_path, os.R_OK):\n return\n filename = os.path.normcase(filename)\n # list all files that start with ``filename``\n file_list = (\n x for x in os.listdir(current_path) if os.path.normcase(x).startswith(filename)\n )\n for f in file_list:\n opt = os.path.join(current_path, f)\n comp_file = os.path.normcase(os.path.join(directory, f))\n # complete regular files when there is not ``<dir>`` after option\n # complete directories when there is ``<file>``, ``<path>`` or\n # ``<dir>``after option\n if completion_type != "dir" and os.path.isfile(opt):\n yield comp_file\n elif os.path.isdir(opt):\n yield os.path.join(comp_file, "")\n
.venv\Lib\site-packages\pip\_internal\cli\autocompletion.py
autocompletion.py
Python
6,864
0.95
0.314286
0.133758
vue-tools
840
2025-06-07T16:44:59.499759
MIT
false
1a9abf7c132e7be52ff3f1d0f44a76d5
"""Base Command class, and related routines"""\n\nimport logging\nimport logging.config\nimport optparse\nimport os\nimport sys\nimport traceback\nfrom optparse import Values\nfrom typing import List, Optional, Tuple\n\nfrom pip._vendor.rich import reconfigure\nfrom pip._vendor.rich import traceback as rich_traceback\n\nfrom pip._internal.cli import cmdoptions\nfrom pip._internal.cli.command_context import CommandContextMixIn\nfrom pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter\nfrom pip._internal.cli.status_codes import (\n ERROR,\n PREVIOUS_BUILD_DIR_ERROR,\n UNKNOWN_ERROR,\n VIRTUALENV_NOT_FOUND,\n)\nfrom pip._internal.exceptions import (\n BadCommand,\n CommandError,\n DiagnosticPipError,\n InstallationError,\n NetworkConnectionError,\n PreviousBuildDirError,\n)\nfrom pip._internal.utils.filesystem import check_path_owner\nfrom pip._internal.utils.logging import BrokenStdoutLoggingError, setup_logging\nfrom pip._internal.utils.misc import get_prog, normalize_path\nfrom pip._internal.utils.temp_dir import TempDirectoryTypeRegistry as TempDirRegistry\nfrom pip._internal.utils.temp_dir import global_tempdir_manager, tempdir_registry\nfrom pip._internal.utils.virtualenv import running_under_virtualenv\n\n__all__ = ["Command"]\n\nlogger = logging.getLogger(__name__)\n\n\nclass Command(CommandContextMixIn):\n usage: str = ""\n ignore_require_venv: bool = False\n\n def __init__(self, name: str, summary: str, isolated: bool = False) -> None:\n super().__init__()\n\n self.name = name\n self.summary = summary\n self.parser = ConfigOptionParser(\n usage=self.usage,\n prog=f"{get_prog()} {name}",\n formatter=UpdatingDefaultsHelpFormatter(),\n add_help_option=False,\n name=name,\n description=self.__doc__,\n isolated=isolated,\n )\n\n self.tempdir_registry: Optional[TempDirRegistry] = None\n\n # Commands should add options to this option group\n optgroup_name = f"{self.name.capitalize()} Options"\n self.cmd_opts = optparse.OptionGroup(self.parser, optgroup_name)\n\n # Add the general options\n gen_opts = cmdoptions.make_option_group(\n cmdoptions.general_group,\n self.parser,\n )\n self.parser.add_option_group(gen_opts)\n\n self.add_options()\n\n def add_options(self) -> None:\n pass\n\n def handle_pip_version_check(self, options: Values) -> None:\n """\n This is a no-op so that commands by default do not do the pip version\n check.\n """\n # Make sure we do the pip version check if the index_group options\n # are present.\n assert not hasattr(options, "no_index")\n\n def run(self, options: Values, args: List[str]) -> int:\n raise NotImplementedError\n\n def _run_wrapper(self, level_number: int, options: Values, args: List[str]) -> int:\n def _inner_run() -> int:\n try:\n return self.run(options, args)\n finally:\n self.handle_pip_version_check(options)\n\n if options.debug_mode:\n rich_traceback.install(show_locals=True)\n return _inner_run()\n\n try:\n status = _inner_run()\n assert isinstance(status, int)\n return status\n except DiagnosticPipError as exc:\n logger.error("%s", exc, extra={"rich": True})\n logger.debug("Exception information:", exc_info=True)\n\n return ERROR\n except PreviousBuildDirError as exc:\n logger.critical(str(exc))\n logger.debug("Exception information:", exc_info=True)\n\n return PREVIOUS_BUILD_DIR_ERROR\n except (\n InstallationError,\n BadCommand,\n NetworkConnectionError,\n ) as exc:\n logger.critical(str(exc))\n logger.debug("Exception information:", exc_info=True)\n\n return ERROR\n except CommandError as exc:\n logger.critical("%s", exc)\n logger.debug("Exception information:", exc_info=True)\n\n return ERROR\n except BrokenStdoutLoggingError:\n # Bypass our logger and write any remaining messages to\n # stderr because stdout no longer works.\n print("ERROR: Pipe to stdout was broken", file=sys.stderr)\n if level_number <= logging.DEBUG:\n traceback.print_exc(file=sys.stderr)\n\n return ERROR\n except KeyboardInterrupt:\n logger.critical("Operation cancelled by user")\n logger.debug("Exception information:", exc_info=True)\n\n return ERROR\n except BaseException:\n logger.critical("Exception:", exc_info=True)\n\n return UNKNOWN_ERROR\n\n def parse_args(self, args: List[str]) -> Tuple[Values, List[str]]:\n # factored out for testability\n return self.parser.parse_args(args)\n\n def main(self, args: List[str]) -> int:\n try:\n with self.main_context():\n return self._main(args)\n finally:\n logging.shutdown()\n\n def _main(self, args: List[str]) -> int:\n # We must initialize this before the tempdir manager, otherwise the\n # configuration would not be accessible by the time we clean up the\n # tempdir manager.\n self.tempdir_registry = self.enter_context(tempdir_registry())\n # Intentionally set as early as possible so globally-managed temporary\n # directories are available to the rest of the code.\n self.enter_context(global_tempdir_manager())\n\n options, args = self.parse_args(args)\n\n # Set verbosity so that it can be used elsewhere.\n self.verbosity = options.verbose - options.quiet\n if options.debug_mode:\n self.verbosity = 2\n\n reconfigure(no_color=options.no_color)\n level_number = setup_logging(\n verbosity=self.verbosity,\n no_color=options.no_color,\n user_log_file=options.log,\n )\n\n always_enabled_features = set(options.features_enabled) & set(\n cmdoptions.ALWAYS_ENABLED_FEATURES\n )\n if always_enabled_features:\n logger.warning(\n "The following features are always enabled: %s. ",\n ", ".join(sorted(always_enabled_features)),\n )\n\n # Make sure that the --python argument isn't specified after the\n # subcommand. We can tell, because if --python was specified,\n # we should only reach this point if we're running in the created\n # subprocess, which has the _PIP_RUNNING_IN_SUBPROCESS environment\n # variable set.\n if options.python and "_PIP_RUNNING_IN_SUBPROCESS" not in os.environ:\n logger.critical(\n "The --python option must be placed before the pip subcommand name"\n )\n sys.exit(ERROR)\n\n # TODO: Try to get these passing down from the command?\n # without resorting to os.environ to hold these.\n # This also affects isolated builds and it should.\n\n if options.no_input:\n os.environ["PIP_NO_INPUT"] = "1"\n\n if options.exists_action:\n os.environ["PIP_EXISTS_ACTION"] = " ".join(options.exists_action)\n\n if options.require_venv and not self.ignore_require_venv:\n # If a venv is required check if it can really be found\n if not running_under_virtualenv():\n logger.critical("Could not find an activated virtualenv (required).")\n sys.exit(VIRTUALENV_NOT_FOUND)\n\n if options.cache_dir:\n options.cache_dir = normalize_path(options.cache_dir)\n if not check_path_owner(options.cache_dir):\n logger.warning(\n "The directory '%s' or its parent directory is not owned "\n "or is not writable by the current user. The cache "\n "has been disabled. Check the permissions and owner of "\n "that directory. If executing pip with sudo, you should "\n "use sudo's -H flag.",\n options.cache_dir,\n )\n options.cache_dir = None\n\n return self._run_wrapper(level_number, options, args)\n
.venv\Lib\site-packages\pip\_internal\cli\base_command.py
base_command.py
Python
8,351
0.95
0.128755
0.11399
awesome-app
575
2025-02-03T08:37:23.227042
Apache-2.0
false
598887cd835d47143cb439f6afc52f7c
"""\nshared options and groups\n\nThe principle here is to define options once, but *not* instantiate them\nglobally. One reason being that options with action='append' can carry state\nbetween parses. pip parses general options twice internally, and shouldn't\npass on state. To be consistent, all options will follow this design.\n"""\n\n# The following comment should be removed at some point in the future.\n# mypy: strict-optional=False\n\nimport importlib.util\nimport logging\nimport os\nimport pathlib\nimport textwrap\nfrom functools import partial\nfrom optparse import SUPPRESS_HELP, Option, OptionGroup, OptionParser, Values\nfrom textwrap import dedent\nfrom typing import Any, Callable, Dict, Optional, Tuple\n\nfrom pip._vendor.packaging.utils import canonicalize_name\n\nfrom pip._internal.cli.parser import ConfigOptionParser\nfrom pip._internal.exceptions import CommandError\nfrom pip._internal.locations import USER_CACHE_DIR, get_src_prefix\nfrom pip._internal.models.format_control import FormatControl\nfrom pip._internal.models.index import PyPI\nfrom pip._internal.models.target_python import TargetPython\nfrom pip._internal.utils.hashes import STRONG_HASHES\nfrom pip._internal.utils.misc import strtobool\n\nlogger = logging.getLogger(__name__)\n\n\ndef raise_option_error(parser: OptionParser, option: Option, msg: str) -> None:\n """\n Raise an option parsing error using parser.error().\n\n Args:\n parser: an OptionParser instance.\n option: an Option instance.\n msg: the error text.\n """\n msg = f"{option} error: {msg}"\n msg = textwrap.fill(" ".join(msg.split()))\n parser.error(msg)\n\n\ndef make_option_group(group: Dict[str, Any], parser: ConfigOptionParser) -> OptionGroup:\n """\n Return an OptionGroup object\n group -- assumed to be dict with 'name' and 'options' keys\n parser -- an optparse Parser\n """\n option_group = OptionGroup(parser, group["name"])\n for option in group["options"]:\n option_group.add_option(option())\n return option_group\n\n\ndef check_dist_restriction(options: Values, check_target: bool = False) -> None:\n """Function for determining if custom platform options are allowed.\n\n :param options: The OptionParser options.\n :param check_target: Whether or not to check if --target is being used.\n """\n dist_restriction_set = any(\n [\n options.python_version,\n options.platforms,\n options.abis,\n options.implementation,\n ]\n )\n\n binary_only = FormatControl(set(), {":all:"})\n sdist_dependencies_allowed = (\n options.format_control != binary_only and not options.ignore_dependencies\n )\n\n # Installations or downloads using dist restrictions must not combine\n # source distributions and dist-specific wheels, as they are not\n # guaranteed to be locally compatible.\n if dist_restriction_set and sdist_dependencies_allowed:\n raise CommandError(\n "When restricting platform and interpreter constraints using "\n "--python-version, --platform, --abi, or --implementation, "\n "either --no-deps must be set, or --only-binary=:all: must be "\n "set and --no-binary must not be set (or must be set to "\n ":none:)."\n )\n\n if check_target:\n if not options.dry_run and dist_restriction_set and not options.target_dir:\n raise CommandError(\n "Can not use any platform or abi specific options unless "\n "installing via '--target' or using '--dry-run'"\n )\n\n\ndef _path_option_check(option: Option, opt: str, value: str) -> str:\n return os.path.expanduser(value)\n\n\ndef _package_name_option_check(option: Option, opt: str, value: str) -> str:\n return canonicalize_name(value)\n\n\nclass PipOption(Option):\n TYPES = Option.TYPES + ("path", "package_name")\n TYPE_CHECKER = Option.TYPE_CHECKER.copy()\n TYPE_CHECKER["package_name"] = _package_name_option_check\n TYPE_CHECKER["path"] = _path_option_check\n\n\n###########\n# options #\n###########\n\nhelp_: Callable[..., Option] = partial(\n Option,\n "-h",\n "--help",\n dest="help",\n action="help",\n help="Show help.",\n)\n\ndebug_mode: Callable[..., Option] = partial(\n Option,\n "--debug",\n dest="debug_mode",\n action="store_true",\n default=False,\n help=(\n "Let unhandled exceptions propagate outside the main subroutine, "\n "instead of logging them to stderr."\n ),\n)\n\nisolated_mode: Callable[..., Option] = partial(\n Option,\n "--isolated",\n dest="isolated_mode",\n action="store_true",\n default=False,\n help=(\n "Run pip in an isolated mode, ignoring environment variables and user "\n "configuration."\n ),\n)\n\nrequire_virtualenv: Callable[..., Option] = partial(\n Option,\n "--require-virtualenv",\n "--require-venv",\n dest="require_venv",\n action="store_true",\n default=False,\n help=(\n "Allow pip to only run in a virtual environment; "\n "exit with an error otherwise."\n ),\n)\n\noverride_externally_managed: Callable[..., Option] = partial(\n Option,\n "--break-system-packages",\n dest="override_externally_managed",\n action="store_true",\n help="Allow pip to modify an EXTERNALLY-MANAGED Python installation",\n)\n\npython: Callable[..., Option] = partial(\n Option,\n "--python",\n dest="python",\n help="Run pip with the specified Python interpreter.",\n)\n\nverbose: Callable[..., Option] = partial(\n Option,\n "-v",\n "--verbose",\n dest="verbose",\n action="count",\n default=0,\n help="Give more output. Option is additive, and can be used up to 3 times.",\n)\n\nno_color: Callable[..., Option] = partial(\n Option,\n "--no-color",\n dest="no_color",\n action="store_true",\n default=False,\n help="Suppress colored output.",\n)\n\nversion: Callable[..., Option] = partial(\n Option,\n "-V",\n "--version",\n dest="version",\n action="store_true",\n help="Show version and exit.",\n)\n\nquiet: Callable[..., Option] = partial(\n Option,\n "-q",\n "--quiet",\n dest="quiet",\n action="count",\n default=0,\n help=(\n "Give less output. Option is additive, and can be used up to 3"\n " times (corresponding to WARNING, ERROR, and CRITICAL logging"\n " levels)."\n ),\n)\n\nprogress_bar: Callable[..., Option] = partial(\n Option,\n "--progress-bar",\n dest="progress_bar",\n type="choice",\n choices=["on", "off", "raw"],\n default="on",\n help="Specify whether the progress bar should be used [on, off, raw] (default: on)",\n)\n\nlog: Callable[..., Option] = partial(\n PipOption,\n "--log",\n "--log-file",\n "--local-log",\n dest="log",\n metavar="path",\n type="path",\n help="Path to a verbose appending log.",\n)\n\nno_input: Callable[..., Option] = partial(\n Option,\n # Don't ask for input\n "--no-input",\n dest="no_input",\n action="store_true",\n default=False,\n help="Disable prompting for input.",\n)\n\nkeyring_provider: Callable[..., Option] = partial(\n Option,\n "--keyring-provider",\n dest="keyring_provider",\n choices=["auto", "disabled", "import", "subprocess"],\n default="auto",\n help=(\n "Enable the credential lookup via the keyring library if user input is allowed."\n " Specify which mechanism to use [auto, disabled, import, subprocess]."\n " (default: %default)"\n ),\n)\n\nproxy: Callable[..., Option] = partial(\n Option,\n "--proxy",\n dest="proxy",\n type="str",\n default="",\n help="Specify a proxy in the form scheme://[user:passwd@]proxy.server:port.",\n)\n\nretries: Callable[..., Option] = partial(\n Option,\n "--retries",\n dest="retries",\n type="int",\n default=5,\n help="Maximum attempts to establish a new HTTP connection. (default: %default)",\n)\n\nresume_retries: Callable[..., Option] = partial(\n Option,\n "--resume-retries",\n dest="resume_retries",\n type="int",\n default=0,\n help="Maximum attempts to resume or restart an incomplete download. "\n "(default: %default)",\n)\n\ntimeout: Callable[..., Option] = partial(\n Option,\n "--timeout",\n "--default-timeout",\n metavar="sec",\n dest="timeout",\n type="float",\n default=15,\n help="Set the socket timeout (default %default seconds).",\n)\n\n\ndef exists_action() -> Option:\n return Option(\n # Option when path already exist\n "--exists-action",\n dest="exists_action",\n type="choice",\n choices=["s", "i", "w", "b", "a"],\n default=[],\n action="append",\n metavar="action",\n help="Default action when a path already exists: "\n "(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.",\n )\n\n\ncert: Callable[..., Option] = partial(\n PipOption,\n "--cert",\n dest="cert",\n type="path",\n metavar="path",\n help=(\n "Path to PEM-encoded CA certificate bundle. "\n "If provided, overrides the default. "\n "See 'SSL Certificate Verification' in pip documentation "\n "for more information."\n ),\n)\n\nclient_cert: Callable[..., Option] = partial(\n PipOption,\n "--client-cert",\n dest="client_cert",\n type="path",\n default=None,\n metavar="path",\n help="Path to SSL client certificate, a single file containing the "\n "private key and the certificate in PEM format.",\n)\n\nindex_url: Callable[..., Option] = partial(\n Option,\n "-i",\n "--index-url",\n "--pypi-url",\n dest="index_url",\n metavar="URL",\n default=PyPI.simple_url,\n help="Base URL of the Python Package Index (default %default). "\n "This should point to a repository compliant with PEP 503 "\n "(the simple repository API) or a local directory laid out "\n "in the same format.",\n)\n\n\ndef extra_index_url() -> Option:\n return Option(\n "--extra-index-url",\n dest="extra_index_urls",\n metavar="URL",\n action="append",\n default=[],\n help="Extra URLs of package indexes to use in addition to "\n "--index-url. Should follow the same rules as "\n "--index-url.",\n )\n\n\nno_index: Callable[..., Option] = partial(\n Option,\n "--no-index",\n dest="no_index",\n action="store_true",\n default=False,\n help="Ignore package index (only looking at --find-links URLs instead).",\n)\n\n\ndef find_links() -> Option:\n return Option(\n "-f",\n "--find-links",\n dest="find_links",\n action="append",\n default=[],\n metavar="url",\n help="If a URL or path to an html file, then parse for links to "\n "archives such as sdist (.tar.gz) or wheel (.whl) files. "\n "If a local path or file:// URL that's a directory, "\n "then look for archives in the directory listing. "\n "Links to VCS project URLs are not supported.",\n )\n\n\ndef trusted_host() -> Option:\n return Option(\n "--trusted-host",\n dest="trusted_hosts",\n action="append",\n metavar="HOSTNAME",\n default=[],\n help="Mark this host or host:port pair as trusted, even though it "\n "does not have valid or any HTTPS.",\n )\n\n\ndef constraints() -> Option:\n return Option(\n "-c",\n "--constraint",\n dest="constraints",\n action="append",\n default=[],\n metavar="file",\n help="Constrain versions using the given constraints file. "\n "This option can be used multiple times.",\n )\n\n\ndef requirements() -> Option:\n return Option(\n "-r",\n "--requirement",\n dest="requirements",\n action="append",\n default=[],\n metavar="file",\n help="Install from the given requirements file. "\n "This option can be used multiple times.",\n )\n\n\ndef editable() -> Option:\n return Option(\n "-e",\n "--editable",\n dest="editables",\n action="append",\n default=[],\n metavar="path/url",\n help=(\n "Install a project in editable mode (i.e. setuptools "\n '"develop mode") from a local project path or a VCS url.'\n ),\n )\n\n\ndef _handle_src(option: Option, opt_str: str, value: str, parser: OptionParser) -> None:\n value = os.path.abspath(value)\n setattr(parser.values, option.dest, value)\n\n\nsrc: Callable[..., Option] = partial(\n PipOption,\n "--src",\n "--source",\n "--source-dir",\n "--source-directory",\n dest="src_dir",\n type="path",\n metavar="dir",\n default=get_src_prefix(),\n action="callback",\n callback=_handle_src,\n help="Directory to check out editable projects into. "\n 'The default in a virtualenv is "<venv path>/src". '\n 'The default for global installs is "<current dir>/src".',\n)\n\n\ndef _get_format_control(values: Values, option: Option) -> Any:\n """Get a format_control object."""\n return getattr(values, option.dest)\n\n\ndef _handle_no_binary(\n option: Option, opt_str: str, value: str, parser: OptionParser\n) -> None:\n existing = _get_format_control(parser.values, option)\n FormatControl.handle_mutual_excludes(\n value,\n existing.no_binary,\n existing.only_binary,\n )\n\n\ndef _handle_only_binary(\n option: Option, opt_str: str, value: str, parser: OptionParser\n) -> None:\n existing = _get_format_control(parser.values, option)\n FormatControl.handle_mutual_excludes(\n value,\n existing.only_binary,\n existing.no_binary,\n )\n\n\ndef no_binary() -> Option:\n format_control = FormatControl(set(), set())\n return Option(\n "--no-binary",\n dest="format_control",\n action="callback",\n callback=_handle_no_binary,\n type="str",\n default=format_control,\n help="Do not use binary packages. Can be supplied multiple times, and "\n 'each time adds to the existing value. Accepts either ":all:" to '\n 'disable all binary packages, ":none:" to empty the set (notice '\n "the colons), or one or more package names with commas between "\n "them (no colons). Note that some packages are tricky to compile "\n "and may fail to install when this option is used on them.",\n )\n\n\ndef only_binary() -> Option:\n format_control = FormatControl(set(), set())\n return Option(\n "--only-binary",\n dest="format_control",\n action="callback",\n callback=_handle_only_binary,\n type="str",\n default=format_control,\n help="Do not use source packages. Can be supplied multiple times, and "\n 'each time adds to the existing value. Accepts either ":all:" to '\n 'disable all source packages, ":none:" to empty the set, or one '\n "or more package names with commas between them. Packages "\n "without binary distributions will fail to install when this "\n "option is used on them.",\n )\n\n\nplatforms: Callable[..., Option] = partial(\n Option,\n "--platform",\n dest="platforms",\n metavar="platform",\n action="append",\n default=None,\n help=(\n "Only use wheels compatible with <platform>. Defaults to the "\n "platform of the running system. Use this option multiple times to "\n "specify multiple platforms supported by the target interpreter."\n ),\n)\n\n\n# This was made a separate function for unit-testing purposes.\ndef _convert_python_version(value: str) -> Tuple[Tuple[int, ...], Optional[str]]:\n """\n Convert a version string like "3", "37", or "3.7.3" into a tuple of ints.\n\n :return: A 2-tuple (version_info, error_msg), where `error_msg` is\n non-None if and only if there was a parsing error.\n """\n if not value:\n # The empty string is the same as not providing a value.\n return (None, None)\n\n parts = value.split(".")\n if len(parts) > 3:\n return ((), "at most three version parts are allowed")\n\n if len(parts) == 1:\n # Then we are in the case of "3" or "37".\n value = parts[0]\n if len(value) > 1:\n parts = [value[0], value[1:]]\n\n try:\n version_info = tuple(int(part) for part in parts)\n except ValueError:\n return ((), "each version part must be an integer")\n\n return (version_info, None)\n\n\ndef _handle_python_version(\n option: Option, opt_str: str, value: str, parser: OptionParser\n) -> None:\n """\n Handle a provided --python-version value.\n """\n version_info, error_msg = _convert_python_version(value)\n if error_msg is not None:\n msg = f"invalid --python-version value: {value!r}: {error_msg}"\n raise_option_error(parser, option=option, msg=msg)\n\n parser.values.python_version = version_info\n\n\npython_version: Callable[..., Option] = partial(\n Option,\n "--python-version",\n dest="python_version",\n metavar="python_version",\n action="callback",\n callback=_handle_python_version,\n type="str",\n default=None,\n help=dedent(\n """\\n The Python interpreter version to use for wheel and "Requires-Python"\n compatibility checks. Defaults to a version derived from the running\n interpreter. The version can be specified using up to three dot-separated\n integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor\n version can also be given as a string without dots (e.g. "37" for 3.7.0).\n """\n ),\n)\n\n\nimplementation: Callable[..., Option] = partial(\n Option,\n "--implementation",\n dest="implementation",\n metavar="implementation",\n default=None,\n help=(\n "Only use wheels compatible with Python "\n "implementation <implementation>, e.g. 'pp', 'jy', 'cp', "\n " or 'ip'. If not specified, then the current "\n "interpreter implementation is used. Use 'py' to force "\n "implementation-agnostic wheels."\n ),\n)\n\n\nabis: Callable[..., Option] = partial(\n Option,\n "--abi",\n dest="abis",\n metavar="abi",\n action="append",\n default=None,\n help=(\n "Only use wheels compatible with Python abi <abi>, e.g. 'pypy_41'. "\n "If not specified, then the current interpreter abi tag is used. "\n "Use this option multiple times to specify multiple abis supported "\n "by the target interpreter. Generally you will need to specify "\n "--implementation, --platform, and --python-version when using this "\n "option."\n ),\n)\n\n\ndef add_target_python_options(cmd_opts: OptionGroup) -> None:\n cmd_opts.add_option(platforms())\n cmd_opts.add_option(python_version())\n cmd_opts.add_option(implementation())\n cmd_opts.add_option(abis())\n\n\ndef make_target_python(options: Values) -> TargetPython:\n target_python = TargetPython(\n platforms=options.platforms,\n py_version_info=options.python_version,\n abis=options.abis,\n implementation=options.implementation,\n )\n\n return target_python\n\n\ndef prefer_binary() -> Option:\n return Option(\n "--prefer-binary",\n dest="prefer_binary",\n action="store_true",\n default=False,\n help=(\n "Prefer binary packages over source packages, even if the "\n "source packages are newer."\n ),\n )\n\n\ncache_dir: Callable[..., Option] = partial(\n PipOption,\n "--cache-dir",\n dest="cache_dir",\n default=USER_CACHE_DIR,\n metavar="dir",\n type="path",\n help="Store the cache data in <dir>.",\n)\n\n\ndef _handle_no_cache_dir(\n option: Option, opt: str, value: str, parser: OptionParser\n) -> None:\n """\n Process a value provided for the --no-cache-dir option.\n\n This is an optparse.Option callback for the --no-cache-dir option.\n """\n # The value argument will be None if --no-cache-dir is passed via the\n # command-line, since the option doesn't accept arguments. However,\n # the value can be non-None if the option is triggered e.g. by an\n # environment variable, like PIP_NO_CACHE_DIR=true.\n if value is not None:\n # Then parse the string value to get argument error-checking.\n try:\n strtobool(value)\n except ValueError as exc:\n raise_option_error(parser, option=option, msg=str(exc))\n\n # Originally, setting PIP_NO_CACHE_DIR to a value that strtobool()\n # converted to 0 (like "false" or "no") caused cache_dir to be disabled\n # rather than enabled (logic would say the latter). Thus, we disable\n # the cache directory not just on values that parse to True, but (for\n # backwards compatibility reasons) also on values that parse to False.\n # In other words, always set it to False if the option is provided in\n # some (valid) form.\n parser.values.cache_dir = False\n\n\nno_cache: Callable[..., Option] = partial(\n Option,\n "--no-cache-dir",\n dest="cache_dir",\n action="callback",\n callback=_handle_no_cache_dir,\n help="Disable the cache.",\n)\n\nno_deps: Callable[..., Option] = partial(\n Option,\n "--no-deps",\n "--no-dependencies",\n dest="ignore_dependencies",\n action="store_true",\n default=False,\n help="Don't install package dependencies.",\n)\n\n\ndef _handle_dependency_group(\n option: Option, opt: str, value: str, parser: OptionParser\n) -> None:\n """\n Process a value provided for the --group option.\n\n Splits on the rightmost ":", and validates that the path (if present) ends\n in `pyproject.toml`. Defaults the path to `pyproject.toml` when one is not given.\n\n `:` cannot appear in dependency group names, so this is a safe and simple parse.\n\n This is an optparse.Option callback for the dependency_groups option.\n """\n path, sep, groupname = value.rpartition(":")\n if not sep:\n path = "pyproject.toml"\n else:\n # check for 'pyproject.toml' filenames using pathlib\n if pathlib.PurePath(path).name != "pyproject.toml":\n msg = "group paths use 'pyproject.toml' filenames"\n raise_option_error(parser, option=option, msg=msg)\n\n parser.values.dependency_groups.append((path, groupname))\n\n\ndependency_groups: Callable[..., Option] = partial(\n Option,\n "--group",\n dest="dependency_groups",\n default=[],\n type=str,\n action="callback",\n callback=_handle_dependency_group,\n metavar="[path:]group",\n help='Install a named dependency-group from a "pyproject.toml" file. '\n 'If a path is given, the name of the file must be "pyproject.toml". '\n 'Defaults to using "pyproject.toml" in the current directory.',\n)\n\nignore_requires_python: Callable[..., Option] = partial(\n Option,\n "--ignore-requires-python",\n dest="ignore_requires_python",\n action="store_true",\n help="Ignore the Requires-Python information.",\n)\n\nno_build_isolation: Callable[..., Option] = partial(\n Option,\n "--no-build-isolation",\n dest="build_isolation",\n action="store_false",\n default=True,\n help="Disable isolation when building a modern source distribution. "\n "Build dependencies specified by PEP 518 must be already installed "\n "if this option is used.",\n)\n\ncheck_build_deps: Callable[..., Option] = partial(\n Option,\n "--check-build-dependencies",\n dest="check_build_deps",\n action="store_true",\n default=False,\n help="Check the build dependencies when PEP517 is used.",\n)\n\n\ndef _handle_no_use_pep517(\n option: Option, opt: str, value: str, parser: OptionParser\n) -> None:\n """\n Process a value provided for the --no-use-pep517 option.\n\n This is an optparse.Option callback for the no_use_pep517 option.\n """\n # Since --no-use-pep517 doesn't accept arguments, the value argument\n # will be None if --no-use-pep517 is passed via the command-line.\n # However, the value can be non-None if the option is triggered e.g.\n # by an environment variable, for example "PIP_NO_USE_PEP517=true".\n if value is not None:\n msg = """A value was passed for --no-use-pep517,\n probably using either the PIP_NO_USE_PEP517 environment variable\n or the "no-use-pep517" config file option. Use an appropriate value\n of the PIP_USE_PEP517 environment variable or the "use-pep517"\n config file option instead.\n """\n raise_option_error(parser, option=option, msg=msg)\n\n # If user doesn't wish to use pep517, we check if setuptools is installed\n # and raise error if it is not.\n packages = ("setuptools",)\n if not all(importlib.util.find_spec(package) for package in packages):\n msg = (\n f"It is not possible to use --no-use-pep517 "\n f"without {' and '.join(packages)} installed."\n )\n raise_option_error(parser, option=option, msg=msg)\n\n # Otherwise, --no-use-pep517 was passed via the command-line.\n parser.values.use_pep517 = False\n\n\nuse_pep517: Any = partial(\n Option,\n "--use-pep517",\n dest="use_pep517",\n action="store_true",\n default=None,\n help="Use PEP 517 for building source distributions "\n "(use --no-use-pep517 to force legacy behaviour).",\n)\n\nno_use_pep517: Any = partial(\n Option,\n "--no-use-pep517",\n dest="use_pep517",\n action="callback",\n callback=_handle_no_use_pep517,\n default=None,\n help=SUPPRESS_HELP,\n)\n\n\ndef _handle_config_settings(\n option: Option, opt_str: str, value: str, parser: OptionParser\n) -> None:\n key, sep, val = value.partition("=")\n if sep != "=":\n parser.error(f"Arguments to {opt_str} must be of the form KEY=VAL")\n dest = getattr(parser.values, option.dest)\n if dest is None:\n dest = {}\n setattr(parser.values, option.dest, dest)\n if key in dest:\n if isinstance(dest[key], list):\n dest[key].append(val)\n else:\n dest[key] = [dest[key], val]\n else:\n dest[key] = val\n\n\nconfig_settings: Callable[..., Option] = partial(\n Option,\n "-C",\n "--config-settings",\n dest="config_settings",\n type=str,\n action="callback",\n callback=_handle_config_settings,\n metavar="settings",\n help="Configuration settings to be passed to the PEP 517 build backend. "\n "Settings take the form KEY=VALUE. Use multiple --config-settings options "\n "to pass multiple keys to the backend.",\n)\n\nbuild_options: Callable[..., Option] = partial(\n Option,\n "--build-option",\n dest="build_options",\n metavar="options",\n action="append",\n help="Extra arguments to be supplied to 'setup.py bdist_wheel'.",\n)\n\nglobal_options: Callable[..., Option] = partial(\n Option,\n "--global-option",\n dest="global_options",\n action="append",\n metavar="options",\n help="Extra global options to be supplied to the setup.py "\n "call before the install or bdist_wheel command.",\n)\n\nno_clean: Callable[..., Option] = partial(\n Option,\n "--no-clean",\n action="store_true",\n default=False,\n help="Don't clean up build directories.",\n)\n\npre: Callable[..., Option] = partial(\n Option,\n "--pre",\n action="store_true",\n default=False,\n help="Include pre-release and development versions. By default, "\n "pip only finds stable versions.",\n)\n\njson: Callable[..., Option] = partial(\n Option,\n "--json",\n action="store_true",\n default=False,\n help="Output data in a machine-readable JSON format.",\n)\n\ndisable_pip_version_check: Callable[..., Option] = partial(\n Option,\n "--disable-pip-version-check",\n dest="disable_pip_version_check",\n action="store_true",\n default=False,\n help="Don't periodically check PyPI to determine whether a new version "\n "of pip is available for download. Implied with --no-index.",\n)\n\nroot_user_action: Callable[..., Option] = partial(\n Option,\n "--root-user-action",\n dest="root_user_action",\n default="warn",\n choices=["warn", "ignore"],\n help="Action if pip is run as a root user [warn, ignore] (default: warn)",\n)\n\n\ndef _handle_merge_hash(\n option: Option, opt_str: str, value: str, parser: OptionParser\n) -> None:\n """Given a value spelled "algo:digest", append the digest to a list\n pointed to in a dict by the algo name."""\n if not parser.values.hashes:\n parser.values.hashes = {}\n try:\n algo, digest = value.split(":", 1)\n except ValueError:\n parser.error(\n f"Arguments to {opt_str} must be a hash name "\n "followed by a value, like --hash=sha256:"\n "abcde..."\n )\n if algo not in STRONG_HASHES:\n parser.error(\n "Allowed hash algorithms for {} are {}.".format(\n opt_str, ", ".join(STRONG_HASHES)\n )\n )\n parser.values.hashes.setdefault(algo, []).append(digest)\n\n\nhash: Callable[..., Option] = partial(\n Option,\n "--hash",\n # Hash values eventually end up in InstallRequirement.hashes due to\n # __dict__ copying in process_line().\n dest="hashes",\n action="callback",\n callback=_handle_merge_hash,\n type="string",\n help="Verify that the package's archive matches this "\n "hash before installing. Example: --hash=sha256:abcdef...",\n)\n\n\nrequire_hashes: Callable[..., Option] = partial(\n Option,\n "--require-hashes",\n dest="require_hashes",\n action="store_true",\n default=False,\n help="Require a hash to check each requirement against, for "\n "repeatable installs. This option is implied when any package in a "\n "requirements file has a --hash option.",\n)\n\n\nlist_path: Callable[..., Option] = partial(\n PipOption,\n "--path",\n dest="path",\n type="path",\n action="append",\n help="Restrict to the specified installation path for listing "\n "packages (can be used multiple times).",\n)\n\n\ndef check_list_path_option(options: Values) -> None:\n if options.path and (options.user or options.local):\n raise CommandError("Cannot combine '--path' with '--user' or '--local'")\n\n\nlist_exclude: Callable[..., Option] = partial(\n PipOption,\n "--exclude",\n dest="excludes",\n action="append",\n metavar="package",\n type="package_name",\n help="Exclude specified package from the output",\n)\n\n\nno_python_version_warning: Callable[..., Option] = partial(\n Option,\n "--no-python-version-warning",\n dest="no_python_version_warning",\n action="store_true",\n default=False,\n help=SUPPRESS_HELP, # No-op, a hold-over from the Python 2->3 transition.\n)\n\n\n# Features that are now always on. A warning is printed if they are used.\nALWAYS_ENABLED_FEATURES = [\n "truststore", # always on since 24.2\n "no-binary-enable-wheel-cache", # always on since 23.1\n]\n\nuse_new_feature: Callable[..., Option] = partial(\n Option,\n "--use-feature",\n dest="features_enabled",\n metavar="feature",\n action="append",\n default=[],\n choices=[\n "fast-deps",\n ]\n + ALWAYS_ENABLED_FEATURES,\n help="Enable new functionality, that may be backward incompatible.",\n)\n\nuse_deprecated_feature: Callable[..., Option] = partial(\n Option,\n "--use-deprecated",\n dest="deprecated_features_enabled",\n metavar="feature",\n action="append",\n default=[],\n choices=[\n "legacy-resolver",\n "legacy-certs",\n ],\n help=("Enable deprecated functionality, that will be removed in the future."),\n)\n\n##########\n# groups #\n##########\n\ngeneral_group: Dict[str, Any] = {\n "name": "General Options",\n "options": [\n help_,\n debug_mode,\n isolated_mode,\n require_virtualenv,\n python,\n verbose,\n version,\n quiet,\n log,\n no_input,\n keyring_provider,\n proxy,\n retries,\n timeout,\n exists_action,\n trusted_host,\n cert,\n client_cert,\n cache_dir,\n no_cache,\n disable_pip_version_check,\n no_color,\n no_python_version_warning,\n use_new_feature,\n use_deprecated_feature,\n resume_retries,\n ],\n}\n\nindex_group: Dict[str, Any] = {\n "name": "Package Index Options",\n "options": [\n index_url,\n extra_index_url,\n no_index,\n find_links,\n ],\n}\n
.venv\Lib\site-packages\pip\_internal\cli\cmdoptions.py
cmdoptions.py
Python
31,909
0.95
0.089144
0.040165
vue-tools
767
2024-11-01T05:39:08.665350
BSD-3-Clause
false
464015d8d99f4fbaee2160887f084d1d
from contextlib import ExitStack, contextmanager\nfrom typing import ContextManager, Generator, TypeVar\n\n_T = TypeVar("_T", covariant=True)\n\n\nclass CommandContextMixIn:\n def __init__(self) -> None:\n super().__init__()\n self._in_main_context = False\n self._main_context = ExitStack()\n\n @contextmanager\n def main_context(self) -> Generator[None, None, None]:\n assert not self._in_main_context\n\n self._in_main_context = True\n try:\n with self._main_context:\n yield\n finally:\n self._in_main_context = False\n\n def enter_context(self, context_provider: ContextManager[_T]) -> _T:\n assert self._in_main_context\n\n return self._main_context.enter_context(context_provider)\n
.venv\Lib\site-packages\pip\_internal\cli\command_context.py
command_context.py
Python
774
0.85
0.185185
0
react-lib
683
2023-12-01T12:31:29.014039
BSD-3-Clause
false
fd633c0517dc6329e5de277a63617387
"""\nContains command classes which may interact with an index / the network.\n\nUnlike its sister module, req_command, this module still uses lazy imports\nso commands which don't always hit the network (e.g. list w/o --outdated or\n--uptodate) don't need waste time importing PipSession and friends.\n"""\n\nimport logging\nimport os\nimport sys\nfrom functools import lru_cache\nfrom optparse import Values\nfrom typing import TYPE_CHECKING, List, Optional\n\nfrom pip._vendor import certifi\n\nfrom pip._internal.cli.base_command import Command\nfrom pip._internal.cli.command_context import CommandContextMixIn\n\nif TYPE_CHECKING:\n from ssl import SSLContext\n\n from pip._internal.network.session import PipSession\n\nlogger = logging.getLogger(__name__)\n\n\n@lru_cache\ndef _create_truststore_ssl_context() -> Optional["SSLContext"]:\n if sys.version_info < (3, 10):\n logger.debug("Disabling truststore because Python version isn't 3.10+")\n return None\n\n try:\n import ssl\n except ImportError:\n logger.warning("Disabling truststore since ssl support is missing")\n return None\n\n try:\n from pip._vendor import truststore\n except ImportError:\n logger.warning("Disabling truststore because platform isn't supported")\n return None\n\n ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n ctx.load_verify_locations(certifi.where())\n return ctx\n\n\nclass SessionCommandMixin(CommandContextMixIn):\n """\n A class mixin for command classes needing _build_session().\n """\n\n def __init__(self) -> None:\n super().__init__()\n self._session: Optional[PipSession] = None\n\n @classmethod\n def _get_index_urls(cls, options: Values) -> Optional[List[str]]:\n """Return a list of index urls from user-provided options."""\n index_urls = []\n if not getattr(options, "no_index", False):\n url = getattr(options, "index_url", None)\n if url:\n index_urls.append(url)\n urls = getattr(options, "extra_index_urls", None)\n if urls:\n index_urls.extend(urls)\n # Return None rather than an empty list\n return index_urls or None\n\n def get_default_session(self, options: Values) -> "PipSession":\n """Get a default-managed session."""\n if self._session is None:\n self._session = self.enter_context(self._build_session(options))\n # there's no type annotation on requests.Session, so it's\n # automatically ContextManager[Any] and self._session becomes Any,\n # then https://github.com/python/mypy/issues/7696 kicks in\n assert self._session is not None\n return self._session\n\n def _build_session(\n self,\n options: Values,\n retries: Optional[int] = None,\n timeout: Optional[int] = None,\n ) -> "PipSession":\n from pip._internal.network.session import PipSession\n\n cache_dir = options.cache_dir\n assert not cache_dir or os.path.isabs(cache_dir)\n\n if "legacy-certs" not in options.deprecated_features_enabled:\n ssl_context = _create_truststore_ssl_context()\n else:\n ssl_context = None\n\n session = PipSession(\n cache=os.path.join(cache_dir, "http-v2") if cache_dir else None,\n retries=retries if retries is not None else options.retries,\n trusted_hosts=options.trusted_hosts,\n index_urls=self._get_index_urls(options),\n ssl_context=ssl_context,\n )\n\n # Handle custom ca-bundles from the user\n if options.cert:\n session.verify = options.cert\n\n # Handle SSL client certificate\n if options.client_cert:\n session.cert = options.client_cert\n\n # Handle timeouts\n if options.timeout or timeout:\n session.timeout = timeout if timeout is not None else options.timeout\n\n # Handle configured proxies\n if options.proxy:\n session.proxies = {\n "http": options.proxy,\n "https": options.proxy,\n }\n session.trust_env = False\n session.pip_proxy = options.proxy\n\n # Determine if we can prompt the user for authentication or not\n session.auth.prompting = not options.no_input\n session.auth.keyring_provider = options.keyring_provider\n\n return session\n\n\ndef _pip_self_version_check(session: "PipSession", options: Values) -> None:\n from pip._internal.self_outdated_check import pip_self_version_check as check\n\n check(session, options)\n\n\nclass IndexGroupCommand(Command, SessionCommandMixin):\n """\n Abstract base class for commands with the index_group options.\n\n This also corresponds to the commands that permit the pip version check.\n """\n\n def handle_pip_version_check(self, options: Values) -> None:\n """\n Do the pip version check if not disabled.\n\n This overrides the default behavior of not doing the check.\n """\n # Make sure the index_group options are present.\n assert hasattr(options, "no_index")\n\n if options.disable_pip_version_check or options.no_index:\n return\n\n try:\n # Otherwise, check if we're using the latest version of pip available.\n session = self._build_session(\n options,\n retries=0,\n timeout=min(5, options.timeout),\n )\n with session:\n _pip_self_version_check(session, options)\n except Exception:\n logger.warning("There was an error checking the latest version of pip.")\n logger.debug("See below for error", exc_info=True)\n
.venv\Lib\site-packages\pip\_internal\cli\index_command.py
index_command.py
Python
5,720
0.95
0.208092
0.080882
python-kit
940
2025-03-26T21:09:46.477567
BSD-3-Clause
false
3dcbbc996094ce617329e194a8a36f9c
"""Primary application entrypoint."""\n\nimport locale\nimport logging\nimport os\nimport sys\nimport warnings\nfrom typing import List, Optional\n\nfrom pip._internal.cli.autocompletion import autocomplete\nfrom pip._internal.cli.main_parser import parse_command\nfrom pip._internal.commands import create_command\nfrom pip._internal.exceptions import PipError\nfrom pip._internal.utils import deprecation\n\nlogger = logging.getLogger(__name__)\n\n\n# Do not import and use main() directly! Using it directly is actively\n# discouraged by pip's maintainers. The name, location and behavior of\n# this function is subject to change, so calling it directly is not\n# portable across different pip versions.\n\n# In addition, running pip in-process is unsupported and unsafe. This is\n# elaborated in detail at\n# https://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program.\n# That document also provides suggestions that should work for nearly\n# all users that are considering importing and using main() directly.\n\n# However, we know that certain users will still want to invoke pip\n# in-process. If you understand and accept the implications of using pip\n# in an unsupported manner, the best approach is to use runpy to avoid\n# depending on the exact location of this entry point.\n\n# The following example shows how to use runpy to invoke pip in that\n# case:\n#\n# sys.argv = ["pip", your, args, here]\n# runpy.run_module("pip", run_name="__main__")\n#\n# Note that this will exit the process after running, unlike a direct\n# call to main. As it is not safe to do any processing after calling\n# main, this should not be an issue in practice.\n\n\ndef main(args: Optional[List[str]] = None) -> int:\n if args is None:\n args = sys.argv[1:]\n\n # Suppress the pkg_resources deprecation warning\n # Note - we use a module of .*pkg_resources to cover\n # the normal case (pip._vendor.pkg_resources) and the\n # devendored case (a bare pkg_resources)\n warnings.filterwarnings(\n action="ignore", category=DeprecationWarning, module=".*pkg_resources"\n )\n\n # Configure our deprecation warnings to be sent through loggers\n deprecation.install_warning_logger()\n\n autocomplete()\n\n try:\n cmd_name, cmd_args = parse_command(args)\n except PipError as exc:\n sys.stderr.write(f"ERROR: {exc}")\n sys.stderr.write(os.linesep)\n sys.exit(1)\n\n # Needed for locale.getpreferredencoding(False) to work\n # in pip._internal.utils.encoding.auto_decode\n try:\n locale.setlocale(locale.LC_ALL, "")\n except locale.Error as e:\n # setlocale can apparently crash if locale are uninitialized\n logger.debug("Ignoring error %s when setting locale", e)\n command = create_command(cmd_name, isolated=("--isolated" in cmd_args))\n\n return command.main(cmd_args)\n
.venv\Lib\site-packages\pip\_internal\cli\main.py
main.py
Python
2,816
0.95
0.101266
0.47619
react-lib
976
2023-10-05T21:25:53.469946
MIT
false
bdc9e610c9c14f2413eb154aaed9f489
"""A single place for constructing and exposing the main parser"""\n\nimport os\nimport subprocess\nimport sys\nfrom typing import List, Optional, Tuple\n\nfrom pip._internal.build_env import get_runnable_pip\nfrom pip._internal.cli import cmdoptions\nfrom pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter\nfrom pip._internal.commands import commands_dict, get_similar_commands\nfrom pip._internal.exceptions import CommandError\nfrom pip._internal.utils.misc import get_pip_version, get_prog\n\n__all__ = ["create_main_parser", "parse_command"]\n\n\ndef create_main_parser() -> ConfigOptionParser:\n """Creates and returns the main parser for pip's CLI"""\n\n parser = ConfigOptionParser(\n usage="\n%prog <command> [options]",\n add_help_option=False,\n formatter=UpdatingDefaultsHelpFormatter(),\n name="global",\n prog=get_prog(),\n )\n parser.disable_interspersed_args()\n\n parser.version = get_pip_version()\n\n # add the general options\n gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser)\n parser.add_option_group(gen_opts)\n\n # so the help formatter knows\n parser.main = True # type: ignore\n\n # create command listing for description\n description = [""] + [\n f"{name:27} {command_info.summary}"\n for name, command_info in commands_dict.items()\n ]\n parser.description = "\n".join(description)\n\n return parser\n\n\ndef identify_python_interpreter(python: str) -> Optional[str]:\n # If the named file exists, use it.\n # If it's a directory, assume it's a virtual environment and\n # look for the environment's Python executable.\n if os.path.exists(python):\n if os.path.isdir(python):\n # bin/python for Unix, Scripts/python.exe for Windows\n # Try both in case of odd cases like cygwin.\n for exe in ("bin/python", "Scripts/python.exe"):\n py = os.path.join(python, exe)\n if os.path.exists(py):\n return py\n else:\n return python\n\n # Could not find the interpreter specified\n return None\n\n\ndef parse_command(args: List[str]) -> Tuple[str, List[str]]:\n parser = create_main_parser()\n\n # Note: parser calls disable_interspersed_args(), so the result of this\n # call is to split the initial args into the general options before the\n # subcommand and everything else.\n # For example:\n # args: ['--timeout=5', 'install', '--user', 'INITools']\n # general_options: ['--timeout==5']\n # args_else: ['install', '--user', 'INITools']\n general_options, args_else = parser.parse_args(args)\n\n # --python\n if general_options.python and "_PIP_RUNNING_IN_SUBPROCESS" not in os.environ:\n # Re-invoke pip using the specified Python interpreter\n interpreter = identify_python_interpreter(general_options.python)\n if interpreter is None:\n raise CommandError(\n f"Could not locate Python interpreter {general_options.python}"\n )\n\n pip_cmd = [\n interpreter,\n get_runnable_pip(),\n ]\n pip_cmd.extend(args)\n\n # Set a flag so the child doesn't re-invoke itself, causing\n # an infinite loop.\n os.environ["_PIP_RUNNING_IN_SUBPROCESS"] = "1"\n returncode = 0\n try:\n proc = subprocess.run(pip_cmd)\n returncode = proc.returncode\n except (subprocess.SubprocessError, OSError) as exc:\n raise CommandError(f"Failed to run pip under {interpreter}: {exc}")\n sys.exit(returncode)\n\n # --version\n if general_options.version:\n sys.stdout.write(parser.version)\n sys.stdout.write(os.linesep)\n sys.exit()\n\n # pip || pip help -> print_help()\n if not args_else or (args_else[0] == "help" and len(args_else) == 1):\n parser.print_help()\n sys.exit()\n\n # the subcommand name\n cmd_name = args_else[0]\n\n if cmd_name not in commands_dict:\n guess = get_similar_commands(cmd_name)\n\n msg = [f'unknown command "{cmd_name}"']\n if guess:\n msg.append(f'maybe you meant "{guess}"')\n\n raise CommandError(" - ".join(msg))\n\n # all the args without the subcommand\n cmd_args = args[:]\n cmd_args.remove(cmd_name)\n\n return cmd_name, cmd_args\n
.venv\Lib\site-packages\pip\_internal\cli\main_parser.py
main_parser.py
Python
4,337
0.95
0.157895
0.228571
node-utils
631
2025-04-06T09:39:38.545017
GPL-3.0
false
946ff918c1c90320b2f7e1be3130dbda
"""Base option parser setup"""\n\nimport logging\nimport optparse\nimport shutil\nimport sys\nimport textwrap\nfrom contextlib import suppress\nfrom typing import Any, Dict, Generator, List, NoReturn, Optional, Tuple\n\nfrom pip._internal.cli.status_codes import UNKNOWN_ERROR\nfrom pip._internal.configuration import Configuration, ConfigurationError\nfrom pip._internal.utils.misc import redact_auth_from_url, strtobool\n\nlogger = logging.getLogger(__name__)\n\n\nclass PrettyHelpFormatter(optparse.IndentedHelpFormatter):\n """A prettier/less verbose help formatter for optparse."""\n\n def __init__(self, *args: Any, **kwargs: Any) -> None:\n # help position must be aligned with __init__.parseopts.description\n kwargs["max_help_position"] = 30\n kwargs["indent_increment"] = 1\n kwargs["width"] = shutil.get_terminal_size()[0] - 2\n super().__init__(*args, **kwargs)\n\n def format_option_strings(self, option: optparse.Option) -> str:\n return self._format_option_strings(option)\n\n def _format_option_strings(\n self, option: optparse.Option, mvarfmt: str = " <{}>", optsep: str = ", "\n ) -> str:\n """\n Return a comma-separated list of option strings and metavars.\n\n :param option: tuple of (short opt, long opt), e.g: ('-f', '--format')\n :param mvarfmt: metavar format string\n :param optsep: separator\n """\n opts = []\n\n if option._short_opts:\n opts.append(option._short_opts[0])\n if option._long_opts:\n opts.append(option._long_opts[0])\n if len(opts) > 1:\n opts.insert(1, optsep)\n\n if option.takes_value():\n assert option.dest is not None\n metavar = option.metavar or option.dest.lower()\n opts.append(mvarfmt.format(metavar.lower()))\n\n return "".join(opts)\n\n def format_heading(self, heading: str) -> str:\n if heading == "Options":\n return ""\n return heading + ":\n"\n\n def format_usage(self, usage: str) -> str:\n """\n Ensure there is only one newline between usage and the first heading\n if there is no description.\n """\n msg = "\nUsage: {}\n".format(self.indent_lines(textwrap.dedent(usage), " "))\n return msg\n\n def format_description(self, description: Optional[str]) -> str:\n # leave full control over description to us\n if description:\n if hasattr(self.parser, "main"):\n label = "Commands"\n else:\n label = "Description"\n # some doc strings have initial newlines, some don't\n description = description.lstrip("\n")\n # some doc strings have final newlines and spaces, some don't\n description = description.rstrip()\n # dedent, then reindent\n description = self.indent_lines(textwrap.dedent(description), " ")\n description = f"{label}:\n{description}\n"\n return description\n else:\n return ""\n\n def format_epilog(self, epilog: Optional[str]) -> str:\n # leave full control over epilog to us\n if epilog:\n return epilog\n else:\n return ""\n\n def indent_lines(self, text: str, indent: str) -> str:\n new_lines = [indent + line for line in text.split("\n")]\n return "\n".join(new_lines)\n\n\nclass UpdatingDefaultsHelpFormatter(PrettyHelpFormatter):\n """Custom help formatter for use in ConfigOptionParser.\n\n This is updates the defaults before expanding them, allowing\n them to show up correctly in the help listing.\n\n Also redact auth from url type options\n """\n\n def expand_default(self, option: optparse.Option) -> str:\n default_values = None\n if self.parser is not None:\n assert isinstance(self.parser, ConfigOptionParser)\n self.parser._update_defaults(self.parser.defaults)\n assert option.dest is not None\n default_values = self.parser.defaults.get(option.dest)\n help_text = super().expand_default(option)\n\n if default_values and option.metavar == "URL":\n if isinstance(default_values, str):\n default_values = [default_values]\n\n # If its not a list, we should abort and just return the help text\n if not isinstance(default_values, list):\n default_values = []\n\n for val in default_values:\n help_text = help_text.replace(val, redact_auth_from_url(val))\n\n return help_text\n\n\nclass CustomOptionParser(optparse.OptionParser):\n def insert_option_group(\n self, idx: int, *args: Any, **kwargs: Any\n ) -> optparse.OptionGroup:\n """Insert an OptionGroup at a given position."""\n group = self.add_option_group(*args, **kwargs)\n\n self.option_groups.pop()\n self.option_groups.insert(idx, group)\n\n return group\n\n @property\n def option_list_all(self) -> List[optparse.Option]:\n """Get a list of all options, including those in option groups."""\n res = self.option_list[:]\n for i in self.option_groups:\n res.extend(i.option_list)\n\n return res\n\n\nclass ConfigOptionParser(CustomOptionParser):\n """Custom option parser which updates its defaults by checking the\n configuration files and environmental variables"""\n\n def __init__(\n self,\n *args: Any,\n name: str,\n isolated: bool = False,\n **kwargs: Any,\n ) -> None:\n self.name = name\n self.config = Configuration(isolated)\n\n assert self.name\n super().__init__(*args, **kwargs)\n\n def check_default(self, option: optparse.Option, key: str, val: Any) -> Any:\n try:\n return option.check_value(key, val)\n except optparse.OptionValueError as exc:\n print(f"An error occurred during configuration: {exc}")\n sys.exit(3)\n\n def _get_ordered_configuration_items(\n self,\n ) -> Generator[Tuple[str, Any], None, None]:\n # Configuration gives keys in an unordered manner. Order them.\n override_order = ["global", self.name, ":env:"]\n\n # Pool the options into different groups\n section_items: Dict[str, List[Tuple[str, Any]]] = {\n name: [] for name in override_order\n }\n for section_key, val in self.config.items():\n # ignore empty values\n if not val:\n logger.debug(\n "Ignoring configuration key '%s' as it's value is empty.",\n section_key,\n )\n continue\n\n section, key = section_key.split(".", 1)\n if section in override_order:\n section_items[section].append((key, val))\n\n # Yield each group in their override order\n for section in override_order:\n for key, val in section_items[section]:\n yield key, val\n\n def _update_defaults(self, defaults: Dict[str, Any]) -> Dict[str, Any]:\n """Updates the given defaults with values from the config files and\n the environ. Does a little special handling for certain types of\n options (lists)."""\n\n # Accumulate complex default state.\n self.values = optparse.Values(self.defaults)\n late_eval = set()\n # Then set the options with those values\n for key, val in self._get_ordered_configuration_items():\n # '--' because configuration supports only long names\n option = self.get_option("--" + key)\n\n # Ignore options not present in this parser. E.g. non-globals put\n # in [global] by users that want them to apply to all applicable\n # commands.\n if option is None:\n continue\n\n assert option.dest is not None\n\n if option.action in ("store_true", "store_false"):\n try:\n val = strtobool(val)\n except ValueError:\n self.error(\n f"{val} is not a valid value for {key} option, "\n "please specify a boolean value like yes/no, "\n "true/false or 1/0 instead."\n )\n elif option.action == "count":\n with suppress(ValueError):\n val = strtobool(val)\n with suppress(ValueError):\n val = int(val)\n if not isinstance(val, int) or val < 0:\n self.error(\n f"{val} is not a valid value for {key} option, "\n "please instead specify either a non-negative integer "\n "or a boolean value like yes/no or false/true "\n "which is equivalent to 1/0."\n )\n elif option.action == "append":\n val = val.split()\n val = [self.check_default(option, key, v) for v in val]\n elif option.action == "callback":\n assert option.callback is not None\n late_eval.add(option.dest)\n opt_str = option.get_opt_string()\n val = option.convert_value(opt_str, val)\n # From take_action\n args = option.callback_args or ()\n kwargs = option.callback_kwargs or {}\n option.callback(option, opt_str, val, self, *args, **kwargs)\n else:\n val = self.check_default(option, key, val)\n\n defaults[option.dest] = val\n\n for key in late_eval:\n defaults[key] = getattr(self.values, key)\n self.values = None\n return defaults\n\n def get_default_values(self) -> optparse.Values:\n """Overriding to make updating the defaults after instantiation of\n the option parser possible, _update_defaults() does the dirty work."""\n if not self.process_default_values:\n # Old, pre-Optik 1.5 behaviour.\n return optparse.Values(self.defaults)\n\n # Load the configuration, or error out in case of an error\n try:\n self.config.load()\n except ConfigurationError as err:\n self.exit(UNKNOWN_ERROR, str(err))\n\n defaults = self._update_defaults(self.defaults.copy()) # ours\n for option in self._get_all_options():\n assert option.dest is not None\n default = defaults.get(option.dest)\n if isinstance(default, str):\n opt_str = option.get_opt_string()\n defaults[option.dest] = option.check_value(opt_str, default)\n return optparse.Values(defaults)\n\n def error(self, msg: str) -> NoReturn:\n self.print_usage(sys.stderr)\n self.exit(UNKNOWN_ERROR, f"{msg}\n")\n
.venv\Lib\site-packages\pip\_internal\cli\parser.py
parser.py
Python
10,825
0.95
0.204082
0.090909
node-utils
679
2024-02-08T08:54:23.072045
MIT
false
3718272cf44ba8eb9c87f2c39367854a
import functools\nimport sys\nfrom typing import Callable, Generator, Iterable, Iterator, Optional, Tuple, TypeVar\n\nfrom pip._vendor.rich.progress import (\n BarColumn,\n DownloadColumn,\n FileSizeColumn,\n MofNCompleteColumn,\n Progress,\n ProgressColumn,\n SpinnerColumn,\n TextColumn,\n TimeElapsedColumn,\n TimeRemainingColumn,\n TransferSpeedColumn,\n)\n\nfrom pip._internal.cli.spinners import RateLimiter\nfrom pip._internal.req.req_install import InstallRequirement\nfrom pip._internal.utils.logging import get_console, get_indentation\n\nT = TypeVar("T")\nProgressRenderer = Callable[[Iterable[T]], Iterator[T]]\n\n\ndef _rich_download_progress_bar(\n iterable: Iterable[bytes],\n *,\n bar_type: str,\n size: Optional[int],\n initial_progress: Optional[int] = None,\n) -> Generator[bytes, None, None]:\n assert bar_type == "on", "This should only be used in the default mode."\n\n if not size:\n total = float("inf")\n columns: Tuple[ProgressColumn, ...] = (\n TextColumn("[progress.description]{task.description}"),\n SpinnerColumn("line", speed=1.5),\n FileSizeColumn(),\n TransferSpeedColumn(),\n TimeElapsedColumn(),\n )\n else:\n total = size\n columns = (\n TextColumn("[progress.description]{task.description}"),\n BarColumn(),\n DownloadColumn(),\n TransferSpeedColumn(),\n TextColumn("eta"),\n TimeRemainingColumn(),\n )\n\n progress = Progress(*columns, refresh_per_second=5)\n task_id = progress.add_task(" " * (get_indentation() + 2), total=total)\n if initial_progress is not None:\n progress.update(task_id, advance=initial_progress)\n with progress:\n for chunk in iterable:\n yield chunk\n progress.update(task_id, advance=len(chunk))\n\n\ndef _rich_install_progress_bar(\n iterable: Iterable[InstallRequirement], *, total: int\n) -> Iterator[InstallRequirement]:\n columns = (\n TextColumn("{task.fields[indent]}"),\n BarColumn(),\n MofNCompleteColumn(),\n TextColumn("{task.description}"),\n )\n console = get_console()\n\n bar = Progress(*columns, refresh_per_second=6, console=console, transient=True)\n # Hiding the progress bar at initialization forces a refresh cycle to occur\n # until the bar appears, avoiding very short flashes.\n task = bar.add_task("", total=total, indent=" " * get_indentation(), visible=False)\n with bar:\n for req in iterable:\n bar.update(task, description=rf"\[{req.name}]", visible=True)\n yield req\n bar.advance(task)\n\n\ndef _raw_progress_bar(\n iterable: Iterable[bytes],\n *,\n size: Optional[int],\n initial_progress: Optional[int] = None,\n) -> Generator[bytes, None, None]:\n def write_progress(current: int, total: int) -> None:\n sys.stdout.write(f"Progress {current} of {total}\n")\n sys.stdout.flush()\n\n current = initial_progress or 0\n total = size or 0\n rate_limiter = RateLimiter(0.25)\n\n write_progress(current, total)\n for chunk in iterable:\n current += len(chunk)\n if rate_limiter.ready() or current == total:\n write_progress(current, total)\n rate_limiter.reset()\n yield chunk\n\n\ndef get_download_progress_renderer(\n *, bar_type: str, size: Optional[int] = None, initial_progress: Optional[int] = None\n) -> ProgressRenderer[bytes]:\n """Get an object that can be used to render the download progress.\n\n Returns a callable, that takes an iterable to "wrap".\n """\n if bar_type == "on":\n return functools.partial(\n _rich_download_progress_bar,\n bar_type=bar_type,\n size=size,\n initial_progress=initial_progress,\n )\n elif bar_type == "raw":\n return functools.partial(\n _raw_progress_bar,\n size=size,\n initial_progress=initial_progress,\n )\n else:\n return iter # no-op, when passed an iterator\n\n\ndef get_install_progress_renderer(\n *, bar_type: str, total: int\n) -> ProgressRenderer[InstallRequirement]:\n """Get an object that can be used to render the install progress.\n Returns a callable, that takes an iterable to "wrap".\n """\n if bar_type == "on":\n return functools.partial(_rich_install_progress_bar, total=total)\n else:\n return iter\n
.venv\Lib\site-packages\pip\_internal\cli\progress_bars.py
progress_bars.py
Python
4,435
0.95
0.097222
0.048
react-lib
12
2024-02-07T07:20:17.105644
MIT
false
25caa940c62828c2c690a10cc3ea2218
"""Contains the RequirementCommand base class.\n\nThis class is in a separate module so the commands that do not always\nneed PackageFinder capability don't unnecessarily import the\nPackageFinder machinery and all its vendored dependencies, etc.\n"""\n\nimport logging\nfrom functools import partial\nfrom optparse import Values\nfrom typing import Any, List, Optional, Tuple\n\nfrom pip._internal.cache import WheelCache\nfrom pip._internal.cli import cmdoptions\nfrom pip._internal.cli.index_command import IndexGroupCommand\nfrom pip._internal.cli.index_command import SessionCommandMixin as SessionCommandMixin\nfrom pip._internal.exceptions import CommandError, PreviousBuildDirError\nfrom pip._internal.index.collector import LinkCollector\nfrom pip._internal.index.package_finder import PackageFinder\nfrom pip._internal.models.selection_prefs import SelectionPreferences\nfrom pip._internal.models.target_python import TargetPython\nfrom pip._internal.network.session import PipSession\nfrom pip._internal.operations.build.build_tracker import BuildTracker\nfrom pip._internal.operations.prepare import RequirementPreparer\nfrom pip._internal.req.constructors import (\n install_req_from_editable,\n install_req_from_line,\n install_req_from_parsed_requirement,\n install_req_from_req_string,\n)\nfrom pip._internal.req.req_dependency_group import parse_dependency_groups\nfrom pip._internal.req.req_file import parse_requirements\nfrom pip._internal.req.req_install import InstallRequirement\nfrom pip._internal.resolution.base import BaseResolver\nfrom pip._internal.utils.temp_dir import (\n TempDirectory,\n TempDirectoryTypeRegistry,\n tempdir_kinds,\n)\n\nlogger = logging.getLogger(__name__)\n\n\nKEEPABLE_TEMPDIR_TYPES = [\n tempdir_kinds.BUILD_ENV,\n tempdir_kinds.EPHEM_WHEEL_CACHE,\n tempdir_kinds.REQ_BUILD,\n]\n\n\ndef with_cleanup(func: Any) -> Any:\n """Decorator for common logic related to managing temporary\n directories.\n """\n\n def configure_tempdir_registry(registry: TempDirectoryTypeRegistry) -> None:\n for t in KEEPABLE_TEMPDIR_TYPES:\n registry.set_delete(t, False)\n\n def wrapper(\n self: RequirementCommand, options: Values, args: List[Any]\n ) -> Optional[int]:\n assert self.tempdir_registry is not None\n if options.no_clean:\n configure_tempdir_registry(self.tempdir_registry)\n\n try:\n return func(self, options, args)\n except PreviousBuildDirError:\n # This kind of conflict can occur when the user passes an explicit\n # build directory with a pre-existing folder. In that case we do\n # not want to accidentally remove it.\n configure_tempdir_registry(self.tempdir_registry)\n raise\n\n return wrapper\n\n\nclass RequirementCommand(IndexGroupCommand):\n def __init__(self, *args: Any, **kw: Any) -> None:\n super().__init__(*args, **kw)\n\n self.cmd_opts.add_option(cmdoptions.dependency_groups())\n self.cmd_opts.add_option(cmdoptions.no_clean())\n\n @staticmethod\n def determine_resolver_variant(options: Values) -> str:\n """Determines which resolver should be used, based on the given options."""\n if "legacy-resolver" in options.deprecated_features_enabled:\n return "legacy"\n\n return "resolvelib"\n\n @classmethod\n def make_requirement_preparer(\n cls,\n temp_build_dir: TempDirectory,\n options: Values,\n build_tracker: BuildTracker,\n session: PipSession,\n finder: PackageFinder,\n use_user_site: bool,\n download_dir: Optional[str] = None,\n verbosity: int = 0,\n ) -> RequirementPreparer:\n """\n Create a RequirementPreparer instance for the given parameters.\n """\n temp_build_dir_path = temp_build_dir.path\n assert temp_build_dir_path is not None\n legacy_resolver = False\n\n resolver_variant = cls.determine_resolver_variant(options)\n if resolver_variant == "resolvelib":\n lazy_wheel = "fast-deps" in options.features_enabled\n if lazy_wheel:\n logger.warning(\n "pip is using lazily downloaded wheels using HTTP "\n "range requests to obtain dependency information. "\n "This experimental feature is enabled through "\n "--use-feature=fast-deps and it is not ready for "\n "production."\n )\n else:\n legacy_resolver = True\n lazy_wheel = False\n if "fast-deps" in options.features_enabled:\n logger.warning(\n "fast-deps has no effect when used with the legacy resolver."\n )\n\n return RequirementPreparer(\n build_dir=temp_build_dir_path,\n src_dir=options.src_dir,\n download_dir=download_dir,\n build_isolation=options.build_isolation,\n check_build_deps=options.check_build_deps,\n build_tracker=build_tracker,\n session=session,\n progress_bar=options.progress_bar,\n finder=finder,\n require_hashes=options.require_hashes,\n use_user_site=use_user_site,\n lazy_wheel=lazy_wheel,\n verbosity=verbosity,\n legacy_resolver=legacy_resolver,\n resume_retries=options.resume_retries,\n )\n\n @classmethod\n def make_resolver(\n cls,\n preparer: RequirementPreparer,\n finder: PackageFinder,\n options: Values,\n wheel_cache: Optional[WheelCache] = None,\n use_user_site: bool = False,\n ignore_installed: bool = True,\n ignore_requires_python: bool = False,\n force_reinstall: bool = False,\n upgrade_strategy: str = "to-satisfy-only",\n use_pep517: Optional[bool] = None,\n py_version_info: Optional[Tuple[int, ...]] = None,\n ) -> BaseResolver:\n """\n Create a Resolver instance for the given parameters.\n """\n make_install_req = partial(\n install_req_from_req_string,\n isolated=options.isolated_mode,\n use_pep517=use_pep517,\n )\n resolver_variant = cls.determine_resolver_variant(options)\n # The long import name and duplicated invocation is needed to convince\n # Mypy into correctly typechecking. Otherwise it would complain the\n # "Resolver" class being redefined.\n if resolver_variant == "resolvelib":\n import pip._internal.resolution.resolvelib.resolver\n\n return pip._internal.resolution.resolvelib.resolver.Resolver(\n preparer=preparer,\n finder=finder,\n wheel_cache=wheel_cache,\n make_install_req=make_install_req,\n use_user_site=use_user_site,\n ignore_dependencies=options.ignore_dependencies,\n ignore_installed=ignore_installed,\n ignore_requires_python=ignore_requires_python,\n force_reinstall=force_reinstall,\n upgrade_strategy=upgrade_strategy,\n py_version_info=py_version_info,\n )\n import pip._internal.resolution.legacy.resolver\n\n return pip._internal.resolution.legacy.resolver.Resolver(\n preparer=preparer,\n finder=finder,\n wheel_cache=wheel_cache,\n make_install_req=make_install_req,\n use_user_site=use_user_site,\n ignore_dependencies=options.ignore_dependencies,\n ignore_installed=ignore_installed,\n ignore_requires_python=ignore_requires_python,\n force_reinstall=force_reinstall,\n upgrade_strategy=upgrade_strategy,\n py_version_info=py_version_info,\n )\n\n def get_requirements(\n self,\n args: List[str],\n options: Values,\n finder: PackageFinder,\n session: PipSession,\n ) -> List[InstallRequirement]:\n """\n Parse command-line arguments into the corresponding requirements.\n """\n requirements: List[InstallRequirement] = []\n for filename in options.constraints:\n for parsed_req in parse_requirements(\n filename,\n constraint=True,\n finder=finder,\n options=options,\n session=session,\n ):\n req_to_add = install_req_from_parsed_requirement(\n parsed_req,\n isolated=options.isolated_mode,\n user_supplied=False,\n )\n requirements.append(req_to_add)\n\n for req in args:\n req_to_add = install_req_from_line(\n req,\n comes_from=None,\n isolated=options.isolated_mode,\n use_pep517=options.use_pep517,\n user_supplied=True,\n config_settings=getattr(options, "config_settings", None),\n )\n requirements.append(req_to_add)\n\n if options.dependency_groups:\n for req in parse_dependency_groups(options.dependency_groups):\n req_to_add = install_req_from_req_string(\n req,\n isolated=options.isolated_mode,\n use_pep517=options.use_pep517,\n user_supplied=True,\n )\n requirements.append(req_to_add)\n\n for req in options.editables:\n req_to_add = install_req_from_editable(\n req,\n user_supplied=True,\n isolated=options.isolated_mode,\n use_pep517=options.use_pep517,\n config_settings=getattr(options, "config_settings", None),\n )\n requirements.append(req_to_add)\n\n # NOTE: options.require_hashes may be set if --require-hashes is True\n for filename in options.requirements:\n for parsed_req in parse_requirements(\n filename, finder=finder, options=options, session=session\n ):\n req_to_add = install_req_from_parsed_requirement(\n parsed_req,\n isolated=options.isolated_mode,\n use_pep517=options.use_pep517,\n user_supplied=True,\n config_settings=(\n parsed_req.options.get("config_settings")\n if parsed_req.options\n else None\n ),\n )\n requirements.append(req_to_add)\n\n # If any requirement has hash options, enable hash checking.\n if any(req.has_hash_options for req in requirements):\n options.require_hashes = True\n\n if not (\n args\n or options.editables\n or options.requirements\n or options.dependency_groups\n ):\n opts = {"name": self.name}\n if options.find_links:\n raise CommandError(\n "You must give at least one requirement to {name} "\n '(maybe you meant "pip {name} {links}"?)'.format(\n **dict(opts, links=" ".join(options.find_links))\n )\n )\n else:\n raise CommandError(\n "You must give at least one requirement to {name} "\n '(see "pip help {name}")'.format(**opts)\n )\n\n return requirements\n\n @staticmethod\n def trace_basic_info(finder: PackageFinder) -> None:\n """\n Trace basic information about the provided objects.\n """\n # Display where finder is looking for packages\n search_scope = finder.search_scope\n locations = search_scope.get_formatted_locations()\n if locations:\n logger.info(locations)\n\n def _build_package_finder(\n self,\n options: Values,\n session: PipSession,\n target_python: Optional[TargetPython] = None,\n ignore_requires_python: Optional[bool] = None,\n ) -> PackageFinder:\n """\n Create a package finder appropriate to this requirement command.\n\n :param ignore_requires_python: Whether to ignore incompatible\n "Requires-Python" values in links. Defaults to False.\n """\n link_collector = LinkCollector.create(session, options=options)\n selection_prefs = SelectionPreferences(\n allow_yanked=True,\n format_control=options.format_control,\n allow_all_prereleases=options.pre,\n prefer_binary=options.prefer_binary,\n ignore_requires_python=ignore_requires_python,\n )\n\n return PackageFinder.create(\n link_collector=link_collector,\n selection_prefs=selection_prefs,\n target_python=target_python,\n )\n
.venv\Lib\site-packages\pip\_internal\cli\req_command.py
req_command.py
Python
12,934
0.95
0.121037
0.032051
awesome-app
382
2024-05-25T06:33:49.708857
MIT
false
029394220227ed5a9a31f91ba47c0252
import contextlib\nimport itertools\nimport logging\nimport sys\nimport time\nfrom typing import IO, Generator, Optional\n\nfrom pip._internal.utils.compat import WINDOWS\nfrom pip._internal.utils.logging import get_indentation\n\nlogger = logging.getLogger(__name__)\n\n\nclass SpinnerInterface:\n def spin(self) -> None:\n raise NotImplementedError()\n\n def finish(self, final_status: str) -> None:\n raise NotImplementedError()\n\n\nclass InteractiveSpinner(SpinnerInterface):\n def __init__(\n self,\n message: str,\n file: Optional[IO[str]] = None,\n spin_chars: str = "-\\|/",\n # Empirically, 8 updates/second looks nice\n min_update_interval_seconds: float = 0.125,\n ):\n self._message = message\n if file is None:\n file = sys.stdout\n self._file = file\n self._rate_limiter = RateLimiter(min_update_interval_seconds)\n self._finished = False\n\n self._spin_cycle = itertools.cycle(spin_chars)\n\n self._file.write(" " * get_indentation() + self._message + " ... ")\n self._width = 0\n\n def _write(self, status: str) -> None:\n assert not self._finished\n # Erase what we wrote before by backspacing to the beginning, writing\n # spaces to overwrite the old text, and then backspacing again\n backup = "\b" * self._width\n self._file.write(backup + " " * self._width + backup)\n # Now we have a blank slate to add our status\n self._file.write(status)\n self._width = len(status)\n self._file.flush()\n self._rate_limiter.reset()\n\n def spin(self) -> None:\n if self._finished:\n return\n if not self._rate_limiter.ready():\n return\n self._write(next(self._spin_cycle))\n\n def finish(self, final_status: str) -> None:\n if self._finished:\n return\n self._write(final_status)\n self._file.write("\n")\n self._file.flush()\n self._finished = True\n\n\n# Used for dumb terminals, non-interactive installs (no tty), etc.\n# We still print updates occasionally (once every 60 seconds by default) to\n# act as a keep-alive for systems like Travis-CI that take lack-of-output as\n# an indication that a task has frozen.\nclass NonInteractiveSpinner(SpinnerInterface):\n def __init__(self, message: str, min_update_interval_seconds: float = 60.0) -> None:\n self._message = message\n self._finished = False\n self._rate_limiter = RateLimiter(min_update_interval_seconds)\n self._update("started")\n\n def _update(self, status: str) -> None:\n assert not self._finished\n self._rate_limiter.reset()\n logger.info("%s: %s", self._message, status)\n\n def spin(self) -> None:\n if self._finished:\n return\n if not self._rate_limiter.ready():\n return\n self._update("still running...")\n\n def finish(self, final_status: str) -> None:\n if self._finished:\n return\n self._update(f"finished with status '{final_status}'")\n self._finished = True\n\n\nclass RateLimiter:\n def __init__(self, min_update_interval_seconds: float) -> None:\n self._min_update_interval_seconds = min_update_interval_seconds\n self._last_update: float = 0\n\n def ready(self) -> bool:\n now = time.time()\n delta = now - self._last_update\n return delta >= self._min_update_interval_seconds\n\n def reset(self) -> None:\n self._last_update = time.time()\n\n\n@contextlib.contextmanager\ndef open_spinner(message: str) -> Generator[SpinnerInterface, None, None]:\n # Interactive spinner goes directly to sys.stdout rather than being routed\n # through the logging system, but it acts like it has level INFO,\n # i.e. it's only displayed if we're at level INFO or better.\n # Non-interactive spinner goes through the logging system, so it is always\n # in sync with logging configuration.\n if sys.stdout.isatty() and logger.getEffectiveLevel() <= logging.INFO:\n spinner: SpinnerInterface = InteractiveSpinner(message)\n else:\n spinner = NonInteractiveSpinner(message)\n try:\n with hidden_cursor(sys.stdout):\n yield spinner\n except KeyboardInterrupt:\n spinner.finish("canceled")\n raise\n except Exception:\n spinner.finish("error")\n raise\n else:\n spinner.finish("done")\n\n\nHIDE_CURSOR = "\x1b[?25l"\nSHOW_CURSOR = "\x1b[?25h"\n\n\n@contextlib.contextmanager\ndef hidden_cursor(file: IO[str]) -> Generator[None, None, None]:\n # The Windows terminal does not support the hide/show cursor ANSI codes,\n # even via colorama. So don't even try.\n if WINDOWS:\n yield\n # We don't want to clutter the output with control characters if we're\n # writing to a file, or if the user is running with --quiet.\n # See https://github.com/pypa/pip/issues/3418\n elif not file.isatty() or logger.getEffectiveLevel() > logging.INFO:\n yield\n else:\n file.write(HIDE_CURSOR)\n try:\n yield\n finally:\n file.write(SHOW_CURSOR)\n
.venv\Lib\site-packages\pip\_internal\cli\spinners.py
spinners.py
Python
5,118
0.95
0.226415
0.136364
awesome-app
963
2024-08-31T04:30:38.724634
GPL-3.0
false
aedc7e09e60737fea30e38cc9c44aea2