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,564 +0,0 @@
1
- """Network Authentication Helpers
2
-
3
- Contains interface (MultiDomainBasicAuth) and associated glue code for
4
- providing credentials in the context of network requests.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- import logging
10
- import os
11
- import shutil
12
- import subprocess
13
- import sysconfig
14
- import typing
15
- import urllib.parse
16
- from abc import ABC, abstractmethod
17
- from functools import cache
18
- from os.path import commonprefix
19
- from pathlib import Path
20
- from typing import Any, NamedTuple
21
-
22
- from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth
23
- from pip._vendor.requests.models import Request, Response
24
- from pip._vendor.requests.utils import get_netrc_auth
25
-
26
- from pip._internal.utils.logging import getLogger
27
- from pip._internal.utils.misc import (
28
- ask,
29
- ask_input,
30
- ask_password,
31
- remove_auth_from_url,
32
- split_auth_netloc_from_url,
33
- )
34
- from pip._internal.vcs.versioncontrol import AuthInfo
35
-
36
- logger = getLogger(__name__)
37
-
38
- KEYRING_DISABLED = False
39
-
40
-
41
- class Credentials(NamedTuple):
42
- url: str
43
- username: str
44
- password: str
45
-
46
-
47
- class KeyRingBaseProvider(ABC):
48
- """Keyring base provider interface"""
49
-
50
- has_keyring: bool
51
-
52
- @abstractmethod
53
- def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None: ...
54
-
55
- @abstractmethod
56
- def save_auth_info(self, url: str, username: str, password: str) -> None: ...
57
-
58
-
59
- class KeyRingNullProvider(KeyRingBaseProvider):
60
- """Keyring null provider"""
61
-
62
- has_keyring = False
63
-
64
- def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None:
65
- return None
66
-
67
- def save_auth_info(self, url: str, username: str, password: str) -> None:
68
- return None
69
-
70
-
71
- class KeyRingPythonProvider(KeyRingBaseProvider):
72
- """Keyring interface which uses locally imported `keyring`"""
73
-
74
- has_keyring = True
75
-
76
- def __init__(self) -> None:
77
- import keyring
78
-
79
- self.keyring = keyring
80
-
81
- def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None:
82
- # Support keyring's get_credential interface which supports getting
83
- # credentials without a username. This is only available for
84
- # keyring>=15.2.0.
85
- if hasattr(self.keyring, "get_credential"):
86
- logger.debug("Getting credentials from keyring for %s", url)
87
- cred = self.keyring.get_credential(url, username)
88
- if cred is not None:
89
- return cred.username, cred.password
90
- return None
91
-
92
- if username is not None:
93
- logger.debug("Getting password from keyring for %s", url)
94
- password = self.keyring.get_password(url, username)
95
- if password:
96
- return username, password
97
- return None
98
-
99
- def save_auth_info(self, url: str, username: str, password: str) -> None:
100
- self.keyring.set_password(url, username, password)
101
-
102
-
103
- class KeyRingCliProvider(KeyRingBaseProvider):
104
- """Provider which uses `keyring` cli
105
-
106
- Instead of calling the keyring package installed alongside pip
107
- we call keyring on the command line which will enable pip to
108
- use which ever installation of keyring is available first in
109
- PATH.
110
- """
111
-
112
- has_keyring = True
113
-
114
- def __init__(self, cmd: str) -> None:
115
- self.keyring = cmd
116
-
117
- def get_auth_info(self, url: str, username: str | None) -> AuthInfo | None:
118
- # This is the default implementation of keyring.get_credential
119
- # https://github.com/jaraco/keyring/blob/97689324abcf01bd1793d49063e7ca01e03d7d07/keyring/backend.py#L134-L139
120
- if username is not None:
121
- password = self._get_password(url, username)
122
- if password is not None:
123
- return username, password
124
- return None
125
-
126
- def save_auth_info(self, url: str, username: str, password: str) -> None:
127
- return self._set_password(url, username, password)
128
-
129
- def _get_password(self, service_name: str, username: str) -> str | None:
130
- """Mirror the implementation of keyring.get_password using cli"""
131
- if self.keyring is None:
132
- return None
133
-
134
- cmd = [self.keyring, "get", service_name, username]
135
- env = os.environ.copy()
136
- env["PYTHONIOENCODING"] = "utf-8"
137
- res = subprocess.run(
138
- cmd,
139
- stdin=subprocess.DEVNULL,
140
- stdout=subprocess.PIPE,
141
- env=env,
142
- )
143
- if res.returncode:
144
- return None
145
- return res.stdout.decode("utf-8").strip(os.linesep)
146
-
147
- def _set_password(self, service_name: str, username: str, password: str) -> None:
148
- """Mirror the implementation of keyring.set_password using cli"""
149
- if self.keyring is None:
150
- return None
151
- env = os.environ.copy()
152
- env["PYTHONIOENCODING"] = "utf-8"
153
- subprocess.run(
154
- [self.keyring, "set", service_name, username],
155
- input=f"{password}{os.linesep}".encode(),
156
- env=env,
157
- check=True,
158
- )
159
- return None
160
-
161
-
162
- @cache
163
- def get_keyring_provider(provider: str) -> KeyRingBaseProvider:
164
- logger.verbose("Keyring provider requested: %s", provider)
165
-
166
- # keyring has previously failed and been disabled
167
- if KEYRING_DISABLED:
168
- provider = "disabled"
169
- if provider in ["import", "auto"]:
170
- try:
171
- impl = KeyRingPythonProvider()
172
- logger.verbose("Keyring provider set: import")
173
- return impl
174
- except ImportError:
175
- pass
176
- except Exception as exc:
177
- # In the event of an unexpected exception
178
- # we should warn the user
179
- msg = "Installed copy of keyring fails with exception %s"
180
- if provider == "auto":
181
- msg = msg + ", trying to find a keyring executable as a fallback"
182
- logger.warning(msg, exc, exc_info=logger.isEnabledFor(logging.DEBUG))
183
- if provider in ["subprocess", "auto"]:
184
- cli = shutil.which("keyring")
185
- if cli and cli.startswith(sysconfig.get_path("scripts")):
186
- # all code within this function is stolen from shutil.which implementation
187
- @typing.no_type_check
188
- def PATH_as_shutil_which_determines_it() -> str:
189
- path = os.environ.get("PATH", None)
190
- if path is None:
191
- try:
192
- path = os.confstr("CS_PATH")
193
- except (AttributeError, ValueError):
194
- # os.confstr() or CS_PATH is not available
195
- path = os.defpath
196
- # bpo-35755: Don't use os.defpath if the PATH environment variable is
197
- # set to an empty string
198
-
199
- return path
200
-
201
- scripts = Path(sysconfig.get_path("scripts"))
202
-
203
- paths = []
204
- for path in PATH_as_shutil_which_determines_it().split(os.pathsep):
205
- p = Path(path)
206
- try:
207
- if not p.samefile(scripts):
208
- paths.append(path)
209
- except FileNotFoundError:
210
- pass
211
-
212
- path = os.pathsep.join(paths)
213
-
214
- cli = shutil.which("keyring", path=path)
215
-
216
- if cli:
217
- logger.verbose("Keyring provider set: subprocess with executable %s", cli)
218
- return KeyRingCliProvider(cli)
219
-
220
- logger.verbose("Keyring provider set: disabled")
221
- return KeyRingNullProvider()
222
-
223
-
224
- class MultiDomainBasicAuth(AuthBase):
225
- def __init__(
226
- self,
227
- prompting: bool = True,
228
- index_urls: list[str] | None = None,
229
- keyring_provider: str = "auto",
230
- ) -> None:
231
- self.prompting = prompting
232
- self.index_urls = index_urls
233
- self.keyring_provider = keyring_provider
234
- self.passwords: dict[str, AuthInfo] = {}
235
- # When the user is prompted to enter credentials and keyring is
236
- # available, we will offer to save them. If the user accepts,
237
- # this value is set to the credentials they entered. After the
238
- # request authenticates, the caller should call
239
- # ``save_credentials`` to save these.
240
- self._credentials_to_save: Credentials | None = None
241
-
242
- @property
243
- def keyring_provider(self) -> KeyRingBaseProvider:
244
- return get_keyring_provider(self._keyring_provider)
245
-
246
- @keyring_provider.setter
247
- def keyring_provider(self, provider: str) -> None:
248
- # The free function get_keyring_provider has been decorated with
249
- # functools.cache. If an exception occurs in get_keyring_auth that
250
- # cache will be cleared and keyring disabled, take that into account
251
- # if you want to remove this indirection.
252
- self._keyring_provider = provider
253
-
254
- @property
255
- def use_keyring(self) -> bool:
256
- # We won't use keyring when --no-input is passed unless
257
- # a specific provider is requested because it might require
258
- # user interaction
259
- return self.prompting or self._keyring_provider not in ["auto", "disabled"]
260
-
261
- def _get_keyring_auth(
262
- self,
263
- url: str | None,
264
- username: str | None,
265
- ) -> AuthInfo | None:
266
- """Return the tuple auth for a given url from keyring."""
267
- # Do nothing if no url was provided
268
- if not url:
269
- return None
270
-
271
- try:
272
- return self.keyring_provider.get_auth_info(url, username)
273
- except Exception as exc:
274
- # Log the full exception (with stacktrace) at debug, so it'll only
275
- # show up when running in verbose mode.
276
- logger.debug("Keyring is skipped due to an exception", exc_info=True)
277
- # Always log a shortened version of the exception.
278
- logger.warning(
279
- "Keyring is skipped due to an exception: %s",
280
- str(exc),
281
- )
282
- global KEYRING_DISABLED
283
- KEYRING_DISABLED = True
284
- get_keyring_provider.cache_clear()
285
- return None
286
-
287
- def _get_index_url(self, url: str) -> str | None:
288
- """Return the original index URL matching the requested URL.
289
-
290
- Cached or dynamically generated credentials may work against
291
- the original index URL rather than just the netloc.
292
-
293
- The provided url should have had its username and password
294
- removed already. If the original index url had credentials then
295
- they will be included in the return value.
296
-
297
- Returns None if no matching index was found, or if --no-index
298
- was specified by the user.
299
- """
300
- if not url or not self.index_urls:
301
- return None
302
-
303
- url = remove_auth_from_url(url).rstrip("/") + "/"
304
- parsed_url = urllib.parse.urlsplit(url)
305
-
306
- candidates = []
307
-
308
- for index in self.index_urls:
309
- index = index.rstrip("/") + "/"
310
- parsed_index = urllib.parse.urlsplit(remove_auth_from_url(index))
311
- if parsed_url == parsed_index:
312
- return index
313
-
314
- if parsed_url.netloc != parsed_index.netloc:
315
- continue
316
-
317
- candidate = urllib.parse.urlsplit(index)
318
- candidates.append(candidate)
319
-
320
- if not candidates:
321
- return None
322
-
323
- candidates.sort(
324
- reverse=True,
325
- key=lambda candidate: commonprefix(
326
- [
327
- parsed_url.path,
328
- candidate.path,
329
- ]
330
- ).rfind("/"),
331
- )
332
-
333
- return urllib.parse.urlunsplit(candidates[0])
334
-
335
- def _get_new_credentials(
336
- self,
337
- original_url: str,
338
- *,
339
- allow_netrc: bool = True,
340
- allow_keyring: bool = False,
341
- ) -> AuthInfo:
342
- """Find and return credentials for the specified URL."""
343
- # Split the credentials and netloc from the url.
344
- url, netloc, url_user_password = split_auth_netloc_from_url(
345
- original_url,
346
- )
347
-
348
- # Start with the credentials embedded in the url
349
- username, password = url_user_password
350
- if username is not None and password is not None:
351
- logger.debug("Found credentials in url for %s", netloc)
352
- return url_user_password
353
-
354
- # Find a matching index url for this request
355
- index_url = self._get_index_url(url)
356
- if index_url:
357
- # Split the credentials from the url.
358
- index_info = split_auth_netloc_from_url(index_url)
359
- if index_info:
360
- index_url, _, index_url_user_password = index_info
361
- logger.debug("Found index url %s", index_url)
362
-
363
- # If an index URL was found, try its embedded credentials
364
- if index_url and index_url_user_password[0] is not None:
365
- username, password = index_url_user_password
366
- if username is not None and password is not None:
367
- logger.debug("Found credentials in index url for %s", netloc)
368
- return index_url_user_password
369
-
370
- # Get creds from netrc if we still don't have them
371
- if allow_netrc:
372
- netrc_auth = get_netrc_auth(original_url)
373
- if netrc_auth:
374
- logger.debug("Found credentials in netrc for %s", netloc)
375
- return netrc_auth
376
-
377
- # If we don't have a password and keyring is available, use it.
378
- if allow_keyring:
379
- # The index url is more specific than the netloc, so try it first
380
- # fmt: off
381
- kr_auth = (
382
- self._get_keyring_auth(index_url, username) or
383
- self._get_keyring_auth(netloc, username)
384
- )
385
- # fmt: on
386
- if kr_auth:
387
- logger.debug("Found credentials in keyring for %s", netloc)
388
- return kr_auth
389
-
390
- return username, password
391
-
392
- def _get_url_and_credentials(
393
- self, original_url: str
394
- ) -> tuple[str, str | None, str | None]:
395
- """Return the credentials to use for the provided URL.
396
-
397
- If allowed, netrc and keyring may be used to obtain the
398
- correct credentials.
399
-
400
- Returns (url_without_credentials, username, password). Note
401
- that even if the original URL contains credentials, this
402
- function may return a different username and password.
403
- """
404
- url, netloc, _ = split_auth_netloc_from_url(original_url)
405
-
406
- # Try to get credentials from original url
407
- username, password = self._get_new_credentials(original_url)
408
-
409
- # If credentials not found, use any stored credentials for this netloc.
410
- # Do this if either the username or the password is missing.
411
- # This accounts for the situation in which the user has specified
412
- # the username in the index url, but the password comes from keyring.
413
- if (username is None or password is None) and netloc in self.passwords:
414
- un, pw = self.passwords[netloc]
415
- # It is possible that the cached credentials are for a different username,
416
- # in which case the cache should be ignored.
417
- if username is None or username == un:
418
- username, password = un, pw
419
-
420
- if username is not None or password is not None:
421
- # Convert the username and password if they're None, so that
422
- # this netloc will show up as "cached" in the conditional above.
423
- # Further, HTTPBasicAuth doesn't accept None, so it makes sense to
424
- # cache the value that is going to be used.
425
- username = username or ""
426
- password = password or ""
427
-
428
- # Store any acquired credentials.
429
- self.passwords[netloc] = (username, password)
430
-
431
- assert (
432
- # Credentials were found
433
- (username is not None and password is not None)
434
- # Credentials were not found
435
- or (username is None and password is None)
436
- ), f"Could not load credentials from url: {original_url}"
437
-
438
- return url, username, password
439
-
440
- def __call__(self, req: Request) -> Request:
441
- # Get credentials for this request
442
- url, username, password = self._get_url_and_credentials(req.url)
443
-
444
- # Set the url of the request to the url without any credentials
445
- req.url = url
446
-
447
- if username is not None and password is not None:
448
- # Send the basic auth with this request
449
- req = HTTPBasicAuth(username, password)(req)
450
-
451
- # Attach a hook to handle 401 responses
452
- req.register_hook("response", self.handle_401)
453
-
454
- return req
455
-
456
- # Factored out to allow for easy patching in tests
457
- def _prompt_for_password(self, netloc: str) -> tuple[str | None, str | None, bool]:
458
- username = ask_input(f"User for {netloc}: ") if self.prompting else None
459
- if not username:
460
- return None, None, False
461
- if self.use_keyring:
462
- auth = self._get_keyring_auth(netloc, username)
463
- if auth and auth[0] is not None and auth[1] is not None:
464
- return auth[0], auth[1], False
465
- password = ask_password("Password: ")
466
- return username, password, True
467
-
468
- # Factored out to allow for easy patching in tests
469
- def _should_save_password_to_keyring(self) -> bool:
470
- if (
471
- not self.prompting
472
- or not self.use_keyring
473
- or not self.keyring_provider.has_keyring
474
- ):
475
- return False
476
- return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y"
477
-
478
- def handle_401(self, resp: Response, **kwargs: Any) -> Response:
479
- # We only care about 401 responses, anything else we want to just
480
- # pass through the actual response
481
- if resp.status_code != 401:
482
- return resp
483
-
484
- username, password = None, None
485
-
486
- # Query the keyring for credentials:
487
- if self.use_keyring:
488
- username, password = self._get_new_credentials(
489
- resp.url,
490
- allow_netrc=False,
491
- allow_keyring=True,
492
- )
493
-
494
- # We are not able to prompt the user so simply return the response
495
- if not self.prompting and not username and not password:
496
- return resp
497
-
498
- parsed = urllib.parse.urlparse(resp.url)
499
-
500
- # Prompt the user for a new username and password
501
- save = False
502
- if not username and not password:
503
- username, password, save = self._prompt_for_password(parsed.netloc)
504
-
505
- # Store the new username and password to use for future requests
506
- self._credentials_to_save = None
507
- if username is not None and password is not None:
508
- self.passwords[parsed.netloc] = (username, password)
509
-
510
- # Prompt to save the password to keyring
511
- if save and self._should_save_password_to_keyring():
512
- self._credentials_to_save = Credentials(
513
- url=parsed.netloc,
514
- username=username,
515
- password=password,
516
- )
517
-
518
- # Consume content and release the original connection to allow our new
519
- # request to reuse the same one.
520
- # The result of the assignment isn't used, it's just needed to consume
521
- # the content.
522
- _ = resp.content
523
- resp.raw.release_conn()
524
-
525
- # Add our new username and password to the request
526
- req = HTTPBasicAuth(username or "", password or "")(resp.request)
527
- req.register_hook("response", self.warn_on_401)
528
-
529
- # On successful request, save the credentials that were used to
530
- # keyring. (Note that if the user responded "no" above, this member
531
- # is not set and nothing will be saved.)
532
- if self._credentials_to_save:
533
- req.register_hook("response", self.save_credentials)
534
-
535
- # Send our new request
536
- new_resp = resp.connection.send(req, **kwargs)
537
- new_resp.history.append(resp)
538
-
539
- return new_resp
540
-
541
- def warn_on_401(self, resp: Response, **kwargs: Any) -> None:
542
- """Response callback to warn about incorrect credentials."""
543
- if resp.status_code == 401:
544
- logger.warning(
545
- "401 Error, Credentials not correct for %s",
546
- resp.request.url,
547
- )
548
-
549
- def save_credentials(self, resp: Response, **kwargs: Any) -> None:
550
- """Response callback to save credentials on success."""
551
- assert (
552
- self.keyring_provider.has_keyring
553
- ), "should never reach here without keyring"
554
-
555
- creds = self._credentials_to_save
556
- self._credentials_to_save = None
557
- if creds and resp.status_code < 400:
558
- try:
559
- logger.info("Saving credentials to keyring")
560
- self.keyring_provider.save_auth_info(
561
- creds.url, creds.username, creds.password
562
- )
563
- except Exception:
564
- logger.exception("Failed to save credentials")
@@ -1,133 +0,0 @@
1
- """HTTP cache implementation."""
2
-
3
- from __future__ import annotations
4
-
5
- import os
6
- import shutil
7
- from collections.abc import Generator
8
- from contextlib import contextmanager
9
- from datetime import datetime
10
- from typing import Any, BinaryIO, Callable
11
-
12
- from pip._vendor.cachecontrol.cache import SeparateBodyBaseCache
13
- from pip._vendor.cachecontrol.caches import SeparateBodyFileCache
14
- from pip._vendor.requests.models import Response
15
-
16
- from pip._internal.utils.filesystem import adjacent_tmp_file, replace
17
- from pip._internal.utils.misc import ensure_dir
18
-
19
-
20
- def is_from_cache(response: Response) -> bool:
21
- return getattr(response, "from_cache", False)
22
-
23
-
24
- @contextmanager
25
- def suppressed_cache_errors() -> Generator[None, None, None]:
26
- """If we can't access the cache then we can just skip caching and process
27
- requests as if caching wasn't enabled.
28
- """
29
- try:
30
- yield
31
- except OSError:
32
- pass
33
-
34
-
35
- class SafeFileCache(SeparateBodyBaseCache):
36
- """
37
- A file based cache which is safe to use even when the target directory may
38
- not be accessible or writable.
39
-
40
- There is a race condition when two processes try to write and/or read the
41
- same entry at the same time, since each entry consists of two separate
42
- files (https://github.com/psf/cachecontrol/issues/324). We therefore have
43
- additional logic that makes sure that both files to be present before
44
- returning an entry; this fixes the read side of the race condition.
45
-
46
- For the write side, we assume that the server will only ever return the
47
- same data for the same URL, which ought to be the case for files pip is
48
- downloading. PyPI does not have a mechanism to swap out a wheel for
49
- another wheel, for example. If this assumption is not true, the
50
- CacheControl issue will need to be fixed.
51
- """
52
-
53
- def __init__(self, directory: str) -> None:
54
- assert directory is not None, "Cache directory must not be None."
55
- super().__init__()
56
- self.directory = directory
57
-
58
- def _get_cache_path(self, name: str) -> str:
59
- # From cachecontrol.caches.file_cache.FileCache._fn, brought into our
60
- # class for backwards-compatibility and to avoid using a non-public
61
- # method.
62
- hashed = SeparateBodyFileCache.encode(name)
63
- parts = list(hashed[:5]) + [hashed]
64
- return os.path.join(self.directory, *parts)
65
-
66
- def get(self, key: str) -> bytes | None:
67
- # The cache entry is only valid if both metadata and body exist.
68
- metadata_path = self._get_cache_path(key)
69
- body_path = metadata_path + ".body"
70
- if not (os.path.exists(metadata_path) and os.path.exists(body_path)):
71
- return None
72
- with suppressed_cache_errors():
73
- with open(metadata_path, "rb") as f:
74
- return f.read()
75
-
76
- def _write_to_file(self, path: str, writer_func: Callable[[BinaryIO], Any]) -> None:
77
- """Common file writing logic with proper permissions and atomic replacement."""
78
- with suppressed_cache_errors():
79
- ensure_dir(os.path.dirname(path))
80
-
81
- with adjacent_tmp_file(path) as f:
82
- writer_func(f)
83
- # Inherit the read/write permissions of the cache directory
84
- # to enable multi-user cache use-cases.
85
- mode = (
86
- os.stat(self.directory).st_mode
87
- & 0o666 # select read/write permissions of cache directory
88
- | 0o600 # set owner read/write permissions
89
- )
90
- # Change permissions only if there is no risk of following a symlink.
91
- if os.chmod in os.supports_fd:
92
- os.chmod(f.fileno(), mode)
93
- elif os.chmod in os.supports_follow_symlinks:
94
- os.chmod(f.name, mode, follow_symlinks=False)
95
-
96
- replace(f.name, path)
97
-
98
- def _write(self, path: str, data: bytes) -> None:
99
- self._write_to_file(path, lambda f: f.write(data))
100
-
101
- def _write_from_io(self, path: str, source_file: BinaryIO) -> None:
102
- self._write_to_file(path, lambda f: shutil.copyfileobj(source_file, f))
103
-
104
- def set(
105
- self, key: str, value: bytes, expires: int | datetime | None = None
106
- ) -> None:
107
- path = self._get_cache_path(key)
108
- self._write(path, value)
109
-
110
- def delete(self, key: str) -> None:
111
- path = self._get_cache_path(key)
112
- with suppressed_cache_errors():
113
- os.remove(path)
114
- with suppressed_cache_errors():
115
- os.remove(path + ".body")
116
-
117
- def get_body(self, key: str) -> BinaryIO | None:
118
- # The cache entry is only valid if both metadata and body exist.
119
- metadata_path = self._get_cache_path(key)
120
- body_path = metadata_path + ".body"
121
- if not (os.path.exists(metadata_path) and os.path.exists(body_path)):
122
- return None
123
- with suppressed_cache_errors():
124
- return open(body_path, "rb")
125
-
126
- def set_body(self, key: str, body: bytes) -> None:
127
- path = self._get_cache_path(key) + ".body"
128
- self._write(path, body)
129
-
130
- def set_body_from_io(self, key: str, body_file: BinaryIO) -> None:
131
- """Set the body of the cache entry from a file object."""
132
- path = self._get_cache_path(key) + ".body"
133
- self._write_from_io(path, body_file)