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,796 +0,0 @@
1
- import sys
2
- from functools import lru_cache
3
- from marshal import dumps, loads
4
- from random import randint
5
- from typing import Any, Dict, Iterable, List, Optional, Type, Union, cast
6
-
7
- from . import errors
8
- from .color import Color, ColorParseError, ColorSystem, blend_rgb
9
- from .repr import Result, rich_repr
10
- from .terminal_theme import DEFAULT_TERMINAL_THEME, TerminalTheme
11
-
12
- # Style instances and style definitions are often interchangeable
13
- StyleType = Union[str, "Style"]
14
-
15
-
16
- class _Bit:
17
- """A descriptor to get/set a style attribute bit."""
18
-
19
- __slots__ = ["bit"]
20
-
21
- def __init__(self, bit_no: int) -> None:
22
- self.bit = 1 << bit_no
23
-
24
- def __get__(self, obj: "Style", objtype: Type["Style"]) -> Optional[bool]:
25
- if obj._set_attributes & self.bit:
26
- return obj._attributes & self.bit != 0
27
- return None
28
-
29
-
30
- @rich_repr
31
- class Style:
32
- """A terminal style.
33
-
34
- A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such
35
- as bold, italic etc. The attributes have 3 states: they can either be on
36
- (``True``), off (``False``), or not set (``None``).
37
-
38
- Args:
39
- color (Union[Color, str], optional): Color of terminal text. Defaults to None.
40
- bgcolor (Union[Color, str], optional): Color of terminal background. Defaults to None.
41
- bold (bool, optional): Enable bold text. Defaults to None.
42
- dim (bool, optional): Enable dim text. Defaults to None.
43
- italic (bool, optional): Enable italic text. Defaults to None.
44
- underline (bool, optional): Enable underlined text. Defaults to None.
45
- blink (bool, optional): Enabled blinking text. Defaults to None.
46
- blink2 (bool, optional): Enable fast blinking text. Defaults to None.
47
- reverse (bool, optional): Enabled reverse text. Defaults to None.
48
- conceal (bool, optional): Enable concealed text. Defaults to None.
49
- strike (bool, optional): Enable strikethrough text. Defaults to None.
50
- underline2 (bool, optional): Enable doubly underlined text. Defaults to None.
51
- frame (bool, optional): Enable framed text. Defaults to None.
52
- encircle (bool, optional): Enable encircled text. Defaults to None.
53
- overline (bool, optional): Enable overlined text. Defaults to None.
54
- link (str, link): Link URL. Defaults to None.
55
-
56
- """
57
-
58
- _color: Optional[Color]
59
- _bgcolor: Optional[Color]
60
- _attributes: int
61
- _set_attributes: int
62
- _hash: Optional[int]
63
- _null: bool
64
- _meta: Optional[bytes]
65
-
66
- __slots__ = [
67
- "_color",
68
- "_bgcolor",
69
- "_attributes",
70
- "_set_attributes",
71
- "_link",
72
- "_link_id",
73
- "_ansi",
74
- "_style_definition",
75
- "_hash",
76
- "_null",
77
- "_meta",
78
- ]
79
-
80
- # maps bits on to SGR parameter
81
- _style_map = {
82
- 0: "1",
83
- 1: "2",
84
- 2: "3",
85
- 3: "4",
86
- 4: "5",
87
- 5: "6",
88
- 6: "7",
89
- 7: "8",
90
- 8: "9",
91
- 9: "21",
92
- 10: "51",
93
- 11: "52",
94
- 12: "53",
95
- }
96
-
97
- STYLE_ATTRIBUTES = {
98
- "dim": "dim",
99
- "d": "dim",
100
- "bold": "bold",
101
- "b": "bold",
102
- "italic": "italic",
103
- "i": "italic",
104
- "underline": "underline",
105
- "u": "underline",
106
- "blink": "blink",
107
- "blink2": "blink2",
108
- "reverse": "reverse",
109
- "r": "reverse",
110
- "conceal": "conceal",
111
- "c": "conceal",
112
- "strike": "strike",
113
- "s": "strike",
114
- "underline2": "underline2",
115
- "uu": "underline2",
116
- "frame": "frame",
117
- "encircle": "encircle",
118
- "overline": "overline",
119
- "o": "overline",
120
- }
121
-
122
- def __init__(
123
- self,
124
- *,
125
- color: Optional[Union[Color, str]] = None,
126
- bgcolor: Optional[Union[Color, str]] = None,
127
- bold: Optional[bool] = None,
128
- dim: Optional[bool] = None,
129
- italic: Optional[bool] = None,
130
- underline: Optional[bool] = None,
131
- blink: Optional[bool] = None,
132
- blink2: Optional[bool] = None,
133
- reverse: Optional[bool] = None,
134
- conceal: Optional[bool] = None,
135
- strike: Optional[bool] = None,
136
- underline2: Optional[bool] = None,
137
- frame: Optional[bool] = None,
138
- encircle: Optional[bool] = None,
139
- overline: Optional[bool] = None,
140
- link: Optional[str] = None,
141
- meta: Optional[Dict[str, Any]] = None,
142
- ):
143
- self._ansi: Optional[str] = None
144
- self._style_definition: Optional[str] = None
145
-
146
- def _make_color(color: Union[Color, str]) -> Color:
147
- return color if isinstance(color, Color) else Color.parse(color)
148
-
149
- self._color = None if color is None else _make_color(color)
150
- self._bgcolor = None if bgcolor is None else _make_color(bgcolor)
151
- self._set_attributes = sum(
152
- (
153
- bold is not None,
154
- dim is not None and 2,
155
- italic is not None and 4,
156
- underline is not None and 8,
157
- blink is not None and 16,
158
- blink2 is not None and 32,
159
- reverse is not None and 64,
160
- conceal is not None and 128,
161
- strike is not None and 256,
162
- underline2 is not None and 512,
163
- frame is not None and 1024,
164
- encircle is not None and 2048,
165
- overline is not None and 4096,
166
- )
167
- )
168
- self._attributes = (
169
- sum(
170
- (
171
- bold and 1 or 0,
172
- dim and 2 or 0,
173
- italic and 4 or 0,
174
- underline and 8 or 0,
175
- blink and 16 or 0,
176
- blink2 and 32 or 0,
177
- reverse and 64 or 0,
178
- conceal and 128 or 0,
179
- strike and 256 or 0,
180
- underline2 and 512 or 0,
181
- frame and 1024 or 0,
182
- encircle and 2048 or 0,
183
- overline and 4096 or 0,
184
- )
185
- )
186
- if self._set_attributes
187
- else 0
188
- )
189
-
190
- self._link = link
191
- self._meta = None if meta is None else dumps(meta)
192
- self._link_id = (
193
- f"{randint(0, 999999)}{hash(self._meta)}" if (link or meta) else ""
194
- )
195
- self._hash: Optional[int] = None
196
- self._null = not (self._set_attributes or color or bgcolor or link or meta)
197
-
198
- @classmethod
199
- def null(cls) -> "Style":
200
- """Create an 'null' style, equivalent to Style(), but more performant."""
201
- return NULL_STYLE
202
-
203
- @classmethod
204
- def from_color(
205
- cls, color: Optional[Color] = None, bgcolor: Optional[Color] = None
206
- ) -> "Style":
207
- """Create a new style with colors and no attributes.
208
-
209
- Returns:
210
- color (Optional[Color]): A (foreground) color, or None for no color. Defaults to None.
211
- bgcolor (Optional[Color]): A (background) color, or None for no color. Defaults to None.
212
- """
213
- style: Style = cls.__new__(Style)
214
- style._ansi = None
215
- style._style_definition = None
216
- style._color = color
217
- style._bgcolor = bgcolor
218
- style._set_attributes = 0
219
- style._attributes = 0
220
- style._link = None
221
- style._link_id = ""
222
- style._meta = None
223
- style._null = not (color or bgcolor)
224
- style._hash = None
225
- return style
226
-
227
- @classmethod
228
- def from_meta(cls, meta: Optional[Dict[str, Any]]) -> "Style":
229
- """Create a new style with meta data.
230
-
231
- Returns:
232
- meta (Optional[Dict[str, Any]]): A dictionary of meta data. Defaults to None.
233
- """
234
- style: Style = cls.__new__(Style)
235
- style._ansi = None
236
- style._style_definition = None
237
- style._color = None
238
- style._bgcolor = None
239
- style._set_attributes = 0
240
- style._attributes = 0
241
- style._link = None
242
- style._meta = dumps(meta)
243
- style._link_id = f"{randint(0, 999999)}{hash(style._meta)}"
244
- style._hash = None
245
- style._null = not (meta)
246
- return style
247
-
248
- @classmethod
249
- def on(cls, meta: Optional[Dict[str, Any]] = None, **handlers: Any) -> "Style":
250
- """Create a blank style with meta information.
251
-
252
- Example:
253
- style = Style.on(click=self.on_click)
254
-
255
- Args:
256
- meta (Optional[Dict[str, Any]], optional): An optional dict of meta information.
257
- **handlers (Any): Keyword arguments are translated in to handlers.
258
-
259
- Returns:
260
- Style: A Style with meta information attached.
261
- """
262
- meta = {} if meta is None else meta
263
- meta.update({f"@{key}": value for key, value in handlers.items()})
264
- return cls.from_meta(meta)
265
-
266
- bold = _Bit(0)
267
- dim = _Bit(1)
268
- italic = _Bit(2)
269
- underline = _Bit(3)
270
- blink = _Bit(4)
271
- blink2 = _Bit(5)
272
- reverse = _Bit(6)
273
- conceal = _Bit(7)
274
- strike = _Bit(8)
275
- underline2 = _Bit(9)
276
- frame = _Bit(10)
277
- encircle = _Bit(11)
278
- overline = _Bit(12)
279
-
280
- @property
281
- def link_id(self) -> str:
282
- """Get a link id, used in ansi code for links."""
283
- return self._link_id
284
-
285
- def __str__(self) -> str:
286
- """Re-generate style definition from attributes."""
287
- if self._style_definition is None:
288
- attributes: List[str] = []
289
- append = attributes.append
290
- bits = self._set_attributes
291
- if bits & 0b0000000001111:
292
- if bits & 1:
293
- append("bold" if self.bold else "not bold")
294
- if bits & (1 << 1):
295
- append("dim" if self.dim else "not dim")
296
- if bits & (1 << 2):
297
- append("italic" if self.italic else "not italic")
298
- if bits & (1 << 3):
299
- append("underline" if self.underline else "not underline")
300
- if bits & 0b0000111110000:
301
- if bits & (1 << 4):
302
- append("blink" if self.blink else "not blink")
303
- if bits & (1 << 5):
304
- append("blink2" if self.blink2 else "not blink2")
305
- if bits & (1 << 6):
306
- append("reverse" if self.reverse else "not reverse")
307
- if bits & (1 << 7):
308
- append("conceal" if self.conceal else "not conceal")
309
- if bits & (1 << 8):
310
- append("strike" if self.strike else "not strike")
311
- if bits & 0b1111000000000:
312
- if bits & (1 << 9):
313
- append("underline2" if self.underline2 else "not underline2")
314
- if bits & (1 << 10):
315
- append("frame" if self.frame else "not frame")
316
- if bits & (1 << 11):
317
- append("encircle" if self.encircle else "not encircle")
318
- if bits & (1 << 12):
319
- append("overline" if self.overline else "not overline")
320
- if self._color is not None:
321
- append(self._color.name)
322
- if self._bgcolor is not None:
323
- append("on")
324
- append(self._bgcolor.name)
325
- if self._link:
326
- append("link")
327
- append(self._link)
328
- self._style_definition = " ".join(attributes) or "none"
329
- return self._style_definition
330
-
331
- def __bool__(self) -> bool:
332
- """A Style is false if it has no attributes, colors, or links."""
333
- return not self._null
334
-
335
- def _make_ansi_codes(self, color_system: ColorSystem) -> str:
336
- """Generate ANSI codes for this style.
337
-
338
- Args:
339
- color_system (ColorSystem): Color system.
340
-
341
- Returns:
342
- str: String containing codes.
343
- """
344
-
345
- if self._ansi is None:
346
- sgr: List[str] = []
347
- append = sgr.append
348
- _style_map = self._style_map
349
- attributes = self._attributes & self._set_attributes
350
- if attributes:
351
- if attributes & 1:
352
- append(_style_map[0])
353
- if attributes & 2:
354
- append(_style_map[1])
355
- if attributes & 4:
356
- append(_style_map[2])
357
- if attributes & 8:
358
- append(_style_map[3])
359
- if attributes & 0b0000111110000:
360
- for bit in range(4, 9):
361
- if attributes & (1 << bit):
362
- append(_style_map[bit])
363
- if attributes & 0b1111000000000:
364
- for bit in range(9, 13):
365
- if attributes & (1 << bit):
366
- append(_style_map[bit])
367
- if self._color is not None:
368
- sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
369
- if self._bgcolor is not None:
370
- sgr.extend(
371
- self._bgcolor.downgrade(color_system).get_ansi_codes(
372
- foreground=False
373
- )
374
- )
375
- self._ansi = ";".join(sgr)
376
- return self._ansi
377
-
378
- @classmethod
379
- @lru_cache(maxsize=1024)
380
- def normalize(cls, style: str) -> str:
381
- """Normalize a style definition so that styles with the same effect have the same string
382
- representation.
383
-
384
- Args:
385
- style (str): A style definition.
386
-
387
- Returns:
388
- str: Normal form of style definition.
389
- """
390
- try:
391
- return str(cls.parse(style))
392
- except errors.StyleSyntaxError:
393
- return style.strip().lower()
394
-
395
- @classmethod
396
- def pick_first(cls, *values: Optional[StyleType]) -> StyleType:
397
- """Pick first non-None style."""
398
- for value in values:
399
- if value is not None:
400
- return value
401
- raise ValueError("expected at least one non-None style")
402
-
403
- def __rich_repr__(self) -> Result:
404
- yield "color", self.color, None
405
- yield "bgcolor", self.bgcolor, None
406
- yield "bold", self.bold, None,
407
- yield "dim", self.dim, None,
408
- yield "italic", self.italic, None
409
- yield "underline", self.underline, None,
410
- yield "blink", self.blink, None
411
- yield "blink2", self.blink2, None
412
- yield "reverse", self.reverse, None
413
- yield "conceal", self.conceal, None
414
- yield "strike", self.strike, None
415
- yield "underline2", self.underline2, None
416
- yield "frame", self.frame, None
417
- yield "encircle", self.encircle, None
418
- yield "link", self.link, None
419
- if self._meta:
420
- yield "meta", self.meta
421
-
422
- def __eq__(self, other: Any) -> bool:
423
- if not isinstance(other, Style):
424
- return NotImplemented
425
- return self.__hash__() == other.__hash__()
426
-
427
- def __ne__(self, other: Any) -> bool:
428
- if not isinstance(other, Style):
429
- return NotImplemented
430
- return self.__hash__() != other.__hash__()
431
-
432
- def __hash__(self) -> int:
433
- if self._hash is not None:
434
- return self._hash
435
- self._hash = hash(
436
- (
437
- self._color,
438
- self._bgcolor,
439
- self._attributes,
440
- self._set_attributes,
441
- self._link,
442
- self._meta,
443
- )
444
- )
445
- return self._hash
446
-
447
- @property
448
- def color(self) -> Optional[Color]:
449
- """The foreground color or None if it is not set."""
450
- return self._color
451
-
452
- @property
453
- def bgcolor(self) -> Optional[Color]:
454
- """The background color or None if it is not set."""
455
- return self._bgcolor
456
-
457
- @property
458
- def link(self) -> Optional[str]:
459
- """Link text, if set."""
460
- return self._link
461
-
462
- @property
463
- def transparent_background(self) -> bool:
464
- """Check if the style specified a transparent background."""
465
- return self.bgcolor is None or self.bgcolor.is_default
466
-
467
- @property
468
- def background_style(self) -> "Style":
469
- """A Style with background only."""
470
- return Style(bgcolor=self.bgcolor)
471
-
472
- @property
473
- def meta(self) -> Dict[str, Any]:
474
- """Get meta information (can not be changed after construction)."""
475
- return {} if self._meta is None else cast(Dict[str, Any], loads(self._meta))
476
-
477
- @property
478
- def without_color(self) -> "Style":
479
- """Get a copy of the style with color removed."""
480
- if self._null:
481
- return NULL_STYLE
482
- style: Style = self.__new__(Style)
483
- style._ansi = None
484
- style._style_definition = None
485
- style._color = None
486
- style._bgcolor = None
487
- style._attributes = self._attributes
488
- style._set_attributes = self._set_attributes
489
- style._link = self._link
490
- style._link_id = f"{randint(0, 999999)}" if self._link else ""
491
- style._null = False
492
- style._meta = None
493
- style._hash = None
494
- return style
495
-
496
- @classmethod
497
- @lru_cache(maxsize=4096)
498
- def parse(cls, style_definition: str) -> "Style":
499
- """Parse a style definition.
500
-
501
- Args:
502
- style_definition (str): A string containing a style.
503
-
504
- Raises:
505
- errors.StyleSyntaxError: If the style definition syntax is invalid.
506
-
507
- Returns:
508
- `Style`: A Style instance.
509
- """
510
- if style_definition.strip() == "none" or not style_definition:
511
- return cls.null()
512
-
513
- STYLE_ATTRIBUTES = cls.STYLE_ATTRIBUTES
514
- color: Optional[str] = None
515
- bgcolor: Optional[str] = None
516
- attributes: Dict[str, Optional[Any]] = {}
517
- link: Optional[str] = None
518
-
519
- words = iter(style_definition.split())
520
- for original_word in words:
521
- word = original_word.lower()
522
- if word == "on":
523
- word = next(words, "")
524
- if not word:
525
- raise errors.StyleSyntaxError("color expected after 'on'")
526
- try:
527
- Color.parse(word)
528
- except ColorParseError as error:
529
- raise errors.StyleSyntaxError(
530
- f"unable to parse {word!r} as background color; {error}"
531
- ) from None
532
- bgcolor = word
533
-
534
- elif word == "not":
535
- word = next(words, "")
536
- attribute = STYLE_ATTRIBUTES.get(word)
537
- if attribute is None:
538
- raise errors.StyleSyntaxError(
539
- f"expected style attribute after 'not', found {word!r}"
540
- )
541
- attributes[attribute] = False
542
-
543
- elif word == "link":
544
- word = next(words, "")
545
- if not word:
546
- raise errors.StyleSyntaxError("URL expected after 'link'")
547
- link = word
548
-
549
- elif word in STYLE_ATTRIBUTES:
550
- attributes[STYLE_ATTRIBUTES[word]] = True
551
-
552
- else:
553
- try:
554
- Color.parse(word)
555
- except ColorParseError as error:
556
- raise errors.StyleSyntaxError(
557
- f"unable to parse {word!r} as color; {error}"
558
- ) from None
559
- color = word
560
- style = Style(color=color, bgcolor=bgcolor, link=link, **attributes)
561
- return style
562
-
563
- @lru_cache(maxsize=1024)
564
- def get_html_style(self, theme: Optional[TerminalTheme] = None) -> str:
565
- """Get a CSS style rule."""
566
- theme = theme or DEFAULT_TERMINAL_THEME
567
- css: List[str] = []
568
- append = css.append
569
-
570
- color = self.color
571
- bgcolor = self.bgcolor
572
- if self.reverse:
573
- color, bgcolor = bgcolor, color
574
- if self.dim:
575
- foreground_color = (
576
- theme.foreground_color if color is None else color.get_truecolor(theme)
577
- )
578
- color = Color.from_triplet(
579
- blend_rgb(foreground_color, theme.background_color, 0.5)
580
- )
581
- if color is not None:
582
- theme_color = color.get_truecolor(theme)
583
- append(f"color: {theme_color.hex}")
584
- append(f"text-decoration-color: {theme_color.hex}")
585
- if bgcolor is not None:
586
- theme_color = bgcolor.get_truecolor(theme, foreground=False)
587
- append(f"background-color: {theme_color.hex}")
588
- if self.bold:
589
- append("font-weight: bold")
590
- if self.italic:
591
- append("font-style: italic")
592
- if self.underline:
593
- append("text-decoration: underline")
594
- if self.strike:
595
- append("text-decoration: line-through")
596
- if self.overline:
597
- append("text-decoration: overline")
598
- return "; ".join(css)
599
-
600
- @classmethod
601
- def combine(cls, styles: Iterable["Style"]) -> "Style":
602
- """Combine styles and get result.
603
-
604
- Args:
605
- styles (Iterable[Style]): Styles to combine.
606
-
607
- Returns:
608
- Style: A new style instance.
609
- """
610
- iter_styles = iter(styles)
611
- return sum(iter_styles, next(iter_styles))
612
-
613
- @classmethod
614
- def chain(cls, *styles: "Style") -> "Style":
615
- """Combine styles from positional argument in to a single style.
616
-
617
- Args:
618
- *styles (Iterable[Style]): Styles to combine.
619
-
620
- Returns:
621
- Style: A new style instance.
622
- """
623
- iter_styles = iter(styles)
624
- return sum(iter_styles, next(iter_styles))
625
-
626
- def copy(self) -> "Style":
627
- """Get a copy of this style.
628
-
629
- Returns:
630
- Style: A new Style instance with identical attributes.
631
- """
632
- if self._null:
633
- return NULL_STYLE
634
- style: Style = self.__new__(Style)
635
- style._ansi = self._ansi
636
- style._style_definition = self._style_definition
637
- style._color = self._color
638
- style._bgcolor = self._bgcolor
639
- style._attributes = self._attributes
640
- style._set_attributes = self._set_attributes
641
- style._link = self._link
642
- style._link_id = f"{randint(0, 999999)}" if self._link else ""
643
- style._hash = self._hash
644
- style._null = False
645
- style._meta = self._meta
646
- return style
647
-
648
- @lru_cache(maxsize=128)
649
- def clear_meta_and_links(self) -> "Style":
650
- """Get a copy of this style with link and meta information removed.
651
-
652
- Returns:
653
- Style: New style object.
654
- """
655
- if self._null:
656
- return NULL_STYLE
657
- style: Style = self.__new__(Style)
658
- style._ansi = self._ansi
659
- style._style_definition = self._style_definition
660
- style._color = self._color
661
- style._bgcolor = self._bgcolor
662
- style._attributes = self._attributes
663
- style._set_attributes = self._set_attributes
664
- style._link = None
665
- style._link_id = ""
666
- style._hash = None
667
- style._null = False
668
- style._meta = None
669
- return style
670
-
671
- def update_link(self, link: Optional[str] = None) -> "Style":
672
- """Get a copy with a different value for link.
673
-
674
- Args:
675
- link (str, optional): New value for link. Defaults to None.
676
-
677
- Returns:
678
- Style: A new Style instance.
679
- """
680
- style: Style = self.__new__(Style)
681
- style._ansi = self._ansi
682
- style._style_definition = self._style_definition
683
- style._color = self._color
684
- style._bgcolor = self._bgcolor
685
- style._attributes = self._attributes
686
- style._set_attributes = self._set_attributes
687
- style._link = link
688
- style._link_id = f"{randint(0, 999999)}" if link else ""
689
- style._hash = None
690
- style._null = False
691
- style._meta = self._meta
692
- return style
693
-
694
- def render(
695
- self,
696
- text: str = "",
697
- *,
698
- color_system: Optional[ColorSystem] = ColorSystem.TRUECOLOR,
699
- legacy_windows: bool = False,
700
- ) -> str:
701
- """Render the ANSI codes for the style.
702
-
703
- Args:
704
- text (str, optional): A string to style. Defaults to "".
705
- color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.
706
-
707
- Returns:
708
- str: A string containing ANSI style codes.
709
- """
710
- if not text or color_system is None:
711
- return text
712
- attrs = self._ansi or self._make_ansi_codes(color_system)
713
- rendered = f"\x1b[{attrs}m{text}\x1b[0m" if attrs else text
714
- if self._link and not legacy_windows:
715
- rendered = (
716
- f"\x1b]8;id={self._link_id};{self._link}\x1b\\{rendered}\x1b]8;;\x1b\\"
717
- )
718
- return rendered
719
-
720
- def test(self, text: Optional[str] = None) -> None:
721
- """Write text with style directly to terminal.
722
-
723
- This method is for testing purposes only.
724
-
725
- Args:
726
- text (Optional[str], optional): Text to style or None for style name.
727
-
728
- """
729
- text = text or str(self)
730
- sys.stdout.write(f"{self.render(text)}\n")
731
-
732
- @lru_cache(maxsize=1024)
733
- def _add(self, style: Optional["Style"]) -> "Style":
734
- if style is None or style._null:
735
- return self
736
- if self._null:
737
- return style
738
- new_style: Style = self.__new__(Style)
739
- new_style._ansi = None
740
- new_style._style_definition = None
741
- new_style._color = style._color or self._color
742
- new_style._bgcolor = style._bgcolor or self._bgcolor
743
- new_style._attributes = (self._attributes & ~style._set_attributes) | (
744
- style._attributes & style._set_attributes
745
- )
746
- new_style._set_attributes = self._set_attributes | style._set_attributes
747
- new_style._link = style._link or self._link
748
- new_style._link_id = style._link_id or self._link_id
749
- new_style._null = style._null
750
- if self._meta and style._meta:
751
- new_style._meta = dumps({**self.meta, **style.meta})
752
- else:
753
- new_style._meta = self._meta or style._meta
754
- new_style._hash = None
755
- return new_style
756
-
757
- def __add__(self, style: Optional["Style"]) -> "Style":
758
- combined_style = self._add(style)
759
- return combined_style.copy() if combined_style.link else combined_style
760
-
761
-
762
- NULL_STYLE = Style()
763
-
764
-
765
- class StyleStack:
766
- """A stack of styles."""
767
-
768
- __slots__ = ["_stack"]
769
-
770
- def __init__(self, default_style: "Style") -> None:
771
- self._stack: List[Style] = [default_style]
772
-
773
- def __repr__(self) -> str:
774
- return f"<stylestack {self._stack!r}>"
775
-
776
- @property
777
- def current(self) -> Style:
778
- """Get the Style at the top of the stack."""
779
- return self._stack[-1]
780
-
781
- def push(self, style: Style) -> None:
782
- """Push a new style on to the stack.
783
-
784
- Args:
785
- style (Style): New style to combine with current style.
786
- """
787
- self._stack.append(self._stack[-1] + style)
788
-
789
- def pop(self) -> Style:
790
- """Pop last style and discard.
791
-
792
- Returns:
793
- Style: New current style (also available as stack.current)
794
- """
795
- self._stack.pop()
796
- return self._stack[-1]