cli-ih 0.6.2.1__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 +51 -21
  2. cli_ih/client.py +14 -7
  3. {cli_ih-0.6.2.1.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.2.1.dist-info → cli_ih-0.6.3.1.dist-info}/WHEEL +1 -1
  6. {cli_ih-0.6.2.1.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.2.1.dist-info/RECORD +0 -8
@@ -0,0 +1,223 @@
1
+ import math
2
+ from functools import lru_cache
3
+ from time import monotonic
4
+ from typing import Iterable, List, Optional
5
+
6
+ from .color import Color, blend_rgb
7
+ from .color_triplet import ColorTriplet
8
+ from .console import Console, ConsoleOptions, RenderResult
9
+ from .jupyter import JupyterMixin
10
+ from .measure import Measurement
11
+ from .segment import Segment
12
+ from .style import Style, StyleType
13
+
14
+ # Number of characters before 'pulse' animation repeats
15
+ PULSE_SIZE = 20
16
+
17
+
18
+ class ProgressBar(JupyterMixin):
19
+ """Renders a (progress) bar. Used by rich.progress.
20
+
21
+ Args:
22
+ total (float, optional): Number of steps in the bar. Defaults to 100. Set to None to render a pulsing animation.
23
+ completed (float, optional): Number of steps completed. Defaults to 0.
24
+ width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None.
25
+ pulse (bool, optional): Enable pulse effect. Defaults to False. Will pulse if a None total was passed.
26
+ style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
27
+ complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
28
+ finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
29
+ pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
30
+ animation_time (Optional[float], optional): Time in seconds to use for animation, or None to use system time.
31
+ """
32
+
33
+ def __init__(
34
+ self,
35
+ total: Optional[float] = 100.0,
36
+ completed: float = 0,
37
+ width: Optional[int] = None,
38
+ pulse: bool = False,
39
+ style: StyleType = "bar.back",
40
+ complete_style: StyleType = "bar.complete",
41
+ finished_style: StyleType = "bar.finished",
42
+ pulse_style: StyleType = "bar.pulse",
43
+ animation_time: Optional[float] = None,
44
+ ):
45
+ self.total = total
46
+ self.completed = completed
47
+ self.width = width
48
+ self.pulse = pulse
49
+ self.style = style
50
+ self.complete_style = complete_style
51
+ self.finished_style = finished_style
52
+ self.pulse_style = pulse_style
53
+ self.animation_time = animation_time
54
+
55
+ self._pulse_segments: Optional[List[Segment]] = None
56
+
57
+ def __repr__(self) -> str:
58
+ return f"<Bar {self.completed!r} of {self.total!r}>"
59
+
60
+ @property
61
+ def percentage_completed(self) -> Optional[float]:
62
+ """Calculate percentage complete."""
63
+ if self.total is None:
64
+ return None
65
+ completed = (self.completed / self.total) * 100.0
66
+ completed = min(100, max(0.0, completed))
67
+ return completed
68
+
69
+ @lru_cache(maxsize=16)
70
+ def _get_pulse_segments(
71
+ self,
72
+ fore_style: Style,
73
+ back_style: Style,
74
+ color_system: str,
75
+ no_color: bool,
76
+ ascii: bool = False,
77
+ ) -> List[Segment]:
78
+ """Get a list of segments to render a pulse animation.
79
+
80
+ Returns:
81
+ List[Segment]: A list of segments, one segment per character.
82
+ """
83
+ bar = "-" if ascii else "━"
84
+ segments: List[Segment] = []
85
+ if color_system not in ("standard", "eight_bit", "truecolor") or no_color:
86
+ segments += [Segment(bar, fore_style)] * (PULSE_SIZE // 2)
87
+ segments += [Segment(" " if no_color else bar, back_style)] * (
88
+ PULSE_SIZE - (PULSE_SIZE // 2)
89
+ )
90
+ return segments
91
+
92
+ append = segments.append
93
+ fore_color = (
94
+ fore_style.color.get_truecolor()
95
+ if fore_style.color
96
+ else ColorTriplet(255, 0, 255)
97
+ )
98
+ back_color = (
99
+ back_style.color.get_truecolor()
100
+ if back_style.color
101
+ else ColorTriplet(0, 0, 0)
102
+ )
103
+ cos = math.cos
104
+ pi = math.pi
105
+ _Segment = Segment
106
+ _Style = Style
107
+ from_triplet = Color.from_triplet
108
+
109
+ for index in range(PULSE_SIZE):
110
+ position = index / PULSE_SIZE
111
+ fade = 0.5 + cos(position * pi * 2) / 2.0
112
+ color = blend_rgb(fore_color, back_color, cross_fade=fade)
113
+ append(_Segment(bar, _Style(color=from_triplet(color))))
114
+ return segments
115
+
116
+ def update(self, completed: float, total: Optional[float] = None) -> None:
117
+ """Update progress with new values.
118
+
119
+ Args:
120
+ completed (float): Number of steps completed.
121
+ total (float, optional): Total number of steps, or ``None`` to not change. Defaults to None.
122
+ """
123
+ self.completed = completed
124
+ self.total = total if total is not None else self.total
125
+
126
+ def _render_pulse(
127
+ self, console: Console, width: int, ascii: bool = False
128
+ ) -> Iterable[Segment]:
129
+ """Renders the pulse animation.
130
+
131
+ Args:
132
+ console (Console): Console instance.
133
+ width (int): Width in characters of pulse animation.
134
+
135
+ Returns:
136
+ RenderResult: [description]
137
+
138
+ Yields:
139
+ Iterator[Segment]: Segments to render pulse
140
+ """
141
+ fore_style = console.get_style(self.pulse_style, default="white")
142
+ back_style = console.get_style(self.style, default="black")
143
+
144
+ pulse_segments = self._get_pulse_segments(
145
+ fore_style, back_style, console.color_system, console.no_color, ascii=ascii
146
+ )
147
+ segment_count = len(pulse_segments)
148
+ current_time = (
149
+ monotonic() if self.animation_time is None else self.animation_time
150
+ )
151
+ segments = pulse_segments * (int(width / segment_count) + 2)
152
+ offset = int(-current_time * 15) % segment_count
153
+ segments = segments[offset : offset + width]
154
+ yield from segments
155
+
156
+ def __rich_console__(
157
+ self, console: Console, options: ConsoleOptions
158
+ ) -> RenderResult:
159
+ width = min(self.width or options.max_width, options.max_width)
160
+ ascii = options.legacy_windows or options.ascii_only
161
+ should_pulse = self.pulse or self.total is None
162
+ if should_pulse:
163
+ yield from self._render_pulse(console, width, ascii=ascii)
164
+ return
165
+
166
+ completed: Optional[float] = (
167
+ min(self.total, max(0, self.completed)) if self.total is not None else None
168
+ )
169
+
170
+ bar = "-" if ascii else "━"
171
+ half_bar_right = " " if ascii else "╸"
172
+ half_bar_left = " " if ascii else "╺"
173
+ complete_halves = (
174
+ int(width * 2 * completed / self.total)
175
+ if self.total and completed is not None
176
+ else width * 2
177
+ )
178
+ bar_count = complete_halves // 2
179
+ half_bar_count = complete_halves % 2
180
+ style = console.get_style(self.style)
181
+ is_finished = self.total is None or self.completed >= self.total
182
+ complete_style = console.get_style(
183
+ self.finished_style if is_finished else self.complete_style
184
+ )
185
+ _Segment = Segment
186
+ if bar_count:
187
+ yield _Segment(bar * bar_count, complete_style)
188
+ if half_bar_count:
189
+ yield _Segment(half_bar_right * half_bar_count, complete_style)
190
+
191
+ if not console.no_color:
192
+ remaining_bars = width - bar_count - half_bar_count
193
+ if remaining_bars and console.color_system is not None:
194
+ if not half_bar_count and bar_count:
195
+ yield _Segment(half_bar_left, style)
196
+ remaining_bars -= 1
197
+ if remaining_bars:
198
+ yield _Segment(bar * remaining_bars, style)
199
+
200
+ def __rich_measure__(
201
+ self, console: Console, options: ConsoleOptions
202
+ ) -> Measurement:
203
+ return (
204
+ Measurement(self.width, self.width)
205
+ if self.width is not None
206
+ else Measurement(4, options.max_width)
207
+ )
208
+
209
+
210
+ if __name__ == "__main__": # pragma: no cover
211
+ console = Console()
212
+ bar = ProgressBar(width=50, total=100)
213
+
214
+ import time
215
+
216
+ console.show_cursor(False)
217
+ for n in range(0, 101, 1):
218
+ bar.update(n)
219
+ console.print(bar)
220
+ console.file.write("\r")
221
+ time.sleep(0.05)
222
+ console.show_cursor(True)
223
+ console.print()
@@ -0,0 +1,400 @@
1
+ from typing import Any, Generic, List, Optional, TextIO, TypeVar, Union, overload
2
+
3
+ from . import get_console
4
+ from .console import Console
5
+ from .text import Text, TextType
6
+
7
+ PromptType = TypeVar("PromptType")
8
+ DefaultType = TypeVar("DefaultType")
9
+
10
+
11
+ class PromptError(Exception):
12
+ """Exception base class for prompt related errors."""
13
+
14
+
15
+ class InvalidResponse(PromptError):
16
+ """Exception to indicate a response was invalid. Raise this within process_response() to indicate an error
17
+ and provide an error message.
18
+
19
+ Args:
20
+ message (Union[str, Text]): Error message.
21
+ """
22
+
23
+ def __init__(self, message: TextType) -> None:
24
+ self.message = message
25
+
26
+ def __rich__(self) -> TextType:
27
+ return self.message
28
+
29
+
30
+ class PromptBase(Generic[PromptType]):
31
+ """Ask the user for input until a valid response is received. This is the base class, see one of
32
+ the concrete classes for examples.
33
+
34
+ Args:
35
+ prompt (TextType, optional): Prompt text. Defaults to "".
36
+ console (Console, optional): A Console instance or None to use global console. Defaults to None.
37
+ password (bool, optional): Enable password input. Defaults to False.
38
+ choices (List[str], optional): A list of valid choices. Defaults to None.
39
+ case_sensitive (bool, optional): Matching of choices should be case-sensitive. Defaults to True.
40
+ show_default (bool, optional): Show default in prompt. Defaults to True.
41
+ show_choices (bool, optional): Show choices in prompt. Defaults to True.
42
+ """
43
+
44
+ response_type: type = str
45
+
46
+ validate_error_message = "[prompt.invalid]Please enter a valid value"
47
+ illegal_choice_message = (
48
+ "[prompt.invalid.choice]Please select one of the available options"
49
+ )
50
+ prompt_suffix = ": "
51
+
52
+ choices: Optional[List[str]] = None
53
+
54
+ def __init__(
55
+ self,
56
+ prompt: TextType = "",
57
+ *,
58
+ console: Optional[Console] = None,
59
+ password: bool = False,
60
+ choices: Optional[List[str]] = None,
61
+ case_sensitive: bool = True,
62
+ show_default: bool = True,
63
+ show_choices: bool = True,
64
+ ) -> None:
65
+ self.console = console or get_console()
66
+ self.prompt = (
67
+ Text.from_markup(prompt, style="prompt")
68
+ if isinstance(prompt, str)
69
+ else prompt
70
+ )
71
+ self.password = password
72
+ if choices is not None:
73
+ self.choices = choices
74
+ self.case_sensitive = case_sensitive
75
+ self.show_default = show_default
76
+ self.show_choices = show_choices
77
+
78
+ @classmethod
79
+ @overload
80
+ def ask(
81
+ cls,
82
+ prompt: TextType = "",
83
+ *,
84
+ console: Optional[Console] = None,
85
+ password: bool = False,
86
+ choices: Optional[List[str]] = None,
87
+ case_sensitive: bool = True,
88
+ show_default: bool = True,
89
+ show_choices: bool = True,
90
+ default: DefaultType,
91
+ stream: Optional[TextIO] = None,
92
+ ) -> Union[DefaultType, PromptType]:
93
+ ...
94
+
95
+ @classmethod
96
+ @overload
97
+ def ask(
98
+ cls,
99
+ prompt: TextType = "",
100
+ *,
101
+ console: Optional[Console] = None,
102
+ password: bool = False,
103
+ choices: Optional[List[str]] = None,
104
+ case_sensitive: bool = True,
105
+ show_default: bool = True,
106
+ show_choices: bool = True,
107
+ stream: Optional[TextIO] = None,
108
+ ) -> PromptType:
109
+ ...
110
+
111
+ @classmethod
112
+ def ask(
113
+ cls,
114
+ prompt: TextType = "",
115
+ *,
116
+ console: Optional[Console] = None,
117
+ password: bool = False,
118
+ choices: Optional[List[str]] = None,
119
+ case_sensitive: bool = True,
120
+ show_default: bool = True,
121
+ show_choices: bool = True,
122
+ default: Any = ...,
123
+ stream: Optional[TextIO] = None,
124
+ ) -> Any:
125
+ """Shortcut to construct and run a prompt loop and return the result.
126
+
127
+ Example:
128
+ >>> filename = Prompt.ask("Enter a filename")
129
+
130
+ Args:
131
+ prompt (TextType, optional): Prompt text. Defaults to "".
132
+ console (Console, optional): A Console instance or None to use global console. Defaults to None.
133
+ password (bool, optional): Enable password input. Defaults to False.
134
+ choices (List[str], optional): A list of valid choices. Defaults to None.
135
+ case_sensitive (bool, optional): Matching of choices should be case-sensitive. Defaults to True.
136
+ show_default (bool, optional): Show default in prompt. Defaults to True.
137
+ show_choices (bool, optional): Show choices in prompt. Defaults to True.
138
+ stream (TextIO, optional): Optional text file open for reading to get input. Defaults to None.
139
+ """
140
+ _prompt = cls(
141
+ prompt,
142
+ console=console,
143
+ password=password,
144
+ choices=choices,
145
+ case_sensitive=case_sensitive,
146
+ show_default=show_default,
147
+ show_choices=show_choices,
148
+ )
149
+ return _prompt(default=default, stream=stream)
150
+
151
+ def render_default(self, default: DefaultType) -> Text:
152
+ """Turn the supplied default in to a Text instance.
153
+
154
+ Args:
155
+ default (DefaultType): Default value.
156
+
157
+ Returns:
158
+ Text: Text containing rendering of default value.
159
+ """
160
+ return Text(f"({default})", "prompt.default")
161
+
162
+ def make_prompt(self, default: DefaultType) -> Text:
163
+ """Make prompt text.
164
+
165
+ Args:
166
+ default (DefaultType): Default value.
167
+
168
+ Returns:
169
+ Text: Text to display in prompt.
170
+ """
171
+ prompt = self.prompt.copy()
172
+ prompt.end = ""
173
+
174
+ if self.show_choices and self.choices:
175
+ _choices = "/".join(self.choices)
176
+ choices = f"[{_choices}]"
177
+ prompt.append(" ")
178
+ prompt.append(choices, "prompt.choices")
179
+
180
+ if (
181
+ default != ...
182
+ and self.show_default
183
+ and isinstance(default, (str, self.response_type))
184
+ ):
185
+ prompt.append(" ")
186
+ _default = self.render_default(default)
187
+ prompt.append(_default)
188
+
189
+ prompt.append(self.prompt_suffix)
190
+
191
+ return prompt
192
+
193
+ @classmethod
194
+ def get_input(
195
+ cls,
196
+ console: Console,
197
+ prompt: TextType,
198
+ password: bool,
199
+ stream: Optional[TextIO] = None,
200
+ ) -> str:
201
+ """Get input from user.
202
+
203
+ Args:
204
+ console (Console): Console instance.
205
+ prompt (TextType): Prompt text.
206
+ password (bool): Enable password entry.
207
+
208
+ Returns:
209
+ str: String from user.
210
+ """
211
+ return console.input(prompt, password=password, stream=stream)
212
+
213
+ def check_choice(self, value: str) -> bool:
214
+ """Check value is in the list of valid choices.
215
+
216
+ Args:
217
+ value (str): Value entered by user.
218
+
219
+ Returns:
220
+ bool: True if choice was valid, otherwise False.
221
+ """
222
+ assert self.choices is not None
223
+ if self.case_sensitive:
224
+ return value.strip() in self.choices
225
+ return value.strip().lower() in [choice.lower() for choice in self.choices]
226
+
227
+ def process_response(self, value: str) -> PromptType:
228
+ """Process response from user, convert to prompt type.
229
+
230
+ Args:
231
+ value (str): String typed by user.
232
+
233
+ Raises:
234
+ InvalidResponse: If ``value`` is invalid.
235
+
236
+ Returns:
237
+ PromptType: The value to be returned from ask method.
238
+ """
239
+ value = value.strip()
240
+ try:
241
+ return_value: PromptType = self.response_type(value)
242
+ except ValueError:
243
+ raise InvalidResponse(self.validate_error_message)
244
+
245
+ if self.choices is not None:
246
+ if not self.check_choice(value):
247
+ raise InvalidResponse(self.illegal_choice_message)
248
+
249
+ if not self.case_sensitive:
250
+ # return the original choice, not the lower case version
251
+ return_value = self.response_type(
252
+ self.choices[
253
+ [choice.lower() for choice in self.choices].index(value.lower())
254
+ ]
255
+ )
256
+ return return_value
257
+
258
+ def on_validate_error(self, value: str, error: InvalidResponse) -> None:
259
+ """Called to handle validation error.
260
+
261
+ Args:
262
+ value (str): String entered by user.
263
+ error (InvalidResponse): Exception instance the initiated the error.
264
+ """
265
+ self.console.print(error)
266
+
267
+ def pre_prompt(self) -> None:
268
+ """Hook to display something before the prompt."""
269
+
270
+ @overload
271
+ def __call__(self, *, stream: Optional[TextIO] = None) -> PromptType:
272
+ ...
273
+
274
+ @overload
275
+ def __call__(
276
+ self, *, default: DefaultType, stream: Optional[TextIO] = None
277
+ ) -> Union[PromptType, DefaultType]:
278
+ ...
279
+
280
+ def __call__(self, *, default: Any = ..., stream: Optional[TextIO] = None) -> Any:
281
+ """Run the prompt loop.
282
+
283
+ Args:
284
+ default (Any, optional): Optional default value.
285
+
286
+ Returns:
287
+ PromptType: Processed value.
288
+ """
289
+ while True:
290
+ self.pre_prompt()
291
+ prompt = self.make_prompt(default)
292
+ value = self.get_input(self.console, prompt, self.password, stream=stream)
293
+ if value == "" and default != ...:
294
+ return default
295
+ try:
296
+ return_value = self.process_response(value)
297
+ except InvalidResponse as error:
298
+ self.on_validate_error(value, error)
299
+ continue
300
+ else:
301
+ return return_value
302
+
303
+
304
+ class Prompt(PromptBase[str]):
305
+ """A prompt that returns a str.
306
+
307
+ Example:
308
+ >>> name = Prompt.ask("Enter your name")
309
+
310
+
311
+ """
312
+
313
+ response_type = str
314
+
315
+
316
+ class IntPrompt(PromptBase[int]):
317
+ """A prompt that returns an integer.
318
+
319
+ Example:
320
+ >>> burrito_count = IntPrompt.ask("How many burritos do you want to order")
321
+
322
+ """
323
+
324
+ response_type = int
325
+ validate_error_message = "[prompt.invalid]Please enter a valid integer number"
326
+
327
+
328
+ class FloatPrompt(PromptBase[float]):
329
+ """A prompt that returns a float.
330
+
331
+ Example:
332
+ >>> temperature = FloatPrompt.ask("Enter desired temperature")
333
+
334
+ """
335
+
336
+ response_type = float
337
+ validate_error_message = "[prompt.invalid]Please enter a number"
338
+
339
+
340
+ class Confirm(PromptBase[bool]):
341
+ """A yes / no confirmation prompt.
342
+
343
+ Example:
344
+ >>> if Confirm.ask("Continue"):
345
+ run_job()
346
+
347
+ """
348
+
349
+ response_type = bool
350
+ validate_error_message = "[prompt.invalid]Please enter Y or N"
351
+ choices: List[str] = ["y", "n"]
352
+
353
+ def render_default(self, default: DefaultType) -> Text:
354
+ """Render the default as (y) or (n) rather than True/False."""
355
+ yes, no = self.choices
356
+ return Text(f"({yes})" if default else f"({no})", style="prompt.default")
357
+
358
+ def process_response(self, value: str) -> bool:
359
+ """Convert choices to a bool."""
360
+ value = value.strip().lower()
361
+ if value not in self.choices:
362
+ raise InvalidResponse(self.validate_error_message)
363
+ return value == self.choices[0]
364
+
365
+
366
+ if __name__ == "__main__": # pragma: no cover
367
+ from pip._vendor.rich import print
368
+
369
+ if Confirm.ask("Run [i]prompt[/i] tests?", default=True):
370
+ while True:
371
+ result = IntPrompt.ask(
372
+ ":rocket: Enter a number between [b]1[/b] and [b]10[/b]", default=5
373
+ )
374
+ if result >= 1 and result <= 10:
375
+ break
376
+ print(":pile_of_poo: [prompt.invalid]Number must be between 1 and 10")
377
+ print(f"number={result}")
378
+
379
+ while True:
380
+ password = Prompt.ask(
381
+ "Please enter a password [cyan](must be at least 5 characters)",
382
+ password=True,
383
+ )
384
+ if len(password) >= 5:
385
+ break
386
+ print("[prompt.invalid]password too short")
387
+ print(f"password={password!r}")
388
+
389
+ fruit = Prompt.ask("Enter a fruit", choices=["apple", "orange", "pear"])
390
+ print(f"fruit={fruit!r}")
391
+
392
+ doggie = Prompt.ask(
393
+ "What's the best Dog? (Case INSENSITIVE)",
394
+ choices=["Border Terrier", "Collie", "Labradoodle"],
395
+ case_sensitive=False,
396
+ )
397
+ print(f"doggie={doggie!r}")
398
+
399
+ else:
400
+ print("[b]OK :loudly_crying_face:")
@@ -0,0 +1,42 @@
1
+ from typing import Any, cast, Set, TYPE_CHECKING
2
+ from inspect import isclass
3
+
4
+ if TYPE_CHECKING:
5
+ from pip._vendor.rich.console import RenderableType
6
+
7
+ _GIBBERISH = """aihwerij235234ljsdnp34ksodfipwoe234234jlskjdf"""
8
+
9
+
10
+ def is_renderable(check_object: Any) -> bool:
11
+ """Check if an object may be rendered by Rich."""
12
+ return (
13
+ isinstance(check_object, str)
14
+ or hasattr(check_object, "__rich__")
15
+ or hasattr(check_object, "__rich_console__")
16
+ )
17
+
18
+
19
+ def rich_cast(renderable: object) -> "RenderableType":
20
+ """Cast an object to a renderable by calling __rich__ if present.
21
+
22
+ Args:
23
+ renderable (object): A potentially renderable object
24
+
25
+ Returns:
26
+ object: The result of recursively calling __rich__.
27
+ """
28
+ from pip._vendor.rich.console import RenderableType
29
+
30
+ rich_visited_set: Set[type] = set() # Prevent potential infinite loop
31
+ while hasattr(renderable, "__rich__") and not isclass(renderable):
32
+ # Detect object which claim to have all the attributes
33
+ if hasattr(renderable, _GIBBERISH):
34
+ return repr(renderable)
35
+ cast_method = getattr(renderable, "__rich__")
36
+ renderable = cast_method()
37
+ renderable_type = type(renderable)
38
+ if renderable_type in rich_visited_set:
39
+ break
40
+ rich_visited_set.add(renderable_type)
41
+
42
+ return cast(RenderableType, renderable)
File without changes
@@ -0,0 +1,10 @@
1
+ from typing import NamedTuple
2
+
3
+
4
+ class Region(NamedTuple):
5
+ """Defines a rectangular region of the screen."""
6
+
7
+ x: int
8
+ y: int
9
+ width: int
10
+ height: int