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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. cli_ih/__init__.py +1 -0
  2. cli_ih/asyncClient.py +109 -10
  3. cli_ih/client.py +110 -18
  4. cli_ih/utils.py +51 -0
  5. cli_ih-0.7.1.dist-info/METADATA +100 -0
  6. cli_ih-0.7.1.dist-info/RECORD +9 -0
  7. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.1.dist-info}/top_level.txt +0 -1
  8. cli_ih-0.6.3.1.dist-info/METADATA +0 -86
  9. cli_ih-0.6.3.1.dist-info/RECORD +0 -425
  10. venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +0 -85
  11. venv/Lib/site-packages/pip/__init__.py +0 -13
  12. venv/Lib/site-packages/pip/__main__.py +0 -24
  13. venv/Lib/site-packages/pip/__pip-runner__.py +0 -50
  14. venv/Lib/site-packages/pip/_internal/__init__.py +0 -18
  15. venv/Lib/site-packages/pip/_internal/build_env.py +0 -349
  16. venv/Lib/site-packages/pip/_internal/cache.py +0 -291
  17. venv/Lib/site-packages/pip/_internal/cli/__init__.py +0 -3
  18. venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +0 -184
  19. venv/Lib/site-packages/pip/_internal/cli/base_command.py +0 -244
  20. venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +0 -1138
  21. venv/Lib/site-packages/pip/_internal/cli/command_context.py +0 -28
  22. venv/Lib/site-packages/pip/_internal/cli/index_command.py +0 -175
  23. venv/Lib/site-packages/pip/_internal/cli/main.py +0 -80
  24. venv/Lib/site-packages/pip/_internal/cli/main_parser.py +0 -134
  25. venv/Lib/site-packages/pip/_internal/cli/parser.py +0 -298
  26. venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +0 -151
  27. venv/Lib/site-packages/pip/_internal/cli/req_command.py +0 -351
  28. venv/Lib/site-packages/pip/_internal/cli/spinners.py +0 -235
  29. venv/Lib/site-packages/pip/_internal/cli/status_codes.py +0 -6
  30. venv/Lib/site-packages/pip/_internal/commands/__init__.py +0 -139
  31. venv/Lib/site-packages/pip/_internal/commands/cache.py +0 -231
  32. venv/Lib/site-packages/pip/_internal/commands/check.py +0 -66
  33. venv/Lib/site-packages/pip/_internal/commands/completion.py +0 -135
  34. venv/Lib/site-packages/pip/_internal/commands/configuration.py +0 -288
  35. venv/Lib/site-packages/pip/_internal/commands/debug.py +0 -203
  36. venv/Lib/site-packages/pip/_internal/commands/download.py +0 -145
  37. venv/Lib/site-packages/pip/_internal/commands/freeze.py +0 -107
  38. venv/Lib/site-packages/pip/_internal/commands/hash.py +0 -58
  39. venv/Lib/site-packages/pip/_internal/commands/help.py +0 -40
  40. venv/Lib/site-packages/pip/_internal/commands/index.py +0 -159
  41. venv/Lib/site-packages/pip/_internal/commands/inspect.py +0 -92
  42. venv/Lib/site-packages/pip/_internal/commands/install.py +0 -798
  43. venv/Lib/site-packages/pip/_internal/commands/list.py +0 -400
  44. venv/Lib/site-packages/pip/_internal/commands/lock.py +0 -170
  45. venv/Lib/site-packages/pip/_internal/commands/search.py +0 -178
  46. venv/Lib/site-packages/pip/_internal/commands/show.py +0 -231
  47. venv/Lib/site-packages/pip/_internal/commands/uninstall.py +0 -113
  48. venv/Lib/site-packages/pip/_internal/commands/wheel.py +0 -181
  49. venv/Lib/site-packages/pip/_internal/configuration.py +0 -397
  50. venv/Lib/site-packages/pip/_internal/distributions/__init__.py +0 -21
  51. venv/Lib/site-packages/pip/_internal/distributions/base.py +0 -55
  52. venv/Lib/site-packages/pip/_internal/distributions/installed.py +0 -33
  53. venv/Lib/site-packages/pip/_internal/distributions/sdist.py +0 -165
  54. venv/Lib/site-packages/pip/_internal/distributions/wheel.py +0 -44
  55. venv/Lib/site-packages/pip/_internal/exceptions.py +0 -881
  56. venv/Lib/site-packages/pip/_internal/index/__init__.py +0 -1
  57. venv/Lib/site-packages/pip/_internal/index/collector.py +0 -489
  58. venv/Lib/site-packages/pip/_internal/index/package_finder.py +0 -1059
  59. venv/Lib/site-packages/pip/_internal/index/sources.py +0 -287
  60. venv/Lib/site-packages/pip/_internal/locations/__init__.py +0 -441
  61. venv/Lib/site-packages/pip/_internal/locations/_distutils.py +0 -173
  62. venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +0 -215
  63. venv/Lib/site-packages/pip/_internal/locations/base.py +0 -82
  64. venv/Lib/site-packages/pip/_internal/main.py +0 -12
  65. venv/Lib/site-packages/pip/_internal/metadata/__init__.py +0 -164
  66. venv/Lib/site-packages/pip/_internal/metadata/_json.py +0 -87
  67. venv/Lib/site-packages/pip/_internal/metadata/base.py +0 -685
  68. venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +0 -6
  69. venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +0 -87
  70. venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +0 -223
  71. venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +0 -143
  72. venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +0 -298
  73. venv/Lib/site-packages/pip/_internal/models/__init__.py +0 -1
  74. venv/Lib/site-packages/pip/_internal/models/candidate.py +0 -25
  75. venv/Lib/site-packages/pip/_internal/models/direct_url.py +0 -227
  76. venv/Lib/site-packages/pip/_internal/models/format_control.py +0 -78
  77. venv/Lib/site-packages/pip/_internal/models/index.py +0 -28
  78. venv/Lib/site-packages/pip/_internal/models/installation_report.py +0 -57
  79. venv/Lib/site-packages/pip/_internal/models/link.py +0 -613
  80. venv/Lib/site-packages/pip/_internal/models/pylock.py +0 -188
  81. venv/Lib/site-packages/pip/_internal/models/scheme.py +0 -25
  82. venv/Lib/site-packages/pip/_internal/models/search_scope.py +0 -126
  83. venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +0 -53
  84. venv/Lib/site-packages/pip/_internal/models/target_python.py +0 -122
  85. venv/Lib/site-packages/pip/_internal/models/wheel.py +0 -141
  86. venv/Lib/site-packages/pip/_internal/network/__init__.py +0 -1
  87. venv/Lib/site-packages/pip/_internal/network/auth.py +0 -564
  88. venv/Lib/site-packages/pip/_internal/network/cache.py +0 -133
  89. venv/Lib/site-packages/pip/_internal/network/download.py +0 -342
  90. venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +0 -213
  91. venv/Lib/site-packages/pip/_internal/network/session.py +0 -528
  92. venv/Lib/site-packages/pip/_internal/network/utils.py +0 -98
  93. venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +0 -61
  94. venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
  95. venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
  96. venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +0 -140
  97. venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +0 -38
  98. venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +0 -41
  99. venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +0 -73
  100. venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +0 -38
  101. venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +0 -47
  102. venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +0 -119
  103. venv/Lib/site-packages/pip/_internal/operations/check.py +0 -175
  104. venv/Lib/site-packages/pip/_internal/operations/freeze.py +0 -259
  105. venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +0 -1
  106. venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +0 -48
  107. venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +0 -746
  108. venv/Lib/site-packages/pip/_internal/operations/prepare.py +0 -742
  109. venv/Lib/site-packages/pip/_internal/pyproject.py +0 -182
  110. venv/Lib/site-packages/pip/_internal/req/__init__.py +0 -105
  111. venv/Lib/site-packages/pip/_internal/req/constructors.py +0 -562
  112. venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +0 -75
  113. venv/Lib/site-packages/pip/_internal/req/req_file.py +0 -620
  114. venv/Lib/site-packages/pip/_internal/req/req_install.py +0 -937
  115. venv/Lib/site-packages/pip/_internal/req/req_set.py +0 -81
  116. venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +0 -639
  117. venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
  118. venv/Lib/site-packages/pip/_internal/resolution/base.py +0 -20
  119. venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
  120. venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +0 -598
  121. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
  122. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +0 -142
  123. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +0 -582
  124. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +0 -814
  125. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +0 -166
  126. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +0 -276
  127. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +0 -85
  128. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +0 -247
  129. venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +0 -336
  130. venv/Lib/site-packages/pip/_internal/self_outdated_check.py +0 -254
  131. venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
  132. venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +0 -109
  133. venv/Lib/site-packages/pip/_internal/utils/_log.py +0 -38
  134. venv/Lib/site-packages/pip/_internal/utils/appdirs.py +0 -52
  135. venv/Lib/site-packages/pip/_internal/utils/compat.py +0 -85
  136. venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +0 -201
  137. venv/Lib/site-packages/pip/_internal/utils/datetime.py +0 -10
  138. venv/Lib/site-packages/pip/_internal/utils/deprecation.py +0 -126
  139. venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +0 -87
  140. venv/Lib/site-packages/pip/_internal/utils/egg_link.py +0 -81
  141. venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +0 -88
  142. venv/Lib/site-packages/pip/_internal/utils/filesystem.py +0 -152
  143. venv/Lib/site-packages/pip/_internal/utils/filetypes.py +0 -24
  144. venv/Lib/site-packages/pip/_internal/utils/glibc.py +0 -102
  145. venv/Lib/site-packages/pip/_internal/utils/hashes.py +0 -150
  146. venv/Lib/site-packages/pip/_internal/utils/logging.py +0 -364
  147. venv/Lib/site-packages/pip/_internal/utils/misc.py +0 -765
  148. venv/Lib/site-packages/pip/_internal/utils/packaging.py +0 -44
  149. venv/Lib/site-packages/pip/_internal/utils/retry.py +0 -45
  150. venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +0 -149
  151. venv/Lib/site-packages/pip/_internal/utils/subprocess.py +0 -248
  152. venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +0 -294
  153. venv/Lib/site-packages/pip/_internal/utils/unpacking.py +0 -337
  154. venv/Lib/site-packages/pip/_internal/utils/urls.py +0 -55
  155. venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +0 -105
  156. venv/Lib/site-packages/pip/_internal/utils/wheel.py +0 -132
  157. venv/Lib/site-packages/pip/_internal/vcs/__init__.py +0 -15
  158. venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +0 -130
  159. venv/Lib/site-packages/pip/_internal/vcs/git.py +0 -571
  160. venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +0 -186
  161. venv/Lib/site-packages/pip/_internal/vcs/subversion.py +0 -335
  162. venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +0 -693
  163. venv/Lib/site-packages/pip/_internal/wheel_builder.py +0 -334
  164. venv/Lib/site-packages/pip/_vendor/__init__.py +0 -117
  165. venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +0 -29
  166. venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +0 -70
  167. venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +0 -168
  168. venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +0 -75
  169. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +0 -8
  170. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +0 -145
  171. venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +0 -48
  172. venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +0 -511
  173. venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +0 -119
  174. venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +0 -157
  175. venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
  176. venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +0 -146
  177. venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +0 -43
  178. venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +0 -4
  179. venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +0 -12
  180. venv/Lib/site-packages/pip/_vendor/certifi/core.py +0 -83
  181. venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
  182. venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +0 -13
  183. venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +0 -65
  184. venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +0 -209
  185. venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +0 -59
  186. venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +0 -62
  187. venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +0 -9
  188. venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
  189. venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +0 -33
  190. venv/Lib/site-packages/pip/_vendor/distlib/compat.py +0 -1137
  191. venv/Lib/site-packages/pip/_vendor/distlib/resources.py +0 -358
  192. venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +0 -447
  193. venv/Lib/site-packages/pip/_vendor/distlib/util.py +0 -1984
  194. venv/Lib/site-packages/pip/_vendor/distro/__init__.py +0 -54
  195. venv/Lib/site-packages/pip/_vendor/distro/__main__.py +0 -4
  196. venv/Lib/site-packages/pip/_vendor/distro/distro.py +0 -1403
  197. venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
  198. venv/Lib/site-packages/pip/_vendor/idna/__init__.py +0 -45
  199. venv/Lib/site-packages/pip/_vendor/idna/codec.py +0 -122
  200. venv/Lib/site-packages/pip/_vendor/idna/compat.py +0 -15
  201. venv/Lib/site-packages/pip/_vendor/idna/core.py +0 -437
  202. venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +0 -4243
  203. venv/Lib/site-packages/pip/_vendor/idna/intranges.py +0 -57
  204. venv/Lib/site-packages/pip/_vendor/idna/package_data.py +0 -1
  205. venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
  206. venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +0 -8681
  207. venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +0 -55
  208. venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +0 -48
  209. venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +0 -170
  210. venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +0 -929
  211. venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +0 -15
  212. venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +0 -109
  213. venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +0 -262
  214. venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +0 -85
  215. venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +0 -353
  216. venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +0 -61
  217. venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +0 -195
  218. venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +0 -145
  219. venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +0 -759
  220. venv/Lib/site-packages/pip/_vendor/packaging/markers.py +0 -362
  221. venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +0 -862
  222. venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
  223. venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +0 -91
  224. venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +0 -1019
  225. venv/Lib/site-packages/pip/_vendor/packaging/tags.py +0 -656
  226. venv/Lib/site-packages/pip/_vendor/packaging/utils.py +0 -163
  227. venv/Lib/site-packages/pip/_vendor/packaging/version.py +0 -582
  228. venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +0 -3676
  229. venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +0 -631
  230. venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +0 -55
  231. venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +0 -249
  232. venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +0 -299
  233. venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +0 -144
  234. venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
  235. venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +0 -272
  236. venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +0 -21
  237. venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +0 -272
  238. venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +0 -82
  239. venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +0 -17
  240. venv/Lib/site-packages/pip/_vendor/pygments/console.py +0 -70
  241. venv/Lib/site-packages/pip/_vendor/pygments/filter.py +0 -70
  242. venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +0 -940
  243. venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +0 -129
  244. venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +0 -157
  245. venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +0 -23
  246. venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +0 -963
  247. venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +0 -362
  248. venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +0 -602
  249. venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +0 -1201
  250. venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +0 -43
  251. venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +0 -72
  252. venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +0 -91
  253. venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +0 -104
  254. venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +0 -247
  255. venv/Lib/site-packages/pip/_vendor/pygments/style.py +0 -203
  256. venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +0 -61
  257. venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +0 -54
  258. venv/Lib/site-packages/pip/_vendor/pygments/token.py +0 -214
  259. venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +0 -153
  260. venv/Lib/site-packages/pip/_vendor/pygments/util.py +0 -324
  261. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +0 -31
  262. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +0 -410
  263. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +0 -21
  264. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +0 -389
  265. venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
  266. venv/Lib/site-packages/pip/_vendor/requests/__init__.py +0 -179
  267. venv/Lib/site-packages/pip/_vendor/requests/__version__.py +0 -14
  268. venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +0 -50
  269. venv/Lib/site-packages/pip/_vendor/requests/adapters.py +0 -719
  270. venv/Lib/site-packages/pip/_vendor/requests/api.py +0 -157
  271. venv/Lib/site-packages/pip/_vendor/requests/auth.py +0 -314
  272. venv/Lib/site-packages/pip/_vendor/requests/certs.py +0 -17
  273. venv/Lib/site-packages/pip/_vendor/requests/compat.py +0 -90
  274. venv/Lib/site-packages/pip/_vendor/requests/cookies.py +0 -561
  275. venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +0 -151
  276. venv/Lib/site-packages/pip/_vendor/requests/help.py +0 -127
  277. venv/Lib/site-packages/pip/_vendor/requests/hooks.py +0 -33
  278. venv/Lib/site-packages/pip/_vendor/requests/models.py +0 -1039
  279. venv/Lib/site-packages/pip/_vendor/requests/packages.py +0 -25
  280. venv/Lib/site-packages/pip/_vendor/requests/sessions.py +0 -831
  281. venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +0 -128
  282. venv/Lib/site-packages/pip/_vendor/requests/structures.py +0 -99
  283. venv/Lib/site-packages/pip/_vendor/requests/utils.py +0 -1086
  284. venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +0 -27
  285. venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +0 -196
  286. venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
  287. venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +0 -55
  288. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +0 -27
  289. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +0 -47
  290. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +0 -48
  291. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +0 -57
  292. venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +0 -622
  293. venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +0 -209
  294. venv/Lib/site-packages/pip/_vendor/rich/__init__.py +0 -177
  295. venv/Lib/site-packages/pip/_vendor/rich/__main__.py +0 -245
  296. venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +0 -454
  297. venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +0 -3610
  298. venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +0 -32
  299. venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +0 -76
  300. venv/Lib/site-packages/pip/_vendor/rich/_extension.py +0 -10
  301. venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +0 -24
  302. venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +0 -268
  303. venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +0 -94
  304. venv/Lib/site-packages/pip/_vendor/rich/_loop.py +0 -43
  305. venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +0 -69
  306. venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +0 -309
  307. venv/Lib/site-packages/pip/_vendor/rich/_pick.py +0 -17
  308. venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +0 -153
  309. venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +0 -482
  310. venv/Lib/site-packages/pip/_vendor/rich/_stack.py +0 -16
  311. venv/Lib/site-packages/pip/_vendor/rich/_timer.py +0 -19
  312. venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +0 -661
  313. venv/Lib/site-packages/pip/_vendor/rich/_windows.py +0 -71
  314. venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +0 -56
  315. venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +0 -93
  316. venv/Lib/site-packages/pip/_vendor/rich/abc.py +0 -33
  317. venv/Lib/site-packages/pip/_vendor/rich/align.py +0 -306
  318. venv/Lib/site-packages/pip/_vendor/rich/ansi.py +0 -241
  319. venv/Lib/site-packages/pip/_vendor/rich/bar.py +0 -93
  320. venv/Lib/site-packages/pip/_vendor/rich/box.py +0 -474
  321. venv/Lib/site-packages/pip/_vendor/rich/cells.py +0 -174
  322. venv/Lib/site-packages/pip/_vendor/rich/color.py +0 -621
  323. venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +0 -38
  324. venv/Lib/site-packages/pip/_vendor/rich/columns.py +0 -187
  325. venv/Lib/site-packages/pip/_vendor/rich/console.py +0 -2680
  326. venv/Lib/site-packages/pip/_vendor/rich/constrain.py +0 -37
  327. venv/Lib/site-packages/pip/_vendor/rich/containers.py +0 -167
  328. venv/Lib/site-packages/pip/_vendor/rich/control.py +0 -219
  329. venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +0 -193
  330. venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +0 -39
  331. venv/Lib/site-packages/pip/_vendor/rich/emoji.py +0 -91
  332. venv/Lib/site-packages/pip/_vendor/rich/errors.py +0 -34
  333. venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +0 -57
  334. venv/Lib/site-packages/pip/_vendor/rich/filesize.py +0 -88
  335. venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +0 -232
  336. venv/Lib/site-packages/pip/_vendor/rich/json.py +0 -139
  337. venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +0 -101
  338. venv/Lib/site-packages/pip/_vendor/rich/layout.py +0 -442
  339. venv/Lib/site-packages/pip/_vendor/rich/live.py +0 -400
  340. venv/Lib/site-packages/pip/_vendor/rich/live_render.py +0 -106
  341. venv/Lib/site-packages/pip/_vendor/rich/logging.py +0 -297
  342. venv/Lib/site-packages/pip/_vendor/rich/markup.py +0 -251
  343. venv/Lib/site-packages/pip/_vendor/rich/measure.py +0 -151
  344. venv/Lib/site-packages/pip/_vendor/rich/padding.py +0 -141
  345. venv/Lib/site-packages/pip/_vendor/rich/pager.py +0 -34
  346. venv/Lib/site-packages/pip/_vendor/rich/palette.py +0 -100
  347. venv/Lib/site-packages/pip/_vendor/rich/panel.py +0 -317
  348. venv/Lib/site-packages/pip/_vendor/rich/pretty.py +0 -1016
  349. venv/Lib/site-packages/pip/_vendor/rich/progress.py +0 -1715
  350. venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +0 -223
  351. venv/Lib/site-packages/pip/_vendor/rich/prompt.py +0 -400
  352. venv/Lib/site-packages/pip/_vendor/rich/protocol.py +0 -42
  353. venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
  354. venv/Lib/site-packages/pip/_vendor/rich/region.py +0 -10
  355. venv/Lib/site-packages/pip/_vendor/rich/repr.py +0 -149
  356. venv/Lib/site-packages/pip/_vendor/rich/rule.py +0 -130
  357. venv/Lib/site-packages/pip/_vendor/rich/scope.py +0 -86
  358. venv/Lib/site-packages/pip/_vendor/rich/screen.py +0 -54
  359. venv/Lib/site-packages/pip/_vendor/rich/segment.py +0 -752
  360. venv/Lib/site-packages/pip/_vendor/rich/spinner.py +0 -132
  361. venv/Lib/site-packages/pip/_vendor/rich/status.py +0 -131
  362. venv/Lib/site-packages/pip/_vendor/rich/style.py +0 -796
  363. venv/Lib/site-packages/pip/_vendor/rich/styled.py +0 -42
  364. venv/Lib/site-packages/pip/_vendor/rich/syntax.py +0 -985
  365. venv/Lib/site-packages/pip/_vendor/rich/table.py +0 -1006
  366. venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +0 -153
  367. venv/Lib/site-packages/pip/_vendor/rich/text.py +0 -1361
  368. venv/Lib/site-packages/pip/_vendor/rich/theme.py +0 -115
  369. venv/Lib/site-packages/pip/_vendor/rich/themes.py +0 -5
  370. venv/Lib/site-packages/pip/_vendor/rich/traceback.py +0 -899
  371. venv/Lib/site-packages/pip/_vendor/rich/tree.py +0 -257
  372. venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +0 -8
  373. venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +0 -770
  374. venv/Lib/site-packages/pip/_vendor/tomli/_re.py +0 -112
  375. venv/Lib/site-packages/pip/_vendor/tomli/_types.py +0 -10
  376. venv/Lib/site-packages/pip/_vendor/tomli/py.typed +0 -1
  377. venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +0 -4
  378. venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +0 -229
  379. venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +0 -1
  380. venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +0 -36
  381. venv/Lib/site-packages/pip/_vendor/truststore/_api.py +0 -333
  382. venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +0 -571
  383. venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +0 -66
  384. venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +0 -31
  385. venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +0 -567
  386. venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
  387. venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +0 -102
  388. venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +0 -355
  389. venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +0 -2
  390. venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +0 -572
  391. venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +0 -1140
  392. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  393. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +0 -36
  394. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  395. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +0 -519
  396. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +0 -397
  397. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +0 -314
  398. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +0 -130
  399. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +0 -518
  400. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +0 -920
  401. venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +0 -216
  402. venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +0 -323
  403. venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +0 -274
  404. venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +0 -98
  405. venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
  406. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  407. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +0 -51
  408. venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +0 -155
  409. venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +0 -1076
  410. venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +0 -540
  411. venv/Lib/site-packages/pip/_vendor/urllib3/request.py +0 -191
  412. venv/Lib/site-packages/pip/_vendor/urllib3/response.py +0 -879
  413. venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +0 -49
  414. venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +0 -149
  415. venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +0 -57
  416. venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +0 -22
  417. venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +0 -137
  418. venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +0 -107
  419. venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +0 -622
  420. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +0 -504
  421. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +0 -159
  422. venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +0 -221
  423. venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +0 -271
  424. venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +0 -435
  425. venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +0 -152
  426. venv/Lib/site-packages/pip/py.typed +0 -4
  427. {cli_ih-0.6.3.1.dist-info → cli_ih-0.7.1.dist-info}/WHEEL +0 -0
@@ -1,571 +0,0 @@
1
- import contextlib
2
- import ctypes
3
- import platform
4
- import ssl
5
- import typing
6
- from ctypes import (
7
- CDLL,
8
- POINTER,
9
- c_bool,
10
- c_char_p,
11
- c_int32,
12
- c_long,
13
- c_uint32,
14
- c_ulong,
15
- c_void_p,
16
- )
17
- from ctypes.util import find_library
18
-
19
- from ._ssl_constants import _set_ssl_context_verify_mode
20
-
21
- _mac_version = platform.mac_ver()[0]
22
- _mac_version_info = tuple(map(int, _mac_version.split(".")))
23
- if _mac_version_info < (10, 8):
24
- raise ImportError(
25
- f"Only OS X 10.8 and newer are supported, not {_mac_version_info[0]}.{_mac_version_info[1]}"
26
- )
27
-
28
- _is_macos_version_10_14_or_later = _mac_version_info >= (10, 14)
29
-
30
-
31
- def _load_cdll(name: str, macos10_16_path: str) -> CDLL:
32
- """Loads a CDLL by name, falling back to known path on 10.16+"""
33
- try:
34
- # Big Sur is technically 11 but we use 10.16 due to the Big Sur
35
- # beta being labeled as 10.16.
36
- path: str | None
37
- if _mac_version_info >= (10, 16):
38
- path = macos10_16_path
39
- else:
40
- path = find_library(name)
41
- if not path:
42
- raise OSError # Caught and reraised as 'ImportError'
43
- return CDLL(path, use_errno=True)
44
- except OSError:
45
- raise ImportError(f"The library {name} failed to load") from None
46
-
47
-
48
- Security = _load_cdll(
49
- "Security", "/System/Library/Frameworks/Security.framework/Security"
50
- )
51
- CoreFoundation = _load_cdll(
52
- "CoreFoundation",
53
- "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation",
54
- )
55
-
56
- Boolean = c_bool
57
- CFIndex = c_long
58
- CFStringEncoding = c_uint32
59
- CFData = c_void_p
60
- CFString = c_void_p
61
- CFArray = c_void_p
62
- CFMutableArray = c_void_p
63
- CFError = c_void_p
64
- CFType = c_void_p
65
- CFTypeID = c_ulong
66
- CFTypeRef = POINTER(CFType)
67
- CFAllocatorRef = c_void_p
68
-
69
- OSStatus = c_int32
70
-
71
- CFErrorRef = POINTER(CFError)
72
- CFDataRef = POINTER(CFData)
73
- CFStringRef = POINTER(CFString)
74
- CFArrayRef = POINTER(CFArray)
75
- CFMutableArrayRef = POINTER(CFMutableArray)
76
- CFArrayCallBacks = c_void_p
77
- CFOptionFlags = c_uint32
78
-
79
- SecCertificateRef = POINTER(c_void_p)
80
- SecPolicyRef = POINTER(c_void_p)
81
- SecTrustRef = POINTER(c_void_p)
82
- SecTrustResultType = c_uint32
83
- SecTrustOptionFlags = c_uint32
84
-
85
- try:
86
- Security.SecCertificateCreateWithData.argtypes = [CFAllocatorRef, CFDataRef]
87
- Security.SecCertificateCreateWithData.restype = SecCertificateRef
88
-
89
- Security.SecCertificateCopyData.argtypes = [SecCertificateRef]
90
- Security.SecCertificateCopyData.restype = CFDataRef
91
-
92
- Security.SecCopyErrorMessageString.argtypes = [OSStatus, c_void_p]
93
- Security.SecCopyErrorMessageString.restype = CFStringRef
94
-
95
- Security.SecTrustSetAnchorCertificates.argtypes = [SecTrustRef, CFArrayRef]
96
- Security.SecTrustSetAnchorCertificates.restype = OSStatus
97
-
98
- Security.SecTrustSetAnchorCertificatesOnly.argtypes = [SecTrustRef, Boolean]
99
- Security.SecTrustSetAnchorCertificatesOnly.restype = OSStatus
100
-
101
- Security.SecPolicyCreateRevocation.argtypes = [CFOptionFlags]
102
- Security.SecPolicyCreateRevocation.restype = SecPolicyRef
103
-
104
- Security.SecPolicyCreateSSL.argtypes = [Boolean, CFStringRef]
105
- Security.SecPolicyCreateSSL.restype = SecPolicyRef
106
-
107
- Security.SecTrustCreateWithCertificates.argtypes = [
108
- CFTypeRef,
109
- CFTypeRef,
110
- POINTER(SecTrustRef),
111
- ]
112
- Security.SecTrustCreateWithCertificates.restype = OSStatus
113
-
114
- Security.SecTrustGetTrustResult.argtypes = [
115
- SecTrustRef,
116
- POINTER(SecTrustResultType),
117
- ]
118
- Security.SecTrustGetTrustResult.restype = OSStatus
119
-
120
- Security.SecTrustEvaluate.argtypes = [
121
- SecTrustRef,
122
- POINTER(SecTrustResultType),
123
- ]
124
- Security.SecTrustEvaluate.restype = OSStatus
125
-
126
- Security.SecTrustRef = SecTrustRef # type: ignore[attr-defined]
127
- Security.SecTrustResultType = SecTrustResultType # type: ignore[attr-defined]
128
- Security.OSStatus = OSStatus # type: ignore[attr-defined]
129
-
130
- kSecRevocationUseAnyAvailableMethod = 3
131
- kSecRevocationRequirePositiveResponse = 8
132
-
133
- CoreFoundation.CFRelease.argtypes = [CFTypeRef]
134
- CoreFoundation.CFRelease.restype = None
135
-
136
- CoreFoundation.CFGetTypeID.argtypes = [CFTypeRef]
137
- CoreFoundation.CFGetTypeID.restype = CFTypeID
138
-
139
- CoreFoundation.CFStringCreateWithCString.argtypes = [
140
- CFAllocatorRef,
141
- c_char_p,
142
- CFStringEncoding,
143
- ]
144
- CoreFoundation.CFStringCreateWithCString.restype = CFStringRef
145
-
146
- CoreFoundation.CFStringGetCStringPtr.argtypes = [CFStringRef, CFStringEncoding]
147
- CoreFoundation.CFStringGetCStringPtr.restype = c_char_p
148
-
149
- CoreFoundation.CFStringGetCString.argtypes = [
150
- CFStringRef,
151
- c_char_p,
152
- CFIndex,
153
- CFStringEncoding,
154
- ]
155
- CoreFoundation.CFStringGetCString.restype = c_bool
156
-
157
- CoreFoundation.CFDataCreate.argtypes = [CFAllocatorRef, c_char_p, CFIndex]
158
- CoreFoundation.CFDataCreate.restype = CFDataRef
159
-
160
- CoreFoundation.CFDataGetLength.argtypes = [CFDataRef]
161
- CoreFoundation.CFDataGetLength.restype = CFIndex
162
-
163
- CoreFoundation.CFDataGetBytePtr.argtypes = [CFDataRef]
164
- CoreFoundation.CFDataGetBytePtr.restype = c_void_p
165
-
166
- CoreFoundation.CFArrayCreate.argtypes = [
167
- CFAllocatorRef,
168
- POINTER(CFTypeRef),
169
- CFIndex,
170
- CFArrayCallBacks,
171
- ]
172
- CoreFoundation.CFArrayCreate.restype = CFArrayRef
173
-
174
- CoreFoundation.CFArrayCreateMutable.argtypes = [
175
- CFAllocatorRef,
176
- CFIndex,
177
- CFArrayCallBacks,
178
- ]
179
- CoreFoundation.CFArrayCreateMutable.restype = CFMutableArrayRef
180
-
181
- CoreFoundation.CFArrayAppendValue.argtypes = [CFMutableArrayRef, c_void_p]
182
- CoreFoundation.CFArrayAppendValue.restype = None
183
-
184
- CoreFoundation.CFArrayGetCount.argtypes = [CFArrayRef]
185
- CoreFoundation.CFArrayGetCount.restype = CFIndex
186
-
187
- CoreFoundation.CFArrayGetValueAtIndex.argtypes = [CFArrayRef, CFIndex]
188
- CoreFoundation.CFArrayGetValueAtIndex.restype = c_void_p
189
-
190
- CoreFoundation.CFErrorGetCode.argtypes = [CFErrorRef]
191
- CoreFoundation.CFErrorGetCode.restype = CFIndex
192
-
193
- CoreFoundation.CFErrorCopyDescription.argtypes = [CFErrorRef]
194
- CoreFoundation.CFErrorCopyDescription.restype = CFStringRef
195
-
196
- CoreFoundation.kCFAllocatorDefault = CFAllocatorRef.in_dll( # type: ignore[attr-defined]
197
- CoreFoundation, "kCFAllocatorDefault"
198
- )
199
- CoreFoundation.kCFTypeArrayCallBacks = c_void_p.in_dll( # type: ignore[attr-defined]
200
- CoreFoundation, "kCFTypeArrayCallBacks"
201
- )
202
-
203
- CoreFoundation.CFTypeRef = CFTypeRef # type: ignore[attr-defined]
204
- CoreFoundation.CFArrayRef = CFArrayRef # type: ignore[attr-defined]
205
- CoreFoundation.CFStringRef = CFStringRef # type: ignore[attr-defined]
206
- CoreFoundation.CFErrorRef = CFErrorRef # type: ignore[attr-defined]
207
-
208
- except AttributeError as e:
209
- raise ImportError(f"Error initializing ctypes: {e}") from None
210
-
211
- # SecTrustEvaluateWithError is macOS 10.14+
212
- if _is_macos_version_10_14_or_later:
213
- try:
214
- Security.SecTrustEvaluateWithError.argtypes = [
215
- SecTrustRef,
216
- POINTER(CFErrorRef),
217
- ]
218
- Security.SecTrustEvaluateWithError.restype = c_bool
219
- except AttributeError as e:
220
- raise ImportError(f"Error initializing ctypes: {e}") from None
221
-
222
-
223
- def _handle_osstatus(result: OSStatus, _: typing.Any, args: typing.Any) -> typing.Any:
224
- """
225
- Raises an error if the OSStatus value is non-zero.
226
- """
227
- if int(result) == 0:
228
- return args
229
-
230
- # Returns a CFString which we need to transform
231
- # into a UTF-8 Python string.
232
- error_message_cfstring = None
233
- try:
234
- error_message_cfstring = Security.SecCopyErrorMessageString(result, None)
235
-
236
- # First step is convert the CFString into a C string pointer.
237
- # We try the fast no-copy way first.
238
- error_message_cfstring_c_void_p = ctypes.cast(
239
- error_message_cfstring, ctypes.POINTER(ctypes.c_void_p)
240
- )
241
- message = CoreFoundation.CFStringGetCStringPtr(
242
- error_message_cfstring_c_void_p, CFConst.kCFStringEncodingUTF8
243
- )
244
-
245
- # Quoting the Apple dev docs:
246
- #
247
- # "A pointer to a C string or NULL if the internal
248
- # storage of theString does not allow this to be
249
- # returned efficiently."
250
- #
251
- # So we need to get our hands dirty.
252
- if message is None:
253
- buffer = ctypes.create_string_buffer(1024)
254
- result = CoreFoundation.CFStringGetCString(
255
- error_message_cfstring_c_void_p,
256
- buffer,
257
- 1024,
258
- CFConst.kCFStringEncodingUTF8,
259
- )
260
- if not result:
261
- raise OSError("Error copying C string from CFStringRef")
262
- message = buffer.value
263
-
264
- finally:
265
- if error_message_cfstring is not None:
266
- CoreFoundation.CFRelease(error_message_cfstring)
267
-
268
- # If no message can be found for this status we come
269
- # up with a generic one that forwards the status code.
270
- if message is None or message == "":
271
- message = f"SecureTransport operation returned a non-zero OSStatus: {result}"
272
-
273
- raise ssl.SSLError(message)
274
-
275
-
276
- Security.SecTrustCreateWithCertificates.errcheck = _handle_osstatus # type: ignore[assignment]
277
- Security.SecTrustSetAnchorCertificates.errcheck = _handle_osstatus # type: ignore[assignment]
278
- Security.SecTrustSetAnchorCertificatesOnly.errcheck = _handle_osstatus # type: ignore[assignment]
279
- Security.SecTrustGetTrustResult.errcheck = _handle_osstatus # type: ignore[assignment]
280
- Security.SecTrustEvaluate.errcheck = _handle_osstatus # type: ignore[assignment]
281
-
282
-
283
- class CFConst:
284
- """CoreFoundation constants"""
285
-
286
- kCFStringEncodingUTF8 = CFStringEncoding(0x08000100)
287
-
288
- errSecIncompleteCertRevocationCheck = -67635
289
- errSecHostNameMismatch = -67602
290
- errSecCertificateExpired = -67818
291
- errSecNotTrusted = -67843
292
-
293
-
294
- def _bytes_to_cf_data_ref(value: bytes) -> CFDataRef: # type: ignore[valid-type]
295
- return CoreFoundation.CFDataCreate( # type: ignore[no-any-return]
296
- CoreFoundation.kCFAllocatorDefault, value, len(value)
297
- )
298
-
299
-
300
- def _bytes_to_cf_string(value: bytes) -> CFString:
301
- """
302
- Given a Python binary data, create a CFString.
303
- The string must be CFReleased by the caller.
304
- """
305
- c_str = ctypes.c_char_p(value)
306
- cf_str = CoreFoundation.CFStringCreateWithCString(
307
- CoreFoundation.kCFAllocatorDefault,
308
- c_str,
309
- CFConst.kCFStringEncodingUTF8,
310
- )
311
- return cf_str # type: ignore[no-any-return]
312
-
313
-
314
- def _cf_string_ref_to_str(cf_string_ref: CFStringRef) -> str | None: # type: ignore[valid-type]
315
- """
316
- Creates a Unicode string from a CFString object. Used entirely for error
317
- reporting.
318
- Yes, it annoys me quite a lot that this function is this complex.
319
- """
320
-
321
- string = CoreFoundation.CFStringGetCStringPtr(
322
- cf_string_ref, CFConst.kCFStringEncodingUTF8
323
- )
324
- if string is None:
325
- buffer = ctypes.create_string_buffer(1024)
326
- result = CoreFoundation.CFStringGetCString(
327
- cf_string_ref, buffer, 1024, CFConst.kCFStringEncodingUTF8
328
- )
329
- if not result:
330
- raise OSError("Error copying C string from CFStringRef")
331
- string = buffer.value
332
- if string is not None:
333
- string = string.decode("utf-8")
334
- return string # type: ignore[no-any-return]
335
-
336
-
337
- def _der_certs_to_cf_cert_array(certs: list[bytes]) -> CFMutableArrayRef: # type: ignore[valid-type]
338
- """Builds a CFArray of SecCertificateRefs from a list of DER-encoded certificates.
339
- Responsibility of the caller to call CoreFoundation.CFRelease on the CFArray.
340
- """
341
- cf_array = CoreFoundation.CFArrayCreateMutable(
342
- CoreFoundation.kCFAllocatorDefault,
343
- 0,
344
- ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks),
345
- )
346
- if not cf_array:
347
- raise MemoryError("Unable to allocate memory!")
348
-
349
- for cert_data in certs:
350
- cf_data = None
351
- sec_cert_ref = None
352
- try:
353
- cf_data = _bytes_to_cf_data_ref(cert_data)
354
- sec_cert_ref = Security.SecCertificateCreateWithData(
355
- CoreFoundation.kCFAllocatorDefault, cf_data
356
- )
357
- CoreFoundation.CFArrayAppendValue(cf_array, sec_cert_ref)
358
- finally:
359
- if cf_data:
360
- CoreFoundation.CFRelease(cf_data)
361
- if sec_cert_ref:
362
- CoreFoundation.CFRelease(sec_cert_ref)
363
-
364
- return cf_array # type: ignore[no-any-return]
365
-
366
-
367
- @contextlib.contextmanager
368
- def _configure_context(ctx: ssl.SSLContext) -> typing.Iterator[None]:
369
- check_hostname = ctx.check_hostname
370
- verify_mode = ctx.verify_mode
371
- ctx.check_hostname = False
372
- _set_ssl_context_verify_mode(ctx, ssl.CERT_NONE)
373
- try:
374
- yield
375
- finally:
376
- ctx.check_hostname = check_hostname
377
- _set_ssl_context_verify_mode(ctx, verify_mode)
378
-
379
-
380
- def _verify_peercerts_impl(
381
- ssl_context: ssl.SSLContext,
382
- cert_chain: list[bytes],
383
- server_hostname: str | None = None,
384
- ) -> None:
385
- certs = None
386
- policies = None
387
- trust = None
388
- try:
389
- # Only set a hostname on the policy if we're verifying the hostname
390
- # on the leaf certificate.
391
- if server_hostname is not None and ssl_context.check_hostname:
392
- cf_str_hostname = None
393
- try:
394
- cf_str_hostname = _bytes_to_cf_string(server_hostname.encode("ascii"))
395
- ssl_policy = Security.SecPolicyCreateSSL(True, cf_str_hostname)
396
- finally:
397
- if cf_str_hostname:
398
- CoreFoundation.CFRelease(cf_str_hostname)
399
- else:
400
- ssl_policy = Security.SecPolicyCreateSSL(True, None)
401
-
402
- policies = ssl_policy
403
- if ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_CHAIN:
404
- # Add explicit policy requiring positive revocation checks
405
- policies = CoreFoundation.CFArrayCreateMutable(
406
- CoreFoundation.kCFAllocatorDefault,
407
- 0,
408
- ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks),
409
- )
410
- CoreFoundation.CFArrayAppendValue(policies, ssl_policy)
411
- CoreFoundation.CFRelease(ssl_policy)
412
- revocation_policy = Security.SecPolicyCreateRevocation(
413
- kSecRevocationUseAnyAvailableMethod
414
- | kSecRevocationRequirePositiveResponse
415
- )
416
- CoreFoundation.CFArrayAppendValue(policies, revocation_policy)
417
- CoreFoundation.CFRelease(revocation_policy)
418
- elif ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_LEAF:
419
- raise NotImplementedError("VERIFY_CRL_CHECK_LEAF not implemented for macOS")
420
-
421
- certs = None
422
- try:
423
- certs = _der_certs_to_cf_cert_array(cert_chain)
424
-
425
- # Now that we have certificates loaded and a SecPolicy
426
- # we can finally create a SecTrust object!
427
- trust = Security.SecTrustRef()
428
- Security.SecTrustCreateWithCertificates(
429
- certs, policies, ctypes.byref(trust)
430
- )
431
-
432
- finally:
433
- # The certs are now being held by SecTrust so we can
434
- # release our handles for the array.
435
- if certs:
436
- CoreFoundation.CFRelease(certs)
437
-
438
- # If there are additional trust anchors to load we need to transform
439
- # the list of DER-encoded certificates into a CFArray.
440
- ctx_ca_certs_der: list[bytes] | None = ssl_context.get_ca_certs(
441
- binary_form=True
442
- )
443
- if ctx_ca_certs_der:
444
- ctx_ca_certs = None
445
- try:
446
- ctx_ca_certs = _der_certs_to_cf_cert_array(ctx_ca_certs_der)
447
- Security.SecTrustSetAnchorCertificates(trust, ctx_ca_certs)
448
- finally:
449
- if ctx_ca_certs:
450
- CoreFoundation.CFRelease(ctx_ca_certs)
451
-
452
- # We always want system certificates.
453
- Security.SecTrustSetAnchorCertificatesOnly(trust, False)
454
-
455
- # macOS 10.13 and earlier don't support SecTrustEvaluateWithError()
456
- # so we use SecTrustEvaluate() which means we need to construct error
457
- # messages ourselves.
458
- if _is_macos_version_10_14_or_later:
459
- _verify_peercerts_impl_macos_10_14(ssl_context, trust)
460
- else:
461
- _verify_peercerts_impl_macos_10_13(ssl_context, trust)
462
- finally:
463
- if policies:
464
- CoreFoundation.CFRelease(policies)
465
- if trust:
466
- CoreFoundation.CFRelease(trust)
467
-
468
-
469
- def _verify_peercerts_impl_macos_10_13(
470
- ssl_context: ssl.SSLContext, sec_trust_ref: typing.Any
471
- ) -> None:
472
- """Verify using 'SecTrustEvaluate' API for macOS 10.13 and earlier.
473
- macOS 10.14 added the 'SecTrustEvaluateWithError' API.
474
- """
475
- sec_trust_result_type = Security.SecTrustResultType()
476
- Security.SecTrustEvaluate(sec_trust_ref, ctypes.byref(sec_trust_result_type))
477
-
478
- try:
479
- sec_trust_result_type_as_int = int(sec_trust_result_type.value)
480
- except (ValueError, TypeError):
481
- sec_trust_result_type_as_int = -1
482
-
483
- # Apple doesn't document these values in their own API docs.
484
- # See: https://github.com/xybp888/iOS-SDKs/blob/master/iPhoneOS13.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecTrust.h#L84
485
- if (
486
- ssl_context.verify_mode == ssl.CERT_REQUIRED
487
- and sec_trust_result_type_as_int not in (1, 4)
488
- ):
489
- # Note that we're not able to ignore only hostname errors
490
- # for macOS 10.13 and earlier, so check_hostname=False will
491
- # still return an error.
492
- sec_trust_result_type_to_message = {
493
- 0: "Invalid trust result type",
494
- # 1: "Trust evaluation succeeded",
495
- 2: "User confirmation required",
496
- 3: "User specified that certificate is not trusted",
497
- # 4: "Trust result is unspecified",
498
- 5: "Recoverable trust failure occurred",
499
- 6: "Fatal trust failure occurred",
500
- 7: "Other error occurred, certificate may be revoked",
501
- }
502
- error_message = sec_trust_result_type_to_message.get(
503
- sec_trust_result_type_as_int,
504
- f"Unknown trust result: {sec_trust_result_type_as_int}",
505
- )
506
-
507
- err = ssl.SSLCertVerificationError(error_message)
508
- err.verify_message = error_message
509
- err.verify_code = sec_trust_result_type_as_int
510
- raise err
511
-
512
-
513
- def _verify_peercerts_impl_macos_10_14(
514
- ssl_context: ssl.SSLContext, sec_trust_ref: typing.Any
515
- ) -> None:
516
- """Verify using 'SecTrustEvaluateWithError' API for macOS 10.14+."""
517
- cf_error = CoreFoundation.CFErrorRef()
518
- sec_trust_eval_result = Security.SecTrustEvaluateWithError(
519
- sec_trust_ref, ctypes.byref(cf_error)
520
- )
521
- # sec_trust_eval_result is a bool (0 or 1)
522
- # where 1 means that the certs are trusted.
523
- if sec_trust_eval_result == 1:
524
- is_trusted = True
525
- elif sec_trust_eval_result == 0:
526
- is_trusted = False
527
- else:
528
- raise ssl.SSLError(
529
- f"Unknown result from Security.SecTrustEvaluateWithError: {sec_trust_eval_result!r}"
530
- )
531
-
532
- cf_error_code = 0
533
- if not is_trusted:
534
- cf_error_code = CoreFoundation.CFErrorGetCode(cf_error)
535
-
536
- # If the error is a known failure that we're
537
- # explicitly okay with from SSLContext configuration
538
- # we can set is_trusted accordingly.
539
- if ssl_context.verify_mode != ssl.CERT_REQUIRED and (
540
- cf_error_code == CFConst.errSecNotTrusted
541
- or cf_error_code == CFConst.errSecCertificateExpired
542
- ):
543
- is_trusted = True
544
-
545
- # If we're still not trusted then we start to
546
- # construct and raise the SSLCertVerificationError.
547
- if not is_trusted:
548
- cf_error_string_ref = None
549
- try:
550
- cf_error_string_ref = CoreFoundation.CFErrorCopyDescription(cf_error)
551
-
552
- # Can this ever return 'None' if there's a CFError?
553
- cf_error_message = (
554
- _cf_string_ref_to_str(cf_error_string_ref)
555
- or "Certificate verification failed"
556
- )
557
-
558
- # TODO: Not sure if we need the SecTrustResultType for anything?
559
- # We only care whether or not it's a success or failure for now.
560
- sec_trust_result_type = Security.SecTrustResultType()
561
- Security.SecTrustGetTrustResult(
562
- sec_trust_ref, ctypes.byref(sec_trust_result_type)
563
- )
564
-
565
- err = ssl.SSLCertVerificationError(cf_error_message)
566
- err.verify_message = cf_error_message
567
- err.verify_code = cf_error_code
568
- raise err
569
- finally:
570
- if cf_error_string_ref:
571
- CoreFoundation.CFRelease(cf_error_string_ref)
@@ -1,66 +0,0 @@
1
- import contextlib
2
- import os
3
- import re
4
- import ssl
5
- import typing
6
-
7
- # candidates based on https://github.com/tiran/certifi-system-store by Christian Heimes
8
- _CA_FILE_CANDIDATES = [
9
- # Alpine, Arch, Fedora 34+, OpenWRT, RHEL 9+, BSD
10
- "/etc/ssl/cert.pem",
11
- # Fedora <= 34, RHEL <= 9, CentOS <= 9
12
- "/etc/pki/tls/cert.pem",
13
- # Debian, Ubuntu (requires ca-certificates)
14
- "/etc/ssl/certs/ca-certificates.crt",
15
- # SUSE
16
- "/etc/ssl/ca-bundle.pem",
17
- ]
18
-
19
- _HASHED_CERT_FILENAME_RE = re.compile(r"^[0-9a-fA-F]{8}\.[0-9]$")
20
-
21
-
22
- @contextlib.contextmanager
23
- def _configure_context(ctx: ssl.SSLContext) -> typing.Iterator[None]:
24
- # First, check whether the default locations from OpenSSL
25
- # seem like they will give us a usable set of CA certs.
26
- # ssl.get_default_verify_paths already takes care of:
27
- # - getting cafile from either the SSL_CERT_FILE env var
28
- # or the path configured when OpenSSL was compiled,
29
- # and verifying that that path exists
30
- # - getting capath from either the SSL_CERT_DIR env var
31
- # or the path configured when OpenSSL was compiled,
32
- # and verifying that that path exists
33
- # In addition we'll check whether capath appears to contain certs.
34
- defaults = ssl.get_default_verify_paths()
35
- if defaults.cafile or (defaults.capath and _capath_contains_certs(defaults.capath)):
36
- ctx.set_default_verify_paths()
37
- else:
38
- # cafile from OpenSSL doesn't exist
39
- # and capath from OpenSSL doesn't contain certs.
40
- # Let's search other common locations instead.
41
- for cafile in _CA_FILE_CANDIDATES:
42
- if os.path.isfile(cafile):
43
- ctx.load_verify_locations(cafile=cafile)
44
- break
45
-
46
- yield
47
-
48
-
49
- def _capath_contains_certs(capath: str) -> bool:
50
- """Check whether capath exists and contains certs in the expected format."""
51
- if not os.path.isdir(capath):
52
- return False
53
- for name in os.listdir(capath):
54
- if _HASHED_CERT_FILENAME_RE.match(name):
55
- return True
56
- return False
57
-
58
-
59
- def _verify_peercerts_impl(
60
- ssl_context: ssl.SSLContext,
61
- cert_chain: list[bytes],
62
- server_hostname: str | None = None,
63
- ) -> None:
64
- # This is a no-op because we've enabled SSLContext's built-in
65
- # verification via verify_mode=CERT_REQUIRED, and don't need to repeat it.
66
- pass
@@ -1,31 +0,0 @@
1
- import ssl
2
- import sys
3
- import typing
4
-
5
- # Hold on to the original class so we can create it consistently
6
- # even if we inject our own SSLContext into the ssl module.
7
- _original_SSLContext = ssl.SSLContext
8
- _original_super_SSLContext = super(_original_SSLContext, _original_SSLContext)
9
-
10
- # CPython is known to be good, but non-CPython implementations
11
- # may implement SSLContext differently so to be safe we don't
12
- # subclass the SSLContext.
13
-
14
- # This is returned by truststore.SSLContext.__class__()
15
- _truststore_SSLContext_dunder_class: typing.Optional[type]
16
-
17
- # This value is the superclass of truststore.SSLContext.
18
- _truststore_SSLContext_super_class: type
19
-
20
- if sys.implementation.name == "cpython":
21
- _truststore_SSLContext_super_class = _original_SSLContext
22
- _truststore_SSLContext_dunder_class = None
23
- else:
24
- _truststore_SSLContext_super_class = object
25
- _truststore_SSLContext_dunder_class = _original_SSLContext
26
-
27
-
28
- def _set_ssl_context_verify_mode(
29
- ssl_context: ssl.SSLContext, verify_mode: ssl.VerifyMode
30
- ) -> None:
31
- _original_super_SSLContext.verify_mode.__set__(ssl_context, verify_mode) # type: ignore[attr-defined]