cli-ih 0.6.3__py3-none-any.whl → 0.6.3.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 (424) hide show
  1. cli_ih/asyncClient.py +13 -7
  2. cli_ih/client.py +13 -6
  3. {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/METADATA +1 -1
  4. cli_ih-0.6.3.1.dist-info/RECORD +425 -0
  5. {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/WHEEL +1 -1
  6. {cli_ih-0.6.3.dist-info → cli_ih-0.6.3.1.dist-info}/top_level.txt +1 -0
  7. venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +85 -0
  8. venv/Lib/site-packages/pip/__init__.py +13 -0
  9. venv/Lib/site-packages/pip/__main__.py +24 -0
  10. venv/Lib/site-packages/pip/__pip-runner__.py +50 -0
  11. venv/Lib/site-packages/pip/_internal/__init__.py +18 -0
  12. venv/Lib/site-packages/pip/_internal/build_env.py +349 -0
  13. venv/Lib/site-packages/pip/_internal/cache.py +291 -0
  14. venv/Lib/site-packages/pip/_internal/cli/__init__.py +3 -0
  15. venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +184 -0
  16. venv/Lib/site-packages/pip/_internal/cli/base_command.py +244 -0
  17. venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +1138 -0
  18. venv/Lib/site-packages/pip/_internal/cli/command_context.py +28 -0
  19. venv/Lib/site-packages/pip/_internal/cli/index_command.py +175 -0
  20. venv/Lib/site-packages/pip/_internal/cli/main.py +80 -0
  21. venv/Lib/site-packages/pip/_internal/cli/main_parser.py +134 -0
  22. venv/Lib/site-packages/pip/_internal/cli/parser.py +298 -0
  23. venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +151 -0
  24. venv/Lib/site-packages/pip/_internal/cli/req_command.py +351 -0
  25. venv/Lib/site-packages/pip/_internal/cli/spinners.py +235 -0
  26. venv/Lib/site-packages/pip/_internal/cli/status_codes.py +6 -0
  27. venv/Lib/site-packages/pip/_internal/commands/__init__.py +139 -0
  28. venv/Lib/site-packages/pip/_internal/commands/cache.py +231 -0
  29. venv/Lib/site-packages/pip/_internal/commands/check.py +66 -0
  30. venv/Lib/site-packages/pip/_internal/commands/completion.py +135 -0
  31. venv/Lib/site-packages/pip/_internal/commands/configuration.py +288 -0
  32. venv/Lib/site-packages/pip/_internal/commands/debug.py +203 -0
  33. venv/Lib/site-packages/pip/_internal/commands/download.py +145 -0
  34. venv/Lib/site-packages/pip/_internal/commands/freeze.py +107 -0
  35. venv/Lib/site-packages/pip/_internal/commands/hash.py +58 -0
  36. venv/Lib/site-packages/pip/_internal/commands/help.py +40 -0
  37. venv/Lib/site-packages/pip/_internal/commands/index.py +159 -0
  38. venv/Lib/site-packages/pip/_internal/commands/inspect.py +92 -0
  39. venv/Lib/site-packages/pip/_internal/commands/install.py +798 -0
  40. venv/Lib/site-packages/pip/_internal/commands/list.py +400 -0
  41. venv/Lib/site-packages/pip/_internal/commands/lock.py +170 -0
  42. venv/Lib/site-packages/pip/_internal/commands/search.py +178 -0
  43. venv/Lib/site-packages/pip/_internal/commands/show.py +231 -0
  44. venv/Lib/site-packages/pip/_internal/commands/uninstall.py +113 -0
  45. venv/Lib/site-packages/pip/_internal/commands/wheel.py +181 -0
  46. venv/Lib/site-packages/pip/_internal/configuration.py +397 -0
  47. venv/Lib/site-packages/pip/_internal/distributions/__init__.py +21 -0
  48. venv/Lib/site-packages/pip/_internal/distributions/base.py +55 -0
  49. venv/Lib/site-packages/pip/_internal/distributions/installed.py +33 -0
  50. venv/Lib/site-packages/pip/_internal/distributions/sdist.py +165 -0
  51. venv/Lib/site-packages/pip/_internal/distributions/wheel.py +44 -0
  52. venv/Lib/site-packages/pip/_internal/exceptions.py +881 -0
  53. venv/Lib/site-packages/pip/_internal/index/__init__.py +1 -0
  54. venv/Lib/site-packages/pip/_internal/index/collector.py +489 -0
  55. venv/Lib/site-packages/pip/_internal/index/package_finder.py +1059 -0
  56. venv/Lib/site-packages/pip/_internal/index/sources.py +287 -0
  57. venv/Lib/site-packages/pip/_internal/locations/__init__.py +441 -0
  58. venv/Lib/site-packages/pip/_internal/locations/_distutils.py +173 -0
  59. venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +215 -0
  60. venv/Lib/site-packages/pip/_internal/locations/base.py +82 -0
  61. venv/Lib/site-packages/pip/_internal/main.py +12 -0
  62. venv/Lib/site-packages/pip/_internal/metadata/__init__.py +164 -0
  63. venv/Lib/site-packages/pip/_internal/metadata/_json.py +87 -0
  64. venv/Lib/site-packages/pip/_internal/metadata/base.py +685 -0
  65. venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +6 -0
  66. venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +87 -0
  67. venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +223 -0
  68. venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +143 -0
  69. venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +298 -0
  70. venv/Lib/site-packages/pip/_internal/models/__init__.py +1 -0
  71. venv/Lib/site-packages/pip/_internal/models/candidate.py +25 -0
  72. venv/Lib/site-packages/pip/_internal/models/direct_url.py +227 -0
  73. venv/Lib/site-packages/pip/_internal/models/format_control.py +78 -0
  74. venv/Lib/site-packages/pip/_internal/models/index.py +28 -0
  75. venv/Lib/site-packages/pip/_internal/models/installation_report.py +57 -0
  76. venv/Lib/site-packages/pip/_internal/models/link.py +613 -0
  77. venv/Lib/site-packages/pip/_internal/models/pylock.py +188 -0
  78. venv/Lib/site-packages/pip/_internal/models/scheme.py +25 -0
  79. venv/Lib/site-packages/pip/_internal/models/search_scope.py +126 -0
  80. venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +53 -0
  81. venv/Lib/site-packages/pip/_internal/models/target_python.py +122 -0
  82. venv/Lib/site-packages/pip/_internal/models/wheel.py +141 -0
  83. venv/Lib/site-packages/pip/_internal/network/__init__.py +1 -0
  84. venv/Lib/site-packages/pip/_internal/network/auth.py +564 -0
  85. venv/Lib/site-packages/pip/_internal/network/cache.py +133 -0
  86. venv/Lib/site-packages/pip/_internal/network/download.py +342 -0
  87. venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +213 -0
  88. venv/Lib/site-packages/pip/_internal/network/session.py +528 -0
  89. venv/Lib/site-packages/pip/_internal/network/utils.py +98 -0
  90. venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +61 -0
  91. venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
  92. venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
  93. venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +140 -0
  94. venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +38 -0
  95. venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +41 -0
  96. venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +73 -0
  97. venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +38 -0
  98. venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +47 -0
  99. venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +119 -0
  100. venv/Lib/site-packages/pip/_internal/operations/check.py +175 -0
  101. venv/Lib/site-packages/pip/_internal/operations/freeze.py +259 -0
  102. venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +1 -0
  103. venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +48 -0
  104. venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +746 -0
  105. venv/Lib/site-packages/pip/_internal/operations/prepare.py +742 -0
  106. venv/Lib/site-packages/pip/_internal/pyproject.py +182 -0
  107. venv/Lib/site-packages/pip/_internal/req/__init__.py +105 -0
  108. venv/Lib/site-packages/pip/_internal/req/constructors.py +562 -0
  109. venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +75 -0
  110. venv/Lib/site-packages/pip/_internal/req/req_file.py +620 -0
  111. venv/Lib/site-packages/pip/_internal/req/req_install.py +937 -0
  112. venv/Lib/site-packages/pip/_internal/req/req_set.py +81 -0
  113. venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +639 -0
  114. venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
  115. venv/Lib/site-packages/pip/_internal/resolution/base.py +20 -0
  116. venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
  117. venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +598 -0
  118. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
  119. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +142 -0
  120. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +582 -0
  121. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +814 -0
  122. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +166 -0
  123. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +276 -0
  124. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +85 -0
  125. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +247 -0
  126. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +336 -0
  127. venv/Lib/site-packages/pip/_internal/self_outdated_check.py +254 -0
  128. venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
  129. venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +109 -0
  130. venv/Lib/site-packages/pip/_internal/utils/_log.py +38 -0
  131. venv/Lib/site-packages/pip/_internal/utils/appdirs.py +52 -0
  132. venv/Lib/site-packages/pip/_internal/utils/compat.py +85 -0
  133. venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +201 -0
  134. venv/Lib/site-packages/pip/_internal/utils/datetime.py +10 -0
  135. venv/Lib/site-packages/pip/_internal/utils/deprecation.py +126 -0
  136. venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +87 -0
  137. venv/Lib/site-packages/pip/_internal/utils/egg_link.py +81 -0
  138. venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +88 -0
  139. venv/Lib/site-packages/pip/_internal/utils/filesystem.py +152 -0
  140. venv/Lib/site-packages/pip/_internal/utils/filetypes.py +24 -0
  141. venv/Lib/site-packages/pip/_internal/utils/glibc.py +102 -0
  142. venv/Lib/site-packages/pip/_internal/utils/hashes.py +150 -0
  143. venv/Lib/site-packages/pip/_internal/utils/logging.py +364 -0
  144. venv/Lib/site-packages/pip/_internal/utils/misc.py +765 -0
  145. venv/Lib/site-packages/pip/_internal/utils/packaging.py +44 -0
  146. venv/Lib/site-packages/pip/_internal/utils/retry.py +45 -0
  147. venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +149 -0
  148. venv/Lib/site-packages/pip/_internal/utils/subprocess.py +248 -0
  149. venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +294 -0
  150. venv/Lib/site-packages/pip/_internal/utils/unpacking.py +337 -0
  151. venv/Lib/site-packages/pip/_internal/utils/urls.py +55 -0
  152. venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +105 -0
  153. venv/Lib/site-packages/pip/_internal/utils/wheel.py +132 -0
  154. venv/Lib/site-packages/pip/_internal/vcs/__init__.py +15 -0
  155. venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +130 -0
  156. venv/Lib/site-packages/pip/_internal/vcs/git.py +571 -0
  157. venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +186 -0
  158. venv/Lib/site-packages/pip/_internal/vcs/subversion.py +335 -0
  159. venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +693 -0
  160. venv/Lib/site-packages/pip/_internal/wheel_builder.py +334 -0
  161. venv/Lib/site-packages/pip/_vendor/__init__.py +117 -0
  162. venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +29 -0
  163. venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +70 -0
  164. venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +168 -0
  165. venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +75 -0
  166. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +8 -0
  167. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +145 -0
  168. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +48 -0
  169. venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +511 -0
  170. venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +119 -0
  171. venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +157 -0
  172. venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
  173. venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +146 -0
  174. venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +43 -0
  175. venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +4 -0
  176. venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +12 -0
  177. venv/Lib/site-packages/pip/_vendor/certifi/core.py +83 -0
  178. venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
  179. venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +13 -0
  180. venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +65 -0
  181. venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +209 -0
  182. venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +59 -0
  183. venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +62 -0
  184. venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +9 -0
  185. venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
  186. venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +33 -0
  187. venv/Lib/site-packages/pip/_vendor/distlib/compat.py +1137 -0
  188. venv/Lib/site-packages/pip/_vendor/distlib/resources.py +358 -0
  189. venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +447 -0
  190. venv/Lib/site-packages/pip/_vendor/distlib/util.py +1984 -0
  191. venv/Lib/site-packages/pip/_vendor/distro/__init__.py +54 -0
  192. venv/Lib/site-packages/pip/_vendor/distro/__main__.py +4 -0
  193. venv/Lib/site-packages/pip/_vendor/distro/distro.py +1403 -0
  194. venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
  195. venv/Lib/site-packages/pip/_vendor/idna/__init__.py +45 -0
  196. venv/Lib/site-packages/pip/_vendor/idna/codec.py +122 -0
  197. venv/Lib/site-packages/pip/_vendor/idna/compat.py +15 -0
  198. venv/Lib/site-packages/pip/_vendor/idna/core.py +437 -0
  199. venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +4243 -0
  200. venv/Lib/site-packages/pip/_vendor/idna/intranges.py +57 -0
  201. venv/Lib/site-packages/pip/_vendor/idna/package_data.py +1 -0
  202. venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
  203. venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +8681 -0
  204. venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +55 -0
  205. venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +48 -0
  206. venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +170 -0
  207. venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +929 -0
  208. venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +15 -0
  209. venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +109 -0
  210. venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +262 -0
  211. venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +85 -0
  212. venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +353 -0
  213. venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +61 -0
  214. venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +195 -0
  215. venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +145 -0
  216. venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +759 -0
  217. venv/Lib/site-packages/pip/_vendor/packaging/markers.py +362 -0
  218. venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +862 -0
  219. venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
  220. venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +91 -0
  221. venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +1019 -0
  222. venv/Lib/site-packages/pip/_vendor/packaging/tags.py +656 -0
  223. venv/Lib/site-packages/pip/_vendor/packaging/utils.py +163 -0
  224. venv/Lib/site-packages/pip/_vendor/packaging/version.py +582 -0
  225. venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +3676 -0
  226. venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +631 -0
  227. venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +55 -0
  228. venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +249 -0
  229. venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +299 -0
  230. venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +144 -0
  231. venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
  232. venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +272 -0
  233. venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +21 -0
  234. venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +272 -0
  235. venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +82 -0
  236. venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +17 -0
  237. venv/Lib/site-packages/pip/_vendor/pygments/console.py +70 -0
  238. venv/Lib/site-packages/pip/_vendor/pygments/filter.py +70 -0
  239. venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +940 -0
  240. venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +129 -0
  241. venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +157 -0
  242. venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +23 -0
  243. venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +963 -0
  244. venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +362 -0
  245. venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +602 -0
  246. venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +1201 -0
  247. venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +43 -0
  248. venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +72 -0
  249. venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +91 -0
  250. venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +104 -0
  251. venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +247 -0
  252. venv/Lib/site-packages/pip/_vendor/pygments/style.py +203 -0
  253. venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +61 -0
  254. venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +54 -0
  255. venv/Lib/site-packages/pip/_vendor/pygments/token.py +214 -0
  256. venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +153 -0
  257. venv/Lib/site-packages/pip/_vendor/pygments/util.py +324 -0
  258. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +31 -0
  259. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +410 -0
  260. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +21 -0
  261. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +389 -0
  262. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
  263. venv/Lib/site-packages/pip/_vendor/requests/__init__.py +179 -0
  264. venv/Lib/site-packages/pip/_vendor/requests/__version__.py +14 -0
  265. venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +50 -0
  266. venv/Lib/site-packages/pip/_vendor/requests/adapters.py +719 -0
  267. venv/Lib/site-packages/pip/_vendor/requests/api.py +157 -0
  268. venv/Lib/site-packages/pip/_vendor/requests/auth.py +314 -0
  269. venv/Lib/site-packages/pip/_vendor/requests/certs.py +17 -0
  270. venv/Lib/site-packages/pip/_vendor/requests/compat.py +90 -0
  271. venv/Lib/site-packages/pip/_vendor/requests/cookies.py +561 -0
  272. venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +151 -0
  273. venv/Lib/site-packages/pip/_vendor/requests/help.py +127 -0
  274. venv/Lib/site-packages/pip/_vendor/requests/hooks.py +33 -0
  275. venv/Lib/site-packages/pip/_vendor/requests/models.py +1039 -0
  276. venv/Lib/site-packages/pip/_vendor/requests/packages.py +25 -0
  277. venv/Lib/site-packages/pip/_vendor/requests/sessions.py +831 -0
  278. venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +128 -0
  279. venv/Lib/site-packages/pip/_vendor/requests/structures.py +99 -0
  280. venv/Lib/site-packages/pip/_vendor/requests/utils.py +1086 -0
  281. venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +27 -0
  282. venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +196 -0
  283. venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
  284. venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +55 -0
  285. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +27 -0
  286. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +47 -0
  287. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +48 -0
  288. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +57 -0
  289. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +622 -0
  290. venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +209 -0
  291. venv/Lib/site-packages/pip/_vendor/rich/__init__.py +177 -0
  292. venv/Lib/site-packages/pip/_vendor/rich/__main__.py +245 -0
  293. venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +454 -0
  294. venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +3610 -0
  295. venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +32 -0
  296. venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +76 -0
  297. venv/Lib/site-packages/pip/_vendor/rich/_extension.py +10 -0
  298. venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +24 -0
  299. venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +268 -0
  300. venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +94 -0
  301. venv/Lib/site-packages/pip/_vendor/rich/_loop.py +43 -0
  302. venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +69 -0
  303. venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +309 -0
  304. venv/Lib/site-packages/pip/_vendor/rich/_pick.py +17 -0
  305. venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +153 -0
  306. venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +482 -0
  307. venv/Lib/site-packages/pip/_vendor/rich/_stack.py +16 -0
  308. venv/Lib/site-packages/pip/_vendor/rich/_timer.py +19 -0
  309. venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +661 -0
  310. venv/Lib/site-packages/pip/_vendor/rich/_windows.py +71 -0
  311. venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +56 -0
  312. venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +93 -0
  313. venv/Lib/site-packages/pip/_vendor/rich/abc.py +33 -0
  314. venv/Lib/site-packages/pip/_vendor/rich/align.py +306 -0
  315. venv/Lib/site-packages/pip/_vendor/rich/ansi.py +241 -0
  316. venv/Lib/site-packages/pip/_vendor/rich/bar.py +93 -0
  317. venv/Lib/site-packages/pip/_vendor/rich/box.py +474 -0
  318. venv/Lib/site-packages/pip/_vendor/rich/cells.py +174 -0
  319. venv/Lib/site-packages/pip/_vendor/rich/color.py +621 -0
  320. venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +38 -0
  321. venv/Lib/site-packages/pip/_vendor/rich/columns.py +187 -0
  322. venv/Lib/site-packages/pip/_vendor/rich/console.py +2680 -0
  323. venv/Lib/site-packages/pip/_vendor/rich/constrain.py +37 -0
  324. venv/Lib/site-packages/pip/_vendor/rich/containers.py +167 -0
  325. venv/Lib/site-packages/pip/_vendor/rich/control.py +219 -0
  326. venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +193 -0
  327. venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +39 -0
  328. venv/Lib/site-packages/pip/_vendor/rich/emoji.py +91 -0
  329. venv/Lib/site-packages/pip/_vendor/rich/errors.py +34 -0
  330. venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
  331. venv/Lib/site-packages/pip/_vendor/rich/filesize.py +88 -0
  332. venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +232 -0
  333. venv/Lib/site-packages/pip/_vendor/rich/json.py +139 -0
  334. venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +101 -0
  335. venv/Lib/site-packages/pip/_vendor/rich/layout.py +442 -0
  336. venv/Lib/site-packages/pip/_vendor/rich/live.py +400 -0
  337. venv/Lib/site-packages/pip/_vendor/rich/live_render.py +106 -0
  338. venv/Lib/site-packages/pip/_vendor/rich/logging.py +297 -0
  339. venv/Lib/site-packages/pip/_vendor/rich/markup.py +251 -0
  340. venv/Lib/site-packages/pip/_vendor/rich/measure.py +151 -0
  341. venv/Lib/site-packages/pip/_vendor/rich/padding.py +141 -0
  342. venv/Lib/site-packages/pip/_vendor/rich/pager.py +34 -0
  343. venv/Lib/site-packages/pip/_vendor/rich/palette.py +100 -0
  344. venv/Lib/site-packages/pip/_vendor/rich/panel.py +317 -0
  345. venv/Lib/site-packages/pip/_vendor/rich/pretty.py +1016 -0
  346. venv/Lib/site-packages/pip/_vendor/rich/progress.py +1715 -0
  347. venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
  348. venv/Lib/site-packages/pip/_vendor/rich/prompt.py +400 -0
  349. venv/Lib/site-packages/pip/_vendor/rich/protocol.py +42 -0
  350. venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
  351. venv/Lib/site-packages/pip/_vendor/rich/region.py +10 -0
  352. venv/Lib/site-packages/pip/_vendor/rich/repr.py +149 -0
  353. venv/Lib/site-packages/pip/_vendor/rich/rule.py +130 -0
  354. venv/Lib/site-packages/pip/_vendor/rich/scope.py +86 -0
  355. venv/Lib/site-packages/pip/_vendor/rich/screen.py +54 -0
  356. venv/Lib/site-packages/pip/_vendor/rich/segment.py +752 -0
  357. venv/Lib/site-packages/pip/_vendor/rich/spinner.py +132 -0
  358. venv/Lib/site-packages/pip/_vendor/rich/status.py +131 -0
  359. venv/Lib/site-packages/pip/_vendor/rich/style.py +796 -0
  360. venv/Lib/site-packages/pip/_vendor/rich/styled.py +42 -0
  361. venv/Lib/site-packages/pip/_vendor/rich/syntax.py +985 -0
  362. venv/Lib/site-packages/pip/_vendor/rich/table.py +1006 -0
  363. venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +153 -0
  364. venv/Lib/site-packages/pip/_vendor/rich/text.py +1361 -0
  365. venv/Lib/site-packages/pip/_vendor/rich/theme.py +115 -0
  366. venv/Lib/site-packages/pip/_vendor/rich/themes.py +5 -0
  367. venv/Lib/site-packages/pip/_vendor/rich/traceback.py +899 -0
  368. venv/Lib/site-packages/pip/_vendor/rich/tree.py +257 -0
  369. venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +8 -0
  370. venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +770 -0
  371. venv/Lib/site-packages/pip/_vendor/tomli/_re.py +112 -0
  372. venv/Lib/site-packages/pip/_vendor/tomli/_types.py +10 -0
  373. venv/Lib/site-packages/pip/_vendor/tomli/py.typed +1 -0
  374. venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +4 -0
  375. venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +229 -0
  376. venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +1 -0
  377. venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +36 -0
  378. venv/Lib/site-packages/pip/_vendor/truststore/_api.py +333 -0
  379. venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +571 -0
  380. venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +66 -0
  381. venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +31 -0
  382. venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +567 -0
  383. venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
  384. venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +102 -0
  385. venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +355 -0
  386. venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +2 -0
  387. venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +572 -0
  388. venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +1140 -0
  389. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  390. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +36 -0
  391. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  392. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +519 -0
  393. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +397 -0
  394. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +314 -0
  395. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +130 -0
  396. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +518 -0
  397. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +920 -0
  398. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +216 -0
  399. venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +323 -0
  400. venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +274 -0
  401. venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +98 -0
  402. venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
  403. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  404. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +51 -0
  405. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +155 -0
  406. venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +1076 -0
  407. venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +540 -0
  408. venv/Lib/site-packages/pip/_vendor/urllib3/request.py +191 -0
  409. venv/Lib/site-packages/pip/_vendor/urllib3/response.py +879 -0
  410. venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +49 -0
  411. venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +149 -0
  412. venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +57 -0
  413. venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +22 -0
  414. venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +137 -0
  415. venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +107 -0
  416. venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +622 -0
  417. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +504 -0
  418. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +159 -0
  419. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +221 -0
  420. venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +271 -0
  421. venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +435 -0
  422. venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +152 -0
  423. venv/Lib/site-packages/pip/py.typed +4 -0
  424. cli_ih-0.6.3.dist-info/RECORD +0 -8
@@ -0,0 +1,639 @@
1
+ from __future__ import annotations
2
+
3
+ import functools
4
+ import os
5
+ import sys
6
+ import sysconfig
7
+ from collections.abc import Generator, Iterable
8
+ from importlib.util import cache_from_source
9
+ from typing import Any, Callable
10
+
11
+ from pip._internal.exceptions import LegacyDistutilsInstall, UninstallMissingRecord
12
+ from pip._internal.locations import get_bin_prefix, get_bin_user
13
+ from pip._internal.metadata import BaseDistribution
14
+ from pip._internal.utils.compat import WINDOWS
15
+ from pip._internal.utils.egg_link import egg_link_path_from_location
16
+ from pip._internal.utils.logging import getLogger, indent_log
17
+ from pip._internal.utils.misc import ask, normalize_path, renames, rmtree
18
+ from pip._internal.utils.temp_dir import AdjacentTempDirectory, TempDirectory
19
+ from pip._internal.utils.virtualenv import running_under_virtualenv
20
+
21
+ logger = getLogger(__name__)
22
+
23
+
24
+ def _script_names(
25
+ bin_dir: str, script_name: str, is_gui: bool
26
+ ) -> Generator[str, None, None]:
27
+ """Create the fully qualified name of the files created by
28
+ {console,gui}_scripts for the given ``dist``.
29
+ Returns the list of file names
30
+ """
31
+ exe_name = os.path.join(bin_dir, script_name)
32
+ yield exe_name
33
+ if not WINDOWS:
34
+ return
35
+ yield f"{exe_name}.exe"
36
+ yield f"{exe_name}.exe.manifest"
37
+ if is_gui:
38
+ yield f"{exe_name}-script.pyw"
39
+ else:
40
+ yield f"{exe_name}-script.py"
41
+
42
+
43
+ def _unique(
44
+ fn: Callable[..., Generator[Any, None, None]],
45
+ ) -> Callable[..., Generator[Any, None, None]]:
46
+ @functools.wraps(fn)
47
+ def unique(*args: Any, **kw: Any) -> Generator[Any, None, None]:
48
+ seen: set[Any] = set()
49
+ for item in fn(*args, **kw):
50
+ if item not in seen:
51
+ seen.add(item)
52
+ yield item
53
+
54
+ return unique
55
+
56
+
57
+ @_unique
58
+ def uninstallation_paths(dist: BaseDistribution) -> Generator[str, None, None]:
59
+ """
60
+ Yield all the uninstallation paths for dist based on RECORD-without-.py[co]
61
+
62
+ Yield paths to all the files in RECORD. For each .py file in RECORD, add
63
+ the .pyc and .pyo in the same directory.
64
+
65
+ UninstallPathSet.add() takes care of the __pycache__ .py[co].
66
+
67
+ If RECORD is not found, raises an error,
68
+ with possible information from the INSTALLER file.
69
+
70
+ https://packaging.python.org/specifications/recording-installed-packages/
71
+ """
72
+ location = dist.location
73
+ assert location is not None, "not installed"
74
+
75
+ entries = dist.iter_declared_entries()
76
+ if entries is None:
77
+ raise UninstallMissingRecord(distribution=dist)
78
+
79
+ for entry in entries:
80
+ path = os.path.join(location, entry)
81
+ yield path
82
+ if path.endswith(".py"):
83
+ dn, fn = os.path.split(path)
84
+ base = fn[:-3]
85
+ path = os.path.join(dn, base + ".pyc")
86
+ yield path
87
+ path = os.path.join(dn, base + ".pyo")
88
+ yield path
89
+
90
+
91
+ def compact(paths: Iterable[str]) -> set[str]:
92
+ """Compact a path set to contain the minimal number of paths
93
+ necessary to contain all paths in the set. If /a/path/ and
94
+ /a/path/to/a/file.txt are both in the set, leave only the
95
+ shorter path."""
96
+
97
+ sep = os.path.sep
98
+ short_paths: set[str] = set()
99
+ for path in sorted(paths, key=len):
100
+ should_skip = any(
101
+ path.startswith(shortpath.rstrip("*"))
102
+ and path[len(shortpath.rstrip("*").rstrip(sep))] == sep
103
+ for shortpath in short_paths
104
+ )
105
+ if not should_skip:
106
+ short_paths.add(path)
107
+ return short_paths
108
+
109
+
110
+ def compress_for_rename(paths: Iterable[str]) -> set[str]:
111
+ """Returns a set containing the paths that need to be renamed.
112
+
113
+ This set may include directories when the original sequence of paths
114
+ included every file on disk.
115
+ """
116
+ case_map = {os.path.normcase(p): p for p in paths}
117
+ remaining = set(case_map)
118
+ unchecked = sorted({os.path.split(p)[0] for p in case_map.values()}, key=len)
119
+ wildcards: set[str] = set()
120
+
121
+ def norm_join(*a: str) -> str:
122
+ return os.path.normcase(os.path.join(*a))
123
+
124
+ for root in unchecked:
125
+ if any(os.path.normcase(root).startswith(w) for w in wildcards):
126
+ # This directory has already been handled.
127
+ continue
128
+
129
+ all_files: set[str] = set()
130
+ all_subdirs: set[str] = set()
131
+ for dirname, subdirs, files in os.walk(root):
132
+ all_subdirs.update(norm_join(root, dirname, d) for d in subdirs)
133
+ all_files.update(norm_join(root, dirname, f) for f in files)
134
+ # If all the files we found are in our remaining set of files to
135
+ # remove, then remove them from the latter set and add a wildcard
136
+ # for the directory.
137
+ if not (all_files - remaining):
138
+ remaining.difference_update(all_files)
139
+ wildcards.add(root + os.sep)
140
+
141
+ return set(map(case_map.__getitem__, remaining)) | wildcards
142
+
143
+
144
+ def compress_for_output_listing(paths: Iterable[str]) -> tuple[set[str], set[str]]:
145
+ """Returns a tuple of 2 sets of which paths to display to user
146
+
147
+ The first set contains paths that would be deleted. Files of a package
148
+ are not added and the top-level directory of the package has a '*' added
149
+ at the end - to signify that all it's contents are removed.
150
+
151
+ The second set contains files that would have been skipped in the above
152
+ folders.
153
+ """
154
+
155
+ will_remove = set(paths)
156
+ will_skip = set()
157
+
158
+ # Determine folders and files
159
+ folders = set()
160
+ files = set()
161
+ for path in will_remove:
162
+ if path.endswith(".pyc"):
163
+ continue
164
+ if path.endswith("__init__.py") or ".dist-info" in path:
165
+ folders.add(os.path.dirname(path))
166
+ files.add(path)
167
+
168
+ _normcased_files = set(map(os.path.normcase, files))
169
+
170
+ folders = compact(folders)
171
+
172
+ # This walks the tree using os.walk to not miss extra folders
173
+ # that might get added.
174
+ for folder in folders:
175
+ for dirpath, _, dirfiles in os.walk(folder):
176
+ for fname in dirfiles:
177
+ if fname.endswith(".pyc"):
178
+ continue
179
+
180
+ file_ = os.path.join(dirpath, fname)
181
+ if (
182
+ os.path.isfile(file_)
183
+ and os.path.normcase(file_) not in _normcased_files
184
+ ):
185
+ # We are skipping this file. Add it to the set.
186
+ will_skip.add(file_)
187
+
188
+ will_remove = files | {os.path.join(folder, "*") for folder in folders}
189
+
190
+ return will_remove, will_skip
191
+
192
+
193
+ class StashedUninstallPathSet:
194
+ """A set of file rename operations to stash files while
195
+ tentatively uninstalling them."""
196
+
197
+ def __init__(self) -> None:
198
+ # Mapping from source file root to [Adjacent]TempDirectory
199
+ # for files under that directory.
200
+ self._save_dirs: dict[str, TempDirectory] = {}
201
+ # (old path, new path) tuples for each move that may need
202
+ # to be undone.
203
+ self._moves: list[tuple[str, str]] = []
204
+
205
+ def _get_directory_stash(self, path: str) -> str:
206
+ """Stashes a directory.
207
+
208
+ Directories are stashed adjacent to their original location if
209
+ possible, or else moved/copied into the user's temp dir."""
210
+
211
+ try:
212
+ save_dir: TempDirectory = AdjacentTempDirectory(path)
213
+ except OSError:
214
+ save_dir = TempDirectory(kind="uninstall")
215
+ self._save_dirs[os.path.normcase(path)] = save_dir
216
+
217
+ return save_dir.path
218
+
219
+ def _get_file_stash(self, path: str) -> str:
220
+ """Stashes a file.
221
+
222
+ If no root has been provided, one will be created for the directory
223
+ in the user's temp directory."""
224
+ path = os.path.normcase(path)
225
+ head, old_head = os.path.dirname(path), None
226
+ save_dir = None
227
+
228
+ while head != old_head:
229
+ try:
230
+ save_dir = self._save_dirs[head]
231
+ break
232
+ except KeyError:
233
+ pass
234
+ head, old_head = os.path.dirname(head), head
235
+ else:
236
+ # Did not find any suitable root
237
+ head = os.path.dirname(path)
238
+ save_dir = TempDirectory(kind="uninstall")
239
+ self._save_dirs[head] = save_dir
240
+
241
+ relpath = os.path.relpath(path, head)
242
+ if relpath and relpath != os.path.curdir:
243
+ return os.path.join(save_dir.path, relpath)
244
+ return save_dir.path
245
+
246
+ def stash(self, path: str) -> str:
247
+ """Stashes the directory or file and returns its new location.
248
+ Handle symlinks as files to avoid modifying the symlink targets.
249
+ """
250
+ path_is_dir = os.path.isdir(path) and not os.path.islink(path)
251
+ if path_is_dir:
252
+ new_path = self._get_directory_stash(path)
253
+ else:
254
+ new_path = self._get_file_stash(path)
255
+
256
+ self._moves.append((path, new_path))
257
+ if path_is_dir and os.path.isdir(new_path):
258
+ # If we're moving a directory, we need to
259
+ # remove the destination first or else it will be
260
+ # moved to inside the existing directory.
261
+ # We just created new_path ourselves, so it will
262
+ # be removable.
263
+ os.rmdir(new_path)
264
+ renames(path, new_path)
265
+ return new_path
266
+
267
+ def commit(self) -> None:
268
+ """Commits the uninstall by removing stashed files."""
269
+ for save_dir in self._save_dirs.values():
270
+ save_dir.cleanup()
271
+ self._moves = []
272
+ self._save_dirs = {}
273
+
274
+ def rollback(self) -> None:
275
+ """Undoes the uninstall by moving stashed files back."""
276
+ for p in self._moves:
277
+ logger.info("Moving to %s\n from %s", *p)
278
+
279
+ for new_path, path in self._moves:
280
+ try:
281
+ logger.debug("Replacing %s from %s", new_path, path)
282
+ if os.path.isfile(new_path) or os.path.islink(new_path):
283
+ os.unlink(new_path)
284
+ elif os.path.isdir(new_path):
285
+ rmtree(new_path)
286
+ renames(path, new_path)
287
+ except OSError as ex:
288
+ logger.error("Failed to restore %s", new_path)
289
+ logger.debug("Exception: %s", ex)
290
+
291
+ self.commit()
292
+
293
+ @property
294
+ def can_rollback(self) -> bool:
295
+ return bool(self._moves)
296
+
297
+
298
+ class UninstallPathSet:
299
+ """A set of file paths to be removed in the uninstallation of a
300
+ requirement."""
301
+
302
+ def __init__(self, dist: BaseDistribution) -> None:
303
+ self._paths: set[str] = set()
304
+ self._refuse: set[str] = set()
305
+ self._pth: dict[str, UninstallPthEntries] = {}
306
+ self._dist = dist
307
+ self._moved_paths = StashedUninstallPathSet()
308
+ # Create local cache of normalize_path results. Creating an UninstallPathSet
309
+ # can result in hundreds/thousands of redundant calls to normalize_path with
310
+ # the same args, which hurts performance.
311
+ self._normalize_path_cached = functools.lru_cache(normalize_path)
312
+
313
+ def _permitted(self, path: str) -> bool:
314
+ """
315
+ Return True if the given path is one we are permitted to
316
+ remove/modify, False otherwise.
317
+
318
+ """
319
+ # aka is_local, but caching normalized sys.prefix
320
+ if not running_under_virtualenv():
321
+ return True
322
+ return path.startswith(self._normalize_path_cached(sys.prefix))
323
+
324
+ def add(self, path: str) -> None:
325
+ head, tail = os.path.split(path)
326
+
327
+ # we normalize the head to resolve parent directory symlinks, but not
328
+ # the tail, since we only want to uninstall symlinks, not their targets
329
+ path = os.path.join(self._normalize_path_cached(head), os.path.normcase(tail))
330
+
331
+ if not os.path.exists(path):
332
+ return
333
+ if self._permitted(path):
334
+ self._paths.add(path)
335
+ else:
336
+ self._refuse.add(path)
337
+
338
+ # __pycache__ files can show up after 'installed-files.txt' is created,
339
+ # due to imports
340
+ if os.path.splitext(path)[1] == ".py":
341
+ self.add(cache_from_source(path))
342
+
343
+ def add_pth(self, pth_file: str, entry: str) -> None:
344
+ pth_file = self._normalize_path_cached(pth_file)
345
+ if self._permitted(pth_file):
346
+ if pth_file not in self._pth:
347
+ self._pth[pth_file] = UninstallPthEntries(pth_file)
348
+ self._pth[pth_file].add(entry)
349
+ else:
350
+ self._refuse.add(pth_file)
351
+
352
+ def remove(self, auto_confirm: bool = False, verbose: bool = False) -> None:
353
+ """Remove paths in ``self._paths`` with confirmation (unless
354
+ ``auto_confirm`` is True)."""
355
+
356
+ if not self._paths:
357
+ logger.info(
358
+ "Can't uninstall '%s'. No files were found to uninstall.",
359
+ self._dist.raw_name,
360
+ )
361
+ return
362
+
363
+ dist_name_version = f"{self._dist.raw_name}-{self._dist.raw_version}"
364
+ logger.info("Uninstalling %s:", dist_name_version)
365
+
366
+ with indent_log():
367
+ if auto_confirm or self._allowed_to_proceed(verbose):
368
+ moved = self._moved_paths
369
+
370
+ for_rename = compress_for_rename(self._paths)
371
+
372
+ for path in sorted(compact(for_rename)):
373
+ moved.stash(path)
374
+ logger.verbose("Removing file or directory %s", path)
375
+
376
+ for pth in self._pth.values():
377
+ pth.remove()
378
+
379
+ logger.info("Successfully uninstalled %s", dist_name_version)
380
+
381
+ def _allowed_to_proceed(self, verbose: bool) -> bool:
382
+ """Display which files would be deleted and prompt for confirmation"""
383
+
384
+ def _display(msg: str, paths: Iterable[str]) -> None:
385
+ if not paths:
386
+ return
387
+
388
+ logger.info(msg)
389
+ with indent_log():
390
+ for path in sorted(compact(paths)):
391
+ logger.info(path)
392
+
393
+ if not verbose:
394
+ will_remove, will_skip = compress_for_output_listing(self._paths)
395
+ else:
396
+ # In verbose mode, display all the files that are going to be
397
+ # deleted.
398
+ will_remove = set(self._paths)
399
+ will_skip = set()
400
+
401
+ _display("Would remove:", will_remove)
402
+ _display("Would not remove (might be manually added):", will_skip)
403
+ _display("Would not remove (outside of prefix):", self._refuse)
404
+ if verbose:
405
+ _display("Will actually move:", compress_for_rename(self._paths))
406
+
407
+ return ask("Proceed (Y/n)? ", ("y", "n", "")) != "n"
408
+
409
+ def rollback(self) -> None:
410
+ """Rollback the changes previously made by remove()."""
411
+ if not self._moved_paths.can_rollback:
412
+ logger.error(
413
+ "Can't roll back %s; was not uninstalled",
414
+ self._dist.raw_name,
415
+ )
416
+ return
417
+ logger.info("Rolling back uninstall of %s", self._dist.raw_name)
418
+ self._moved_paths.rollback()
419
+ for pth in self._pth.values():
420
+ pth.rollback()
421
+
422
+ def commit(self) -> None:
423
+ """Remove temporary save dir: rollback will no longer be possible."""
424
+ self._moved_paths.commit()
425
+
426
+ @classmethod
427
+ def from_dist(cls, dist: BaseDistribution) -> UninstallPathSet:
428
+ dist_location = dist.location
429
+ info_location = dist.info_location
430
+ if dist_location is None:
431
+ logger.info(
432
+ "Not uninstalling %s since it is not installed",
433
+ dist.canonical_name,
434
+ )
435
+ return cls(dist)
436
+
437
+ normalized_dist_location = normalize_path(dist_location)
438
+ if not dist.local:
439
+ logger.info(
440
+ "Not uninstalling %s at %s, outside environment %s",
441
+ dist.canonical_name,
442
+ normalized_dist_location,
443
+ sys.prefix,
444
+ )
445
+ return cls(dist)
446
+
447
+ if normalized_dist_location in {
448
+ p
449
+ for p in {sysconfig.get_path("stdlib"), sysconfig.get_path("platstdlib")}
450
+ if p
451
+ }:
452
+ logger.info(
453
+ "Not uninstalling %s at %s, as it is in the standard library.",
454
+ dist.canonical_name,
455
+ normalized_dist_location,
456
+ )
457
+ return cls(dist)
458
+
459
+ paths_to_remove = cls(dist)
460
+ develop_egg_link = egg_link_path_from_location(dist.raw_name)
461
+
462
+ # Distribution is installed with metadata in a "flat" .egg-info
463
+ # directory. This means it is not a modern .dist-info installation, an
464
+ # egg, or legacy editable.
465
+ setuptools_flat_installation = (
466
+ dist.installed_with_setuptools_egg_info
467
+ and info_location is not None
468
+ and os.path.exists(info_location)
469
+ # If dist is editable and the location points to a ``.egg-info``,
470
+ # we are in fact in the legacy editable case.
471
+ and not info_location.endswith(f"{dist.setuptools_filename}.egg-info")
472
+ )
473
+
474
+ # Uninstall cases order do matter as in the case of 2 installs of the
475
+ # same package, pip needs to uninstall the currently detected version
476
+ if setuptools_flat_installation:
477
+ if info_location is not None:
478
+ paths_to_remove.add(info_location)
479
+ installed_files = dist.iter_declared_entries()
480
+ if installed_files is not None:
481
+ for installed_file in installed_files:
482
+ paths_to_remove.add(os.path.join(dist_location, installed_file))
483
+ # FIXME: need a test for this elif block
484
+ # occurs with --single-version-externally-managed/--record outside
485
+ # of pip
486
+ elif dist.is_file("top_level.txt"):
487
+ try:
488
+ namespace_packages = dist.read_text("namespace_packages.txt")
489
+ except FileNotFoundError:
490
+ namespaces = []
491
+ else:
492
+ namespaces = namespace_packages.splitlines(keepends=False)
493
+ for top_level_pkg in [
494
+ p
495
+ for p in dist.read_text("top_level.txt").splitlines()
496
+ if p and p not in namespaces
497
+ ]:
498
+ path = os.path.join(dist_location, top_level_pkg)
499
+ paths_to_remove.add(path)
500
+ paths_to_remove.add(f"{path}.py")
501
+ paths_to_remove.add(f"{path}.pyc")
502
+ paths_to_remove.add(f"{path}.pyo")
503
+
504
+ elif dist.installed_by_distutils:
505
+ raise LegacyDistutilsInstall(distribution=dist)
506
+
507
+ elif dist.installed_as_egg:
508
+ # package installed by easy_install
509
+ # We cannot match on dist.egg_name because it can slightly vary
510
+ # i.e. setuptools-0.6c11-py2.6.egg vs setuptools-0.6rc11-py2.6.egg
511
+ # XXX We use normalized_dist_location because dist_location my contain
512
+ # a trailing / if the distribution is a zipped egg
513
+ # (which is not a directory).
514
+ paths_to_remove.add(normalized_dist_location)
515
+ easy_install_egg = os.path.split(normalized_dist_location)[1]
516
+ easy_install_pth = os.path.join(
517
+ os.path.dirname(normalized_dist_location),
518
+ "easy-install.pth",
519
+ )
520
+ paths_to_remove.add_pth(easy_install_pth, "./" + easy_install_egg)
521
+
522
+ elif dist.installed_with_dist_info:
523
+ for path in uninstallation_paths(dist):
524
+ paths_to_remove.add(path)
525
+
526
+ elif develop_egg_link:
527
+ # PEP 660 modern editable is handled in the ``.dist-info`` case
528
+ # above, so this only covers the setuptools-style editable.
529
+ with open(develop_egg_link) as fh:
530
+ link_pointer = os.path.normcase(fh.readline().strip())
531
+ normalized_link_pointer = paths_to_remove._normalize_path_cached(
532
+ link_pointer
533
+ )
534
+ assert os.path.samefile(
535
+ normalized_link_pointer, normalized_dist_location
536
+ ), (
537
+ f"Egg-link {develop_egg_link} (to {link_pointer}) does not match "
538
+ f"installed location of {dist.raw_name} (at {dist_location})"
539
+ )
540
+ paths_to_remove.add(develop_egg_link)
541
+ easy_install_pth = os.path.join(
542
+ os.path.dirname(develop_egg_link), "easy-install.pth"
543
+ )
544
+ paths_to_remove.add_pth(easy_install_pth, dist_location)
545
+
546
+ else:
547
+ logger.debug(
548
+ "Not sure how to uninstall: %s - Check: %s",
549
+ dist,
550
+ dist_location,
551
+ )
552
+
553
+ if dist.in_usersite:
554
+ bin_dir = get_bin_user()
555
+ else:
556
+ bin_dir = get_bin_prefix()
557
+
558
+ # find distutils scripts= scripts
559
+ try:
560
+ for script in dist.iter_distutils_script_names():
561
+ paths_to_remove.add(os.path.join(bin_dir, script))
562
+ if WINDOWS:
563
+ paths_to_remove.add(os.path.join(bin_dir, f"{script}.bat"))
564
+ except (FileNotFoundError, NotADirectoryError):
565
+ pass
566
+
567
+ # find console_scripts and gui_scripts
568
+ def iter_scripts_to_remove(
569
+ dist: BaseDistribution,
570
+ bin_dir: str,
571
+ ) -> Generator[str, None, None]:
572
+ for entry_point in dist.iter_entry_points():
573
+ if entry_point.group == "console_scripts":
574
+ yield from _script_names(bin_dir, entry_point.name, False)
575
+ elif entry_point.group == "gui_scripts":
576
+ yield from _script_names(bin_dir, entry_point.name, True)
577
+
578
+ for s in iter_scripts_to_remove(dist, bin_dir):
579
+ paths_to_remove.add(s)
580
+
581
+ return paths_to_remove
582
+
583
+
584
+ class UninstallPthEntries:
585
+ def __init__(self, pth_file: str) -> None:
586
+ self.file = pth_file
587
+ self.entries: set[str] = set()
588
+ self._saved_lines: list[bytes] | None = None
589
+
590
+ def add(self, entry: str) -> None:
591
+ entry = os.path.normcase(entry)
592
+ # On Windows, os.path.normcase converts the entry to use
593
+ # backslashes. This is correct for entries that describe absolute
594
+ # paths outside of site-packages, but all the others use forward
595
+ # slashes.
596
+ # os.path.splitdrive is used instead of os.path.isabs because isabs
597
+ # treats non-absolute paths with drive letter markings like c:foo\bar
598
+ # as absolute paths. It also does not recognize UNC paths if they don't
599
+ # have more than "\\sever\share". Valid examples: "\\server\share\" or
600
+ # "\\server\share\folder".
601
+ if WINDOWS and not os.path.splitdrive(entry)[0]:
602
+ entry = entry.replace("\\", "/")
603
+ self.entries.add(entry)
604
+
605
+ def remove(self) -> None:
606
+ logger.verbose("Removing pth entries from %s:", self.file)
607
+
608
+ # If the file doesn't exist, log a warning and return
609
+ if not os.path.isfile(self.file):
610
+ logger.warning("Cannot remove entries from nonexistent file %s", self.file)
611
+ return
612
+ with open(self.file, "rb") as fh:
613
+ # windows uses '\r\n' with py3k, but uses '\n' with py2.x
614
+ lines = fh.readlines()
615
+ self._saved_lines = lines
616
+ if any(b"\r\n" in line for line in lines):
617
+ endline = "\r\n"
618
+ else:
619
+ endline = "\n"
620
+ # handle missing trailing newline
621
+ if lines and not lines[-1].endswith(endline.encode("utf-8")):
622
+ lines[-1] = lines[-1] + endline.encode("utf-8")
623
+ for entry in self.entries:
624
+ try:
625
+ logger.verbose("Removing entry: %s", entry)
626
+ lines.remove((entry + endline).encode("utf-8"))
627
+ except ValueError:
628
+ pass
629
+ with open(self.file, "wb") as fh:
630
+ fh.writelines(lines)
631
+
632
+ def rollback(self) -> bool:
633
+ if self._saved_lines is None:
634
+ logger.error("Cannot roll back changes to %s, none were made", self.file)
635
+ return False
636
+ logger.debug("Rolling %s back to previous state", self.file)
637
+ with open(self.file, "wb") as fh:
638
+ fh.writelines(self._saved_lines)
639
+ return True
@@ -0,0 +1,20 @@
1
+ from typing import Callable, Optional
2
+
3
+ from pip._internal.req.req_install import InstallRequirement
4
+ from pip._internal.req.req_set import RequirementSet
5
+
6
+ InstallRequirementProvider = Callable[
7
+ [str, Optional[InstallRequirement]], InstallRequirement
8
+ ]
9
+
10
+
11
+ class BaseResolver:
12
+ def resolve(
13
+ self, root_reqs: list[InstallRequirement], check_supported_wheels: bool
14
+ ) -> RequirementSet:
15
+ raise NotImplementedError()
16
+
17
+ def get_installation_order(
18
+ self, req_set: RequirementSet
19
+ ) -> list[InstallRequirement]:
20
+ raise NotImplementedError()