cli-ih 0.6.3.1__py3-none-any.whl → 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. cli_ih/__init__.py +1 -0
  2. cli_ih/asyncClient.py +73 -10
  3. cli_ih/client.py +63 -18
  4. cli_ih/utils.py +51 -0
  5. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.0.dist-info}/METADATA +1 -1
  6. cli_ih-0.7.0.dist-info/RECORD +9 -0
  7. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.0.dist-info}/top_level.txt +0 -1
  8. cli_ih-0.6.3.1.dist-info/RECORD +0 -425
  9. venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +0 -85
  10. venv/Lib/site-packages/pip/__init__.py +0 -13
  11. venv/Lib/site-packages/pip/__main__.py +0 -24
  12. venv/Lib/site-packages/pip/__pip-runner__.py +0 -50
  13. venv/Lib/site-packages/pip/_internal/__init__.py +0 -18
  14. venv/Lib/site-packages/pip/_internal/build_env.py +0 -349
  15. venv/Lib/site-packages/pip/_internal/cache.py +0 -291
  16. venv/Lib/site-packages/pip/_internal/cli/__init__.py +0 -3
  17. venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +0 -184
  18. venv/Lib/site-packages/pip/_internal/cli/base_command.py +0 -244
  19. venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +0 -1138
  20. venv/Lib/site-packages/pip/_internal/cli/command_context.py +0 -28
  21. venv/Lib/site-packages/pip/_internal/cli/index_command.py +0 -175
  22. venv/Lib/site-packages/pip/_internal/cli/main.py +0 -80
  23. venv/Lib/site-packages/pip/_internal/cli/main_parser.py +0 -134
  24. venv/Lib/site-packages/pip/_internal/cli/parser.py +0 -298
  25. venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +0 -151
  26. venv/Lib/site-packages/pip/_internal/cli/req_command.py +0 -351
  27. venv/Lib/site-packages/pip/_internal/cli/spinners.py +0 -235
  28. venv/Lib/site-packages/pip/_internal/cli/status_codes.py +0 -6
  29. venv/Lib/site-packages/pip/_internal/commands/__init__.py +0 -139
  30. venv/Lib/site-packages/pip/_internal/commands/cache.py +0 -231
  31. venv/Lib/site-packages/pip/_internal/commands/check.py +0 -66
  32. venv/Lib/site-packages/pip/_internal/commands/completion.py +0 -135
  33. venv/Lib/site-packages/pip/_internal/commands/configuration.py +0 -288
  34. venv/Lib/site-packages/pip/_internal/commands/debug.py +0 -203
  35. venv/Lib/site-packages/pip/_internal/commands/download.py +0 -145
  36. venv/Lib/site-packages/pip/_internal/commands/freeze.py +0 -107
  37. venv/Lib/site-packages/pip/_internal/commands/hash.py +0 -58
  38. venv/Lib/site-packages/pip/_internal/commands/help.py +0 -40
  39. venv/Lib/site-packages/pip/_internal/commands/index.py +0 -159
  40. venv/Lib/site-packages/pip/_internal/commands/inspect.py +0 -92
  41. venv/Lib/site-packages/pip/_internal/commands/install.py +0 -798
  42. venv/Lib/site-packages/pip/_internal/commands/list.py +0 -400
  43. venv/Lib/site-packages/pip/_internal/commands/lock.py +0 -170
  44. venv/Lib/site-packages/pip/_internal/commands/search.py +0 -178
  45. venv/Lib/site-packages/pip/_internal/commands/show.py +0 -231
  46. venv/Lib/site-packages/pip/_internal/commands/uninstall.py +0 -113
  47. venv/Lib/site-packages/pip/_internal/commands/wheel.py +0 -181
  48. venv/Lib/site-packages/pip/_internal/configuration.py +0 -397
  49. venv/Lib/site-packages/pip/_internal/distributions/__init__.py +0 -21
  50. venv/Lib/site-packages/pip/_internal/distributions/base.py +0 -55
  51. venv/Lib/site-packages/pip/_internal/distributions/installed.py +0 -33
  52. venv/Lib/site-packages/pip/_internal/distributions/sdist.py +0 -165
  53. venv/Lib/site-packages/pip/_internal/distributions/wheel.py +0 -44
  54. venv/Lib/site-packages/pip/_internal/exceptions.py +0 -881
  55. venv/Lib/site-packages/pip/_internal/index/__init__.py +0 -1
  56. venv/Lib/site-packages/pip/_internal/index/collector.py +0 -489
  57. venv/Lib/site-packages/pip/_internal/index/package_finder.py +0 -1059
  58. venv/Lib/site-packages/pip/_internal/index/sources.py +0 -287
  59. venv/Lib/site-packages/pip/_internal/locations/__init__.py +0 -441
  60. venv/Lib/site-packages/pip/_internal/locations/_distutils.py +0 -173
  61. venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +0 -215
  62. venv/Lib/site-packages/pip/_internal/locations/base.py +0 -82
  63. venv/Lib/site-packages/pip/_internal/main.py +0 -12
  64. venv/Lib/site-packages/pip/_internal/metadata/__init__.py +0 -164
  65. venv/Lib/site-packages/pip/_internal/metadata/_json.py +0 -87
  66. venv/Lib/site-packages/pip/_internal/metadata/base.py +0 -685
  67. venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +0 -6
  68. venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +0 -87
  69. venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +0 -223
  70. venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +0 -143
  71. venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +0 -298
  72. venv/Lib/site-packages/pip/_internal/models/__init__.py +0 -1
  73. venv/Lib/site-packages/pip/_internal/models/candidate.py +0 -25
  74. venv/Lib/site-packages/pip/_internal/models/direct_url.py +0 -227
  75. venv/Lib/site-packages/pip/_internal/models/format_control.py +0 -78
  76. venv/Lib/site-packages/pip/_internal/models/index.py +0 -28
  77. venv/Lib/site-packages/pip/_internal/models/installation_report.py +0 -57
  78. venv/Lib/site-packages/pip/_internal/models/link.py +0 -613
  79. venv/Lib/site-packages/pip/_internal/models/pylock.py +0 -188
  80. venv/Lib/site-packages/pip/_internal/models/scheme.py +0 -25
  81. venv/Lib/site-packages/pip/_internal/models/search_scope.py +0 -126
  82. venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +0 -53
  83. venv/Lib/site-packages/pip/_internal/models/target_python.py +0 -122
  84. venv/Lib/site-packages/pip/_internal/models/wheel.py +0 -141
  85. venv/Lib/site-packages/pip/_internal/network/__init__.py +0 -1
  86. venv/Lib/site-packages/pip/_internal/network/auth.py +0 -564
  87. venv/Lib/site-packages/pip/_internal/network/cache.py +0 -133
  88. venv/Lib/site-packages/pip/_internal/network/download.py +0 -342
  89. venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +0 -213
  90. venv/Lib/site-packages/pip/_internal/network/session.py +0 -528
  91. venv/Lib/site-packages/pip/_internal/network/utils.py +0 -98
  92. venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +0 -61
  93. venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
  94. venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
  95. venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +0 -140
  96. venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +0 -38
  97. venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +0 -41
  98. venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +0 -73
  99. venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +0 -38
  100. venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +0 -47
  101. venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +0 -119
  102. venv/Lib/site-packages/pip/_internal/operations/check.py +0 -175
  103. venv/Lib/site-packages/pip/_internal/operations/freeze.py +0 -259
  104. venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +0 -1
  105. venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +0 -48
  106. venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +0 -746
  107. venv/Lib/site-packages/pip/_internal/operations/prepare.py +0 -742
  108. venv/Lib/site-packages/pip/_internal/pyproject.py +0 -182
  109. venv/Lib/site-packages/pip/_internal/req/__init__.py +0 -105
  110. venv/Lib/site-packages/pip/_internal/req/constructors.py +0 -562
  111. venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +0 -75
  112. venv/Lib/site-packages/pip/_internal/req/req_file.py +0 -620
  113. venv/Lib/site-packages/pip/_internal/req/req_install.py +0 -937
  114. venv/Lib/site-packages/pip/_internal/req/req_set.py +0 -81
  115. venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +0 -639
  116. venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
  117. venv/Lib/site-packages/pip/_internal/resolution/base.py +0 -20
  118. venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
  119. venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +0 -598
  120. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
  121. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +0 -142
  122. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +0 -582
  123. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +0 -814
  124. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +0 -166
  125. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +0 -276
  126. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +0 -85
  127. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +0 -247
  128. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +0 -336
  129. venv/Lib/site-packages/pip/_internal/self_outdated_check.py +0 -254
  130. venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
  131. venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +0 -109
  132. venv/Lib/site-packages/pip/_internal/utils/_log.py +0 -38
  133. venv/Lib/site-packages/pip/_internal/utils/appdirs.py +0 -52
  134. venv/Lib/site-packages/pip/_internal/utils/compat.py +0 -85
  135. venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +0 -201
  136. venv/Lib/site-packages/pip/_internal/utils/datetime.py +0 -10
  137. venv/Lib/site-packages/pip/_internal/utils/deprecation.py +0 -126
  138. venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +0 -87
  139. venv/Lib/site-packages/pip/_internal/utils/egg_link.py +0 -81
  140. venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +0 -88
  141. venv/Lib/site-packages/pip/_internal/utils/filesystem.py +0 -152
  142. venv/Lib/site-packages/pip/_internal/utils/filetypes.py +0 -24
  143. venv/Lib/site-packages/pip/_internal/utils/glibc.py +0 -102
  144. venv/Lib/site-packages/pip/_internal/utils/hashes.py +0 -150
  145. venv/Lib/site-packages/pip/_internal/utils/logging.py +0 -364
  146. venv/Lib/site-packages/pip/_internal/utils/misc.py +0 -765
  147. venv/Lib/site-packages/pip/_internal/utils/packaging.py +0 -44
  148. venv/Lib/site-packages/pip/_internal/utils/retry.py +0 -45
  149. venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +0 -149
  150. venv/Lib/site-packages/pip/_internal/utils/subprocess.py +0 -248
  151. venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +0 -294
  152. venv/Lib/site-packages/pip/_internal/utils/unpacking.py +0 -337
  153. venv/Lib/site-packages/pip/_internal/utils/urls.py +0 -55
  154. venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +0 -105
  155. venv/Lib/site-packages/pip/_internal/utils/wheel.py +0 -132
  156. venv/Lib/site-packages/pip/_internal/vcs/__init__.py +0 -15
  157. venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +0 -130
  158. venv/Lib/site-packages/pip/_internal/vcs/git.py +0 -571
  159. venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +0 -186
  160. venv/Lib/site-packages/pip/_internal/vcs/subversion.py +0 -335
  161. venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +0 -693
  162. venv/Lib/site-packages/pip/_internal/wheel_builder.py +0 -334
  163. venv/Lib/site-packages/pip/_vendor/__init__.py +0 -117
  164. venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +0 -29
  165. venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +0 -70
  166. venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +0 -168
  167. venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +0 -75
  168. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +0 -8
  169. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +0 -145
  170. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +0 -48
  171. venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +0 -511
  172. venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +0 -119
  173. venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +0 -157
  174. venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
  175. venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +0 -146
  176. venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +0 -43
  177. venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +0 -4
  178. venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +0 -12
  179. venv/Lib/site-packages/pip/_vendor/certifi/core.py +0 -83
  180. venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
  181. venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +0 -13
  182. venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +0 -65
  183. venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +0 -209
  184. venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +0 -59
  185. venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +0 -62
  186. venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +0 -9
  187. venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
  188. venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +0 -33
  189. venv/Lib/site-packages/pip/_vendor/distlib/compat.py +0 -1137
  190. venv/Lib/site-packages/pip/_vendor/distlib/resources.py +0 -358
  191. venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +0 -447
  192. venv/Lib/site-packages/pip/_vendor/distlib/util.py +0 -1984
  193. venv/Lib/site-packages/pip/_vendor/distro/__init__.py +0 -54
  194. venv/Lib/site-packages/pip/_vendor/distro/__main__.py +0 -4
  195. venv/Lib/site-packages/pip/_vendor/distro/distro.py +0 -1403
  196. venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
  197. venv/Lib/site-packages/pip/_vendor/idna/__init__.py +0 -45
  198. venv/Lib/site-packages/pip/_vendor/idna/codec.py +0 -122
  199. venv/Lib/site-packages/pip/_vendor/idna/compat.py +0 -15
  200. venv/Lib/site-packages/pip/_vendor/idna/core.py +0 -437
  201. venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +0 -4243
  202. venv/Lib/site-packages/pip/_vendor/idna/intranges.py +0 -57
  203. venv/Lib/site-packages/pip/_vendor/idna/package_data.py +0 -1
  204. venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
  205. venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +0 -8681
  206. venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +0 -55
  207. venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +0 -48
  208. venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +0 -170
  209. venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +0 -929
  210. venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +0 -15
  211. venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +0 -109
  212. venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +0 -262
  213. venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +0 -85
  214. venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +0 -353
  215. venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +0 -61
  216. venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +0 -195
  217. venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +0 -145
  218. venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +0 -759
  219. venv/Lib/site-packages/pip/_vendor/packaging/markers.py +0 -362
  220. venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +0 -862
  221. venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
  222. venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +0 -91
  223. venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +0 -1019
  224. venv/Lib/site-packages/pip/_vendor/packaging/tags.py +0 -656
  225. venv/Lib/site-packages/pip/_vendor/packaging/utils.py +0 -163
  226. venv/Lib/site-packages/pip/_vendor/packaging/version.py +0 -582
  227. venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +0 -3676
  228. venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +0 -631
  229. venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +0 -55
  230. venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +0 -249
  231. venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +0 -299
  232. venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +0 -144
  233. venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
  234. venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +0 -272
  235. venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +0 -21
  236. venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +0 -272
  237. venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +0 -82
  238. venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +0 -17
  239. venv/Lib/site-packages/pip/_vendor/pygments/console.py +0 -70
  240. venv/Lib/site-packages/pip/_vendor/pygments/filter.py +0 -70
  241. venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +0 -940
  242. venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +0 -129
  243. venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +0 -157
  244. venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +0 -23
  245. venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +0 -963
  246. venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +0 -362
  247. venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +0 -602
  248. venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +0 -1201
  249. venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +0 -43
  250. venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +0 -72
  251. venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +0 -91
  252. venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +0 -104
  253. venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +0 -247
  254. venv/Lib/site-packages/pip/_vendor/pygments/style.py +0 -203
  255. venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +0 -61
  256. venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +0 -54
  257. venv/Lib/site-packages/pip/_vendor/pygments/token.py +0 -214
  258. venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +0 -153
  259. venv/Lib/site-packages/pip/_vendor/pygments/util.py +0 -324
  260. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +0 -31
  261. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +0 -410
  262. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +0 -21
  263. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +0 -389
  264. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
  265. venv/Lib/site-packages/pip/_vendor/requests/__init__.py +0 -179
  266. venv/Lib/site-packages/pip/_vendor/requests/__version__.py +0 -14
  267. venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +0 -50
  268. venv/Lib/site-packages/pip/_vendor/requests/adapters.py +0 -719
  269. venv/Lib/site-packages/pip/_vendor/requests/api.py +0 -157
  270. venv/Lib/site-packages/pip/_vendor/requests/auth.py +0 -314
  271. venv/Lib/site-packages/pip/_vendor/requests/certs.py +0 -17
  272. venv/Lib/site-packages/pip/_vendor/requests/compat.py +0 -90
  273. venv/Lib/site-packages/pip/_vendor/requests/cookies.py +0 -561
  274. venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +0 -151
  275. venv/Lib/site-packages/pip/_vendor/requests/help.py +0 -127
  276. venv/Lib/site-packages/pip/_vendor/requests/hooks.py +0 -33
  277. venv/Lib/site-packages/pip/_vendor/requests/models.py +0 -1039
  278. venv/Lib/site-packages/pip/_vendor/requests/packages.py +0 -25
  279. venv/Lib/site-packages/pip/_vendor/requests/sessions.py +0 -831
  280. venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +0 -128
  281. venv/Lib/site-packages/pip/_vendor/requests/structures.py +0 -99
  282. venv/Lib/site-packages/pip/_vendor/requests/utils.py +0 -1086
  283. venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +0 -27
  284. venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +0 -196
  285. venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
  286. venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +0 -55
  287. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +0 -27
  288. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +0 -47
  289. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +0 -48
  290. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +0 -57
  291. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +0 -622
  292. venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +0 -209
  293. venv/Lib/site-packages/pip/_vendor/rich/__init__.py +0 -177
  294. venv/Lib/site-packages/pip/_vendor/rich/__main__.py +0 -245
  295. venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +0 -454
  296. venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +0 -3610
  297. venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +0 -32
  298. venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +0 -76
  299. venv/Lib/site-packages/pip/_vendor/rich/_extension.py +0 -10
  300. venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +0 -24
  301. venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +0 -268
  302. venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +0 -94
  303. venv/Lib/site-packages/pip/_vendor/rich/_loop.py +0 -43
  304. venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +0 -69
  305. venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +0 -309
  306. venv/Lib/site-packages/pip/_vendor/rich/_pick.py +0 -17
  307. venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +0 -153
  308. venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +0 -482
  309. venv/Lib/site-packages/pip/_vendor/rich/_stack.py +0 -16
  310. venv/Lib/site-packages/pip/_vendor/rich/_timer.py +0 -19
  311. venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +0 -661
  312. venv/Lib/site-packages/pip/_vendor/rich/_windows.py +0 -71
  313. venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +0 -56
  314. venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +0 -93
  315. venv/Lib/site-packages/pip/_vendor/rich/abc.py +0 -33
  316. venv/Lib/site-packages/pip/_vendor/rich/align.py +0 -306
  317. venv/Lib/site-packages/pip/_vendor/rich/ansi.py +0 -241
  318. venv/Lib/site-packages/pip/_vendor/rich/bar.py +0 -93
  319. venv/Lib/site-packages/pip/_vendor/rich/box.py +0 -474
  320. venv/Lib/site-packages/pip/_vendor/rich/cells.py +0 -174
  321. venv/Lib/site-packages/pip/_vendor/rich/color.py +0 -621
  322. venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +0 -38
  323. venv/Lib/site-packages/pip/_vendor/rich/columns.py +0 -187
  324. venv/Lib/site-packages/pip/_vendor/rich/console.py +0 -2680
  325. venv/Lib/site-packages/pip/_vendor/rich/constrain.py +0 -37
  326. venv/Lib/site-packages/pip/_vendor/rich/containers.py +0 -167
  327. venv/Lib/site-packages/pip/_vendor/rich/control.py +0 -219
  328. venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +0 -193
  329. venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +0 -39
  330. venv/Lib/site-packages/pip/_vendor/rich/emoji.py +0 -91
  331. venv/Lib/site-packages/pip/_vendor/rich/errors.py +0 -34
  332. venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +0 -57
  333. venv/Lib/site-packages/pip/_vendor/rich/filesize.py +0 -88
  334. venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +0 -232
  335. venv/Lib/site-packages/pip/_vendor/rich/json.py +0 -139
  336. venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +0 -101
  337. venv/Lib/site-packages/pip/_vendor/rich/layout.py +0 -442
  338. venv/Lib/site-packages/pip/_vendor/rich/live.py +0 -400
  339. venv/Lib/site-packages/pip/_vendor/rich/live_render.py +0 -106
  340. venv/Lib/site-packages/pip/_vendor/rich/logging.py +0 -297
  341. venv/Lib/site-packages/pip/_vendor/rich/markup.py +0 -251
  342. venv/Lib/site-packages/pip/_vendor/rich/measure.py +0 -151
  343. venv/Lib/site-packages/pip/_vendor/rich/padding.py +0 -141
  344. venv/Lib/site-packages/pip/_vendor/rich/pager.py +0 -34
  345. venv/Lib/site-packages/pip/_vendor/rich/palette.py +0 -100
  346. venv/Lib/site-packages/pip/_vendor/rich/panel.py +0 -317
  347. venv/Lib/site-packages/pip/_vendor/rich/pretty.py +0 -1016
  348. venv/Lib/site-packages/pip/_vendor/rich/progress.py +0 -1715
  349. venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +0 -223
  350. venv/Lib/site-packages/pip/_vendor/rich/prompt.py +0 -400
  351. venv/Lib/site-packages/pip/_vendor/rich/protocol.py +0 -42
  352. venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
  353. venv/Lib/site-packages/pip/_vendor/rich/region.py +0 -10
  354. venv/Lib/site-packages/pip/_vendor/rich/repr.py +0 -149
  355. venv/Lib/site-packages/pip/_vendor/rich/rule.py +0 -130
  356. venv/Lib/site-packages/pip/_vendor/rich/scope.py +0 -86
  357. venv/Lib/site-packages/pip/_vendor/rich/screen.py +0 -54
  358. venv/Lib/site-packages/pip/_vendor/rich/segment.py +0 -752
  359. venv/Lib/site-packages/pip/_vendor/rich/spinner.py +0 -132
  360. venv/Lib/site-packages/pip/_vendor/rich/status.py +0 -131
  361. venv/Lib/site-packages/pip/_vendor/rich/style.py +0 -796
  362. venv/Lib/site-packages/pip/_vendor/rich/styled.py +0 -42
  363. venv/Lib/site-packages/pip/_vendor/rich/syntax.py +0 -985
  364. venv/Lib/site-packages/pip/_vendor/rich/table.py +0 -1006
  365. venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +0 -153
  366. venv/Lib/site-packages/pip/_vendor/rich/text.py +0 -1361
  367. venv/Lib/site-packages/pip/_vendor/rich/theme.py +0 -115
  368. venv/Lib/site-packages/pip/_vendor/rich/themes.py +0 -5
  369. venv/Lib/site-packages/pip/_vendor/rich/traceback.py +0 -899
  370. venv/Lib/site-packages/pip/_vendor/rich/tree.py +0 -257
  371. venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +0 -8
  372. venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +0 -770
  373. venv/Lib/site-packages/pip/_vendor/tomli/_re.py +0 -112
  374. venv/Lib/site-packages/pip/_vendor/tomli/_types.py +0 -10
  375. venv/Lib/site-packages/pip/_vendor/tomli/py.typed +0 -1
  376. venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +0 -4
  377. venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +0 -229
  378. venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +0 -1
  379. venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +0 -36
  380. venv/Lib/site-packages/pip/_vendor/truststore/_api.py +0 -333
  381. venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +0 -571
  382. venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +0 -66
  383. venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +0 -31
  384. venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +0 -567
  385. venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
  386. venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +0 -102
  387. venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +0 -355
  388. venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +0 -2
  389. venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +0 -572
  390. venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +0 -1140
  391. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  392. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +0 -36
  393. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  394. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +0 -519
  395. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +0 -397
  396. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +0 -314
  397. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +0 -130
  398. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +0 -518
  399. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +0 -920
  400. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +0 -216
  401. venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +0 -323
  402. venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +0 -274
  403. venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +0 -98
  404. venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
  405. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  406. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +0 -51
  407. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +0 -155
  408. venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +0 -1076
  409. venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +0 -540
  410. venv/Lib/site-packages/pip/_vendor/urllib3/request.py +0 -191
  411. venv/Lib/site-packages/pip/_vendor/urllib3/response.py +0 -879
  412. venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +0 -49
  413. venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +0 -149
  414. venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +0 -57
  415. venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +0 -22
  416. venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +0 -137
  417. venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +0 -107
  418. venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +0 -622
  419. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +0 -504
  420. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +0 -159
  421. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +0 -221
  422. venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +0 -271
  423. venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +0 -435
  424. venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +0 -152
  425. venv/Lib/site-packages/pip/py.typed +0 -4
  426. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.0.dist-info}/WHEEL +0 -0
@@ -1,862 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import email.feedparser
4
- import email.header
5
- import email.message
6
- import email.parser
7
- import email.policy
8
- import pathlib
9
- import sys
10
- import typing
11
- from typing import (
12
- Any,
13
- Callable,
14
- Generic,
15
- Literal,
16
- TypedDict,
17
- cast,
18
- )
19
-
20
- from . import licenses, requirements, specifiers, utils
21
- from . import version as version_module
22
- from .licenses import NormalizedLicenseExpression
23
-
24
- T = typing.TypeVar("T")
25
-
26
-
27
- if sys.version_info >= (3, 11): # pragma: no cover
28
- ExceptionGroup = ExceptionGroup
29
- else: # pragma: no cover
30
-
31
- class ExceptionGroup(Exception):
32
- """A minimal implementation of :external:exc:`ExceptionGroup` from Python 3.11.
33
-
34
- If :external:exc:`ExceptionGroup` is already defined by Python itself,
35
- that version is used instead.
36
- """
37
-
38
- message: str
39
- exceptions: list[Exception]
40
-
41
- def __init__(self, message: str, exceptions: list[Exception]) -> None:
42
- self.message = message
43
- self.exceptions = exceptions
44
-
45
- def __repr__(self) -> str:
46
- return f"{self.__class__.__name__}({self.message!r}, {self.exceptions!r})"
47
-
48
-
49
- class InvalidMetadata(ValueError):
50
- """A metadata field contains invalid data."""
51
-
52
- field: str
53
- """The name of the field that contains invalid data."""
54
-
55
- def __init__(self, field: str, message: str) -> None:
56
- self.field = field
57
- super().__init__(message)
58
-
59
-
60
- # The RawMetadata class attempts to make as few assumptions about the underlying
61
- # serialization formats as possible. The idea is that as long as a serialization
62
- # formats offer some very basic primitives in *some* way then we can support
63
- # serializing to and from that format.
64
- class RawMetadata(TypedDict, total=False):
65
- """A dictionary of raw core metadata.
66
-
67
- Each field in core metadata maps to a key of this dictionary (when data is
68
- provided). The key is lower-case and underscores are used instead of dashes
69
- compared to the equivalent core metadata field. Any core metadata field that
70
- can be specified multiple times or can hold multiple values in a single
71
- field have a key with a plural name. See :class:`Metadata` whose attributes
72
- match the keys of this dictionary.
73
-
74
- Core metadata fields that can be specified multiple times are stored as a
75
- list or dict depending on which is appropriate for the field. Any fields
76
- which hold multiple values in a single field are stored as a list.
77
-
78
- """
79
-
80
- # Metadata 1.0 - PEP 241
81
- metadata_version: str
82
- name: str
83
- version: str
84
- platforms: list[str]
85
- summary: str
86
- description: str
87
- keywords: list[str]
88
- home_page: str
89
- author: str
90
- author_email: str
91
- license: str
92
-
93
- # Metadata 1.1 - PEP 314
94
- supported_platforms: list[str]
95
- download_url: str
96
- classifiers: list[str]
97
- requires: list[str]
98
- provides: list[str]
99
- obsoletes: list[str]
100
-
101
- # Metadata 1.2 - PEP 345
102
- maintainer: str
103
- maintainer_email: str
104
- requires_dist: list[str]
105
- provides_dist: list[str]
106
- obsoletes_dist: list[str]
107
- requires_python: str
108
- requires_external: list[str]
109
- project_urls: dict[str, str]
110
-
111
- # Metadata 2.0
112
- # PEP 426 attempted to completely revamp the metadata format
113
- # but got stuck without ever being able to build consensus on
114
- # it and ultimately ended up withdrawn.
115
- #
116
- # However, a number of tools had started emitting METADATA with
117
- # `2.0` Metadata-Version, so for historical reasons, this version
118
- # was skipped.
119
-
120
- # Metadata 2.1 - PEP 566
121
- description_content_type: str
122
- provides_extra: list[str]
123
-
124
- # Metadata 2.2 - PEP 643
125
- dynamic: list[str]
126
-
127
- # Metadata 2.3 - PEP 685
128
- # No new fields were added in PEP 685, just some edge case were
129
- # tightened up to provide better interoptability.
130
-
131
- # Metadata 2.4 - PEP 639
132
- license_expression: str
133
- license_files: list[str]
134
-
135
-
136
- _STRING_FIELDS = {
137
- "author",
138
- "author_email",
139
- "description",
140
- "description_content_type",
141
- "download_url",
142
- "home_page",
143
- "license",
144
- "license_expression",
145
- "maintainer",
146
- "maintainer_email",
147
- "metadata_version",
148
- "name",
149
- "requires_python",
150
- "summary",
151
- "version",
152
- }
153
-
154
- _LIST_FIELDS = {
155
- "classifiers",
156
- "dynamic",
157
- "license_files",
158
- "obsoletes",
159
- "obsoletes_dist",
160
- "platforms",
161
- "provides",
162
- "provides_dist",
163
- "provides_extra",
164
- "requires",
165
- "requires_dist",
166
- "requires_external",
167
- "supported_platforms",
168
- }
169
-
170
- _DICT_FIELDS = {
171
- "project_urls",
172
- }
173
-
174
-
175
- def _parse_keywords(data: str) -> list[str]:
176
- """Split a string of comma-separated keywords into a list of keywords."""
177
- return [k.strip() for k in data.split(",")]
178
-
179
-
180
- def _parse_project_urls(data: list[str]) -> dict[str, str]:
181
- """Parse a list of label/URL string pairings separated by a comma."""
182
- urls = {}
183
- for pair in data:
184
- # Our logic is slightly tricky here as we want to try and do
185
- # *something* reasonable with malformed data.
186
- #
187
- # The main thing that we have to worry about, is data that does
188
- # not have a ',' at all to split the label from the Value. There
189
- # isn't a singular right answer here, and we will fail validation
190
- # later on (if the caller is validating) so it doesn't *really*
191
- # matter, but since the missing value has to be an empty str
192
- # and our return value is dict[str, str], if we let the key
193
- # be the missing value, then they'd have multiple '' values that
194
- # overwrite each other in a accumulating dict.
195
- #
196
- # The other potentional issue is that it's possible to have the
197
- # same label multiple times in the metadata, with no solid "right"
198
- # answer with what to do in that case. As such, we'll do the only
199
- # thing we can, which is treat the field as unparseable and add it
200
- # to our list of unparsed fields.
201
- parts = [p.strip() for p in pair.split(",", 1)]
202
- parts.extend([""] * (max(0, 2 - len(parts)))) # Ensure 2 items
203
-
204
- # TODO: The spec doesn't say anything about if the keys should be
205
- # considered case sensitive or not... logically they should
206
- # be case-preserving and case-insensitive, but doing that
207
- # would open up more cases where we might have duplicate
208
- # entries.
209
- label, url = parts
210
- if label in urls:
211
- # The label already exists in our set of urls, so this field
212
- # is unparseable, and we can just add the whole thing to our
213
- # unparseable data and stop processing it.
214
- raise KeyError("duplicate labels in project urls")
215
- urls[label] = url
216
-
217
- return urls
218
-
219
-
220
- def _get_payload(msg: email.message.Message, source: bytes | str) -> str:
221
- """Get the body of the message."""
222
- # If our source is a str, then our caller has managed encodings for us,
223
- # and we don't need to deal with it.
224
- if isinstance(source, str):
225
- payload = msg.get_payload()
226
- assert isinstance(payload, str)
227
- return payload
228
- # If our source is a bytes, then we're managing the encoding and we need
229
- # to deal with it.
230
- else:
231
- bpayload = msg.get_payload(decode=True)
232
- assert isinstance(bpayload, bytes)
233
- try:
234
- return bpayload.decode("utf8", "strict")
235
- except UnicodeDecodeError as exc:
236
- raise ValueError("payload in an invalid encoding") from exc
237
-
238
-
239
- # The various parse_FORMAT functions here are intended to be as lenient as
240
- # possible in their parsing, while still returning a correctly typed
241
- # RawMetadata.
242
- #
243
- # To aid in this, we also generally want to do as little touching of the
244
- # data as possible, except where there are possibly some historic holdovers
245
- # that make valid data awkward to work with.
246
- #
247
- # While this is a lower level, intermediate format than our ``Metadata``
248
- # class, some light touch ups can make a massive difference in usability.
249
-
250
- # Map METADATA fields to RawMetadata.
251
- _EMAIL_TO_RAW_MAPPING = {
252
- "author": "author",
253
- "author-email": "author_email",
254
- "classifier": "classifiers",
255
- "description": "description",
256
- "description-content-type": "description_content_type",
257
- "download-url": "download_url",
258
- "dynamic": "dynamic",
259
- "home-page": "home_page",
260
- "keywords": "keywords",
261
- "license": "license",
262
- "license-expression": "license_expression",
263
- "license-file": "license_files",
264
- "maintainer": "maintainer",
265
- "maintainer-email": "maintainer_email",
266
- "metadata-version": "metadata_version",
267
- "name": "name",
268
- "obsoletes": "obsoletes",
269
- "obsoletes-dist": "obsoletes_dist",
270
- "platform": "platforms",
271
- "project-url": "project_urls",
272
- "provides": "provides",
273
- "provides-dist": "provides_dist",
274
- "provides-extra": "provides_extra",
275
- "requires": "requires",
276
- "requires-dist": "requires_dist",
277
- "requires-external": "requires_external",
278
- "requires-python": "requires_python",
279
- "summary": "summary",
280
- "supported-platform": "supported_platforms",
281
- "version": "version",
282
- }
283
- _RAW_TO_EMAIL_MAPPING = {raw: email for email, raw in _EMAIL_TO_RAW_MAPPING.items()}
284
-
285
-
286
- def parse_email(data: bytes | str) -> tuple[RawMetadata, dict[str, list[str]]]:
287
- """Parse a distribution's metadata stored as email headers (e.g. from ``METADATA``).
288
-
289
- This function returns a two-item tuple of dicts. The first dict is of
290
- recognized fields from the core metadata specification. Fields that can be
291
- parsed and translated into Python's built-in types are converted
292
- appropriately. All other fields are left as-is. Fields that are allowed to
293
- appear multiple times are stored as lists.
294
-
295
- The second dict contains all other fields from the metadata. This includes
296
- any unrecognized fields. It also includes any fields which are expected to
297
- be parsed into a built-in type but were not formatted appropriately. Finally,
298
- any fields that are expected to appear only once but are repeated are
299
- included in this dict.
300
-
301
- """
302
- raw: dict[str, str | list[str] | dict[str, str]] = {}
303
- unparsed: dict[str, list[str]] = {}
304
-
305
- if isinstance(data, str):
306
- parsed = email.parser.Parser(policy=email.policy.compat32).parsestr(data)
307
- else:
308
- parsed = email.parser.BytesParser(policy=email.policy.compat32).parsebytes(data)
309
-
310
- # We have to wrap parsed.keys() in a set, because in the case of multiple
311
- # values for a key (a list), the key will appear multiple times in the
312
- # list of keys, but we're avoiding that by using get_all().
313
- for name in frozenset(parsed.keys()):
314
- # Header names in RFC are case insensitive, so we'll normalize to all
315
- # lower case to make comparisons easier.
316
- name = name.lower()
317
-
318
- # We use get_all() here, even for fields that aren't multiple use,
319
- # because otherwise someone could have e.g. two Name fields, and we
320
- # would just silently ignore it rather than doing something about it.
321
- headers = parsed.get_all(name) or []
322
-
323
- # The way the email module works when parsing bytes is that it
324
- # unconditionally decodes the bytes as ascii using the surrogateescape
325
- # handler. When you pull that data back out (such as with get_all() ),
326
- # it looks to see if the str has any surrogate escapes, and if it does
327
- # it wraps it in a Header object instead of returning the string.
328
- #
329
- # As such, we'll look for those Header objects, and fix up the encoding.
330
- value = []
331
- # Flag if we have run into any issues processing the headers, thus
332
- # signalling that the data belongs in 'unparsed'.
333
- valid_encoding = True
334
- for h in headers:
335
- # It's unclear if this can return more types than just a Header or
336
- # a str, so we'll just assert here to make sure.
337
- assert isinstance(h, (email.header.Header, str))
338
-
339
- # If it's a header object, we need to do our little dance to get
340
- # the real data out of it. In cases where there is invalid data
341
- # we're going to end up with mojibake, but there's no obvious, good
342
- # way around that without reimplementing parts of the Header object
343
- # ourselves.
344
- #
345
- # That should be fine since, if mojibacked happens, this key is
346
- # going into the unparsed dict anyways.
347
- if isinstance(h, email.header.Header):
348
- # The Header object stores it's data as chunks, and each chunk
349
- # can be independently encoded, so we'll need to check each
350
- # of them.
351
- chunks: list[tuple[bytes, str | None]] = []
352
- for bin, encoding in email.header.decode_header(h):
353
- try:
354
- bin.decode("utf8", "strict")
355
- except UnicodeDecodeError:
356
- # Enable mojibake.
357
- encoding = "latin1"
358
- valid_encoding = False
359
- else:
360
- encoding = "utf8"
361
- chunks.append((bin, encoding))
362
-
363
- # Turn our chunks back into a Header object, then let that
364
- # Header object do the right thing to turn them into a
365
- # string for us.
366
- value.append(str(email.header.make_header(chunks)))
367
- # This is already a string, so just add it.
368
- else:
369
- value.append(h)
370
-
371
- # We've processed all of our values to get them into a list of str,
372
- # but we may have mojibake data, in which case this is an unparsed
373
- # field.
374
- if not valid_encoding:
375
- unparsed[name] = value
376
- continue
377
-
378
- raw_name = _EMAIL_TO_RAW_MAPPING.get(name)
379
- if raw_name is None:
380
- # This is a bit of a weird situation, we've encountered a key that
381
- # we don't know what it means, so we don't know whether it's meant
382
- # to be a list or not.
383
- #
384
- # Since we can't really tell one way or another, we'll just leave it
385
- # as a list, even though it may be a single item list, because that's
386
- # what makes the most sense for email headers.
387
- unparsed[name] = value
388
- continue
389
-
390
- # If this is one of our string fields, then we'll check to see if our
391
- # value is a list of a single item. If it is then we'll assume that
392
- # it was emitted as a single string, and unwrap the str from inside
393
- # the list.
394
- #
395
- # If it's any other kind of data, then we haven't the faintest clue
396
- # what we should parse it as, and we have to just add it to our list
397
- # of unparsed stuff.
398
- if raw_name in _STRING_FIELDS and len(value) == 1:
399
- raw[raw_name] = value[0]
400
- # If this is one of our list of string fields, then we can just assign
401
- # the value, since email *only* has strings, and our get_all() call
402
- # above ensures that this is a list.
403
- elif raw_name in _LIST_FIELDS:
404
- raw[raw_name] = value
405
- # Special Case: Keywords
406
- # The keywords field is implemented in the metadata spec as a str,
407
- # but it conceptually is a list of strings, and is serialized using
408
- # ", ".join(keywords), so we'll do some light data massaging to turn
409
- # this into what it logically is.
410
- elif raw_name == "keywords" and len(value) == 1:
411
- raw[raw_name] = _parse_keywords(value[0])
412
- # Special Case: Project-URL
413
- # The project urls is implemented in the metadata spec as a list of
414
- # specially-formatted strings that represent a key and a value, which
415
- # is fundamentally a mapping, however the email format doesn't support
416
- # mappings in a sane way, so it was crammed into a list of strings
417
- # instead.
418
- #
419
- # We will do a little light data massaging to turn this into a map as
420
- # it logically should be.
421
- elif raw_name == "project_urls":
422
- try:
423
- raw[raw_name] = _parse_project_urls(value)
424
- except KeyError:
425
- unparsed[name] = value
426
- # Nothing that we've done has managed to parse this, so it'll just
427
- # throw it in our unparseable data and move on.
428
- else:
429
- unparsed[name] = value
430
-
431
- # We need to support getting the Description from the message payload in
432
- # addition to getting it from the the headers. This does mean, though, there
433
- # is the possibility of it being set both ways, in which case we put both
434
- # in 'unparsed' since we don't know which is right.
435
- try:
436
- payload = _get_payload(parsed, data)
437
- except ValueError:
438
- unparsed.setdefault("description", []).append(
439
- parsed.get_payload(decode=isinstance(data, bytes)) # type: ignore[call-overload]
440
- )
441
- else:
442
- if payload:
443
- # Check to see if we've already got a description, if so then both
444
- # it, and this body move to unparseable.
445
- if "description" in raw:
446
- description_header = cast(str, raw.pop("description"))
447
- unparsed.setdefault("description", []).extend(
448
- [description_header, payload]
449
- )
450
- elif "description" in unparsed:
451
- unparsed["description"].append(payload)
452
- else:
453
- raw["description"] = payload
454
-
455
- # We need to cast our `raw` to a metadata, because a TypedDict only support
456
- # literal key names, but we're computing our key names on purpose, but the
457
- # way this function is implemented, our `TypedDict` can only have valid key
458
- # names.
459
- return cast(RawMetadata, raw), unparsed
460
-
461
-
462
- _NOT_FOUND = object()
463
-
464
-
465
- # Keep the two values in sync.
466
- _VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.1", "2.2", "2.3", "2.4"]
467
- _MetadataVersion = Literal["1.0", "1.1", "1.2", "2.1", "2.2", "2.3", "2.4"]
468
-
469
- _REQUIRED_ATTRS = frozenset(["metadata_version", "name", "version"])
470
-
471
-
472
- class _Validator(Generic[T]):
473
- """Validate a metadata field.
474
-
475
- All _process_*() methods correspond to a core metadata field. The method is
476
- called with the field's raw value. If the raw value is valid it is returned
477
- in its "enriched" form (e.g. ``version.Version`` for the ``Version`` field).
478
- If the raw value is invalid, :exc:`InvalidMetadata` is raised (with a cause
479
- as appropriate).
480
- """
481
-
482
- name: str
483
- raw_name: str
484
- added: _MetadataVersion
485
-
486
- def __init__(
487
- self,
488
- *,
489
- added: _MetadataVersion = "1.0",
490
- ) -> None:
491
- self.added = added
492
-
493
- def __set_name__(self, _owner: Metadata, name: str) -> None:
494
- self.name = name
495
- self.raw_name = _RAW_TO_EMAIL_MAPPING[name]
496
-
497
- def __get__(self, instance: Metadata, _owner: type[Metadata]) -> T:
498
- # With Python 3.8, the caching can be replaced with functools.cached_property().
499
- # No need to check the cache as attribute lookup will resolve into the
500
- # instance's __dict__ before __get__ is called.
501
- cache = instance.__dict__
502
- value = instance._raw.get(self.name)
503
-
504
- # To make the _process_* methods easier, we'll check if the value is None
505
- # and if this field is NOT a required attribute, and if both of those
506
- # things are true, we'll skip the the converter. This will mean that the
507
- # converters never have to deal with the None union.
508
- if self.name in _REQUIRED_ATTRS or value is not None:
509
- try:
510
- converter: Callable[[Any], T] = getattr(self, f"_process_{self.name}")
511
- except AttributeError:
512
- pass
513
- else:
514
- value = converter(value)
515
-
516
- cache[self.name] = value
517
- try:
518
- del instance._raw[self.name] # type: ignore[misc]
519
- except KeyError:
520
- pass
521
-
522
- return cast(T, value)
523
-
524
- def _invalid_metadata(
525
- self, msg: str, cause: Exception | None = None
526
- ) -> InvalidMetadata:
527
- exc = InvalidMetadata(
528
- self.raw_name, msg.format_map({"field": repr(self.raw_name)})
529
- )
530
- exc.__cause__ = cause
531
- return exc
532
-
533
- def _process_metadata_version(self, value: str) -> _MetadataVersion:
534
- # Implicitly makes Metadata-Version required.
535
- if value not in _VALID_METADATA_VERSIONS:
536
- raise self._invalid_metadata(f"{value!r} is not a valid metadata version")
537
- return cast(_MetadataVersion, value)
538
-
539
- def _process_name(self, value: str) -> str:
540
- if not value:
541
- raise self._invalid_metadata("{field} is a required field")
542
- # Validate the name as a side-effect.
543
- try:
544
- utils.canonicalize_name(value, validate=True)
545
- except utils.InvalidName as exc:
546
- raise self._invalid_metadata(
547
- f"{value!r} is invalid for {{field}}", cause=exc
548
- ) from exc
549
- else:
550
- return value
551
-
552
- def _process_version(self, value: str) -> version_module.Version:
553
- if not value:
554
- raise self._invalid_metadata("{field} is a required field")
555
- try:
556
- return version_module.parse(value)
557
- except version_module.InvalidVersion as exc:
558
- raise self._invalid_metadata(
559
- f"{value!r} is invalid for {{field}}", cause=exc
560
- ) from exc
561
-
562
- def _process_summary(self, value: str) -> str:
563
- """Check the field contains no newlines."""
564
- if "\n" in value:
565
- raise self._invalid_metadata("{field} must be a single line")
566
- return value
567
-
568
- def _process_description_content_type(self, value: str) -> str:
569
- content_types = {"text/plain", "text/x-rst", "text/markdown"}
570
- message = email.message.EmailMessage()
571
- message["content-type"] = value
572
-
573
- content_type, parameters = (
574
- # Defaults to `text/plain` if parsing failed.
575
- message.get_content_type().lower(),
576
- message["content-type"].params,
577
- )
578
- # Check if content-type is valid or defaulted to `text/plain` and thus was
579
- # not parseable.
580
- if content_type not in content_types or content_type not in value.lower():
581
- raise self._invalid_metadata(
582
- f"{{field}} must be one of {list(content_types)}, not {value!r}"
583
- )
584
-
585
- charset = parameters.get("charset", "UTF-8")
586
- if charset != "UTF-8":
587
- raise self._invalid_metadata(
588
- f"{{field}} can only specify the UTF-8 charset, not {list(charset)}"
589
- )
590
-
591
- markdown_variants = {"GFM", "CommonMark"}
592
- variant = parameters.get("variant", "GFM") # Use an acceptable default.
593
- if content_type == "text/markdown" and variant not in markdown_variants:
594
- raise self._invalid_metadata(
595
- f"valid Markdown variants for {{field}} are {list(markdown_variants)}, "
596
- f"not {variant!r}",
597
- )
598
- return value
599
-
600
- def _process_dynamic(self, value: list[str]) -> list[str]:
601
- for dynamic_field in map(str.lower, value):
602
- if dynamic_field in {"name", "version", "metadata-version"}:
603
- raise self._invalid_metadata(
604
- f"{dynamic_field!r} is not allowed as a dynamic field"
605
- )
606
- elif dynamic_field not in _EMAIL_TO_RAW_MAPPING:
607
- raise self._invalid_metadata(
608
- f"{dynamic_field!r} is not a valid dynamic field"
609
- )
610
- return list(map(str.lower, value))
611
-
612
- def _process_provides_extra(
613
- self,
614
- value: list[str],
615
- ) -> list[utils.NormalizedName]:
616
- normalized_names = []
617
- try:
618
- for name in value:
619
- normalized_names.append(utils.canonicalize_name(name, validate=True))
620
- except utils.InvalidName as exc:
621
- raise self._invalid_metadata(
622
- f"{name!r} is invalid for {{field}}", cause=exc
623
- ) from exc
624
- else:
625
- return normalized_names
626
-
627
- def _process_requires_python(self, value: str) -> specifiers.SpecifierSet:
628
- try:
629
- return specifiers.SpecifierSet(value)
630
- except specifiers.InvalidSpecifier as exc:
631
- raise self._invalid_metadata(
632
- f"{value!r} is invalid for {{field}}", cause=exc
633
- ) from exc
634
-
635
- def _process_requires_dist(
636
- self,
637
- value: list[str],
638
- ) -> list[requirements.Requirement]:
639
- reqs = []
640
- try:
641
- for req in value:
642
- reqs.append(requirements.Requirement(req))
643
- except requirements.InvalidRequirement as exc:
644
- raise self._invalid_metadata(
645
- f"{req!r} is invalid for {{field}}", cause=exc
646
- ) from exc
647
- else:
648
- return reqs
649
-
650
- def _process_license_expression(
651
- self, value: str
652
- ) -> NormalizedLicenseExpression | None:
653
- try:
654
- return licenses.canonicalize_license_expression(value)
655
- except ValueError as exc:
656
- raise self._invalid_metadata(
657
- f"{value!r} is invalid for {{field}}", cause=exc
658
- ) from exc
659
-
660
- def _process_license_files(self, value: list[str]) -> list[str]:
661
- paths = []
662
- for path in value:
663
- if ".." in path:
664
- raise self._invalid_metadata(
665
- f"{path!r} is invalid for {{field}}, "
666
- "parent directory indicators are not allowed"
667
- )
668
- if "*" in path:
669
- raise self._invalid_metadata(
670
- f"{path!r} is invalid for {{field}}, paths must be resolved"
671
- )
672
- if (
673
- pathlib.PurePosixPath(path).is_absolute()
674
- or pathlib.PureWindowsPath(path).is_absolute()
675
- ):
676
- raise self._invalid_metadata(
677
- f"{path!r} is invalid for {{field}}, paths must be relative"
678
- )
679
- if pathlib.PureWindowsPath(path).as_posix() != path:
680
- raise self._invalid_metadata(
681
- f"{path!r} is invalid for {{field}}, paths must use '/' delimiter"
682
- )
683
- paths.append(path)
684
- return paths
685
-
686
-
687
- class Metadata:
688
- """Representation of distribution metadata.
689
-
690
- Compared to :class:`RawMetadata`, this class provides objects representing
691
- metadata fields instead of only using built-in types. Any invalid metadata
692
- will cause :exc:`InvalidMetadata` to be raised (with a
693
- :py:attr:`~BaseException.__cause__` attribute as appropriate).
694
- """
695
-
696
- _raw: RawMetadata
697
-
698
- @classmethod
699
- def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> Metadata:
700
- """Create an instance from :class:`RawMetadata`.
701
-
702
- If *validate* is true, all metadata will be validated. All exceptions
703
- related to validation will be gathered and raised as an :class:`ExceptionGroup`.
704
- """
705
- ins = cls()
706
- ins._raw = data.copy() # Mutations occur due to caching enriched values.
707
-
708
- if validate:
709
- exceptions: list[Exception] = []
710
- try:
711
- metadata_version = ins.metadata_version
712
- metadata_age = _VALID_METADATA_VERSIONS.index(metadata_version)
713
- except InvalidMetadata as metadata_version_exc:
714
- exceptions.append(metadata_version_exc)
715
- metadata_version = None
716
-
717
- # Make sure to check for the fields that are present, the required
718
- # fields (so their absence can be reported).
719
- fields_to_check = frozenset(ins._raw) | _REQUIRED_ATTRS
720
- # Remove fields that have already been checked.
721
- fields_to_check -= {"metadata_version"}
722
-
723
- for key in fields_to_check:
724
- try:
725
- if metadata_version:
726
- # Can't use getattr() as that triggers descriptor protocol which
727
- # will fail due to no value for the instance argument.
728
- try:
729
- field_metadata_version = cls.__dict__[key].added
730
- except KeyError:
731
- exc = InvalidMetadata(key, f"unrecognized field: {key!r}")
732
- exceptions.append(exc)
733
- continue
734
- field_age = _VALID_METADATA_VERSIONS.index(
735
- field_metadata_version
736
- )
737
- if field_age > metadata_age:
738
- field = _RAW_TO_EMAIL_MAPPING[key]
739
- exc = InvalidMetadata(
740
- field,
741
- f"{field} introduced in metadata version "
742
- f"{field_metadata_version}, not {metadata_version}",
743
- )
744
- exceptions.append(exc)
745
- continue
746
- getattr(ins, key)
747
- except InvalidMetadata as exc:
748
- exceptions.append(exc)
749
-
750
- if exceptions:
751
- raise ExceptionGroup("invalid metadata", exceptions)
752
-
753
- return ins
754
-
755
- @classmethod
756
- def from_email(cls, data: bytes | str, *, validate: bool = True) -> Metadata:
757
- """Parse metadata from email headers.
758
-
759
- If *validate* is true, the metadata will be validated. All exceptions
760
- related to validation will be gathered and raised as an :class:`ExceptionGroup`.
761
- """
762
- raw, unparsed = parse_email(data)
763
-
764
- if validate:
765
- exceptions: list[Exception] = []
766
- for unparsed_key in unparsed:
767
- if unparsed_key in _EMAIL_TO_RAW_MAPPING:
768
- message = f"{unparsed_key!r} has invalid data"
769
- else:
770
- message = f"unrecognized field: {unparsed_key!r}"
771
- exceptions.append(InvalidMetadata(unparsed_key, message))
772
-
773
- if exceptions:
774
- raise ExceptionGroup("unparsed", exceptions)
775
-
776
- try:
777
- return cls.from_raw(raw, validate=validate)
778
- except ExceptionGroup as exc_group:
779
- raise ExceptionGroup(
780
- "invalid or unparsed metadata", exc_group.exceptions
781
- ) from None
782
-
783
- metadata_version: _Validator[_MetadataVersion] = _Validator()
784
- """:external:ref:`core-metadata-metadata-version`
785
- (required; validated to be a valid metadata version)"""
786
- # `name` is not normalized/typed to NormalizedName so as to provide access to
787
- # the original/raw name.
788
- name: _Validator[str] = _Validator()
789
- """:external:ref:`core-metadata-name`
790
- (required; validated using :func:`~packaging.utils.canonicalize_name` and its
791
- *validate* parameter)"""
792
- version: _Validator[version_module.Version] = _Validator()
793
- """:external:ref:`core-metadata-version` (required)"""
794
- dynamic: _Validator[list[str] | None] = _Validator(
795
- added="2.2",
796
- )
797
- """:external:ref:`core-metadata-dynamic`
798
- (validated against core metadata field names and lowercased)"""
799
- platforms: _Validator[list[str] | None] = _Validator()
800
- """:external:ref:`core-metadata-platform`"""
801
- supported_platforms: _Validator[list[str] | None] = _Validator(added="1.1")
802
- """:external:ref:`core-metadata-supported-platform`"""
803
- summary: _Validator[str | None] = _Validator()
804
- """:external:ref:`core-metadata-summary` (validated to contain no newlines)"""
805
- description: _Validator[str | None] = _Validator() # TODO 2.1: can be in body
806
- """:external:ref:`core-metadata-description`"""
807
- description_content_type: _Validator[str | None] = _Validator(added="2.1")
808
- """:external:ref:`core-metadata-description-content-type` (validated)"""
809
- keywords: _Validator[list[str] | None] = _Validator()
810
- """:external:ref:`core-metadata-keywords`"""
811
- home_page: _Validator[str | None] = _Validator()
812
- """:external:ref:`core-metadata-home-page`"""
813
- download_url: _Validator[str | None] = _Validator(added="1.1")
814
- """:external:ref:`core-metadata-download-url`"""
815
- author: _Validator[str | None] = _Validator()
816
- """:external:ref:`core-metadata-author`"""
817
- author_email: _Validator[str | None] = _Validator()
818
- """:external:ref:`core-metadata-author-email`"""
819
- maintainer: _Validator[str | None] = _Validator(added="1.2")
820
- """:external:ref:`core-metadata-maintainer`"""
821
- maintainer_email: _Validator[str | None] = _Validator(added="1.2")
822
- """:external:ref:`core-metadata-maintainer-email`"""
823
- license: _Validator[str | None] = _Validator()
824
- """:external:ref:`core-metadata-license`"""
825
- license_expression: _Validator[NormalizedLicenseExpression | None] = _Validator(
826
- added="2.4"
827
- )
828
- """:external:ref:`core-metadata-license-expression`"""
829
- license_files: _Validator[list[str] | None] = _Validator(added="2.4")
830
- """:external:ref:`core-metadata-license-file`"""
831
- classifiers: _Validator[list[str] | None] = _Validator(added="1.1")
832
- """:external:ref:`core-metadata-classifier`"""
833
- requires_dist: _Validator[list[requirements.Requirement] | None] = _Validator(
834
- added="1.2"
835
- )
836
- """:external:ref:`core-metadata-requires-dist`"""
837
- requires_python: _Validator[specifiers.SpecifierSet | None] = _Validator(
838
- added="1.2"
839
- )
840
- """:external:ref:`core-metadata-requires-python`"""
841
- # Because `Requires-External` allows for non-PEP 440 version specifiers, we
842
- # don't do any processing on the values.
843
- requires_external: _Validator[list[str] | None] = _Validator(added="1.2")
844
- """:external:ref:`core-metadata-requires-external`"""
845
- project_urls: _Validator[dict[str, str] | None] = _Validator(added="1.2")
846
- """:external:ref:`core-metadata-project-url`"""
847
- # PEP 685 lets us raise an error if an extra doesn't pass `Name` validation
848
- # regardless of metadata version.
849
- provides_extra: _Validator[list[utils.NormalizedName] | None] = _Validator(
850
- added="2.1",
851
- )
852
- """:external:ref:`core-metadata-provides-extra`"""
853
- provides_dist: _Validator[list[str] | None] = _Validator(added="1.2")
854
- """:external:ref:`core-metadata-provides-dist`"""
855
- obsoletes_dist: _Validator[list[str] | None] = _Validator(added="1.2")
856
- """:external:ref:`core-metadata-obsoletes-dist`"""
857
- requires: _Validator[list[str] | None] = _Validator(added="1.1")
858
- """``Requires`` (deprecated)"""
859
- provides: _Validator[list[str] | None] = _Validator(added="1.1")
860
- """``Provides`` (deprecated)"""
861
- obsoletes: _Validator[list[str] | None] = _Validator(added="1.1")
862
- """``Obsoletes`` (deprecated)"""