cli-ih 0.6.3.1__py3-none-any.whl → 0.7.1__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 (427) hide show
  1. cli_ih/__init__.py +1 -0
  2. cli_ih/asyncClient.py +109 -10
  3. cli_ih/client.py +110 -18
  4. cli_ih/utils.py +51 -0
  5. cli_ih-0.7.1.dist-info/METADATA +100 -0
  6. cli_ih-0.7.1.dist-info/RECORD +9 -0
  7. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.1.dist-info}/top_level.txt +0 -1
  8. cli_ih-0.6.3.1.dist-info/METADATA +0 -86
  9. cli_ih-0.6.3.1.dist-info/RECORD +0 -425
  10. venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +0 -85
  11. venv/Lib/site-packages/pip/__init__.py +0 -13
  12. venv/Lib/site-packages/pip/__main__.py +0 -24
  13. venv/Lib/site-packages/pip/__pip-runner__.py +0 -50
  14. venv/Lib/site-packages/pip/_internal/__init__.py +0 -18
  15. venv/Lib/site-packages/pip/_internal/build_env.py +0 -349
  16. venv/Lib/site-packages/pip/_internal/cache.py +0 -291
  17. venv/Lib/site-packages/pip/_internal/cli/__init__.py +0 -3
  18. venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +0 -184
  19. venv/Lib/site-packages/pip/_internal/cli/base_command.py +0 -244
  20. venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +0 -1138
  21. venv/Lib/site-packages/pip/_internal/cli/command_context.py +0 -28
  22. venv/Lib/site-packages/pip/_internal/cli/index_command.py +0 -175
  23. venv/Lib/site-packages/pip/_internal/cli/main.py +0 -80
  24. venv/Lib/site-packages/pip/_internal/cli/main_parser.py +0 -134
  25. venv/Lib/site-packages/pip/_internal/cli/parser.py +0 -298
  26. venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +0 -151
  27. venv/Lib/site-packages/pip/_internal/cli/req_command.py +0 -351
  28. venv/Lib/site-packages/pip/_internal/cli/spinners.py +0 -235
  29. venv/Lib/site-packages/pip/_internal/cli/status_codes.py +0 -6
  30. venv/Lib/site-packages/pip/_internal/commands/__init__.py +0 -139
  31. venv/Lib/site-packages/pip/_internal/commands/cache.py +0 -231
  32. venv/Lib/site-packages/pip/_internal/commands/check.py +0 -66
  33. venv/Lib/site-packages/pip/_internal/commands/completion.py +0 -135
  34. venv/Lib/site-packages/pip/_internal/commands/configuration.py +0 -288
  35. venv/Lib/site-packages/pip/_internal/commands/debug.py +0 -203
  36. venv/Lib/site-packages/pip/_internal/commands/download.py +0 -145
  37. venv/Lib/site-packages/pip/_internal/commands/freeze.py +0 -107
  38. venv/Lib/site-packages/pip/_internal/commands/hash.py +0 -58
  39. venv/Lib/site-packages/pip/_internal/commands/help.py +0 -40
  40. venv/Lib/site-packages/pip/_internal/commands/index.py +0 -159
  41. venv/Lib/site-packages/pip/_internal/commands/inspect.py +0 -92
  42. venv/Lib/site-packages/pip/_internal/commands/install.py +0 -798
  43. venv/Lib/site-packages/pip/_internal/commands/list.py +0 -400
  44. venv/Lib/site-packages/pip/_internal/commands/lock.py +0 -170
  45. venv/Lib/site-packages/pip/_internal/commands/search.py +0 -178
  46. venv/Lib/site-packages/pip/_internal/commands/show.py +0 -231
  47. venv/Lib/site-packages/pip/_internal/commands/uninstall.py +0 -113
  48. venv/Lib/site-packages/pip/_internal/commands/wheel.py +0 -181
  49. venv/Lib/site-packages/pip/_internal/configuration.py +0 -397
  50. venv/Lib/site-packages/pip/_internal/distributions/__init__.py +0 -21
  51. venv/Lib/site-packages/pip/_internal/distributions/base.py +0 -55
  52. venv/Lib/site-packages/pip/_internal/distributions/installed.py +0 -33
  53. venv/Lib/site-packages/pip/_internal/distributions/sdist.py +0 -165
  54. venv/Lib/site-packages/pip/_internal/distributions/wheel.py +0 -44
  55. venv/Lib/site-packages/pip/_internal/exceptions.py +0 -881
  56. venv/Lib/site-packages/pip/_internal/index/__init__.py +0 -1
  57. venv/Lib/site-packages/pip/_internal/index/collector.py +0 -489
  58. venv/Lib/site-packages/pip/_internal/index/package_finder.py +0 -1059
  59. venv/Lib/site-packages/pip/_internal/index/sources.py +0 -287
  60. venv/Lib/site-packages/pip/_internal/locations/__init__.py +0 -441
  61. venv/Lib/site-packages/pip/_internal/locations/_distutils.py +0 -173
  62. venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +0 -215
  63. venv/Lib/site-packages/pip/_internal/locations/base.py +0 -82
  64. venv/Lib/site-packages/pip/_internal/main.py +0 -12
  65. venv/Lib/site-packages/pip/_internal/metadata/__init__.py +0 -164
  66. venv/Lib/site-packages/pip/_internal/metadata/_json.py +0 -87
  67. venv/Lib/site-packages/pip/_internal/metadata/base.py +0 -685
  68. venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +0 -6
  69. venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +0 -87
  70. venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +0 -223
  71. venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +0 -143
  72. venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +0 -298
  73. venv/Lib/site-packages/pip/_internal/models/__init__.py +0 -1
  74. venv/Lib/site-packages/pip/_internal/models/candidate.py +0 -25
  75. venv/Lib/site-packages/pip/_internal/models/direct_url.py +0 -227
  76. venv/Lib/site-packages/pip/_internal/models/format_control.py +0 -78
  77. venv/Lib/site-packages/pip/_internal/models/index.py +0 -28
  78. venv/Lib/site-packages/pip/_internal/models/installation_report.py +0 -57
  79. venv/Lib/site-packages/pip/_internal/models/link.py +0 -613
  80. venv/Lib/site-packages/pip/_internal/models/pylock.py +0 -188
  81. venv/Lib/site-packages/pip/_internal/models/scheme.py +0 -25
  82. venv/Lib/site-packages/pip/_internal/models/search_scope.py +0 -126
  83. venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +0 -53
  84. venv/Lib/site-packages/pip/_internal/models/target_python.py +0 -122
  85. venv/Lib/site-packages/pip/_internal/models/wheel.py +0 -141
  86. venv/Lib/site-packages/pip/_internal/network/__init__.py +0 -1
  87. venv/Lib/site-packages/pip/_internal/network/auth.py +0 -564
  88. venv/Lib/site-packages/pip/_internal/network/cache.py +0 -133
  89. venv/Lib/site-packages/pip/_internal/network/download.py +0 -342
  90. venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +0 -213
  91. venv/Lib/site-packages/pip/_internal/network/session.py +0 -528
  92. venv/Lib/site-packages/pip/_internal/network/utils.py +0 -98
  93. venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +0 -61
  94. venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
  95. venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
  96. venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +0 -140
  97. venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +0 -38
  98. venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +0 -41
  99. venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +0 -73
  100. venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +0 -38
  101. venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +0 -47
  102. venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +0 -119
  103. venv/Lib/site-packages/pip/_internal/operations/check.py +0 -175
  104. venv/Lib/site-packages/pip/_internal/operations/freeze.py +0 -259
  105. venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +0 -1
  106. venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +0 -48
  107. venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +0 -746
  108. venv/Lib/site-packages/pip/_internal/operations/prepare.py +0 -742
  109. venv/Lib/site-packages/pip/_internal/pyproject.py +0 -182
  110. venv/Lib/site-packages/pip/_internal/req/__init__.py +0 -105
  111. venv/Lib/site-packages/pip/_internal/req/constructors.py +0 -562
  112. venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +0 -75
  113. venv/Lib/site-packages/pip/_internal/req/req_file.py +0 -620
  114. venv/Lib/site-packages/pip/_internal/req/req_install.py +0 -937
  115. venv/Lib/site-packages/pip/_internal/req/req_set.py +0 -81
  116. venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +0 -639
  117. venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
  118. venv/Lib/site-packages/pip/_internal/resolution/base.py +0 -20
  119. venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
  120. venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +0 -598
  121. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
  122. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +0 -142
  123. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +0 -582
  124. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +0 -814
  125. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +0 -166
  126. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +0 -276
  127. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +0 -85
  128. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +0 -247
  129. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +0 -336
  130. venv/Lib/site-packages/pip/_internal/self_outdated_check.py +0 -254
  131. venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
  132. venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +0 -109
  133. venv/Lib/site-packages/pip/_internal/utils/_log.py +0 -38
  134. venv/Lib/site-packages/pip/_internal/utils/appdirs.py +0 -52
  135. venv/Lib/site-packages/pip/_internal/utils/compat.py +0 -85
  136. venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +0 -201
  137. venv/Lib/site-packages/pip/_internal/utils/datetime.py +0 -10
  138. venv/Lib/site-packages/pip/_internal/utils/deprecation.py +0 -126
  139. venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +0 -87
  140. venv/Lib/site-packages/pip/_internal/utils/egg_link.py +0 -81
  141. venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +0 -88
  142. venv/Lib/site-packages/pip/_internal/utils/filesystem.py +0 -152
  143. venv/Lib/site-packages/pip/_internal/utils/filetypes.py +0 -24
  144. venv/Lib/site-packages/pip/_internal/utils/glibc.py +0 -102
  145. venv/Lib/site-packages/pip/_internal/utils/hashes.py +0 -150
  146. venv/Lib/site-packages/pip/_internal/utils/logging.py +0 -364
  147. venv/Lib/site-packages/pip/_internal/utils/misc.py +0 -765
  148. venv/Lib/site-packages/pip/_internal/utils/packaging.py +0 -44
  149. venv/Lib/site-packages/pip/_internal/utils/retry.py +0 -45
  150. venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +0 -149
  151. venv/Lib/site-packages/pip/_internal/utils/subprocess.py +0 -248
  152. venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +0 -294
  153. venv/Lib/site-packages/pip/_internal/utils/unpacking.py +0 -337
  154. venv/Lib/site-packages/pip/_internal/utils/urls.py +0 -55
  155. venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +0 -105
  156. venv/Lib/site-packages/pip/_internal/utils/wheel.py +0 -132
  157. venv/Lib/site-packages/pip/_internal/vcs/__init__.py +0 -15
  158. venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +0 -130
  159. venv/Lib/site-packages/pip/_internal/vcs/git.py +0 -571
  160. venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +0 -186
  161. venv/Lib/site-packages/pip/_internal/vcs/subversion.py +0 -335
  162. venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +0 -693
  163. venv/Lib/site-packages/pip/_internal/wheel_builder.py +0 -334
  164. venv/Lib/site-packages/pip/_vendor/__init__.py +0 -117
  165. venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +0 -29
  166. venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +0 -70
  167. venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +0 -168
  168. venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +0 -75
  169. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +0 -8
  170. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +0 -145
  171. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +0 -48
  172. venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +0 -511
  173. venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +0 -119
  174. venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +0 -157
  175. venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
  176. venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +0 -146
  177. venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +0 -43
  178. venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +0 -4
  179. venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +0 -12
  180. venv/Lib/site-packages/pip/_vendor/certifi/core.py +0 -83
  181. venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
  182. venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +0 -13
  183. venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +0 -65
  184. venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +0 -209
  185. venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +0 -59
  186. venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +0 -62
  187. venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +0 -9
  188. venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
  189. venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +0 -33
  190. venv/Lib/site-packages/pip/_vendor/distlib/compat.py +0 -1137
  191. venv/Lib/site-packages/pip/_vendor/distlib/resources.py +0 -358
  192. venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +0 -447
  193. venv/Lib/site-packages/pip/_vendor/distlib/util.py +0 -1984
  194. venv/Lib/site-packages/pip/_vendor/distro/__init__.py +0 -54
  195. venv/Lib/site-packages/pip/_vendor/distro/__main__.py +0 -4
  196. venv/Lib/site-packages/pip/_vendor/distro/distro.py +0 -1403
  197. venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
  198. venv/Lib/site-packages/pip/_vendor/idna/__init__.py +0 -45
  199. venv/Lib/site-packages/pip/_vendor/idna/codec.py +0 -122
  200. venv/Lib/site-packages/pip/_vendor/idna/compat.py +0 -15
  201. venv/Lib/site-packages/pip/_vendor/idna/core.py +0 -437
  202. venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +0 -4243
  203. venv/Lib/site-packages/pip/_vendor/idna/intranges.py +0 -57
  204. venv/Lib/site-packages/pip/_vendor/idna/package_data.py +0 -1
  205. venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
  206. venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +0 -8681
  207. venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +0 -55
  208. venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +0 -48
  209. venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +0 -170
  210. venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +0 -929
  211. venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +0 -15
  212. venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +0 -109
  213. venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +0 -262
  214. venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +0 -85
  215. venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +0 -353
  216. venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +0 -61
  217. venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +0 -195
  218. venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +0 -145
  219. venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +0 -759
  220. venv/Lib/site-packages/pip/_vendor/packaging/markers.py +0 -362
  221. venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +0 -862
  222. venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
  223. venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +0 -91
  224. venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +0 -1019
  225. venv/Lib/site-packages/pip/_vendor/packaging/tags.py +0 -656
  226. venv/Lib/site-packages/pip/_vendor/packaging/utils.py +0 -163
  227. venv/Lib/site-packages/pip/_vendor/packaging/version.py +0 -582
  228. venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +0 -3676
  229. venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +0 -631
  230. venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +0 -55
  231. venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +0 -249
  232. venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +0 -299
  233. venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +0 -144
  234. venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
  235. venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +0 -272
  236. venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +0 -21
  237. venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +0 -272
  238. venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +0 -82
  239. venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +0 -17
  240. venv/Lib/site-packages/pip/_vendor/pygments/console.py +0 -70
  241. venv/Lib/site-packages/pip/_vendor/pygments/filter.py +0 -70
  242. venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +0 -940
  243. venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +0 -129
  244. venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +0 -157
  245. venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +0 -23
  246. venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +0 -963
  247. venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +0 -362
  248. venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +0 -602
  249. venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +0 -1201
  250. venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +0 -43
  251. venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +0 -72
  252. venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +0 -91
  253. venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +0 -104
  254. venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +0 -247
  255. venv/Lib/site-packages/pip/_vendor/pygments/style.py +0 -203
  256. venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +0 -61
  257. venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +0 -54
  258. venv/Lib/site-packages/pip/_vendor/pygments/token.py +0 -214
  259. venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +0 -153
  260. venv/Lib/site-packages/pip/_vendor/pygments/util.py +0 -324
  261. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +0 -31
  262. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +0 -410
  263. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +0 -21
  264. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +0 -389
  265. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
  266. venv/Lib/site-packages/pip/_vendor/requests/__init__.py +0 -179
  267. venv/Lib/site-packages/pip/_vendor/requests/__version__.py +0 -14
  268. venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +0 -50
  269. venv/Lib/site-packages/pip/_vendor/requests/adapters.py +0 -719
  270. venv/Lib/site-packages/pip/_vendor/requests/api.py +0 -157
  271. venv/Lib/site-packages/pip/_vendor/requests/auth.py +0 -314
  272. venv/Lib/site-packages/pip/_vendor/requests/certs.py +0 -17
  273. venv/Lib/site-packages/pip/_vendor/requests/compat.py +0 -90
  274. venv/Lib/site-packages/pip/_vendor/requests/cookies.py +0 -561
  275. venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +0 -151
  276. venv/Lib/site-packages/pip/_vendor/requests/help.py +0 -127
  277. venv/Lib/site-packages/pip/_vendor/requests/hooks.py +0 -33
  278. venv/Lib/site-packages/pip/_vendor/requests/models.py +0 -1039
  279. venv/Lib/site-packages/pip/_vendor/requests/packages.py +0 -25
  280. venv/Lib/site-packages/pip/_vendor/requests/sessions.py +0 -831
  281. venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +0 -128
  282. venv/Lib/site-packages/pip/_vendor/requests/structures.py +0 -99
  283. venv/Lib/site-packages/pip/_vendor/requests/utils.py +0 -1086
  284. venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +0 -27
  285. venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +0 -196
  286. venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
  287. venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +0 -55
  288. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +0 -27
  289. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +0 -47
  290. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +0 -48
  291. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +0 -57
  292. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +0 -622
  293. venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +0 -209
  294. venv/Lib/site-packages/pip/_vendor/rich/__init__.py +0 -177
  295. venv/Lib/site-packages/pip/_vendor/rich/__main__.py +0 -245
  296. venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +0 -454
  297. venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +0 -3610
  298. venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +0 -32
  299. venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +0 -76
  300. venv/Lib/site-packages/pip/_vendor/rich/_extension.py +0 -10
  301. venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +0 -24
  302. venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +0 -268
  303. venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +0 -94
  304. venv/Lib/site-packages/pip/_vendor/rich/_loop.py +0 -43
  305. venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +0 -69
  306. venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +0 -309
  307. venv/Lib/site-packages/pip/_vendor/rich/_pick.py +0 -17
  308. venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +0 -153
  309. venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +0 -482
  310. venv/Lib/site-packages/pip/_vendor/rich/_stack.py +0 -16
  311. venv/Lib/site-packages/pip/_vendor/rich/_timer.py +0 -19
  312. venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +0 -661
  313. venv/Lib/site-packages/pip/_vendor/rich/_windows.py +0 -71
  314. venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +0 -56
  315. venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +0 -93
  316. venv/Lib/site-packages/pip/_vendor/rich/abc.py +0 -33
  317. venv/Lib/site-packages/pip/_vendor/rich/align.py +0 -306
  318. venv/Lib/site-packages/pip/_vendor/rich/ansi.py +0 -241
  319. venv/Lib/site-packages/pip/_vendor/rich/bar.py +0 -93
  320. venv/Lib/site-packages/pip/_vendor/rich/box.py +0 -474
  321. venv/Lib/site-packages/pip/_vendor/rich/cells.py +0 -174
  322. venv/Lib/site-packages/pip/_vendor/rich/color.py +0 -621
  323. venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +0 -38
  324. venv/Lib/site-packages/pip/_vendor/rich/columns.py +0 -187
  325. venv/Lib/site-packages/pip/_vendor/rich/console.py +0 -2680
  326. venv/Lib/site-packages/pip/_vendor/rich/constrain.py +0 -37
  327. venv/Lib/site-packages/pip/_vendor/rich/containers.py +0 -167
  328. venv/Lib/site-packages/pip/_vendor/rich/control.py +0 -219
  329. venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +0 -193
  330. venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +0 -39
  331. venv/Lib/site-packages/pip/_vendor/rich/emoji.py +0 -91
  332. venv/Lib/site-packages/pip/_vendor/rich/errors.py +0 -34
  333. venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +0 -57
  334. venv/Lib/site-packages/pip/_vendor/rich/filesize.py +0 -88
  335. venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +0 -232
  336. venv/Lib/site-packages/pip/_vendor/rich/json.py +0 -139
  337. venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +0 -101
  338. venv/Lib/site-packages/pip/_vendor/rich/layout.py +0 -442
  339. venv/Lib/site-packages/pip/_vendor/rich/live.py +0 -400
  340. venv/Lib/site-packages/pip/_vendor/rich/live_render.py +0 -106
  341. venv/Lib/site-packages/pip/_vendor/rich/logging.py +0 -297
  342. venv/Lib/site-packages/pip/_vendor/rich/markup.py +0 -251
  343. venv/Lib/site-packages/pip/_vendor/rich/measure.py +0 -151
  344. venv/Lib/site-packages/pip/_vendor/rich/padding.py +0 -141
  345. venv/Lib/site-packages/pip/_vendor/rich/pager.py +0 -34
  346. venv/Lib/site-packages/pip/_vendor/rich/palette.py +0 -100
  347. venv/Lib/site-packages/pip/_vendor/rich/panel.py +0 -317
  348. venv/Lib/site-packages/pip/_vendor/rich/pretty.py +0 -1016
  349. venv/Lib/site-packages/pip/_vendor/rich/progress.py +0 -1715
  350. venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +0 -223
  351. venv/Lib/site-packages/pip/_vendor/rich/prompt.py +0 -400
  352. venv/Lib/site-packages/pip/_vendor/rich/protocol.py +0 -42
  353. venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
  354. venv/Lib/site-packages/pip/_vendor/rich/region.py +0 -10
  355. venv/Lib/site-packages/pip/_vendor/rich/repr.py +0 -149
  356. venv/Lib/site-packages/pip/_vendor/rich/rule.py +0 -130
  357. venv/Lib/site-packages/pip/_vendor/rich/scope.py +0 -86
  358. venv/Lib/site-packages/pip/_vendor/rich/screen.py +0 -54
  359. venv/Lib/site-packages/pip/_vendor/rich/segment.py +0 -752
  360. venv/Lib/site-packages/pip/_vendor/rich/spinner.py +0 -132
  361. venv/Lib/site-packages/pip/_vendor/rich/status.py +0 -131
  362. venv/Lib/site-packages/pip/_vendor/rich/style.py +0 -796
  363. venv/Lib/site-packages/pip/_vendor/rich/styled.py +0 -42
  364. venv/Lib/site-packages/pip/_vendor/rich/syntax.py +0 -985
  365. venv/Lib/site-packages/pip/_vendor/rich/table.py +0 -1006
  366. venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +0 -153
  367. venv/Lib/site-packages/pip/_vendor/rich/text.py +0 -1361
  368. venv/Lib/site-packages/pip/_vendor/rich/theme.py +0 -115
  369. venv/Lib/site-packages/pip/_vendor/rich/themes.py +0 -5
  370. venv/Lib/site-packages/pip/_vendor/rich/traceback.py +0 -899
  371. venv/Lib/site-packages/pip/_vendor/rich/tree.py +0 -257
  372. venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +0 -8
  373. venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +0 -770
  374. venv/Lib/site-packages/pip/_vendor/tomli/_re.py +0 -112
  375. venv/Lib/site-packages/pip/_vendor/tomli/_types.py +0 -10
  376. venv/Lib/site-packages/pip/_vendor/tomli/py.typed +0 -1
  377. venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +0 -4
  378. venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +0 -229
  379. venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +0 -1
  380. venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +0 -36
  381. venv/Lib/site-packages/pip/_vendor/truststore/_api.py +0 -333
  382. venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +0 -571
  383. venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +0 -66
  384. venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +0 -31
  385. venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +0 -567
  386. venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
  387. venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +0 -102
  388. venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +0 -355
  389. venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +0 -2
  390. venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +0 -572
  391. venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +0 -1140
  392. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  393. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +0 -36
  394. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  395. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +0 -519
  396. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +0 -397
  397. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +0 -314
  398. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +0 -130
  399. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +0 -518
  400. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +0 -920
  401. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +0 -216
  402. venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +0 -323
  403. venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +0 -274
  404. venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +0 -98
  405. venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
  406. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  407. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +0 -51
  408. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +0 -155
  409. venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +0 -1076
  410. venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +0 -540
  411. venv/Lib/site-packages/pip/_vendor/urllib3/request.py +0 -191
  412. venv/Lib/site-packages/pip/_vendor/urllib3/response.py +0 -879
  413. venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +0 -49
  414. venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +0 -149
  415. venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +0 -57
  416. venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +0 -22
  417. venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +0 -137
  418. venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +0 -107
  419. venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +0 -622
  420. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +0 -504
  421. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +0 -159
  422. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +0 -221
  423. venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +0 -271
  424. venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +0 -435
  425. venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +0 -152
  426. venv/Lib/site-packages/pip/py.typed +0 -4
  427. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.1.dist-info}/WHEEL +0 -0
@@ -1,620 +0,0 @@
1
- """
2
- Requirements file parsing
3
- """
4
-
5
- from __future__ import annotations
6
-
7
- import codecs
8
- import locale
9
- import logging
10
- import optparse
11
- import os
12
- import re
13
- import shlex
14
- import sys
15
- import urllib.parse
16
- from collections.abc import Generator, Iterable
17
- from dataclasses import dataclass
18
- from optparse import Values
19
- from typing import (
20
- TYPE_CHECKING,
21
- Any,
22
- Callable,
23
- NoReturn,
24
- )
25
-
26
- from pip._internal.cli import cmdoptions
27
- from pip._internal.exceptions import InstallationError, RequirementsFileParseError
28
- from pip._internal.models.search_scope import SearchScope
29
-
30
- if TYPE_CHECKING:
31
- from pip._internal.index.package_finder import PackageFinder
32
- from pip._internal.network.session import PipSession
33
-
34
- __all__ = ["parse_requirements"]
35
-
36
- ReqFileLines = Iterable[tuple[int, str]]
37
-
38
- LineParser = Callable[[str], tuple[str, Values]]
39
-
40
- SCHEME_RE = re.compile(r"^(http|https|file):", re.I)
41
- COMMENT_RE = re.compile(r"(^|\s+)#.*$")
42
-
43
- # Matches environment variable-style values in '${MY_VARIABLE_1}' with the
44
- # variable name consisting of only uppercase letters, digits or the '_'
45
- # (underscore). This follows the POSIX standard defined in IEEE Std 1003.1,
46
- # 2013 Edition.
47
- ENV_VAR_RE = re.compile(r"(?P<var>\$\{(?P<name>[A-Z0-9_]+)\})")
48
-
49
- SUPPORTED_OPTIONS: list[Callable[..., optparse.Option]] = [
50
- cmdoptions.index_url,
51
- cmdoptions.extra_index_url,
52
- cmdoptions.no_index,
53
- cmdoptions.constraints,
54
- cmdoptions.requirements,
55
- cmdoptions.editable,
56
- cmdoptions.find_links,
57
- cmdoptions.no_binary,
58
- cmdoptions.only_binary,
59
- cmdoptions.prefer_binary,
60
- cmdoptions.require_hashes,
61
- cmdoptions.pre,
62
- cmdoptions.trusted_host,
63
- cmdoptions.use_new_feature,
64
- ]
65
-
66
- # options to be passed to requirements
67
- SUPPORTED_OPTIONS_REQ: list[Callable[..., optparse.Option]] = [
68
- cmdoptions.global_options,
69
- cmdoptions.hash,
70
- cmdoptions.config_settings,
71
- ]
72
-
73
- SUPPORTED_OPTIONS_EDITABLE_REQ: list[Callable[..., optparse.Option]] = [
74
- cmdoptions.config_settings,
75
- ]
76
-
77
-
78
- # the 'dest' string values
79
- SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ]
80
- SUPPORTED_OPTIONS_EDITABLE_REQ_DEST = [
81
- str(o().dest) for o in SUPPORTED_OPTIONS_EDITABLE_REQ
82
- ]
83
-
84
- # order of BOMS is important: codecs.BOM_UTF16_LE is a prefix of codecs.BOM_UTF32_LE
85
- # so data.startswith(BOM_UTF16_LE) would be true for UTF32_LE data
86
- BOMS: list[tuple[bytes, str]] = [
87
- (codecs.BOM_UTF8, "utf-8"),
88
- (codecs.BOM_UTF32, "utf-32"),
89
- (codecs.BOM_UTF32_BE, "utf-32-be"),
90
- (codecs.BOM_UTF32_LE, "utf-32-le"),
91
- (codecs.BOM_UTF16, "utf-16"),
92
- (codecs.BOM_UTF16_BE, "utf-16-be"),
93
- (codecs.BOM_UTF16_LE, "utf-16-le"),
94
- ]
95
-
96
- PEP263_ENCODING_RE = re.compile(rb"coding[:=]\s*([-\w.]+)")
97
- DEFAULT_ENCODING = "utf-8"
98
-
99
- logger = logging.getLogger(__name__)
100
-
101
-
102
- @dataclass(frozen=True)
103
- class ParsedRequirement:
104
- # TODO: replace this with slots=True when dropping Python 3.9 support.
105
- __slots__ = (
106
- "requirement",
107
- "is_editable",
108
- "comes_from",
109
- "constraint",
110
- "options",
111
- "line_source",
112
- )
113
-
114
- requirement: str
115
- is_editable: bool
116
- comes_from: str
117
- constraint: bool
118
- options: dict[str, Any] | None
119
- line_source: str | None
120
-
121
-
122
- @dataclass(frozen=True)
123
- class ParsedLine:
124
- __slots__ = ("filename", "lineno", "args", "opts", "constraint")
125
-
126
- filename: str
127
- lineno: int
128
- args: str
129
- opts: Values
130
- constraint: bool
131
-
132
- @property
133
- def is_editable(self) -> bool:
134
- return bool(self.opts.editables)
135
-
136
- @property
137
- def requirement(self) -> str | None:
138
- if self.args:
139
- return self.args
140
- elif self.is_editable:
141
- # We don't support multiple -e on one line
142
- return self.opts.editables[0]
143
- return None
144
-
145
-
146
- def parse_requirements(
147
- filename: str,
148
- session: PipSession,
149
- finder: PackageFinder | None = None,
150
- options: optparse.Values | None = None,
151
- constraint: bool = False,
152
- ) -> Generator[ParsedRequirement, None, None]:
153
- """Parse a requirements file and yield ParsedRequirement instances.
154
-
155
- :param filename: Path or url of requirements file.
156
- :param session: PipSession instance.
157
- :param finder: Instance of pip.index.PackageFinder.
158
- :param options: cli options.
159
- :param constraint: If true, parsing a constraint file rather than
160
- requirements file.
161
- """
162
- line_parser = get_line_parser(finder)
163
- parser = RequirementsFileParser(session, line_parser)
164
-
165
- for parsed_line in parser.parse(filename, constraint):
166
- parsed_req = handle_line(
167
- parsed_line, options=options, finder=finder, session=session
168
- )
169
- if parsed_req is not None:
170
- yield parsed_req
171
-
172
-
173
- def preprocess(content: str) -> ReqFileLines:
174
- """Split, filter, and join lines, and return a line iterator
175
-
176
- :param content: the content of the requirements file
177
- """
178
- lines_enum: ReqFileLines = enumerate(content.splitlines(), start=1)
179
- lines_enum = join_lines(lines_enum)
180
- lines_enum = ignore_comments(lines_enum)
181
- lines_enum = expand_env_variables(lines_enum)
182
- return lines_enum
183
-
184
-
185
- def handle_requirement_line(
186
- line: ParsedLine,
187
- options: optparse.Values | None = None,
188
- ) -> ParsedRequirement:
189
- # preserve for the nested code path
190
- line_comes_from = "{} {} (line {})".format(
191
- "-c" if line.constraint else "-r",
192
- line.filename,
193
- line.lineno,
194
- )
195
-
196
- assert line.requirement is not None
197
-
198
- # get the options that apply to requirements
199
- if line.is_editable:
200
- supported_dest = SUPPORTED_OPTIONS_EDITABLE_REQ_DEST
201
- else:
202
- supported_dest = SUPPORTED_OPTIONS_REQ_DEST
203
- req_options = {}
204
- for dest in supported_dest:
205
- if dest in line.opts.__dict__ and line.opts.__dict__[dest]:
206
- req_options[dest] = line.opts.__dict__[dest]
207
-
208
- line_source = f"line {line.lineno} of {line.filename}"
209
- return ParsedRequirement(
210
- requirement=line.requirement,
211
- is_editable=line.is_editable,
212
- comes_from=line_comes_from,
213
- constraint=line.constraint,
214
- options=req_options,
215
- line_source=line_source,
216
- )
217
-
218
-
219
- def handle_option_line(
220
- opts: Values,
221
- filename: str,
222
- lineno: int,
223
- finder: PackageFinder | None = None,
224
- options: optparse.Values | None = None,
225
- session: PipSession | None = None,
226
- ) -> None:
227
- if opts.hashes:
228
- logger.warning(
229
- "%s line %s has --hash but no requirement, and will be ignored.",
230
- filename,
231
- lineno,
232
- )
233
-
234
- if options:
235
- # percolate options upward
236
- if opts.require_hashes:
237
- options.require_hashes = opts.require_hashes
238
- if opts.features_enabled:
239
- options.features_enabled.extend(
240
- f for f in opts.features_enabled if f not in options.features_enabled
241
- )
242
-
243
- # set finder options
244
- if finder:
245
- find_links = finder.find_links
246
- index_urls = finder.index_urls
247
- no_index = finder.search_scope.no_index
248
- if opts.no_index is True:
249
- no_index = True
250
- index_urls = []
251
- if opts.index_url and not no_index:
252
- index_urls = [opts.index_url]
253
- if opts.extra_index_urls and not no_index:
254
- index_urls.extend(opts.extra_index_urls)
255
- if opts.find_links:
256
- # FIXME: it would be nice to keep track of the source
257
- # of the find_links: support a find-links local path
258
- # relative to a requirements file.
259
- value = opts.find_links[0]
260
- req_dir = os.path.dirname(os.path.abspath(filename))
261
- relative_to_reqs_file = os.path.join(req_dir, value)
262
- if os.path.exists(relative_to_reqs_file):
263
- value = relative_to_reqs_file
264
- find_links.append(value)
265
-
266
- if session:
267
- # We need to update the auth urls in session
268
- session.update_index_urls(index_urls)
269
-
270
- search_scope = SearchScope(
271
- find_links=find_links,
272
- index_urls=index_urls,
273
- no_index=no_index,
274
- )
275
- finder.search_scope = search_scope
276
-
277
- if opts.pre:
278
- finder.set_allow_all_prereleases()
279
-
280
- if opts.prefer_binary:
281
- finder.set_prefer_binary()
282
-
283
- if session:
284
- for host in opts.trusted_hosts or []:
285
- source = f"line {lineno} of {filename}"
286
- session.add_trusted_host(host, source=source)
287
-
288
-
289
- def handle_line(
290
- line: ParsedLine,
291
- options: optparse.Values | None = None,
292
- finder: PackageFinder | None = None,
293
- session: PipSession | None = None,
294
- ) -> ParsedRequirement | None:
295
- """Handle a single parsed requirements line; This can result in
296
- creating/yielding requirements, or updating the finder.
297
-
298
- :param line: The parsed line to be processed.
299
- :param options: CLI options.
300
- :param finder: The finder - updated by non-requirement lines.
301
- :param session: The session - updated by non-requirement lines.
302
-
303
- Returns a ParsedRequirement object if the line is a requirement line,
304
- otherwise returns None.
305
-
306
- For lines that contain requirements, the only options that have an effect
307
- are from SUPPORTED_OPTIONS_REQ, and they are scoped to the
308
- requirement. Other options from SUPPORTED_OPTIONS may be present, but are
309
- ignored.
310
-
311
- For lines that do not contain requirements, the only options that have an
312
- effect are from SUPPORTED_OPTIONS. Options from SUPPORTED_OPTIONS_REQ may
313
- be present, but are ignored. These lines may contain multiple options
314
- (although our docs imply only one is supported), and all our parsed and
315
- affect the finder.
316
- """
317
-
318
- if line.requirement is not None:
319
- parsed_req = handle_requirement_line(line, options)
320
- return parsed_req
321
- else:
322
- handle_option_line(
323
- line.opts,
324
- line.filename,
325
- line.lineno,
326
- finder,
327
- options,
328
- session,
329
- )
330
- return None
331
-
332
-
333
- class RequirementsFileParser:
334
- def __init__(
335
- self,
336
- session: PipSession,
337
- line_parser: LineParser,
338
- ) -> None:
339
- self._session = session
340
- self._line_parser = line_parser
341
-
342
- def parse(
343
- self, filename: str, constraint: bool
344
- ) -> Generator[ParsedLine, None, None]:
345
- """Parse a given file, yielding parsed lines."""
346
- yield from self._parse_and_recurse(
347
- filename, constraint, [{os.path.abspath(filename): None}]
348
- )
349
-
350
- def _parse_and_recurse(
351
- self,
352
- filename: str,
353
- constraint: bool,
354
- parsed_files_stack: list[dict[str, str | None]],
355
- ) -> Generator[ParsedLine, None, None]:
356
- for line in self._parse_file(filename, constraint):
357
- if line.requirement is None and (
358
- line.opts.requirements or line.opts.constraints
359
- ):
360
- # parse a nested requirements file
361
- if line.opts.requirements:
362
- req_path = line.opts.requirements[0]
363
- nested_constraint = False
364
- else:
365
- req_path = line.opts.constraints[0]
366
- nested_constraint = True
367
-
368
- # original file is over http
369
- if SCHEME_RE.search(filename):
370
- # do a url join so relative paths work
371
- req_path = urllib.parse.urljoin(filename, req_path)
372
- # original file and nested file are paths
373
- elif not SCHEME_RE.search(req_path):
374
- # do a join so relative paths work
375
- # and then abspath so that we can identify recursive references
376
- req_path = os.path.abspath(
377
- os.path.join(
378
- os.path.dirname(filename),
379
- req_path,
380
- )
381
- )
382
- parsed_files = parsed_files_stack[0]
383
- if req_path in parsed_files:
384
- initial_file = parsed_files[req_path]
385
- tail = (
386
- f" and again in {initial_file}"
387
- if initial_file is not None
388
- else ""
389
- )
390
- raise RequirementsFileParseError(
391
- f"{req_path} recursively references itself in {filename}{tail}"
392
- )
393
- # Keeping a track where was each file first included in
394
- new_parsed_files = parsed_files.copy()
395
- new_parsed_files[req_path] = filename
396
- yield from self._parse_and_recurse(
397
- req_path, nested_constraint, [new_parsed_files, *parsed_files_stack]
398
- )
399
- else:
400
- yield line
401
-
402
- def _parse_file(
403
- self, filename: str, constraint: bool
404
- ) -> Generator[ParsedLine, None, None]:
405
- _, content = get_file_content(filename, self._session)
406
-
407
- lines_enum = preprocess(content)
408
-
409
- for line_number, line in lines_enum:
410
- try:
411
- args_str, opts = self._line_parser(line)
412
- except OptionParsingError as e:
413
- # add offending line
414
- msg = f"Invalid requirement: {line}\n{e.msg}"
415
- raise RequirementsFileParseError(msg)
416
-
417
- yield ParsedLine(
418
- filename,
419
- line_number,
420
- args_str,
421
- opts,
422
- constraint,
423
- )
424
-
425
-
426
- def get_line_parser(finder: PackageFinder | None) -> LineParser:
427
- def parse_line(line: str) -> tuple[str, Values]:
428
- # Build new parser for each line since it accumulates appendable
429
- # options.
430
- parser = build_parser()
431
- defaults = parser.get_default_values()
432
- defaults.index_url = None
433
- if finder:
434
- defaults.format_control = finder.format_control
435
-
436
- args_str, options_str = break_args_options(line)
437
-
438
- try:
439
- options = shlex.split(options_str)
440
- except ValueError as e:
441
- raise OptionParsingError(f"Could not split options: {options_str}") from e
442
-
443
- opts, _ = parser.parse_args(options, defaults)
444
-
445
- return args_str, opts
446
-
447
- return parse_line
448
-
449
-
450
- def break_args_options(line: str) -> tuple[str, str]:
451
- """Break up the line into an args and options string. We only want to shlex
452
- (and then optparse) the options, not the args. args can contain markers
453
- which are corrupted by shlex.
454
- """
455
- tokens = line.split(" ")
456
- args = []
457
- options = tokens[:]
458
- for token in tokens:
459
- if token.startswith(("-", "--")):
460
- break
461
- else:
462
- args.append(token)
463
- options.pop(0)
464
- return " ".join(args), " ".join(options)
465
-
466
-
467
- class OptionParsingError(Exception):
468
- def __init__(self, msg: str) -> None:
469
- self.msg = msg
470
-
471
-
472
- def build_parser() -> optparse.OptionParser:
473
- """
474
- Return a parser for parsing requirement lines
475
- """
476
- parser = optparse.OptionParser(add_help_option=False)
477
-
478
- option_factories = SUPPORTED_OPTIONS + SUPPORTED_OPTIONS_REQ
479
- for option_factory in option_factories:
480
- option = option_factory()
481
- parser.add_option(option)
482
-
483
- # By default optparse sys.exits on parsing errors. We want to wrap
484
- # that in our own exception.
485
- def parser_exit(self: Any, msg: str) -> NoReturn:
486
- raise OptionParsingError(msg)
487
-
488
- # NOTE: mypy disallows assigning to a method
489
- # https://github.com/python/mypy/issues/2427
490
- parser.exit = parser_exit # type: ignore
491
-
492
- return parser
493
-
494
-
495
- def join_lines(lines_enum: ReqFileLines) -> ReqFileLines:
496
- """Joins a line ending in '\' with the previous line (except when following
497
- comments). The joined line takes on the index of the first line.
498
- """
499
- primary_line_number = None
500
- new_line: list[str] = []
501
- for line_number, line in lines_enum:
502
- if not line.endswith("\\") or COMMENT_RE.match(line):
503
- if COMMENT_RE.match(line):
504
- # this ensures comments are always matched later
505
- line = " " + line
506
- if new_line:
507
- new_line.append(line)
508
- assert primary_line_number is not None
509
- yield primary_line_number, "".join(new_line)
510
- new_line = []
511
- else:
512
- yield line_number, line
513
- else:
514
- if not new_line:
515
- primary_line_number = line_number
516
- new_line.append(line.strip("\\"))
517
-
518
- # last line contains \
519
- if new_line:
520
- assert primary_line_number is not None
521
- yield primary_line_number, "".join(new_line)
522
-
523
- # TODO: handle space after '\'.
524
-
525
-
526
- def ignore_comments(lines_enum: ReqFileLines) -> ReqFileLines:
527
- """
528
- Strips comments and filter empty lines.
529
- """
530
- for line_number, line in lines_enum:
531
- line = COMMENT_RE.sub("", line)
532
- line = line.strip()
533
- if line:
534
- yield line_number, line
535
-
536
-
537
- def expand_env_variables(lines_enum: ReqFileLines) -> ReqFileLines:
538
- """Replace all environment variables that can be retrieved via `os.getenv`.
539
-
540
- The only allowed format for environment variables defined in the
541
- requirement file is `${MY_VARIABLE_1}` to ensure two things:
542
-
543
- 1. Strings that contain a `$` aren't accidentally (partially) expanded.
544
- 2. Ensure consistency across platforms for requirement files.
545
-
546
- These points are the result of a discussion on the `github pull
547
- request #3514 <https://github.com/pypa/pip/pull/3514>`_.
548
-
549
- Valid characters in variable names follow the `POSIX standard
550
- <http://pubs.opengroup.org/onlinepubs/9699919799/>`_ and are limited
551
- to uppercase letter, digits and the `_` (underscore).
552
- """
553
- for line_number, line in lines_enum:
554
- for env_var, var_name in ENV_VAR_RE.findall(line):
555
- value = os.getenv(var_name)
556
- if not value:
557
- continue
558
-
559
- line = line.replace(env_var, value)
560
-
561
- yield line_number, line
562
-
563
-
564
- def get_file_content(url: str, session: PipSession) -> tuple[str, str]:
565
- """Gets the content of a file; it may be a filename, file: URL, or
566
- http: URL. Returns (location, content). Content is unicode.
567
- Respects # -*- coding: declarations on the retrieved files.
568
-
569
- :param url: File path or url.
570
- :param session: PipSession instance.
571
- """
572
- scheme = urllib.parse.urlsplit(url).scheme
573
- # Pip has special support for file:// URLs (LocalFSAdapter).
574
- if scheme in ["http", "https", "file"]:
575
- # Delay importing heavy network modules until absolutely necessary.
576
- from pip._internal.network.utils import raise_for_status
577
-
578
- resp = session.get(url)
579
- raise_for_status(resp)
580
- return resp.url, resp.text
581
-
582
- # Assume this is a bare path.
583
- try:
584
- with open(url, "rb") as f:
585
- raw_content = f.read()
586
- except OSError as exc:
587
- raise InstallationError(f"Could not open requirements file: {exc}")
588
-
589
- content = _decode_req_file(raw_content, url)
590
-
591
- return url, content
592
-
593
-
594
- def _decode_req_file(data: bytes, url: str) -> str:
595
- for bom, encoding in BOMS:
596
- if data.startswith(bom):
597
- return data[len(bom) :].decode(encoding)
598
-
599
- for line in data.split(b"\n")[:2]:
600
- if line[0:1] == b"#":
601
- result = PEP263_ENCODING_RE.search(line)
602
- if result is not None:
603
- encoding = result.groups()[0].decode("ascii")
604
- return data.decode(encoding)
605
-
606
- try:
607
- return data.decode(DEFAULT_ENCODING)
608
- except UnicodeDecodeError:
609
- locale_encoding = locale.getpreferredencoding(False) or sys.getdefaultencoding()
610
- logging.warning(
611
- "unable to decode data from %s with default encoding %s, "
612
- "falling back to encoding from locale: %s. "
613
- "If this is intentional you should specify the encoding with a "
614
- "PEP-263 style comment, e.g. '# -*- coding: %s -*-'",
615
- url,
616
- DEFAULT_ENCODING,
617
- locale_encoding,
618
- locale_encoding,
619
- )
620
- return data.decode(locale_encoding)