Upload folder using huggingface_hub (part 13)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +9 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/AUTHORS.txt +760 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/INSTALLER +1 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/LICENSE.txt +20 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/METADATA +88 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/RECORD +1005 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/REQUESTED +0 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/WHEEL +5 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/entry_points.txt +4 -0
- .venv/lib/python3.12/site-packages/pip-24.0.dist-info/top_level.txt +1 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/ansi.py +240 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/bar.py +94 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/box.py +517 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/cells.py +154 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/color.py +622 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/color_triplet.py +38 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/columns.py +187 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/console.py +0 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/constrain.py +37 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/containers.py +167 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/control.py +225 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/default_styles.py +190 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/diagnose.py +37 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/emoji.py +96 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/errors.py +34 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/filesize.py +89 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/highlighter.py +232 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/json.py +140 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/jupyter.py +101 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/layout.py +443 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/live.py +375 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/live_render.py +113 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/logging.py +289 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/markup.py +246 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/measure.py +151 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/padding.py +141 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/pager.py +34 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/palette.py +100 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/panel.py +308 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/pretty.py +994 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/progress.py +1702 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/progress_bar.py +224 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/prompt.py +376 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/protocol.py +42 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/region.py +10 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/repr.py +149 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/rule.py +130 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/scope.py +86 -0
- .venv/lib/python3.12/site-packages/pip/_vendor/rich/screen.py +54 -0
.gitattributes
CHANGED
|
@@ -298,3 +298,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 298 |
.venv/lib/python3.12/site-packages/pip/_vendor/pyparsing/__pycache__/core.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 299 |
.venv/lib/python3.12/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 300 |
.venv/lib/python3.12/site-packages/pip/_vendor/rich/__pycache__/console.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
.venv/lib/python3.12/site-packages/pip/_vendor/pyparsing/__pycache__/core.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 299 |
.venv/lib/python3.12/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 300 |
.venv/lib/python3.12/site-packages/pip/_vendor/rich/__pycache__/console.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 301 |
+
.venv/lib/python3.12/site-packages/pkg_resources/__pycache__/__init__.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 302 |
+
.venv/lib/python3.12/site-packages/polars/__pycache__/selectors.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 303 |
+
.venv/lib/python3.12/site-packages/polars/dataframe/__pycache__/frame.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 304 |
+
.venv/lib/python3.12/site-packages/polars/expr/__pycache__/datetime.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 305 |
+
.venv/lib/python3.12/site-packages/polars/expr/__pycache__/expr.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 306 |
+
.venv/lib/python3.12/site-packages/polars/expr/__pycache__/string.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 307 |
+
.venv/lib/python3.12/site-packages/polars/lazyframe/__pycache__/frame.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 308 |
+
.venv/lib/python3.12/site-packages/polars/series/__pycache__/series.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 309 |
+
.venv/lib/python3.12/site-packages/psutil/_psutil_linux.abi3.so filter=lfs diff=lfs merge=lfs -text
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/AUTHORS.txt
ADDED
|
@@ -0,0 +1,760 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
Albert Tugushev
|
| 19 |
+
Albert-Guan
|
| 20 |
+
albertg
|
| 21 |
+
Alberto Sottile
|
| 22 |
+
Aleks Bunin
|
| 23 |
+
Ales Erjavec
|
| 24 |
+
Alethea Flowers
|
| 25 |
+
Alex Gaynor
|
| 26 |
+
Alex Grönholm
|
| 27 |
+
Alex Hedges
|
| 28 |
+
Alex Loosley
|
| 29 |
+
Alex Morega
|
| 30 |
+
Alex Stachowiak
|
| 31 |
+
Alexander Shtyrov
|
| 32 |
+
Alexandre Conrad
|
| 33 |
+
Alexey Popravka
|
| 34 |
+
Aleš Erjavec
|
| 35 |
+
Alli
|
| 36 |
+
Ami Fischman
|
| 37 |
+
Ananya Maiti
|
| 38 |
+
Anatoly Techtonik
|
| 39 |
+
Anders Kaseorg
|
| 40 |
+
Andre Aguiar
|
| 41 |
+
Andreas Lutro
|
| 42 |
+
Andrei Geacar
|
| 43 |
+
Andrew Gaul
|
| 44 |
+
Andrew Shymanel
|
| 45 |
+
Andrey Bienkowski
|
| 46 |
+
Andrey Bulgakov
|
| 47 |
+
Andrés Delfino
|
| 48 |
+
Andy Freeland
|
| 49 |
+
Andy Kluger
|
| 50 |
+
Ani Hayrapetyan
|
| 51 |
+
Aniruddha Basak
|
| 52 |
+
Anish Tambe
|
| 53 |
+
Anrs Hu
|
| 54 |
+
Anthony Sottile
|
| 55 |
+
Antoine Musso
|
| 56 |
+
Anton Ovchinnikov
|
| 57 |
+
Anton Patrushev
|
| 58 |
+
Antonio Alvarado Hernandez
|
| 59 |
+
Antony Lee
|
| 60 |
+
Antti Kaihola
|
| 61 |
+
Anubhav Patel
|
| 62 |
+
Anudit Nagar
|
| 63 |
+
Anuj Godase
|
| 64 |
+
AQNOUCH Mohammed
|
| 65 |
+
AraHaan
|
| 66 |
+
Arindam Choudhury
|
| 67 |
+
Armin Ronacher
|
| 68 |
+
Artem
|
| 69 |
+
Arun Babu Neelicattu
|
| 70 |
+
Ashley Manton
|
| 71 |
+
Ashwin Ramaswami
|
| 72 |
+
atse
|
| 73 |
+
Atsushi Odagiri
|
| 74 |
+
Avinash Karhana
|
| 75 |
+
Avner Cohen
|
| 76 |
+
Awit (Ah-Wit) Ghirmai
|
| 77 |
+
Baptiste Mispelon
|
| 78 |
+
Barney Gale
|
| 79 |
+
barneygale
|
| 80 |
+
Bartek Ogryczak
|
| 81 |
+
Bastian Venthur
|
| 82 |
+
Ben Bodenmiller
|
| 83 |
+
Ben Darnell
|
| 84 |
+
Ben Hoyt
|
| 85 |
+
Ben Mares
|
| 86 |
+
Ben Rosser
|
| 87 |
+
Bence Nagy
|
| 88 |
+
Benjamin Peterson
|
| 89 |
+
Benjamin VanEvery
|
| 90 |
+
Benoit Pierre
|
| 91 |
+
Berker Peksag
|
| 92 |
+
Bernard
|
| 93 |
+
Bernard Tyers
|
| 94 |
+
Bernardo B. Marques
|
| 95 |
+
Bernhard M. Wiedemann
|
| 96 |
+
Bertil Hatt
|
| 97 |
+
Bhavam Vidyarthi
|
| 98 |
+
Blazej Michalik
|
| 99 |
+
Bogdan Opanchuk
|
| 100 |
+
BorisZZZ
|
| 101 |
+
Brad Erickson
|
| 102 |
+
Bradley Ayers
|
| 103 |
+
Brandon L. Reiss
|
| 104 |
+
Brandt Bucher
|
| 105 |
+
Brett Randall
|
| 106 |
+
Brett Rosen
|
| 107 |
+
Brian Cristante
|
| 108 |
+
Brian Rosner
|
| 109 |
+
briantracy
|
| 110 |
+
BrownTruck
|
| 111 |
+
Bruno Oliveira
|
| 112 |
+
Bruno Renié
|
| 113 |
+
Bruno S
|
| 114 |
+
Bstrdsmkr
|
| 115 |
+
Buck Golemon
|
| 116 |
+
burrows
|
| 117 |
+
Bussonnier Matthias
|
| 118 |
+
bwoodsend
|
| 119 |
+
c22
|
| 120 |
+
Caleb Martinez
|
| 121 |
+
Calvin Smith
|
| 122 |
+
Carl Meyer
|
| 123 |
+
Carlos Liam
|
| 124 |
+
Carol Willing
|
| 125 |
+
Carter Thayer
|
| 126 |
+
Cass
|
| 127 |
+
Chandrasekhar Atina
|
| 128 |
+
Chih-Hsuan Yen
|
| 129 |
+
Chris Brinker
|
| 130 |
+
Chris Hunt
|
| 131 |
+
Chris Jerdonek
|
| 132 |
+
Chris Kuehl
|
| 133 |
+
Chris McDonough
|
| 134 |
+
Chris Pawley
|
| 135 |
+
Chris Pryer
|
| 136 |
+
Chris Wolfe
|
| 137 |
+
Christian Clauss
|
| 138 |
+
Christian Heimes
|
| 139 |
+
Christian Oudard
|
| 140 |
+
Christoph Reiter
|
| 141 |
+
Christopher Hunt
|
| 142 |
+
Christopher Snyder
|
| 143 |
+
cjc7373
|
| 144 |
+
Clark Boylan
|
| 145 |
+
Claudio Jolowicz
|
| 146 |
+
Clay McClure
|
| 147 |
+
Cody
|
| 148 |
+
Cody Soyland
|
| 149 |
+
Colin Watson
|
| 150 |
+
Collin Anderson
|
| 151 |
+
Connor Osborn
|
| 152 |
+
Cooper Lees
|
| 153 |
+
Cooper Ry Lees
|
| 154 |
+
Cory Benfield
|
| 155 |
+
Cory Wright
|
| 156 |
+
Craig Kerstiens
|
| 157 |
+
Cristian Sorinel
|
| 158 |
+
Cristina
|
| 159 |
+
Cristina Muñoz
|
| 160 |
+
Curtis Doty
|
| 161 |
+
cytolentino
|
| 162 |
+
Daan De Meyer
|
| 163 |
+
Dale
|
| 164 |
+
Damian
|
| 165 |
+
Damian Quiroga
|
| 166 |
+
Damian Shaw
|
| 167 |
+
Dan Black
|
| 168 |
+
Dan Savilonis
|
| 169 |
+
Dan Sully
|
| 170 |
+
Dane Hillard
|
| 171 |
+
daniel
|
| 172 |
+
Daniel Collins
|
| 173 |
+
Daniel Hahler
|
| 174 |
+
Daniel Holth
|
| 175 |
+
Daniel Jost
|
| 176 |
+
Daniel Katz
|
| 177 |
+
Daniel Shaulov
|
| 178 |
+
Daniele Esposti
|
| 179 |
+
Daniele Nicolodi
|
| 180 |
+
Daniele Procida
|
| 181 |
+
Daniil Konovalenko
|
| 182 |
+
Danny Hermes
|
| 183 |
+
Danny McClanahan
|
| 184 |
+
Darren Kavanagh
|
| 185 |
+
Dav Clark
|
| 186 |
+
Dave Abrahams
|
| 187 |
+
Dave Jones
|
| 188 |
+
David Aguilar
|
| 189 |
+
David Black
|
| 190 |
+
David Bordeynik
|
| 191 |
+
David Caro
|
| 192 |
+
David D Lowe
|
| 193 |
+
David Evans
|
| 194 |
+
David Hewitt
|
| 195 |
+
David Linke
|
| 196 |
+
David Poggi
|
| 197 |
+
David Pursehouse
|
| 198 |
+
David Runge
|
| 199 |
+
David Tucker
|
| 200 |
+
David Wales
|
| 201 |
+
Davidovich
|
| 202 |
+
ddelange
|
| 203 |
+
Deepak Sharma
|
| 204 |
+
Deepyaman Datta
|
| 205 |
+
Denise Yu
|
| 206 |
+
dependabot[bot]
|
| 207 |
+
derwolfe
|
| 208 |
+
Desetude
|
| 209 |
+
Devesh Kumar Singh
|
| 210 |
+
Diego Caraballo
|
| 211 |
+
Diego Ramirez
|
| 212 |
+
DiegoCaraballo
|
| 213 |
+
Dimitri Merejkowsky
|
| 214 |
+
Dimitri Papadopoulos
|
| 215 |
+
Dirk Stolle
|
| 216 |
+
Dmitry Gladkov
|
| 217 |
+
Dmitry Volodin
|
| 218 |
+
Domen Kožar
|
| 219 |
+
Dominic Davis-Foster
|
| 220 |
+
Donald Stufft
|
| 221 |
+
Dongweiming
|
| 222 |
+
doron zarhi
|
| 223 |
+
Dos Moonen
|
| 224 |
+
Douglas Thor
|
| 225 |
+
DrFeathers
|
| 226 |
+
Dustin Ingram
|
| 227 |
+
Dwayne Bailey
|
| 228 |
+
Ed Morley
|
| 229 |
+
Edgar Ramírez
|
| 230 |
+
Edgar Ramírez Mondragón
|
| 231 |
+
Ee Durbin
|
| 232 |
+
Efflam Lemaillet
|
| 233 |
+
efflamlemaillet
|
| 234 |
+
Eitan Adler
|
| 235 |
+
ekristina
|
| 236 |
+
elainechan
|
| 237 |
+
Eli Schwartz
|
| 238 |
+
Elisha Hollander
|
| 239 |
+
Ellen Marie Dash
|
| 240 |
+
Emil Burzo
|
| 241 |
+
Emil Styrke
|
| 242 |
+
Emmanuel Arias
|
| 243 |
+
Endoh Takanao
|
| 244 |
+
enoch
|
| 245 |
+
Erdinc Mutlu
|
| 246 |
+
Eric Cousineau
|
| 247 |
+
Eric Gillingham
|
| 248 |
+
Eric Hanchrow
|
| 249 |
+
Eric Hopper
|
| 250 |
+
Erik M. Bray
|
| 251 |
+
Erik Rose
|
| 252 |
+
Erwin Janssen
|
| 253 |
+
Eugene Vereshchagin
|
| 254 |
+
everdimension
|
| 255 |
+
Federico
|
| 256 |
+
Felipe Peter
|
| 257 |
+
Felix Yan
|
| 258 |
+
fiber-space
|
| 259 |
+
Filip Kokosiński
|
| 260 |
+
Filipe Laíns
|
| 261 |
+
Finn Womack
|
| 262 |
+
finnagin
|
| 263 |
+
Flavio Amurrio
|
| 264 |
+
Florian Briand
|
| 265 |
+
Florian Rathgeber
|
| 266 |
+
Francesco
|
| 267 |
+
Francesco Montesano
|
| 268 |
+
Frost Ming
|
| 269 |
+
Gabriel Curio
|
| 270 |
+
Gabriel de Perthuis
|
| 271 |
+
Garry Polley
|
| 272 |
+
gavin
|
| 273 |
+
gdanielson
|
| 274 |
+
Geoffrey Sneddon
|
| 275 |
+
George Song
|
| 276 |
+
Georgi Valkov
|
| 277 |
+
Georgy Pchelkin
|
| 278 |
+
ghost
|
| 279 |
+
Giftlin Rajaiah
|
| 280 |
+
gizmoguy1
|
| 281 |
+
gkdoc
|
| 282 |
+
Godefroid Chapelle
|
| 283 |
+
Gopinath M
|
| 284 |
+
GOTO Hayato
|
| 285 |
+
gousaiyang
|
| 286 |
+
gpiks
|
| 287 |
+
Greg Roodt
|
| 288 |
+
Greg Ward
|
| 289 |
+
Guilherme Espada
|
| 290 |
+
Guillaume Seguin
|
| 291 |
+
gutsytechster
|
| 292 |
+
Guy Rozendorn
|
| 293 |
+
Guy Tuval
|
| 294 |
+
gzpan123
|
| 295 |
+
Hanjun Kim
|
| 296 |
+
Hari Charan
|
| 297 |
+
Harsh Vardhan
|
| 298 |
+
harupy
|
| 299 |
+
Harutaka Kawamura
|
| 300 |
+
hauntsaninja
|
| 301 |
+
Henrich Hartzer
|
| 302 |
+
Henry Schreiner
|
| 303 |
+
Herbert Pfennig
|
| 304 |
+
Holly Stotelmyer
|
| 305 |
+
Honnix
|
| 306 |
+
Hsiaoming Yang
|
| 307 |
+
Hugo Lopes Tavares
|
| 308 |
+
Hugo van Kemenade
|
| 309 |
+
Hugues Bruant
|
| 310 |
+
Hynek Schlawack
|
| 311 |
+
Ian Bicking
|
| 312 |
+
Ian Cordasco
|
| 313 |
+
Ian Lee
|
| 314 |
+
Ian Stapleton Cordasco
|
| 315 |
+
Ian Wienand
|
| 316 |
+
Igor Kuzmitshov
|
| 317 |
+
Igor Sobreira
|
| 318 |
+
Ilan Schnell
|
| 319 |
+
Illia Volochii
|
| 320 |
+
Ilya Baryshev
|
| 321 |
+
Inada Naoki
|
| 322 |
+
Ionel Cristian Mărieș
|
| 323 |
+
Ionel Maries Cristian
|
| 324 |
+
Itamar Turner-Trauring
|
| 325 |
+
Ivan Pozdeev
|
| 326 |
+
J. Nick Koston
|
| 327 |
+
Jacob Kim
|
| 328 |
+
Jacob Walls
|
| 329 |
+
Jaime Sanz
|
| 330 |
+
jakirkham
|
| 331 |
+
Jakub Kuczys
|
| 332 |
+
Jakub Stasiak
|
| 333 |
+
Jakub Vysoky
|
| 334 |
+
Jakub Wilk
|
| 335 |
+
James Cleveland
|
| 336 |
+
James Curtin
|
| 337 |
+
James Firth
|
| 338 |
+
James Gerity
|
| 339 |
+
James Polley
|
| 340 |
+
Jan Pokorný
|
| 341 |
+
Jannis Leidel
|
| 342 |
+
Jarek Potiuk
|
| 343 |
+
jarondl
|
| 344 |
+
Jason Curtis
|
| 345 |
+
Jason R. Coombs
|
| 346 |
+
JasonMo
|
| 347 |
+
JasonMo1
|
| 348 |
+
Jay Graves
|
| 349 |
+
Jean Abou Samra
|
| 350 |
+
Jean-Christophe Fillion-Robin
|
| 351 |
+
Jeff Barber
|
| 352 |
+
Jeff Dairiki
|
| 353 |
+
Jeff Widman
|
| 354 |
+
Jelmer Vernooij
|
| 355 |
+
jenix21
|
| 356 |
+
Jeremy Stanley
|
| 357 |
+
Jeremy Zafran
|
| 358 |
+
Jesse Rittner
|
| 359 |
+
Jiashuo Li
|
| 360 |
+
Jim Fisher
|
| 361 |
+
Jim Garrison
|
| 362 |
+
Jiun Bae
|
| 363 |
+
Jivan Amara
|
| 364 |
+
Joe Bylund
|
| 365 |
+
Joe Michelini
|
| 366 |
+
John Paton
|
| 367 |
+
John T. Wodder II
|
| 368 |
+
John-Scott Atlakson
|
| 369 |
+
johnthagen
|
| 370 |
+
Jon Banafato
|
| 371 |
+
Jon Dufresne
|
| 372 |
+
Jon Parise
|
| 373 |
+
Jonas Nockert
|
| 374 |
+
Jonathan Herbert
|
| 375 |
+
Joonatan Partanen
|
| 376 |
+
Joost Molenaar
|
| 377 |
+
Jorge Niedbalski
|
| 378 |
+
Joseph Bylund
|
| 379 |
+
Joseph Long
|
| 380 |
+
Josh Bronson
|
| 381 |
+
Josh Hansen
|
| 382 |
+
Josh Schneier
|
| 383 |
+
Joshua
|
| 384 |
+
Juan Luis Cano Rodríguez
|
| 385 |
+
Juanjo Bazán
|
| 386 |
+
Judah Rand
|
| 387 |
+
Julian Berman
|
| 388 |
+
Julian Gethmann
|
| 389 |
+
Julien Demoor
|
| 390 |
+
Jussi Kukkonen
|
| 391 |
+
jwg4
|
| 392 |
+
Jyrki Pulliainen
|
| 393 |
+
Kai Chen
|
| 394 |
+
Kai Mueller
|
| 395 |
+
Kamal Bin Mustafa
|
| 396 |
+
kasium
|
| 397 |
+
kaustav haldar
|
| 398 |
+
keanemind
|
| 399 |
+
Keith Maxwell
|
| 400 |
+
Kelsey Hightower
|
| 401 |
+
Kenneth Belitzky
|
| 402 |
+
Kenneth Reitz
|
| 403 |
+
Kevin Burke
|
| 404 |
+
Kevin Carter
|
| 405 |
+
Kevin Frommelt
|
| 406 |
+
Kevin R Patterson
|
| 407 |
+
Kexuan Sun
|
| 408 |
+
Kit Randel
|
| 409 |
+
Klaas van Schelven
|
| 410 |
+
KOLANICH
|
| 411 |
+
kpinc
|
| 412 |
+
Krishna Oza
|
| 413 |
+
Kumar McMillan
|
| 414 |
+
Kurt McKee
|
| 415 |
+
Kyle Persohn
|
| 416 |
+
lakshmanaram
|
| 417 |
+
Laszlo Kiss-Kollar
|
| 418 |
+
Laurent Bristiel
|
| 419 |
+
Laurent LAPORTE
|
| 420 |
+
Laurie O
|
| 421 |
+
Laurie Opperman
|
| 422 |
+
layday
|
| 423 |
+
Leon Sasson
|
| 424 |
+
Lev Givon
|
| 425 |
+
Lincoln de Sousa
|
| 426 |
+
Lipis
|
| 427 |
+
lorddavidiii
|
| 428 |
+
Loren Carvalho
|
| 429 |
+
Lucas Cimon
|
| 430 |
+
Ludovic Gasc
|
| 431 |
+
Lukas Geiger
|
| 432 |
+
Lukas Juhrich
|
| 433 |
+
Luke Macken
|
| 434 |
+
Luo Jiebin
|
| 435 |
+
luojiebin
|
| 436 |
+
luz.paz
|
| 437 |
+
László Kiss Kollár
|
| 438 |
+
M00nL1ght
|
| 439 |
+
Marc Abramowitz
|
| 440 |
+
Marc Tamlyn
|
| 441 |
+
Marcus Smith
|
| 442 |
+
Mariatta
|
| 443 |
+
Mark Kohler
|
| 444 |
+
Mark Williams
|
| 445 |
+
Markus Hametner
|
| 446 |
+
Martey Dodoo
|
| 447 |
+
Martin Fischer
|
| 448 |
+
Martin Häcker
|
| 449 |
+
Martin Pavlasek
|
| 450 |
+
Masaki
|
| 451 |
+
Masklinn
|
| 452 |
+
Matej Stuchlik
|
| 453 |
+
Mathew Jennings
|
| 454 |
+
Mathieu Bridon
|
| 455 |
+
Mathieu Kniewallner
|
| 456 |
+
Matt Bacchi
|
| 457 |
+
Matt Good
|
| 458 |
+
Matt Maker
|
| 459 |
+
Matt Robenolt
|
| 460 |
+
matthew
|
| 461 |
+
Matthew Einhorn
|
| 462 |
+
Matthew Feickert
|
| 463 |
+
Matthew Gilliard
|
| 464 |
+
Matthew Iversen
|
| 465 |
+
Matthew Treinish
|
| 466 |
+
Matthew Trumbell
|
| 467 |
+
Matthew Willson
|
| 468 |
+
Matthias Bussonnier
|
| 469 |
+
mattip
|
| 470 |
+
Maurits van Rees
|
| 471 |
+
Max W Chase
|
| 472 |
+
Maxim Kurnikov
|
| 473 |
+
Maxime Rouyrre
|
| 474 |
+
mayeut
|
| 475 |
+
mbaluna
|
| 476 |
+
mdebi
|
| 477 |
+
memoselyk
|
| 478 |
+
meowmeowcat
|
| 479 |
+
Michael
|
| 480 |
+
Michael Aquilina
|
| 481 |
+
Michael E. Karpeles
|
| 482 |
+
Michael Klich
|
| 483 |
+
Michael Mintz
|
| 484 |
+
Michael Williamson
|
| 485 |
+
michaelpacer
|
| 486 |
+
Michał Górny
|
| 487 |
+
Mickaël Schoentgen
|
| 488 |
+
Miguel Araujo Perez
|
| 489 |
+
Mihir Singh
|
| 490 |
+
Mike
|
| 491 |
+
Mike Hendricks
|
| 492 |
+
Min RK
|
| 493 |
+
MinRK
|
| 494 |
+
Miro Hrončok
|
| 495 |
+
Monica Baluna
|
| 496 |
+
montefra
|
| 497 |
+
Monty Taylor
|
| 498 |
+
Muha Ajjan
|
| 499 |
+
Nadav Wexler
|
| 500 |
+
Nahuel Ambrosini
|
| 501 |
+
Nate Coraor
|
| 502 |
+
Nate Prewitt
|
| 503 |
+
Nathan Houghton
|
| 504 |
+
Nathaniel J. Smith
|
| 505 |
+
Nehal J Wani
|
| 506 |
+
Neil Botelho
|
| 507 |
+
Nguyễn Gia Phong
|
| 508 |
+
Nicholas Serra
|
| 509 |
+
Nick Coghlan
|
| 510 |
+
Nick Stenning
|
| 511 |
+
Nick Timkovich
|
| 512 |
+
Nicolas Bock
|
| 513 |
+
Nicole Harris
|
| 514 |
+
Nikhil Benesch
|
| 515 |
+
Nikhil Ladha
|
| 516 |
+
Nikita Chepanov
|
| 517 |
+
Nikolay Korolev
|
| 518 |
+
Nipunn Koorapati
|
| 519 |
+
Nitesh Sharma
|
| 520 |
+
Niyas Sait
|
| 521 |
+
Noah
|
| 522 |
+
Noah Gorny
|
| 523 |
+
Nowell Strite
|
| 524 |
+
NtaleGrey
|
| 525 |
+
nvdv
|
| 526 |
+
OBITORASU
|
| 527 |
+
Ofek Lev
|
| 528 |
+
ofrinevo
|
| 529 |
+
Oliver Freund
|
| 530 |
+
Oliver Jeeves
|
| 531 |
+
Oliver Mannion
|
| 532 |
+
Oliver Tonnhofer
|
| 533 |
+
Olivier Girardot
|
| 534 |
+
Olivier Grisel
|
| 535 |
+
Ollie Rutherfurd
|
| 536 |
+
OMOTO Kenji
|
| 537 |
+
Omry Yadan
|
| 538 |
+
onlinejudge95
|
| 539 |
+
Oren Held
|
| 540 |
+
Oscar Benjamin
|
| 541 |
+
Oz N Tiram
|
| 542 |
+
Pachwenko
|
| 543 |
+
Patrick Dubroy
|
| 544 |
+
Patrick Jenkins
|
| 545 |
+
Patrick Lawson
|
| 546 |
+
patricktokeeffe
|
| 547 |
+
Patrik Kopkan
|
| 548 |
+
Paul Ganssle
|
| 549 |
+
Paul Kehrer
|
| 550 |
+
Paul Moore
|
| 551 |
+
Paul Nasrat
|
| 552 |
+
Paul Oswald
|
| 553 |
+
Paul van der Linden
|
| 554 |
+
Paulus Schoutsen
|
| 555 |
+
Pavel Safronov
|
| 556 |
+
Pavithra Eswaramoorthy
|
| 557 |
+
Pawel Jasinski
|
| 558 |
+
Paweł Szramowski
|
| 559 |
+
Pekka Klärck
|
| 560 |
+
Peter Gessler
|
| 561 |
+
Peter Lisák
|
| 562 |
+
Peter Waller
|
| 563 |
+
petr-tik
|
| 564 |
+
Phaneendra Chiruvella
|
| 565 |
+
Phil Elson
|
| 566 |
+
Phil Freo
|
| 567 |
+
Phil Pennock
|
| 568 |
+
Phil Whelan
|
| 569 |
+
Philip Jägenstedt
|
| 570 |
+
Philip Molloy
|
| 571 |
+
Philippe Ombredanne
|
| 572 |
+
Pi Delport
|
| 573 |
+
Pierre-Yves Rofes
|
| 574 |
+
Pieter Degroote
|
| 575 |
+
pip
|
| 576 |
+
Prabakaran Kumaresshan
|
| 577 |
+
Prabhjyotsing Surjit Singh Sodhi
|
| 578 |
+
Prabhu Marappan
|
| 579 |
+
Pradyun Gedam
|
| 580 |
+
Prashant Sharma
|
| 581 |
+
Pratik Mallya
|
| 582 |
+
pre-commit-ci[bot]
|
| 583 |
+
Preet Thakkar
|
| 584 |
+
Preston Holmes
|
| 585 |
+
Przemek Wrzos
|
| 586 |
+
Pulkit Goyal
|
| 587 |
+
q0w
|
| 588 |
+
Qiangning Hong
|
| 589 |
+
Qiming Xu
|
| 590 |
+
Quentin Lee
|
| 591 |
+
Quentin Pradet
|
| 592 |
+
R. David Murray
|
| 593 |
+
Rafael Caricio
|
| 594 |
+
Ralf Schmitt
|
| 595 |
+
Razzi Abuissa
|
| 596 |
+
rdb
|
| 597 |
+
Reece Dunham
|
| 598 |
+
Remi Rampin
|
| 599 |
+
Rene Dudfield
|
| 600 |
+
Riccardo Magliocchetti
|
| 601 |
+
Riccardo Schirone
|
| 602 |
+
Richard Jones
|
| 603 |
+
Richard Si
|
| 604 |
+
Ricky Ng-Adam
|
| 605 |
+
Rishi
|
| 606 |
+
RobberPhex
|
| 607 |
+
Robert Collins
|
| 608 |
+
Robert McGibbon
|
| 609 |
+
Robert Pollak
|
| 610 |
+
Robert T. McGibbon
|
| 611 |
+
robin elisha robinson
|
| 612 |
+
Roey Berman
|
| 613 |
+
Rohan Jain
|
| 614 |
+
Roman Bogorodskiy
|
| 615 |
+
Roman Donchenko
|
| 616 |
+
Romuald Brunet
|
| 617 |
+
ronaudinho
|
| 618 |
+
Ronny Pfannschmidt
|
| 619 |
+
Rory McCann
|
| 620 |
+
Ross Brattain
|
| 621 |
+
Roy Wellington Ⅳ
|
| 622 |
+
Ruairidh MacLeod
|
| 623 |
+
Russell Keith-Magee
|
| 624 |
+
Ryan Shepherd
|
| 625 |
+
Ryan Wooden
|
| 626 |
+
ryneeverett
|
| 627 |
+
Sachi King
|
| 628 |
+
Salvatore Rinchiera
|
| 629 |
+
sandeepkiran-js
|
| 630 |
+
Sander Van Balen
|
| 631 |
+
Savio Jomton
|
| 632 |
+
schlamar
|
| 633 |
+
Scott Kitterman
|
| 634 |
+
Sean
|
| 635 |
+
seanj
|
| 636 |
+
Sebastian Jordan
|
| 637 |
+
Sebastian Schaetz
|
| 638 |
+
Segev Finer
|
| 639 |
+
SeongSoo Cho
|
| 640 |
+
Sergey Vasilyev
|
| 641 |
+
Seth Michael Larson
|
| 642 |
+
Seth Woodworth
|
| 643 |
+
Shahar Epstein
|
| 644 |
+
Shantanu
|
| 645 |
+
shireenrao
|
| 646 |
+
Shivansh-007
|
| 647 |
+
Shlomi Fish
|
| 648 |
+
Shovan Maity
|
| 649 |
+
Simeon Visser
|
| 650 |
+
Simon Cross
|
| 651 |
+
Simon Pichugin
|
| 652 |
+
sinoroc
|
| 653 |
+
sinscary
|
| 654 |
+
snook92
|
| 655 |
+
socketubs
|
| 656 |
+
Sorin Sbarnea
|
| 657 |
+
Srinivas Nyayapati
|
| 658 |
+
Stavros Korokithakis
|
| 659 |
+
Stefan Scherfke
|
| 660 |
+
Stefano Rivera
|
| 661 |
+
Stephan Erb
|
| 662 |
+
Stephen Rosen
|
| 663 |
+
stepshal
|
| 664 |
+
Steve (Gadget) Barnes
|
| 665 |
+
Steve Barnes
|
| 666 |
+
Steve Dower
|
| 667 |
+
Steve Kowalik
|
| 668 |
+
Steven Myint
|
| 669 |
+
Steven Silvester
|
| 670 |
+
stonebig
|
| 671 |
+
studioj
|
| 672 |
+
Stéphane Bidoul
|
| 673 |
+
Stéphane Bidoul (ACSONE)
|
| 674 |
+
Stéphane Klein
|
| 675 |
+
Sumana Harihareswara
|
| 676 |
+
Surbhi Sharma
|
| 677 |
+
Sviatoslav Sydorenko
|
| 678 |
+
Swat009
|
| 679 |
+
Sylvain
|
| 680 |
+
Takayuki SHIMIZUKAWA
|
| 681 |
+
Taneli Hukkinen
|
| 682 |
+
tbeswick
|
| 683 |
+
Thiago
|
| 684 |
+
Thijs Triemstra
|
| 685 |
+
Thomas Fenzl
|
| 686 |
+
Thomas Grainger
|
| 687 |
+
Thomas Guettler
|
| 688 |
+
Thomas Johansson
|
| 689 |
+
Thomas Kluyver
|
| 690 |
+
Thomas Smith
|
| 691 |
+
Thomas VINCENT
|
| 692 |
+
Tim D. Smith
|
| 693 |
+
Tim Gates
|
| 694 |
+
Tim Harder
|
| 695 |
+
Tim Heap
|
| 696 |
+
tim smith
|
| 697 |
+
tinruufu
|
| 698 |
+
Tobias Hermann
|
| 699 |
+
Tom Forbes
|
| 700 |
+
Tom Freudenheim
|
| 701 |
+
Tom V
|
| 702 |
+
Tomas Hrnciar
|
| 703 |
+
Tomas Orsava
|
| 704 |
+
Tomer Chachamu
|
| 705 |
+
Tommi Enenkel | AnB
|
| 706 |
+
Tomáš Hrnčiar
|
| 707 |
+
Tony Beswick
|
| 708 |
+
Tony Narlock
|
| 709 |
+
Tony Zhaocheng Tan
|
| 710 |
+
TonyBeswick
|
| 711 |
+
toonarmycaptain
|
| 712 |
+
Toshio Kuratomi
|
| 713 |
+
toxinu
|
| 714 |
+
Travis Swicegood
|
| 715 |
+
Tushar Sadhwani
|
| 716 |
+
Tzu-ping Chung
|
| 717 |
+
Valentin Haenel
|
| 718 |
+
Victor Stinner
|
| 719 |
+
victorvpaulo
|
| 720 |
+
Vikram - Google
|
| 721 |
+
Viktor Szépe
|
| 722 |
+
Ville Skyttä
|
| 723 |
+
Vinay Sajip
|
| 724 |
+
Vincent Philippon
|
| 725 |
+
Vinicyus Macedo
|
| 726 |
+
Vipul Kumar
|
| 727 |
+
Vitaly Babiy
|
| 728 |
+
Vladimir Fokow
|
| 729 |
+
Vladimir Rutsky
|
| 730 |
+
W. Trevor King
|
| 731 |
+
Wil Tan
|
| 732 |
+
Wilfred Hughes
|
| 733 |
+
William Edwards
|
| 734 |
+
William ML Leslie
|
| 735 |
+
William T Olson
|
| 736 |
+
William Woodruff
|
| 737 |
+
Wilson Mo
|
| 738 |
+
wim glenn
|
| 739 |
+
Winson Luk
|
| 740 |
+
Wolfgang Maier
|
| 741 |
+
Wu Zhenyu
|
| 742 |
+
XAMES3
|
| 743 |
+
Xavier Fernandez
|
| 744 |
+
xoviat
|
| 745 |
+
xtreak
|
| 746 |
+
YAMAMOTO Takashi
|
| 747 |
+
Yen Chi Hsuan
|
| 748 |
+
Yeray Diaz Diaz
|
| 749 |
+
Yoval P
|
| 750 |
+
Yu Jian
|
| 751 |
+
Yuan Jing Vincent Yan
|
| 752 |
+
Yusuke Hayashi
|
| 753 |
+
Zearin
|
| 754 |
+
Zhiping Deng
|
| 755 |
+
ziebam
|
| 756 |
+
Zvezdan Petkovic
|
| 757 |
+
Łukasz Langa
|
| 758 |
+
Роман Донченко
|
| 759 |
+
Семён Марьясин
|
| 760 |
+
rekcäH nitraM
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2008-present The pip developers (see AUTHORS.txt file)
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
a copy of this software and associated documentation files (the
|
| 5 |
+
"Software"), to deal in the Software without restriction, including
|
| 6 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
the following conditions:
|
| 10 |
+
|
| 11 |
+
The above copyright notice and this permission notice shall be
|
| 12 |
+
included in all copies or substantial portions of the Software.
|
| 13 |
+
|
| 14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.1
|
| 2 |
+
Name: pip
|
| 3 |
+
Version: 24.0
|
| 4 |
+
Summary: The PyPA recommended tool for installing Python packages.
|
| 5 |
+
Author-email: The pip developers <distutils-sig@python.org>
|
| 6 |
+
License: MIT
|
| 7 |
+
Project-URL: Homepage, https://pip.pypa.io/
|
| 8 |
+
Project-URL: Documentation, https://pip.pypa.io
|
| 9 |
+
Project-URL: Source, https://github.com/pypa/pip
|
| 10 |
+
Project-URL: Changelog, https://pip.pypa.io/en/stable/news/
|
| 11 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 12 |
+
Classifier: Intended Audience :: Developers
|
| 13 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 14 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 15 |
+
Classifier: Programming Language :: Python
|
| 16 |
+
Classifier: Programming Language :: Python :: 3
|
| 17 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 24 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 25 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 26 |
+
Requires-Python: >=3.7
|
| 27 |
+
Description-Content-Type: text/x-rst
|
| 28 |
+
License-File: LICENSE.txt
|
| 29 |
+
License-File: AUTHORS.txt
|
| 30 |
+
|
| 31 |
+
pip - The Python Package Installer
|
| 32 |
+
==================================
|
| 33 |
+
|
| 34 |
+
.. image:: https://img.shields.io/pypi/v/pip.svg
|
| 35 |
+
:target: https://pypi.org/project/pip/
|
| 36 |
+
:alt: PyPI
|
| 37 |
+
|
| 38 |
+
.. image:: https://img.shields.io/pypi/pyversions/pip
|
| 39 |
+
:target: https://pypi.org/project/pip
|
| 40 |
+
:alt: PyPI - Python Version
|
| 41 |
+
|
| 42 |
+
.. image:: https://readthedocs.org/projects/pip/badge/?version=latest
|
| 43 |
+
:target: https://pip.pypa.io/en/latest
|
| 44 |
+
:alt: Documentation
|
| 45 |
+
|
| 46 |
+
pip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.
|
| 47 |
+
|
| 48 |
+
Please take a look at our documentation for how to install and use pip:
|
| 49 |
+
|
| 50 |
+
* `Installation`_
|
| 51 |
+
* `Usage`_
|
| 52 |
+
|
| 53 |
+
We release updates regularly, with a new version every 3 months. Find more details in our documentation:
|
| 54 |
+
|
| 55 |
+
* `Release notes`_
|
| 56 |
+
* `Release process`_
|
| 57 |
+
|
| 58 |
+
If you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:
|
| 59 |
+
|
| 60 |
+
* `Issue tracking`_
|
| 61 |
+
* `Discourse channel`_
|
| 62 |
+
* `User IRC`_
|
| 63 |
+
|
| 64 |
+
If you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:
|
| 65 |
+
|
| 66 |
+
* `GitHub page`_
|
| 67 |
+
* `Development documentation`_
|
| 68 |
+
* `Development IRC`_
|
| 69 |
+
|
| 70 |
+
Code of Conduct
|
| 71 |
+
---------------
|
| 72 |
+
|
| 73 |
+
Everyone interacting in the pip project's codebases, issue trackers, chat
|
| 74 |
+
rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.
|
| 75 |
+
|
| 76 |
+
.. _package installer: https://packaging.python.org/guides/tool-recommendations/
|
| 77 |
+
.. _Python Package Index: https://pypi.org
|
| 78 |
+
.. _Installation: https://pip.pypa.io/en/stable/installation/
|
| 79 |
+
.. _Usage: https://pip.pypa.io/en/stable/
|
| 80 |
+
.. _Release notes: https://pip.pypa.io/en/stable/news.html
|
| 81 |
+
.. _Release process: https://pip.pypa.io/en/latest/development/release-process/
|
| 82 |
+
.. _GitHub page: https://github.com/pypa/pip
|
| 83 |
+
.. _Development documentation: https://pip.pypa.io/en/latest/development
|
| 84 |
+
.. _Issue tracking: https://github.com/pypa/pip/issues
|
| 85 |
+
.. _Discourse channel: https://discuss.python.org/c/packaging
|
| 86 |
+
.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa
|
| 87 |
+
.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev
|
| 88 |
+
.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,1005 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
../../../bin/pip,sha256=J3UO1dQE4IkUGsV06uf5AddiDR_zOO1D2d1rPl8nrMU,253
|
| 2 |
+
../../../bin/pip3,sha256=J3UO1dQE4IkUGsV06uf5AddiDR_zOO1D2d1rPl8nrMU,253
|
| 3 |
+
../../../bin/pip3.12,sha256=J3UO1dQE4IkUGsV06uf5AddiDR_zOO1D2d1rPl8nrMU,253
|
| 4 |
+
pip-24.0.dist-info/AUTHORS.txt,sha256=SwXm4nkwRkmtnO1ZY-dLy7EPeoQNXMNLby5CN3GlNhY,10388
|
| 5 |
+
pip-24.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 6 |
+
pip-24.0.dist-info/LICENSE.txt,sha256=Y0MApmnUmurmWxLGxIySTFGkzfPR_whtw0VtyLyqIQQ,1093
|
| 7 |
+
pip-24.0.dist-info/METADATA,sha256=kNEfJ3_Vho2mee4lfJdlbd5RHIqsfQJSMUB-bOkIOeI,3581
|
| 8 |
+
pip-24.0.dist-info/RECORD,,
|
| 9 |
+
pip-24.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 10 |
+
pip-24.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
| 11 |
+
pip-24.0.dist-info/entry_points.txt,sha256=Fa_c0b-xGFaYxagIruvpJD6qqXmNTA02vAVIkmMj-9o,125
|
| 12 |
+
pip-24.0.dist-info/top_level.txt,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 13 |
+
pip/__init__.py,sha256=oAk1nFpLmUVS5Ln7NxvNoGUn5Vkn6FGQjPaNDf8Q8pk,355
|
| 14 |
+
pip/__main__.py,sha256=WzbhHXTbSE6gBY19mNN9m4s5o_365LOvTYSgqgbdBhE,854
|
| 15 |
+
pip/__pip-runner__.py,sha256=EnrfKmKMzWAdqg_JicLCOP9Y95Ux7zHh4ObvqLtQcjo,1444
|
| 16 |
+
pip/__pycache__/__init__.cpython-312.pyc,,
|
| 17 |
+
pip/__pycache__/__main__.cpython-312.pyc,,
|
| 18 |
+
pip/__pycache__/__pip-runner__.cpython-312.pyc,,
|
| 19 |
+
pip/_internal/__init__.py,sha256=iqZ5-YQsQV08tkUc7L806Reop6tguLFWf70ySF6be0Y,515
|
| 20 |
+
pip/_internal/__pycache__/__init__.cpython-312.pyc,,
|
| 21 |
+
pip/_internal/__pycache__/build_env.cpython-312.pyc,,
|
| 22 |
+
pip/_internal/__pycache__/cache.cpython-312.pyc,,
|
| 23 |
+
pip/_internal/__pycache__/configuration.cpython-312.pyc,,
|
| 24 |
+
pip/_internal/__pycache__/exceptions.cpython-312.pyc,,
|
| 25 |
+
pip/_internal/__pycache__/main.cpython-312.pyc,,
|
| 26 |
+
pip/_internal/__pycache__/pyproject.cpython-312.pyc,,
|
| 27 |
+
pip/_internal/__pycache__/self_outdated_check.cpython-312.pyc,,
|
| 28 |
+
pip/_internal/__pycache__/wheel_builder.cpython-312.pyc,,
|
| 29 |
+
pip/_internal/build_env.py,sha256=1ESpqw0iupS_K7phZK5zshVE5Czy9BtGLFU4W6Enva8,10243
|
| 30 |
+
pip/_internal/cache.py,sha256=uiYD-9F0Bv1C8ZyWE85lpzDmQf7hcUkgL99GmI8I41Q,10370
|
| 31 |
+
pip/_internal/cli/__init__.py,sha256=FkHBgpxxb-_gd6r1FjnNhfMOzAUYyXoXKJ6abijfcFU,132
|
| 32 |
+
pip/_internal/cli/__pycache__/__init__.cpython-312.pyc,,
|
| 33 |
+
pip/_internal/cli/__pycache__/autocompletion.cpython-312.pyc,,
|
| 34 |
+
pip/_internal/cli/__pycache__/base_command.cpython-312.pyc,,
|
| 35 |
+
pip/_internal/cli/__pycache__/cmdoptions.cpython-312.pyc,,
|
| 36 |
+
pip/_internal/cli/__pycache__/command_context.cpython-312.pyc,,
|
| 37 |
+
pip/_internal/cli/__pycache__/main.cpython-312.pyc,,
|
| 38 |
+
pip/_internal/cli/__pycache__/main_parser.cpython-312.pyc,,
|
| 39 |
+
pip/_internal/cli/__pycache__/parser.cpython-312.pyc,,
|
| 40 |
+
pip/_internal/cli/__pycache__/progress_bars.cpython-312.pyc,,
|
| 41 |
+
pip/_internal/cli/__pycache__/req_command.cpython-312.pyc,,
|
| 42 |
+
pip/_internal/cli/__pycache__/spinners.cpython-312.pyc,,
|
| 43 |
+
pip/_internal/cli/__pycache__/status_codes.cpython-312.pyc,,
|
| 44 |
+
pip/_internal/cli/autocompletion.py,sha256=_br_5NgSxSuvPjMF0MLHzS5s6BpSkQAQHKrLK89VauM,6690
|
| 45 |
+
pip/_internal/cli/base_command.py,sha256=iuVWGa2oTq7gBReo0er3Z0tXJ2oqBIC6QjDHcnDhKXY,8733
|
| 46 |
+
pip/_internal/cli/cmdoptions.py,sha256=V8ggG6AtHpHKkH_6tRU0mhJaZTeqtrFpu75ghvMXXJk,30063
|
| 47 |
+
pip/_internal/cli/command_context.py,sha256=RHgIPwtObh5KhMrd3YZTkl8zbVG-6Okml7YbFX4Ehg0,774
|
| 48 |
+
pip/_internal/cli/main.py,sha256=Uzxt_YD1hIvB1AW5mxt6IVcht5G712AtMqdo51UMhmQ,2816
|
| 49 |
+
pip/_internal/cli/main_parser.py,sha256=laDpsuBDl6kyfywp9eMMA9s84jfH2TJJn-vmL0GG90w,4338
|
| 50 |
+
pip/_internal/cli/parser.py,sha256=KW6C3-7-4ErTNB0TfLTKwOdHcd-qefCeGnrOoE2r0RQ,10781
|
| 51 |
+
pip/_internal/cli/progress_bars.py,sha256=So4mPoSjXkXiSHiTzzquH3VVyVD_njXlHJSExYPXAow,1968
|
| 52 |
+
pip/_internal/cli/req_command.py,sha256=c7_XHABnXmD3_qlK9-r37KqdKBAcgmVKvQ2WcTrNLfc,18369
|
| 53 |
+
pip/_internal/cli/spinners.py,sha256=hIJ83GerdFgFCdobIA23Jggetegl_uC4Sp586nzFbPE,5118
|
| 54 |
+
pip/_internal/cli/status_codes.py,sha256=sEFHUaUJbqv8iArL3HAtcztWZmGOFX01hTesSytDEh0,116
|
| 55 |
+
pip/_internal/commands/__init__.py,sha256=5oRO9O3dM2vGuh0bFw4HOVletryrz5HHMmmPWwJrH9U,3882
|
| 56 |
+
pip/_internal/commands/__pycache__/__init__.cpython-312.pyc,,
|
| 57 |
+
pip/_internal/commands/__pycache__/cache.cpython-312.pyc,,
|
| 58 |
+
pip/_internal/commands/__pycache__/check.cpython-312.pyc,,
|
| 59 |
+
pip/_internal/commands/__pycache__/completion.cpython-312.pyc,,
|
| 60 |
+
pip/_internal/commands/__pycache__/configuration.cpython-312.pyc,,
|
| 61 |
+
pip/_internal/commands/__pycache__/debug.cpython-312.pyc,,
|
| 62 |
+
pip/_internal/commands/__pycache__/download.cpython-312.pyc,,
|
| 63 |
+
pip/_internal/commands/__pycache__/freeze.cpython-312.pyc,,
|
| 64 |
+
pip/_internal/commands/__pycache__/hash.cpython-312.pyc,,
|
| 65 |
+
pip/_internal/commands/__pycache__/help.cpython-312.pyc,,
|
| 66 |
+
pip/_internal/commands/__pycache__/index.cpython-312.pyc,,
|
| 67 |
+
pip/_internal/commands/__pycache__/inspect.cpython-312.pyc,,
|
| 68 |
+
pip/_internal/commands/__pycache__/install.cpython-312.pyc,,
|
| 69 |
+
pip/_internal/commands/__pycache__/list.cpython-312.pyc,,
|
| 70 |
+
pip/_internal/commands/__pycache__/search.cpython-312.pyc,,
|
| 71 |
+
pip/_internal/commands/__pycache__/show.cpython-312.pyc,,
|
| 72 |
+
pip/_internal/commands/__pycache__/uninstall.cpython-312.pyc,,
|
| 73 |
+
pip/_internal/commands/__pycache__/wheel.cpython-312.pyc,,
|
| 74 |
+
pip/_internal/commands/cache.py,sha256=xg76_ZFEBC6zoQ3gXLRfMZJft4z2a0RwH4GEFZC6nnU,7944
|
| 75 |
+
pip/_internal/commands/check.py,sha256=Rb13Q28yoLh0j1gpx5SU0jlResNct21eQCRsnaO9xKA,1782
|
| 76 |
+
pip/_internal/commands/completion.py,sha256=HT4lD0bgsflHq2IDgYfiEdp7IGGtE7s6MgI3xn0VQEw,4287
|
| 77 |
+
pip/_internal/commands/configuration.py,sha256=n98enwp6y0b5G6fiRQjaZo43FlJKYve_daMhN-4BRNc,9766
|
| 78 |
+
pip/_internal/commands/debug.py,sha256=63972uUCeMIGOdMMVeIUGrOjTOqTVWplFC82a-hcKyA,6777
|
| 79 |
+
pip/_internal/commands/download.py,sha256=e4hw088zGo26WmJaMIRvCniLlLmoOjqolGyfHjsCkCQ,5335
|
| 80 |
+
pip/_internal/commands/freeze.py,sha256=qrIHS_-c6JPrQ92hMhAv9kkl0bHgFpRLwYJDdbcYr1o,3243
|
| 81 |
+
pip/_internal/commands/hash.py,sha256=EVVOuvGtoPEdFi8SNnmdqlCQrhCxV-kJsdwtdcCnXGQ,1703
|
| 82 |
+
pip/_internal/commands/help.py,sha256=gcc6QDkcgHMOuAn5UxaZwAStsRBrnGSn_yxjS57JIoM,1132
|
| 83 |
+
pip/_internal/commands/index.py,sha256=CNXQer_PeZKSJooURcCFCBEKGfwyNoUWYP_MWczAcOM,4775
|
| 84 |
+
pip/_internal/commands/inspect.py,sha256=2wSPt9yfr3r6g-s2S5L6PvRtaHNVyb4TuodMStJ39cw,3188
|
| 85 |
+
pip/_internal/commands/install.py,sha256=VxDd-BD3a27ApeE2OK34rfBXS6Zo2wtemK9-HCwPqxM,28782
|
| 86 |
+
pip/_internal/commands/list.py,sha256=-QbpPuGDiGN1SdThsk2ml8beBnepliefbGhMAN8tkzU,12547
|
| 87 |
+
pip/_internal/commands/search.py,sha256=sbBZiARRc050QquOKcCvOr2K3XLsoYebLKZGRi__iUI,5697
|
| 88 |
+
pip/_internal/commands/show.py,sha256=t5jia4zcYJRJZy4U_Von7zMl03hJmmcofj6oDNTnj7Y,6419
|
| 89 |
+
pip/_internal/commands/uninstall.py,sha256=OIqO9tqadY8kM4HwhFf1Q62fUIp7v8KDrTRo8yWMz7Y,3886
|
| 90 |
+
pip/_internal/commands/wheel.py,sha256=CSnX8Pmf1oPCnd7j7bn1_f58G9KHNiAblvVJ5zykN-A,6476
|
| 91 |
+
pip/_internal/configuration.py,sha256=XkAiBS0hpzsM-LF0Qu5hvPWO_Bs67-oQKRYFBuMbESs,14006
|
| 92 |
+
pip/_internal/distributions/__init__.py,sha256=Hq6kt6gXBgjNit5hTTWLAzeCNOKoB-N0pGYSqehrli8,858
|
| 93 |
+
pip/_internal/distributions/__pycache__/__init__.cpython-312.pyc,,
|
| 94 |
+
pip/_internal/distributions/__pycache__/base.cpython-312.pyc,,
|
| 95 |
+
pip/_internal/distributions/__pycache__/installed.cpython-312.pyc,,
|
| 96 |
+
pip/_internal/distributions/__pycache__/sdist.cpython-312.pyc,,
|
| 97 |
+
pip/_internal/distributions/__pycache__/wheel.cpython-312.pyc,,
|
| 98 |
+
pip/_internal/distributions/base.py,sha256=oRSEvnv2ZjBnargamnv2fcJa1n6gUDKaW0g6CWSEpWs,1743
|
| 99 |
+
pip/_internal/distributions/installed.py,sha256=QinHFbWAQ8oE0pbD8MFZWkwlnfU1QYTccA1vnhrlYOU,842
|
| 100 |
+
pip/_internal/distributions/sdist.py,sha256=4K3V0VNMllHbBzCJibjwd_tylUKpmIdu2AQyhplvCQo,6709
|
| 101 |
+
pip/_internal/distributions/wheel.py,sha256=-ma3sOtUQj0AxXCEb6_Fhmjl3nh4k3A0HC2taAb2N-4,1277
|
| 102 |
+
pip/_internal/exceptions.py,sha256=TmF1iNFEneSWaemwlg6a5bpPuq2cMHK7d1-SvjsQHb0,23634
|
| 103 |
+
pip/_internal/index/__init__.py,sha256=vpt-JeTZefh8a-FC22ZeBSXFVbuBcXSGiILhQZJaNpQ,30
|
| 104 |
+
pip/_internal/index/__pycache__/__init__.cpython-312.pyc,,
|
| 105 |
+
pip/_internal/index/__pycache__/collector.cpython-312.pyc,,
|
| 106 |
+
pip/_internal/index/__pycache__/package_finder.cpython-312.pyc,,
|
| 107 |
+
pip/_internal/index/__pycache__/sources.cpython-312.pyc,,
|
| 108 |
+
pip/_internal/index/collector.py,sha256=sH0tL_cOoCk6pLLfCSGVjFM4rPEJtllF-VobvAvLSH4,16590
|
| 109 |
+
pip/_internal/index/package_finder.py,sha256=S_nC8gzVIMY6ikWfKoSOzRtoesUqnfNhAPl_BwSOusA,37843
|
| 110 |
+
pip/_internal/index/sources.py,sha256=dJegiR9f86kslaAHcv9-R5L_XBf5Rzm_FkyPteDuPxI,8688
|
| 111 |
+
pip/_internal/locations/__init__.py,sha256=Dh8LJWG8LRlDK4JIj9sfRF96TREzE--N_AIlx7Tqoe4,15365
|
| 112 |
+
pip/_internal/locations/__pycache__/__init__.cpython-312.pyc,,
|
| 113 |
+
pip/_internal/locations/__pycache__/_distutils.cpython-312.pyc,,
|
| 114 |
+
pip/_internal/locations/__pycache__/_sysconfig.cpython-312.pyc,,
|
| 115 |
+
pip/_internal/locations/__pycache__/base.cpython-312.pyc,,
|
| 116 |
+
pip/_internal/locations/_distutils.py,sha256=H9ZHK_35rdDV1Qsmi4QeaBULjFT4Mbu6QuoVGkJ6QHI,6009
|
| 117 |
+
pip/_internal/locations/_sysconfig.py,sha256=jyNVtUfMIf0mtyY-Xp1m9yQ8iwECozSVVFmjkN9a2yw,7680
|
| 118 |
+
pip/_internal/locations/base.py,sha256=RQiPi1d4FVM2Bxk04dQhXZ2PqkeljEL2fZZ9SYqIQ78,2556
|
| 119 |
+
pip/_internal/main.py,sha256=r-UnUe8HLo5XFJz8inTcOOTiu_sxNhgHb6VwlGUllOI,340
|
| 120 |
+
pip/_internal/metadata/__init__.py,sha256=9pU3W3s-6HtjFuYhWcLTYVmSaziklPv7k2x8p7X1GmA,4339
|
| 121 |
+
pip/_internal/metadata/__pycache__/__init__.cpython-312.pyc,,
|
| 122 |
+
pip/_internal/metadata/__pycache__/_json.cpython-312.pyc,,
|
| 123 |
+
pip/_internal/metadata/__pycache__/base.cpython-312.pyc,,
|
| 124 |
+
pip/_internal/metadata/__pycache__/pkg_resources.cpython-312.pyc,,
|
| 125 |
+
pip/_internal/metadata/_json.py,sha256=Rz5M5ciSNvITwaTQR6NfN8TgKgM5WfTws4D6CFknovE,2627
|
| 126 |
+
pip/_internal/metadata/base.py,sha256=l3Wgku4xlgr8s4p6fS-3qQ4QKOpPbWLRwi5d9omEFG4,25907
|
| 127 |
+
pip/_internal/metadata/importlib/__init__.py,sha256=jUUidoxnHcfITHHaAWG1G2i5fdBYklv_uJcjo2x7VYE,135
|
| 128 |
+
pip/_internal/metadata/importlib/__pycache__/__init__.cpython-312.pyc,,
|
| 129 |
+
pip/_internal/metadata/importlib/__pycache__/_compat.cpython-312.pyc,,
|
| 130 |
+
pip/_internal/metadata/importlib/__pycache__/_dists.cpython-312.pyc,,
|
| 131 |
+
pip/_internal/metadata/importlib/__pycache__/_envs.cpython-312.pyc,,
|
| 132 |
+
pip/_internal/metadata/importlib/_compat.py,sha256=GAe_prIfCE4iUylrnr_2dJRlkkBVRUbOidEoID7LPoE,1882
|
| 133 |
+
pip/_internal/metadata/importlib/_dists.py,sha256=UPl1wUujFqiwiltRJ1tMF42WRINO1sSpNNlYQ2mX0mk,8297
|
| 134 |
+
pip/_internal/metadata/importlib/_envs.py,sha256=XTaFIYERP2JF0QUZuPx2ETiugXbPEcZ8q8ZKeht6Lpc,7456
|
| 135 |
+
pip/_internal/metadata/pkg_resources.py,sha256=opjw4IBSqHvie6sXJ_cbT42meygoPEUfNURJuWZY7sk,10035
|
| 136 |
+
pip/_internal/models/__init__.py,sha256=3DHUd_qxpPozfzouoqa9g9ts1Czr5qaHfFxbnxriepM,63
|
| 137 |
+
pip/_internal/models/__pycache__/__init__.cpython-312.pyc,,
|
| 138 |
+
pip/_internal/models/__pycache__/candidate.cpython-312.pyc,,
|
| 139 |
+
pip/_internal/models/__pycache__/direct_url.cpython-312.pyc,,
|
| 140 |
+
pip/_internal/models/__pycache__/format_control.cpython-312.pyc,,
|
| 141 |
+
pip/_internal/models/__pycache__/index.cpython-312.pyc,,
|
| 142 |
+
pip/_internal/models/__pycache__/installation_report.cpython-312.pyc,,
|
| 143 |
+
pip/_internal/models/__pycache__/link.cpython-312.pyc,,
|
| 144 |
+
pip/_internal/models/__pycache__/scheme.cpython-312.pyc,,
|
| 145 |
+
pip/_internal/models/__pycache__/search_scope.cpython-312.pyc,,
|
| 146 |
+
pip/_internal/models/__pycache__/selection_prefs.cpython-312.pyc,,
|
| 147 |
+
pip/_internal/models/__pycache__/target_python.cpython-312.pyc,,
|
| 148 |
+
pip/_internal/models/__pycache__/wheel.cpython-312.pyc,,
|
| 149 |
+
pip/_internal/models/candidate.py,sha256=hEPu8VdGE5qVASv6vLz-R-Rgh5-7LMbai1jgthMCd8M,931
|
| 150 |
+
pip/_internal/models/direct_url.py,sha256=FwouYBKcqckh7B-k2H3HVgRhhFTukFwqiS3kfvtFLSk,6889
|
| 151 |
+
pip/_internal/models/format_control.py,sha256=wtsQqSK9HaUiNxQEuB-C62eVimw6G4_VQFxV9-_KDBE,2486
|
| 152 |
+
pip/_internal/models/index.py,sha256=tYnL8oxGi4aSNWur0mG8DAP7rC6yuha_MwJO8xw0crI,1030
|
| 153 |
+
pip/_internal/models/installation_report.py,sha256=zRVZoaz-2vsrezj_H3hLOhMZCK9c7TbzWgC-jOalD00,2818
|
| 154 |
+
pip/_internal/models/link.py,sha256=XirOAGv1jgMu7vu87kuPbohGj7VHpwVrd2q3KUgVQNg,20777
|
| 155 |
+
pip/_internal/models/scheme.py,sha256=3EFQp_ICu_shH1-TBqhl0QAusKCPDFOlgHFeN4XowWs,738
|
| 156 |
+
pip/_internal/models/search_scope.py,sha256=ASVyyZxiJILw7bTIVVpJx8J293M3Hk5F33ilGn0e80c,4643
|
| 157 |
+
pip/_internal/models/selection_prefs.py,sha256=KZdi66gsR-_RUXUr9uejssk3rmTHrQVJWeNA2sV-VSY,1907
|
| 158 |
+
pip/_internal/models/target_python.py,sha256=34EkorrMuRvRp-bjqHKJ-bOO71m9xdjN2b8WWFEC2HU,4272
|
| 159 |
+
pip/_internal/models/wheel.py,sha256=YqazoIZyma_Q1ejFa1C7NHKQRRWlvWkdK96VRKmDBeI,3600
|
| 160 |
+
pip/_internal/network/__init__.py,sha256=jf6Tt5nV_7zkARBrKojIXItgejvoegVJVKUbhAa5Ioc,50
|
| 161 |
+
pip/_internal/network/__pycache__/__init__.cpython-312.pyc,,
|
| 162 |
+
pip/_internal/network/__pycache__/auth.cpython-312.pyc,,
|
| 163 |
+
pip/_internal/network/__pycache__/cache.cpython-312.pyc,,
|
| 164 |
+
pip/_internal/network/__pycache__/download.cpython-312.pyc,,
|
| 165 |
+
pip/_internal/network/__pycache__/lazy_wheel.cpython-312.pyc,,
|
| 166 |
+
pip/_internal/network/__pycache__/session.cpython-312.pyc,,
|
| 167 |
+
pip/_internal/network/__pycache__/utils.cpython-312.pyc,,
|
| 168 |
+
pip/_internal/network/__pycache__/xmlrpc.cpython-312.pyc,,
|
| 169 |
+
pip/_internal/network/auth.py,sha256=TC-OcW2KU4W6R1hU4qPgQXvVH54adACpZz6sWq-R9NA,20541
|
| 170 |
+
pip/_internal/network/cache.py,sha256=48A971qCzKNFvkb57uGEk7-0xaqPS0HWj2711QNTxkU,3935
|
| 171 |
+
pip/_internal/network/download.py,sha256=i0Tn55CD5D7XYEFY3TxiYaCf0OaaTQ6SScNgCsSeV14,6086
|
| 172 |
+
pip/_internal/network/lazy_wheel.py,sha256=2PXVduYZPCPZkkQFe1J1GbfHJWeCU--FXonGyIfw9eU,7638
|
| 173 |
+
pip/_internal/network/session.py,sha256=9tqEDD8JiVaFdplOEXJxNo9cjRfBZ6RIa0yQQ_qBNiM,18698
|
| 174 |
+
pip/_internal/network/utils.py,sha256=6A5SrUJEEUHxbGtbscwU2NpCyz-3ztiDlGWHpRRhsJ8,4073
|
| 175 |
+
pip/_internal/network/xmlrpc.py,sha256=sAxzOacJ-N1NXGPvap9jC3zuYWSnnv3GXtgR2-E2APA,1838
|
| 176 |
+
pip/_internal/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 177 |
+
pip/_internal/operations/__pycache__/__init__.cpython-312.pyc,,
|
| 178 |
+
pip/_internal/operations/__pycache__/check.cpython-312.pyc,,
|
| 179 |
+
pip/_internal/operations/__pycache__/freeze.cpython-312.pyc,,
|
| 180 |
+
pip/_internal/operations/__pycache__/prepare.cpython-312.pyc,,
|
| 181 |
+
pip/_internal/operations/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 182 |
+
pip/_internal/operations/build/__pycache__/__init__.cpython-312.pyc,,
|
| 183 |
+
pip/_internal/operations/build/__pycache__/build_tracker.cpython-312.pyc,,
|
| 184 |
+
pip/_internal/operations/build/__pycache__/metadata.cpython-312.pyc,,
|
| 185 |
+
pip/_internal/operations/build/__pycache__/metadata_editable.cpython-312.pyc,,
|
| 186 |
+
pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-312.pyc,,
|
| 187 |
+
pip/_internal/operations/build/__pycache__/wheel.cpython-312.pyc,,
|
| 188 |
+
pip/_internal/operations/build/__pycache__/wheel_editable.cpython-312.pyc,,
|
| 189 |
+
pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-312.pyc,,
|
| 190 |
+
pip/_internal/operations/build/build_tracker.py,sha256=z-H5DOknZdBa3dh2Vq6VBMY5qLYIKmlj2p6CGZK5Lc8,4832
|
| 191 |
+
pip/_internal/operations/build/metadata.py,sha256=9S0CUD8U3QqZeXp-Zyt8HxwU90lE4QrnYDgrqZDzBnc,1422
|
| 192 |
+
pip/_internal/operations/build/metadata_editable.py,sha256=VLL7LvntKE8qxdhUdEJhcotFzUsOSI8NNS043xULKew,1474
|
| 193 |
+
pip/_internal/operations/build/metadata_legacy.py,sha256=o-eU21As175hDC7dluM1fJJ_FqokTIShyWpjKaIpHZw,2198
|
| 194 |
+
pip/_internal/operations/build/wheel.py,sha256=sT12FBLAxDC6wyrDorh8kvcZ1jG5qInCRWzzP-UkJiQ,1075
|
| 195 |
+
pip/_internal/operations/build/wheel_editable.py,sha256=yOtoH6zpAkoKYEUtr8FhzrYnkNHQaQBjWQ2HYae1MQg,1417
|
| 196 |
+
pip/_internal/operations/build/wheel_legacy.py,sha256=C9j6rukgQI1n_JeQLoZGuDdfUwzCXShyIdPTp6edbMQ,3064
|
| 197 |
+
pip/_internal/operations/check.py,sha256=fsqA88iGaqftCr2tlP3sSU202CSkoODRtW0O-JU9M4Y,6806
|
| 198 |
+
pip/_internal/operations/freeze.py,sha256=uqoeTAf6HOYVMR2UgAT8N85UZoGEVEoQdan_Ao6SOfk,9816
|
| 199 |
+
pip/_internal/operations/install/__init__.py,sha256=mX7hyD2GNBO2mFGokDQ30r_GXv7Y_PLdtxcUv144e-s,51
|
| 200 |
+
pip/_internal/operations/install/__pycache__/__init__.cpython-312.pyc,,
|
| 201 |
+
pip/_internal/operations/install/__pycache__/editable_legacy.cpython-312.pyc,,
|
| 202 |
+
pip/_internal/operations/install/__pycache__/wheel.cpython-312.pyc,,
|
| 203 |
+
pip/_internal/operations/install/editable_legacy.py,sha256=YeR0KadWXw_ZheC1NtAG1qVIEkOgRGHc23x-YtGW7NU,1282
|
| 204 |
+
pip/_internal/operations/install/wheel.py,sha256=9hGb1c4bRnPIb2FG7CtUSPfPxqprmHQBtwIAlWPNTtE,27311
|
| 205 |
+
pip/_internal/operations/prepare.py,sha256=57Oq87HfunX3Rbqp47FdaJr9cHbAKUm_3gv7WhBAqbE,28128
|
| 206 |
+
pip/_internal/pyproject.py,sha256=4Xszp11xgr126yzG6BbJA0oaQ9WXuhb0jyUb-y_6lPQ,7152
|
| 207 |
+
pip/_internal/req/__init__.py,sha256=TELFgZOof3lhMmaICVWL9U7PlhXo9OufokbMAJ6J2GI,2738
|
| 208 |
+
pip/_internal/req/__pycache__/__init__.cpython-312.pyc,,
|
| 209 |
+
pip/_internal/req/__pycache__/constructors.cpython-312.pyc,,
|
| 210 |
+
pip/_internal/req/__pycache__/req_file.cpython-312.pyc,,
|
| 211 |
+
pip/_internal/req/__pycache__/req_install.cpython-312.pyc,,
|
| 212 |
+
pip/_internal/req/__pycache__/req_set.cpython-312.pyc,,
|
| 213 |
+
pip/_internal/req/__pycache__/req_uninstall.cpython-312.pyc,,
|
| 214 |
+
pip/_internal/req/constructors.py,sha256=8hlY56imEthLORRwmloyKz3YOyXymIaKsNB6P9ewvNI,19018
|
| 215 |
+
pip/_internal/req/req_file.py,sha256=M8ttOZL-PwAj7scPElhW3ZD2hiD9mm_6FJAGIbwAzEI,17790
|
| 216 |
+
pip/_internal/req/req_install.py,sha256=wtOPxkyRSM8comTks8oL1Gp2oyGqbH7JwIDRci2QiPk,35460
|
| 217 |
+
pip/_internal/req/req_set.py,sha256=iMYDUToSgkxFyrP_OrTtPSgw4dwjRyGRDpGooTqeA4Y,4704
|
| 218 |
+
pip/_internal/req/req_uninstall.py,sha256=nmvTQaRCC0iu-5Tw0djlXJhSj6WmqHRvT3qkkEdC35E,24551
|
| 219 |
+
pip/_internal/resolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 220 |
+
pip/_internal/resolution/__pycache__/__init__.cpython-312.pyc,,
|
| 221 |
+
pip/_internal/resolution/__pycache__/base.cpython-312.pyc,,
|
| 222 |
+
pip/_internal/resolution/base.py,sha256=qlmh325SBVfvG6Me9gc5Nsh5sdwHBwzHBq6aEXtKsLA,583
|
| 223 |
+
pip/_internal/resolution/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 224 |
+
pip/_internal/resolution/legacy/__pycache__/__init__.cpython-312.pyc,,
|
| 225 |
+
pip/_internal/resolution/legacy/__pycache__/resolver.cpython-312.pyc,,
|
| 226 |
+
pip/_internal/resolution/legacy/resolver.py,sha256=Xk24jQ62GvLr4Mc7IjN_qiO88qp0BImzVmPIFz9QLOE,24025
|
| 227 |
+
pip/_internal/resolution/resolvelib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 228 |
+
pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-312.pyc,,
|
| 229 |
+
pip/_internal/resolution/resolvelib/__pycache__/base.cpython-312.pyc,,
|
| 230 |
+
pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-312.pyc,,
|
| 231 |
+
pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-312.pyc,,
|
| 232 |
+
pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-312.pyc,,
|
| 233 |
+
pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-312.pyc,,
|
| 234 |
+
pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-312.pyc,,
|
| 235 |
+
pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-312.pyc,,
|
| 236 |
+
pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-312.pyc,,
|
| 237 |
+
pip/_internal/resolution/resolvelib/base.py,sha256=jg5COmHLhmBIKOR-4spdJD3jyULYa1BdsqiBu2YJnJ4,5173
|
| 238 |
+
pip/_internal/resolution/resolvelib/candidates.py,sha256=19Ki91Po-MSxBknGIfOGkaWkFdOznN0W_nKv7jL28L0,21052
|
| 239 |
+
pip/_internal/resolution/resolvelib/factory.py,sha256=vqqk-hjchdhShwWVdeW2_A-5ZblLhE_nC_v3Mhz4Svc,32292
|
| 240 |
+
pip/_internal/resolution/resolvelib/found_candidates.py,sha256=hvL3Hoa9VaYo-qEOZkBi2Iqw251UDxPz-uMHVaWmLpE,5705
|
| 241 |
+
pip/_internal/resolution/resolvelib/provider.py,sha256=4t23ivjruqM6hKBX1KpGiTt-M4HGhRcZnGLV0c01K7U,9824
|
| 242 |
+
pip/_internal/resolution/resolvelib/reporter.py,sha256=YFm9hQvz4DFCbjZeFTQ56hTz3Ac-mDBnHkeNRVvMHLY,3100
|
| 243 |
+
pip/_internal/resolution/resolvelib/requirements.py,sha256=-kJONP0WjDfdTvBAs2vUXPgAnOyNIBEAXY4b72ogtPE,5696
|
| 244 |
+
pip/_internal/resolution/resolvelib/resolver.py,sha256=nLJOsVMEVi2gQUVJoUFKMZAeu2f7GRMjGMvNSWyz0Bc,12592
|
| 245 |
+
pip/_internal/self_outdated_check.py,sha256=saxQLB8UzIFtMScquytG10TOTsYVFJQ_mkW1NY-46wE,8378
|
| 246 |
+
pip/_internal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 247 |
+
pip/_internal/utils/__pycache__/__init__.cpython-312.pyc,,
|
| 248 |
+
pip/_internal/utils/__pycache__/_jaraco_text.cpython-312.pyc,,
|
| 249 |
+
pip/_internal/utils/__pycache__/_log.cpython-312.pyc,,
|
| 250 |
+
pip/_internal/utils/__pycache__/appdirs.cpython-312.pyc,,
|
| 251 |
+
pip/_internal/utils/__pycache__/compat.cpython-312.pyc,,
|
| 252 |
+
pip/_internal/utils/__pycache__/compatibility_tags.cpython-312.pyc,,
|
| 253 |
+
pip/_internal/utils/__pycache__/datetime.cpython-312.pyc,,
|
| 254 |
+
pip/_internal/utils/__pycache__/deprecation.cpython-312.pyc,,
|
| 255 |
+
pip/_internal/utils/__pycache__/direct_url_helpers.cpython-312.pyc,,
|
| 256 |
+
pip/_internal/utils/__pycache__/egg_link.cpython-312.pyc,,
|
| 257 |
+
pip/_internal/utils/__pycache__/encoding.cpython-312.pyc,,
|
| 258 |
+
pip/_internal/utils/__pycache__/entrypoints.cpython-312.pyc,,
|
| 259 |
+
pip/_internal/utils/__pycache__/filesystem.cpython-312.pyc,,
|
| 260 |
+
pip/_internal/utils/__pycache__/filetypes.cpython-312.pyc,,
|
| 261 |
+
pip/_internal/utils/__pycache__/glibc.cpython-312.pyc,,
|
| 262 |
+
pip/_internal/utils/__pycache__/hashes.cpython-312.pyc,,
|
| 263 |
+
pip/_internal/utils/__pycache__/logging.cpython-312.pyc,,
|
| 264 |
+
pip/_internal/utils/__pycache__/misc.cpython-312.pyc,,
|
| 265 |
+
pip/_internal/utils/__pycache__/models.cpython-312.pyc,,
|
| 266 |
+
pip/_internal/utils/__pycache__/packaging.cpython-312.pyc,,
|
| 267 |
+
pip/_internal/utils/__pycache__/setuptools_build.cpython-312.pyc,,
|
| 268 |
+
pip/_internal/utils/__pycache__/subprocess.cpython-312.pyc,,
|
| 269 |
+
pip/_internal/utils/__pycache__/temp_dir.cpython-312.pyc,,
|
| 270 |
+
pip/_internal/utils/__pycache__/unpacking.cpython-312.pyc,,
|
| 271 |
+
pip/_internal/utils/__pycache__/urls.cpython-312.pyc,,
|
| 272 |
+
pip/_internal/utils/__pycache__/virtualenv.cpython-312.pyc,,
|
| 273 |
+
pip/_internal/utils/__pycache__/wheel.cpython-312.pyc,,
|
| 274 |
+
pip/_internal/utils/_jaraco_text.py,sha256=yvDGelTVugRayPaOF2k4ab0Ky4d3uOkAfuOQjASjImY,3351
|
| 275 |
+
pip/_internal/utils/_log.py,sha256=-jHLOE_THaZz5BFcCnoSL9EYAtJ0nXem49s9of4jvKw,1015
|
| 276 |
+
pip/_internal/utils/appdirs.py,sha256=swgcTKOm3daLeXTW6v5BUS2Ti2RvEnGRQYH_yDXklAo,1665
|
| 277 |
+
pip/_internal/utils/compat.py,sha256=ACyBfLgj3_XG-iA5omEDrXqDM0cQKzi8h8HRBInzG6Q,1884
|
| 278 |
+
pip/_internal/utils/compatibility_tags.py,sha256=ydin8QG8BHqYRsPY4OL6cmb44CbqXl1T0xxS97VhHkk,5377
|
| 279 |
+
pip/_internal/utils/datetime.py,sha256=m21Y3wAtQc-ji6Veb6k_M5g6A0ZyFI4egchTdnwh-pQ,242
|
| 280 |
+
pip/_internal/utils/deprecation.py,sha256=NKo8VqLioJ4nnXXGmW4KdasxF90EFHkZaHeX1fT08C8,3627
|
| 281 |
+
pip/_internal/utils/direct_url_helpers.py,sha256=6F1tc2rcKaCZmgfVwsE6ObIe_Pux23mUVYA-2D9wCFc,3206
|
| 282 |
+
pip/_internal/utils/egg_link.py,sha256=0FePZoUYKv4RGQ2t6x7w5Z427wbA_Uo3WZnAkrgsuqo,2463
|
| 283 |
+
pip/_internal/utils/encoding.py,sha256=qqsXDtiwMIjXMEiIVSaOjwH5YmirCaK-dIzb6-XJsL0,1169
|
| 284 |
+
pip/_internal/utils/entrypoints.py,sha256=YlhLTRl2oHBAuqhc-zmL7USS67TPWVHImjeAQHreZTQ,3064
|
| 285 |
+
pip/_internal/utils/filesystem.py,sha256=RhMIXUaNVMGjc3rhsDahWQ4MavvEQDdqXqgq-F6fpw8,5122
|
| 286 |
+
pip/_internal/utils/filetypes.py,sha256=i8XAQ0eFCog26Fw9yV0Yb1ygAqKYB1w9Cz9n0fj8gZU,716
|
| 287 |
+
pip/_internal/utils/glibc.py,sha256=Mesxxgg3BLxheLZx-dSf30b6gKpOgdVXw6W--uHSszQ,3113
|
| 288 |
+
pip/_internal/utils/hashes.py,sha256=MjOigC75z6qoRMkgHiHqot7eqxfwDZSrEflJMPm-bHE,5118
|
| 289 |
+
pip/_internal/utils/logging.py,sha256=fdtuZJ-AKkqwDTANDvGcBEpssL8el7T1jnwk1CnZl3Y,11603
|
| 290 |
+
pip/_internal/utils/misc.py,sha256=fNXwaeeikvnUt4CPMFIL4-IQbZDxxjj4jDpzCi4ZsOw,23623
|
| 291 |
+
pip/_internal/utils/models.py,sha256=5GoYU586SrxURMvDn_jBMJInitviJg4O5-iOU-6I0WY,1193
|
| 292 |
+
pip/_internal/utils/packaging.py,sha256=5Wm6_x7lKrlqVjPI5MBN_RurcRHwVYoQ7Ksrs84de7s,2108
|
| 293 |
+
pip/_internal/utils/setuptools_build.py,sha256=ouXpud-jeS8xPyTPsXJ-m34NPvK5os45otAzdSV_IJE,4435
|
| 294 |
+
pip/_internal/utils/subprocess.py,sha256=zzdimb75jVLE1GU4WlTZ055gczhD7n1y1xTcNc7vNZQ,9207
|
| 295 |
+
pip/_internal/utils/temp_dir.py,sha256=DUAw22uFruQdK43i2L2K53C-CDjRCPeAsBKJpu-rHQ4,9312
|
| 296 |
+
pip/_internal/utils/unpacking.py,sha256=SBb2iV1crb89MDRTEKY86R4A_UOWApTQn9VQVcMDOlE,8821
|
| 297 |
+
pip/_internal/utils/urls.py,sha256=AhaesUGl-9it6uvG6fsFPOr9ynFpGaTMk4t5XTX7Z_Q,1759
|
| 298 |
+
pip/_internal/utils/virtualenv.py,sha256=S6f7csYorRpiD6cvn3jISZYc3I8PJC43H5iMFpRAEDU,3456
|
| 299 |
+
pip/_internal/utils/wheel.py,sha256=i4BwUNHattzN0ixy3HBAF04tZPRh2CcxaT6t86viwkE,4499
|
| 300 |
+
pip/_internal/vcs/__init__.py,sha256=UAqvzpbi0VbZo3Ub6skEeZAw-ooIZR-zX_WpCbxyCoU,596
|
| 301 |
+
pip/_internal/vcs/__pycache__/__init__.cpython-312.pyc,,
|
| 302 |
+
pip/_internal/vcs/__pycache__/bazaar.cpython-312.pyc,,
|
| 303 |
+
pip/_internal/vcs/__pycache__/git.cpython-312.pyc,,
|
| 304 |
+
pip/_internal/vcs/__pycache__/mercurial.cpython-312.pyc,,
|
| 305 |
+
pip/_internal/vcs/__pycache__/subversion.cpython-312.pyc,,
|
| 306 |
+
pip/_internal/vcs/__pycache__/versioncontrol.cpython-312.pyc,,
|
| 307 |
+
pip/_internal/vcs/bazaar.py,sha256=j0oin0fpGRHcCFCxEcpPCQoFEvA-DMLULKdGP8Nv76o,3519
|
| 308 |
+
pip/_internal/vcs/git.py,sha256=CeKBGJnl6uskvvjkAUXrJVxbHJrpS_B_pyfFdjL3CRc,18121
|
| 309 |
+
pip/_internal/vcs/mercurial.py,sha256=oULOhzJ2Uie-06d1omkL-_Gc6meGaUkyogvqG9ZCyPs,5249
|
| 310 |
+
pip/_internal/vcs/subversion.py,sha256=vhZs8L-TNggXqM1bbhl-FpbxE3TrIB6Tgnx8fh3S2HE,11729
|
| 311 |
+
pip/_internal/vcs/versioncontrol.py,sha256=3eIjtOMYvOY5qP6BMYIYDZ375CSuec6kSEB0bOo1cSs,22787
|
| 312 |
+
pip/_internal/wheel_builder.py,sha256=qTTzQV8F6b1jNsFCda1TRQC8J7gK-m7iuRNgKo7Dj68,11801
|
| 313 |
+
pip/_vendor/__init__.py,sha256=U51NPwXdA-wXOiANIQncYjcMp6txgeOL5nHxksJeyas,4993
|
| 314 |
+
pip/_vendor/__pycache__/__init__.cpython-312.pyc,,
|
| 315 |
+
pip/_vendor/__pycache__/six.cpython-312.pyc,,
|
| 316 |
+
pip/_vendor/__pycache__/typing_extensions.cpython-312.pyc,,
|
| 317 |
+
pip/_vendor/cachecontrol/__init__.py,sha256=ctHagMhQXuvQDdm4TirZrwDOT5H8oBNAJqzdKI6sovk,676
|
| 318 |
+
pip/_vendor/cachecontrol/__pycache__/__init__.cpython-312.pyc,,
|
| 319 |
+
pip/_vendor/cachecontrol/__pycache__/_cmd.cpython-312.pyc,,
|
| 320 |
+
pip/_vendor/cachecontrol/__pycache__/adapter.cpython-312.pyc,,
|
| 321 |
+
pip/_vendor/cachecontrol/__pycache__/cache.cpython-312.pyc,,
|
| 322 |
+
pip/_vendor/cachecontrol/__pycache__/controller.cpython-312.pyc,,
|
| 323 |
+
pip/_vendor/cachecontrol/__pycache__/filewrapper.cpython-312.pyc,,
|
| 324 |
+
pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-312.pyc,,
|
| 325 |
+
pip/_vendor/cachecontrol/__pycache__/serialize.cpython-312.pyc,,
|
| 326 |
+
pip/_vendor/cachecontrol/__pycache__/wrapper.cpython-312.pyc,,
|
| 327 |
+
pip/_vendor/cachecontrol/_cmd.py,sha256=iist2EpzJvDVIhMAxXq8iFnTBsiZAd6iplxfmNboNyk,1737
|
| 328 |
+
pip/_vendor/cachecontrol/adapter.py,sha256=_CcWvUP9048qAZjsNqViaHbdcLs9mmFNixVfpO7oebE,6392
|
| 329 |
+
pip/_vendor/cachecontrol/cache.py,sha256=OTQj72tUf8C1uEgczdl3Gc8vkldSzsTITKtDGKMx4z8,1952
|
| 330 |
+
pip/_vendor/cachecontrol/caches/__init__.py,sha256=dtrrroK5BnADR1GWjCZ19aZ0tFsMfvFBtLQQU1sp_ag,303
|
| 331 |
+
pip/_vendor/cachecontrol/caches/__pycache__/__init__.cpython-312.pyc,,
|
| 332 |
+
pip/_vendor/cachecontrol/caches/__pycache__/file_cache.cpython-312.pyc,,
|
| 333 |
+
pip/_vendor/cachecontrol/caches/__pycache__/redis_cache.cpython-312.pyc,,
|
| 334 |
+
pip/_vendor/cachecontrol/caches/file_cache.py,sha256=3z8AWKD-vfKeiJqIzLmJyIYtR2yd6Tsh3u1TyLRQoIQ,5352
|
| 335 |
+
pip/_vendor/cachecontrol/caches/redis_cache.py,sha256=9rmqwtYu_ljVkW6_oLqbC7EaX_a8YT_yLuna-eS0dgo,1386
|
| 336 |
+
pip/_vendor/cachecontrol/controller.py,sha256=keCFA3ZaNVaWTwHd6F1zqWhb4vyvNx_UvZuo5iIYMfo,18384
|
| 337 |
+
pip/_vendor/cachecontrol/filewrapper.py,sha256=STttGmIPBvZzt2b51dUOwoWX5crcMCpKZOisM3f5BNc,4292
|
| 338 |
+
pip/_vendor/cachecontrol/heuristics.py,sha256=fdFbk9W8IeLrjteIz_fK4mj2HD_Y7COXF2Uc8TgjT1c,4828
|
| 339 |
+
pip/_vendor/cachecontrol/serialize.py,sha256=0dHeMaDwysVAAnGVlhMOP4tDliohgNK0Jxk_zsOiWxw,7173
|
| 340 |
+
pip/_vendor/cachecontrol/wrapper.py,sha256=hsGc7g8QGQTT-4f8tgz3AM5qwScg6FO0BSdLSRdEvpU,1417
|
| 341 |
+
pip/_vendor/certifi/__init__.py,sha256=L_j-d0kYuA_MzA2_2hraF1ovf6KT6DTquRdV3paQwOk,94
|
| 342 |
+
pip/_vendor/certifi/__main__.py,sha256=1k3Cr95vCxxGRGDljrW3wMdpZdL3Nhf0u1n-k2qdsCY,255
|
| 343 |
+
pip/_vendor/certifi/__pycache__/__init__.cpython-312.pyc,,
|
| 344 |
+
pip/_vendor/certifi/__pycache__/__main__.cpython-312.pyc,,
|
| 345 |
+
pip/_vendor/certifi/__pycache__/core.cpython-312.pyc,,
|
| 346 |
+
pip/_vendor/certifi/cacert.pem,sha256=eU0Dn_3yd8BH4m8sfVj4Glhl2KDrcCSg-sEWT-pNJ88,281617
|
| 347 |
+
pip/_vendor/certifi/core.py,sha256=DNTl8b_B6C4vO3Vc9_q2uvwHpNnBQoy5onDC4McImxc,4531
|
| 348 |
+
pip/_vendor/chardet/__init__.py,sha256=57R-HSxj0PWmILMN0GFmUNqEMfrEVSamXyjD-W6_fbs,4797
|
| 349 |
+
pip/_vendor/chardet/__pycache__/__init__.cpython-312.pyc,,
|
| 350 |
+
pip/_vendor/chardet/__pycache__/big5freq.cpython-312.pyc,,
|
| 351 |
+
pip/_vendor/chardet/__pycache__/big5prober.cpython-312.pyc,,
|
| 352 |
+
pip/_vendor/chardet/__pycache__/chardistribution.cpython-312.pyc,,
|
| 353 |
+
pip/_vendor/chardet/__pycache__/charsetgroupprober.cpython-312.pyc,,
|
| 354 |
+
pip/_vendor/chardet/__pycache__/charsetprober.cpython-312.pyc,,
|
| 355 |
+
pip/_vendor/chardet/__pycache__/codingstatemachine.cpython-312.pyc,,
|
| 356 |
+
pip/_vendor/chardet/__pycache__/codingstatemachinedict.cpython-312.pyc,,
|
| 357 |
+
pip/_vendor/chardet/__pycache__/cp949prober.cpython-312.pyc,,
|
| 358 |
+
pip/_vendor/chardet/__pycache__/enums.cpython-312.pyc,,
|
| 359 |
+
pip/_vendor/chardet/__pycache__/escprober.cpython-312.pyc,,
|
| 360 |
+
pip/_vendor/chardet/__pycache__/escsm.cpython-312.pyc,,
|
| 361 |
+
pip/_vendor/chardet/__pycache__/eucjpprober.cpython-312.pyc,,
|
| 362 |
+
pip/_vendor/chardet/__pycache__/euckrfreq.cpython-312.pyc,,
|
| 363 |
+
pip/_vendor/chardet/__pycache__/euckrprober.cpython-312.pyc,,
|
| 364 |
+
pip/_vendor/chardet/__pycache__/euctwfreq.cpython-312.pyc,,
|
| 365 |
+
pip/_vendor/chardet/__pycache__/euctwprober.cpython-312.pyc,,
|
| 366 |
+
pip/_vendor/chardet/__pycache__/gb2312freq.cpython-312.pyc,,
|
| 367 |
+
pip/_vendor/chardet/__pycache__/gb2312prober.cpython-312.pyc,,
|
| 368 |
+
pip/_vendor/chardet/__pycache__/hebrewprober.cpython-312.pyc,,
|
| 369 |
+
pip/_vendor/chardet/__pycache__/jisfreq.cpython-312.pyc,,
|
| 370 |
+
pip/_vendor/chardet/__pycache__/johabfreq.cpython-312.pyc,,
|
| 371 |
+
pip/_vendor/chardet/__pycache__/johabprober.cpython-312.pyc,,
|
| 372 |
+
pip/_vendor/chardet/__pycache__/jpcntx.cpython-312.pyc,,
|
| 373 |
+
pip/_vendor/chardet/__pycache__/langbulgarianmodel.cpython-312.pyc,,
|
| 374 |
+
pip/_vendor/chardet/__pycache__/langgreekmodel.cpython-312.pyc,,
|
| 375 |
+
pip/_vendor/chardet/__pycache__/langhebrewmodel.cpython-312.pyc,,
|
| 376 |
+
pip/_vendor/chardet/__pycache__/langhungarianmodel.cpython-312.pyc,,
|
| 377 |
+
pip/_vendor/chardet/__pycache__/langrussianmodel.cpython-312.pyc,,
|
| 378 |
+
pip/_vendor/chardet/__pycache__/langthaimodel.cpython-312.pyc,,
|
| 379 |
+
pip/_vendor/chardet/__pycache__/langturkishmodel.cpython-312.pyc,,
|
| 380 |
+
pip/_vendor/chardet/__pycache__/latin1prober.cpython-312.pyc,,
|
| 381 |
+
pip/_vendor/chardet/__pycache__/macromanprober.cpython-312.pyc,,
|
| 382 |
+
pip/_vendor/chardet/__pycache__/mbcharsetprober.cpython-312.pyc,,
|
| 383 |
+
pip/_vendor/chardet/__pycache__/mbcsgroupprober.cpython-312.pyc,,
|
| 384 |
+
pip/_vendor/chardet/__pycache__/mbcssm.cpython-312.pyc,,
|
| 385 |
+
pip/_vendor/chardet/__pycache__/resultdict.cpython-312.pyc,,
|
| 386 |
+
pip/_vendor/chardet/__pycache__/sbcharsetprober.cpython-312.pyc,,
|
| 387 |
+
pip/_vendor/chardet/__pycache__/sbcsgroupprober.cpython-312.pyc,,
|
| 388 |
+
pip/_vendor/chardet/__pycache__/sjisprober.cpython-312.pyc,,
|
| 389 |
+
pip/_vendor/chardet/__pycache__/universaldetector.cpython-312.pyc,,
|
| 390 |
+
pip/_vendor/chardet/__pycache__/utf1632prober.cpython-312.pyc,,
|
| 391 |
+
pip/_vendor/chardet/__pycache__/utf8prober.cpython-312.pyc,,
|
| 392 |
+
pip/_vendor/chardet/__pycache__/version.cpython-312.pyc,,
|
| 393 |
+
pip/_vendor/chardet/big5freq.py,sha256=ltcfP-3PjlNHCoo5e4a7C4z-2DhBTXRfY6jbMbB7P30,31274
|
| 394 |
+
pip/_vendor/chardet/big5prober.py,sha256=lPMfwCX6v2AaPgvFh_cSWZcgLDbWiFCHLZ_p9RQ9uxE,1763
|
| 395 |
+
pip/_vendor/chardet/chardistribution.py,sha256=13B8XUG4oXDuLdXvfbIWwLFeR-ZU21AqTS1zcdON8bU,10032
|
| 396 |
+
pip/_vendor/chardet/charsetgroupprober.py,sha256=UKK3SaIZB2PCdKSIS0gnvMtLR9JJX62M-fZJu3OlWyg,3915
|
| 397 |
+
pip/_vendor/chardet/charsetprober.py,sha256=L3t8_wIOov8em-vZWOcbkdsrwe43N6_gqNh5pH7WPd4,5420
|
| 398 |
+
pip/_vendor/chardet/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 399 |
+
pip/_vendor/chardet/cli/__pycache__/__init__.cpython-312.pyc,,
|
| 400 |
+
pip/_vendor/chardet/cli/__pycache__/chardetect.cpython-312.pyc,,
|
| 401 |
+
pip/_vendor/chardet/cli/chardetect.py,sha256=zibMVg5RpKb-ME9_7EYG4ZM2Sf07NHcQzZ12U-rYJho,3242
|
| 402 |
+
pip/_vendor/chardet/codingstatemachine.py,sha256=K7k69sw3jY5DmTXoSJQVsUtFIQKYPQVOSJJhBuGv_yE,3732
|
| 403 |
+
pip/_vendor/chardet/codingstatemachinedict.py,sha256=0GY3Hi2qIZvDrOOJ3AtqppM1RsYxr_66ER4EHjuMiMc,542
|
| 404 |
+
pip/_vendor/chardet/cp949prober.py,sha256=0jKRV7fECuWI16rNnks0ZECKA1iZYCIEaP8A1ZvjUSI,1860
|
| 405 |
+
pip/_vendor/chardet/enums.py,sha256=TzECiZoCKNMqgwU76cPCeKWFBqaWvAdLMev5_bCkhY8,1683
|
| 406 |
+
pip/_vendor/chardet/escprober.py,sha256=Kho48X65xE0scFylIdeJjM2bcbvRvv0h0WUbMWrJD3A,4006
|
| 407 |
+
pip/_vendor/chardet/escsm.py,sha256=AqyXpA2FQFD7k-buBty_7itGEYkhmVa8X09NLRul3QM,12176
|
| 408 |
+
pip/_vendor/chardet/eucjpprober.py,sha256=5KYaM9fsxkRYzw1b5k0fL-j_-ezIw-ij9r97a9MHxLY,3934
|
| 409 |
+
pip/_vendor/chardet/euckrfreq.py,sha256=3mHuRvXfsq_QcQysDQFb8qSudvTiol71C6Ic2w57tKM,13566
|
| 410 |
+
pip/_vendor/chardet/euckrprober.py,sha256=hiFT6wM174GIwRvqDsIcuOc-dDsq2uPKMKbyV8-1Xnc,1753
|
| 411 |
+
pip/_vendor/chardet/euctwfreq.py,sha256=2alILE1Lh5eqiFJZjzRkMQXolNJRHY5oBQd-vmZYFFM,36913
|
| 412 |
+
pip/_vendor/chardet/euctwprober.py,sha256=NxbpNdBtU0VFI0bKfGfDkpP7S2_8_6FlO87dVH0ogws,1753
|
| 413 |
+
pip/_vendor/chardet/gb2312freq.py,sha256=49OrdXzD-HXqwavkqjo8Z7gvs58hONNzDhAyMENNkvY,20735
|
| 414 |
+
pip/_vendor/chardet/gb2312prober.py,sha256=KPEBueaSLSvBpFeINMu0D6TgHcR90e5PaQawifzF4o0,1759
|
| 415 |
+
pip/_vendor/chardet/hebrewprober.py,sha256=96T_Lj_OmW-fK7JrSHojYjyG3fsGgbzkoTNleZ3kfYE,14537
|
| 416 |
+
pip/_vendor/chardet/jisfreq.py,sha256=mm8tfrwqhpOd3wzZKS4NJqkYBQVcDfTM2JiQ5aW932E,25796
|
| 417 |
+
pip/_vendor/chardet/johabfreq.py,sha256=dBpOYG34GRX6SL8k_LbS9rxZPMjLjoMlgZ03Pz5Hmqc,42498
|
| 418 |
+
pip/_vendor/chardet/johabprober.py,sha256=O1Qw9nVzRnun7vZp4UZM7wvJSv9W941mEU9uDMnY3DU,1752
|
| 419 |
+
pip/_vendor/chardet/jpcntx.py,sha256=uhHrYWkLxE_rF5OkHKInm0HUsrjgKHHVQvtt3UcvotA,27055
|
| 420 |
+
pip/_vendor/chardet/langbulgarianmodel.py,sha256=vmbvYFP8SZkSxoBvLkFqKiH1sjma5ihk3PTpdy71Rr4,104562
|
| 421 |
+
pip/_vendor/chardet/langgreekmodel.py,sha256=JfB7bupjjJH2w3X_mYnQr9cJA_7EuITC2cRW13fUjeI,98484
|
| 422 |
+
pip/_vendor/chardet/langhebrewmodel.py,sha256=3HXHaLQPNAGcXnJjkIJfozNZLTvTJmf4W5Awi6zRRKc,98196
|
| 423 |
+
pip/_vendor/chardet/langhungarianmodel.py,sha256=WxbeQIxkv8YtApiNqxQcvj-tMycsoI4Xy-fwkDHpP_Y,101363
|
| 424 |
+
pip/_vendor/chardet/langrussianmodel.py,sha256=s395bTZ87ESTrZCOdgXbEjZ9P1iGPwCl_8xSsac_DLY,128035
|
| 425 |
+
pip/_vendor/chardet/langthaimodel.py,sha256=7bJlQitRpTnVGABmbSznHnJwOHDy3InkTvtFUx13WQI,102774
|
| 426 |
+
pip/_vendor/chardet/langturkishmodel.py,sha256=XY0eGdTIy4eQ9Xg1LVPZacb-UBhHBR-cq0IpPVHowKc,95372
|
| 427 |
+
pip/_vendor/chardet/latin1prober.py,sha256=p15EEmFbmQUwbKLC7lOJVGHEZwcG45ubEZYTGu01J5g,5380
|
| 428 |
+
pip/_vendor/chardet/macromanprober.py,sha256=9anfzmY6TBfUPDyBDOdY07kqmTHpZ1tK0jL-p1JWcOY,6077
|
| 429 |
+
pip/_vendor/chardet/mbcharsetprober.py,sha256=Wr04WNI4F3X_VxEverNG-H25g7u-MDDKlNt-JGj-_uU,3715
|
| 430 |
+
pip/_vendor/chardet/mbcsgroupprober.py,sha256=iRpaNBjV0DNwYPu_z6TiHgRpwYahiM7ztI_4kZ4Uz9A,2131
|
| 431 |
+
pip/_vendor/chardet/mbcssm.py,sha256=hUtPvDYgWDaA2dWdgLsshbwRfm3Q5YRlRogdmeRUNQw,30391
|
| 432 |
+
pip/_vendor/chardet/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 433 |
+
pip/_vendor/chardet/metadata/__pycache__/__init__.cpython-312.pyc,,
|
| 434 |
+
pip/_vendor/chardet/metadata/__pycache__/languages.cpython-312.pyc,,
|
| 435 |
+
pip/_vendor/chardet/metadata/languages.py,sha256=FhvBIdZFxRQ-dTwkb_0madRKgVBCaUMQz9I5xqjE5iQ,13560
|
| 436 |
+
pip/_vendor/chardet/resultdict.py,sha256=ez4FRvN5KaSosJeJ2WzUyKdDdg35HDy_SSLPXKCdt5M,402
|
| 437 |
+
pip/_vendor/chardet/sbcharsetprober.py,sha256=-nd3F90i7GpXLjehLVHqVBE0KlWzGvQUPETLBNn4o6U,6400
|
| 438 |
+
pip/_vendor/chardet/sbcsgroupprober.py,sha256=gcgI0fOfgw_3YTClpbra_MNxwyEyJ3eUXraoLHYb59E,4137
|
| 439 |
+
pip/_vendor/chardet/sjisprober.py,sha256=aqQufMzRw46ZpFlzmYaYeT2-nzmKb-hmcrApppJ862k,4007
|
| 440 |
+
pip/_vendor/chardet/universaldetector.py,sha256=xYBrg4x0dd9WnT8qclfADVD9ondrUNkqPmvte1pa520,14848
|
| 441 |
+
pip/_vendor/chardet/utf1632prober.py,sha256=pw1epGdMj1hDGiCu1AHqqzOEfjX8MVdiW7O1BlT8-eQ,8505
|
| 442 |
+
pip/_vendor/chardet/utf8prober.py,sha256=8m08Ub5490H4jQ6LYXvFysGtgKoKsHUd2zH_i8_TnVw,2812
|
| 443 |
+
pip/_vendor/chardet/version.py,sha256=lGtJcxGM44Qz4Cbk4rbbmrKxnNr1-97U25TameLehZw,244
|
| 444 |
+
pip/_vendor/colorama/__init__.py,sha256=wePQA4U20tKgYARySLEC047ucNX-g8pRLpYBuiHlLb8,266
|
| 445 |
+
pip/_vendor/colorama/__pycache__/__init__.cpython-312.pyc,,
|
| 446 |
+
pip/_vendor/colorama/__pycache__/ansi.cpython-312.pyc,,
|
| 447 |
+
pip/_vendor/colorama/__pycache__/ansitowin32.cpython-312.pyc,,
|
| 448 |
+
pip/_vendor/colorama/__pycache__/initialise.cpython-312.pyc,,
|
| 449 |
+
pip/_vendor/colorama/__pycache__/win32.cpython-312.pyc,,
|
| 450 |
+
pip/_vendor/colorama/__pycache__/winterm.cpython-312.pyc,,
|
| 451 |
+
pip/_vendor/colorama/ansi.py,sha256=Top4EeEuaQdBWdteKMEcGOTeKeF19Q-Wo_6_Cj5kOzQ,2522
|
| 452 |
+
pip/_vendor/colorama/ansitowin32.py,sha256=vPNYa3OZbxjbuFyaVo0Tmhmy1FZ1lKMWCnT7odXpItk,11128
|
| 453 |
+
pip/_vendor/colorama/initialise.py,sha256=-hIny86ClXo39ixh5iSCfUIa2f_h_bgKRDW7gqs-KLU,3325
|
| 454 |
+
pip/_vendor/colorama/tests/__init__.py,sha256=MkgPAEzGQd-Rq0w0PZXSX2LadRWhUECcisJY8lSrm4Q,75
|
| 455 |
+
pip/_vendor/colorama/tests/__pycache__/__init__.cpython-312.pyc,,
|
| 456 |
+
pip/_vendor/colorama/tests/__pycache__/ansi_test.cpython-312.pyc,,
|
| 457 |
+
pip/_vendor/colorama/tests/__pycache__/ansitowin32_test.cpython-312.pyc,,
|
| 458 |
+
pip/_vendor/colorama/tests/__pycache__/initialise_test.cpython-312.pyc,,
|
| 459 |
+
pip/_vendor/colorama/tests/__pycache__/isatty_test.cpython-312.pyc,,
|
| 460 |
+
pip/_vendor/colorama/tests/__pycache__/utils.cpython-312.pyc,,
|
| 461 |
+
pip/_vendor/colorama/tests/__pycache__/winterm_test.cpython-312.pyc,,
|
| 462 |
+
pip/_vendor/colorama/tests/ansi_test.py,sha256=FeViDrUINIZcr505PAxvU4AjXz1asEiALs9GXMhwRaE,2839
|
| 463 |
+
pip/_vendor/colorama/tests/ansitowin32_test.py,sha256=RN7AIhMJ5EqDsYaCjVo-o4u8JzDD4ukJbmevWKS70rY,10678
|
| 464 |
+
pip/_vendor/colorama/tests/initialise_test.py,sha256=BbPy-XfyHwJ6zKozuQOvNvQZzsx9vdb_0bYXn7hsBTc,6741
|
| 465 |
+
pip/_vendor/colorama/tests/isatty_test.py,sha256=Pg26LRpv0yQDB5Ac-sxgVXG7hsA1NYvapFgApZfYzZg,1866
|
| 466 |
+
pip/_vendor/colorama/tests/utils.py,sha256=1IIRylG39z5-dzq09R_ngufxyPZxgldNbrxKxUGwGKE,1079
|
| 467 |
+
pip/_vendor/colorama/tests/winterm_test.py,sha256=qoWFPEjym5gm2RuMwpf3pOis3a5r_PJZFCzK254JL8A,3709
|
| 468 |
+
pip/_vendor/colorama/win32.py,sha256=YQOKwMTwtGBbsY4dL5HYTvwTeP9wIQra5MvPNddpxZs,6181
|
| 469 |
+
pip/_vendor/colorama/winterm.py,sha256=XCQFDHjPi6AHYNdZwy0tA02H-Jh48Jp-HvCjeLeLp3U,7134
|
| 470 |
+
pip/_vendor/distlib/__init__.py,sha256=hJKF7FHoqbmGckncDuEINWo_OYkDNiHODtYXSMcvjcc,625
|
| 471 |
+
pip/_vendor/distlib/__pycache__/__init__.cpython-312.pyc,,
|
| 472 |
+
pip/_vendor/distlib/__pycache__/compat.cpython-312.pyc,,
|
| 473 |
+
pip/_vendor/distlib/__pycache__/database.cpython-312.pyc,,
|
| 474 |
+
pip/_vendor/distlib/__pycache__/index.cpython-312.pyc,,
|
| 475 |
+
pip/_vendor/distlib/__pycache__/locators.cpython-312.pyc,,
|
| 476 |
+
pip/_vendor/distlib/__pycache__/manifest.cpython-312.pyc,,
|
| 477 |
+
pip/_vendor/distlib/__pycache__/markers.cpython-312.pyc,,
|
| 478 |
+
pip/_vendor/distlib/__pycache__/metadata.cpython-312.pyc,,
|
| 479 |
+
pip/_vendor/distlib/__pycache__/resources.cpython-312.pyc,,
|
| 480 |
+
pip/_vendor/distlib/__pycache__/scripts.cpython-312.pyc,,
|
| 481 |
+
pip/_vendor/distlib/__pycache__/util.cpython-312.pyc,,
|
| 482 |
+
pip/_vendor/distlib/__pycache__/version.cpython-312.pyc,,
|
| 483 |
+
pip/_vendor/distlib/__pycache__/wheel.cpython-312.pyc,,
|
| 484 |
+
pip/_vendor/distlib/compat.py,sha256=Un-uIBvy02w-D267OG4VEhuddqWgKj9nNkxVltAb75w,41487
|
| 485 |
+
pip/_vendor/distlib/database.py,sha256=0V9Qvs0Vrxa2F_-hLWitIyVyRifJ0pCxyOI-kEOBwsA,51965
|
| 486 |
+
pip/_vendor/distlib/index.py,sha256=lTbw268rRhj8dw1sib3VZ_0EhSGgoJO3FKJzSFMOaeA,20797
|
| 487 |
+
pip/_vendor/distlib/locators.py,sha256=o1r_M86_bRLafSpetmyfX8KRtFu-_Q58abvQrnOSnbA,51767
|
| 488 |
+
pip/_vendor/distlib/manifest.py,sha256=3qfmAmVwxRqU1o23AlfXrQGZzh6g_GGzTAP_Hb9C5zQ,14168
|
| 489 |
+
pip/_vendor/distlib/markers.py,sha256=n3DfOh1yvZ_8EW7atMyoYeZFXjYla0Nz0itQlojCd0A,5268
|
| 490 |
+
pip/_vendor/distlib/metadata.py,sha256=pB9WZ9mBfmQxc9OVIldLS5CjOoQRvKAvUwwQyKwKQtQ,39693
|
| 491 |
+
pip/_vendor/distlib/resources.py,sha256=LwbPksc0A1JMbi6XnuPdMBUn83X7BPuFNWqPGEKI698,10820
|
| 492 |
+
pip/_vendor/distlib/scripts.py,sha256=nQFXN6G7nOWNDUyxirUep-3WOlJhB7McvCs9zOnkGTI,18315
|
| 493 |
+
pip/_vendor/distlib/util.py,sha256=XSznxEi_i3T20UJuaVc0qXHz5ksGUCW1khYlBprN_QE,67530
|
| 494 |
+
pip/_vendor/distlib/version.py,sha256=9pXkduchve_aN7JG6iL9VTYV_kqNSGoc2Dwl8JuySnQ,23747
|
| 495 |
+
pip/_vendor/distlib/wheel.py,sha256=FVQCve8u-L0QYk5-YTZc7s4WmNQdvjRWTK08KXzZVX4,43958
|
| 496 |
+
pip/_vendor/distro/__init__.py,sha256=2fHjF-SfgPvjyNZ1iHh_wjqWdR_Yo5ODHwZC0jLBPhc,981
|
| 497 |
+
pip/_vendor/distro/__main__.py,sha256=bu9d3TifoKciZFcqRBuygV3GSuThnVD_m2IK4cz96Vs,64
|
| 498 |
+
pip/_vendor/distro/__pycache__/__init__.cpython-312.pyc,,
|
| 499 |
+
pip/_vendor/distro/__pycache__/__main__.cpython-312.pyc,,
|
| 500 |
+
pip/_vendor/distro/__pycache__/distro.cpython-312.pyc,,
|
| 501 |
+
pip/_vendor/distro/distro.py,sha256=UZO1LjIhtFCMdlbiz39gj3raV-Amf3SBwzGzfApiMHw,49330
|
| 502 |
+
pip/_vendor/idna/__init__.py,sha256=KJQN1eQBr8iIK5SKrJ47lXvxG0BJ7Lm38W4zT0v_8lk,849
|
| 503 |
+
pip/_vendor/idna/__pycache__/__init__.cpython-312.pyc,,
|
| 504 |
+
pip/_vendor/idna/__pycache__/codec.cpython-312.pyc,,
|
| 505 |
+
pip/_vendor/idna/__pycache__/compat.cpython-312.pyc,,
|
| 506 |
+
pip/_vendor/idna/__pycache__/core.cpython-312.pyc,,
|
| 507 |
+
pip/_vendor/idna/__pycache__/idnadata.cpython-312.pyc,,
|
| 508 |
+
pip/_vendor/idna/__pycache__/intranges.cpython-312.pyc,,
|
| 509 |
+
pip/_vendor/idna/__pycache__/package_data.cpython-312.pyc,,
|
| 510 |
+
pip/_vendor/idna/__pycache__/uts46data.cpython-312.pyc,,
|
| 511 |
+
pip/_vendor/idna/codec.py,sha256=6ly5odKfqrytKT9_7UrlGklHnf1DSK2r9C6cSM4sa28,3374
|
| 512 |
+
pip/_vendor/idna/compat.py,sha256=0_sOEUMT4CVw9doD3vyRhX80X19PwqFoUBs7gWsFME4,321
|
| 513 |
+
pip/_vendor/idna/core.py,sha256=kkCFNJOrE6I3WwBTXcGNuc24V_QZQ8AULE6EYe1iHlU,12813
|
| 514 |
+
pip/_vendor/idna/idnadata.py,sha256=9NIhTqC2piUpeIMOGZ9Bu_7eAFQ-Ic8TkP_hOzUpnDc,78344
|
| 515 |
+
pip/_vendor/idna/intranges.py,sha256=YBr4fRYuWH7kTKS2tXlFjM24ZF1Pdvcir-aywniInqg,1881
|
| 516 |
+
pip/_vendor/idna/package_data.py,sha256=C_jHJzmX8PI4xq0jpzmcTMxpb5lDsq4o5VyxQzlVrZE,21
|
| 517 |
+
pip/_vendor/idna/uts46data.py,sha256=zvjZU24s58_uAS850Mcd0NnD0X7_gCMAMjzWNIeUJdc,206539
|
| 518 |
+
pip/_vendor/msgpack/__init__.py,sha256=hyGhlnmcJkxryJBKC3X5FnEph375kQoL_mG8LZUuXgY,1132
|
| 519 |
+
pip/_vendor/msgpack/__pycache__/__init__.cpython-312.pyc,,
|
| 520 |
+
pip/_vendor/msgpack/__pycache__/exceptions.cpython-312.pyc,,
|
| 521 |
+
pip/_vendor/msgpack/__pycache__/ext.cpython-312.pyc,,
|
| 522 |
+
pip/_vendor/msgpack/__pycache__/fallback.cpython-312.pyc,,
|
| 523 |
+
pip/_vendor/msgpack/exceptions.py,sha256=dCTWei8dpkrMsQDcjQk74ATl9HsIBH0ybt8zOPNqMYc,1081
|
| 524 |
+
pip/_vendor/msgpack/ext.py,sha256=C5MK8JhVYGYFWPvxsORsqZAnvOXefYQ57m1Ym0luW5M,6079
|
| 525 |
+
pip/_vendor/msgpack/fallback.py,sha256=tvNBHyxxFbuVlC8GZShETClJxjLiDMOja4XwwyvNm2g,34544
|
| 526 |
+
pip/_vendor/packaging/__about__.py,sha256=ugASIO2w1oUyH8_COqQ2X_s0rDhjbhQC3yJocD03h2c,661
|
| 527 |
+
pip/_vendor/packaging/__init__.py,sha256=b9Kk5MF7KxhhLgcDmiUWukN-LatWFxPdNug0joPhHSk,497
|
| 528 |
+
pip/_vendor/packaging/__pycache__/__about__.cpython-312.pyc,,
|
| 529 |
+
pip/_vendor/packaging/__pycache__/__init__.cpython-312.pyc,,
|
| 530 |
+
pip/_vendor/packaging/__pycache__/_manylinux.cpython-312.pyc,,
|
| 531 |
+
pip/_vendor/packaging/__pycache__/_musllinux.cpython-312.pyc,,
|
| 532 |
+
pip/_vendor/packaging/__pycache__/_structures.cpython-312.pyc,,
|
| 533 |
+
pip/_vendor/packaging/__pycache__/markers.cpython-312.pyc,,
|
| 534 |
+
pip/_vendor/packaging/__pycache__/requirements.cpython-312.pyc,,
|
| 535 |
+
pip/_vendor/packaging/__pycache__/specifiers.cpython-312.pyc,,
|
| 536 |
+
pip/_vendor/packaging/__pycache__/tags.cpython-312.pyc,,
|
| 537 |
+
pip/_vendor/packaging/__pycache__/utils.cpython-312.pyc,,
|
| 538 |
+
pip/_vendor/packaging/__pycache__/version.cpython-312.pyc,,
|
| 539 |
+
pip/_vendor/packaging/_manylinux.py,sha256=XcbiXB-qcjv3bcohp6N98TMpOP4_j3m-iOA8ptK2GWY,11488
|
| 540 |
+
pip/_vendor/packaging/_musllinux.py,sha256=_KGgY_qc7vhMGpoqss25n2hiLCNKRtvz9mCrS7gkqyc,4378
|
| 541 |
+
pip/_vendor/packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431
|
| 542 |
+
pip/_vendor/packaging/markers.py,sha256=AJBOcY8Oq0kYc570KuuPTkvuqjAlhufaE2c9sCUbm64,8487
|
| 543 |
+
pip/_vendor/packaging/requirements.py,sha256=NtDlPBtojpn1IUC85iMjPNsUmufjpSlwnNA-Xb4m5NA,4676
|
| 544 |
+
pip/_vendor/packaging/specifiers.py,sha256=LRQ0kFsHrl5qfcFNEEJrIFYsnIHQUJXY9fIsakTrrqE,30110
|
| 545 |
+
pip/_vendor/packaging/tags.py,sha256=lmsnGNiJ8C4D_Pf9PbM0qgbZvD9kmB9lpZBQUZa3R_Y,15699
|
| 546 |
+
pip/_vendor/packaging/utils.py,sha256=dJjeat3BS-TYn1RrUFVwufUMasbtzLfYRoy_HXENeFQ,4200
|
| 547 |
+
pip/_vendor/packaging/version.py,sha256=_fLRNrFrxYcHVfyo8vk9j8s6JM8N_xsSxVFr6RJyco8,14665
|
| 548 |
+
pip/_vendor/pkg_resources/__init__.py,sha256=hTAeJCNYb7dJseIDVsYK3mPQep_gphj4tQh-bspX8bg,109364
|
| 549 |
+
pip/_vendor/pkg_resources/__pycache__/__init__.cpython-312.pyc,,
|
| 550 |
+
pip/_vendor/platformdirs/__init__.py,sha256=SkhEYVyC_HUHC6KX7n4M_6coyRMtEB38QMyOYIAX6Yk,20155
|
| 551 |
+
pip/_vendor/platformdirs/__main__.py,sha256=fVvSiTzr2-RM6IsjWjj4fkaOtDOgDhUWv6sA99do4CQ,1476
|
| 552 |
+
pip/_vendor/platformdirs/__pycache__/__init__.cpython-312.pyc,,
|
| 553 |
+
pip/_vendor/platformdirs/__pycache__/__main__.cpython-312.pyc,,
|
| 554 |
+
pip/_vendor/platformdirs/__pycache__/android.cpython-312.pyc,,
|
| 555 |
+
pip/_vendor/platformdirs/__pycache__/api.cpython-312.pyc,,
|
| 556 |
+
pip/_vendor/platformdirs/__pycache__/macos.cpython-312.pyc,,
|
| 557 |
+
pip/_vendor/platformdirs/__pycache__/unix.cpython-312.pyc,,
|
| 558 |
+
pip/_vendor/platformdirs/__pycache__/version.cpython-312.pyc,,
|
| 559 |
+
pip/_vendor/platformdirs/__pycache__/windows.cpython-312.pyc,,
|
| 560 |
+
pip/_vendor/platformdirs/android.py,sha256=y_EEMKwYl2-bzYBDovksSn8m76on0Lda8eyJksVQE9U,7211
|
| 561 |
+
pip/_vendor/platformdirs/api.py,sha256=jWtX06jAJytYrkJDOqEls97mCkyHRSZkoqUlbMK5Qew,7132
|
| 562 |
+
pip/_vendor/platformdirs/macos.py,sha256=LueVOoVgGWDBwQb8OFwXkVKfVn33CM1Lkwf1-A86tRQ,3678
|
| 563 |
+
pip/_vendor/platformdirs/unix.py,sha256=22JhR8ZY0aLxSVCFnKrc6f1iz6Gv42K24Daj7aTjfSg,8809
|
| 564 |
+
pip/_vendor/platformdirs/version.py,sha256=mavZTQIJIXfdewEaSTn7EWrNfPZWeRofb-74xqW5f2M,160
|
| 565 |
+
pip/_vendor/platformdirs/windows.py,sha256=4TtbPGoWG2PRgI11uquDa7eRk8TcxvnUNuuMGZItnXc,9573
|
| 566 |
+
pip/_vendor/pygments/__init__.py,sha256=6AuDljQtvf89DTNUyWM7k3oUlP_lq70NU-INKKteOBY,2983
|
| 567 |
+
pip/_vendor/pygments/__main__.py,sha256=es8EKMvXj5yToIfQ-pf3Dv5TnIeeM6sME0LW-n4ecHo,353
|
| 568 |
+
pip/_vendor/pygments/__pycache__/__init__.cpython-312.pyc,,
|
| 569 |
+
pip/_vendor/pygments/__pycache__/__main__.cpython-312.pyc,,
|
| 570 |
+
pip/_vendor/pygments/__pycache__/cmdline.cpython-312.pyc,,
|
| 571 |
+
pip/_vendor/pygments/__pycache__/console.cpython-312.pyc,,
|
| 572 |
+
pip/_vendor/pygments/__pycache__/filter.cpython-312.pyc,,
|
| 573 |
+
pip/_vendor/pygments/__pycache__/formatter.cpython-312.pyc,,
|
| 574 |
+
pip/_vendor/pygments/__pycache__/lexer.cpython-312.pyc,,
|
| 575 |
+
pip/_vendor/pygments/__pycache__/modeline.cpython-312.pyc,,
|
| 576 |
+
pip/_vendor/pygments/__pycache__/plugin.cpython-312.pyc,,
|
| 577 |
+
pip/_vendor/pygments/__pycache__/regexopt.cpython-312.pyc,,
|
| 578 |
+
pip/_vendor/pygments/__pycache__/scanner.cpython-312.pyc,,
|
| 579 |
+
pip/_vendor/pygments/__pycache__/sphinxext.cpython-312.pyc,,
|
| 580 |
+
pip/_vendor/pygments/__pycache__/style.cpython-312.pyc,,
|
| 581 |
+
pip/_vendor/pygments/__pycache__/token.cpython-312.pyc,,
|
| 582 |
+
pip/_vendor/pygments/__pycache__/unistring.cpython-312.pyc,,
|
| 583 |
+
pip/_vendor/pygments/__pycache__/util.cpython-312.pyc,,
|
| 584 |
+
pip/_vendor/pygments/cmdline.py,sha256=byxYJp9gnjVeyhRlZ3UTMgo_LhkXh1afvN8wJBtAcc8,23685
|
| 585 |
+
pip/_vendor/pygments/console.py,sha256=2wZ5W-U6TudJD1_NLUwjclMpbomFM91lNv11_60sfGY,1697
|
| 586 |
+
pip/_vendor/pygments/filter.py,sha256=j5aLM9a9wSx6eH1oy473oSkJ02hGWNptBlVo4s1g_30,1938
|
| 587 |
+
pip/_vendor/pygments/filters/__init__.py,sha256=h_koYkUFo-FFUxjs564JHUAz7O3yJpVwI6fKN3MYzG0,40386
|
| 588 |
+
pip/_vendor/pygments/filters/__pycache__/__init__.cpython-312.pyc,,
|
| 589 |
+
pip/_vendor/pygments/formatter.py,sha256=J9OL9hXLJKZk7moUgKwpjW9HNf4WlJFg_o_-Z_S_tTY,4178
|
| 590 |
+
pip/_vendor/pygments/formatters/__init__.py,sha256=_xgAcdFKr0QNYwh_i98AU9hvfP3X2wAkhElFcRRF3Uo,5424
|
| 591 |
+
pip/_vendor/pygments/formatters/__pycache__/__init__.cpython-312.pyc,,
|
| 592 |
+
pip/_vendor/pygments/formatters/__pycache__/_mapping.cpython-312.pyc,,
|
| 593 |
+
pip/_vendor/pygments/formatters/__pycache__/bbcode.cpython-312.pyc,,
|
| 594 |
+
pip/_vendor/pygments/formatters/__pycache__/groff.cpython-312.pyc,,
|
| 595 |
+
pip/_vendor/pygments/formatters/__pycache__/html.cpython-312.pyc,,
|
| 596 |
+
pip/_vendor/pygments/formatters/__pycache__/img.cpython-312.pyc,,
|
| 597 |
+
pip/_vendor/pygments/formatters/__pycache__/irc.cpython-312.pyc,,
|
| 598 |
+
pip/_vendor/pygments/formatters/__pycache__/latex.cpython-312.pyc,,
|
| 599 |
+
pip/_vendor/pygments/formatters/__pycache__/other.cpython-312.pyc,,
|
| 600 |
+
pip/_vendor/pygments/formatters/__pycache__/pangomarkup.cpython-312.pyc,,
|
| 601 |
+
pip/_vendor/pygments/formatters/__pycache__/rtf.cpython-312.pyc,,
|
| 602 |
+
pip/_vendor/pygments/formatters/__pycache__/svg.cpython-312.pyc,,
|
| 603 |
+
pip/_vendor/pygments/formatters/__pycache__/terminal.cpython-312.pyc,,
|
| 604 |
+
pip/_vendor/pygments/formatters/__pycache__/terminal256.cpython-312.pyc,,
|
| 605 |
+
pip/_vendor/pygments/formatters/_mapping.py,sha256=1Cw37FuQlNacnxRKmtlPX4nyLoX9_ttko5ZwscNUZZ4,4176
|
| 606 |
+
pip/_vendor/pygments/formatters/bbcode.py,sha256=r1b7wzWTJouADDLh-Z11iRi4iQxD0JKJ1qHl6mOYxsA,3314
|
| 607 |
+
pip/_vendor/pygments/formatters/groff.py,sha256=xy8Zf3tXOo6MWrXh7yPGWx3lVEkg_DhY4CxmsDb0IVo,5094
|
| 608 |
+
pip/_vendor/pygments/formatters/html.py,sha256=PIzAyilNqaTzSSP2slDG2VDLE3qNioWy2rgtSSoviuI,35610
|
| 609 |
+
pip/_vendor/pygments/formatters/img.py,sha256=XKXmg2_XONrR4mtq2jfEU8XCsoln3VSGTw-UYiEokys,21938
|
| 610 |
+
pip/_vendor/pygments/formatters/irc.py,sha256=Ep-m8jd3voFO6Fv57cUGFmz6JVA67IEgyiBOwv0N4a0,4981
|
| 611 |
+
pip/_vendor/pygments/formatters/latex.py,sha256=FGzJ-YqSTE8z_voWPdzvLY5Tq8jE_ygjGjM6dXZJ8-k,19351
|
| 612 |
+
pip/_vendor/pygments/formatters/other.py,sha256=gPxkk5BdAzWTCgbEHg1lpLi-1F6ZPh5A_aotgLXHnzg,5073
|
| 613 |
+
pip/_vendor/pygments/formatters/pangomarkup.py,sha256=6LKnQc8yh49f802bF0sPvbzck4QivMYqqoXAPaYP8uU,2212
|
| 614 |
+
pip/_vendor/pygments/formatters/rtf.py,sha256=aA0v_psW6KZI3N18TKDifxeL6mcF8EDXcPXDWI4vhVQ,5014
|
| 615 |
+
pip/_vendor/pygments/formatters/svg.py,sha256=dQONWypbzfvzGCDtdp3M_NJawScJvM2DiHbx1k-ww7g,7335
|
| 616 |
+
pip/_vendor/pygments/formatters/terminal.py,sha256=FG-rpjRpFmNpiGB4NzIucvxq6sQIXB3HOTo2meTKtrU,4674
|
| 617 |
+
pip/_vendor/pygments/formatters/terminal256.py,sha256=13SJ3D5pFdqZ9zROE6HbWnBDwHvOGE8GlsmqGhprRp4,11753
|
| 618 |
+
pip/_vendor/pygments/lexer.py,sha256=2BpqLlT2ExvOOi7vnjK5nB4Fp-m52ldiPaXMox5uwug,34618
|
| 619 |
+
pip/_vendor/pygments/lexers/__init__.py,sha256=j5KEi5O_VQ5GS59H49l-10gzUOkWKxlwGeVMlGO2MMk,12130
|
| 620 |
+
pip/_vendor/pygments/lexers/__pycache__/__init__.cpython-312.pyc,,
|
| 621 |
+
pip/_vendor/pygments/lexers/__pycache__/_mapping.cpython-312.pyc,,
|
| 622 |
+
pip/_vendor/pygments/lexers/__pycache__/python.cpython-312.pyc,,
|
| 623 |
+
pip/_vendor/pygments/lexers/_mapping.py,sha256=Hts4r_ZQ8icftGM7gkBPeED5lyVSv4affFgXYE6Ap04,72281
|
| 624 |
+
pip/_vendor/pygments/lexers/python.py,sha256=c7jnmKFU9DLxTJW0UbwXt6Z9FJqbBlVsWA1Qr9xSA_w,53424
|
| 625 |
+
pip/_vendor/pygments/modeline.py,sha256=eF2vO4LpOGoPvIKKkbPfnyut8hT4UiebZPpb-BYGQdI,986
|
| 626 |
+
pip/_vendor/pygments/plugin.py,sha256=j1Fh310RbV2DQ9nvkmkqvlj38gdyuYKllLnGxbc8sJM,2591
|
| 627 |
+
pip/_vendor/pygments/regexopt.py,sha256=jg1ALogcYGU96TQS9isBl6dCrvw5y5--BP_K-uFk_8s,3072
|
| 628 |
+
pip/_vendor/pygments/scanner.py,sha256=b_nu5_f3HCgSdp5S_aNRBQ1MSCm4ZjDwec2OmTRickw,3092
|
| 629 |
+
pip/_vendor/pygments/sphinxext.py,sha256=wBFYm180qea9JKt__UzhRlNRNhczPDFDaqGD21sbuso,6882
|
| 630 |
+
pip/_vendor/pygments/style.py,sha256=C4qyoJrUTkq-OV3iO-8Vz3UtWYpJwSTdh5_vlGCGdNQ,6257
|
| 631 |
+
pip/_vendor/pygments/styles/__init__.py,sha256=he7HjQx7sC0d2kfTVLjUs0J15mtToJM6M1brwIm9--Q,3700
|
| 632 |
+
pip/_vendor/pygments/styles/__pycache__/__init__.cpython-312.pyc,,
|
| 633 |
+
pip/_vendor/pygments/token.py,sha256=seNsmcch9OEHXYirh8Ool7w8xDhfNTbLj5rHAC-gc_o,6184
|
| 634 |
+
pip/_vendor/pygments/unistring.py,sha256=FaUfG14NBJEKLQoY9qj6JYeXrpYcLmKulghdxOGFaOc,63223
|
| 635 |
+
pip/_vendor/pygments/util.py,sha256=AEVY0qonyyEMgv4Do2dINrrqUAwUk2XYSqHM650uzek,10230
|
| 636 |
+
pip/_vendor/pyparsing/__init__.py,sha256=9m1JbE2JTLdBG0Mb6B0lEaZj181Wx5cuPXZpsbHEYgE,9116
|
| 637 |
+
pip/_vendor/pyparsing/__pycache__/__init__.cpython-312.pyc,,
|
| 638 |
+
pip/_vendor/pyparsing/__pycache__/actions.cpython-312.pyc,,
|
| 639 |
+
pip/_vendor/pyparsing/__pycache__/common.cpython-312.pyc,,
|
| 640 |
+
pip/_vendor/pyparsing/__pycache__/core.cpython-312.pyc,,
|
| 641 |
+
pip/_vendor/pyparsing/__pycache__/exceptions.cpython-312.pyc,,
|
| 642 |
+
pip/_vendor/pyparsing/__pycache__/helpers.cpython-312.pyc,,
|
| 643 |
+
pip/_vendor/pyparsing/__pycache__/results.cpython-312.pyc,,
|
| 644 |
+
pip/_vendor/pyparsing/__pycache__/testing.cpython-312.pyc,,
|
| 645 |
+
pip/_vendor/pyparsing/__pycache__/unicode.cpython-312.pyc,,
|
| 646 |
+
pip/_vendor/pyparsing/__pycache__/util.cpython-312.pyc,,
|
| 647 |
+
pip/_vendor/pyparsing/actions.py,sha256=05uaIPOznJPQ7VgRdmGCmG4sDnUPtwgv5qOYIqbL2UY,6567
|
| 648 |
+
pip/_vendor/pyparsing/common.py,sha256=p-3c83E5-DjlkF35G0O9-kjQRpoejP-2_z0hxZ-eol4,13387
|
| 649 |
+
pip/_vendor/pyparsing/core.py,sha256=yvuRlLpXSF8mgk-QhiW3OVLqD9T0rsj9tbibhRH4Yaw,224445
|
| 650 |
+
pip/_vendor/pyparsing/diagram/__init__.py,sha256=nxmDOoYF9NXuLaGYy01tKFjkNReWJlrGFuJNWEiTo84,24215
|
| 651 |
+
pip/_vendor/pyparsing/diagram/__pycache__/__init__.cpython-312.pyc,,
|
| 652 |
+
pip/_vendor/pyparsing/exceptions.py,sha256=6Jc6W1eDZBzyFu1J0YrcdNFVBC-RINujZmveSnB8Rxw,9523
|
| 653 |
+
pip/_vendor/pyparsing/helpers.py,sha256=BZJHCA8SS0pYio30KGQTc9w2qMOaK4YpZ7hcvHbnTgk,38646
|
| 654 |
+
pip/_vendor/pyparsing/results.py,sha256=9dyqQ-w3MjfmxWbFt8KEPU6IfXeyRdoWp2Og802rUQY,26692
|
| 655 |
+
pip/_vendor/pyparsing/testing.py,sha256=eJncg0p83zm1FTPvM9auNT6oavIvXaibmRFDf1qmwkY,13488
|
| 656 |
+
pip/_vendor/pyparsing/unicode.py,sha256=fAPdsJiARFbkPAih6NkYry0dpj4jPqelGVMlE4wWFW8,10646
|
| 657 |
+
pip/_vendor/pyparsing/util.py,sha256=vTMzTdwSDyV8d_dSgquUTdWgBFoA_W30nfxEJDsshRQ,8670
|
| 658 |
+
pip/_vendor/pyproject_hooks/__init__.py,sha256=kCehmy0UaBa9oVMD7ZIZrnswfnP3LXZ5lvnNJAL5JBM,491
|
| 659 |
+
pip/_vendor/pyproject_hooks/__pycache__/__init__.cpython-312.pyc,,
|
| 660 |
+
pip/_vendor/pyproject_hooks/__pycache__/_compat.cpython-312.pyc,,
|
| 661 |
+
pip/_vendor/pyproject_hooks/__pycache__/_impl.cpython-312.pyc,,
|
| 662 |
+
pip/_vendor/pyproject_hooks/_compat.py,sha256=by6evrYnqkisiM-MQcvOKs5bgDMzlOSgZqRHNqf04zE,138
|
| 663 |
+
pip/_vendor/pyproject_hooks/_impl.py,sha256=61GJxzQip0IInhuO69ZI5GbNQ82XEDUB_1Gg5_KtUoc,11920
|
| 664 |
+
pip/_vendor/pyproject_hooks/_in_process/__init__.py,sha256=9gQATptbFkelkIy0OfWFEACzqxXJMQDWCH9rBOAZVwQ,546
|
| 665 |
+
pip/_vendor/pyproject_hooks/_in_process/__pycache__/__init__.cpython-312.pyc,,
|
| 666 |
+
pip/_vendor/pyproject_hooks/_in_process/__pycache__/_in_process.cpython-312.pyc,,
|
| 667 |
+
pip/_vendor/pyproject_hooks/_in_process/_in_process.py,sha256=m2b34c917IW5o-Q_6TYIHlsK9lSUlNiyrITTUH_zwew,10927
|
| 668 |
+
pip/_vendor/requests/__init__.py,sha256=owujob4dk45Siy4EYtbCKR6wcFph7E04a_v_OuAacBA,5169
|
| 669 |
+
pip/_vendor/requests/__pycache__/__init__.cpython-312.pyc,,
|
| 670 |
+
pip/_vendor/requests/__pycache__/__version__.cpython-312.pyc,,
|
| 671 |
+
pip/_vendor/requests/__pycache__/_internal_utils.cpython-312.pyc,,
|
| 672 |
+
pip/_vendor/requests/__pycache__/adapters.cpython-312.pyc,,
|
| 673 |
+
pip/_vendor/requests/__pycache__/api.cpython-312.pyc,,
|
| 674 |
+
pip/_vendor/requests/__pycache__/auth.cpython-312.pyc,,
|
| 675 |
+
pip/_vendor/requests/__pycache__/certs.cpython-312.pyc,,
|
| 676 |
+
pip/_vendor/requests/__pycache__/compat.cpython-312.pyc,,
|
| 677 |
+
pip/_vendor/requests/__pycache__/cookies.cpython-312.pyc,,
|
| 678 |
+
pip/_vendor/requests/__pycache__/exceptions.cpython-312.pyc,,
|
| 679 |
+
pip/_vendor/requests/__pycache__/help.cpython-312.pyc,,
|
| 680 |
+
pip/_vendor/requests/__pycache__/hooks.cpython-312.pyc,,
|
| 681 |
+
pip/_vendor/requests/__pycache__/models.cpython-312.pyc,,
|
| 682 |
+
pip/_vendor/requests/__pycache__/packages.cpython-312.pyc,,
|
| 683 |
+
pip/_vendor/requests/__pycache__/sessions.cpython-312.pyc,,
|
| 684 |
+
pip/_vendor/requests/__pycache__/status_codes.cpython-312.pyc,,
|
| 685 |
+
pip/_vendor/requests/__pycache__/structures.cpython-312.pyc,,
|
| 686 |
+
pip/_vendor/requests/__pycache__/utils.cpython-312.pyc,,
|
| 687 |
+
pip/_vendor/requests/__version__.py,sha256=ssI3Ezt7PaxgkOW45GhtwPUclo_SO_ygtIm4A74IOfw,435
|
| 688 |
+
pip/_vendor/requests/_internal_utils.py,sha256=nMQymr4hs32TqVo5AbCrmcJEhvPUh7xXlluyqwslLiQ,1495
|
| 689 |
+
pip/_vendor/requests/adapters.py,sha256=idj6cZcId3L5xNNeJ7ieOLtw3awJk5A64xUfetHwq3M,19697
|
| 690 |
+
pip/_vendor/requests/api.py,sha256=q61xcXq4tmiImrvcSVLTbFyCiD2F-L_-hWKGbz4y8vg,6449
|
| 691 |
+
pip/_vendor/requests/auth.py,sha256=h-HLlVx9j8rKV5hfSAycP2ApOSglTz77R0tz7qCbbEE,10187
|
| 692 |
+
pip/_vendor/requests/certs.py,sha256=PVPooB0jP5hkZEULSCwC074532UFbR2Ptgu0I5zwmCs,575
|
| 693 |
+
pip/_vendor/requests/compat.py,sha256=IhK9quyX0RRuWTNcg6d2JGSAOUbM6mym2p_2XjLTwf4,1286
|
| 694 |
+
pip/_vendor/requests/cookies.py,sha256=kD3kNEcCj-mxbtf5fJsSaT86eGoEYpD3X0CSgpzl7BM,18560
|
| 695 |
+
pip/_vendor/requests/exceptions.py,sha256=FA-_kVwBZ2jhXauRctN_ewHVK25b-fj0Azyz1THQ0Kk,3823
|
| 696 |
+
pip/_vendor/requests/help.py,sha256=FnAAklv8MGm_qb2UilDQgS6l0cUttiCFKUjx0zn2XNA,3879
|
| 697 |
+
pip/_vendor/requests/hooks.py,sha256=CiuysiHA39V5UfcCBXFIx83IrDpuwfN9RcTUgv28ftQ,733
|
| 698 |
+
pip/_vendor/requests/models.py,sha256=dDZ-iThotky-Noq9yy97cUEJhr3wnY6mv-xR_ePg_lk,35288
|
| 699 |
+
pip/_vendor/requests/packages.py,sha256=njJmVifY4aSctuW3PP5EFRCxjEwMRDO6J_feG2dKWsI,695
|
| 700 |
+
pip/_vendor/requests/sessions.py,sha256=-LvTzrPtetSTrR3buxu4XhdgMrJFLB1q5D7P--L2Xhw,30373
|
| 701 |
+
pip/_vendor/requests/status_codes.py,sha256=FvHmT5uH-_uimtRz5hH9VCbt7VV-Nei2J9upbej6j8g,4235
|
| 702 |
+
pip/_vendor/requests/structures.py,sha256=-IbmhVz06S-5aPSZuUthZ6-6D9XOjRuTXHOabY041XM,2912
|
| 703 |
+
pip/_vendor/requests/utils.py,sha256=BvQDKkLuXCSaVfSW_1blUN0IzJSfNC8njNr8vhKj76Y,33189
|
| 704 |
+
pip/_vendor/resolvelib/__init__.py,sha256=h509TdEcpb5-44JonaU3ex2TM15GVBLjM9CNCPwnTTs,537
|
| 705 |
+
pip/_vendor/resolvelib/__pycache__/__init__.cpython-312.pyc,,
|
| 706 |
+
pip/_vendor/resolvelib/__pycache__/providers.cpython-312.pyc,,
|
| 707 |
+
pip/_vendor/resolvelib/__pycache__/reporters.cpython-312.pyc,,
|
| 708 |
+
pip/_vendor/resolvelib/__pycache__/resolvers.cpython-312.pyc,,
|
| 709 |
+
pip/_vendor/resolvelib/__pycache__/structs.cpython-312.pyc,,
|
| 710 |
+
pip/_vendor/resolvelib/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 711 |
+
pip/_vendor/resolvelib/compat/__pycache__/__init__.cpython-312.pyc,,
|
| 712 |
+
pip/_vendor/resolvelib/compat/__pycache__/collections_abc.cpython-312.pyc,,
|
| 713 |
+
pip/_vendor/resolvelib/compat/collections_abc.py,sha256=uy8xUZ-NDEw916tugUXm8HgwCGiMO0f-RcdnpkfXfOs,156
|
| 714 |
+
pip/_vendor/resolvelib/providers.py,sha256=fuuvVrCetu5gsxPB43ERyjfO8aReS3rFQHpDgiItbs4,5871
|
| 715 |
+
pip/_vendor/resolvelib/reporters.py,sha256=TSbRmWzTc26w0ggsV1bxVpeWDB8QNIre6twYl7GIZBE,1601
|
| 716 |
+
pip/_vendor/resolvelib/resolvers.py,sha256=G8rsLZSq64g5VmIq-lB7UcIJ1gjAxIQJmTF4REZleQ0,20511
|
| 717 |
+
pip/_vendor/resolvelib/structs.py,sha256=0_1_XO8z_CLhegP3Vpf9VJ3zJcfLm0NOHRM-i0Ykz3o,4963
|
| 718 |
+
pip/_vendor/rich/__init__.py,sha256=dRxjIL-SbFVY0q3IjSMrfgBTHrm1LZDgLOygVBwiYZc,6090
|
| 719 |
+
pip/_vendor/rich/__main__.py,sha256=TT8sb9PTnsnKhhrGuHkLN0jdN0dtKhtPkEr9CidDbPM,8478
|
| 720 |
+
pip/_vendor/rich/__pycache__/__init__.cpython-312.pyc,,
|
| 721 |
+
pip/_vendor/rich/__pycache__/__main__.cpython-312.pyc,,
|
| 722 |
+
pip/_vendor/rich/__pycache__/_cell_widths.cpython-312.pyc,,
|
| 723 |
+
pip/_vendor/rich/__pycache__/_emoji_codes.cpython-312.pyc,,
|
| 724 |
+
pip/_vendor/rich/__pycache__/_emoji_replace.cpython-312.pyc,,
|
| 725 |
+
pip/_vendor/rich/__pycache__/_export_format.cpython-312.pyc,,
|
| 726 |
+
pip/_vendor/rich/__pycache__/_extension.cpython-312.pyc,,
|
| 727 |
+
pip/_vendor/rich/__pycache__/_fileno.cpython-312.pyc,,
|
| 728 |
+
pip/_vendor/rich/__pycache__/_inspect.cpython-312.pyc,,
|
| 729 |
+
pip/_vendor/rich/__pycache__/_log_render.cpython-312.pyc,,
|
| 730 |
+
pip/_vendor/rich/__pycache__/_loop.cpython-312.pyc,,
|
| 731 |
+
pip/_vendor/rich/__pycache__/_null_file.cpython-312.pyc,,
|
| 732 |
+
pip/_vendor/rich/__pycache__/_palettes.cpython-312.pyc,,
|
| 733 |
+
pip/_vendor/rich/__pycache__/_pick.cpython-312.pyc,,
|
| 734 |
+
pip/_vendor/rich/__pycache__/_ratio.cpython-312.pyc,,
|
| 735 |
+
pip/_vendor/rich/__pycache__/_spinners.cpython-312.pyc,,
|
| 736 |
+
pip/_vendor/rich/__pycache__/_stack.cpython-312.pyc,,
|
| 737 |
+
pip/_vendor/rich/__pycache__/_timer.cpython-312.pyc,,
|
| 738 |
+
pip/_vendor/rich/__pycache__/_win32_console.cpython-312.pyc,,
|
| 739 |
+
pip/_vendor/rich/__pycache__/_windows.cpython-312.pyc,,
|
| 740 |
+
pip/_vendor/rich/__pycache__/_windows_renderer.cpython-312.pyc,,
|
| 741 |
+
pip/_vendor/rich/__pycache__/_wrap.cpython-312.pyc,,
|
| 742 |
+
pip/_vendor/rich/__pycache__/abc.cpython-312.pyc,,
|
| 743 |
+
pip/_vendor/rich/__pycache__/align.cpython-312.pyc,,
|
| 744 |
+
pip/_vendor/rich/__pycache__/ansi.cpython-312.pyc,,
|
| 745 |
+
pip/_vendor/rich/__pycache__/bar.cpython-312.pyc,,
|
| 746 |
+
pip/_vendor/rich/__pycache__/box.cpython-312.pyc,,
|
| 747 |
+
pip/_vendor/rich/__pycache__/cells.cpython-312.pyc,,
|
| 748 |
+
pip/_vendor/rich/__pycache__/color.cpython-312.pyc,,
|
| 749 |
+
pip/_vendor/rich/__pycache__/color_triplet.cpython-312.pyc,,
|
| 750 |
+
pip/_vendor/rich/__pycache__/columns.cpython-312.pyc,,
|
| 751 |
+
pip/_vendor/rich/__pycache__/console.cpython-312.pyc,,
|
| 752 |
+
pip/_vendor/rich/__pycache__/constrain.cpython-312.pyc,,
|
| 753 |
+
pip/_vendor/rich/__pycache__/containers.cpython-312.pyc,,
|
| 754 |
+
pip/_vendor/rich/__pycache__/control.cpython-312.pyc,,
|
| 755 |
+
pip/_vendor/rich/__pycache__/default_styles.cpython-312.pyc,,
|
| 756 |
+
pip/_vendor/rich/__pycache__/diagnose.cpython-312.pyc,,
|
| 757 |
+
pip/_vendor/rich/__pycache__/emoji.cpython-312.pyc,,
|
| 758 |
+
pip/_vendor/rich/__pycache__/errors.cpython-312.pyc,,
|
| 759 |
+
pip/_vendor/rich/__pycache__/file_proxy.cpython-312.pyc,,
|
| 760 |
+
pip/_vendor/rich/__pycache__/filesize.cpython-312.pyc,,
|
| 761 |
+
pip/_vendor/rich/__pycache__/highlighter.cpython-312.pyc,,
|
| 762 |
+
pip/_vendor/rich/__pycache__/json.cpython-312.pyc,,
|
| 763 |
+
pip/_vendor/rich/__pycache__/jupyter.cpython-312.pyc,,
|
| 764 |
+
pip/_vendor/rich/__pycache__/layout.cpython-312.pyc,,
|
| 765 |
+
pip/_vendor/rich/__pycache__/live.cpython-312.pyc,,
|
| 766 |
+
pip/_vendor/rich/__pycache__/live_render.cpython-312.pyc,,
|
| 767 |
+
pip/_vendor/rich/__pycache__/logging.cpython-312.pyc,,
|
| 768 |
+
pip/_vendor/rich/__pycache__/markup.cpython-312.pyc,,
|
| 769 |
+
pip/_vendor/rich/__pycache__/measure.cpython-312.pyc,,
|
| 770 |
+
pip/_vendor/rich/__pycache__/padding.cpython-312.pyc,,
|
| 771 |
+
pip/_vendor/rich/__pycache__/pager.cpython-312.pyc,,
|
| 772 |
+
pip/_vendor/rich/__pycache__/palette.cpython-312.pyc,,
|
| 773 |
+
pip/_vendor/rich/__pycache__/panel.cpython-312.pyc,,
|
| 774 |
+
pip/_vendor/rich/__pycache__/pretty.cpython-312.pyc,,
|
| 775 |
+
pip/_vendor/rich/__pycache__/progress.cpython-312.pyc,,
|
| 776 |
+
pip/_vendor/rich/__pycache__/progress_bar.cpython-312.pyc,,
|
| 777 |
+
pip/_vendor/rich/__pycache__/prompt.cpython-312.pyc,,
|
| 778 |
+
pip/_vendor/rich/__pycache__/protocol.cpython-312.pyc,,
|
| 779 |
+
pip/_vendor/rich/__pycache__/region.cpython-312.pyc,,
|
| 780 |
+
pip/_vendor/rich/__pycache__/repr.cpython-312.pyc,,
|
| 781 |
+
pip/_vendor/rich/__pycache__/rule.cpython-312.pyc,,
|
| 782 |
+
pip/_vendor/rich/__pycache__/scope.cpython-312.pyc,,
|
| 783 |
+
pip/_vendor/rich/__pycache__/screen.cpython-312.pyc,,
|
| 784 |
+
pip/_vendor/rich/__pycache__/segment.cpython-312.pyc,,
|
| 785 |
+
pip/_vendor/rich/__pycache__/spinner.cpython-312.pyc,,
|
| 786 |
+
pip/_vendor/rich/__pycache__/status.cpython-312.pyc,,
|
| 787 |
+
pip/_vendor/rich/__pycache__/style.cpython-312.pyc,,
|
| 788 |
+
pip/_vendor/rich/__pycache__/styled.cpython-312.pyc,,
|
| 789 |
+
pip/_vendor/rich/__pycache__/syntax.cpython-312.pyc,,
|
| 790 |
+
pip/_vendor/rich/__pycache__/table.cpython-312.pyc,,
|
| 791 |
+
pip/_vendor/rich/__pycache__/terminal_theme.cpython-312.pyc,,
|
| 792 |
+
pip/_vendor/rich/__pycache__/text.cpython-312.pyc,,
|
| 793 |
+
pip/_vendor/rich/__pycache__/theme.cpython-312.pyc,,
|
| 794 |
+
pip/_vendor/rich/__pycache__/themes.cpython-312.pyc,,
|
| 795 |
+
pip/_vendor/rich/__pycache__/traceback.cpython-312.pyc,,
|
| 796 |
+
pip/_vendor/rich/__pycache__/tree.cpython-312.pyc,,
|
| 797 |
+
pip/_vendor/rich/_cell_widths.py,sha256=2n4EiJi3X9sqIq0O16kUZ_zy6UYMd3xFfChlKfnW1Hc,10096
|
| 798 |
+
pip/_vendor/rich/_emoji_codes.py,sha256=hu1VL9nbVdppJrVoijVshRlcRRe_v3dju3Mmd2sKZdY,140235
|
| 799 |
+
pip/_vendor/rich/_emoji_replace.py,sha256=n-kcetsEUx2ZUmhQrfeMNc-teeGhpuSQ5F8VPBsyvDo,1064
|
| 800 |
+
pip/_vendor/rich/_export_format.py,sha256=qxgV3nKnXQu1hfbnRVswPYy-AwIg1X0LSC47cK5s8jk,2100
|
| 801 |
+
pip/_vendor/rich/_extension.py,sha256=Xt47QacCKwYruzjDi-gOBq724JReDj9Cm9xUi5fr-34,265
|
| 802 |
+
pip/_vendor/rich/_fileno.py,sha256=HWZxP5C2ajMbHryvAQZseflVfQoGzsKOHzKGsLD8ynQ,799
|
| 803 |
+
pip/_vendor/rich/_inspect.py,sha256=oZJGw31e64dwXSCmrDnvZbwVb1ZKhWfU8wI3VWohjJk,9695
|
| 804 |
+
pip/_vendor/rich/_log_render.py,sha256=1ByI0PA1ZpxZY3CGJOK54hjlq4X-Bz_boIjIqCd8Kns,3225
|
| 805 |
+
pip/_vendor/rich/_loop.py,sha256=hV_6CLdoPm0va22Wpw4zKqM0RYsz3TZxXj0PoS-9eDQ,1236
|
| 806 |
+
pip/_vendor/rich/_null_file.py,sha256=tGSXk_v-IZmbj1GAzHit8A3kYIQMiCpVsCFfsC-_KJ4,1387
|
| 807 |
+
pip/_vendor/rich/_palettes.py,sha256=cdev1JQKZ0JvlguV9ipHgznTdnvlIzUFDBb0It2PzjI,7063
|
| 808 |
+
pip/_vendor/rich/_pick.py,sha256=evDt8QN4lF5CiwrUIXlOJCntitBCOsI3ZLPEIAVRLJU,423
|
| 809 |
+
pip/_vendor/rich/_ratio.py,sha256=2lLSliL025Y-YMfdfGbutkQDevhcyDqc-DtUYW9mU70,5472
|
| 810 |
+
pip/_vendor/rich/_spinners.py,sha256=U2r1_g_1zSjsjiUdAESc2iAMc3i4ri_S8PYP6kQ5z1I,19919
|
| 811 |
+
pip/_vendor/rich/_stack.py,sha256=-C8OK7rxn3sIUdVwxZBBpeHhIzX0eI-VM3MemYfaXm0,351
|
| 812 |
+
pip/_vendor/rich/_timer.py,sha256=zelxbT6oPFZnNrwWPpc1ktUeAT-Vc4fuFcRZLQGLtMI,417
|
| 813 |
+
pip/_vendor/rich/_win32_console.py,sha256=P0vxI2fcndym1UU1S37XAzQzQnkyY7YqAKmxm24_gug,22820
|
| 814 |
+
pip/_vendor/rich/_windows.py,sha256=dvNl9TmfPzNVxiKk5WDFihErZ5796g2UC9-KGGyfXmk,1926
|
| 815 |
+
pip/_vendor/rich/_windows_renderer.py,sha256=t74ZL3xuDCP3nmTp9pH1L5LiI2cakJuQRQleHCJerlk,2783
|
| 816 |
+
pip/_vendor/rich/_wrap.py,sha256=xfV_9t0Sg6rzimmrDru8fCVmUlalYAcHLDfrJZnbbwQ,1840
|
| 817 |
+
pip/_vendor/rich/abc.py,sha256=ON-E-ZqSSheZ88VrKX2M3PXpFbGEUUZPMa_Af0l-4f0,890
|
| 818 |
+
pip/_vendor/rich/align.py,sha256=Ji-Yokfkhnfe_xMmr4ISjZB07TJXggBCOYoYa-HDAr8,10368
|
| 819 |
+
pip/_vendor/rich/ansi.py,sha256=iD6532QYqnBm6hADulKjrV8l8kFJ-9fEVooHJHH3hMg,6906
|
| 820 |
+
pip/_vendor/rich/bar.py,sha256=a7UD303BccRCrEhGjfMElpv5RFYIinaAhAuqYqhUvmw,3264
|
| 821 |
+
pip/_vendor/rich/box.py,sha256=FJ6nI3jD7h2XNFU138bJUt2HYmWOlRbltoCEuIAZhew,9842
|
| 822 |
+
pip/_vendor/rich/cells.py,sha256=627ztJs9zOL-38HJ7kXBerR-gT8KBfYC8UzEwMJDYYo,4509
|
| 823 |
+
pip/_vendor/rich/color.py,sha256=9Gh958U3f75WVdLTeC0U9nkGTn2n0wnojKpJ6jQEkIE,18224
|
| 824 |
+
pip/_vendor/rich/color_triplet.py,sha256=3lhQkdJbvWPoLDO-AnYImAWmJvV5dlgYNCVZ97ORaN4,1054
|
| 825 |
+
pip/_vendor/rich/columns.py,sha256=HUX0KcMm9dsKNi11fTbiM_h2iDtl8ySCaVcxlalEzq8,7131
|
| 826 |
+
pip/_vendor/rich/console.py,sha256=pDvkbLkvtZIMIwQx_jkZ-seyNl4zGBLviXoWXte9fwg,99218
|
| 827 |
+
pip/_vendor/rich/constrain.py,sha256=1VIPuC8AgtKWrcncQrjBdYqA3JVWysu6jZo1rrh7c7Q,1288
|
| 828 |
+
pip/_vendor/rich/containers.py,sha256=aKgm5UDHn5Nmui6IJaKdsZhbHClh_X7D-_Wg8Ehrr7s,5497
|
| 829 |
+
pip/_vendor/rich/control.py,sha256=DSkHTUQLorfSERAKE_oTAEUFefZnZp4bQb4q8rHbKws,6630
|
| 830 |
+
pip/_vendor/rich/default_styles.py,sha256=-Fe318kMVI_IwciK5POpThcO0-9DYJ67TZAN6DlmlmM,8082
|
| 831 |
+
pip/_vendor/rich/diagnose.py,sha256=an6uouwhKPAlvQhYpNNpGq9EJysfMIOvvCbO3oSoR24,972
|
| 832 |
+
pip/_vendor/rich/emoji.py,sha256=omTF9asaAnsM4yLY94eR_9dgRRSm1lHUszX20D1yYCQ,2501
|
| 833 |
+
pip/_vendor/rich/errors.py,sha256=5pP3Kc5d4QJ_c0KFsxrfyhjiPVe7J1zOqSFbFAzcV-Y,642
|
| 834 |
+
pip/_vendor/rich/file_proxy.py,sha256=Tl9THMDZ-Pk5Wm8sI1gGg_U5DhusmxD-FZ0fUbcU0W0,1683
|
| 835 |
+
pip/_vendor/rich/filesize.py,sha256=9fTLAPCAwHmBXdRv7KZU194jSgNrRb6Wx7RIoBgqeKY,2508
|
| 836 |
+
pip/_vendor/rich/highlighter.py,sha256=p3C1g4QYzezFKdR7NF9EhPbzQDvdPUhGRgSyGGEmPko,9584
|
| 837 |
+
pip/_vendor/rich/json.py,sha256=EYp9ucj-nDjYDkHCV6Mk1ve8nUOpuFLaW76X50Mis2M,5032
|
| 838 |
+
pip/_vendor/rich/jupyter.py,sha256=QyoKoE_8IdCbrtiSHp9TsTSNyTHY0FO5whE7jOTd9UE,3252
|
| 839 |
+
pip/_vendor/rich/layout.py,sha256=RFYL6HdCFsHf9WRpcvi3w-fpj-8O5dMZ8W96VdKNdbI,14007
|
| 840 |
+
pip/_vendor/rich/live.py,sha256=vZzYvu7fqwlv3Gthl2xiw1Dc_O80VlGcCV0DOHwCyDM,14273
|
| 841 |
+
pip/_vendor/rich/live_render.py,sha256=zElm3PrfSIvjOce28zETHMIUf9pFYSUA5o0AflgUP64,3667
|
| 842 |
+
pip/_vendor/rich/logging.py,sha256=uB-cB-3Q4bmXDLLpbOWkmFviw-Fde39zyMV6tKJ2WHQ,11903
|
| 843 |
+
pip/_vendor/rich/markup.py,sha256=xzF4uAafiEeEYDJYt_vUnJOGoTU8RrH-PH7WcWYXjCg,8198
|
| 844 |
+
pip/_vendor/rich/measure.py,sha256=HmrIJX8sWRTHbgh8MxEay_83VkqNW_70s8aKP5ZcYI8,5305
|
| 845 |
+
pip/_vendor/rich/padding.py,sha256=kTFGsdGe0os7tXLnHKpwTI90CXEvrceeZGCshmJy5zw,4970
|
| 846 |
+
pip/_vendor/rich/pager.py,sha256=SO_ETBFKbg3n_AgOzXm41Sv36YxXAyI3_R-KOY2_uSc,828
|
| 847 |
+
pip/_vendor/rich/palette.py,sha256=lInvR1ODDT2f3UZMfL1grq7dY_pDdKHw4bdUgOGaM4Y,3396
|
| 848 |
+
pip/_vendor/rich/panel.py,sha256=wGMe40J8KCGgQoM0LyjRErmGIkv2bsYA71RCXThD0xE,10574
|
| 849 |
+
pip/_vendor/rich/pretty.py,sha256=eLEYN9xVaMNuA6EJVYm4li7HdOHxCqmVKvnOqJpyFt0,35852
|
| 850 |
+
pip/_vendor/rich/progress.py,sha256=n4KF9vky8_5iYeXcyZPEvzyLplWlDvFLkM5JI0Bs08A,59706
|
| 851 |
+
pip/_vendor/rich/progress_bar.py,sha256=cEoBfkc3lLwqba4XKsUpy4vSQKDh2QQ5J2J94-ACFoo,8165
|
| 852 |
+
pip/_vendor/rich/prompt.py,sha256=x0mW-pIPodJM4ry6grgmmLrl8VZp99kqcmdnBe70YYA,11303
|
| 853 |
+
pip/_vendor/rich/protocol.py,sha256=5hHHDDNHckdk8iWH5zEbi-zuIVSF5hbU2jIo47R7lTE,1391
|
| 854 |
+
pip/_vendor/rich/region.py,sha256=rNT9xZrVZTYIXZC0NYn41CJQwYNbR-KecPOxTgQvB8Y,166
|
| 855 |
+
pip/_vendor/rich/repr.py,sha256=9Z8otOmM-tyxnyTodvXlectP60lwahjGiDTrbrxPSTg,4431
|
| 856 |
+
pip/_vendor/rich/rule.py,sha256=0fNaS_aERa3UMRc3T5WMpN_sumtDxfaor2y3of1ftBk,4602
|
| 857 |
+
pip/_vendor/rich/scope.py,sha256=TMUU8qo17thyqQCPqjDLYpg_UU1k5qVd-WwiJvnJVas,2843
|
| 858 |
+
pip/_vendor/rich/screen.py,sha256=YoeReESUhx74grqb0mSSb9lghhysWmFHYhsbMVQjXO8,1591
|
| 859 |
+
pip/_vendor/rich/segment.py,sha256=XLnJEFvcV3bjaVzMNUJiem3n8lvvI9TJ5PTu-IG2uTg,24247
|
| 860 |
+
pip/_vendor/rich/spinner.py,sha256=15koCmF0DQeD8-k28Lpt6X_zJQUlzEhgo_6A6uy47lc,4339
|
| 861 |
+
pip/_vendor/rich/status.py,sha256=gJsIXIZeSo3urOyxRUjs6VrhX5CZrA0NxIQ-dxhCnwo,4425
|
| 862 |
+
pip/_vendor/rich/style.py,sha256=3hiocH_4N8vwRm3-8yFWzM7tSwjjEven69XqWasSQwM,27073
|
| 863 |
+
pip/_vendor/rich/styled.py,sha256=eZNnzGrI4ki_54pgY3Oj0T-x3lxdXTYh4_ryDB24wBU,1258
|
| 864 |
+
pip/_vendor/rich/syntax.py,sha256=jgDiVCK6cpR0NmBOpZmIu-Ud4eaW7fHvjJZkDbjpcSA,35173
|
| 865 |
+
pip/_vendor/rich/table.py,sha256=-WzesL-VJKsaiDU3uyczpJMHy6VCaSewBYJwx8RudI8,39684
|
| 866 |
+
pip/_vendor/rich/terminal_theme.py,sha256=1j5-ufJfnvlAo5Qsi_ACZiXDmwMXzqgmFByObT9-yJY,3370
|
| 867 |
+
pip/_vendor/rich/text.py,sha256=_8JBlSau0c2z8ENOZMi1hJ7M1ZGY408E4-hXjHyyg1A,45525
|
| 868 |
+
pip/_vendor/rich/theme.py,sha256=belFJogzA0W0HysQabKaHOc3RWH2ko3fQAJhoN-AFdo,3777
|
| 869 |
+
pip/_vendor/rich/themes.py,sha256=0xgTLozfabebYtcJtDdC5QkX5IVUEaviqDUJJh4YVFk,102
|
| 870 |
+
pip/_vendor/rich/traceback.py,sha256=yCLVrCtyoFNENd9mkm2xeG3KmqkTwH9xpFOO7p2Bq0A,29604
|
| 871 |
+
pip/_vendor/rich/tree.py,sha256=BMbUYNjS9uodNPfvtY_odmU09GA5QzcMbQ5cJZhllQI,9169
|
| 872 |
+
pip/_vendor/six.py,sha256=TOOfQi7nFGfMrIvtdr6wX4wyHH8M7aknmuLfo2cBBrM,34549
|
| 873 |
+
pip/_vendor/tenacity/__init__.py,sha256=3kvAL6KClq8GFo2KFhmOzskRKSDQI-ubrlfZ8AQEEI0,20493
|
| 874 |
+
pip/_vendor/tenacity/__pycache__/__init__.cpython-312.pyc,,
|
| 875 |
+
pip/_vendor/tenacity/__pycache__/_asyncio.cpython-312.pyc,,
|
| 876 |
+
pip/_vendor/tenacity/__pycache__/_utils.cpython-312.pyc,,
|
| 877 |
+
pip/_vendor/tenacity/__pycache__/after.cpython-312.pyc,,
|
| 878 |
+
pip/_vendor/tenacity/__pycache__/before.cpython-312.pyc,,
|
| 879 |
+
pip/_vendor/tenacity/__pycache__/before_sleep.cpython-312.pyc,,
|
| 880 |
+
pip/_vendor/tenacity/__pycache__/nap.cpython-312.pyc,,
|
| 881 |
+
pip/_vendor/tenacity/__pycache__/retry.cpython-312.pyc,,
|
| 882 |
+
pip/_vendor/tenacity/__pycache__/stop.cpython-312.pyc,,
|
| 883 |
+
pip/_vendor/tenacity/__pycache__/tornadoweb.cpython-312.pyc,,
|
| 884 |
+
pip/_vendor/tenacity/__pycache__/wait.cpython-312.pyc,,
|
| 885 |
+
pip/_vendor/tenacity/_asyncio.py,sha256=Qi6wgQsGa9MQibYRy3OXqcDQswIZZ00dLOoSUGN-6o8,3551
|
| 886 |
+
pip/_vendor/tenacity/_utils.py,sha256=ubs6a7sxj3JDNRKWCyCU2j5r1CB7rgyONgZzYZq6D_4,2179
|
| 887 |
+
pip/_vendor/tenacity/after.py,sha256=S5NCISScPeIrKwIeXRwdJl3kV9Q4nqZfnNPDx6Hf__g,1682
|
| 888 |
+
pip/_vendor/tenacity/before.py,sha256=dIZE9gmBTffisfwNkK0F1xFwGPV41u5GK70UY4Pi5Kc,1562
|
| 889 |
+
pip/_vendor/tenacity/before_sleep.py,sha256=YmpgN9Y7HGlH97U24vvq_YWb5deaK4_DbiD8ZuFmy-E,2372
|
| 890 |
+
pip/_vendor/tenacity/nap.py,sha256=fRWvnz1aIzbIq9Ap3gAkAZgDH6oo5zxMrU6ZOVByq0I,1383
|
| 891 |
+
pip/_vendor/tenacity/retry.py,sha256=jrzD_mxA5mSTUEdiYB7SHpxltjhPSYZSnSRATb-ggRc,8746
|
| 892 |
+
pip/_vendor/tenacity/stop.py,sha256=YMJs7ZgZfND65PRLqlGB_agpfGXlemx_5Hm4PKnBqpQ,3086
|
| 893 |
+
pip/_vendor/tenacity/tornadoweb.py,sha256=po29_F1Mt8qZpsFjX7EVwAT0ydC_NbVia9gVi7R_wXA,2142
|
| 894 |
+
pip/_vendor/tenacity/wait.py,sha256=3FcBJoCDgym12_dN6xfK8C1gROY0Hn4NSI2u8xv50uE,8024
|
| 895 |
+
pip/_vendor/tomli/__init__.py,sha256=JhUwV66DB1g4Hvt1UQCVMdfCu-IgAV8FXmvDU9onxd4,396
|
| 896 |
+
pip/_vendor/tomli/__pycache__/__init__.cpython-312.pyc,,
|
| 897 |
+
pip/_vendor/tomli/__pycache__/_parser.cpython-312.pyc,,
|
| 898 |
+
pip/_vendor/tomli/__pycache__/_re.cpython-312.pyc,,
|
| 899 |
+
pip/_vendor/tomli/__pycache__/_types.cpython-312.pyc,,
|
| 900 |
+
pip/_vendor/tomli/_parser.py,sha256=g9-ENaALS-B8dokYpCuzUFalWlog7T-SIYMjLZSWrtM,22633
|
| 901 |
+
pip/_vendor/tomli/_re.py,sha256=dbjg5ChZT23Ka9z9DHOXfdtSpPwUfdgMXnj8NOoly-w,2943
|
| 902 |
+
pip/_vendor/tomli/_types.py,sha256=-GTG2VUqkpxwMqzmVO4F7ybKddIbAnuAHXfmWQcTi3Q,254
|
| 903 |
+
pip/_vendor/truststore/__init__.py,sha256=qzTLSH8PvAkY1fr6QQ2vV-KwE_M83wdXugtpJaP_AbM,403
|
| 904 |
+
pip/_vendor/truststore/__pycache__/__init__.cpython-312.pyc,,
|
| 905 |
+
pip/_vendor/truststore/__pycache__/_api.cpython-312.pyc,,
|
| 906 |
+
pip/_vendor/truststore/__pycache__/_macos.cpython-312.pyc,,
|
| 907 |
+
pip/_vendor/truststore/__pycache__/_openssl.cpython-312.pyc,,
|
| 908 |
+
pip/_vendor/truststore/__pycache__/_ssl_constants.cpython-312.pyc,,
|
| 909 |
+
pip/_vendor/truststore/__pycache__/_windows.cpython-312.pyc,,
|
| 910 |
+
pip/_vendor/truststore/_api.py,sha256=xjuEu_rlH4hcdJTROImEyOEqdw-F8t5vO2H2BToY0Ro,9893
|
| 911 |
+
pip/_vendor/truststore/_macos.py,sha256=BjvAKoAjXhdIPuxpY124HJIFswDb0pq8DjynzJOVwqc,17694
|
| 912 |
+
pip/_vendor/truststore/_openssl.py,sha256=LLUZ7ZGaio-i5dpKKjKCSeSufmn6T8pi9lDcFnvSyq0,2324
|
| 913 |
+
pip/_vendor/truststore/_ssl_constants.py,sha256=NUD4fVKdSD02ri7-db0tnO0VqLP9aHuzmStcW7tAl08,1130
|
| 914 |
+
pip/_vendor/truststore/_windows.py,sha256=1x_EhROeJ9QK1sMAjfnZC7awYI8UnBJYL-TjACUYI4A,17468
|
| 915 |
+
pip/_vendor/typing_extensions.py,sha256=EWpcpyQnVmc48E9fSyPGs-vXgHcAk9tQABQIxmMsCGk,111130
|
| 916 |
+
pip/_vendor/urllib3/__init__.py,sha256=iXLcYiJySn0GNbWOOZDDApgBL1JgP44EZ8i1760S8Mc,3333
|
| 917 |
+
pip/_vendor/urllib3/__pycache__/__init__.cpython-312.pyc,,
|
| 918 |
+
pip/_vendor/urllib3/__pycache__/_collections.cpython-312.pyc,,
|
| 919 |
+
pip/_vendor/urllib3/__pycache__/_version.cpython-312.pyc,,
|
| 920 |
+
pip/_vendor/urllib3/__pycache__/connection.cpython-312.pyc,,
|
| 921 |
+
pip/_vendor/urllib3/__pycache__/connectionpool.cpython-312.pyc,,
|
| 922 |
+
pip/_vendor/urllib3/__pycache__/exceptions.cpython-312.pyc,,
|
| 923 |
+
pip/_vendor/urllib3/__pycache__/fields.cpython-312.pyc,,
|
| 924 |
+
pip/_vendor/urllib3/__pycache__/filepost.cpython-312.pyc,,
|
| 925 |
+
pip/_vendor/urllib3/__pycache__/poolmanager.cpython-312.pyc,,
|
| 926 |
+
pip/_vendor/urllib3/__pycache__/request.cpython-312.pyc,,
|
| 927 |
+
pip/_vendor/urllib3/__pycache__/response.cpython-312.pyc,,
|
| 928 |
+
pip/_vendor/urllib3/_collections.py,sha256=pyASJJhW7wdOpqJj9QJA8FyGRfr8E8uUUhqUvhF0728,11372
|
| 929 |
+
pip/_vendor/urllib3/_version.py,sha256=azoM7M7BUADl2kBhMVR6PPf2GhBDI90me1fcnzTwdcw,64
|
| 930 |
+
pip/_vendor/urllib3/connection.py,sha256=92k9td_y4PEiTIjNufCUa1NzMB3J3w0LEdyokYgXnW8,20300
|
| 931 |
+
pip/_vendor/urllib3/connectionpool.py,sha256=Be6q65SR9laoikg-h_jmc_p8OWtEmwgq_Om_Xtig-2M,40285
|
| 932 |
+
pip/_vendor/urllib3/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 933 |
+
pip/_vendor/urllib3/contrib/__pycache__/__init__.cpython-312.pyc,,
|
| 934 |
+
pip/_vendor/urllib3/contrib/__pycache__/_appengine_environ.cpython-312.pyc,,
|
| 935 |
+
pip/_vendor/urllib3/contrib/__pycache__/appengine.cpython-312.pyc,,
|
| 936 |
+
pip/_vendor/urllib3/contrib/__pycache__/ntlmpool.cpython-312.pyc,,
|
| 937 |
+
pip/_vendor/urllib3/contrib/__pycache__/pyopenssl.cpython-312.pyc,,
|
| 938 |
+
pip/_vendor/urllib3/contrib/__pycache__/securetransport.cpython-312.pyc,,
|
| 939 |
+
pip/_vendor/urllib3/contrib/__pycache__/socks.cpython-312.pyc,,
|
| 940 |
+
pip/_vendor/urllib3/contrib/_appengine_environ.py,sha256=bDbyOEhW2CKLJcQqAKAyrEHN-aklsyHFKq6vF8ZFsmk,957
|
| 941 |
+
pip/_vendor/urllib3/contrib/_securetransport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 942 |
+
pip/_vendor/urllib3/contrib/_securetransport/__pycache__/__init__.cpython-312.pyc,,
|
| 943 |
+
pip/_vendor/urllib3/contrib/_securetransport/__pycache__/bindings.cpython-312.pyc,,
|
| 944 |
+
pip/_vendor/urllib3/contrib/_securetransport/__pycache__/low_level.cpython-312.pyc,,
|
| 945 |
+
pip/_vendor/urllib3/contrib/_securetransport/bindings.py,sha256=4Xk64qIkPBt09A5q-RIFUuDhNc9mXilVapm7WnYnzRw,17632
|
| 946 |
+
pip/_vendor/urllib3/contrib/_securetransport/low_level.py,sha256=B2JBB2_NRP02xK6DCa1Pa9IuxrPwxzDzZbixQkb7U9M,13922
|
| 947 |
+
pip/_vendor/urllib3/contrib/appengine.py,sha256=VR68eAVE137lxTgjBDwCna5UiBZTOKa01Aj_-5BaCz4,11036
|
| 948 |
+
pip/_vendor/urllib3/contrib/ntlmpool.py,sha256=NlfkW7WMdW8ziqudopjHoW299og1BTWi0IeIibquFwk,4528
|
| 949 |
+
pip/_vendor/urllib3/contrib/pyopenssl.py,sha256=hDJh4MhyY_p-oKlFcYcQaVQRDv6GMmBGuW9yjxyeejM,17081
|
| 950 |
+
pip/_vendor/urllib3/contrib/securetransport.py,sha256=yhZdmVjY6PI6EeFbp7qYOp6-vp1Rkv2NMuOGaEj7pmc,34448
|
| 951 |
+
pip/_vendor/urllib3/contrib/socks.py,sha256=aRi9eWXo9ZEb95XUxef4Z21CFlnnjbEiAo9HOseoMt4,7097
|
| 952 |
+
pip/_vendor/urllib3/exceptions.py,sha256=0Mnno3KHTNfXRfY7638NufOPkUb6mXOm-Lqj-4x2w8A,8217
|
| 953 |
+
pip/_vendor/urllib3/fields.py,sha256=kvLDCg_JmH1lLjUUEY_FLS8UhY7hBvDPuVETbY8mdrM,8579
|
| 954 |
+
pip/_vendor/urllib3/filepost.py,sha256=5b_qqgRHVlL7uLtdAYBzBh-GHmU5AfJVt_2N0XS3PeY,2440
|
| 955 |
+
pip/_vendor/urllib3/packages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 956 |
+
pip/_vendor/urllib3/packages/__pycache__/__init__.cpython-312.pyc,,
|
| 957 |
+
pip/_vendor/urllib3/packages/__pycache__/six.cpython-312.pyc,,
|
| 958 |
+
pip/_vendor/urllib3/packages/backports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 959 |
+
pip/_vendor/urllib3/packages/backports/__pycache__/__init__.cpython-312.pyc,,
|
| 960 |
+
pip/_vendor/urllib3/packages/backports/__pycache__/makefile.cpython-312.pyc,,
|
| 961 |
+
pip/_vendor/urllib3/packages/backports/__pycache__/weakref_finalize.cpython-312.pyc,,
|
| 962 |
+
pip/_vendor/urllib3/packages/backports/makefile.py,sha256=nbzt3i0agPVP07jqqgjhaYjMmuAi_W5E0EywZivVO8E,1417
|
| 963 |
+
pip/_vendor/urllib3/packages/backports/weakref_finalize.py,sha256=tRCal5OAhNSRyb0DhHp-38AtIlCsRP8BxF3NX-6rqIA,5343
|
| 964 |
+
pip/_vendor/urllib3/packages/six.py,sha256=b9LM0wBXv7E7SrbCjAm4wwN-hrH-iNxv18LgWNMMKPo,34665
|
| 965 |
+
pip/_vendor/urllib3/poolmanager.py,sha256=mJmZWy_Mb4-dHbmNCKbDqv3fZS9UF_2bVDuiECHyPaI,20943
|
| 966 |
+
pip/_vendor/urllib3/request.py,sha256=YTWFNr7QIwh7E1W9dde9LM77v2VWTJ5V78XuTTw7D1A,6691
|
| 967 |
+
pip/_vendor/urllib3/response.py,sha256=fmDJAFkG71uFTn-sVSTh2Iw0WmcXQYqkbRjihvwBjU8,30641
|
| 968 |
+
pip/_vendor/urllib3/util/__init__.py,sha256=JEmSmmqqLyaw8P51gUImZh8Gwg9i1zSe-DoqAitn2nc,1155
|
| 969 |
+
pip/_vendor/urllib3/util/__pycache__/__init__.cpython-312.pyc,,
|
| 970 |
+
pip/_vendor/urllib3/util/__pycache__/connection.cpython-312.pyc,,
|
| 971 |
+
pip/_vendor/urllib3/util/__pycache__/proxy.cpython-312.pyc,,
|
| 972 |
+
pip/_vendor/urllib3/util/__pycache__/queue.cpython-312.pyc,,
|
| 973 |
+
pip/_vendor/urllib3/util/__pycache__/request.cpython-312.pyc,,
|
| 974 |
+
pip/_vendor/urllib3/util/__pycache__/response.cpython-312.pyc,,
|
| 975 |
+
pip/_vendor/urllib3/util/__pycache__/retry.cpython-312.pyc,,
|
| 976 |
+
pip/_vendor/urllib3/util/__pycache__/ssl_.cpython-312.pyc,,
|
| 977 |
+
pip/_vendor/urllib3/util/__pycache__/ssl_match_hostname.cpython-312.pyc,,
|
| 978 |
+
pip/_vendor/urllib3/util/__pycache__/ssltransport.cpython-312.pyc,,
|
| 979 |
+
pip/_vendor/urllib3/util/__pycache__/timeout.cpython-312.pyc,,
|
| 980 |
+
pip/_vendor/urllib3/util/__pycache__/url.cpython-312.pyc,,
|
| 981 |
+
pip/_vendor/urllib3/util/__pycache__/wait.cpython-312.pyc,,
|
| 982 |
+
pip/_vendor/urllib3/util/connection.py,sha256=5Lx2B1PW29KxBn2T0xkN1CBgRBa3gGVJBKoQoRogEVk,4901
|
| 983 |
+
pip/_vendor/urllib3/util/proxy.py,sha256=zUvPPCJrp6dOF0N4GAVbOcl6o-4uXKSrGiTkkr5vUS4,1605
|
| 984 |
+
pip/_vendor/urllib3/util/queue.py,sha256=nRgX8_eX-_VkvxoX096QWoz8Ps0QHUAExILCY_7PncM,498
|
| 985 |
+
pip/_vendor/urllib3/util/request.py,sha256=C0OUt2tcU6LRiQJ7YYNP9GvPrSvl7ziIBekQ-5nlBZk,3997
|
| 986 |
+
pip/_vendor/urllib3/util/response.py,sha256=GJpg3Egi9qaJXRwBh5wv-MNuRWan5BIu40oReoxWP28,3510
|
| 987 |
+
pip/_vendor/urllib3/util/retry.py,sha256=6ENvOZ8PBDzh8kgixpql9lIrb2dxH-k7ZmBanJF2Ng4,22050
|
| 988 |
+
pip/_vendor/urllib3/util/ssl_.py,sha256=X4-AqW91aYPhPx6-xbf66yHFQKbqqfC_5Zt4WkLX1Hc,17177
|
| 989 |
+
pip/_vendor/urllib3/util/ssl_match_hostname.py,sha256=Ir4cZVEjmAk8gUAIHWSi7wtOO83UCYABY2xFD1Ql_WA,5758
|
| 990 |
+
pip/_vendor/urllib3/util/ssltransport.py,sha256=NA-u5rMTrDFDFC8QzRKUEKMG0561hOD4qBTr3Z4pv6E,6895
|
| 991 |
+
pip/_vendor/urllib3/util/timeout.py,sha256=cwq4dMk87mJHSBktK1miYJ-85G-3T3RmT20v7SFCpno,10168
|
| 992 |
+
pip/_vendor/urllib3/util/url.py,sha256=lCAE7M5myA8EDdW0sJuyyZhVB9K_j38ljWhHAnFaWoE,14296
|
| 993 |
+
pip/_vendor/urllib3/util/wait.py,sha256=fOX0_faozG2P7iVojQoE1mbydweNyTcm-hXEfFrTtLI,5403
|
| 994 |
+
pip/_vendor/vendor.txt,sha256=4NKk7fQhVsZw0U-0zmm9Q2LgGyaPXacFbnJAaS0Q6EY,493
|
| 995 |
+
pip/_vendor/webencodings/__init__.py,sha256=qOBJIuPy_4ByYH6W_bNgJF-qYQ2DoU-dKsDu5yRWCXg,10579
|
| 996 |
+
pip/_vendor/webencodings/__pycache__/__init__.cpython-312.pyc,,
|
| 997 |
+
pip/_vendor/webencodings/__pycache__/labels.cpython-312.pyc,,
|
| 998 |
+
pip/_vendor/webencodings/__pycache__/mklabels.cpython-312.pyc,,
|
| 999 |
+
pip/_vendor/webencodings/__pycache__/tests.cpython-312.pyc,,
|
| 1000 |
+
pip/_vendor/webencodings/__pycache__/x_user_defined.cpython-312.pyc,,
|
| 1001 |
+
pip/_vendor/webencodings/labels.py,sha256=4AO_KxTddqGtrL9ns7kAPjb0CcN6xsCIxbK37HY9r3E,8979
|
| 1002 |
+
pip/_vendor/webencodings/mklabels.py,sha256=GYIeywnpaLnP0GSic8LFWgd0UVvO_l1Nc6YoF-87R_4,1305
|
| 1003 |
+
pip/_vendor/webencodings/tests.py,sha256=OtGLyjhNY1fvkW1GvLJ_FV9ZoqC9Anyjr7q3kxTbzNs,6563
|
| 1004 |
+
pip/_vendor/webencodings/x_user_defined.py,sha256=yOqWSdmpytGfUgh_Z6JYgDNhoc-BAHyyeeT15Fr42tM,4307
|
| 1005 |
+
pip/py.typed,sha256=EBVvvPRTn_eIpz5e5QztSCdrMX7Qwd7VP93RSoIlZ2I,286
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/REQUESTED
ADDED
|
File without changes
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: bdist_wheel (0.42.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
pip = pip._internal.cli.main:main
|
| 3 |
+
pip3 = pip._internal.cli.main:main
|
| 4 |
+
pip3.12 = pip._internal.cli.main:main
|
.venv/lib/python3.12/site-packages/pip-24.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/ansi.py
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
import sys
|
| 3 |
+
from contextlib import suppress
|
| 4 |
+
from typing import Iterable, NamedTuple, Optional
|
| 5 |
+
|
| 6 |
+
from .color import Color
|
| 7 |
+
from .style import Style
|
| 8 |
+
from .text import Text
|
| 9 |
+
|
| 10 |
+
re_ansi = re.compile(
|
| 11 |
+
r"""
|
| 12 |
+
(?:\x1b\](.*?)\x1b\\)|
|
| 13 |
+
(?:\x1b([(@-Z\\-_]|\[[0-?]*[ -/]*[@-~]))
|
| 14 |
+
""",
|
| 15 |
+
re.VERBOSE,
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class _AnsiToken(NamedTuple):
|
| 20 |
+
"""Result of ansi tokenized string."""
|
| 21 |
+
|
| 22 |
+
plain: str = ""
|
| 23 |
+
sgr: Optional[str] = ""
|
| 24 |
+
osc: Optional[str] = ""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def _ansi_tokenize(ansi_text: str) -> Iterable[_AnsiToken]:
|
| 28 |
+
"""Tokenize a string in to plain text and ANSI codes.
|
| 29 |
+
|
| 30 |
+
Args:
|
| 31 |
+
ansi_text (str): A String containing ANSI codes.
|
| 32 |
+
|
| 33 |
+
Yields:
|
| 34 |
+
AnsiToken: A named tuple of (plain, sgr, osc)
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
position = 0
|
| 38 |
+
sgr: Optional[str]
|
| 39 |
+
osc: Optional[str]
|
| 40 |
+
for match in re_ansi.finditer(ansi_text):
|
| 41 |
+
start, end = match.span(0)
|
| 42 |
+
osc, sgr = match.groups()
|
| 43 |
+
if start > position:
|
| 44 |
+
yield _AnsiToken(ansi_text[position:start])
|
| 45 |
+
if sgr:
|
| 46 |
+
if sgr == "(":
|
| 47 |
+
position = end + 1
|
| 48 |
+
continue
|
| 49 |
+
if sgr.endswith("m"):
|
| 50 |
+
yield _AnsiToken("", sgr[1:-1], osc)
|
| 51 |
+
else:
|
| 52 |
+
yield _AnsiToken("", sgr, osc)
|
| 53 |
+
position = end
|
| 54 |
+
if position < len(ansi_text):
|
| 55 |
+
yield _AnsiToken(ansi_text[position:])
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
SGR_STYLE_MAP = {
|
| 59 |
+
1: "bold",
|
| 60 |
+
2: "dim",
|
| 61 |
+
3: "italic",
|
| 62 |
+
4: "underline",
|
| 63 |
+
5: "blink",
|
| 64 |
+
6: "blink2",
|
| 65 |
+
7: "reverse",
|
| 66 |
+
8: "conceal",
|
| 67 |
+
9: "strike",
|
| 68 |
+
21: "underline2",
|
| 69 |
+
22: "not dim not bold",
|
| 70 |
+
23: "not italic",
|
| 71 |
+
24: "not underline",
|
| 72 |
+
25: "not blink",
|
| 73 |
+
26: "not blink2",
|
| 74 |
+
27: "not reverse",
|
| 75 |
+
28: "not conceal",
|
| 76 |
+
29: "not strike",
|
| 77 |
+
30: "color(0)",
|
| 78 |
+
31: "color(1)",
|
| 79 |
+
32: "color(2)",
|
| 80 |
+
33: "color(3)",
|
| 81 |
+
34: "color(4)",
|
| 82 |
+
35: "color(5)",
|
| 83 |
+
36: "color(6)",
|
| 84 |
+
37: "color(7)",
|
| 85 |
+
39: "default",
|
| 86 |
+
40: "on color(0)",
|
| 87 |
+
41: "on color(1)",
|
| 88 |
+
42: "on color(2)",
|
| 89 |
+
43: "on color(3)",
|
| 90 |
+
44: "on color(4)",
|
| 91 |
+
45: "on color(5)",
|
| 92 |
+
46: "on color(6)",
|
| 93 |
+
47: "on color(7)",
|
| 94 |
+
49: "on default",
|
| 95 |
+
51: "frame",
|
| 96 |
+
52: "encircle",
|
| 97 |
+
53: "overline",
|
| 98 |
+
54: "not frame not encircle",
|
| 99 |
+
55: "not overline",
|
| 100 |
+
90: "color(8)",
|
| 101 |
+
91: "color(9)",
|
| 102 |
+
92: "color(10)",
|
| 103 |
+
93: "color(11)",
|
| 104 |
+
94: "color(12)",
|
| 105 |
+
95: "color(13)",
|
| 106 |
+
96: "color(14)",
|
| 107 |
+
97: "color(15)",
|
| 108 |
+
100: "on color(8)",
|
| 109 |
+
101: "on color(9)",
|
| 110 |
+
102: "on color(10)",
|
| 111 |
+
103: "on color(11)",
|
| 112 |
+
104: "on color(12)",
|
| 113 |
+
105: "on color(13)",
|
| 114 |
+
106: "on color(14)",
|
| 115 |
+
107: "on color(15)",
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class AnsiDecoder:
|
| 120 |
+
"""Translate ANSI code in to styled Text."""
|
| 121 |
+
|
| 122 |
+
def __init__(self) -> None:
|
| 123 |
+
self.style = Style.null()
|
| 124 |
+
|
| 125 |
+
def decode(self, terminal_text: str) -> Iterable[Text]:
|
| 126 |
+
"""Decode ANSI codes in an iterable of lines.
|
| 127 |
+
|
| 128 |
+
Args:
|
| 129 |
+
lines (Iterable[str]): An iterable of lines of terminal output.
|
| 130 |
+
|
| 131 |
+
Yields:
|
| 132 |
+
Text: Marked up Text.
|
| 133 |
+
"""
|
| 134 |
+
for line in terminal_text.splitlines():
|
| 135 |
+
yield self.decode_line(line)
|
| 136 |
+
|
| 137 |
+
def decode_line(self, line: str) -> Text:
|
| 138 |
+
"""Decode a line containing ansi codes.
|
| 139 |
+
|
| 140 |
+
Args:
|
| 141 |
+
line (str): A line of terminal output.
|
| 142 |
+
|
| 143 |
+
Returns:
|
| 144 |
+
Text: A Text instance marked up according to ansi codes.
|
| 145 |
+
"""
|
| 146 |
+
from_ansi = Color.from_ansi
|
| 147 |
+
from_rgb = Color.from_rgb
|
| 148 |
+
_Style = Style
|
| 149 |
+
text = Text()
|
| 150 |
+
append = text.append
|
| 151 |
+
line = line.rsplit("\r", 1)[-1]
|
| 152 |
+
for plain_text, sgr, osc in _ansi_tokenize(line):
|
| 153 |
+
if plain_text:
|
| 154 |
+
append(plain_text, self.style or None)
|
| 155 |
+
elif osc is not None:
|
| 156 |
+
if osc.startswith("8;"):
|
| 157 |
+
_params, semicolon, link = osc[2:].partition(";")
|
| 158 |
+
if semicolon:
|
| 159 |
+
self.style = self.style.update_link(link or None)
|
| 160 |
+
elif sgr is not None:
|
| 161 |
+
# Translate in to semi-colon separated codes
|
| 162 |
+
# Ignore invalid codes, because we want to be lenient
|
| 163 |
+
codes = [
|
| 164 |
+
min(255, int(_code) if _code else 0)
|
| 165 |
+
for _code in sgr.split(";")
|
| 166 |
+
if _code.isdigit() or _code == ""
|
| 167 |
+
]
|
| 168 |
+
iter_codes = iter(codes)
|
| 169 |
+
for code in iter_codes:
|
| 170 |
+
if code == 0:
|
| 171 |
+
# reset
|
| 172 |
+
self.style = _Style.null()
|
| 173 |
+
elif code in SGR_STYLE_MAP:
|
| 174 |
+
# styles
|
| 175 |
+
self.style += _Style.parse(SGR_STYLE_MAP[code])
|
| 176 |
+
elif code == 38:
|
| 177 |
+
# Foreground
|
| 178 |
+
with suppress(StopIteration):
|
| 179 |
+
color_type = next(iter_codes)
|
| 180 |
+
if color_type == 5:
|
| 181 |
+
self.style += _Style.from_color(
|
| 182 |
+
from_ansi(next(iter_codes))
|
| 183 |
+
)
|
| 184 |
+
elif color_type == 2:
|
| 185 |
+
self.style += _Style.from_color(
|
| 186 |
+
from_rgb(
|
| 187 |
+
next(iter_codes),
|
| 188 |
+
next(iter_codes),
|
| 189 |
+
next(iter_codes),
|
| 190 |
+
)
|
| 191 |
+
)
|
| 192 |
+
elif code == 48:
|
| 193 |
+
# Background
|
| 194 |
+
with suppress(StopIteration):
|
| 195 |
+
color_type = next(iter_codes)
|
| 196 |
+
if color_type == 5:
|
| 197 |
+
self.style += _Style.from_color(
|
| 198 |
+
None, from_ansi(next(iter_codes))
|
| 199 |
+
)
|
| 200 |
+
elif color_type == 2:
|
| 201 |
+
self.style += _Style.from_color(
|
| 202 |
+
None,
|
| 203 |
+
from_rgb(
|
| 204 |
+
next(iter_codes),
|
| 205 |
+
next(iter_codes),
|
| 206 |
+
next(iter_codes),
|
| 207 |
+
),
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
return text
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
if sys.platform != "win32" and __name__ == "__main__": # pragma: no cover
|
| 214 |
+
import io
|
| 215 |
+
import os
|
| 216 |
+
import pty
|
| 217 |
+
import sys
|
| 218 |
+
|
| 219 |
+
decoder = AnsiDecoder()
|
| 220 |
+
|
| 221 |
+
stdout = io.BytesIO()
|
| 222 |
+
|
| 223 |
+
def read(fd: int) -> bytes:
|
| 224 |
+
data = os.read(fd, 1024)
|
| 225 |
+
stdout.write(data)
|
| 226 |
+
return data
|
| 227 |
+
|
| 228 |
+
pty.spawn(sys.argv[1:], read)
|
| 229 |
+
|
| 230 |
+
from .console import Console
|
| 231 |
+
|
| 232 |
+
console = Console(record=True)
|
| 233 |
+
|
| 234 |
+
stdout_result = stdout.getvalue().decode("utf-8")
|
| 235 |
+
print(stdout_result)
|
| 236 |
+
|
| 237 |
+
for line in decoder.decode(stdout_result):
|
| 238 |
+
console.print(line)
|
| 239 |
+
|
| 240 |
+
console.save_html("stdout.html")
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/bar.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional, Union
|
| 2 |
+
|
| 3 |
+
from .color import Color
|
| 4 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 5 |
+
from .jupyter import JupyterMixin
|
| 6 |
+
from .measure import Measurement
|
| 7 |
+
from .segment import Segment
|
| 8 |
+
from .style import Style
|
| 9 |
+
|
| 10 |
+
# There are left-aligned characters for 1/8 to 7/8, but
|
| 11 |
+
# the right-aligned characters exist only for 1/8 and 4/8.
|
| 12 |
+
BEGIN_BLOCK_ELEMENTS = ["█", "█", "█", "▐", "▐", "▐", "▕", "▕"]
|
| 13 |
+
END_BLOCK_ELEMENTS = [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉"]
|
| 14 |
+
FULL_BLOCK = "█"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Bar(JupyterMixin):
|
| 18 |
+
"""Renders a solid block bar.
|
| 19 |
+
|
| 20 |
+
Args:
|
| 21 |
+
size (float): Value for the end of the bar.
|
| 22 |
+
begin (float): Begin point (between 0 and size, inclusive).
|
| 23 |
+
end (float): End point (between 0 and size, inclusive).
|
| 24 |
+
width (int, optional): Width of the bar, or ``None`` for maximum width. Defaults to None.
|
| 25 |
+
color (Union[Color, str], optional): Color of the bar. Defaults to "default".
|
| 26 |
+
bgcolor (Union[Color, str], optional): Color of bar background. Defaults to "default".
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
def __init__(
|
| 30 |
+
self,
|
| 31 |
+
size: float,
|
| 32 |
+
begin: float,
|
| 33 |
+
end: float,
|
| 34 |
+
*,
|
| 35 |
+
width: Optional[int] = None,
|
| 36 |
+
color: Union[Color, str] = "default",
|
| 37 |
+
bgcolor: Union[Color, str] = "default",
|
| 38 |
+
):
|
| 39 |
+
self.size = size
|
| 40 |
+
self.begin = max(begin, 0)
|
| 41 |
+
self.end = min(end, size)
|
| 42 |
+
self.width = width
|
| 43 |
+
self.style = Style(color=color, bgcolor=bgcolor)
|
| 44 |
+
|
| 45 |
+
def __repr__(self) -> str:
|
| 46 |
+
return f"Bar({self.size}, {self.begin}, {self.end})"
|
| 47 |
+
|
| 48 |
+
def __rich_console__(
|
| 49 |
+
self, console: Console, options: ConsoleOptions
|
| 50 |
+
) -> RenderResult:
|
| 51 |
+
|
| 52 |
+
width = min(
|
| 53 |
+
self.width if self.width is not None else options.max_width,
|
| 54 |
+
options.max_width,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
if self.begin >= self.end:
|
| 58 |
+
yield Segment(" " * width, self.style)
|
| 59 |
+
yield Segment.line()
|
| 60 |
+
return
|
| 61 |
+
|
| 62 |
+
prefix_complete_eights = int(width * 8 * self.begin / self.size)
|
| 63 |
+
prefix_bar_count = prefix_complete_eights // 8
|
| 64 |
+
prefix_eights_count = prefix_complete_eights % 8
|
| 65 |
+
|
| 66 |
+
body_complete_eights = int(width * 8 * self.end / self.size)
|
| 67 |
+
body_bar_count = body_complete_eights // 8
|
| 68 |
+
body_eights_count = body_complete_eights % 8
|
| 69 |
+
|
| 70 |
+
# When start and end fall into the same cell, we ideally should render
|
| 71 |
+
# a symbol that's "center-aligned", but there is no good symbol in Unicode.
|
| 72 |
+
# In this case, we fall back to right-aligned block symbol for simplicity.
|
| 73 |
+
|
| 74 |
+
prefix = " " * prefix_bar_count
|
| 75 |
+
if prefix_eights_count:
|
| 76 |
+
prefix += BEGIN_BLOCK_ELEMENTS[prefix_eights_count]
|
| 77 |
+
|
| 78 |
+
body = FULL_BLOCK * body_bar_count
|
| 79 |
+
if body_eights_count:
|
| 80 |
+
body += END_BLOCK_ELEMENTS[body_eights_count]
|
| 81 |
+
|
| 82 |
+
suffix = " " * (width - len(body))
|
| 83 |
+
|
| 84 |
+
yield Segment(prefix + body[len(prefix) :] + suffix, self.style)
|
| 85 |
+
yield Segment.line()
|
| 86 |
+
|
| 87 |
+
def __rich_measure__(
|
| 88 |
+
self, console: Console, options: ConsoleOptions
|
| 89 |
+
) -> Measurement:
|
| 90 |
+
return (
|
| 91 |
+
Measurement(self.width, self.width)
|
| 92 |
+
if self.width is not None
|
| 93 |
+
else Measurement(4, options.max_width)
|
| 94 |
+
)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/box.py
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import TYPE_CHECKING, Iterable, List
|
| 3 |
+
|
| 4 |
+
if sys.version_info >= (3, 8):
|
| 5 |
+
from typing import Literal
|
| 6 |
+
else:
|
| 7 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from ._loop import loop_last
|
| 11 |
+
|
| 12 |
+
if TYPE_CHECKING:
|
| 13 |
+
from pip._vendor.rich.console import ConsoleOptions
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class Box:
|
| 17 |
+
"""Defines characters to render boxes.
|
| 18 |
+
|
| 19 |
+
┌─┬┐ top
|
| 20 |
+
│ ││ head
|
| 21 |
+
├─┼┤ head_row
|
| 22 |
+
│ ││ mid
|
| 23 |
+
├─┼┤ row
|
| 24 |
+
├─┼┤ foot_row
|
| 25 |
+
│ ││ foot
|
| 26 |
+
└─┴┘ bottom
|
| 27 |
+
|
| 28 |
+
Args:
|
| 29 |
+
box (str): Characters making up box.
|
| 30 |
+
ascii (bool, optional): True if this box uses ascii characters only. Default is False.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
def __init__(self, box: str, *, ascii: bool = False) -> None:
|
| 34 |
+
self._box = box
|
| 35 |
+
self.ascii = ascii
|
| 36 |
+
line1, line2, line3, line4, line5, line6, line7, line8 = box.splitlines()
|
| 37 |
+
# top
|
| 38 |
+
self.top_left, self.top, self.top_divider, self.top_right = iter(line1)
|
| 39 |
+
# head
|
| 40 |
+
self.head_left, _, self.head_vertical, self.head_right = iter(line2)
|
| 41 |
+
# head_row
|
| 42 |
+
(
|
| 43 |
+
self.head_row_left,
|
| 44 |
+
self.head_row_horizontal,
|
| 45 |
+
self.head_row_cross,
|
| 46 |
+
self.head_row_right,
|
| 47 |
+
) = iter(line3)
|
| 48 |
+
|
| 49 |
+
# mid
|
| 50 |
+
self.mid_left, _, self.mid_vertical, self.mid_right = iter(line4)
|
| 51 |
+
# row
|
| 52 |
+
self.row_left, self.row_horizontal, self.row_cross, self.row_right = iter(line5)
|
| 53 |
+
# foot_row
|
| 54 |
+
(
|
| 55 |
+
self.foot_row_left,
|
| 56 |
+
self.foot_row_horizontal,
|
| 57 |
+
self.foot_row_cross,
|
| 58 |
+
self.foot_row_right,
|
| 59 |
+
) = iter(line6)
|
| 60 |
+
# foot
|
| 61 |
+
self.foot_left, _, self.foot_vertical, self.foot_right = iter(line7)
|
| 62 |
+
# bottom
|
| 63 |
+
self.bottom_left, self.bottom, self.bottom_divider, self.bottom_right = iter(
|
| 64 |
+
line8
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
def __repr__(self) -> str:
|
| 68 |
+
return "Box(...)"
|
| 69 |
+
|
| 70 |
+
def __str__(self) -> str:
|
| 71 |
+
return self._box
|
| 72 |
+
|
| 73 |
+
def substitute(self, options: "ConsoleOptions", safe: bool = True) -> "Box":
|
| 74 |
+
"""Substitute this box for another if it won't render due to platform issues.
|
| 75 |
+
|
| 76 |
+
Args:
|
| 77 |
+
options (ConsoleOptions): Console options used in rendering.
|
| 78 |
+
safe (bool, optional): Substitute this for another Box if there are known problems
|
| 79 |
+
displaying on the platform (currently only relevant on Windows). Default is True.
|
| 80 |
+
|
| 81 |
+
Returns:
|
| 82 |
+
Box: A different Box or the same Box.
|
| 83 |
+
"""
|
| 84 |
+
box = self
|
| 85 |
+
if options.legacy_windows and safe:
|
| 86 |
+
box = LEGACY_WINDOWS_SUBSTITUTIONS.get(box, box)
|
| 87 |
+
if options.ascii_only and not box.ascii:
|
| 88 |
+
box = ASCII
|
| 89 |
+
return box
|
| 90 |
+
|
| 91 |
+
def get_plain_headed_box(self) -> "Box":
|
| 92 |
+
"""If this box uses special characters for the borders of the header, then
|
| 93 |
+
return the equivalent box that does not.
|
| 94 |
+
|
| 95 |
+
Returns:
|
| 96 |
+
Box: The most similar Box that doesn't use header-specific box characters.
|
| 97 |
+
If the current Box already satisfies this criterion, then it's returned.
|
| 98 |
+
"""
|
| 99 |
+
return PLAIN_HEADED_SUBSTITUTIONS.get(self, self)
|
| 100 |
+
|
| 101 |
+
def get_top(self, widths: Iterable[int]) -> str:
|
| 102 |
+
"""Get the top of a simple box.
|
| 103 |
+
|
| 104 |
+
Args:
|
| 105 |
+
widths (List[int]): Widths of columns.
|
| 106 |
+
|
| 107 |
+
Returns:
|
| 108 |
+
str: A string of box characters.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
parts: List[str] = []
|
| 112 |
+
append = parts.append
|
| 113 |
+
append(self.top_left)
|
| 114 |
+
for last, width in loop_last(widths):
|
| 115 |
+
append(self.top * width)
|
| 116 |
+
if not last:
|
| 117 |
+
append(self.top_divider)
|
| 118 |
+
append(self.top_right)
|
| 119 |
+
return "".join(parts)
|
| 120 |
+
|
| 121 |
+
def get_row(
|
| 122 |
+
self,
|
| 123 |
+
widths: Iterable[int],
|
| 124 |
+
level: Literal["head", "row", "foot", "mid"] = "row",
|
| 125 |
+
edge: bool = True,
|
| 126 |
+
) -> str:
|
| 127 |
+
"""Get the top of a simple box.
|
| 128 |
+
|
| 129 |
+
Args:
|
| 130 |
+
width (List[int]): Widths of columns.
|
| 131 |
+
|
| 132 |
+
Returns:
|
| 133 |
+
str: A string of box characters.
|
| 134 |
+
"""
|
| 135 |
+
if level == "head":
|
| 136 |
+
left = self.head_row_left
|
| 137 |
+
horizontal = self.head_row_horizontal
|
| 138 |
+
cross = self.head_row_cross
|
| 139 |
+
right = self.head_row_right
|
| 140 |
+
elif level == "row":
|
| 141 |
+
left = self.row_left
|
| 142 |
+
horizontal = self.row_horizontal
|
| 143 |
+
cross = self.row_cross
|
| 144 |
+
right = self.row_right
|
| 145 |
+
elif level == "mid":
|
| 146 |
+
left = self.mid_left
|
| 147 |
+
horizontal = " "
|
| 148 |
+
cross = self.mid_vertical
|
| 149 |
+
right = self.mid_right
|
| 150 |
+
elif level == "foot":
|
| 151 |
+
left = self.foot_row_left
|
| 152 |
+
horizontal = self.foot_row_horizontal
|
| 153 |
+
cross = self.foot_row_cross
|
| 154 |
+
right = self.foot_row_right
|
| 155 |
+
else:
|
| 156 |
+
raise ValueError("level must be 'head', 'row' or 'foot'")
|
| 157 |
+
|
| 158 |
+
parts: List[str] = []
|
| 159 |
+
append = parts.append
|
| 160 |
+
if edge:
|
| 161 |
+
append(left)
|
| 162 |
+
for last, width in loop_last(widths):
|
| 163 |
+
append(horizontal * width)
|
| 164 |
+
if not last:
|
| 165 |
+
append(cross)
|
| 166 |
+
if edge:
|
| 167 |
+
append(right)
|
| 168 |
+
return "".join(parts)
|
| 169 |
+
|
| 170 |
+
def get_bottom(self, widths: Iterable[int]) -> str:
|
| 171 |
+
"""Get the bottom of a simple box.
|
| 172 |
+
|
| 173 |
+
Args:
|
| 174 |
+
widths (List[int]): Widths of columns.
|
| 175 |
+
|
| 176 |
+
Returns:
|
| 177 |
+
str: A string of box characters.
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
parts: List[str] = []
|
| 181 |
+
append = parts.append
|
| 182 |
+
append(self.bottom_left)
|
| 183 |
+
for last, width in loop_last(widths):
|
| 184 |
+
append(self.bottom * width)
|
| 185 |
+
if not last:
|
| 186 |
+
append(self.bottom_divider)
|
| 187 |
+
append(self.bottom_right)
|
| 188 |
+
return "".join(parts)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
ASCII: Box = Box(
|
| 192 |
+
"""\
|
| 193 |
+
+--+
|
| 194 |
+
| ||
|
| 195 |
+
|-+|
|
| 196 |
+
| ||
|
| 197 |
+
|-+|
|
| 198 |
+
|-+|
|
| 199 |
+
| ||
|
| 200 |
+
+--+
|
| 201 |
+
""",
|
| 202 |
+
ascii=True,
|
| 203 |
+
)
|
| 204 |
+
|
| 205 |
+
ASCII2: Box = Box(
|
| 206 |
+
"""\
|
| 207 |
+
+-++
|
| 208 |
+
| ||
|
| 209 |
+
+-++
|
| 210 |
+
| ||
|
| 211 |
+
+-++
|
| 212 |
+
+-++
|
| 213 |
+
| ||
|
| 214 |
+
+-++
|
| 215 |
+
""",
|
| 216 |
+
ascii=True,
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
ASCII_DOUBLE_HEAD: Box = Box(
|
| 220 |
+
"""\
|
| 221 |
+
+-++
|
| 222 |
+
| ||
|
| 223 |
+
+=++
|
| 224 |
+
| ||
|
| 225 |
+
+-++
|
| 226 |
+
+-++
|
| 227 |
+
| ||
|
| 228 |
+
+-++
|
| 229 |
+
""",
|
| 230 |
+
ascii=True,
|
| 231 |
+
)
|
| 232 |
+
|
| 233 |
+
SQUARE: Box = Box(
|
| 234 |
+
"""\
|
| 235 |
+
┌─┬┐
|
| 236 |
+
│ ││
|
| 237 |
+
├─┼┤
|
| 238 |
+
│ ││
|
| 239 |
+
├─┼┤
|
| 240 |
+
├─┼┤
|
| 241 |
+
│ ││
|
| 242 |
+
└─┴┘
|
| 243 |
+
"""
|
| 244 |
+
)
|
| 245 |
+
|
| 246 |
+
SQUARE_DOUBLE_HEAD: Box = Box(
|
| 247 |
+
"""\
|
| 248 |
+
┌─┬┐
|
| 249 |
+
│ ││
|
| 250 |
+
╞═╪╡
|
| 251 |
+
│ ││
|
| 252 |
+
├─┼┤
|
| 253 |
+
├─┼┤
|
| 254 |
+
│ ││
|
| 255 |
+
└─┴┘
|
| 256 |
+
"""
|
| 257 |
+
)
|
| 258 |
+
|
| 259 |
+
MINIMAL: Box = Box(
|
| 260 |
+
"""\
|
| 261 |
+
╷
|
| 262 |
+
│
|
| 263 |
+
╶─┼╴
|
| 264 |
+
│
|
| 265 |
+
╶─┼╴
|
| 266 |
+
╶─┼╴
|
| 267 |
+
│
|
| 268 |
+
╵
|
| 269 |
+
"""
|
| 270 |
+
)
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
MINIMAL_HEAVY_HEAD: Box = Box(
|
| 274 |
+
"""\
|
| 275 |
+
╷
|
| 276 |
+
│
|
| 277 |
+
╺━┿╸
|
| 278 |
+
│
|
| 279 |
+
╶─┼╴
|
| 280 |
+
╶─┼╴
|
| 281 |
+
│
|
| 282 |
+
╵
|
| 283 |
+
"""
|
| 284 |
+
)
|
| 285 |
+
|
| 286 |
+
MINIMAL_DOUBLE_HEAD: Box = Box(
|
| 287 |
+
"""\
|
| 288 |
+
╷
|
| 289 |
+
│
|
| 290 |
+
═╪
|
| 291 |
+
│
|
| 292 |
+
─┼
|
| 293 |
+
─┼
|
| 294 |
+
│
|
| 295 |
+
╵
|
| 296 |
+
"""
|
| 297 |
+
)
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
SIMPLE: Box = Box(
|
| 301 |
+
"""\
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
──
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
──
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
"""
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
SIMPLE_HEAD: Box = Box(
|
| 314 |
+
"""\
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
──
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
"""
|
| 324 |
+
)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
SIMPLE_HEAVY: Box = Box(
|
| 328 |
+
"""\
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
━━
|
| 332 |
+
|
| 333 |
+
|
| 334 |
+
━━
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
"""
|
| 338 |
+
)
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
HORIZONTALS: Box = Box(
|
| 342 |
+
"""\
|
| 343 |
+
──
|
| 344 |
+
|
| 345 |
+
──
|
| 346 |
+
|
| 347 |
+
──
|
| 348 |
+
──
|
| 349 |
+
|
| 350 |
+
──
|
| 351 |
+
"""
|
| 352 |
+
)
|
| 353 |
+
|
| 354 |
+
ROUNDED: Box = Box(
|
| 355 |
+
"""\
|
| 356 |
+
╭─┬╮
|
| 357 |
+
│ ││
|
| 358 |
+
├─┼┤
|
| 359 |
+
│ ││
|
| 360 |
+
├─┼┤
|
| 361 |
+
├─┼┤
|
| 362 |
+
│ ││
|
| 363 |
+
╰─┴╯
|
| 364 |
+
"""
|
| 365 |
+
)
|
| 366 |
+
|
| 367 |
+
HEAVY: Box = Box(
|
| 368 |
+
"""\
|
| 369 |
+
┏━┳┓
|
| 370 |
+
┃ ┃┃
|
| 371 |
+
┣━╋┫
|
| 372 |
+
┃ ┃┃
|
| 373 |
+
┣━╋┫
|
| 374 |
+
┣━╋┫
|
| 375 |
+
┃ ┃┃
|
| 376 |
+
┗━┻┛
|
| 377 |
+
"""
|
| 378 |
+
)
|
| 379 |
+
|
| 380 |
+
HEAVY_EDGE: Box = Box(
|
| 381 |
+
"""\
|
| 382 |
+
┏━┯┓
|
| 383 |
+
┃ │┃
|
| 384 |
+
┠─┼┨
|
| 385 |
+
┃ │┃
|
| 386 |
+
┠─┼┨
|
| 387 |
+
┠─┼┨
|
| 388 |
+
┃ │┃
|
| 389 |
+
┗━┷┛
|
| 390 |
+
"""
|
| 391 |
+
)
|
| 392 |
+
|
| 393 |
+
HEAVY_HEAD: Box = Box(
|
| 394 |
+
"""\
|
| 395 |
+
┏━┳┓
|
| 396 |
+
┃ ┃┃
|
| 397 |
+
┡━╇┩
|
| 398 |
+
│ ││
|
| 399 |
+
├─┼┤
|
| 400 |
+
├─┼┤
|
| 401 |
+
│ ││
|
| 402 |
+
└─┴┘
|
| 403 |
+
"""
|
| 404 |
+
)
|
| 405 |
+
|
| 406 |
+
DOUBLE: Box = Box(
|
| 407 |
+
"""\
|
| 408 |
+
╔═╦╗
|
| 409 |
+
║ ║║
|
| 410 |
+
╠═╬╣
|
| 411 |
+
║ ║║
|
| 412 |
+
╠═╬╣
|
| 413 |
+
╠═╬╣
|
| 414 |
+
║ ║║
|
| 415 |
+
╚═╩╝
|
| 416 |
+
"""
|
| 417 |
+
)
|
| 418 |
+
|
| 419 |
+
DOUBLE_EDGE: Box = Box(
|
| 420 |
+
"""\
|
| 421 |
+
╔═╤╗
|
| 422 |
+
║ │║
|
| 423 |
+
╟─┼╢
|
| 424 |
+
║ │║
|
| 425 |
+
╟─┼╢
|
| 426 |
+
╟─┼╢
|
| 427 |
+
║ │║
|
| 428 |
+
╚═╧╝
|
| 429 |
+
"""
|
| 430 |
+
)
|
| 431 |
+
|
| 432 |
+
MARKDOWN: Box = Box(
|
| 433 |
+
"""\
|
| 434 |
+
|
| 435 |
+
| ||
|
| 436 |
+
|-||
|
| 437 |
+
| ||
|
| 438 |
+
|-||
|
| 439 |
+
|-||
|
| 440 |
+
| ||
|
| 441 |
+
|
| 442 |
+
""",
|
| 443 |
+
ascii=True,
|
| 444 |
+
)
|
| 445 |
+
|
| 446 |
+
# Map Boxes that don't render with raster fonts on to equivalent that do
|
| 447 |
+
LEGACY_WINDOWS_SUBSTITUTIONS = {
|
| 448 |
+
ROUNDED: SQUARE,
|
| 449 |
+
MINIMAL_HEAVY_HEAD: MINIMAL,
|
| 450 |
+
SIMPLE_HEAVY: SIMPLE,
|
| 451 |
+
HEAVY: SQUARE,
|
| 452 |
+
HEAVY_EDGE: SQUARE,
|
| 453 |
+
HEAVY_HEAD: SQUARE,
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
# Map headed boxes to their headerless equivalents
|
| 457 |
+
PLAIN_HEADED_SUBSTITUTIONS = {
|
| 458 |
+
HEAVY_HEAD: SQUARE,
|
| 459 |
+
SQUARE_DOUBLE_HEAD: SQUARE,
|
| 460 |
+
MINIMAL_DOUBLE_HEAD: MINIMAL,
|
| 461 |
+
MINIMAL_HEAVY_HEAD: MINIMAL,
|
| 462 |
+
ASCII_DOUBLE_HEAD: ASCII2,
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
|
| 466 |
+
if __name__ == "__main__": # pragma: no cover
|
| 467 |
+
|
| 468 |
+
from pip._vendor.rich.columns import Columns
|
| 469 |
+
from pip._vendor.rich.panel import Panel
|
| 470 |
+
|
| 471 |
+
from . import box as box
|
| 472 |
+
from .console import Console
|
| 473 |
+
from .table import Table
|
| 474 |
+
from .text import Text
|
| 475 |
+
|
| 476 |
+
console = Console(record=True)
|
| 477 |
+
|
| 478 |
+
BOXES = [
|
| 479 |
+
"ASCII",
|
| 480 |
+
"ASCII2",
|
| 481 |
+
"ASCII_DOUBLE_HEAD",
|
| 482 |
+
"SQUARE",
|
| 483 |
+
"SQUARE_DOUBLE_HEAD",
|
| 484 |
+
"MINIMAL",
|
| 485 |
+
"MINIMAL_HEAVY_HEAD",
|
| 486 |
+
"MINIMAL_DOUBLE_HEAD",
|
| 487 |
+
"SIMPLE",
|
| 488 |
+
"SIMPLE_HEAD",
|
| 489 |
+
"SIMPLE_HEAVY",
|
| 490 |
+
"HORIZONTALS",
|
| 491 |
+
"ROUNDED",
|
| 492 |
+
"HEAVY",
|
| 493 |
+
"HEAVY_EDGE",
|
| 494 |
+
"HEAVY_HEAD",
|
| 495 |
+
"DOUBLE",
|
| 496 |
+
"DOUBLE_EDGE",
|
| 497 |
+
"MARKDOWN",
|
| 498 |
+
]
|
| 499 |
+
|
| 500 |
+
console.print(Panel("[bold green]Box Constants", style="green"), justify="center")
|
| 501 |
+
console.print()
|
| 502 |
+
|
| 503 |
+
columns = Columns(expand=True, padding=2)
|
| 504 |
+
for box_name in sorted(BOXES):
|
| 505 |
+
table = Table(
|
| 506 |
+
show_footer=True, style="dim", border_style="not dim", expand=True
|
| 507 |
+
)
|
| 508 |
+
table.add_column("Header 1", "Footer 1")
|
| 509 |
+
table.add_column("Header 2", "Footer 2")
|
| 510 |
+
table.add_row("Cell", "Cell")
|
| 511 |
+
table.add_row("Cell", "Cell")
|
| 512 |
+
table.box = getattr(box, box_name)
|
| 513 |
+
table.title = Text(f"box.{box_name}", style="magenta")
|
| 514 |
+
columns.add_renderable(table)
|
| 515 |
+
console.print(columns)
|
| 516 |
+
|
| 517 |
+
# console.save_svg("box.svg")
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/cells.py
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from typing import Callable, List
|
| 4 |
+
|
| 5 |
+
from ._cell_widths import CELL_WIDTHS
|
| 6 |
+
|
| 7 |
+
# Regex to match sequence of the most common character ranges
|
| 8 |
+
_is_single_cell_widths = re.compile("^[\u0020-\u006f\u00a0\u02ff\u0370-\u0482]*$").match
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@lru_cache(4096)
|
| 12 |
+
def cached_cell_len(text: str) -> int:
|
| 13 |
+
"""Get the number of cells required to display text.
|
| 14 |
+
|
| 15 |
+
This method always caches, which may use up a lot of memory. It is recommended to use
|
| 16 |
+
`cell_len` over this method.
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
text (str): Text to display.
|
| 20 |
+
|
| 21 |
+
Returns:
|
| 22 |
+
int: Get the number of cells required to display text.
|
| 23 |
+
"""
|
| 24 |
+
_get_size = get_character_cell_size
|
| 25 |
+
total_size = sum(_get_size(character) for character in text)
|
| 26 |
+
return total_size
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def cell_len(text: str, _cell_len: Callable[[str], int] = cached_cell_len) -> int:
|
| 30 |
+
"""Get the number of cells required to display text.
|
| 31 |
+
|
| 32 |
+
Args:
|
| 33 |
+
text (str): Text to display.
|
| 34 |
+
|
| 35 |
+
Returns:
|
| 36 |
+
int: Get the number of cells required to display text.
|
| 37 |
+
"""
|
| 38 |
+
if len(text) < 512:
|
| 39 |
+
return _cell_len(text)
|
| 40 |
+
_get_size = get_character_cell_size
|
| 41 |
+
total_size = sum(_get_size(character) for character in text)
|
| 42 |
+
return total_size
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
@lru_cache(maxsize=4096)
|
| 46 |
+
def get_character_cell_size(character: str) -> int:
|
| 47 |
+
"""Get the cell size of a character.
|
| 48 |
+
|
| 49 |
+
Args:
|
| 50 |
+
character (str): A single character.
|
| 51 |
+
|
| 52 |
+
Returns:
|
| 53 |
+
int: Number of cells (0, 1 or 2) occupied by that character.
|
| 54 |
+
"""
|
| 55 |
+
return _get_codepoint_cell_size(ord(character))
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
@lru_cache(maxsize=4096)
|
| 59 |
+
def _get_codepoint_cell_size(codepoint: int) -> int:
|
| 60 |
+
"""Get the cell size of a character.
|
| 61 |
+
|
| 62 |
+
Args:
|
| 63 |
+
codepoint (int): Codepoint of a character.
|
| 64 |
+
|
| 65 |
+
Returns:
|
| 66 |
+
int: Number of cells (0, 1 or 2) occupied by that character.
|
| 67 |
+
"""
|
| 68 |
+
|
| 69 |
+
_table = CELL_WIDTHS
|
| 70 |
+
lower_bound = 0
|
| 71 |
+
upper_bound = len(_table) - 1
|
| 72 |
+
index = (lower_bound + upper_bound) // 2
|
| 73 |
+
while True:
|
| 74 |
+
start, end, width = _table[index]
|
| 75 |
+
if codepoint < start:
|
| 76 |
+
upper_bound = index - 1
|
| 77 |
+
elif codepoint > end:
|
| 78 |
+
lower_bound = index + 1
|
| 79 |
+
else:
|
| 80 |
+
return 0 if width == -1 else width
|
| 81 |
+
if upper_bound < lower_bound:
|
| 82 |
+
break
|
| 83 |
+
index = (lower_bound + upper_bound) // 2
|
| 84 |
+
return 1
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def set_cell_size(text: str, total: int) -> str:
|
| 88 |
+
"""Set the length of a string to fit within given number of cells."""
|
| 89 |
+
|
| 90 |
+
if _is_single_cell_widths(text):
|
| 91 |
+
size = len(text)
|
| 92 |
+
if size < total:
|
| 93 |
+
return text + " " * (total - size)
|
| 94 |
+
return text[:total]
|
| 95 |
+
|
| 96 |
+
if total <= 0:
|
| 97 |
+
return ""
|
| 98 |
+
cell_size = cell_len(text)
|
| 99 |
+
if cell_size == total:
|
| 100 |
+
return text
|
| 101 |
+
if cell_size < total:
|
| 102 |
+
return text + " " * (total - cell_size)
|
| 103 |
+
|
| 104 |
+
start = 0
|
| 105 |
+
end = len(text)
|
| 106 |
+
|
| 107 |
+
# Binary search until we find the right size
|
| 108 |
+
while True:
|
| 109 |
+
pos = (start + end) // 2
|
| 110 |
+
before = text[: pos + 1]
|
| 111 |
+
before_len = cell_len(before)
|
| 112 |
+
if before_len == total + 1 and cell_len(before[-1]) == 2:
|
| 113 |
+
return before[:-1] + " "
|
| 114 |
+
if before_len == total:
|
| 115 |
+
return before
|
| 116 |
+
if before_len > total:
|
| 117 |
+
end = pos
|
| 118 |
+
else:
|
| 119 |
+
start = pos
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
# TODO: This is inefficient
|
| 123 |
+
# TODO: This might not work with CWJ type characters
|
| 124 |
+
def chop_cells(text: str, max_size: int, position: int = 0) -> List[str]:
|
| 125 |
+
"""Break text in to equal (cell) length strings, returning the characters in reverse
|
| 126 |
+
order"""
|
| 127 |
+
_get_character_cell_size = get_character_cell_size
|
| 128 |
+
characters = [
|
| 129 |
+
(character, _get_character_cell_size(character)) for character in text
|
| 130 |
+
]
|
| 131 |
+
total_size = position
|
| 132 |
+
lines: List[List[str]] = [[]]
|
| 133 |
+
append = lines[-1].append
|
| 134 |
+
|
| 135 |
+
for character, size in reversed(characters):
|
| 136 |
+
if total_size + size > max_size:
|
| 137 |
+
lines.append([character])
|
| 138 |
+
append = lines[-1].append
|
| 139 |
+
total_size = size
|
| 140 |
+
else:
|
| 141 |
+
total_size += size
|
| 142 |
+
append(character)
|
| 143 |
+
|
| 144 |
+
return ["".join(line) for line in lines]
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
if __name__ == "__main__": # pragma: no cover
|
| 148 |
+
|
| 149 |
+
print(get_character_cell_size("😽"))
|
| 150 |
+
for line in chop_cells("""这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。""", 8):
|
| 151 |
+
print(line)
|
| 152 |
+
for n in range(80, 1, -1):
|
| 153 |
+
print(set_cell_size("""这是对亚洲语言支持的测试。面对模棱两可的想法,拒绝猜测的诱惑。""", n) + "|")
|
| 154 |
+
print("x" * n)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/color.py
ADDED
|
@@ -0,0 +1,622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
+
from colorsys import rgb_to_hls
|
| 4 |
+
from enum import IntEnum
|
| 5 |
+
from functools import lru_cache
|
| 6 |
+
from typing import TYPE_CHECKING, NamedTuple, Optional, Tuple
|
| 7 |
+
|
| 8 |
+
from ._palettes import EIGHT_BIT_PALETTE, STANDARD_PALETTE, WINDOWS_PALETTE
|
| 9 |
+
from .color_triplet import ColorTriplet
|
| 10 |
+
from .repr import Result, rich_repr
|
| 11 |
+
from .terminal_theme import DEFAULT_TERMINAL_THEME
|
| 12 |
+
|
| 13 |
+
if TYPE_CHECKING: # pragma: no cover
|
| 14 |
+
from .terminal_theme import TerminalTheme
|
| 15 |
+
from .text import Text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
WINDOWS = platform.system() == "Windows"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class ColorSystem(IntEnum):
|
| 22 |
+
"""One of the 3 color system supported by terminals."""
|
| 23 |
+
|
| 24 |
+
STANDARD = 1
|
| 25 |
+
EIGHT_BIT = 2
|
| 26 |
+
TRUECOLOR = 3
|
| 27 |
+
WINDOWS = 4
|
| 28 |
+
|
| 29 |
+
def __repr__(self) -> str:
|
| 30 |
+
return f"ColorSystem.{self.name}"
|
| 31 |
+
|
| 32 |
+
def __str__(self) -> str:
|
| 33 |
+
return repr(self)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class ColorType(IntEnum):
|
| 37 |
+
"""Type of color stored in Color class."""
|
| 38 |
+
|
| 39 |
+
DEFAULT = 0
|
| 40 |
+
STANDARD = 1
|
| 41 |
+
EIGHT_BIT = 2
|
| 42 |
+
TRUECOLOR = 3
|
| 43 |
+
WINDOWS = 4
|
| 44 |
+
|
| 45 |
+
def __repr__(self) -> str:
|
| 46 |
+
return f"ColorType.{self.name}"
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
ANSI_COLOR_NAMES = {
|
| 50 |
+
"black": 0,
|
| 51 |
+
"red": 1,
|
| 52 |
+
"green": 2,
|
| 53 |
+
"yellow": 3,
|
| 54 |
+
"blue": 4,
|
| 55 |
+
"magenta": 5,
|
| 56 |
+
"cyan": 6,
|
| 57 |
+
"white": 7,
|
| 58 |
+
"bright_black": 8,
|
| 59 |
+
"bright_red": 9,
|
| 60 |
+
"bright_green": 10,
|
| 61 |
+
"bright_yellow": 11,
|
| 62 |
+
"bright_blue": 12,
|
| 63 |
+
"bright_magenta": 13,
|
| 64 |
+
"bright_cyan": 14,
|
| 65 |
+
"bright_white": 15,
|
| 66 |
+
"grey0": 16,
|
| 67 |
+
"gray0": 16,
|
| 68 |
+
"navy_blue": 17,
|
| 69 |
+
"dark_blue": 18,
|
| 70 |
+
"blue3": 20,
|
| 71 |
+
"blue1": 21,
|
| 72 |
+
"dark_green": 22,
|
| 73 |
+
"deep_sky_blue4": 25,
|
| 74 |
+
"dodger_blue3": 26,
|
| 75 |
+
"dodger_blue2": 27,
|
| 76 |
+
"green4": 28,
|
| 77 |
+
"spring_green4": 29,
|
| 78 |
+
"turquoise4": 30,
|
| 79 |
+
"deep_sky_blue3": 32,
|
| 80 |
+
"dodger_blue1": 33,
|
| 81 |
+
"green3": 40,
|
| 82 |
+
"spring_green3": 41,
|
| 83 |
+
"dark_cyan": 36,
|
| 84 |
+
"light_sea_green": 37,
|
| 85 |
+
"deep_sky_blue2": 38,
|
| 86 |
+
"deep_sky_blue1": 39,
|
| 87 |
+
"spring_green2": 47,
|
| 88 |
+
"cyan3": 43,
|
| 89 |
+
"dark_turquoise": 44,
|
| 90 |
+
"turquoise2": 45,
|
| 91 |
+
"green1": 46,
|
| 92 |
+
"spring_green1": 48,
|
| 93 |
+
"medium_spring_green": 49,
|
| 94 |
+
"cyan2": 50,
|
| 95 |
+
"cyan1": 51,
|
| 96 |
+
"dark_red": 88,
|
| 97 |
+
"deep_pink4": 125,
|
| 98 |
+
"purple4": 55,
|
| 99 |
+
"purple3": 56,
|
| 100 |
+
"blue_violet": 57,
|
| 101 |
+
"orange4": 94,
|
| 102 |
+
"grey37": 59,
|
| 103 |
+
"gray37": 59,
|
| 104 |
+
"medium_purple4": 60,
|
| 105 |
+
"slate_blue3": 62,
|
| 106 |
+
"royal_blue1": 63,
|
| 107 |
+
"chartreuse4": 64,
|
| 108 |
+
"dark_sea_green4": 71,
|
| 109 |
+
"pale_turquoise4": 66,
|
| 110 |
+
"steel_blue": 67,
|
| 111 |
+
"steel_blue3": 68,
|
| 112 |
+
"cornflower_blue": 69,
|
| 113 |
+
"chartreuse3": 76,
|
| 114 |
+
"cadet_blue": 73,
|
| 115 |
+
"sky_blue3": 74,
|
| 116 |
+
"steel_blue1": 81,
|
| 117 |
+
"pale_green3": 114,
|
| 118 |
+
"sea_green3": 78,
|
| 119 |
+
"aquamarine3": 79,
|
| 120 |
+
"medium_turquoise": 80,
|
| 121 |
+
"chartreuse2": 112,
|
| 122 |
+
"sea_green2": 83,
|
| 123 |
+
"sea_green1": 85,
|
| 124 |
+
"aquamarine1": 122,
|
| 125 |
+
"dark_slate_gray2": 87,
|
| 126 |
+
"dark_magenta": 91,
|
| 127 |
+
"dark_violet": 128,
|
| 128 |
+
"purple": 129,
|
| 129 |
+
"light_pink4": 95,
|
| 130 |
+
"plum4": 96,
|
| 131 |
+
"medium_purple3": 98,
|
| 132 |
+
"slate_blue1": 99,
|
| 133 |
+
"yellow4": 106,
|
| 134 |
+
"wheat4": 101,
|
| 135 |
+
"grey53": 102,
|
| 136 |
+
"gray53": 102,
|
| 137 |
+
"light_slate_grey": 103,
|
| 138 |
+
"light_slate_gray": 103,
|
| 139 |
+
"medium_purple": 104,
|
| 140 |
+
"light_slate_blue": 105,
|
| 141 |
+
"dark_olive_green3": 149,
|
| 142 |
+
"dark_sea_green": 108,
|
| 143 |
+
"light_sky_blue3": 110,
|
| 144 |
+
"sky_blue2": 111,
|
| 145 |
+
"dark_sea_green3": 150,
|
| 146 |
+
"dark_slate_gray3": 116,
|
| 147 |
+
"sky_blue1": 117,
|
| 148 |
+
"chartreuse1": 118,
|
| 149 |
+
"light_green": 120,
|
| 150 |
+
"pale_green1": 156,
|
| 151 |
+
"dark_slate_gray1": 123,
|
| 152 |
+
"red3": 160,
|
| 153 |
+
"medium_violet_red": 126,
|
| 154 |
+
"magenta3": 164,
|
| 155 |
+
"dark_orange3": 166,
|
| 156 |
+
"indian_red": 167,
|
| 157 |
+
"hot_pink3": 168,
|
| 158 |
+
"medium_orchid3": 133,
|
| 159 |
+
"medium_orchid": 134,
|
| 160 |
+
"medium_purple2": 140,
|
| 161 |
+
"dark_goldenrod": 136,
|
| 162 |
+
"light_salmon3": 173,
|
| 163 |
+
"rosy_brown": 138,
|
| 164 |
+
"grey63": 139,
|
| 165 |
+
"gray63": 139,
|
| 166 |
+
"medium_purple1": 141,
|
| 167 |
+
"gold3": 178,
|
| 168 |
+
"dark_khaki": 143,
|
| 169 |
+
"navajo_white3": 144,
|
| 170 |
+
"grey69": 145,
|
| 171 |
+
"gray69": 145,
|
| 172 |
+
"light_steel_blue3": 146,
|
| 173 |
+
"light_steel_blue": 147,
|
| 174 |
+
"yellow3": 184,
|
| 175 |
+
"dark_sea_green2": 157,
|
| 176 |
+
"light_cyan3": 152,
|
| 177 |
+
"light_sky_blue1": 153,
|
| 178 |
+
"green_yellow": 154,
|
| 179 |
+
"dark_olive_green2": 155,
|
| 180 |
+
"dark_sea_green1": 193,
|
| 181 |
+
"pale_turquoise1": 159,
|
| 182 |
+
"deep_pink3": 162,
|
| 183 |
+
"magenta2": 200,
|
| 184 |
+
"hot_pink2": 169,
|
| 185 |
+
"orchid": 170,
|
| 186 |
+
"medium_orchid1": 207,
|
| 187 |
+
"orange3": 172,
|
| 188 |
+
"light_pink3": 174,
|
| 189 |
+
"pink3": 175,
|
| 190 |
+
"plum3": 176,
|
| 191 |
+
"violet": 177,
|
| 192 |
+
"light_goldenrod3": 179,
|
| 193 |
+
"tan": 180,
|
| 194 |
+
"misty_rose3": 181,
|
| 195 |
+
"thistle3": 182,
|
| 196 |
+
"plum2": 183,
|
| 197 |
+
"khaki3": 185,
|
| 198 |
+
"light_goldenrod2": 222,
|
| 199 |
+
"light_yellow3": 187,
|
| 200 |
+
"grey84": 188,
|
| 201 |
+
"gray84": 188,
|
| 202 |
+
"light_steel_blue1": 189,
|
| 203 |
+
"yellow2": 190,
|
| 204 |
+
"dark_olive_green1": 192,
|
| 205 |
+
"honeydew2": 194,
|
| 206 |
+
"light_cyan1": 195,
|
| 207 |
+
"red1": 196,
|
| 208 |
+
"deep_pink2": 197,
|
| 209 |
+
"deep_pink1": 199,
|
| 210 |
+
"magenta1": 201,
|
| 211 |
+
"orange_red1": 202,
|
| 212 |
+
"indian_red1": 204,
|
| 213 |
+
"hot_pink": 206,
|
| 214 |
+
"dark_orange": 208,
|
| 215 |
+
"salmon1": 209,
|
| 216 |
+
"light_coral": 210,
|
| 217 |
+
"pale_violet_red1": 211,
|
| 218 |
+
"orchid2": 212,
|
| 219 |
+
"orchid1": 213,
|
| 220 |
+
"orange1": 214,
|
| 221 |
+
"sandy_brown": 215,
|
| 222 |
+
"light_salmon1": 216,
|
| 223 |
+
"light_pink1": 217,
|
| 224 |
+
"pink1": 218,
|
| 225 |
+
"plum1": 219,
|
| 226 |
+
"gold1": 220,
|
| 227 |
+
"navajo_white1": 223,
|
| 228 |
+
"misty_rose1": 224,
|
| 229 |
+
"thistle1": 225,
|
| 230 |
+
"yellow1": 226,
|
| 231 |
+
"light_goldenrod1": 227,
|
| 232 |
+
"khaki1": 228,
|
| 233 |
+
"wheat1": 229,
|
| 234 |
+
"cornsilk1": 230,
|
| 235 |
+
"grey100": 231,
|
| 236 |
+
"gray100": 231,
|
| 237 |
+
"grey3": 232,
|
| 238 |
+
"gray3": 232,
|
| 239 |
+
"grey7": 233,
|
| 240 |
+
"gray7": 233,
|
| 241 |
+
"grey11": 234,
|
| 242 |
+
"gray11": 234,
|
| 243 |
+
"grey15": 235,
|
| 244 |
+
"gray15": 235,
|
| 245 |
+
"grey19": 236,
|
| 246 |
+
"gray19": 236,
|
| 247 |
+
"grey23": 237,
|
| 248 |
+
"gray23": 237,
|
| 249 |
+
"grey27": 238,
|
| 250 |
+
"gray27": 238,
|
| 251 |
+
"grey30": 239,
|
| 252 |
+
"gray30": 239,
|
| 253 |
+
"grey35": 240,
|
| 254 |
+
"gray35": 240,
|
| 255 |
+
"grey39": 241,
|
| 256 |
+
"gray39": 241,
|
| 257 |
+
"grey42": 242,
|
| 258 |
+
"gray42": 242,
|
| 259 |
+
"grey46": 243,
|
| 260 |
+
"gray46": 243,
|
| 261 |
+
"grey50": 244,
|
| 262 |
+
"gray50": 244,
|
| 263 |
+
"grey54": 245,
|
| 264 |
+
"gray54": 245,
|
| 265 |
+
"grey58": 246,
|
| 266 |
+
"gray58": 246,
|
| 267 |
+
"grey62": 247,
|
| 268 |
+
"gray62": 247,
|
| 269 |
+
"grey66": 248,
|
| 270 |
+
"gray66": 248,
|
| 271 |
+
"grey70": 249,
|
| 272 |
+
"gray70": 249,
|
| 273 |
+
"grey74": 250,
|
| 274 |
+
"gray74": 250,
|
| 275 |
+
"grey78": 251,
|
| 276 |
+
"gray78": 251,
|
| 277 |
+
"grey82": 252,
|
| 278 |
+
"gray82": 252,
|
| 279 |
+
"grey85": 253,
|
| 280 |
+
"gray85": 253,
|
| 281 |
+
"grey89": 254,
|
| 282 |
+
"gray89": 254,
|
| 283 |
+
"grey93": 255,
|
| 284 |
+
"gray93": 255,
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
class ColorParseError(Exception):
|
| 289 |
+
"""The color could not be parsed."""
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
RE_COLOR = re.compile(
|
| 293 |
+
r"""^
|
| 294 |
+
\#([0-9a-f]{6})$|
|
| 295 |
+
color\(([0-9]{1,3})\)$|
|
| 296 |
+
rgb\(([\d\s,]+)\)$
|
| 297 |
+
""",
|
| 298 |
+
re.VERBOSE,
|
| 299 |
+
)
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
@rich_repr
|
| 303 |
+
class Color(NamedTuple):
|
| 304 |
+
"""Terminal color definition."""
|
| 305 |
+
|
| 306 |
+
name: str
|
| 307 |
+
"""The name of the color (typically the input to Color.parse)."""
|
| 308 |
+
type: ColorType
|
| 309 |
+
"""The type of the color."""
|
| 310 |
+
number: Optional[int] = None
|
| 311 |
+
"""The color number, if a standard color, or None."""
|
| 312 |
+
triplet: Optional[ColorTriplet] = None
|
| 313 |
+
"""A triplet of color components, if an RGB color."""
|
| 314 |
+
|
| 315 |
+
def __rich__(self) -> "Text":
|
| 316 |
+
"""Displays the actual color if Rich printed."""
|
| 317 |
+
from .style import Style
|
| 318 |
+
from .text import Text
|
| 319 |
+
|
| 320 |
+
return Text.assemble(
|
| 321 |
+
f"<color {self.name!r} ({self.type.name.lower()})",
|
| 322 |
+
("⬤", Style(color=self)),
|
| 323 |
+
" >",
|
| 324 |
+
)
|
| 325 |
+
|
| 326 |
+
def __rich_repr__(self) -> Result:
|
| 327 |
+
yield self.name
|
| 328 |
+
yield self.type
|
| 329 |
+
yield "number", self.number, None
|
| 330 |
+
yield "triplet", self.triplet, None
|
| 331 |
+
|
| 332 |
+
@property
|
| 333 |
+
def system(self) -> ColorSystem:
|
| 334 |
+
"""Get the native color system for this color."""
|
| 335 |
+
if self.type == ColorType.DEFAULT:
|
| 336 |
+
return ColorSystem.STANDARD
|
| 337 |
+
return ColorSystem(int(self.type))
|
| 338 |
+
|
| 339 |
+
@property
|
| 340 |
+
def is_system_defined(self) -> bool:
|
| 341 |
+
"""Check if the color is ultimately defined by the system."""
|
| 342 |
+
return self.system not in (ColorSystem.EIGHT_BIT, ColorSystem.TRUECOLOR)
|
| 343 |
+
|
| 344 |
+
@property
|
| 345 |
+
def is_default(self) -> bool:
|
| 346 |
+
"""Check if the color is a default color."""
|
| 347 |
+
return self.type == ColorType.DEFAULT
|
| 348 |
+
|
| 349 |
+
def get_truecolor(
|
| 350 |
+
self, theme: Optional["TerminalTheme"] = None, foreground: bool = True
|
| 351 |
+
) -> ColorTriplet:
|
| 352 |
+
"""Get an equivalent color triplet for this color.
|
| 353 |
+
|
| 354 |
+
Args:
|
| 355 |
+
theme (TerminalTheme, optional): Optional terminal theme, or None to use default. Defaults to None.
|
| 356 |
+
foreground (bool, optional): True for a foreground color, or False for background. Defaults to True.
|
| 357 |
+
|
| 358 |
+
Returns:
|
| 359 |
+
ColorTriplet: A color triplet containing RGB components.
|
| 360 |
+
"""
|
| 361 |
+
|
| 362 |
+
if theme is None:
|
| 363 |
+
theme = DEFAULT_TERMINAL_THEME
|
| 364 |
+
if self.type == ColorType.TRUECOLOR:
|
| 365 |
+
assert self.triplet is not None
|
| 366 |
+
return self.triplet
|
| 367 |
+
elif self.type == ColorType.EIGHT_BIT:
|
| 368 |
+
assert self.number is not None
|
| 369 |
+
return EIGHT_BIT_PALETTE[self.number]
|
| 370 |
+
elif self.type == ColorType.STANDARD:
|
| 371 |
+
assert self.number is not None
|
| 372 |
+
return theme.ansi_colors[self.number]
|
| 373 |
+
elif self.type == ColorType.WINDOWS:
|
| 374 |
+
assert self.number is not None
|
| 375 |
+
return WINDOWS_PALETTE[self.number]
|
| 376 |
+
else: # self.type == ColorType.DEFAULT:
|
| 377 |
+
assert self.number is None
|
| 378 |
+
return theme.foreground_color if foreground else theme.background_color
|
| 379 |
+
|
| 380 |
+
@classmethod
|
| 381 |
+
def from_ansi(cls, number: int) -> "Color":
|
| 382 |
+
"""Create a Color number from it's 8-bit ansi number.
|
| 383 |
+
|
| 384 |
+
Args:
|
| 385 |
+
number (int): A number between 0-255 inclusive.
|
| 386 |
+
|
| 387 |
+
Returns:
|
| 388 |
+
Color: A new Color instance.
|
| 389 |
+
"""
|
| 390 |
+
return cls(
|
| 391 |
+
name=f"color({number})",
|
| 392 |
+
type=(ColorType.STANDARD if number < 16 else ColorType.EIGHT_BIT),
|
| 393 |
+
number=number,
|
| 394 |
+
)
|
| 395 |
+
|
| 396 |
+
@classmethod
|
| 397 |
+
def from_triplet(cls, triplet: "ColorTriplet") -> "Color":
|
| 398 |
+
"""Create a truecolor RGB color from a triplet of values.
|
| 399 |
+
|
| 400 |
+
Args:
|
| 401 |
+
triplet (ColorTriplet): A color triplet containing red, green and blue components.
|
| 402 |
+
|
| 403 |
+
Returns:
|
| 404 |
+
Color: A new color object.
|
| 405 |
+
"""
|
| 406 |
+
return cls(name=triplet.hex, type=ColorType.TRUECOLOR, triplet=triplet)
|
| 407 |
+
|
| 408 |
+
@classmethod
|
| 409 |
+
def from_rgb(cls, red: float, green: float, blue: float) -> "Color":
|
| 410 |
+
"""Create a truecolor from three color components in the range(0->255).
|
| 411 |
+
|
| 412 |
+
Args:
|
| 413 |
+
red (float): Red component in range 0-255.
|
| 414 |
+
green (float): Green component in range 0-255.
|
| 415 |
+
blue (float): Blue component in range 0-255.
|
| 416 |
+
|
| 417 |
+
Returns:
|
| 418 |
+
Color: A new color object.
|
| 419 |
+
"""
|
| 420 |
+
return cls.from_triplet(ColorTriplet(int(red), int(green), int(blue)))
|
| 421 |
+
|
| 422 |
+
@classmethod
|
| 423 |
+
def default(cls) -> "Color":
|
| 424 |
+
"""Get a Color instance representing the default color.
|
| 425 |
+
|
| 426 |
+
Returns:
|
| 427 |
+
Color: Default color.
|
| 428 |
+
"""
|
| 429 |
+
return cls(name="default", type=ColorType.DEFAULT)
|
| 430 |
+
|
| 431 |
+
@classmethod
|
| 432 |
+
@lru_cache(maxsize=1024)
|
| 433 |
+
def parse(cls, color: str) -> "Color":
|
| 434 |
+
"""Parse a color definition."""
|
| 435 |
+
original_color = color
|
| 436 |
+
color = color.lower().strip()
|
| 437 |
+
|
| 438 |
+
if color == "default":
|
| 439 |
+
return cls(color, type=ColorType.DEFAULT)
|
| 440 |
+
|
| 441 |
+
color_number = ANSI_COLOR_NAMES.get(color)
|
| 442 |
+
if color_number is not None:
|
| 443 |
+
return cls(
|
| 444 |
+
color,
|
| 445 |
+
type=(ColorType.STANDARD if color_number < 16 else ColorType.EIGHT_BIT),
|
| 446 |
+
number=color_number,
|
| 447 |
+
)
|
| 448 |
+
|
| 449 |
+
color_match = RE_COLOR.match(color)
|
| 450 |
+
if color_match is None:
|
| 451 |
+
raise ColorParseError(f"{original_color!r} is not a valid color")
|
| 452 |
+
|
| 453 |
+
color_24, color_8, color_rgb = color_match.groups()
|
| 454 |
+
if color_24:
|
| 455 |
+
triplet = ColorTriplet(
|
| 456 |
+
int(color_24[0:2], 16), int(color_24[2:4], 16), int(color_24[4:6], 16)
|
| 457 |
+
)
|
| 458 |
+
return cls(color, ColorType.TRUECOLOR, triplet=triplet)
|
| 459 |
+
|
| 460 |
+
elif color_8:
|
| 461 |
+
number = int(color_8)
|
| 462 |
+
if number > 255:
|
| 463 |
+
raise ColorParseError(f"color number must be <= 255 in {color!r}")
|
| 464 |
+
return cls(
|
| 465 |
+
color,
|
| 466 |
+
type=(ColorType.STANDARD if number < 16 else ColorType.EIGHT_BIT),
|
| 467 |
+
number=number,
|
| 468 |
+
)
|
| 469 |
+
|
| 470 |
+
else: # color_rgb:
|
| 471 |
+
components = color_rgb.split(",")
|
| 472 |
+
if len(components) != 3:
|
| 473 |
+
raise ColorParseError(
|
| 474 |
+
f"expected three components in {original_color!r}"
|
| 475 |
+
)
|
| 476 |
+
red, green, blue = components
|
| 477 |
+
triplet = ColorTriplet(int(red), int(green), int(blue))
|
| 478 |
+
if not all(component <= 255 for component in triplet):
|
| 479 |
+
raise ColorParseError(
|
| 480 |
+
f"color components must be <= 255 in {original_color!r}"
|
| 481 |
+
)
|
| 482 |
+
return cls(color, ColorType.TRUECOLOR, triplet=triplet)
|
| 483 |
+
|
| 484 |
+
@lru_cache(maxsize=1024)
|
| 485 |
+
def get_ansi_codes(self, foreground: bool = True) -> Tuple[str, ...]:
|
| 486 |
+
"""Get the ANSI escape codes for this color."""
|
| 487 |
+
_type = self.type
|
| 488 |
+
if _type == ColorType.DEFAULT:
|
| 489 |
+
return ("39" if foreground else "49",)
|
| 490 |
+
|
| 491 |
+
elif _type == ColorType.WINDOWS:
|
| 492 |
+
number = self.number
|
| 493 |
+
assert number is not None
|
| 494 |
+
fore, back = (30, 40) if number < 8 else (82, 92)
|
| 495 |
+
return (str(fore + number if foreground else back + number),)
|
| 496 |
+
|
| 497 |
+
elif _type == ColorType.STANDARD:
|
| 498 |
+
number = self.number
|
| 499 |
+
assert number is not None
|
| 500 |
+
fore, back = (30, 40) if number < 8 else (82, 92)
|
| 501 |
+
return (str(fore + number if foreground else back + number),)
|
| 502 |
+
|
| 503 |
+
elif _type == ColorType.EIGHT_BIT:
|
| 504 |
+
assert self.number is not None
|
| 505 |
+
return ("38" if foreground else "48", "5", str(self.number))
|
| 506 |
+
|
| 507 |
+
else: # self.standard == ColorStandard.TRUECOLOR:
|
| 508 |
+
assert self.triplet is not None
|
| 509 |
+
red, green, blue = self.triplet
|
| 510 |
+
return ("38" if foreground else "48", "2", str(red), str(green), str(blue))
|
| 511 |
+
|
| 512 |
+
@lru_cache(maxsize=1024)
|
| 513 |
+
def downgrade(self, system: ColorSystem) -> "Color":
|
| 514 |
+
"""Downgrade a color system to a system with fewer colors."""
|
| 515 |
+
|
| 516 |
+
if self.type in (ColorType.DEFAULT, system):
|
| 517 |
+
return self
|
| 518 |
+
# Convert to 8-bit color from truecolor color
|
| 519 |
+
if system == ColorSystem.EIGHT_BIT and self.system == ColorSystem.TRUECOLOR:
|
| 520 |
+
assert self.triplet is not None
|
| 521 |
+
_h, l, s = rgb_to_hls(*self.triplet.normalized)
|
| 522 |
+
# If saturation is under 15% assume it is grayscale
|
| 523 |
+
if s < 0.15:
|
| 524 |
+
gray = round(l * 25.0)
|
| 525 |
+
if gray == 0:
|
| 526 |
+
color_number = 16
|
| 527 |
+
elif gray == 25:
|
| 528 |
+
color_number = 231
|
| 529 |
+
else:
|
| 530 |
+
color_number = 231 + gray
|
| 531 |
+
return Color(self.name, ColorType.EIGHT_BIT, number=color_number)
|
| 532 |
+
|
| 533 |
+
red, green, blue = self.triplet
|
| 534 |
+
six_red = red / 95 if red < 95 else 1 + (red - 95) / 40
|
| 535 |
+
six_green = green / 95 if green < 95 else 1 + (green - 95) / 40
|
| 536 |
+
six_blue = blue / 95 if blue < 95 else 1 + (blue - 95) / 40
|
| 537 |
+
|
| 538 |
+
color_number = (
|
| 539 |
+
16 + 36 * round(six_red) + 6 * round(six_green) + round(six_blue)
|
| 540 |
+
)
|
| 541 |
+
return Color(self.name, ColorType.EIGHT_BIT, number=color_number)
|
| 542 |
+
|
| 543 |
+
# Convert to standard from truecolor or 8-bit
|
| 544 |
+
elif system == ColorSystem.STANDARD:
|
| 545 |
+
if self.system == ColorSystem.TRUECOLOR:
|
| 546 |
+
assert self.triplet is not None
|
| 547 |
+
triplet = self.triplet
|
| 548 |
+
else: # self.system == ColorSystem.EIGHT_BIT
|
| 549 |
+
assert self.number is not None
|
| 550 |
+
triplet = ColorTriplet(*EIGHT_BIT_PALETTE[self.number])
|
| 551 |
+
|
| 552 |
+
color_number = STANDARD_PALETTE.match(triplet)
|
| 553 |
+
return Color(self.name, ColorType.STANDARD, number=color_number)
|
| 554 |
+
|
| 555 |
+
elif system == ColorSystem.WINDOWS:
|
| 556 |
+
if self.system == ColorSystem.TRUECOLOR:
|
| 557 |
+
assert self.triplet is not None
|
| 558 |
+
triplet = self.triplet
|
| 559 |
+
else: # self.system == ColorSystem.EIGHT_BIT
|
| 560 |
+
assert self.number is not None
|
| 561 |
+
if self.number < 16:
|
| 562 |
+
return Color(self.name, ColorType.WINDOWS, number=self.number)
|
| 563 |
+
triplet = ColorTriplet(*EIGHT_BIT_PALETTE[self.number])
|
| 564 |
+
|
| 565 |
+
color_number = WINDOWS_PALETTE.match(triplet)
|
| 566 |
+
return Color(self.name, ColorType.WINDOWS, number=color_number)
|
| 567 |
+
|
| 568 |
+
return self
|
| 569 |
+
|
| 570 |
+
|
| 571 |
+
def parse_rgb_hex(hex_color: str) -> ColorTriplet:
|
| 572 |
+
"""Parse six hex characters in to RGB triplet."""
|
| 573 |
+
assert len(hex_color) == 6, "must be 6 characters"
|
| 574 |
+
color = ColorTriplet(
|
| 575 |
+
int(hex_color[0:2], 16), int(hex_color[2:4], 16), int(hex_color[4:6], 16)
|
| 576 |
+
)
|
| 577 |
+
return color
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
def blend_rgb(
|
| 581 |
+
color1: ColorTriplet, color2: ColorTriplet, cross_fade: float = 0.5
|
| 582 |
+
) -> ColorTriplet:
|
| 583 |
+
"""Blend one RGB color in to another."""
|
| 584 |
+
r1, g1, b1 = color1
|
| 585 |
+
r2, g2, b2 = color2
|
| 586 |
+
new_color = ColorTriplet(
|
| 587 |
+
int(r1 + (r2 - r1) * cross_fade),
|
| 588 |
+
int(g1 + (g2 - g1) * cross_fade),
|
| 589 |
+
int(b1 + (b2 - b1) * cross_fade),
|
| 590 |
+
)
|
| 591 |
+
return new_color
|
| 592 |
+
|
| 593 |
+
|
| 594 |
+
if __name__ == "__main__": # pragma: no cover
|
| 595 |
+
|
| 596 |
+
from .console import Console
|
| 597 |
+
from .table import Table
|
| 598 |
+
from .text import Text
|
| 599 |
+
|
| 600 |
+
console = Console()
|
| 601 |
+
|
| 602 |
+
table = Table(show_footer=False, show_edge=True)
|
| 603 |
+
table.add_column("Color", width=10, overflow="ellipsis")
|
| 604 |
+
table.add_column("Number", justify="right", style="yellow")
|
| 605 |
+
table.add_column("Name", style="green")
|
| 606 |
+
table.add_column("Hex", style="blue")
|
| 607 |
+
table.add_column("RGB", style="magenta")
|
| 608 |
+
|
| 609 |
+
colors = sorted((v, k) for k, v in ANSI_COLOR_NAMES.items())
|
| 610 |
+
for color_number, name in colors:
|
| 611 |
+
if "grey" in name:
|
| 612 |
+
continue
|
| 613 |
+
color_cell = Text(" " * 10, style=f"on {name}")
|
| 614 |
+
if color_number < 16:
|
| 615 |
+
table.add_row(color_cell, f"{color_number}", Text(f'"{name}"'))
|
| 616 |
+
else:
|
| 617 |
+
color = EIGHT_BIT_PALETTE[color_number] # type: ignore[has-type]
|
| 618 |
+
table.add_row(
|
| 619 |
+
color_cell, str(color_number), Text(f'"{name}"'), color.hex, color.rgb
|
| 620 |
+
)
|
| 621 |
+
|
| 622 |
+
console.print(table)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/color_triplet.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import NamedTuple, Tuple
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class ColorTriplet(NamedTuple):
|
| 5 |
+
"""The red, green, and blue components of a color."""
|
| 6 |
+
|
| 7 |
+
red: int
|
| 8 |
+
"""Red component in 0 to 255 range."""
|
| 9 |
+
green: int
|
| 10 |
+
"""Green component in 0 to 255 range."""
|
| 11 |
+
blue: int
|
| 12 |
+
"""Blue component in 0 to 255 range."""
|
| 13 |
+
|
| 14 |
+
@property
|
| 15 |
+
def hex(self) -> str:
|
| 16 |
+
"""get the color triplet in CSS style."""
|
| 17 |
+
red, green, blue = self
|
| 18 |
+
return f"#{red:02x}{green:02x}{blue:02x}"
|
| 19 |
+
|
| 20 |
+
@property
|
| 21 |
+
def rgb(self) -> str:
|
| 22 |
+
"""The color in RGB format.
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
str: An rgb color, e.g. ``"rgb(100,23,255)"``.
|
| 26 |
+
"""
|
| 27 |
+
red, green, blue = self
|
| 28 |
+
return f"rgb({red},{green},{blue})"
|
| 29 |
+
|
| 30 |
+
@property
|
| 31 |
+
def normalized(self) -> Tuple[float, float, float]:
|
| 32 |
+
"""Convert components into floats between 0 and 1.
|
| 33 |
+
|
| 34 |
+
Returns:
|
| 35 |
+
Tuple[float, float, float]: A tuple of three normal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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import defaultdict
|
| 2 |
+
from itertools import chain
|
| 3 |
+
from operator import itemgetter
|
| 4 |
+
from typing import Dict, Iterable, List, Optional, Tuple
|
| 5 |
+
|
| 6 |
+
from .align import Align, AlignMethod
|
| 7 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 8 |
+
from .constrain import Constrain
|
| 9 |
+
from .measure import Measurement
|
| 10 |
+
from .padding import Padding, PaddingDimensions
|
| 11 |
+
from .table import Table
|
| 12 |
+
from .text import TextType
|
| 13 |
+
from .jupyter import JupyterMixin
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class Columns(JupyterMixin):
|
| 17 |
+
"""Display renderables in neat columns.
|
| 18 |
+
|
| 19 |
+
Args:
|
| 20 |
+
renderables (Iterable[RenderableType]): Any number of Rich renderables (including str).
|
| 21 |
+
width (int, optional): The desired width of the columns, or None to auto detect. Defaults to None.
|
| 22 |
+
padding (PaddingDimensions, optional): Optional padding around cells. Defaults to (0, 1).
|
| 23 |
+
expand (bool, optional): Expand columns to full width. Defaults to False.
|
| 24 |
+
equal (bool, optional): Arrange in to equal sized columns. Defaults to False.
|
| 25 |
+
column_first (bool, optional): Align items from top to bottom (rather than left to right). Defaults to False.
|
| 26 |
+
right_to_left (bool, optional): Start column from right hand side. Defaults to False.
|
| 27 |
+
align (str, optional): Align value ("left", "right", or "center") or None for default. Defaults to None.
|
| 28 |
+
title (TextType, optional): Optional title for Columns.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
def __init__(
|
| 32 |
+
self,
|
| 33 |
+
renderables: Optional[Iterable[RenderableType]] = None,
|
| 34 |
+
padding: PaddingDimensions = (0, 1),
|
| 35 |
+
*,
|
| 36 |
+
width: Optional[int] = None,
|
| 37 |
+
expand: bool = False,
|
| 38 |
+
equal: bool = False,
|
| 39 |
+
column_first: bool = False,
|
| 40 |
+
right_to_left: bool = False,
|
| 41 |
+
align: Optional[AlignMethod] = None,
|
| 42 |
+
title: Optional[TextType] = None,
|
| 43 |
+
) -> None:
|
| 44 |
+
self.renderables = list(renderables or [])
|
| 45 |
+
self.width = width
|
| 46 |
+
self.padding = padding
|
| 47 |
+
self.expand = expand
|
| 48 |
+
self.equal = equal
|
| 49 |
+
self.column_first = column_first
|
| 50 |
+
self.right_to_left = right_to_left
|
| 51 |
+
self.align: Optional[AlignMethod] = align
|
| 52 |
+
self.title = title
|
| 53 |
+
|
| 54 |
+
def add_renderable(self, renderable: RenderableType) -> None:
|
| 55 |
+
"""Add a renderable to the columns.
|
| 56 |
+
|
| 57 |
+
Args:
|
| 58 |
+
renderable (RenderableType): Any renderable object.
|
| 59 |
+
"""
|
| 60 |
+
self.renderables.append(renderable)
|
| 61 |
+
|
| 62 |
+
def __rich_console__(
|
| 63 |
+
self, console: Console, options: ConsoleOptions
|
| 64 |
+
) -> RenderResult:
|
| 65 |
+
render_str = console.render_str
|
| 66 |
+
renderables = [
|
| 67 |
+
render_str(renderable) if isinstance(renderable, str) else renderable
|
| 68 |
+
for renderable in self.renderables
|
| 69 |
+
]
|
| 70 |
+
if not renderables:
|
| 71 |
+
return
|
| 72 |
+
_top, right, _bottom, left = Padding.unpack(self.padding)
|
| 73 |
+
width_padding = max(left, right)
|
| 74 |
+
max_width = options.max_width
|
| 75 |
+
widths: Dict[int, int] = defaultdict(int)
|
| 76 |
+
column_count = len(renderables)
|
| 77 |
+
|
| 78 |
+
get_measurement = Measurement.get
|
| 79 |
+
renderable_widths = [
|
| 80 |
+
get_measurement(console, options, renderable).maximum
|
| 81 |
+
for renderable in renderables
|
| 82 |
+
]
|
| 83 |
+
if self.equal:
|
| 84 |
+
renderable_widths = [max(renderable_widths)] * len(renderable_widths)
|
| 85 |
+
|
| 86 |
+
def iter_renderables(
|
| 87 |
+
column_count: int,
|
| 88 |
+
) -> Iterable[Tuple[int, Optional[RenderableType]]]:
|
| 89 |
+
item_count = len(renderables)
|
| 90 |
+
if self.column_first:
|
| 91 |
+
width_renderables = list(zip(renderable_widths, renderables))
|
| 92 |
+
|
| 93 |
+
column_lengths: List[int] = [item_count // column_count] * column_count
|
| 94 |
+
for col_no in range(item_count % column_count):
|
| 95 |
+
column_lengths[col_no] += 1
|
| 96 |
+
|
| 97 |
+
row_count = (item_count + column_count - 1) // column_count
|
| 98 |
+
cells = [[-1] * column_count for _ in range(row_count)]
|
| 99 |
+
row = col = 0
|
| 100 |
+
for index in range(item_count):
|
| 101 |
+
cells[row][col] = index
|
| 102 |
+
column_lengths[col] -= 1
|
| 103 |
+
if column_lengths[col]:
|
| 104 |
+
row += 1
|
| 105 |
+
else:
|
| 106 |
+
col += 1
|
| 107 |
+
row = 0
|
| 108 |
+
for index in chain.from_iterable(cells):
|
| 109 |
+
if index == -1:
|
| 110 |
+
break
|
| 111 |
+
yield width_renderables[index]
|
| 112 |
+
else:
|
| 113 |
+
yield from zip(renderable_widths, renderables)
|
| 114 |
+
# Pad odd elements with spaces
|
| 115 |
+
if item_count % column_count:
|
| 116 |
+
for _ in range(column_count - (item_count % column_count)):
|
| 117 |
+
yield 0, None
|
| 118 |
+
|
| 119 |
+
table = Table.grid(padding=self.padding, collapse_padding=True, pad_edge=False)
|
| 120 |
+
table.expand = self.expand
|
| 121 |
+
table.title = self.title
|
| 122 |
+
|
| 123 |
+
if self.width is not None:
|
| 124 |
+
column_count = (max_width) // (self.width + width_padding)
|
| 125 |
+
for _ in range(column_count):
|
| 126 |
+
table.add_column(width=self.width)
|
| 127 |
+
else:
|
| 128 |
+
while column_count > 1:
|
| 129 |
+
widths.clear()
|
| 130 |
+
column_no = 0
|
| 131 |
+
for renderable_width, _ in iter_renderables(column_count):
|
| 132 |
+
widths[column_no] = max(widths[column_no], renderable_width)
|
| 133 |
+
total_width = sum(widths.values()) + width_padding * (
|
| 134 |
+
len(widths) - 1
|
| 135 |
+
)
|
| 136 |
+
if total_width > max_width:
|
| 137 |
+
column_count = len(widths) - 1
|
| 138 |
+
break
|
| 139 |
+
else:
|
| 140 |
+
column_no = (column_no + 1) % column_count
|
| 141 |
+
else:
|
| 142 |
+
break
|
| 143 |
+
|
| 144 |
+
get_renderable = itemgetter(1)
|
| 145 |
+
_renderables = [
|
| 146 |
+
get_renderable(_renderable)
|
| 147 |
+
for _renderable in iter_renderables(column_count)
|
| 148 |
+
]
|
| 149 |
+
if self.equal:
|
| 150 |
+
_renderables = [
|
| 151 |
+
None
|
| 152 |
+
if renderable is None
|
| 153 |
+
else Constrain(renderable, renderable_widths[0])
|
| 154 |
+
for renderable in _renderables
|
| 155 |
+
]
|
| 156 |
+
if self.align:
|
| 157 |
+
align = self.align
|
| 158 |
+
_Align = Align
|
| 159 |
+
_renderables = [
|
| 160 |
+
None if renderable is None else _Align(renderable, align)
|
| 161 |
+
for renderable in _renderables
|
| 162 |
+
]
|
| 163 |
+
|
| 164 |
+
right_to_left = self.right_to_left
|
| 165 |
+
add_row = table.add_row
|
| 166 |
+
for start in range(0, len(_renderables), column_count):
|
| 167 |
+
row = _renderables[start : start + column_count]
|
| 168 |
+
if right_to_left:
|
| 169 |
+
row = row[::-1]
|
| 170 |
+
add_row(*row)
|
| 171 |
+
yield table
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
if __name__ == "__main__": # pragma: no cover
|
| 175 |
+
import os
|
| 176 |
+
|
| 177 |
+
console = Console()
|
| 178 |
+
|
| 179 |
+
files = [f"{i} {s}" for i, s in enumerate(sorted(os.listdir()))]
|
| 180 |
+
columns = Columns(files, padding=(0, 1), expand=False, equal=False)
|
| 181 |
+
console.print(columns)
|
| 182 |
+
console.rule()
|
| 183 |
+
columns.column_first = True
|
| 184 |
+
console.print(columns)
|
| 185 |
+
columns.right_to_left = True
|
| 186 |
+
console.rule()
|
| 187 |
+
console.print(columns)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/console.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/constrain.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional, TYPE_CHECKING
|
| 2 |
+
|
| 3 |
+
from .jupyter import JupyterMixin
|
| 4 |
+
from .measure import Measurement
|
| 5 |
+
|
| 6 |
+
if TYPE_CHECKING:
|
| 7 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class Constrain(JupyterMixin):
|
| 11 |
+
"""Constrain the width of a renderable to a given number of characters.
|
| 12 |
+
|
| 13 |
+
Args:
|
| 14 |
+
renderable (RenderableType): A renderable object.
|
| 15 |
+
width (int, optional): The maximum width (in characters) to render. Defaults to 80.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
def __init__(self, renderable: "RenderableType", width: Optional[int] = 80) -> None:
|
| 19 |
+
self.renderable = renderable
|
| 20 |
+
self.width = width
|
| 21 |
+
|
| 22 |
+
def __rich_console__(
|
| 23 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 24 |
+
) -> "RenderResult":
|
| 25 |
+
if self.width is None:
|
| 26 |
+
yield self.renderable
|
| 27 |
+
else:
|
| 28 |
+
child_options = options.update_width(min(self.width, options.max_width))
|
| 29 |
+
yield from console.render(self.renderable, child_options)
|
| 30 |
+
|
| 31 |
+
def __rich_measure__(
|
| 32 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 33 |
+
) -> "Measurement":
|
| 34 |
+
if self.width is not None:
|
| 35 |
+
options = options.update_width(self.width)
|
| 36 |
+
measurement = Measurement.get(console, options, self.renderable)
|
| 37 |
+
return measurement
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/containers.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from itertools import zip_longest
|
| 2 |
+
from typing import (
|
| 3 |
+
Iterator,
|
| 4 |
+
Iterable,
|
| 5 |
+
List,
|
| 6 |
+
Optional,
|
| 7 |
+
Union,
|
| 8 |
+
overload,
|
| 9 |
+
TypeVar,
|
| 10 |
+
TYPE_CHECKING,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
if TYPE_CHECKING:
|
| 14 |
+
from .console import (
|
| 15 |
+
Console,
|
| 16 |
+
ConsoleOptions,
|
| 17 |
+
JustifyMethod,
|
| 18 |
+
OverflowMethod,
|
| 19 |
+
RenderResult,
|
| 20 |
+
RenderableType,
|
| 21 |
+
)
|
| 22 |
+
from .text import Text
|
| 23 |
+
|
| 24 |
+
from .cells import cell_len
|
| 25 |
+
from .measure import Measurement
|
| 26 |
+
|
| 27 |
+
T = TypeVar("T")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class Renderables:
|
| 31 |
+
"""A list subclass which renders its contents to the console."""
|
| 32 |
+
|
| 33 |
+
def __init__(
|
| 34 |
+
self, renderables: Optional[Iterable["RenderableType"]] = None
|
| 35 |
+
) -> None:
|
| 36 |
+
self._renderables: List["RenderableType"] = (
|
| 37 |
+
list(renderables) if renderables is not None else []
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
def __rich_console__(
|
| 41 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 42 |
+
) -> "RenderResult":
|
| 43 |
+
"""Console render method to insert line-breaks."""
|
| 44 |
+
yield from self._renderables
|
| 45 |
+
|
| 46 |
+
def __rich_measure__(
|
| 47 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 48 |
+
) -> "Measurement":
|
| 49 |
+
dimensions = [
|
| 50 |
+
Measurement.get(console, options, renderable)
|
| 51 |
+
for renderable in self._renderables
|
| 52 |
+
]
|
| 53 |
+
if not dimensions:
|
| 54 |
+
return Measurement(1, 1)
|
| 55 |
+
_min = max(dimension.minimum for dimension in dimensions)
|
| 56 |
+
_max = max(dimension.maximum for dimension in dimensions)
|
| 57 |
+
return Measurement(_min, _max)
|
| 58 |
+
|
| 59 |
+
def append(self, renderable: "RenderableType") -> None:
|
| 60 |
+
self._renderables.append(renderable)
|
| 61 |
+
|
| 62 |
+
def __iter__(self) -> Iterable["RenderableType"]:
|
| 63 |
+
return iter(self._renderables)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class Lines:
|
| 67 |
+
"""A list subclass which can render to the console."""
|
| 68 |
+
|
| 69 |
+
def __init__(self, lines: Iterable["Text"] = ()) -> None:
|
| 70 |
+
self._lines: List["Text"] = list(lines)
|
| 71 |
+
|
| 72 |
+
def __repr__(self) -> str:
|
| 73 |
+
return f"Lines({self._lines!r})"
|
| 74 |
+
|
| 75 |
+
def __iter__(self) -> Iterator["Text"]:
|
| 76 |
+
return iter(self._lines)
|
| 77 |
+
|
| 78 |
+
@overload
|
| 79 |
+
def __getitem__(self, index: int) -> "Text":
|
| 80 |
+
...
|
| 81 |
+
|
| 82 |
+
@overload
|
| 83 |
+
def __getitem__(self, index: slice) -> List["Text"]:
|
| 84 |
+
...
|
| 85 |
+
|
| 86 |
+
def __getitem__(self, index: Union[slice, int]) -> Union["Text", List["Text"]]:
|
| 87 |
+
return self._lines[index]
|
| 88 |
+
|
| 89 |
+
def __setitem__(self, index: int, value: "Text") -> "Lines":
|
| 90 |
+
self._lines[index] = value
|
| 91 |
+
return self
|
| 92 |
+
|
| 93 |
+
def __len__(self) -> int:
|
| 94 |
+
return self._lines.__len__()
|
| 95 |
+
|
| 96 |
+
def __rich_console__(
|
| 97 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 98 |
+
) -> "RenderResult":
|
| 99 |
+
"""Console render method to insert line-breaks."""
|
| 100 |
+
yield from self._lines
|
| 101 |
+
|
| 102 |
+
def append(self, line: "Text") -> None:
|
| 103 |
+
self._lines.append(line)
|
| 104 |
+
|
| 105 |
+
def extend(self, lines: Iterable["Text"]) -> None:
|
| 106 |
+
self._lines.extend(lines)
|
| 107 |
+
|
| 108 |
+
def pop(self, index: int = -1) -> "Text":
|
| 109 |
+
return self._lines.pop(index)
|
| 110 |
+
|
| 111 |
+
def justify(
|
| 112 |
+
self,
|
| 113 |
+
console: "Console",
|
| 114 |
+
width: int,
|
| 115 |
+
justify: "JustifyMethod" = "left",
|
| 116 |
+
overflow: "OverflowMethod" = "fold",
|
| 117 |
+
) -> None:
|
| 118 |
+
"""Justify and overflow text to a given width.
|
| 119 |
+
|
| 120 |
+
Args:
|
| 121 |
+
console (Console): Console instance.
|
| 122 |
+
width (int): Number of characters per line.
|
| 123 |
+
justify (str, optional): Default justify method for text: "left", "center", "full" or "right". Defaults to "left".
|
| 124 |
+
overflow (str, optional): Default overflow for text: "crop", "fold", or "ellipsis". Defaults to "fold".
|
| 125 |
+
|
| 126 |
+
"""
|
| 127 |
+
from .text import Text
|
| 128 |
+
|
| 129 |
+
if justify == "left":
|
| 130 |
+
for line in self._lines:
|
| 131 |
+
line.truncate(width, overflow=overflow, pad=True)
|
| 132 |
+
elif justify == "center":
|
| 133 |
+
for line in self._lines:
|
| 134 |
+
line.rstrip()
|
| 135 |
+
line.truncate(width, overflow=overflow)
|
| 136 |
+
line.pad_left((width - cell_len(line.plain)) // 2)
|
| 137 |
+
line.pad_right(width - cell_len(line.plain))
|
| 138 |
+
elif justify == "right":
|
| 139 |
+
for line in self._lines:
|
| 140 |
+
line.rstrip()
|
| 141 |
+
line.truncate(width, overflow=overflow)
|
| 142 |
+
line.pad_left(width - cell_len(line.plain))
|
| 143 |
+
elif justify == "full":
|
| 144 |
+
for line_index, line in enumerate(self._lines):
|
| 145 |
+
if line_index == len(self._lines) - 1:
|
| 146 |
+
break
|
| 147 |
+
words = line.split(" ")
|
| 148 |
+
words_size = sum(cell_len(word.plain) for word in words)
|
| 149 |
+
num_spaces = len(words) - 1
|
| 150 |
+
spaces = [1 for _ in range(num_spaces)]
|
| 151 |
+
index = 0
|
| 152 |
+
if spaces:
|
| 153 |
+
while words_size + num_spaces < width:
|
| 154 |
+
spaces[len(spaces) - index - 1] += 1
|
| 155 |
+
num_spaces += 1
|
| 156 |
+
index = (index + 1) % len(spaces)
|
| 157 |
+
tokens: List[Text] = []
|
| 158 |
+
for index, (word, next_word) in enumerate(
|
| 159 |
+
zip_longest(words, words[1:])
|
| 160 |
+
):
|
| 161 |
+
tokens.append(word)
|
| 162 |
+
if index < len(spaces):
|
| 163 |
+
style = word.get_style_at_offset(console, -1)
|
| 164 |
+
next_style = next_word.get_style_at_offset(console, 0)
|
| 165 |
+
space_style = style if style == next_style else line.style
|
| 166 |
+
tokens.append(Text(" " * spaces[index], style=space_style))
|
| 167 |
+
self[line_index] = Text("").join(tokens)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/control.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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_CHECKING, Callable, Dict, Iterable, List, Union
|
| 4 |
+
|
| 5 |
+
if sys.version_info >= (3, 8):
|
| 6 |
+
from typing import Final
|
| 7 |
+
else:
|
| 8 |
+
from pip._vendor.typing_extensions import Final # pragma: no cover
|
| 9 |
+
|
| 10 |
+
from .segment import ControlCode, ControlType, Segment
|
| 11 |
+
|
| 12 |
+
if TYPE_CHECKING:
|
| 13 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 14 |
+
|
| 15 |
+
STRIP_CONTROL_CODES: Final = [
|
| 16 |
+
7, # Bell
|
| 17 |
+
8, # Backspace
|
| 18 |
+
11, # Vertical tab
|
| 19 |
+
12, # Form feed
|
| 20 |
+
13, # Carriage return
|
| 21 |
+
]
|
| 22 |
+
_CONTROL_STRIP_TRANSLATE: Final = {
|
| 23 |
+
_codepoint: None for _codepoint in STRIP_CONTROL_CODES
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
CONTROL_ESCAPE: Final = {
|
| 27 |
+
7: "\\a",
|
| 28 |
+
8: "\\b",
|
| 29 |
+
11: "\\v",
|
| 30 |
+
12: "\\f",
|
| 31 |
+
13: "\\r",
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
CONTROL_CODES_FORMAT: Dict[int, Callable[..., str]] = {
|
| 35 |
+
ControlType.BELL: lambda: "\x07",
|
| 36 |
+
ControlType.CARRIAGE_RETURN: lambda: "\r",
|
| 37 |
+
ControlType.HOME: lambda: "\x1b[H",
|
| 38 |
+
ControlType.CLEAR: lambda: "\x1b[2J",
|
| 39 |
+
ControlType.ENABLE_ALT_SCREEN: lambda: "\x1b[?1049h",
|
| 40 |
+
ControlType.DISABLE_ALT_SCREEN: lambda: "\x1b[?1049l",
|
| 41 |
+
ControlType.SHOW_CURSOR: lambda: "\x1b[?25h",
|
| 42 |
+
ControlType.HIDE_CURSOR: lambda: "\x1b[?25l",
|
| 43 |
+
ControlType.CURSOR_UP: lambda param: f"\x1b[{param}A",
|
| 44 |
+
ControlType.CURSOR_DOWN: lambda param: f"\x1b[{param}B",
|
| 45 |
+
ControlType.CURSOR_FORWARD: lambda param: f"\x1b[{param}C",
|
| 46 |
+
ControlType.CURSOR_BACKWARD: lambda param: f"\x1b[{param}D",
|
| 47 |
+
ControlType.CURSOR_MOVE_TO_COLUMN: lambda param: f"\x1b[{param+1}G",
|
| 48 |
+
ControlType.ERASE_IN_LINE: lambda param: f"\x1b[{param}K",
|
| 49 |
+
ControlType.CURSOR_MOVE_TO: lambda x, y: f"\x1b[{y+1};{x+1}H",
|
| 50 |
+
ControlType.SET_WINDOW_TITLE: lambda title: f"\x1b]0;{title}\x07",
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class Control:
|
| 55 |
+
"""A renderable that inserts a control code (non printable but may move cursor).
|
| 56 |
+
|
| 57 |
+
Args:
|
| 58 |
+
*codes (str): Positional arguments are either a :class:`~rich.segment.ControlType` enum or a
|
| 59 |
+
tuple of ControlType and an integer parameter
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
__slots__ = ["segment"]
|
| 63 |
+
|
| 64 |
+
def __init__(self, *codes: Union[ControlType, ControlCode]) -> None:
|
| 65 |
+
control_codes: List[ControlCode] = [
|
| 66 |
+
(code,) if isinstance(code, ControlType) else code for code in codes
|
| 67 |
+
]
|
| 68 |
+
_format_map = CONTROL_CODES_FORMAT
|
| 69 |
+
rendered_codes = "".join(
|
| 70 |
+
_format_map[code](*parameters) for code, *parameters in control_codes
|
| 71 |
+
)
|
| 72 |
+
self.segment = Segment(rendered_codes, None, control_codes)
|
| 73 |
+
|
| 74 |
+
@classmethod
|
| 75 |
+
def bell(cls) -> "Control":
|
| 76 |
+
"""Ring the 'bell'."""
|
| 77 |
+
return cls(ControlType.BELL)
|
| 78 |
+
|
| 79 |
+
@classmethod
|
| 80 |
+
def home(cls) -> "Control":
|
| 81 |
+
"""Move cursor to 'home' position."""
|
| 82 |
+
return cls(ControlType.HOME)
|
| 83 |
+
|
| 84 |
+
@classmethod
|
| 85 |
+
def move(cls, x: int = 0, y: int = 0) -> "Control":
|
| 86 |
+
"""Move cursor relative to current position.
|
| 87 |
+
|
| 88 |
+
Args:
|
| 89 |
+
x (int): X offset.
|
| 90 |
+
y (int): Y offset.
|
| 91 |
+
|
| 92 |
+
Returns:
|
| 93 |
+
~Control: Control object.
|
| 94 |
+
|
| 95 |
+
"""
|
| 96 |
+
|
| 97 |
+
def get_codes() -> Iterable[ControlCode]:
|
| 98 |
+
control = ControlType
|
| 99 |
+
if x:
|
| 100 |
+
yield (
|
| 101 |
+
control.CURSOR_FORWARD if x > 0 else control.CURSOR_BACKWARD,
|
| 102 |
+
abs(x),
|
| 103 |
+
)
|
| 104 |
+
if y:
|
| 105 |
+
yield (
|
| 106 |
+
control.CURSOR_DOWN if y > 0 else control.CURSOR_UP,
|
| 107 |
+
abs(y),
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
control = cls(*get_codes())
|
| 111 |
+
return control
|
| 112 |
+
|
| 113 |
+
@classmethod
|
| 114 |
+
def move_to_column(cls, x: int, y: int = 0) -> "Control":
|
| 115 |
+
"""Move to the given column, optionally add offset to row.
|
| 116 |
+
|
| 117 |
+
Returns:
|
| 118 |
+
x (int): absolute x (column)
|
| 119 |
+
y (int): optional y offset (row)
|
| 120 |
+
|
| 121 |
+
Returns:
|
| 122 |
+
~Control: Control object.
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
return (
|
| 126 |
+
cls(
|
| 127 |
+
(ControlType.CURSOR_MOVE_TO_COLUMN, x),
|
| 128 |
+
(
|
| 129 |
+
ControlType.CURSOR_DOWN if y > 0 else ControlType.CURSOR_UP,
|
| 130 |
+
abs(y),
|
| 131 |
+
),
|
| 132 |
+
)
|
| 133 |
+
if y
|
| 134 |
+
else cls((ControlType.CURSOR_MOVE_TO_COLUMN, x))
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
@classmethod
|
| 138 |
+
def move_to(cls, x: int, y: int) -> "Control":
|
| 139 |
+
"""Move cursor to absolute position.
|
| 140 |
+
|
| 141 |
+
Args:
|
| 142 |
+
x (int): x offset (column)
|
| 143 |
+
y (int): y offset (row)
|
| 144 |
+
|
| 145 |
+
Returns:
|
| 146 |
+
~Control: Control object.
|
| 147 |
+
"""
|
| 148 |
+
return cls((ControlType.CURSOR_MOVE_TO, x, y))
|
| 149 |
+
|
| 150 |
+
@classmethod
|
| 151 |
+
def clear(cls) -> "Control":
|
| 152 |
+
"""Clear the screen."""
|
| 153 |
+
return cls(ControlType.CLEAR)
|
| 154 |
+
|
| 155 |
+
@classmethod
|
| 156 |
+
def show_cursor(cls, show: bool) -> "Control":
|
| 157 |
+
"""Show or hide the cursor."""
|
| 158 |
+
return cls(ControlType.SHOW_CURSOR if show else ControlType.HIDE_CURSOR)
|
| 159 |
+
|
| 160 |
+
@classmethod
|
| 161 |
+
def alt_screen(cls, enable: bool) -> "Control":
|
| 162 |
+
"""Enable or disable alt screen."""
|
| 163 |
+
if enable:
|
| 164 |
+
return cls(ControlType.ENABLE_ALT_SCREEN, ControlType.HOME)
|
| 165 |
+
else:
|
| 166 |
+
return cls(ControlType.DISABLE_ALT_SCREEN)
|
| 167 |
+
|
| 168 |
+
@classmethod
|
| 169 |
+
def title(cls, title: str) -> "Control":
|
| 170 |
+
"""Set the terminal window title
|
| 171 |
+
|
| 172 |
+
Args:
|
| 173 |
+
title (str): The new terminal window title
|
| 174 |
+
"""
|
| 175 |
+
return cls((ControlType.SET_WINDOW_TITLE, title))
|
| 176 |
+
|
| 177 |
+
def __str__(self) -> str:
|
| 178 |
+
return self.segment.text
|
| 179 |
+
|
| 180 |
+
def __rich_console__(
|
| 181 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 182 |
+
) -> "RenderResult":
|
| 183 |
+
if self.segment.text:
|
| 184 |
+
yield self.segment
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def strip_control_codes(
|
| 188 |
+
text: str, _translate_table: Dict[int, None] = _CONTROL_STRIP_TRANSLATE
|
| 189 |
+
) -> str:
|
| 190 |
+
"""Remove control codes from text.
|
| 191 |
+
|
| 192 |
+
Args:
|
| 193 |
+
text (str): A string possibly contain control codes.
|
| 194 |
+
|
| 195 |
+
Returns:
|
| 196 |
+
str: String with control codes removed.
|
| 197 |
+
"""
|
| 198 |
+
return text.translate(_translate_table)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def escape_control_codes(
|
| 202 |
+
text: str,
|
| 203 |
+
_translate_table: Dict[int, str] = CONTROL_ESCAPE,
|
| 204 |
+
) -> str:
|
| 205 |
+
"""Replace control codes with their "escaped" equivalent in the given text.
|
| 206 |
+
(e.g. "\b" becomes "\\b")
|
| 207 |
+
|
| 208 |
+
Args:
|
| 209 |
+
text (str): A string possibly containing control codes.
|
| 210 |
+
|
| 211 |
+
Returns:
|
| 212 |
+
str: String with control codes replaced with their escaped version.
|
| 213 |
+
"""
|
| 214 |
+
return text.translate(_translate_table)
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
if __name__ == "__main__": # pragma: no cover
|
| 218 |
+
from pip._vendor.rich.console import Console
|
| 219 |
+
|
| 220 |
+
console = Console()
|
| 221 |
+
console.print("Look at the title of your terminal window ^")
|
| 222 |
+
# console.print(Control((ControlType.SET_WINDOW_TITLE, "Hello, world!")))
|
| 223 |
+
for i in range(10):
|
| 224 |
+
console.set_window_title("🚀 Loading" + "." * i)
|
| 225 |
+
time.sleep(0.5)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/default_styles.py
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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),
|
| 7 |
+
"reset": Style(
|
| 8 |
+
color="default",
|
| 9 |
+
bgcolor="default",
|
| 10 |
+
dim=False,
|
| 11 |
+
bold=False,
|
| 12 |
+
italic=False,
|
| 13 |
+
underline=False,
|
| 14 |
+
blink=False,
|
| 15 |
+
blink2=False,
|
| 16 |
+
reverse=False,
|
| 17 |
+
conceal=False,
|
| 18 |
+
strike=False,
|
| 19 |
+
),
|
| 20 |
+
"dim": Style(dim=True),
|
| 21 |
+
"bright": Style(dim=False),
|
| 22 |
+
"bold": Style(bold=True),
|
| 23 |
+
"strong": Style(bold=True),
|
| 24 |
+
"code": Style(reverse=True, bold=True),
|
| 25 |
+
"italic": Style(italic=True),
|
| 26 |
+
"emphasize": Style(italic=True),
|
| 27 |
+
"underline": Style(underline=True),
|
| 28 |
+
"blink": Style(blink=True),
|
| 29 |
+
"blink2": Style(blink2=True),
|
| 30 |
+
"reverse": Style(reverse=True),
|
| 31 |
+
"strike": Style(strike=True),
|
| 32 |
+
"black": Style(color="black"),
|
| 33 |
+
"red": Style(color="red"),
|
| 34 |
+
"green": Style(color="green"),
|
| 35 |
+
"yellow": Style(color="yellow"),
|
| 36 |
+
"magenta": Style(color="magenta"),
|
| 37 |
+
"cyan": Style(color="cyan"),
|
| 38 |
+
"white": Style(color="white"),
|
| 39 |
+
"inspect.attr": Style(color="yellow", italic=True),
|
| 40 |
+
"inspect.attr.dunder": Style(color="yellow", italic=True, dim=True),
|
| 41 |
+
"inspect.callable": Style(bold=True, color="red"),
|
| 42 |
+
"inspect.async_def": Style(italic=True, color="bright_cyan"),
|
| 43 |
+
"inspect.def": Style(italic=True, color="bright_cyan"),
|
| 44 |
+
"inspect.class": Style(italic=True, color="bright_cyan"),
|
| 45 |
+
"inspect.error": Style(bold=True, color="red"),
|
| 46 |
+
"inspect.equals": Style(),
|
| 47 |
+
"inspect.help": Style(color="cyan"),
|
| 48 |
+
"inspect.doc": Style(dim=True),
|
| 49 |
+
"inspect.value.border": Style(color="green"),
|
| 50 |
+
"live.ellipsis": Style(bold=True, color="red"),
|
| 51 |
+
"layout.tree.row": Style(dim=False, color="red"),
|
| 52 |
+
"layout.tree.column": Style(dim=False, color="blue"),
|
| 53 |
+
"logging.keyword": Style(bold=True, color="yellow"),
|
| 54 |
+
"logging.level.notset": Style(dim=True),
|
| 55 |
+
"logging.level.debug": Style(color="green"),
|
| 56 |
+
"logging.level.info": Style(color="blue"),
|
| 57 |
+
"logging.level.warning": Style(color="red"),
|
| 58 |
+
"logging.level.error": Style(color="red", bold=True),
|
| 59 |
+
"logging.level.critical": Style(color="red", bold=True, reverse=True),
|
| 60 |
+
"log.level": Style.null(),
|
| 61 |
+
"log.time": Style(color="cyan", dim=True),
|
| 62 |
+
"log.message": Style.null(),
|
| 63 |
+
"log.path": Style(dim=True),
|
| 64 |
+
"repr.ellipsis": Style(color="yellow"),
|
| 65 |
+
"repr.indent": Style(color="green", dim=True),
|
| 66 |
+
"repr.error": Style(color="red", bold=True),
|
| 67 |
+
"repr.str": Style(color="green", italic=False, bold=False),
|
| 68 |
+
"repr.brace": Style(bold=True),
|
| 69 |
+
"repr.comma": Style(bold=True),
|
| 70 |
+
"repr.ipv4": Style(bold=True, color="bright_green"),
|
| 71 |
+
"repr.ipv6": Style(bold=True, color="bright_green"),
|
| 72 |
+
"repr.eui48": Style(bold=True, color="bright_green"),
|
| 73 |
+
"repr.eui64": Style(bold=True, color="bright_green"),
|
| 74 |
+
"repr.tag_start": Style(bold=True),
|
| 75 |
+
"repr.tag_name": Style(color="bright_magenta", bold=True),
|
| 76 |
+
"repr.tag_contents": Style(color="default"),
|
| 77 |
+
"repr.tag_end": Style(bold=True),
|
| 78 |
+
"repr.attrib_name": Style(color="yellow", italic=False),
|
| 79 |
+
"repr.attrib_equal": Style(bold=True),
|
| 80 |
+
"repr.attrib_value": Style(color="magenta", italic=False),
|
| 81 |
+
"repr.number": Style(color="cyan", bold=True, italic=False),
|
| 82 |
+
"repr.number_complex": Style(color="cyan", bold=True, italic=False), # same
|
| 83 |
+
"repr.bool_true": Style(color="bright_green", italic=True),
|
| 84 |
+
"repr.bool_false": Style(color="bright_red", italic=True),
|
| 85 |
+
"repr.none": Style(color="magenta", italic=True),
|
| 86 |
+
"repr.url": Style(underline=True, color="bright_blue", italic=False, bold=False),
|
| 87 |
+
"repr.uuid": Style(color="bright_yellow", bold=False),
|
| 88 |
+
"repr.call": Style(color="magenta", bold=True),
|
| 89 |
+
"repr.path": Style(color="magenta"),
|
| 90 |
+
"repr.filename": Style(color="bright_magenta"),
|
| 91 |
+
"rule.line": Style(color="bright_green"),
|
| 92 |
+
"rule.text": Style.null(),
|
| 93 |
+
"json.brace": Style(bold=True),
|
| 94 |
+
"json.bool_true": Style(color="bright_green", italic=True),
|
| 95 |
+
"json.bool_false": Style(color="bright_red", italic=True),
|
| 96 |
+
"json.null": Style(color="magenta", italic=True),
|
| 97 |
+
"json.number": Style(color="cyan", bold=True, italic=False),
|
| 98 |
+
"json.str": Style(color="green", italic=False, bold=False),
|
| 99 |
+
"json.key": Style(color="blue", bold=True),
|
| 100 |
+
"prompt": Style.null(),
|
| 101 |
+
"prompt.choices": Style(color="magenta", bold=True),
|
| 102 |
+
"prompt.default": Style(color="cyan", bold=True),
|
| 103 |
+
"prompt.invalid": Style(color="red"),
|
| 104 |
+
"prompt.invalid.choice": Style(color="red"),
|
| 105 |
+
"pretty": Style.null(),
|
| 106 |
+
"scope.border": Style(color="blue"),
|
| 107 |
+
"scope.key": Style(color="yellow", italic=True),
|
| 108 |
+
"scope.key.special": Style(color="yellow", italic=True, dim=True),
|
| 109 |
+
"scope.equals": Style(color="red"),
|
| 110 |
+
"table.header": Style(bold=True),
|
| 111 |
+
"table.footer": Style(bold=True),
|
| 112 |
+
"table.cell": Style.null(),
|
| 113 |
+
"table.title": Style(italic=True),
|
| 114 |
+
"table.caption": Style(italic=True, dim=True),
|
| 115 |
+
"traceback.error": Style(color="red", italic=True),
|
| 116 |
+
"traceback.border.syntax_error": Style(color="bright_red"),
|
| 117 |
+
"traceback.border": Style(color="red"),
|
| 118 |
+
"traceback.text": Style.null(),
|
| 119 |
+
"traceback.title": Style(color="red", bold=True),
|
| 120 |
+
"traceback.exc_type": Style(color="bright_red", bold=True),
|
| 121 |
+
"traceback.exc_value": Style.null(),
|
| 122 |
+
"traceback.offset": Style(color="bright_red", bold=True),
|
| 123 |
+
"bar.back": Style(color="grey23"),
|
| 124 |
+
"bar.complete": Style(color="rgb(249,38,114)"),
|
| 125 |
+
"bar.finished": Style(color="rgb(114,156,31)"),
|
| 126 |
+
"bar.pulse": Style(color="rgb(249,38,114)"),
|
| 127 |
+
"progress.description": Style.null(),
|
| 128 |
+
"progress.filesize": Style(color="green"),
|
| 129 |
+
"progress.filesize.total": Style(color="green"),
|
| 130 |
+
"progress.download": Style(color="green"),
|
| 131 |
+
"progress.elapsed": Style(color="yellow"),
|
| 132 |
+
"progress.percentage": Style(color="magenta"),
|
| 133 |
+
"progress.remaining": Style(color="cyan"),
|
| 134 |
+
"progress.data.speed": Style(color="red"),
|
| 135 |
+
"progress.spinner": Style(color="green"),
|
| 136 |
+
"status.spinner": Style(color="green"),
|
| 137 |
+
"tree": Style(),
|
| 138 |
+
"tree.line": Style(),
|
| 139 |
+
"markdown.paragraph": Style(),
|
| 140 |
+
"markdown.text": Style(),
|
| 141 |
+
"markdown.em": Style(italic=True),
|
| 142 |
+
"markdown.emph": Style(italic=True), # For commonmark backwards compatibility
|
| 143 |
+
"markdown.strong": Style(bold=True),
|
| 144 |
+
"markdown.code": Style(bold=True, color="cyan", bgcolor="black"),
|
| 145 |
+
"markdown.code_block": Style(color="cyan", bgcolor="black"),
|
| 146 |
+
"markdown.block_quote": Style(color="magenta"),
|
| 147 |
+
"markdown.list": Style(color="cyan"),
|
| 148 |
+
"markdown.item": Style(),
|
| 149 |
+
"markdown.item.bullet": Style(color="yellow", bold=True),
|
| 150 |
+
"markdown.item.number": Style(color="yellow", bold=True),
|
| 151 |
+
"markdown.hr": Style(color="yellow"),
|
| 152 |
+
"markdown.h1.border": Style(),
|
| 153 |
+
"markdown.h1": Style(bold=True),
|
| 154 |
+
"markdown.h2": Style(bold=True, underline=True),
|
| 155 |
+
"markdown.h3": Style(bold=True),
|
| 156 |
+
"markdown.h4": Style(bold=True, dim=True),
|
| 157 |
+
"markdown.h5": Style(underline=True),
|
| 158 |
+
"markdown.h6": Style(italic=True),
|
| 159 |
+
"markdown.h7": Style(italic=True, dim=True),
|
| 160 |
+
"markdown.link": Style(color="bright_blue"),
|
| 161 |
+
"markdown.link_url": Style(color="blue", underline=True),
|
| 162 |
+
"markdown.s": Style(strike=True),
|
| 163 |
+
"iso8601.date": Style(color="blue"),
|
| 164 |
+
"iso8601.time": Style(color="magenta"),
|
| 165 |
+
"iso8601.timezone": Style(color="yellow"),
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
if __name__ == "__main__": # pragma: no cover
|
| 170 |
+
import argparse
|
| 171 |
+
import io
|
| 172 |
+
|
| 173 |
+
from pip._vendor.rich.console import Console
|
| 174 |
+
from pip._vendor.rich.table import Table
|
| 175 |
+
from pip._vendor.rich.text import Text
|
| 176 |
+
|
| 177 |
+
parser = argparse.ArgumentParser()
|
| 178 |
+
parser.add_argument("--html", action="store_true", help="Export as HTML table")
|
| 179 |
+
args = parser.parse_args()
|
| 180 |
+
html: bool = args.html
|
| 181 |
+
console = Console(record=True, width=70, file=io.StringIO()) if html else Console()
|
| 182 |
+
|
| 183 |
+
table = Table("Name", "Styling")
|
| 184 |
+
|
| 185 |
+
for style_name, style in DEFAULT_STYLES.items():
|
| 186 |
+
table.add_row(Text(style_name, style=style), str(style))
|
| 187 |
+
|
| 188 |
+
console.print(table)
|
| 189 |
+
if html:
|
| 190 |
+
print(console.export_html(inline_styles=True))
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/diagnose.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import platform
|
| 3 |
+
|
| 4 |
+
from pip._vendor.rich import inspect
|
| 5 |
+
from pip._vendor.rich.console import Console, get_windows_console_features
|
| 6 |
+
from pip._vendor.rich.panel import Panel
|
| 7 |
+
from pip._vendor.rich.pretty import Pretty
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def report() -> None: # pragma: no cover
|
| 11 |
+
"""Print a report to the terminal with debugging information"""
|
| 12 |
+
console = Console()
|
| 13 |
+
inspect(console)
|
| 14 |
+
features = get_windows_console_features()
|
| 15 |
+
inspect(features)
|
| 16 |
+
|
| 17 |
+
env_names = (
|
| 18 |
+
"TERM",
|
| 19 |
+
"COLORTERM",
|
| 20 |
+
"CLICOLOR",
|
| 21 |
+
"NO_COLOR",
|
| 22 |
+
"TERM_PROGRAM",
|
| 23 |
+
"COLUMNS",
|
| 24 |
+
"LINES",
|
| 25 |
+
"JUPYTER_COLUMNS",
|
| 26 |
+
"JUPYTER_LINES",
|
| 27 |
+
"JPY_PARENT_PID",
|
| 28 |
+
"VSCODE_VERBOSE_LOGGING",
|
| 29 |
+
)
|
| 30 |
+
env = {name: os.getenv(name) for name in env_names}
|
| 31 |
+
console.print(Panel.fit((Pretty(env)), title="[b]Environment Variables"))
|
| 32 |
+
|
| 33 |
+
console.print(f'platform="{platform.system()}"')
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__": # pragma: no cover
|
| 37 |
+
report()
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/emoji.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import TYPE_CHECKING, Optional, Union
|
| 3 |
+
|
| 4 |
+
from .jupyter import JupyterMixin
|
| 5 |
+
from .segment import Segment
|
| 6 |
+
from .style import Style
|
| 7 |
+
from ._emoji_codes import EMOJI
|
| 8 |
+
from ._emoji_replace import _emoji_replace
|
| 9 |
+
|
| 10 |
+
if sys.version_info >= (3, 8):
|
| 11 |
+
from typing import Literal
|
| 12 |
+
else:
|
| 13 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
if TYPE_CHECKING:
|
| 17 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
EmojiVariant = Literal["emoji", "text"]
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class NoEmoji(Exception):
|
| 24 |
+
"""No emoji by that name."""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class Emoji(JupyterMixin):
|
| 28 |
+
__slots__ = ["name", "style", "_char", "variant"]
|
| 29 |
+
|
| 30 |
+
VARIANTS = {"text": "\uFE0E", "emoji": "\uFE0F"}
|
| 31 |
+
|
| 32 |
+
def __init__(
|
| 33 |
+
self,
|
| 34 |
+
name: str,
|
| 35 |
+
style: Union[str, Style] = "none",
|
| 36 |
+
variant: Optional[EmojiVariant] = None,
|
| 37 |
+
) -> None:
|
| 38 |
+
"""A single emoji character.
|
| 39 |
+
|
| 40 |
+
Args:
|
| 41 |
+
name (str): Name of emoji.
|
| 42 |
+
style (Union[str, Style], optional): Optional style. Defaults to None.
|
| 43 |
+
|
| 44 |
+
Raises:
|
| 45 |
+
NoEmoji: If the emoji doesn't exist.
|
| 46 |
+
"""
|
| 47 |
+
self.name = name
|
| 48 |
+
self.style = style
|
| 49 |
+
self.variant = variant
|
| 50 |
+
try:
|
| 51 |
+
self._char = EMOJI[name]
|
| 52 |
+
except KeyError:
|
| 53 |
+
raise NoEmoji(f"No emoji called {name!r}")
|
| 54 |
+
if variant is not None:
|
| 55 |
+
self._char += self.VARIANTS.get(variant, "")
|
| 56 |
+
|
| 57 |
+
@classmethod
|
| 58 |
+
def replace(cls, text: str) -> str:
|
| 59 |
+
"""Replace emoji markup with corresponding unicode characters.
|
| 60 |
+
|
| 61 |
+
Args:
|
| 62 |
+
text (str): A string with emojis codes, e.g. "Hello :smiley:!"
|
| 63 |
+
|
| 64 |
+
Returns:
|
| 65 |
+
str: A string with emoji codes replaces with actual emoji.
|
| 66 |
+
"""
|
| 67 |
+
return _emoji_replace(text)
|
| 68 |
+
|
| 69 |
+
def __repr__(self) -> str:
|
| 70 |
+
return f"<emoji {self.name!r}>"
|
| 71 |
+
|
| 72 |
+
def __str__(self) -> str:
|
| 73 |
+
return self._char
|
| 74 |
+
|
| 75 |
+
def __rich_console__(
|
| 76 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 77 |
+
) -> "RenderResult":
|
| 78 |
+
yield Segment(self._char, console.get_style(self.style))
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
if __name__ == "__main__": # pragma: no cover
|
| 82 |
+
import sys
|
| 83 |
+
|
| 84 |
+
from pip._vendor.rich.columns import Columns
|
| 85 |
+
from pip._vendor.rich.console import Console
|
| 86 |
+
|
| 87 |
+
console = Console(record=True)
|
| 88 |
+
|
| 89 |
+
columns = Columns(
|
| 90 |
+
(f":{name}: {name}" for name in sorted(EMOJI.keys()) if "\u200D" not in name),
|
| 91 |
+
column_first=True,
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
console.print(columns)
|
| 95 |
+
if len(sys.argv) > 1:
|
| 96 |
+
console.save_html(sys.argv[1])
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/errors.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class ConsoleError(Exception):
|
| 2 |
+
"""An error in console operation."""
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class StyleError(Exception):
|
| 6 |
+
"""An error in styles."""
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class StyleSyntaxError(ConsoleError):
|
| 10 |
+
"""Style was badly formatted."""
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class MissingStyle(StyleError):
|
| 14 |
+
"""No such style."""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class StyleStackError(ConsoleError):
|
| 18 |
+
"""Style stack is invalid."""
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class NotRenderableError(ConsoleError):
|
| 22 |
+
"""Object is not renderable."""
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class MarkupError(ConsoleError):
|
| 26 |
+
"""Markup was badly formatted."""
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class LiveError(ConsoleError):
|
| 30 |
+
"""Error related to Live display."""
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class NoAltScreen(ConsoleError):
|
| 34 |
+
"""Alt screen mode was required."""
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/file_proxy.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import io
|
| 2 |
+
from typing import IO, TYPE_CHECKING, Any, List
|
| 3 |
+
|
| 4 |
+
from .ansi import AnsiDecoder
|
| 5 |
+
from .text import Text
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from .console import Console
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class FileProxy(io.TextIOBase):
|
| 12 |
+
"""Wraps a file (e.g. sys.stdout) and redirects writes to a console."""
|
| 13 |
+
|
| 14 |
+
def __init__(self, console: "Console", file: IO[str]) -> None:
|
| 15 |
+
self.__console = console
|
| 16 |
+
self.__file = file
|
| 17 |
+
self.__buffer: List[str] = []
|
| 18 |
+
self.__ansi_decoder = AnsiDecoder()
|
| 19 |
+
|
| 20 |
+
@property
|
| 21 |
+
def rich_proxied_file(self) -> IO[str]:
|
| 22 |
+
"""Get proxied file."""
|
| 23 |
+
return self.__file
|
| 24 |
+
|
| 25 |
+
def __getattr__(self, name: str) -> Any:
|
| 26 |
+
return getattr(self.__file, name)
|
| 27 |
+
|
| 28 |
+
def write(self, text: str) -> int:
|
| 29 |
+
if not isinstance(text, str):
|
| 30 |
+
raise TypeError(f"write() argument must be str, not {type(text).__name__}")
|
| 31 |
+
buffer = self.__buffer
|
| 32 |
+
lines: List[str] = []
|
| 33 |
+
while text:
|
| 34 |
+
line, new_line, text = text.partition("\n")
|
| 35 |
+
if new_line:
|
| 36 |
+
lines.append("".join(buffer) + line)
|
| 37 |
+
buffer.clear()
|
| 38 |
+
else:
|
| 39 |
+
buffer.append(line)
|
| 40 |
+
break
|
| 41 |
+
if lines:
|
| 42 |
+
console = self.__console
|
| 43 |
+
with console:
|
| 44 |
+
output = Text("\n").join(
|
| 45 |
+
self.__ansi_decoder.decode_line(line) for line in lines
|
| 46 |
+
)
|
| 47 |
+
console.print(output)
|
| 48 |
+
return len(text)
|
| 49 |
+
|
| 50 |
+
def flush(self) -> None:
|
| 51 |
+
output = "".join(self.__buffer)
|
| 52 |
+
if output:
|
| 53 |
+
self.__console.print(output)
|
| 54 |
+
del self.__buffer[:]
|
| 55 |
+
|
| 56 |
+
def fileno(self) -> int:
|
| 57 |
+
return self.__file.fileno()
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/filesize.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding: utf-8
|
| 2 |
+
"""Functions for reporting filesizes. Borrowed from https://github.com/PyFilesystem/pyfilesystem2
|
| 3 |
+
|
| 4 |
+
The functions declared in this module should cover the different
|
| 5 |
+
use cases needed to generate a string representation of a file size
|
| 6 |
+
using several different units. Since there are many standards regarding
|
| 7 |
+
file size units, three different functions have been implemented.
|
| 8 |
+
|
| 9 |
+
See Also:
|
| 10 |
+
* `Wikipedia: Binary prefix <https://en.wikipedia.org/wiki/Binary_prefix>`_
|
| 11 |
+
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
__all__ = ["decimal"]
|
| 15 |
+
|
| 16 |
+
from typing import Iterable, List, Optional, Tuple
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def _to_str(
|
| 20 |
+
size: int,
|
| 21 |
+
suffixes: Iterable[str],
|
| 22 |
+
base: int,
|
| 23 |
+
*,
|
| 24 |
+
precision: Optional[int] = 1,
|
| 25 |
+
separator: Optional[str] = " ",
|
| 26 |
+
) -> str:
|
| 27 |
+
if size == 1:
|
| 28 |
+
return "1 byte"
|
| 29 |
+
elif size < base:
|
| 30 |
+
return "{:,} bytes".format(size)
|
| 31 |
+
|
| 32 |
+
for i, suffix in enumerate(suffixes, 2): # noqa: B007
|
| 33 |
+
unit = base**i
|
| 34 |
+
if size < unit:
|
| 35 |
+
break
|
| 36 |
+
return "{:,.{precision}f}{separator}{}".format(
|
| 37 |
+
(base * size / unit),
|
| 38 |
+
suffix,
|
| 39 |
+
precision=precision,
|
| 40 |
+
separator=separator,
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def pick_unit_and_suffix(size: int, suffixes: List[str], base: int) -> Tuple[int, str]:
|
| 45 |
+
"""Pick a suffix and base for the given size."""
|
| 46 |
+
for i, suffix in enumerate(suffixes):
|
| 47 |
+
unit = base**i
|
| 48 |
+
if size < unit * base:
|
| 49 |
+
break
|
| 50 |
+
return unit, suffix
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def decimal(
|
| 54 |
+
size: int,
|
| 55 |
+
*,
|
| 56 |
+
precision: Optional[int] = 1,
|
| 57 |
+
separator: Optional[str] = " ",
|
| 58 |
+
) -> str:
|
| 59 |
+
"""Convert a filesize in to a string (powers of 1000, SI prefixes).
|
| 60 |
+
|
| 61 |
+
In this convention, ``1000 B = 1 kB``.
|
| 62 |
+
|
| 63 |
+
This is typically the format used to advertise the storage
|
| 64 |
+
capacity of USB flash drives and the like (*256 MB* meaning
|
| 65 |
+
actually a storage capacity of more than *256 000 000 B*),
|
| 66 |
+
or used by **Mac OS X** since v10.6 to report file sizes.
|
| 67 |
+
|
| 68 |
+
Arguments:
|
| 69 |
+
int (size): A file size.
|
| 70 |
+
int (precision): The number of decimal places to include (default = 1).
|
| 71 |
+
str (separator): The string to separate the value from the units (default = " ").
|
| 72 |
+
|
| 73 |
+
Returns:
|
| 74 |
+
`str`: A string containing a abbreviated file size and units.
|
| 75 |
+
|
| 76 |
+
Example:
|
| 77 |
+
>>> filesize.decimal(30000)
|
| 78 |
+
'30.0 kB'
|
| 79 |
+
>>> filesize.decimal(30000, precision=2, separator="")
|
| 80 |
+
'30.00kB'
|
| 81 |
+
|
| 82 |
+
"""
|
| 83 |
+
return _to_str(
|
| 84 |
+
size,
|
| 85 |
+
("kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"),
|
| 86 |
+
1000,
|
| 87 |
+
precision=precision,
|
| 88 |
+
separator=separator,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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
from abc import ABC, abstractmethod
|
| 3 |
+
from typing import List, Union
|
| 4 |
+
|
| 5 |
+
from .text import Span, Text
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def _combine_regex(*regexes: str) -> str:
|
| 9 |
+
"""Combine a number of regexes in to a single regex.
|
| 10 |
+
|
| 11 |
+
Returns:
|
| 12 |
+
str: New regex with all regexes ORed together.
|
| 13 |
+
"""
|
| 14 |
+
return "|".join(regexes)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Highlighter(ABC):
|
| 18 |
+
"""Abstract base class for highlighters."""
|
| 19 |
+
|
| 20 |
+
def __call__(self, text: Union[str, Text]) -> Text:
|
| 21 |
+
"""Highlight a str or Text instance.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
text (Union[str, ~Text]): Text to highlight.
|
| 25 |
+
|
| 26 |
+
Raises:
|
| 27 |
+
TypeError: If not called with text or str.
|
| 28 |
+
|
| 29 |
+
Returns:
|
| 30 |
+
Text: A test instance with highlighting applied.
|
| 31 |
+
"""
|
| 32 |
+
if isinstance(text, str):
|
| 33 |
+
highlight_text = Text(text)
|
| 34 |
+
elif isinstance(text, Text):
|
| 35 |
+
highlight_text = text.copy()
|
| 36 |
+
else:
|
| 37 |
+
raise TypeError(f"str or Text instance required, not {text!r}")
|
| 38 |
+
self.highlight(highlight_text)
|
| 39 |
+
return highlight_text
|
| 40 |
+
|
| 41 |
+
@abstractmethod
|
| 42 |
+
def highlight(self, text: Text) -> None:
|
| 43 |
+
"""Apply highlighting in place to text.
|
| 44 |
+
|
| 45 |
+
Args:
|
| 46 |
+
text (~Text): A text object highlight.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class NullHighlighter(Highlighter):
|
| 51 |
+
"""A highlighter object that doesn't highlight.
|
| 52 |
+
|
| 53 |
+
May be used to disable highlighting entirely.
|
| 54 |
+
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
def highlight(self, text: Text) -> None:
|
| 58 |
+
"""Nothing to do"""
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class RegexHighlighter(Highlighter):
|
| 62 |
+
"""Applies highlighting from a list of regular expressions."""
|
| 63 |
+
|
| 64 |
+
highlights: List[str] = []
|
| 65 |
+
base_style: str = ""
|
| 66 |
+
|
| 67 |
+
def highlight(self, text: Text) -> None:
|
| 68 |
+
"""Highlight :class:`rich.text.Text` using regular expressions.
|
| 69 |
+
|
| 70 |
+
Args:
|
| 71 |
+
text (~Text): Text to highlighted.
|
| 72 |
+
|
| 73 |
+
"""
|
| 74 |
+
|
| 75 |
+
highlight_regex = text.highlight_regex
|
| 76 |
+
for re_highlight in self.highlights:
|
| 77 |
+
highlight_regex(re_highlight, style_prefix=self.base_style)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class ReprHighlighter(RegexHighlighter):
|
| 81 |
+
"""Highlights the text typically produced from ``__repr__`` methods."""
|
| 82 |
+
|
| 83 |
+
base_style = "repr."
|
| 84 |
+
highlights = [
|
| 85 |
+
r"(?P<tag_start><)(?P<tag_name>[-\w.:|]*)(?P<tag_contents>[\w\W]*)(?P<tag_end>>)",
|
| 86 |
+
r'(?P<attrib_name>[\w_]{1,50})=(?P<attrib_value>"?[\w_]+"?)?',
|
| 87 |
+
r"(?P<brace>[][{}()])",
|
| 88 |
+
_combine_regex(
|
| 89 |
+
r"(?P<ipv4>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})",
|
| 90 |
+
r"(?P<ipv6>([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})",
|
| 91 |
+
r"(?P<eui64>(?:[0-9A-Fa-f]{1,2}-){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){7}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){3}[0-9A-Fa-f]{4})",
|
| 92 |
+
r"(?P<eui48>(?:[0-9A-Fa-f]{1,2}-){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{1,2}:){5}[0-9A-Fa-f]{1,2}|(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4})",
|
| 93 |
+
r"(?P<uuid>[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})",
|
| 94 |
+
r"(?P<call>[\w.]*?)\(",
|
| 95 |
+
r"\b(?P<bool_true>True)\b|\b(?P<bool_false>False)\b|\b(?P<none>None)\b",
|
| 96 |
+
r"(?P<ellipsis>\.\.\.)",
|
| 97 |
+
r"(?P<number_complex>(?<!\w)(?:\-?[0-9]+\.?[0-9]*(?:e[-+]?\d+?)?)(?:[-+](?:[0-9]+\.?[0-9]*(?:e[-+]?\d+)?))?j)",
|
| 98 |
+
r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[-+]?\d+?)?\b|0x[0-9a-fA-F]*)",
|
| 99 |
+
r"(?P<path>\B(/[-\w._+]+)*\/)(?P<filename>[-\w._+]*)?",
|
| 100 |
+
r"(?<![\\\w])(?P<str>b?'''.*?(?<!\\)'''|b?'.*?(?<!\\)'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")",
|
| 101 |
+
r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#]*)",
|
| 102 |
+
),
|
| 103 |
+
]
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class JSONHighlighter(RegexHighlighter):
|
| 107 |
+
"""Highlights JSON"""
|
| 108 |
+
|
| 109 |
+
# Captures the start and end of JSON strings, handling escaped quotes
|
| 110 |
+
JSON_STR = r"(?<![\\\w])(?P<str>b?\".*?(?<!\\)\")"
|
| 111 |
+
JSON_WHITESPACE = {" ", "\n", "\r", "\t"}
|
| 112 |
+
|
| 113 |
+
base_style = "json."
|
| 114 |
+
highlights = [
|
| 115 |
+
_combine_regex(
|
| 116 |
+
r"(?P<brace>[\{\[\(\)\]\}])",
|
| 117 |
+
r"\b(?P<bool_true>true)\b|\b(?P<bool_false>false)\b|\b(?P<null>null)\b",
|
| 118 |
+
r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[\-\+]?\d+?)?\b|0x[0-9a-fA-F]*)",
|
| 119 |
+
JSON_STR,
|
| 120 |
+
),
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
def highlight(self, text: Text) -> None:
|
| 124 |
+
super().highlight(text)
|
| 125 |
+
|
| 126 |
+
# Additional work to handle highlighting JSON keys
|
| 127 |
+
plain = text.plain
|
| 128 |
+
append = text.spans.append
|
| 129 |
+
whitespace = self.JSON_WHITESPACE
|
| 130 |
+
for match in re.finditer(self.JSON_STR, plain):
|
| 131 |
+
start, end = match.span()
|
| 132 |
+
cursor = end
|
| 133 |
+
while cursor < len(plain):
|
| 134 |
+
char = plain[cursor]
|
| 135 |
+
cursor += 1
|
| 136 |
+
if char == ":":
|
| 137 |
+
append(Span(start, end, "json.key"))
|
| 138 |
+
elif char in whitespace:
|
| 139 |
+
continue
|
| 140 |
+
break
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class ISO8601Highlighter(RegexHighlighter):
|
| 144 |
+
"""Highlights the ISO8601 date time strings.
|
| 145 |
+
Regex reference: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s07.html
|
| 146 |
+
"""
|
| 147 |
+
|
| 148 |
+
base_style = "iso8601."
|
| 149 |
+
highlights = [
|
| 150 |
+
#
|
| 151 |
+
# Dates
|
| 152 |
+
#
|
| 153 |
+
# Calendar month (e.g. 2008-08). The hyphen is required
|
| 154 |
+
r"^(?P<year>[0-9]{4})-(?P<month>1[0-2]|0[1-9])$",
|
| 155 |
+
# Calendar date w/o hyphens (e.g. 20080830)
|
| 156 |
+
r"^(?P<date>(?P<year>[0-9]{4})(?P<month>1[0-2]|0[1-9])(?P<day>3[01]|0[1-9]|[12][0-9]))$",
|
| 157 |
+
# Ordinal date (e.g. 2008-243). The hyphen is optional
|
| 158 |
+
r"^(?P<date>(?P<year>[0-9]{4})-?(?P<day>36[0-6]|3[0-5][0-9]|[12][0-9]{2}|0[1-9][0-9]|00[1-9]))$",
|
| 159 |
+
#
|
| 160 |
+
# Weeks
|
| 161 |
+
#
|
| 162 |
+
# Week of the year (e.g., 2008-W35). The hyphen is optional
|
| 163 |
+
r"^(?P<date>(?P<year>[0-9]{4})-?W(?P<week>5[0-3]|[1-4][0-9]|0[1-9]))$",
|
| 164 |
+
# Week date (e.g., 2008-W35-6). The hyphens are optional
|
| 165 |
+
r"^(?P<date>(?P<year>[0-9]{4})-?W(?P<week>5[0-3]|[1-4][0-9]|0[1-9])-?(?P<day>[1-7]))$",
|
| 166 |
+
#
|
| 167 |
+
# Times
|
| 168 |
+
#
|
| 169 |
+
# Hours and minutes (e.g., 17:21). The colon is optional
|
| 170 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9]):?(?P<minute>[0-5][0-9]))$",
|
| 171 |
+
# Hours, minutes, and seconds w/o colons (e.g., 172159)
|
| 172 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9]))$",
|
| 173 |
+
# Time zone designator (e.g., Z, +07 or +07:00). The colons and the minutes are optional
|
| 174 |
+
r"^(?P<timezone>(Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?))$",
|
| 175 |
+
# Hours, minutes, and seconds with time zone designator (e.g., 17:21:59+07:00).
|
| 176 |
+
# All the colons are optional. The minutes in the time zone designator are also optional
|
| 177 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9]))(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9])(?::?(?:[0-5][0-9]))?)$",
|
| 178 |
+
#
|
| 179 |
+
# Date and Time
|
| 180 |
+
#
|
| 181 |
+
# Calendar date with hours, minutes, and seconds (e.g., 2008-08-30 17:21:59 or 20080830 172159).
|
| 182 |
+
# A space is required between the date and the time. The hyphens and colons are optional.
|
| 183 |
+
# This regex matches dates and times that specify some hyphens or colons but omit others.
|
| 184 |
+
# This does not follow ISO 8601
|
| 185 |
+
r"^(?P<date>(?P<year>[0-9]{4})(?P<hyphen>-)?(?P<month>1[0-2]|0[1-9])(?(hyphen)-)(?P<day>3[01]|0[1-9]|[12][0-9])) (?P<time>(?P<hour>2[0-3]|[01][0-9])(?(hyphen):)(?P<minute>[0-5][0-9])(?(hyphen):)(?P<second>[0-5][0-9]))$",
|
| 186 |
+
#
|
| 187 |
+
# XML Schema dates and times
|
| 188 |
+
#
|
| 189 |
+
# Date, with optional time zone (e.g., 2008-08-30 or 2008-08-30+07:00).
|
| 190 |
+
# Hyphens are required. This is the XML Schema 'date' type
|
| 191 |
+
r"^(?P<date>(?P<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?P<month>1[0-2]|0[1-9])-(?P<day>3[01]|0[1-9]|[12][0-9]))(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$",
|
| 192 |
+
# Time, with optional fractional seconds and time zone (e.g., 01:45:36 or 01:45:36.123+07:00).
|
| 193 |
+
# There is no limit on the number of digits for the fractional seconds. This is the XML Schema 'time' type
|
| 194 |
+
r"^(?P<time>(?P<hour>2[0-3]|[01][0-9]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9])(?P<frac>\.[0-9]+)?)(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$",
|
| 195 |
+
# Date and time, with optional fractional seconds and time zone (e.g., 2008-08-30T01:45:36 or 2008-08-30T01:45:36.123Z).
|
| 196 |
+
# This is the XML Schema 'dateTime' type
|
| 197 |
+
r"^(?P<date>(?P<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?P<month>1[0-2]|0[1-9])-(?P<day>3[01]|0[1-9]|[12][0-9]))T(?P<time>(?P<hour>2[0-3]|[01][0-9]):(?P<minute>[0-5][0-9]):(?P<second>[0-5][0-9])(?P<ms>\.[0-9]+)?)(?P<timezone>Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9])?$",
|
| 198 |
+
]
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
if __name__ == "__main__": # pragma: no cover
|
| 202 |
+
from .console import Console
|
| 203 |
+
|
| 204 |
+
console = Console()
|
| 205 |
+
console.print("[bold green]hello world![/bold green]")
|
| 206 |
+
console.print("'[bold green]hello world![/bold green]'")
|
| 207 |
+
|
| 208 |
+
console.print(" /foo")
|
| 209 |
+
console.print("/foo/")
|
| 210 |
+
console.print("/foo/bar")
|
| 211 |
+
console.print("foo/bar/baz")
|
| 212 |
+
|
| 213 |
+
console.print("/foo/bar/baz?foo=bar+egg&egg=baz")
|
| 214 |
+
console.print("/foo/bar/baz/")
|
| 215 |
+
console.print("/foo/bar/baz/egg")
|
| 216 |
+
console.print("/foo/bar/baz/egg.py")
|
| 217 |
+
console.print("/foo/bar/baz/egg.py word")
|
| 218 |
+
console.print(" /foo/bar/baz/egg.py word")
|
| 219 |
+
console.print("foo /foo/bar/baz/egg.py word")
|
| 220 |
+
console.print("foo /foo/bar/ba._++z/egg+.py word")
|
| 221 |
+
console.print("https://example.org?foo=bar#header")
|
| 222 |
+
|
| 223 |
+
console.print(1234567.34)
|
| 224 |
+
console.print(1 / 2)
|
| 225 |
+
console.print(-1 / 123123123123)
|
| 226 |
+
|
| 227 |
+
console.print(
|
| 228 |
+
"127.0.1.1 bar 192.168.1.4 2001:0db8:85a3:0000:0000:8a2e:0370:7334 foo"
|
| 229 |
+
)
|
| 230 |
+
import json
|
| 231 |
+
|
| 232 |
+
console.print_json(json.dumps(obj={"name": "apple", "count": 1}), indent=None)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/json.py
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
from json import loads, dumps
|
| 3 |
+
from typing import Any, Callable, Optional, Union
|
| 4 |
+
|
| 5 |
+
from .text import Text
|
| 6 |
+
from .highlighter import JSONHighlighter, NullHighlighter
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class JSON:
|
| 10 |
+
"""A renderable which pretty prints JSON.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
json (str): JSON encoded data.
|
| 14 |
+
indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
|
| 15 |
+
highlight (bool, optional): Enable highlighting. Defaults to True.
|
| 16 |
+
skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
|
| 17 |
+
ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
|
| 18 |
+
check_circular (bool, optional): Check for circular references. Defaults to True.
|
| 19 |
+
allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
|
| 20 |
+
default (Callable, optional): A callable that converts values that can not be encoded
|
| 21 |
+
in to something that can be JSON encoded. Defaults to None.
|
| 22 |
+
sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
json: str,
|
| 28 |
+
indent: Union[None, int, str] = 2,
|
| 29 |
+
highlight: bool = True,
|
| 30 |
+
skip_keys: bool = False,
|
| 31 |
+
ensure_ascii: bool = False,
|
| 32 |
+
check_circular: bool = True,
|
| 33 |
+
allow_nan: bool = True,
|
| 34 |
+
default: Optional[Callable[[Any], Any]] = None,
|
| 35 |
+
sort_keys: bool = False,
|
| 36 |
+
) -> None:
|
| 37 |
+
data = loads(json)
|
| 38 |
+
json = dumps(
|
| 39 |
+
data,
|
| 40 |
+
indent=indent,
|
| 41 |
+
skipkeys=skip_keys,
|
| 42 |
+
ensure_ascii=ensure_ascii,
|
| 43 |
+
check_circular=check_circular,
|
| 44 |
+
allow_nan=allow_nan,
|
| 45 |
+
default=default,
|
| 46 |
+
sort_keys=sort_keys,
|
| 47 |
+
)
|
| 48 |
+
highlighter = JSONHighlighter() if highlight else NullHighlighter()
|
| 49 |
+
self.text = highlighter(json)
|
| 50 |
+
self.text.no_wrap = True
|
| 51 |
+
self.text.overflow = None
|
| 52 |
+
|
| 53 |
+
@classmethod
|
| 54 |
+
def from_data(
|
| 55 |
+
cls,
|
| 56 |
+
data: Any,
|
| 57 |
+
indent: Union[None, int, str] = 2,
|
| 58 |
+
highlight: bool = True,
|
| 59 |
+
skip_keys: bool = False,
|
| 60 |
+
ensure_ascii: bool = False,
|
| 61 |
+
check_circular: bool = True,
|
| 62 |
+
allow_nan: bool = True,
|
| 63 |
+
default: Optional[Callable[[Any], Any]] = None,
|
| 64 |
+
sort_keys: bool = False,
|
| 65 |
+
) -> "JSON":
|
| 66 |
+
"""Encodes a JSON object from arbitrary data.
|
| 67 |
+
|
| 68 |
+
Args:
|
| 69 |
+
data (Any): An object that may be encoded in to JSON
|
| 70 |
+
indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
|
| 71 |
+
highlight (bool, optional): Enable highlighting. Defaults to True.
|
| 72 |
+
default (Callable, optional): Optional callable which will be called for objects that cannot be serialized. Defaults to None.
|
| 73 |
+
skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
|
| 74 |
+
ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
|
| 75 |
+
check_circular (bool, optional): Check for circular references. Defaults to True.
|
| 76 |
+
allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
|
| 77 |
+
default (Callable, optional): A callable that converts values that can not be encoded
|
| 78 |
+
in to something that can be JSON encoded. Defaults to None.
|
| 79 |
+
sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
|
| 80 |
+
|
| 81 |
+
Returns:
|
| 82 |
+
JSON: New JSON object from the given data.
|
| 83 |
+
"""
|
| 84 |
+
json_instance: "JSON" = cls.__new__(cls)
|
| 85 |
+
json = dumps(
|
| 86 |
+
data,
|
| 87 |
+
indent=indent,
|
| 88 |
+
skipkeys=skip_keys,
|
| 89 |
+
ensure_ascii=ensure_ascii,
|
| 90 |
+
check_circular=check_circular,
|
| 91 |
+
allow_nan=allow_nan,
|
| 92 |
+
default=default,
|
| 93 |
+
sort_keys=sort_keys,
|
| 94 |
+
)
|
| 95 |
+
highlighter = JSONHighlighter() if highlight else NullHighlighter()
|
| 96 |
+
json_instance.text = highlighter(json)
|
| 97 |
+
json_instance.text.no_wrap = True
|
| 98 |
+
json_instance.text.overflow = None
|
| 99 |
+
return json_instance
|
| 100 |
+
|
| 101 |
+
def __rich__(self) -> Text:
|
| 102 |
+
return self.text
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
if __name__ == "__main__":
|
| 106 |
+
|
| 107 |
+
import argparse
|
| 108 |
+
import sys
|
| 109 |
+
|
| 110 |
+
parser = argparse.ArgumentParser(description="Pretty print json")
|
| 111 |
+
parser.add_argument(
|
| 112 |
+
"path",
|
| 113 |
+
metavar="PATH",
|
| 114 |
+
help="path to file, or - for stdin",
|
| 115 |
+
)
|
| 116 |
+
parser.add_argument(
|
| 117 |
+
"-i",
|
| 118 |
+
"--indent",
|
| 119 |
+
metavar="SPACES",
|
| 120 |
+
type=int,
|
| 121 |
+
help="Number of spaces in an indent",
|
| 122 |
+
default=2,
|
| 123 |
+
)
|
| 124 |
+
args = parser.parse_args()
|
| 125 |
+
|
| 126 |
+
from pip._vendor.rich.console import Console
|
| 127 |
+
|
| 128 |
+
console = Console()
|
| 129 |
+
error_console = Console(stderr=True)
|
| 130 |
+
|
| 131 |
+
try:
|
| 132 |
+
if args.path == "-":
|
| 133 |
+
json_data = sys.stdin.read()
|
| 134 |
+
else:
|
| 135 |
+
json_data = Path(args.path).read_text()
|
| 136 |
+
except Exception as error:
|
| 137 |
+
error_console.print(f"Unable to read {args.path!r}; {error}")
|
| 138 |
+
sys.exit(-1)
|
| 139 |
+
|
| 140 |
+
console.print(JSON(json_data, indent=args.indent), soft_wrap=True)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/jupyter.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Sequence
|
| 2 |
+
|
| 3 |
+
if TYPE_CHECKING:
|
| 4 |
+
from pip._vendor.rich.console import ConsoleRenderable
|
| 5 |
+
|
| 6 |
+
from . import get_console
|
| 7 |
+
from .segment import Segment
|
| 8 |
+
from .terminal_theme import DEFAULT_TERMINAL_THEME
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from pip._vendor.rich.console import ConsoleRenderable
|
| 12 |
+
|
| 13 |
+
JUPYTER_HTML_FORMAT = """\
|
| 14 |
+
<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">{code}</pre>
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class JupyterRenderable:
|
| 19 |
+
"""A shim to write html to Jupyter notebook."""
|
| 20 |
+
|
| 21 |
+
def __init__(self, html: str, text: str) -> None:
|
| 22 |
+
self.html = html
|
| 23 |
+
self.text = text
|
| 24 |
+
|
| 25 |
+
def _repr_mimebundle_(
|
| 26 |
+
self, include: Sequence[str], exclude: Sequence[str], **kwargs: Any
|
| 27 |
+
) -> Dict[str, str]:
|
| 28 |
+
data = {"text/plain": self.text, "text/html": self.html}
|
| 29 |
+
if include:
|
| 30 |
+
data = {k: v for (k, v) in data.items() if k in include}
|
| 31 |
+
if exclude:
|
| 32 |
+
data = {k: v for (k, v) in data.items() if k not in exclude}
|
| 33 |
+
return data
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class JupyterMixin:
|
| 37 |
+
"""Add to an Rich renderable to make it render in Jupyter notebook."""
|
| 38 |
+
|
| 39 |
+
__slots__ = ()
|
| 40 |
+
|
| 41 |
+
def _repr_mimebundle_(
|
| 42 |
+
self: "ConsoleRenderable",
|
| 43 |
+
include: Sequence[str],
|
| 44 |
+
exclude: Sequence[str],
|
| 45 |
+
**kwargs: Any,
|
| 46 |
+
) -> Dict[str, str]:
|
| 47 |
+
console = get_console()
|
| 48 |
+
segments = list(console.render(self, console.options))
|
| 49 |
+
html = _render_segments(segments)
|
| 50 |
+
text = console._render_buffer(segments)
|
| 51 |
+
data = {"text/plain": text, "text/html": html}
|
| 52 |
+
if include:
|
| 53 |
+
data = {k: v for (k, v) in data.items() if k in include}
|
| 54 |
+
if exclude:
|
| 55 |
+
data = {k: v for (k, v) in data.items() if k not in exclude}
|
| 56 |
+
return data
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def _render_segments(segments: Iterable[Segment]) -> str:
|
| 60 |
+
def escape(text: str) -> str:
|
| 61 |
+
"""Escape html."""
|
| 62 |
+
return text.replace("&", "&").replace("<", "<").replace(">", ">")
|
| 63 |
+
|
| 64 |
+
fragments: List[str] = []
|
| 65 |
+
append_fragment = fragments.append
|
| 66 |
+
theme = DEFAULT_TERMINAL_THEME
|
| 67 |
+
for text, style, control in Segment.simplify(segments):
|
| 68 |
+
if control:
|
| 69 |
+
continue
|
| 70 |
+
text = escape(text)
|
| 71 |
+
if style:
|
| 72 |
+
rule = style.get_html_style(theme)
|
| 73 |
+
text = f'<span style="{rule}">{text}</span>' if rule else text
|
| 74 |
+
if style.link:
|
| 75 |
+
text = f'<a href="{style.link}" target="_blank">{text}</a>'
|
| 76 |
+
append_fragment(text)
|
| 77 |
+
|
| 78 |
+
code = "".join(fragments)
|
| 79 |
+
html = JUPYTER_HTML_FORMAT.format(code=code)
|
| 80 |
+
|
| 81 |
+
return html
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def display(segments: Iterable[Segment], text: str) -> None:
|
| 85 |
+
"""Render segments to Jupyter."""
|
| 86 |
+
html = _render_segments(segments)
|
| 87 |
+
jupyter_renderable = JupyterRenderable(html, text)
|
| 88 |
+
try:
|
| 89 |
+
from IPython.display import display as ipython_display
|
| 90 |
+
|
| 91 |
+
ipython_display(jupyter_renderable)
|
| 92 |
+
except ModuleNotFoundError:
|
| 93 |
+
# Handle the case where the Console has force_jupyter=True,
|
| 94 |
+
# but IPython is not installed.
|
| 95 |
+
pass
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def print(*args: Any, **kwargs: Any) -> None:
|
| 99 |
+
"""Proxy for Console print."""
|
| 100 |
+
console = get_console()
|
| 101 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from abc import ABC, abstractmethod
|
| 2 |
+
from itertools import islice
|
| 3 |
+
from operator import itemgetter
|
| 4 |
+
from threading import RLock
|
| 5 |
+
from typing import (
|
| 6 |
+
TYPE_CHECKING,
|
| 7 |
+
Dict,
|
| 8 |
+
Iterable,
|
| 9 |
+
List,
|
| 10 |
+
NamedTuple,
|
| 11 |
+
Optional,
|
| 12 |
+
Sequence,
|
| 13 |
+
Tuple,
|
| 14 |
+
Union,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
from ._ratio import ratio_resolve
|
| 18 |
+
from .align import Align
|
| 19 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 20 |
+
from .highlighter import ReprHighlighter
|
| 21 |
+
from .panel import Panel
|
| 22 |
+
from .pretty import Pretty
|
| 23 |
+
from .region import Region
|
| 24 |
+
from .repr import Result, rich_repr
|
| 25 |
+
from .segment import Segment
|
| 26 |
+
from .style import StyleType
|
| 27 |
+
|
| 28 |
+
if TYPE_CHECKING:
|
| 29 |
+
from pip._vendor.rich.tree import Tree
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class LayoutRender(NamedTuple):
|
| 33 |
+
"""An individual layout render."""
|
| 34 |
+
|
| 35 |
+
region: Region
|
| 36 |
+
render: List[List[Segment]]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
RegionMap = Dict["Layout", Region]
|
| 40 |
+
RenderMap = Dict["Layout", LayoutRender]
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class LayoutError(Exception):
|
| 44 |
+
"""Layout related error."""
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class NoSplitter(LayoutError):
|
| 48 |
+
"""Requested splitter does not exist."""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class _Placeholder:
|
| 52 |
+
"""An internal renderable used as a Layout placeholder."""
|
| 53 |
+
|
| 54 |
+
highlighter = ReprHighlighter()
|
| 55 |
+
|
| 56 |
+
def __init__(self, layout: "Layout", style: StyleType = "") -> None:
|
| 57 |
+
self.layout = layout
|
| 58 |
+
self.style = style
|
| 59 |
+
|
| 60 |
+
def __rich_console__(
|
| 61 |
+
self, console: Console, options: ConsoleOptions
|
| 62 |
+
) -> RenderResult:
|
| 63 |
+
width = options.max_width
|
| 64 |
+
height = options.height or options.size.height
|
| 65 |
+
layout = self.layout
|
| 66 |
+
title = (
|
| 67 |
+
f"{layout.name!r} ({width} x {height})"
|
| 68 |
+
if layout.name
|
| 69 |
+
else f"({width} x {height})"
|
| 70 |
+
)
|
| 71 |
+
yield Panel(
|
| 72 |
+
Align.center(Pretty(layout), vertical="middle"),
|
| 73 |
+
style=self.style,
|
| 74 |
+
title=self.highlighter(title),
|
| 75 |
+
border_style="blue",
|
| 76 |
+
height=height,
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class Splitter(ABC):
|
| 81 |
+
"""Base class for a splitter."""
|
| 82 |
+
|
| 83 |
+
name: str = ""
|
| 84 |
+
|
| 85 |
+
@abstractmethod
|
| 86 |
+
def get_tree_icon(self) -> str:
|
| 87 |
+
"""Get the icon (emoji) used in layout.tree"""
|
| 88 |
+
|
| 89 |
+
@abstractmethod
|
| 90 |
+
def divide(
|
| 91 |
+
self, children: Sequence["Layout"], region: Region
|
| 92 |
+
) -> Iterable[Tuple["Layout", Region]]:
|
| 93 |
+
"""Divide a region amongst several child layouts.
|
| 94 |
+
|
| 95 |
+
Args:
|
| 96 |
+
children (Sequence(Layout)): A number of child layouts.
|
| 97 |
+
region (Region): A rectangular region to divide.
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class RowSplitter(Splitter):
|
| 102 |
+
"""Split a layout region in to rows."""
|
| 103 |
+
|
| 104 |
+
name = "row"
|
| 105 |
+
|
| 106 |
+
def get_tree_icon(self) -> str:
|
| 107 |
+
return "[layout.tree.row]⬌"
|
| 108 |
+
|
| 109 |
+
def divide(
|
| 110 |
+
self, children: Sequence["Layout"], region: Region
|
| 111 |
+
) -> Iterable[Tuple["Layout", Region]]:
|
| 112 |
+
x, y, width, height = region
|
| 113 |
+
render_widths = ratio_resolve(width, children)
|
| 114 |
+
offset = 0
|
| 115 |
+
_Region = Region
|
| 116 |
+
for child, child_width in zip(children, render_widths):
|
| 117 |
+
yield child, _Region(x + offset, y, child_width, height)
|
| 118 |
+
offset += child_width
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
class ColumnSplitter(Splitter):
|
| 122 |
+
"""Split a layout region in to columns."""
|
| 123 |
+
|
| 124 |
+
name = "column"
|
| 125 |
+
|
| 126 |
+
def get_tree_icon(self) -> str:
|
| 127 |
+
return "[layout.tree.column]⬍"
|
| 128 |
+
|
| 129 |
+
def divide(
|
| 130 |
+
self, children: Sequence["Layout"], region: Region
|
| 131 |
+
) -> Iterable[Tuple["Layout", Region]]:
|
| 132 |
+
x, y, width, height = region
|
| 133 |
+
render_heights = ratio_resolve(height, children)
|
| 134 |
+
offset = 0
|
| 135 |
+
_Region = Region
|
| 136 |
+
for child, child_height in zip(children, render_heights):
|
| 137 |
+
yield child, _Region(x, y + offset, width, child_height)
|
| 138 |
+
offset += child_height
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
@rich_repr
|
| 142 |
+
class Layout:
|
| 143 |
+
"""A renderable to divide a fixed height in to rows or columns.
|
| 144 |
+
|
| 145 |
+
Args:
|
| 146 |
+
renderable (RenderableType, optional): Renderable content, or None for placeholder. Defaults to None.
|
| 147 |
+
name (str, optional): Optional identifier for Layout. Defaults to None.
|
| 148 |
+
size (int, optional): Optional fixed size of layout. Defaults to None.
|
| 149 |
+
minimum_size (int, optional): Minimum size of layout. Defaults to 1.
|
| 150 |
+
ratio (int, optional): Optional ratio for flexible layout. Defaults to 1.
|
| 151 |
+
visible (bool, optional): Visibility of layout. Defaults to True.
|
| 152 |
+
"""
|
| 153 |
+
|
| 154 |
+
splitters = {"row": RowSplitter, "column": ColumnSplitter}
|
| 155 |
+
|
| 156 |
+
def __init__(
|
| 157 |
+
self,
|
| 158 |
+
renderable: Optional[RenderableType] = None,
|
| 159 |
+
*,
|
| 160 |
+
name: Optional[str] = None,
|
| 161 |
+
size: Optional[int] = None,
|
| 162 |
+
minimum_size: int = 1,
|
| 163 |
+
ratio: int = 1,
|
| 164 |
+
visible: bool = True,
|
| 165 |
+
) -> None:
|
| 166 |
+
self._renderable = renderable or _Placeholder(self)
|
| 167 |
+
self.size = size
|
| 168 |
+
self.minimum_size = minimum_size
|
| 169 |
+
self.ratio = ratio
|
| 170 |
+
self.name = name
|
| 171 |
+
self.visible = visible
|
| 172 |
+
self.splitter: Splitter = self.splitters["column"]()
|
| 173 |
+
self._children: List[Layout] = []
|
| 174 |
+
self._render_map: RenderMap = {}
|
| 175 |
+
self._lock = RLock()
|
| 176 |
+
|
| 177 |
+
def __rich_repr__(self) -> Result:
|
| 178 |
+
yield "name", self.name, None
|
| 179 |
+
yield "size", self.size, None
|
| 180 |
+
yield "minimum_size", self.minimum_size, 1
|
| 181 |
+
yield "ratio", self.ratio, 1
|
| 182 |
+
|
| 183 |
+
@property
|
| 184 |
+
def renderable(self) -> RenderableType:
|
| 185 |
+
"""Layout renderable."""
|
| 186 |
+
return self if self._children else self._renderable
|
| 187 |
+
|
| 188 |
+
@property
|
| 189 |
+
def children(self) -> List["Layout"]:
|
| 190 |
+
"""Gets (visible) layout children."""
|
| 191 |
+
return [child for child in self._children if child.visible]
|
| 192 |
+
|
| 193 |
+
@property
|
| 194 |
+
def map(self) -> RenderMap:
|
| 195 |
+
"""Get a map of the last render."""
|
| 196 |
+
return self._render_map
|
| 197 |
+
|
| 198 |
+
def get(self, name: str) -> Optional["Layout"]:
|
| 199 |
+
"""Get a named layout, or None if it doesn't exist.
|
| 200 |
+
|
| 201 |
+
Args:
|
| 202 |
+
name (str): Name of layout.
|
| 203 |
+
|
| 204 |
+
Returns:
|
| 205 |
+
Optional[Layout]: Layout instance or None if no layout was found.
|
| 206 |
+
"""
|
| 207 |
+
if self.name == name:
|
| 208 |
+
return self
|
| 209 |
+
else:
|
| 210 |
+
for child in self._children:
|
| 211 |
+
named_layout = child.get(name)
|
| 212 |
+
if named_layout is not None:
|
| 213 |
+
return named_layout
|
| 214 |
+
return None
|
| 215 |
+
|
| 216 |
+
def __getitem__(self, name: str) -> "Layout":
|
| 217 |
+
layout = self.get(name)
|
| 218 |
+
if layout is None:
|
| 219 |
+
raise KeyError(f"No layout with name {name!r}")
|
| 220 |
+
return layout
|
| 221 |
+
|
| 222 |
+
@property
|
| 223 |
+
def tree(self) -> "Tree":
|
| 224 |
+
"""Get a tree renderable to show layout structure."""
|
| 225 |
+
from pip._vendor.rich.styled import Styled
|
| 226 |
+
from pip._vendor.rich.table import Table
|
| 227 |
+
from pip._vendor.rich.tree import Tree
|
| 228 |
+
|
| 229 |
+
def summary(layout: "Layout") -> Table:
|
| 230 |
+
|
| 231 |
+
icon = layout.splitter.get_tree_icon()
|
| 232 |
+
|
| 233 |
+
table = Table.grid(padding=(0, 1, 0, 0))
|
| 234 |
+
|
| 235 |
+
text: RenderableType = (
|
| 236 |
+
Pretty(layout) if layout.visible else Styled(Pretty(layout), "dim")
|
| 237 |
+
)
|
| 238 |
+
table.add_row(icon, text)
|
| 239 |
+
_summary = table
|
| 240 |
+
return _summary
|
| 241 |
+
|
| 242 |
+
layout = self
|
| 243 |
+
tree = Tree(
|
| 244 |
+
summary(layout),
|
| 245 |
+
guide_style=f"layout.tree.{layout.splitter.name}",
|
| 246 |
+
highlight=True,
|
| 247 |
+
)
|
| 248 |
+
|
| 249 |
+
def recurse(tree: "Tree", layout: "Layout") -> None:
|
| 250 |
+
for child in layout._children:
|
| 251 |
+
recurse(
|
| 252 |
+
tree.add(
|
| 253 |
+
summary(child),
|
| 254 |
+
guide_style=f"layout.tree.{child.splitter.name}",
|
| 255 |
+
),
|
| 256 |
+
child,
|
| 257 |
+
)
|
| 258 |
+
|
| 259 |
+
recurse(tree, self)
|
| 260 |
+
return tree
|
| 261 |
+
|
| 262 |
+
def split(
|
| 263 |
+
self,
|
| 264 |
+
*layouts: Union["Layout", RenderableType],
|
| 265 |
+
splitter: Union[Splitter, str] = "column",
|
| 266 |
+
) -> None:
|
| 267 |
+
"""Split the layout in to multiple sub-layouts.
|
| 268 |
+
|
| 269 |
+
Args:
|
| 270 |
+
*layouts (Layout): Positional arguments should be (sub) Layout instances.
|
| 271 |
+
splitter (Union[Splitter, str]): Splitter instance or name of splitter.
|
| 272 |
+
"""
|
| 273 |
+
_layouts = [
|
| 274 |
+
layout if isinstance(layout, Layout) else Layout(layout)
|
| 275 |
+
for layout in layouts
|
| 276 |
+
]
|
| 277 |
+
try:
|
| 278 |
+
self.splitter = (
|
| 279 |
+
splitter
|
| 280 |
+
if isinstance(splitter, Splitter)
|
| 281 |
+
else self.splitters[splitter]()
|
| 282 |
+
)
|
| 283 |
+
except KeyError:
|
| 284 |
+
raise NoSplitter(f"No splitter called {splitter!r}")
|
| 285 |
+
self._children[:] = _layouts
|
| 286 |
+
|
| 287 |
+
def add_split(self, *layouts: Union["Layout", RenderableType]) -> None:
|
| 288 |
+
"""Add a new layout(s) to existing split.
|
| 289 |
+
|
| 290 |
+
Args:
|
| 291 |
+
*layouts (Union[Layout, RenderableType]): Positional arguments should be renderables or (sub) Layout instances.
|
| 292 |
+
|
| 293 |
+
"""
|
| 294 |
+
_layouts = (
|
| 295 |
+
layout if isinstance(layout, Layout) else Layout(layout)
|
| 296 |
+
for layout in layouts
|
| 297 |
+
)
|
| 298 |
+
self._children.extend(_layouts)
|
| 299 |
+
|
| 300 |
+
def split_row(self, *layouts: Union["Layout", RenderableType]) -> None:
|
| 301 |
+
"""Split the layout in to a row (layouts side by side).
|
| 302 |
+
|
| 303 |
+
Args:
|
| 304 |
+
*layouts (Layout): Positional arguments should be (sub) Layout instances.
|
| 305 |
+
"""
|
| 306 |
+
self.split(*layouts, splitter="row")
|
| 307 |
+
|
| 308 |
+
def split_column(self, *layouts: Union["Layout", RenderableType]) -> None:
|
| 309 |
+
"""Split the layout in to a column (layouts stacked on top of each other).
|
| 310 |
+
|
| 311 |
+
Args:
|
| 312 |
+
*layouts (Layout): Positional arguments should be (sub) Layout instances.
|
| 313 |
+
"""
|
| 314 |
+
self.split(*layouts, splitter="column")
|
| 315 |
+
|
| 316 |
+
def unsplit(self) -> None:
|
| 317 |
+
"""Reset splits to initial state."""
|
| 318 |
+
del self._children[:]
|
| 319 |
+
|
| 320 |
+
def update(self, renderable: RenderableType) -> None:
|
| 321 |
+
"""Update renderable.
|
| 322 |
+
|
| 323 |
+
Args:
|
| 324 |
+
renderable (RenderableType): New renderable object.
|
| 325 |
+
"""
|
| 326 |
+
with self._lock:
|
| 327 |
+
self._renderable = renderable
|
| 328 |
+
|
| 329 |
+
def refresh_screen(self, console: "Console", layout_name: str) -> None:
|
| 330 |
+
"""Refresh a sub-layout.
|
| 331 |
+
|
| 332 |
+
Args:
|
| 333 |
+
console (Console): Console instance where Layout is to be rendered.
|
| 334 |
+
layout_name (str): Name of layout.
|
| 335 |
+
"""
|
| 336 |
+
with self._lock:
|
| 337 |
+
layout = self[layout_name]
|
| 338 |
+
region, _lines = self._render_map[layout]
|
| 339 |
+
(x, y, width, height) = region
|
| 340 |
+
lines = console.render_lines(
|
| 341 |
+
layout, console.options.update_dimensions(width, height)
|
| 342 |
+
)
|
| 343 |
+
self._render_map[layout] = LayoutRender(region, lines)
|
| 344 |
+
console.update_screen_lines(lines, x, y)
|
| 345 |
+
|
| 346 |
+
def _make_region_map(self, width: int, height: int) -> RegionMap:
|
| 347 |
+
"""Create a dict that maps layout on to Region."""
|
| 348 |
+
stack: List[Tuple[Layout, Region]] = [(self, Region(0, 0, width, height))]
|
| 349 |
+
push = stack.append
|
| 350 |
+
pop = stack.pop
|
| 351 |
+
layout_regions: List[Tuple[Layout, Region]] = []
|
| 352 |
+
append_layout_region = layout_regions.append
|
| 353 |
+
while stack:
|
| 354 |
+
append_layout_region(pop())
|
| 355 |
+
layout, region = layout_regions[-1]
|
| 356 |
+
children = layout.children
|
| 357 |
+
if children:
|
| 358 |
+
for child_and_region in layout.splitter.divide(children, region):
|
| 359 |
+
push(child_and_region)
|
| 360 |
+
|
| 361 |
+
region_map = {
|
| 362 |
+
layout: region
|
| 363 |
+
for layout, region in sorted(layout_regions, key=itemgetter(1))
|
| 364 |
+
}
|
| 365 |
+
return region_map
|
| 366 |
+
|
| 367 |
+
def render(self, console: Console, options: ConsoleOptions) -> RenderMap:
|
| 368 |
+
"""Render the sub_layouts.
|
| 369 |
+
|
| 370 |
+
Args:
|
| 371 |
+
console (Console): Console instance.
|
| 372 |
+
options (ConsoleOptions): Console options.
|
| 373 |
+
|
| 374 |
+
Returns:
|
| 375 |
+
RenderMap: A dict that maps Layout on to a tuple of Region, lines
|
| 376 |
+
"""
|
| 377 |
+
render_width = options.max_width
|
| 378 |
+
render_height = options.height or console.height
|
| 379 |
+
region_map = self._make_region_map(render_width, render_height)
|
| 380 |
+
layout_regions = [
|
| 381 |
+
(layout, region)
|
| 382 |
+
for layout, region in region_map.items()
|
| 383 |
+
if not layout.children
|
| 384 |
+
]
|
| 385 |
+
render_map: Dict["Layout", "LayoutRender"] = {}
|
| 386 |
+
render_lines = console.render_lines
|
| 387 |
+
update_dimensions = options.update_dimensions
|
| 388 |
+
|
| 389 |
+
for layout, region in layout_regions:
|
| 390 |
+
lines = render_lines(
|
| 391 |
+
layout.renderable, update_dimensions(region.width, region.height)
|
| 392 |
+
)
|
| 393 |
+
render_map[layout] = LayoutRender(region, lines)
|
| 394 |
+
return render_map
|
| 395 |
+
|
| 396 |
+
def __rich_console__(
|
| 397 |
+
self, console: Console, options: ConsoleOptions
|
| 398 |
+
) -> RenderResult:
|
| 399 |
+
with self._lock:
|
| 400 |
+
width = options.max_width or console.width
|
| 401 |
+
height = options.height or console.height
|
| 402 |
+
render_map = self.render(console, options.update_dimensions(width, height))
|
| 403 |
+
self._render_map = render_map
|
| 404 |
+
layout_lines: List[List[Segment]] = [[] for _ in range(height)]
|
| 405 |
+
_islice = islice
|
| 406 |
+
for (region, lines) in render_map.values():
|
| 407 |
+
_x, y, _layout_width, layout_height = region
|
| 408 |
+
for row, line in zip(
|
| 409 |
+
_islice(layout_lines, y, y + layout_height), lines
|
| 410 |
+
):
|
| 411 |
+
row.extend(line)
|
| 412 |
+
|
| 413 |
+
new_line = Segment.line()
|
| 414 |
+
for layout_row in layout_lines:
|
| 415 |
+
yield from layout_row
|
| 416 |
+
yield new_line
|
| 417 |
+
|
| 418 |
+
|
| 419 |
+
if __name__ == "__main__":
|
| 420 |
+
from pip._vendor.rich.console import Console
|
| 421 |
+
|
| 422 |
+
console = Console()
|
| 423 |
+
layout = Layout()
|
| 424 |
+
|
| 425 |
+
layout.split_column(
|
| 426 |
+
Layout(name="header", size=3),
|
| 427 |
+
Layout(ratio=1, name="main"),
|
| 428 |
+
Layout(size=10, name="footer"),
|
| 429 |
+
)
|
| 430 |
+
|
| 431 |
+
layout["main"].split_row(Layout(name="side"), Layout(name="body", ratio=2))
|
| 432 |
+
|
| 433 |
+
layout["body"].split_row(Layout(name="content", ratio=2), Layout(name="s2"))
|
| 434 |
+
|
| 435 |
+
layout["s2"].split_column(
|
| 436 |
+
Layout(name="top"), Layout(name="middle"), Layout(name="bottom")
|
| 437 |
+
)
|
| 438 |
+
|
| 439 |
+
layout["side"].split_column(Layout(layout.tree, name="left1"), Layout(name="left2"))
|
| 440 |
+
|
| 441 |
+
layout["content"].update("foo")
|
| 442 |
+
|
| 443 |
+
console.print(layout)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/live.py
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from threading import Event, RLock, Thread
|
| 3 |
+
from types import TracebackType
|
| 4 |
+
from typing import IO, Any, Callable, List, Optional, TextIO, Type, cast
|
| 5 |
+
|
| 6 |
+
from . import get_console
|
| 7 |
+
from .console import Console, ConsoleRenderable, RenderableType, RenderHook
|
| 8 |
+
from .control import Control
|
| 9 |
+
from .file_proxy import FileProxy
|
| 10 |
+
from .jupyter import JupyterMixin
|
| 11 |
+
from .live_render import LiveRender, VerticalOverflowMethod
|
| 12 |
+
from .screen import Screen
|
| 13 |
+
from .text import Text
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class _RefreshThread(Thread):
|
| 17 |
+
"""A thread that calls refresh() at regular intervals."""
|
| 18 |
+
|
| 19 |
+
def __init__(self, live: "Live", refresh_per_second: float) -> None:
|
| 20 |
+
self.live = live
|
| 21 |
+
self.refresh_per_second = refresh_per_second
|
| 22 |
+
self.done = Event()
|
| 23 |
+
super().__init__(daemon=True)
|
| 24 |
+
|
| 25 |
+
def stop(self) -> None:
|
| 26 |
+
self.done.set()
|
| 27 |
+
|
| 28 |
+
def run(self) -> None:
|
| 29 |
+
while not self.done.wait(1 / self.refresh_per_second):
|
| 30 |
+
with self.live._lock:
|
| 31 |
+
if not self.done.is_set():
|
| 32 |
+
self.live.refresh()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Live(JupyterMixin, RenderHook):
|
| 36 |
+
"""Renders an auto-updating live display of any given renderable.
|
| 37 |
+
|
| 38 |
+
Args:
|
| 39 |
+
renderable (RenderableType, optional): The renderable to live display. Defaults to displaying nothing.
|
| 40 |
+
console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stdout.
|
| 41 |
+
screen (bool, optional): Enable alternate screen mode. Defaults to False.
|
| 42 |
+
auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()` or `update()` with refresh flag. Defaults to True
|
| 43 |
+
refresh_per_second (float, optional): Number of times per second to refresh the live display. Defaults to 4.
|
| 44 |
+
transient (bool, optional): Clear the renderable on exit (has no effect when screen=True). Defaults to False.
|
| 45 |
+
redirect_stdout (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
|
| 46 |
+
redirect_stderr (bool, optional): Enable redirection of stderr. Defaults to True.
|
| 47 |
+
vertical_overflow (VerticalOverflowMethod, optional): How to handle renderable when it is too tall for the console. Defaults to "ellipsis".
|
| 48 |
+
get_renderable (Callable[[], RenderableType], optional): Optional callable to get renderable. Defaults to None.
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
def __init__(
|
| 52 |
+
self,
|
| 53 |
+
renderable: Optional[RenderableType] = None,
|
| 54 |
+
*,
|
| 55 |
+
console: Optional[Console] = None,
|
| 56 |
+
screen: bool = False,
|
| 57 |
+
auto_refresh: bool = True,
|
| 58 |
+
refresh_per_second: float = 4,
|
| 59 |
+
transient: bool = False,
|
| 60 |
+
redirect_stdout: bool = True,
|
| 61 |
+
redirect_stderr: bool = True,
|
| 62 |
+
vertical_overflow: VerticalOverflowMethod = "ellipsis",
|
| 63 |
+
get_renderable: Optional[Callable[[], RenderableType]] = None,
|
| 64 |
+
) -> None:
|
| 65 |
+
assert refresh_per_second > 0, "refresh_per_second must be > 0"
|
| 66 |
+
self._renderable = renderable
|
| 67 |
+
self.console = console if console is not None else get_console()
|
| 68 |
+
self._screen = screen
|
| 69 |
+
self._alt_screen = False
|
| 70 |
+
|
| 71 |
+
self._redirect_stdout = redirect_stdout
|
| 72 |
+
self._redirect_stderr = redirect_stderr
|
| 73 |
+
self._restore_stdout: Optional[IO[str]] = None
|
| 74 |
+
self._restore_stderr: Optional[IO[str]] = None
|
| 75 |
+
|
| 76 |
+
self._lock = RLock()
|
| 77 |
+
self.ipy_widget: Optional[Any] = None
|
| 78 |
+
self.auto_refresh = auto_refresh
|
| 79 |
+
self._started: bool = False
|
| 80 |
+
self.transient = True if screen else transient
|
| 81 |
+
|
| 82 |
+
self._refresh_thread: Optional[_RefreshThread] = None
|
| 83 |
+
self.refresh_per_second = refresh_per_second
|
| 84 |
+
|
| 85 |
+
self.vertical_overflow = vertical_overflow
|
| 86 |
+
self._get_renderable = get_renderable
|
| 87 |
+
self._live_render = LiveRender(
|
| 88 |
+
self.get_renderable(), vertical_overflow=vertical_overflow
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
@property
|
| 92 |
+
def is_started(self) -> bool:
|
| 93 |
+
"""Check if live display has been started."""
|
| 94 |
+
return self._started
|
| 95 |
+
|
| 96 |
+
def get_renderable(self) -> RenderableType:
|
| 97 |
+
renderable = (
|
| 98 |
+
self._get_renderable()
|
| 99 |
+
if self._get_renderable is not None
|
| 100 |
+
else self._renderable
|
| 101 |
+
)
|
| 102 |
+
return renderable or ""
|
| 103 |
+
|
| 104 |
+
def start(self, refresh: bool = False) -> None:
|
| 105 |
+
"""Start live rendering display.
|
| 106 |
+
|
| 107 |
+
Args:
|
| 108 |
+
refresh (bool, optional): Also refresh. Defaults to False.
|
| 109 |
+
"""
|
| 110 |
+
with self._lock:
|
| 111 |
+
if self._started:
|
| 112 |
+
return
|
| 113 |
+
self.console.set_live(self)
|
| 114 |
+
self._started = True
|
| 115 |
+
if self._screen:
|
| 116 |
+
self._alt_screen = self.console.set_alt_screen(True)
|
| 117 |
+
self.console.show_cursor(False)
|
| 118 |
+
self._enable_redirect_io()
|
| 119 |
+
self.console.push_render_hook(self)
|
| 120 |
+
if refresh:
|
| 121 |
+
try:
|
| 122 |
+
self.refresh()
|
| 123 |
+
except Exception:
|
| 124 |
+
# If refresh fails, we want to stop the redirection of sys.stderr,
|
| 125 |
+
# so the error stacktrace is properly displayed in the terminal.
|
| 126 |
+
# (or, if the code that calls Rich captures the exception and wants to display something,
|
| 127 |
+
# let this be displayed in the terminal).
|
| 128 |
+
self.stop()
|
| 129 |
+
raise
|
| 130 |
+
if self.auto_refresh:
|
| 131 |
+
self._refresh_thread = _RefreshThread(self, self.refresh_per_second)
|
| 132 |
+
self._refresh_thread.start()
|
| 133 |
+
|
| 134 |
+
def stop(self) -> None:
|
| 135 |
+
"""Stop live rendering display."""
|
| 136 |
+
with self._lock:
|
| 137 |
+
if not self._started:
|
| 138 |
+
return
|
| 139 |
+
self.console.clear_live()
|
| 140 |
+
self._started = False
|
| 141 |
+
|
| 142 |
+
if self.auto_refresh and self._refresh_thread is not None:
|
| 143 |
+
self._refresh_thread.stop()
|
| 144 |
+
self._refresh_thread = None
|
| 145 |
+
# allow it to fully render on the last even if overflow
|
| 146 |
+
self.vertical_overflow = "visible"
|
| 147 |
+
with self.console:
|
| 148 |
+
try:
|
| 149 |
+
if not self._alt_screen and not self.console.is_jupyter:
|
| 150 |
+
self.refresh()
|
| 151 |
+
finally:
|
| 152 |
+
self._disable_redirect_io()
|
| 153 |
+
self.console.pop_render_hook()
|
| 154 |
+
if not self._alt_screen and self.console.is_terminal:
|
| 155 |
+
self.console.line()
|
| 156 |
+
self.console.show_cursor(True)
|
| 157 |
+
if self._alt_screen:
|
| 158 |
+
self.console.set_alt_screen(False)
|
| 159 |
+
|
| 160 |
+
if self.transient and not self._alt_screen:
|
| 161 |
+
self.console.control(self._live_render.restore_cursor())
|
| 162 |
+
if self.ipy_widget is not None and self.transient:
|
| 163 |
+
self.ipy_widget.close() # pragma: no cover
|
| 164 |
+
|
| 165 |
+
def __enter__(self) -> "Live":
|
| 166 |
+
self.start(refresh=self._renderable is not None)
|
| 167 |
+
return self
|
| 168 |
+
|
| 169 |
+
def __exit__(
|
| 170 |
+
self,
|
| 171 |
+
exc_type: Optional[Type[BaseException]],
|
| 172 |
+
exc_val: Optional[BaseException],
|
| 173 |
+
exc_tb: Optional[TracebackType],
|
| 174 |
+
) -> None:
|
| 175 |
+
self.stop()
|
| 176 |
+
|
| 177 |
+
def _enable_redirect_io(self) -> None:
|
| 178 |
+
"""Enable redirecting of stdout / stderr."""
|
| 179 |
+
if self.console.is_terminal or self.console.is_jupyter:
|
| 180 |
+
if self._redirect_stdout and not isinstance(sys.stdout, FileProxy):
|
| 181 |
+
self._restore_stdout = sys.stdout
|
| 182 |
+
sys.stdout = cast("TextIO", FileProxy(self.console, sys.stdout))
|
| 183 |
+
if self._redirect_stderr and not isinstance(sys.stderr, FileProxy):
|
| 184 |
+
self._restore_stderr = sys.stderr
|
| 185 |
+
sys.stderr = cast("TextIO", FileProxy(self.console, sys.stderr))
|
| 186 |
+
|
| 187 |
+
def _disable_redirect_io(self) -> None:
|
| 188 |
+
"""Disable redirecting of stdout / stderr."""
|
| 189 |
+
if self._restore_stdout:
|
| 190 |
+
sys.stdout = cast("TextIO", self._restore_stdout)
|
| 191 |
+
self._restore_stdout = None
|
| 192 |
+
if self._restore_stderr:
|
| 193 |
+
sys.stderr = cast("TextIO", self._restore_stderr)
|
| 194 |
+
self._restore_stderr = None
|
| 195 |
+
|
| 196 |
+
@property
|
| 197 |
+
def renderable(self) -> RenderableType:
|
| 198 |
+
"""Get the renderable that is being displayed
|
| 199 |
+
|
| 200 |
+
Returns:
|
| 201 |
+
RenderableType: Displayed renderable.
|
| 202 |
+
"""
|
| 203 |
+
renderable = self.get_renderable()
|
| 204 |
+
return Screen(renderable) if self._alt_screen else renderable
|
| 205 |
+
|
| 206 |
+
def update(self, renderable: RenderableType, *, refresh: bool = False) -> None:
|
| 207 |
+
"""Update the renderable that is being displayed
|
| 208 |
+
|
| 209 |
+
Args:
|
| 210 |
+
renderable (RenderableType): New renderable to use.
|
| 211 |
+
refresh (bool, optional): Refresh the display. Defaults to False.
|
| 212 |
+
"""
|
| 213 |
+
if isinstance(renderable, str):
|
| 214 |
+
renderable = self.console.render_str(renderable)
|
| 215 |
+
with self._lock:
|
| 216 |
+
self._renderable = renderable
|
| 217 |
+
if refresh:
|
| 218 |
+
self.refresh()
|
| 219 |
+
|
| 220 |
+
def refresh(self) -> None:
|
| 221 |
+
"""Update the display of the Live Render."""
|
| 222 |
+
with self._lock:
|
| 223 |
+
self._live_render.set_renderable(self.renderable)
|
| 224 |
+
if self.console.is_jupyter: # pragma: no cover
|
| 225 |
+
try:
|
| 226 |
+
from IPython.display import display
|
| 227 |
+
from ipywidgets import Output
|
| 228 |
+
except ImportError:
|
| 229 |
+
import warnings
|
| 230 |
+
|
| 231 |
+
warnings.warn('install "ipywidgets" for Jupyter support')
|
| 232 |
+
else:
|
| 233 |
+
if self.ipy_widget is None:
|
| 234 |
+
self.ipy_widget = Output()
|
| 235 |
+
display(self.ipy_widget)
|
| 236 |
+
|
| 237 |
+
with self.ipy_widget:
|
| 238 |
+
self.ipy_widget.clear_output(wait=True)
|
| 239 |
+
self.console.print(self._live_render.renderable)
|
| 240 |
+
elif self.console.is_terminal and not self.console.is_dumb_terminal:
|
| 241 |
+
with self.console:
|
| 242 |
+
self.console.print(Control())
|
| 243 |
+
elif (
|
| 244 |
+
not self._started and not self.transient
|
| 245 |
+
): # if it is finished allow files or dumb-terminals to see final result
|
| 246 |
+
with self.console:
|
| 247 |
+
self.console.print(Control())
|
| 248 |
+
|
| 249 |
+
def process_renderables(
|
| 250 |
+
self, renderables: List[ConsoleRenderable]
|
| 251 |
+
) -> List[ConsoleRenderable]:
|
| 252 |
+
"""Process renderables to restore cursor and display progress."""
|
| 253 |
+
self._live_render.vertical_overflow = self.vertical_overflow
|
| 254 |
+
if self.console.is_interactive:
|
| 255 |
+
# lock needs acquiring as user can modify live_render renderable at any time unlike in Progress.
|
| 256 |
+
with self._lock:
|
| 257 |
+
reset = (
|
| 258 |
+
Control.home()
|
| 259 |
+
if self._alt_screen
|
| 260 |
+
else self._live_render.position_cursor()
|
| 261 |
+
)
|
| 262 |
+
renderables = [reset, *renderables, self._live_render]
|
| 263 |
+
elif (
|
| 264 |
+
not self._started and not self.transient
|
| 265 |
+
): # if it is finished render the final output for files or dumb_terminals
|
| 266 |
+
renderables = [*renderables, self._live_render]
|
| 267 |
+
|
| 268 |
+
return renderables
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
if __name__ == "__main__": # pragma: no cover
|
| 272 |
+
import random
|
| 273 |
+
import time
|
| 274 |
+
from itertools import cycle
|
| 275 |
+
from typing import Dict, List, Tuple
|
| 276 |
+
|
| 277 |
+
from .align import Align
|
| 278 |
+
from .console import Console
|
| 279 |
+
from .live import Live as Live
|
| 280 |
+
from .panel import Panel
|
| 281 |
+
from .rule import Rule
|
| 282 |
+
from .syntax import Syntax
|
| 283 |
+
from .table import Table
|
| 284 |
+
|
| 285 |
+
console = Console()
|
| 286 |
+
|
| 287 |
+
syntax = Syntax(
|
| 288 |
+
'''def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
|
| 289 |
+
"""Iterate and generate a tuple with a flag for last value."""
|
| 290 |
+
iter_values = iter(values)
|
| 291 |
+
try:
|
| 292 |
+
previous_value = next(iter_values)
|
| 293 |
+
except StopIteration:
|
| 294 |
+
return
|
| 295 |
+
for value in iter_values:
|
| 296 |
+
yield False, previous_value
|
| 297 |
+
previous_value = value
|
| 298 |
+
yield True, previous_value''',
|
| 299 |
+
"python",
|
| 300 |
+
line_numbers=True,
|
| 301 |
+
)
|
| 302 |
+
|
| 303 |
+
table = Table("foo", "bar", "baz")
|
| 304 |
+
table.add_row("1", "2", "3")
|
| 305 |
+
|
| 306 |
+
progress_renderables = [
|
| 307 |
+
"You can make the terminal shorter and taller to see the live table hide"
|
| 308 |
+
"Text may be printed while the progress bars are rendering.",
|
| 309 |
+
Panel("In fact, [i]any[/i] renderable will work"),
|
| 310 |
+
"Such as [magenta]tables[/]...",
|
| 311 |
+
table,
|
| 312 |
+
"Pretty printed structures...",
|
| 313 |
+
{"type": "example", "text": "Pretty printed"},
|
| 314 |
+
"Syntax...",
|
| 315 |
+
syntax,
|
| 316 |
+
Rule("Give it a try!"),
|
| 317 |
+
]
|
| 318 |
+
|
| 319 |
+
examples = cycle(progress_renderables)
|
| 320 |
+
|
| 321 |
+
exchanges = [
|
| 322 |
+
"SGD",
|
| 323 |
+
"MYR",
|
| 324 |
+
"EUR",
|
| 325 |
+
"USD",
|
| 326 |
+
"AUD",
|
| 327 |
+
"JPY",
|
| 328 |
+
"CNH",
|
| 329 |
+
"HKD",
|
| 330 |
+
"CAD",
|
| 331 |
+
"INR",
|
| 332 |
+
"DKK",
|
| 333 |
+
"GBP",
|
| 334 |
+
"RUB",
|
| 335 |
+
"NZD",
|
| 336 |
+
"MXN",
|
| 337 |
+
"IDR",
|
| 338 |
+
"TWD",
|
| 339 |
+
"THB",
|
| 340 |
+
"VND",
|
| 341 |
+
]
|
| 342 |
+
with Live(console=console) as live_table:
|
| 343 |
+
exchange_rate_dict: Dict[Tuple[str, str], float] = {}
|
| 344 |
+
|
| 345 |
+
for index in range(100):
|
| 346 |
+
select_exchange = exchanges[index % len(exchanges)]
|
| 347 |
+
|
| 348 |
+
for exchange in exchanges:
|
| 349 |
+
if exchange == select_exchange:
|
| 350 |
+
continue
|
| 351 |
+
time.sleep(0.4)
|
| 352 |
+
if random.randint(0, 10) < 1:
|
| 353 |
+
console.log(next(examples))
|
| 354 |
+
exchange_rate_dict[(select_exchange, exchange)] = 200 / (
|
| 355 |
+
(random.random() * 320) + 1
|
| 356 |
+
)
|
| 357 |
+
if len(exchange_rate_dict) > len(exchanges) - 1:
|
| 358 |
+
exchange_rate_dict.pop(list(exchange_rate_dict.keys())[0])
|
| 359 |
+
table = Table(title="Exchange Rates")
|
| 360 |
+
|
| 361 |
+
table.add_column("Source Currency")
|
| 362 |
+
table.add_column("Destination Currency")
|
| 363 |
+
table.add_column("Exchange Rate")
|
| 364 |
+
|
| 365 |
+
for ((source, dest), exchange_rate) in exchange_rate_dict.items():
|
| 366 |
+
table.add_row(
|
| 367 |
+
source,
|
| 368 |
+
dest,
|
| 369 |
+
Text(
|
| 370 |
+
f"{exchange_rate:.4f}",
|
| 371 |
+
style="red" if exchange_rate < 1.0 else "green",
|
| 372 |
+
),
|
| 373 |
+
)
|
| 374 |
+
|
| 375 |
+
live_table.update(Align.center(table))
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/live_render.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import Optional, Tuple
|
| 3 |
+
|
| 4 |
+
if sys.version_info >= (3, 8):
|
| 5 |
+
from typing import Literal
|
| 6 |
+
else:
|
| 7 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
from ._loop import loop_last
|
| 11 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 12 |
+
from .control import Control
|
| 13 |
+
from .segment import ControlType, Segment
|
| 14 |
+
from .style import StyleType
|
| 15 |
+
from .text import Text
|
| 16 |
+
|
| 17 |
+
VerticalOverflowMethod = Literal["crop", "ellipsis", "visible"]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class LiveRender:
|
| 21 |
+
"""Creates a renderable that may be updated.
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
renderable (RenderableType): Any renderable object.
|
| 25 |
+
style (StyleType, optional): An optional style to apply to the renderable. Defaults to "".
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
def __init__(
|
| 29 |
+
self,
|
| 30 |
+
renderable: RenderableType,
|
| 31 |
+
style: StyleType = "",
|
| 32 |
+
vertical_overflow: VerticalOverflowMethod = "ellipsis",
|
| 33 |
+
) -> None:
|
| 34 |
+
self.renderable = renderable
|
| 35 |
+
self.style = style
|
| 36 |
+
self.vertical_overflow = vertical_overflow
|
| 37 |
+
self._shape: Optional[Tuple[int, int]] = None
|
| 38 |
+
|
| 39 |
+
def set_renderable(self, renderable: RenderableType) -> None:
|
| 40 |
+
"""Set a new renderable.
|
| 41 |
+
|
| 42 |
+
Args:
|
| 43 |
+
renderable (RenderableType): Any renderable object, including str.
|
| 44 |
+
"""
|
| 45 |
+
self.renderable = renderable
|
| 46 |
+
|
| 47 |
+
def position_cursor(self) -> Control:
|
| 48 |
+
"""Get control codes to move cursor to beginning of live render.
|
| 49 |
+
|
| 50 |
+
Returns:
|
| 51 |
+
Control: A control instance that may be printed.
|
| 52 |
+
"""
|
| 53 |
+
if self._shape is not None:
|
| 54 |
+
_, height = self._shape
|
| 55 |
+
return Control(
|
| 56 |
+
ControlType.CARRIAGE_RETURN,
|
| 57 |
+
(ControlType.ERASE_IN_LINE, 2),
|
| 58 |
+
*(
|
| 59 |
+
(
|
| 60 |
+
(ControlType.CURSOR_UP, 1),
|
| 61 |
+
(ControlType.ERASE_IN_LINE, 2),
|
| 62 |
+
)
|
| 63 |
+
* (height - 1)
|
| 64 |
+
)
|
| 65 |
+
)
|
| 66 |
+
return Control()
|
| 67 |
+
|
| 68 |
+
def restore_cursor(self) -> Control:
|
| 69 |
+
"""Get control codes to clear the render and restore the cursor to its previous position.
|
| 70 |
+
|
| 71 |
+
Returns:
|
| 72 |
+
Control: A Control instance that may be printed.
|
| 73 |
+
"""
|
| 74 |
+
if self._shape is not None:
|
| 75 |
+
_, height = self._shape
|
| 76 |
+
return Control(
|
| 77 |
+
ControlType.CARRIAGE_RETURN,
|
| 78 |
+
*((ControlType.CURSOR_UP, 1), (ControlType.ERASE_IN_LINE, 2)) * height
|
| 79 |
+
)
|
| 80 |
+
return Control()
|
| 81 |
+
|
| 82 |
+
def __rich_console__(
|
| 83 |
+
self, console: Console, options: ConsoleOptions
|
| 84 |
+
) -> RenderResult:
|
| 85 |
+
|
| 86 |
+
renderable = self.renderable
|
| 87 |
+
style = console.get_style(self.style)
|
| 88 |
+
lines = console.render_lines(renderable, options, style=style, pad=False)
|
| 89 |
+
shape = Segment.get_shape(lines)
|
| 90 |
+
|
| 91 |
+
_, height = shape
|
| 92 |
+
if height > options.size.height:
|
| 93 |
+
if self.vertical_overflow == "crop":
|
| 94 |
+
lines = lines[: options.size.height]
|
| 95 |
+
shape = Segment.get_shape(lines)
|
| 96 |
+
elif self.vertical_overflow == "ellipsis":
|
| 97 |
+
lines = lines[: (options.size.height - 1)]
|
| 98 |
+
overflow_text = Text(
|
| 99 |
+
"...",
|
| 100 |
+
overflow="crop",
|
| 101 |
+
justify="center",
|
| 102 |
+
end="",
|
| 103 |
+
style="live.ellipsis",
|
| 104 |
+
)
|
| 105 |
+
lines.append(list(console.render(overflow_text)))
|
| 106 |
+
shape = Segment.get_shape(lines)
|
| 107 |
+
self._shape = shape
|
| 108 |
+
|
| 109 |
+
new_line = Segment.line()
|
| 110 |
+
for last, line in loop_last(lines):
|
| 111 |
+
yield from line
|
| 112 |
+
if not last:
|
| 113 |
+
yield new_line
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/logging.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
from datetime import datetime
|
| 3 |
+
from logging import Handler, LogRecord
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from types import ModuleType
|
| 6 |
+
from typing import ClassVar, Iterable, List, Optional, Type, Union
|
| 7 |
+
|
| 8 |
+
from pip._vendor.rich._null_file import NullFile
|
| 9 |
+
|
| 10 |
+
from . import get_console
|
| 11 |
+
from ._log_render import FormatTimeCallable, LogRender
|
| 12 |
+
from .console import Console, ConsoleRenderable
|
| 13 |
+
from .highlighter import Highlighter, ReprHighlighter
|
| 14 |
+
from .text import Text
|
| 15 |
+
from .traceback import Traceback
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class RichHandler(Handler):
|
| 19 |
+
"""A logging handler that renders output with Rich. The time / level / message and file are displayed in columns.
|
| 20 |
+
The level is color coded, and the message is syntax highlighted.
|
| 21 |
+
|
| 22 |
+
Note:
|
| 23 |
+
Be careful when enabling console markup in log messages if you have configured logging for libraries not
|
| 24 |
+
under your control. If a dependency writes messages containing square brackets, it may not produce the intended output.
|
| 25 |
+
|
| 26 |
+
Args:
|
| 27 |
+
level (Union[int, str], optional): Log level. Defaults to logging.NOTSET.
|
| 28 |
+
console (:class:`~rich.console.Console`, optional): Optional console instance to write logs.
|
| 29 |
+
Default will use a global console instance writing to stdout.
|
| 30 |
+
show_time (bool, optional): Show a column for the time. Defaults to True.
|
| 31 |
+
omit_repeated_times (bool, optional): Omit repetition of the same time. Defaults to True.
|
| 32 |
+
show_level (bool, optional): Show a column for the level. Defaults to True.
|
| 33 |
+
show_path (bool, optional): Show the path to the original log call. Defaults to True.
|
| 34 |
+
enable_link_path (bool, optional): Enable terminal link of path column to file. Defaults to True.
|
| 35 |
+
highlighter (Highlighter, optional): Highlighter to style log messages, or None to use ReprHighlighter. Defaults to None.
|
| 36 |
+
markup (bool, optional): Enable console markup in log messages. Defaults to False.
|
| 37 |
+
rich_tracebacks (bool, optional): Enable rich tracebacks with syntax highlighting and formatting. Defaults to False.
|
| 38 |
+
tracebacks_width (Optional[int], optional): Number of characters used to render tracebacks, or None for full width. Defaults to None.
|
| 39 |
+
tracebacks_extra_lines (int, optional): Additional lines of code to render tracebacks, or None for full width. Defaults to None.
|
| 40 |
+
tracebacks_theme (str, optional): Override pygments theme used in traceback.
|
| 41 |
+
tracebacks_word_wrap (bool, optional): Enable word wrapping of long tracebacks lines. Defaults to True.
|
| 42 |
+
tracebacks_show_locals (bool, optional): Enable display of locals in tracebacks. Defaults to False.
|
| 43 |
+
tracebacks_suppress (Sequence[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
|
| 44 |
+
locals_max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 45 |
+
Defaults to 10.
|
| 46 |
+
locals_max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to 80.
|
| 47 |
+
log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%x %X] ".
|
| 48 |
+
keywords (List[str], optional): List of words to highlight instead of ``RichHandler.KEYWORDS``.
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
KEYWORDS: ClassVar[Optional[List[str]]] = [
|
| 52 |
+
"GET",
|
| 53 |
+
"POST",
|
| 54 |
+
"HEAD",
|
| 55 |
+
"PUT",
|
| 56 |
+
"DELETE",
|
| 57 |
+
"OPTIONS",
|
| 58 |
+
"TRACE",
|
| 59 |
+
"PATCH",
|
| 60 |
+
]
|
| 61 |
+
HIGHLIGHTER_CLASS: ClassVar[Type[Highlighter]] = ReprHighlighter
|
| 62 |
+
|
| 63 |
+
def __init__(
|
| 64 |
+
self,
|
| 65 |
+
level: Union[int, str] = logging.NOTSET,
|
| 66 |
+
console: Optional[Console] = None,
|
| 67 |
+
*,
|
| 68 |
+
show_time: bool = True,
|
| 69 |
+
omit_repeated_times: bool = True,
|
| 70 |
+
show_level: bool = True,
|
| 71 |
+
show_path: bool = True,
|
| 72 |
+
enable_link_path: bool = True,
|
| 73 |
+
highlighter: Optional[Highlighter] = None,
|
| 74 |
+
markup: bool = False,
|
| 75 |
+
rich_tracebacks: bool = False,
|
| 76 |
+
tracebacks_width: Optional[int] = None,
|
| 77 |
+
tracebacks_extra_lines: int = 3,
|
| 78 |
+
tracebacks_theme: Optional[str] = None,
|
| 79 |
+
tracebacks_word_wrap: bool = True,
|
| 80 |
+
tracebacks_show_locals: bool = False,
|
| 81 |
+
tracebacks_suppress: Iterable[Union[str, ModuleType]] = (),
|
| 82 |
+
locals_max_length: int = 10,
|
| 83 |
+
locals_max_string: int = 80,
|
| 84 |
+
log_time_format: Union[str, FormatTimeCallable] = "[%x %X]",
|
| 85 |
+
keywords: Optional[List[str]] = None,
|
| 86 |
+
) -> None:
|
| 87 |
+
super().__init__(level=level)
|
| 88 |
+
self.console = console or get_console()
|
| 89 |
+
self.highlighter = highlighter or self.HIGHLIGHTER_CLASS()
|
| 90 |
+
self._log_render = LogRender(
|
| 91 |
+
show_time=show_time,
|
| 92 |
+
show_level=show_level,
|
| 93 |
+
show_path=show_path,
|
| 94 |
+
time_format=log_time_format,
|
| 95 |
+
omit_repeated_times=omit_repeated_times,
|
| 96 |
+
level_width=None,
|
| 97 |
+
)
|
| 98 |
+
self.enable_link_path = enable_link_path
|
| 99 |
+
self.markup = markup
|
| 100 |
+
self.rich_tracebacks = rich_tracebacks
|
| 101 |
+
self.tracebacks_width = tracebacks_width
|
| 102 |
+
self.tracebacks_extra_lines = tracebacks_extra_lines
|
| 103 |
+
self.tracebacks_theme = tracebacks_theme
|
| 104 |
+
self.tracebacks_word_wrap = tracebacks_word_wrap
|
| 105 |
+
self.tracebacks_show_locals = tracebacks_show_locals
|
| 106 |
+
self.tracebacks_suppress = tracebacks_suppress
|
| 107 |
+
self.locals_max_length = locals_max_length
|
| 108 |
+
self.locals_max_string = locals_max_string
|
| 109 |
+
self.keywords = keywords
|
| 110 |
+
|
| 111 |
+
def get_level_text(self, record: LogRecord) -> Text:
|
| 112 |
+
"""Get the level name from the record.
|
| 113 |
+
|
| 114 |
+
Args:
|
| 115 |
+
record (LogRecord): LogRecord instance.
|
| 116 |
+
|
| 117 |
+
Returns:
|
| 118 |
+
Text: A tuple of the style and level name.
|
| 119 |
+
"""
|
| 120 |
+
level_name = record.levelname
|
| 121 |
+
level_text = Text.styled(
|
| 122 |
+
level_name.ljust(8), f"logging.level.{level_name.lower()}"
|
| 123 |
+
)
|
| 124 |
+
return level_text
|
| 125 |
+
|
| 126 |
+
def emit(self, record: LogRecord) -> None:
|
| 127 |
+
"""Invoked by logging."""
|
| 128 |
+
message = self.format(record)
|
| 129 |
+
traceback = None
|
| 130 |
+
if (
|
| 131 |
+
self.rich_tracebacks
|
| 132 |
+
and record.exc_info
|
| 133 |
+
and record.exc_info != (None, None, None)
|
| 134 |
+
):
|
| 135 |
+
exc_type, exc_value, exc_traceback = record.exc_info
|
| 136 |
+
assert exc_type is not None
|
| 137 |
+
assert exc_value is not None
|
| 138 |
+
traceback = Traceback.from_exception(
|
| 139 |
+
exc_type,
|
| 140 |
+
exc_value,
|
| 141 |
+
exc_traceback,
|
| 142 |
+
width=self.tracebacks_width,
|
| 143 |
+
extra_lines=self.tracebacks_extra_lines,
|
| 144 |
+
theme=self.tracebacks_theme,
|
| 145 |
+
word_wrap=self.tracebacks_word_wrap,
|
| 146 |
+
show_locals=self.tracebacks_show_locals,
|
| 147 |
+
locals_max_length=self.locals_max_length,
|
| 148 |
+
locals_max_string=self.locals_max_string,
|
| 149 |
+
suppress=self.tracebacks_suppress,
|
| 150 |
+
)
|
| 151 |
+
message = record.getMessage()
|
| 152 |
+
if self.formatter:
|
| 153 |
+
record.message = record.getMessage()
|
| 154 |
+
formatter = self.formatter
|
| 155 |
+
if hasattr(formatter, "usesTime") and formatter.usesTime():
|
| 156 |
+
record.asctime = formatter.formatTime(record, formatter.datefmt)
|
| 157 |
+
message = formatter.formatMessage(record)
|
| 158 |
+
|
| 159 |
+
message_renderable = self.render_message(record, message)
|
| 160 |
+
log_renderable = self.render(
|
| 161 |
+
record=record, traceback=traceback, message_renderable=message_renderable
|
| 162 |
+
)
|
| 163 |
+
if isinstance(self.console.file, NullFile):
|
| 164 |
+
# Handles pythonw, where stdout/stderr are null, and we return NullFile
|
| 165 |
+
# instance from Console.file. In this case, we still want to make a log record
|
| 166 |
+
# even though we won't be writing anything to a file.
|
| 167 |
+
self.handleError(record)
|
| 168 |
+
else:
|
| 169 |
+
try:
|
| 170 |
+
self.console.print(log_renderable)
|
| 171 |
+
except Exception:
|
| 172 |
+
self.handleError(record)
|
| 173 |
+
|
| 174 |
+
def render_message(self, record: LogRecord, message: str) -> "ConsoleRenderable":
|
| 175 |
+
"""Render message text in to Text.
|
| 176 |
+
|
| 177 |
+
Args:
|
| 178 |
+
record (LogRecord): logging Record.
|
| 179 |
+
message (str): String containing log message.
|
| 180 |
+
|
| 181 |
+
Returns:
|
| 182 |
+
ConsoleRenderable: Renderable to display log message.
|
| 183 |
+
"""
|
| 184 |
+
use_markup = getattr(record, "markup", self.markup)
|
| 185 |
+
message_text = Text.from_markup(message) if use_markup else Text(message)
|
| 186 |
+
|
| 187 |
+
highlighter = getattr(record, "highlighter", self.highlighter)
|
| 188 |
+
if highlighter:
|
| 189 |
+
message_text = highlighter(message_text)
|
| 190 |
+
|
| 191 |
+
if self.keywords is None:
|
| 192 |
+
self.keywords = self.KEYWORDS
|
| 193 |
+
|
| 194 |
+
if self.keywords:
|
| 195 |
+
message_text.highlight_words(self.keywords, "logging.keyword")
|
| 196 |
+
|
| 197 |
+
return message_text
|
| 198 |
+
|
| 199 |
+
def render(
|
| 200 |
+
self,
|
| 201 |
+
*,
|
| 202 |
+
record: LogRecord,
|
| 203 |
+
traceback: Optional[Traceback],
|
| 204 |
+
message_renderable: "ConsoleRenderable",
|
| 205 |
+
) -> "ConsoleRenderable":
|
| 206 |
+
"""Render log for display.
|
| 207 |
+
|
| 208 |
+
Args:
|
| 209 |
+
record (LogRecord): logging Record.
|
| 210 |
+
traceback (Optional[Traceback]): Traceback instance or None for no Traceback.
|
| 211 |
+
message_renderable (ConsoleRenderable): Renderable (typically Text) containing log message contents.
|
| 212 |
+
|
| 213 |
+
Returns:
|
| 214 |
+
ConsoleRenderable: Renderable to display log.
|
| 215 |
+
"""
|
| 216 |
+
path = Path(record.pathname).name
|
| 217 |
+
level = self.get_level_text(record)
|
| 218 |
+
time_format = None if self.formatter is None else self.formatter.datefmt
|
| 219 |
+
log_time = datetime.fromtimestamp(record.created)
|
| 220 |
+
|
| 221 |
+
log_renderable = self._log_render(
|
| 222 |
+
self.console,
|
| 223 |
+
[message_renderable] if not traceback else [message_renderable, traceback],
|
| 224 |
+
log_time=log_time,
|
| 225 |
+
time_format=time_format,
|
| 226 |
+
level=level,
|
| 227 |
+
path=path,
|
| 228 |
+
line_no=record.lineno,
|
| 229 |
+
link_path=record.pathname if self.enable_link_path else None,
|
| 230 |
+
)
|
| 231 |
+
return log_renderable
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
if __name__ == "__main__": # pragma: no cover
|
| 235 |
+
from time import sleep
|
| 236 |
+
|
| 237 |
+
FORMAT = "%(message)s"
|
| 238 |
+
# FORMAT = "%(asctime)-15s - %(levelname)s - %(message)s"
|
| 239 |
+
logging.basicConfig(
|
| 240 |
+
level="NOTSET",
|
| 241 |
+
format=FORMAT,
|
| 242 |
+
datefmt="[%X]",
|
| 243 |
+
handlers=[RichHandler(rich_tracebacks=True, tracebacks_show_locals=True)],
|
| 244 |
+
)
|
| 245 |
+
log = logging.getLogger("rich")
|
| 246 |
+
|
| 247 |
+
log.info("Server starting...")
|
| 248 |
+
log.info("Listening on http://127.0.0.1:8080")
|
| 249 |
+
sleep(1)
|
| 250 |
+
|
| 251 |
+
log.info("GET /index.html 200 1298")
|
| 252 |
+
log.info("GET /imgs/backgrounds/back1.jpg 200 54386")
|
| 253 |
+
log.info("GET /css/styles.css 200 54386")
|
| 254 |
+
log.warning("GET /favicon.ico 404 242")
|
| 255 |
+
sleep(1)
|
| 256 |
+
|
| 257 |
+
log.debug(
|
| 258 |
+
"JSONRPC request\n--> %r\n<-- %r",
|
| 259 |
+
{
|
| 260 |
+
"version": "1.1",
|
| 261 |
+
"method": "confirmFruitPurchase",
|
| 262 |
+
"params": [["apple", "orange", "mangoes", "pomelo"], 1.123],
|
| 263 |
+
"id": "194521489",
|
| 264 |
+
},
|
| 265 |
+
{"version": "1.1", "result": True, "error": None, "id": "194521489"},
|
| 266 |
+
)
|
| 267 |
+
log.debug(
|
| 268 |
+
"Loading configuration file /adasd/asdasd/qeqwe/qwrqwrqwr/sdgsdgsdg/werwerwer/dfgerert/ertertert/ertetert/werwerwer"
|
| 269 |
+
)
|
| 270 |
+
log.error("Unable to find 'pomelo' in database!")
|
| 271 |
+
log.info("POST /jsonrpc/ 200 65532")
|
| 272 |
+
log.info("POST /admin/ 401 42234")
|
| 273 |
+
log.warning("password was rejected for admin site.")
|
| 274 |
+
|
| 275 |
+
def divide() -> None:
|
| 276 |
+
number = 1
|
| 277 |
+
divisor = 0
|
| 278 |
+
foos = ["foo"] * 100
|
| 279 |
+
log.debug("in divide")
|
| 280 |
+
try:
|
| 281 |
+
number / divisor
|
| 282 |
+
except:
|
| 283 |
+
log.exception("An error of some kind occurred!")
|
| 284 |
+
|
| 285 |
+
divide()
|
| 286 |
+
sleep(1)
|
| 287 |
+
log.critical("Out of memory!")
|
| 288 |
+
log.info("Server exited with code=-1")
|
| 289 |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
from ast import literal_eval
|
| 3 |
+
from operator import attrgetter
|
| 4 |
+
from typing import Callable, Iterable, List, Match, NamedTuple, Optional, Tuple, Union
|
| 5 |
+
|
| 6 |
+
from ._emoji_replace import _emoji_replace
|
| 7 |
+
from .emoji import EmojiVariant
|
| 8 |
+
from .errors import MarkupError
|
| 9 |
+
from .style import Style
|
| 10 |
+
from .text import Span, Text
|
| 11 |
+
|
| 12 |
+
RE_TAGS = re.compile(
|
| 13 |
+
r"""((\\*)\[([a-z#/@][^[]*?)])""",
|
| 14 |
+
re.VERBOSE,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
RE_HANDLER = re.compile(r"^([\w.]*?)(\(.*?\))?$")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class Tag(NamedTuple):
|
| 21 |
+
"""A tag in console markup."""
|
| 22 |
+
|
| 23 |
+
name: str
|
| 24 |
+
"""The tag name. e.g. 'bold'."""
|
| 25 |
+
parameters: Optional[str]
|
| 26 |
+
"""Any additional parameters after the name."""
|
| 27 |
+
|
| 28 |
+
def __str__(self) -> str:
|
| 29 |
+
return (
|
| 30 |
+
self.name if self.parameters is None else f"{self.name} {self.parameters}"
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
@property
|
| 34 |
+
def markup(self) -> str:
|
| 35 |
+
"""Get the string representation of this tag."""
|
| 36 |
+
return (
|
| 37 |
+
f"[{self.name}]"
|
| 38 |
+
if self.parameters is None
|
| 39 |
+
else f"[{self.name}={self.parameters}]"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
_ReStringMatch = Match[str] # regex match object
|
| 44 |
+
_ReSubCallable = Callable[[_ReStringMatch], str] # Callable invoked by re.sub
|
| 45 |
+
_EscapeSubMethod = Callable[[_ReSubCallable, str], str] # Sub method of a compiled re
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def escape(
|
| 49 |
+
markup: str,
|
| 50 |
+
_escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#/@][^[]*?])").sub,
|
| 51 |
+
) -> str:
|
| 52 |
+
"""Escapes text so that it won't be interpreted as markup.
|
| 53 |
+
|
| 54 |
+
Args:
|
| 55 |
+
markup (str): Content to be inserted in to markup.
|
| 56 |
+
|
| 57 |
+
Returns:
|
| 58 |
+
str: Markup with square brackets escaped.
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
def escape_backslashes(match: Match[str]) -> str:
|
| 62 |
+
"""Called by re.sub replace matches."""
|
| 63 |
+
backslashes, text = match.groups()
|
| 64 |
+
return f"{backslashes}{backslashes}\\{text}"
|
| 65 |
+
|
| 66 |
+
markup = _escape(escape_backslashes, markup)
|
| 67 |
+
return markup
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _parse(markup: str) -> Iterable[Tuple[int, Optional[str], Optional[Tag]]]:
|
| 71 |
+
"""Parse markup in to an iterable of tuples of (position, text, tag).
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
markup (str): A string containing console markup
|
| 75 |
+
|
| 76 |
+
"""
|
| 77 |
+
position = 0
|
| 78 |
+
_divmod = divmod
|
| 79 |
+
_Tag = Tag
|
| 80 |
+
for match in RE_TAGS.finditer(markup):
|
| 81 |
+
full_text, escapes, tag_text = match.groups()
|
| 82 |
+
start, end = match.span()
|
| 83 |
+
if start > position:
|
| 84 |
+
yield start, markup[position:start], None
|
| 85 |
+
if escapes:
|
| 86 |
+
backslashes, escaped = _divmod(len(escapes), 2)
|
| 87 |
+
if backslashes:
|
| 88 |
+
# Literal backslashes
|
| 89 |
+
yield start, "\\" * backslashes, None
|
| 90 |
+
start += backslashes * 2
|
| 91 |
+
if escaped:
|
| 92 |
+
# Escape of tag
|
| 93 |
+
yield start, full_text[len(escapes) :], None
|
| 94 |
+
position = end
|
| 95 |
+
continue
|
| 96 |
+
text, equals, parameters = tag_text.partition("=")
|
| 97 |
+
yield start, None, _Tag(text, parameters if equals else None)
|
| 98 |
+
position = end
|
| 99 |
+
if position < len(markup):
|
| 100 |
+
yield position, markup[position:], None
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def render(
|
| 104 |
+
markup: str,
|
| 105 |
+
style: Union[str, Style] = "",
|
| 106 |
+
emoji: bool = True,
|
| 107 |
+
emoji_variant: Optional[EmojiVariant] = None,
|
| 108 |
+
) -> Text:
|
| 109 |
+
"""Render console markup in to a Text instance.
|
| 110 |
+
|
| 111 |
+
Args:
|
| 112 |
+
markup (str): A string containing console markup.
|
| 113 |
+
emoji (bool, optional): Also render emoji code. Defaults to True.
|
| 114 |
+
|
| 115 |
+
Raises:
|
| 116 |
+
MarkupError: If there is a syntax error in the markup.
|
| 117 |
+
|
| 118 |
+
Returns:
|
| 119 |
+
Text: A test instance.
|
| 120 |
+
"""
|
| 121 |
+
emoji_replace = _emoji_replace
|
| 122 |
+
if "[" not in markup:
|
| 123 |
+
return Text(
|
| 124 |
+
emoji_replace(markup, default_variant=emoji_variant) if emoji else markup,
|
| 125 |
+
style=style,
|
| 126 |
+
)
|
| 127 |
+
text = Text(style=style)
|
| 128 |
+
append = text.append
|
| 129 |
+
normalize = Style.normalize
|
| 130 |
+
|
| 131 |
+
style_stack: List[Tuple[int, Tag]] = []
|
| 132 |
+
pop = style_stack.pop
|
| 133 |
+
|
| 134 |
+
spans: List[Span] = []
|
| 135 |
+
append_span = spans.append
|
| 136 |
+
|
| 137 |
+
_Span = Span
|
| 138 |
+
_Tag = Tag
|
| 139 |
+
|
| 140 |
+
def pop_style(style_name: str) -> Tuple[int, Tag]:
|
| 141 |
+
"""Pop tag matching given style name."""
|
| 142 |
+
for index, (_, tag) in enumerate(reversed(style_stack), 1):
|
| 143 |
+
if tag.name == style_name:
|
| 144 |
+
return pop(-index)
|
| 145 |
+
raise KeyError(style_name)
|
| 146 |
+
|
| 147 |
+
for position, plain_text, tag in _parse(markup):
|
| 148 |
+
if plain_text is not None:
|
| 149 |
+
# Handle open brace escapes, where the brace is not part of a tag.
|
| 150 |
+
plain_text = plain_text.replace("\\[", "[")
|
| 151 |
+
append(emoji_replace(plain_text) if emoji else plain_text)
|
| 152 |
+
elif tag is not None:
|
| 153 |
+
if tag.name.startswith("/"): # Closing tag
|
| 154 |
+
style_name = tag.name[1:].strip()
|
| 155 |
+
|
| 156 |
+
if style_name: # explicit close
|
| 157 |
+
style_name = normalize(style_name)
|
| 158 |
+
try:
|
| 159 |
+
start, open_tag = pop_style(style_name)
|
| 160 |
+
except KeyError:
|
| 161 |
+
raise MarkupError(
|
| 162 |
+
f"closing tag '{tag.markup}' at position {position} doesn't match any open tag"
|
| 163 |
+
) from None
|
| 164 |
+
else: # implicit close
|
| 165 |
+
try:
|
| 166 |
+
start, open_tag = pop()
|
| 167 |
+
except IndexError:
|
| 168 |
+
raise MarkupError(
|
| 169 |
+
f"closing tag '[/]' at position {position} has nothing to close"
|
| 170 |
+
) from None
|
| 171 |
+
|
| 172 |
+
if open_tag.name.startswith("@"):
|
| 173 |
+
if open_tag.parameters:
|
| 174 |
+
handler_name = ""
|
| 175 |
+
parameters = open_tag.parameters.strip()
|
| 176 |
+
handler_match = RE_HANDLER.match(parameters)
|
| 177 |
+
if handler_match is not None:
|
| 178 |
+
handler_name, match_parameters = handler_match.groups()
|
| 179 |
+
parameters = (
|
| 180 |
+
"()" if match_parameters is None else match_parameters
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
try:
|
| 184 |
+
meta_params = literal_eval(parameters)
|
| 185 |
+
except SyntaxError as error:
|
| 186 |
+
raise MarkupError(
|
| 187 |
+
f"error parsing {parameters!r} in {open_tag.parameters!r}; {error.msg}"
|
| 188 |
+
)
|
| 189 |
+
except Exception as error:
|
| 190 |
+
raise MarkupError(
|
| 191 |
+
f"error parsing {open_tag.parameters!r}; {error}"
|
| 192 |
+
) from None
|
| 193 |
+
|
| 194 |
+
if handler_name:
|
| 195 |
+
meta_params = (
|
| 196 |
+
handler_name,
|
| 197 |
+
meta_params
|
| 198 |
+
if isinstance(meta_params, tuple)
|
| 199 |
+
else (meta_params,),
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
else:
|
| 203 |
+
meta_params = ()
|
| 204 |
+
|
| 205 |
+
append_span(
|
| 206 |
+
_Span(
|
| 207 |
+
start, len(text), Style(meta={open_tag.name: meta_params})
|
| 208 |
+
)
|
| 209 |
+
)
|
| 210 |
+
else:
|
| 211 |
+
append_span(_Span(start, len(text), str(open_tag)))
|
| 212 |
+
|
| 213 |
+
else: # Opening tag
|
| 214 |
+
normalized_tag = _Tag(normalize(tag.name), tag.parameters)
|
| 215 |
+
style_stack.append((len(text), normalized_tag))
|
| 216 |
+
|
| 217 |
+
text_length = len(text)
|
| 218 |
+
while style_stack:
|
| 219 |
+
start, tag = style_stack.pop()
|
| 220 |
+
style = str(tag)
|
| 221 |
+
if style:
|
| 222 |
+
append_span(_Span(start, text_length, style))
|
| 223 |
+
|
| 224 |
+
text.spans = sorted(spans[::-1], key=attrgetter("start"))
|
| 225 |
+
return text
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
if __name__ == "__main__": # pragma: no cover
|
| 229 |
+
|
| 230 |
+
MARKUP = [
|
| 231 |
+
"[red]Hello World[/red]",
|
| 232 |
+
"[magenta]Hello [b]World[/b]",
|
| 233 |
+
"[bold]Bold[italic] bold and italic [/bold]italic[/italic]",
|
| 234 |
+
"Click [link=https://www.willmcgugan.com]here[/link] to visit my Blog",
|
| 235 |
+
":warning-emoji: [bold red blink] DANGER![/]",
|
| 236 |
+
]
|
| 237 |
+
|
| 238 |
+
from pip._vendor.rich import print
|
| 239 |
+
from pip._vendor.rich.table import Table
|
| 240 |
+
|
| 241 |
+
grid = Table("Markup", "Result", padding=(0, 1))
|
| 242 |
+
|
| 243 |
+
for markup in MARKUP:
|
| 244 |
+
grid.add_row(Text(markup), markup)
|
| 245 |
+
|
| 246 |
+
print(grid)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/measure.py
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from operator import itemgetter
|
| 2 |
+
from typing import TYPE_CHECKING, Callable, NamedTuple, Optional, Sequence
|
| 3 |
+
|
| 4 |
+
from . import errors
|
| 5 |
+
from .protocol import is_renderable, rich_cast
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from .console import Console, ConsoleOptions, RenderableType
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Measurement(NamedTuple):
|
| 12 |
+
"""Stores the minimum and maximum widths (in characters) required to render an object."""
|
| 13 |
+
|
| 14 |
+
minimum: int
|
| 15 |
+
"""Minimum number of cells required to render."""
|
| 16 |
+
maximum: int
|
| 17 |
+
"""Maximum number of cells required to render."""
|
| 18 |
+
|
| 19 |
+
@property
|
| 20 |
+
def span(self) -> int:
|
| 21 |
+
"""Get difference between maximum and minimum."""
|
| 22 |
+
return self.maximum - self.minimum
|
| 23 |
+
|
| 24 |
+
def normalize(self) -> "Measurement":
|
| 25 |
+
"""Get measurement that ensures that minimum <= maximum and minimum >= 0
|
| 26 |
+
|
| 27 |
+
Returns:
|
| 28 |
+
Measurement: A normalized measurement.
|
| 29 |
+
"""
|
| 30 |
+
minimum, maximum = self
|
| 31 |
+
minimum = min(max(0, minimum), maximum)
|
| 32 |
+
return Measurement(max(0, minimum), max(0, max(minimum, maximum)))
|
| 33 |
+
|
| 34 |
+
def with_maximum(self, width: int) -> "Measurement":
|
| 35 |
+
"""Get a RenderableWith where the widths are <= width.
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
width (int): Maximum desired width.
|
| 39 |
+
|
| 40 |
+
Returns:
|
| 41 |
+
Measurement: New Measurement object.
|
| 42 |
+
"""
|
| 43 |
+
minimum, maximum = self
|
| 44 |
+
return Measurement(min(minimum, width), min(maximum, width))
|
| 45 |
+
|
| 46 |
+
def with_minimum(self, width: int) -> "Measurement":
|
| 47 |
+
"""Get a RenderableWith where the widths are >= width.
|
| 48 |
+
|
| 49 |
+
Args:
|
| 50 |
+
width (int): Minimum desired width.
|
| 51 |
+
|
| 52 |
+
Returns:
|
| 53 |
+
Measurement: New Measurement object.
|
| 54 |
+
"""
|
| 55 |
+
minimum, maximum = self
|
| 56 |
+
width = max(0, width)
|
| 57 |
+
return Measurement(max(minimum, width), max(maximum, width))
|
| 58 |
+
|
| 59 |
+
def clamp(
|
| 60 |
+
self, min_width: Optional[int] = None, max_width: Optional[int] = None
|
| 61 |
+
) -> "Measurement":
|
| 62 |
+
"""Clamp a measurement within the specified range.
|
| 63 |
+
|
| 64 |
+
Args:
|
| 65 |
+
min_width (int): Minimum desired width, or ``None`` for no minimum. Defaults to None.
|
| 66 |
+
max_width (int): Maximum desired width, or ``None`` for no maximum. Defaults to None.
|
| 67 |
+
|
| 68 |
+
Returns:
|
| 69 |
+
Measurement: New Measurement object.
|
| 70 |
+
"""
|
| 71 |
+
measurement = self
|
| 72 |
+
if min_width is not None:
|
| 73 |
+
measurement = measurement.with_minimum(min_width)
|
| 74 |
+
if max_width is not None:
|
| 75 |
+
measurement = measurement.with_maximum(max_width)
|
| 76 |
+
return measurement
|
| 77 |
+
|
| 78 |
+
@classmethod
|
| 79 |
+
def get(
|
| 80 |
+
cls, console: "Console", options: "ConsoleOptions", renderable: "RenderableType"
|
| 81 |
+
) -> "Measurement":
|
| 82 |
+
"""Get a measurement for a renderable.
|
| 83 |
+
|
| 84 |
+
Args:
|
| 85 |
+
console (~rich.console.Console): Console instance.
|
| 86 |
+
options (~rich.console.ConsoleOptions): Console options.
|
| 87 |
+
renderable (RenderableType): An object that may be rendered with Rich.
|
| 88 |
+
|
| 89 |
+
Raises:
|
| 90 |
+
errors.NotRenderableError: If the object is not renderable.
|
| 91 |
+
|
| 92 |
+
Returns:
|
| 93 |
+
Measurement: Measurement object containing range of character widths required to render the object.
|
| 94 |
+
"""
|
| 95 |
+
_max_width = options.max_width
|
| 96 |
+
if _max_width < 1:
|
| 97 |
+
return Measurement(0, 0)
|
| 98 |
+
if isinstance(renderable, str):
|
| 99 |
+
renderable = console.render_str(
|
| 100 |
+
renderable, markup=options.markup, highlight=False
|
| 101 |
+
)
|
| 102 |
+
renderable = rich_cast(renderable)
|
| 103 |
+
if is_renderable(renderable):
|
| 104 |
+
get_console_width: Optional[
|
| 105 |
+
Callable[["Console", "ConsoleOptions"], "Measurement"]
|
| 106 |
+
] = getattr(renderable, "__rich_measure__", None)
|
| 107 |
+
if get_console_width is not None:
|
| 108 |
+
render_width = (
|
| 109 |
+
get_console_width(console, options)
|
| 110 |
+
.normalize()
|
| 111 |
+
.with_maximum(_max_width)
|
| 112 |
+
)
|
| 113 |
+
if render_width.maximum < 1:
|
| 114 |
+
return Measurement(0, 0)
|
| 115 |
+
return render_width.normalize()
|
| 116 |
+
else:
|
| 117 |
+
return Measurement(0, _max_width)
|
| 118 |
+
else:
|
| 119 |
+
raise errors.NotRenderableError(
|
| 120 |
+
f"Unable to get render width for {renderable!r}; "
|
| 121 |
+
"a str, Segment, or object with __rich_console__ method is required"
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def measure_renderables(
|
| 126 |
+
console: "Console",
|
| 127 |
+
options: "ConsoleOptions",
|
| 128 |
+
renderables: Sequence["RenderableType"],
|
| 129 |
+
) -> "Measurement":
|
| 130 |
+
"""Get a measurement that would fit a number of renderables.
|
| 131 |
+
|
| 132 |
+
Args:
|
| 133 |
+
console (~rich.console.Console): Console instance.
|
| 134 |
+
options (~rich.console.ConsoleOptions): Console options.
|
| 135 |
+
renderables (Iterable[RenderableType]): One or more renderable objects.
|
| 136 |
+
|
| 137 |
+
Returns:
|
| 138 |
+
Measurement: Measurement object containing range of character widths required to
|
| 139 |
+
contain all given renderables.
|
| 140 |
+
"""
|
| 141 |
+
if not renderables:
|
| 142 |
+
return Measurement(0, 0)
|
| 143 |
+
get_measurement = Measurement.get
|
| 144 |
+
measurements = [
|
| 145 |
+
get_measurement(console, options, renderable) for renderable in renderables
|
| 146 |
+
]
|
| 147 |
+
measured_width = Measurement(
|
| 148 |
+
max(measurements, key=itemgetter(0)).minimum,
|
| 149 |
+
max(measurements, key=itemgetter(1)).maximum,
|
| 150 |
+
)
|
| 151 |
+
return measured_width
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/padding.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import cast, List, Optional, Tuple, TYPE_CHECKING, Union
|
| 2 |
+
|
| 3 |
+
if TYPE_CHECKING:
|
| 4 |
+
from .console import (
|
| 5 |
+
Console,
|
| 6 |
+
ConsoleOptions,
|
| 7 |
+
RenderableType,
|
| 8 |
+
RenderResult,
|
| 9 |
+
)
|
| 10 |
+
from .jupyter import JupyterMixin
|
| 11 |
+
from .measure import Measurement
|
| 12 |
+
from .style import Style
|
| 13 |
+
from .segment import Segment
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
PaddingDimensions = Union[int, Tuple[int], Tuple[int, int], Tuple[int, int, int, int]]
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class Padding(JupyterMixin):
|
| 20 |
+
"""Draw space around content.
|
| 21 |
+
|
| 22 |
+
Example:
|
| 23 |
+
>>> print(Padding("Hello", (2, 4), style="on blue"))
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
renderable (RenderableType): String or other renderable.
|
| 27 |
+
pad (Union[int, Tuple[int]]): Padding for top, right, bottom, and left borders.
|
| 28 |
+
May be specified with 1, 2, or 4 integers (CSS style).
|
| 29 |
+
style (Union[str, Style], optional): Style for padding characters. Defaults to "none".
|
| 30 |
+
expand (bool, optional): Expand padding to fit available width. Defaults to True.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
def __init__(
|
| 34 |
+
self,
|
| 35 |
+
renderable: "RenderableType",
|
| 36 |
+
pad: "PaddingDimensions" = (0, 0, 0, 0),
|
| 37 |
+
*,
|
| 38 |
+
style: Union[str, Style] = "none",
|
| 39 |
+
expand: bool = True,
|
| 40 |
+
):
|
| 41 |
+
self.renderable = renderable
|
| 42 |
+
self.top, self.right, self.bottom, self.left = self.unpack(pad)
|
| 43 |
+
self.style = style
|
| 44 |
+
self.expand = expand
|
| 45 |
+
|
| 46 |
+
@classmethod
|
| 47 |
+
def indent(cls, renderable: "RenderableType", level: int) -> "Padding":
|
| 48 |
+
"""Make padding instance to render an indent.
|
| 49 |
+
|
| 50 |
+
Args:
|
| 51 |
+
renderable (RenderableType): String or other renderable.
|
| 52 |
+
level (int): Number of characters to indent.
|
| 53 |
+
|
| 54 |
+
Returns:
|
| 55 |
+
Padding: A Padding instance.
|
| 56 |
+
"""
|
| 57 |
+
|
| 58 |
+
return Padding(renderable, pad=(0, 0, 0, level), expand=False)
|
| 59 |
+
|
| 60 |
+
@staticmethod
|
| 61 |
+
def unpack(pad: "PaddingDimensions") -> Tuple[int, int, int, int]:
|
| 62 |
+
"""Unpack padding specified in CSS style."""
|
| 63 |
+
if isinstance(pad, int):
|
| 64 |
+
return (pad, pad, pad, pad)
|
| 65 |
+
if len(pad) == 1:
|
| 66 |
+
_pad = pad[0]
|
| 67 |
+
return (_pad, _pad, _pad, _pad)
|
| 68 |
+
if len(pad) == 2:
|
| 69 |
+
pad_top, pad_right = cast(Tuple[int, int], pad)
|
| 70 |
+
return (pad_top, pad_right, pad_top, pad_right)
|
| 71 |
+
if len(pad) == 4:
|
| 72 |
+
top, right, bottom, left = cast(Tuple[int, int, int, int], pad)
|
| 73 |
+
return (top, right, bottom, left)
|
| 74 |
+
raise ValueError(f"1, 2 or 4 integers required for padding; {len(pad)} given")
|
| 75 |
+
|
| 76 |
+
def __repr__(self) -> str:
|
| 77 |
+
return f"Padding({self.renderable!r}, ({self.top},{self.right},{self.bottom},{self.left}))"
|
| 78 |
+
|
| 79 |
+
def __rich_console__(
|
| 80 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 81 |
+
) -> "RenderResult":
|
| 82 |
+
style = console.get_style(self.style)
|
| 83 |
+
if self.expand:
|
| 84 |
+
width = options.max_width
|
| 85 |
+
else:
|
| 86 |
+
width = min(
|
| 87 |
+
Measurement.get(console, options, self.renderable).maximum
|
| 88 |
+
+ self.left
|
| 89 |
+
+ self.right,
|
| 90 |
+
options.max_width,
|
| 91 |
+
)
|
| 92 |
+
render_options = options.update_width(width - self.left - self.right)
|
| 93 |
+
if render_options.height is not None:
|
| 94 |
+
render_options = render_options.update_height(
|
| 95 |
+
height=render_options.height - self.top - self.bottom
|
| 96 |
+
)
|
| 97 |
+
lines = console.render_lines(
|
| 98 |
+
self.renderable, render_options, style=style, pad=True
|
| 99 |
+
)
|
| 100 |
+
_Segment = Segment
|
| 101 |
+
|
| 102 |
+
left = _Segment(" " * self.left, style) if self.left else None
|
| 103 |
+
right = (
|
| 104 |
+
[_Segment(f'{" " * self.right}', style), _Segment.line()]
|
| 105 |
+
if self.right
|
| 106 |
+
else [_Segment.line()]
|
| 107 |
+
)
|
| 108 |
+
blank_line: Optional[List[Segment]] = None
|
| 109 |
+
if self.top:
|
| 110 |
+
blank_line = [_Segment(f'{" " * width}\n', style)]
|
| 111 |
+
yield from blank_line * self.top
|
| 112 |
+
if left:
|
| 113 |
+
for line in lines:
|
| 114 |
+
yield left
|
| 115 |
+
yield from line
|
| 116 |
+
yield from right
|
| 117 |
+
else:
|
| 118 |
+
for line in lines:
|
| 119 |
+
yield from line
|
| 120 |
+
yield from right
|
| 121 |
+
if self.bottom:
|
| 122 |
+
blank_line = blank_line or [_Segment(f'{" " * width}\n', style)]
|
| 123 |
+
yield from blank_line * self.bottom
|
| 124 |
+
|
| 125 |
+
def __rich_measure__(
|
| 126 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 127 |
+
) -> "Measurement":
|
| 128 |
+
max_width = options.max_width
|
| 129 |
+
extra_width = self.left + self.right
|
| 130 |
+
if max_width - extra_width < 1:
|
| 131 |
+
return Measurement(max_width, max_width)
|
| 132 |
+
measure_min, measure_max = Measurement.get(console, options, self.renderable)
|
| 133 |
+
measurement = Measurement(measure_min + extra_width, measure_max + extra_width)
|
| 134 |
+
measurement = measurement.with_maximum(max_width)
|
| 135 |
+
return measurement
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
if __name__ == "__main__": # pragma: no cover
|
| 139 |
+
from pip._vendor.rich import print
|
| 140 |
+
|
| 141 |
+
print(Padding("Hello, World", (2, 4), style="on blue"))
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/pager.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from abc import ABC, abstractmethod
|
| 2 |
+
from typing import Any
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class Pager(ABC):
|
| 6 |
+
"""Base class for a pager."""
|
| 7 |
+
|
| 8 |
+
@abstractmethod
|
| 9 |
+
def show(self, content: str) -> None:
|
| 10 |
+
"""Show content in pager.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
content (str): Content to be displayed.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class SystemPager(Pager):
|
| 18 |
+
"""Uses the pager installed on the system."""
|
| 19 |
+
|
| 20 |
+
def _pager(self, content: str) -> Any: # pragma: no cover
|
| 21 |
+
return __import__("pydoc").pager(content)
|
| 22 |
+
|
| 23 |
+
def show(self, content: str) -> None:
|
| 24 |
+
"""Use the same pager used by pydoc."""
|
| 25 |
+
self._pager(content)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__": # pragma: no cover
|
| 29 |
+
from .__main__ import make_test_card
|
| 30 |
+
from .console import Console
|
| 31 |
+
|
| 32 |
+
console = Console()
|
| 33 |
+
with console.pager(styles=True):
|
| 34 |
+
console.print(make_test_card())
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/palette.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from math import sqrt
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
from typing import Sequence, Tuple, TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
from .color_triplet import ColorTriplet
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from pip._vendor.rich.table import Table
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Palette:
|
| 12 |
+
"""A palette of available colors."""
|
| 13 |
+
|
| 14 |
+
def __init__(self, colors: Sequence[Tuple[int, int, int]]):
|
| 15 |
+
self._colors = colors
|
| 16 |
+
|
| 17 |
+
def __getitem__(self, number: int) -> ColorTriplet:
|
| 18 |
+
return ColorTriplet(*self._colors[number])
|
| 19 |
+
|
| 20 |
+
def __rich__(self) -> "Table":
|
| 21 |
+
from pip._vendor.rich.color import Color
|
| 22 |
+
from pip._vendor.rich.style import Style
|
| 23 |
+
from pip._vendor.rich.text import Text
|
| 24 |
+
from pip._vendor.rich.table import Table
|
| 25 |
+
|
| 26 |
+
table = Table(
|
| 27 |
+
"index",
|
| 28 |
+
"RGB",
|
| 29 |
+
"Color",
|
| 30 |
+
title="Palette",
|
| 31 |
+
caption=f"{len(self._colors)} colors",
|
| 32 |
+
highlight=True,
|
| 33 |
+
caption_justify="right",
|
| 34 |
+
)
|
| 35 |
+
for index, color in enumerate(self._colors):
|
| 36 |
+
table.add_row(
|
| 37 |
+
str(index),
|
| 38 |
+
repr(color),
|
| 39 |
+
Text(" " * 16, style=Style(bgcolor=Color.from_rgb(*color))),
|
| 40 |
+
)
|
| 41 |
+
return table
|
| 42 |
+
|
| 43 |
+
# This is somewhat inefficient and needs caching
|
| 44 |
+
@lru_cache(maxsize=1024)
|
| 45 |
+
def match(self, color: Tuple[int, int, int]) -> int:
|
| 46 |
+
"""Find a color from a palette that most closely matches a given color.
|
| 47 |
+
|
| 48 |
+
Args:
|
| 49 |
+
color (Tuple[int, int, int]): RGB components in range 0 > 255.
|
| 50 |
+
|
| 51 |
+
Returns:
|
| 52 |
+
int: Index of closes matching color.
|
| 53 |
+
"""
|
| 54 |
+
red1, green1, blue1 = color
|
| 55 |
+
_sqrt = sqrt
|
| 56 |
+
get_color = self._colors.__getitem__
|
| 57 |
+
|
| 58 |
+
def get_color_distance(index: int) -> float:
|
| 59 |
+
"""Get the distance to a color."""
|
| 60 |
+
red2, green2, blue2 = get_color(index)
|
| 61 |
+
red_mean = (red1 + red2) // 2
|
| 62 |
+
red = red1 - red2
|
| 63 |
+
green = green1 - green2
|
| 64 |
+
blue = blue1 - blue2
|
| 65 |
+
return _sqrt(
|
| 66 |
+
(((512 + red_mean) * red * red) >> 8)
|
| 67 |
+
+ 4 * green * green
|
| 68 |
+
+ (((767 - red_mean) * blue * blue) >> 8)
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
min_index = min(range(len(self._colors)), key=get_color_distance)
|
| 72 |
+
return min_index
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__": # pragma: no cover
|
| 76 |
+
import colorsys
|
| 77 |
+
from typing import Iterable
|
| 78 |
+
from pip._vendor.rich.color import Color
|
| 79 |
+
from pip._vendor.rich.console import Console, ConsoleOptions
|
| 80 |
+
from pip._vendor.rich.segment import Segment
|
| 81 |
+
from pip._vendor.rich.style import Style
|
| 82 |
+
|
| 83 |
+
class ColorBox:
|
| 84 |
+
def __rich_console__(
|
| 85 |
+
self, console: Console, options: ConsoleOptions
|
| 86 |
+
) -> Iterable[Segment]:
|
| 87 |
+
height = console.size.height - 3
|
| 88 |
+
for y in range(0, height):
|
| 89 |
+
for x in range(options.max_width):
|
| 90 |
+
h = x / options.max_width
|
| 91 |
+
l = y / (height + 1)
|
| 92 |
+
r1, g1, b1 = colorsys.hls_to_rgb(h, l, 1.0)
|
| 93 |
+
r2, g2, b2 = colorsys.hls_to_rgb(h, l + (1 / height / 2), 1.0)
|
| 94 |
+
bgcolor = Color.from_rgb(r1 * 255, g1 * 255, b1 * 255)
|
| 95 |
+
color = Color.from_rgb(r2 * 255, g2 * 255, b2 * 255)
|
| 96 |
+
yield Segment("▄", Style(color=color, bgcolor=bgcolor))
|
| 97 |
+
yield Segment.line()
|
| 98 |
+
|
| 99 |
+
console = Console()
|
| 100 |
+
console.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in
|
| 7 |
+
from .measure import Measurement, measure_renderables
|
| 8 |
+
from .padding import Padding, PaddingDimensions
|
| 9 |
+
from .segment import Segment
|
| 10 |
+
from .style import Style, StyleType
|
| 11 |
+
from .text import Text, TextType
|
| 12 |
+
|
| 13 |
+
if TYPE_CHECKING:
|
| 14 |
+
from .console import Console, ConsoleOptions, RenderableType, RenderResult
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Panel(JupyterMixin):
|
| 18 |
+
"""A console renderable that draws a border around its contents.
|
| 19 |
+
|
| 20 |
+
Example:
|
| 21 |
+
>>> console.print(Panel("Hello, World!"))
|
| 22 |
+
|
| 23 |
+
Args:
|
| 24 |
+
renderable (RenderableType): A console renderable object.
|
| 25 |
+
box (Box, optional): A Box instance that defines the look of the border (see :ref:`appendix_box`.
|
| 26 |
+
Defaults to box.ROUNDED.
|
| 27 |
+
safe_box (bool, optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.
|
| 28 |
+
expand (bool, optional): If True the panel will stretch to fill the console
|
| 29 |
+
width, otherwise it will be sized to fit the contents. Defaults to True.
|
| 30 |
+
style (str, optional): The style of the panel (border and contents). Defaults to "none".
|
| 31 |
+
border_style (str, optional): The style of the border. Defaults to "none".
|
| 32 |
+
width (Optional[int], optional): Optional width of panel. Defaults to None to auto-detect.
|
| 33 |
+
height (Optional[int], optional): Optional height of panel. Defaults to None to auto-detect.
|
| 34 |
+
padding (Optional[PaddingDimensions]): Optional padding around renderable. Defaults to 0.
|
| 35 |
+
highlight (bool, optional): Enable automatic highlighting of panel title (if str). Defaults to False.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
def __init__(
|
| 39 |
+
self,
|
| 40 |
+
renderable: "RenderableType",
|
| 41 |
+
box: Box = ROUNDED,
|
| 42 |
+
*,
|
| 43 |
+
title: Optional[TextType] = None,
|
| 44 |
+
title_align: AlignMethod = "center",
|
| 45 |
+
subtitle: Optional[TextType] = None,
|
| 46 |
+
subtitle_align: AlignMethod = "center",
|
| 47 |
+
safe_box: Optional[bool] = None,
|
| 48 |
+
expand: bool = True,
|
| 49 |
+
style: StyleType = "none",
|
| 50 |
+
border_style: StyleType = "none",
|
| 51 |
+
width: Optional[int] = None,
|
| 52 |
+
height: Optional[int] = None,
|
| 53 |
+
padding: PaddingDimensions = (0, 1),
|
| 54 |
+
highlight: bool = False,
|
| 55 |
+
) -> None:
|
| 56 |
+
self.renderable = renderable
|
| 57 |
+
self.box = box
|
| 58 |
+
self.title = title
|
| 59 |
+
self.title_align: AlignMethod = title_align
|
| 60 |
+
self.subtitle = subtitle
|
| 61 |
+
self.subtitle_align = subtitle_align
|
| 62 |
+
self.safe_box = safe_box
|
| 63 |
+
self.expand = expand
|
| 64 |
+
self.style = style
|
| 65 |
+
self.border_style = border_style
|
| 66 |
+
self.width = width
|
| 67 |
+
self.height = height
|
| 68 |
+
self.padding = padding
|
| 69 |
+
self.highlight = highlight
|
| 70 |
+
|
| 71 |
+
@classmethod
|
| 72 |
+
def fit(
|
| 73 |
+
cls,
|
| 74 |
+
renderable: "RenderableType",
|
| 75 |
+
box: Box = ROUNDED,
|
| 76 |
+
*,
|
| 77 |
+
title: Optional[TextType] = None,
|
| 78 |
+
title_align: AlignMethod = "center",
|
| 79 |
+
subtitle: Optional[TextType] = None,
|
| 80 |
+
subtitle_align: AlignMethod = "center",
|
| 81 |
+
safe_box: Optional[bool] = None,
|
| 82 |
+
style: StyleType = "none",
|
| 83 |
+
border_style: StyleType = "none",
|
| 84 |
+
width: Optional[int] = None,
|
| 85 |
+
padding: PaddingDimensions = (0, 1),
|
| 86 |
+
) -> "Panel":
|
| 87 |
+
"""An alternative constructor that sets expand=False."""
|
| 88 |
+
return cls(
|
| 89 |
+
renderable,
|
| 90 |
+
box,
|
| 91 |
+
title=title,
|
| 92 |
+
title_align=title_align,
|
| 93 |
+
subtitle=subtitle,
|
| 94 |
+
subtitle_align=subtitle_align,
|
| 95 |
+
safe_box=safe_box,
|
| 96 |
+
style=style,
|
| 97 |
+
border_style=border_style,
|
| 98 |
+
width=width,
|
| 99 |
+
padding=padding,
|
| 100 |
+
expand=False,
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def _title(self) -> Optional[Text]:
|
| 105 |
+
if self.title:
|
| 106 |
+
title_text = (
|
| 107 |
+
Text.from_markup(self.title)
|
| 108 |
+
if isinstance(self.title, str)
|
| 109 |
+
else self.title.copy()
|
| 110 |
+
)
|
| 111 |
+
title_text.end = ""
|
| 112 |
+
title_text.plain = title_text.plain.replace("\n", " ")
|
| 113 |
+
title_text.no_wrap = True
|
| 114 |
+
title_text.expand_tabs()
|
| 115 |
+
title_text.pad(1)
|
| 116 |
+
return title_text
|
| 117 |
+
return None
|
| 118 |
+
|
| 119 |
+
@property
|
| 120 |
+
def _subtitle(self) -> Optional[Text]:
|
| 121 |
+
if self.subtitle:
|
| 122 |
+
subtitle_text = (
|
| 123 |
+
Text.from_markup(self.subtitle)
|
| 124 |
+
if isinstance(self.subtitle, str)
|
| 125 |
+
else self.subtitle.copy()
|
| 126 |
+
)
|
| 127 |
+
subtitle_text.end = ""
|
| 128 |
+
subtitle_text.plain = subtitle_text.plain.replace("\n", " ")
|
| 129 |
+
subtitle_text.no_wrap = True
|
| 130 |
+
subtitle_text.expand_tabs()
|
| 131 |
+
subtitle_text.pad(1)
|
| 132 |
+
return subtitle_text
|
| 133 |
+
return None
|
| 134 |
+
|
| 135 |
+
def __rich_console__(
|
| 136 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 137 |
+
) -> "RenderResult":
|
| 138 |
+
_padding = Padding.unpack(self.padding)
|
| 139 |
+
renderable = (
|
| 140 |
+
Padding(self.renderable, _padding) if any(_padding) else self.renderable
|
| 141 |
+
)
|
| 142 |
+
style = console.get_style(self.style)
|
| 143 |
+
border_style = style + console.get_style(self.border_style)
|
| 144 |
+
width = (
|
| 145 |
+
options.max_width
|
| 146 |
+
if self.width is None
|
| 147 |
+
else min(options.max_width, self.width)
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
safe_box: bool = console.safe_box if self.safe_box is None else self.safe_box
|
| 151 |
+
box = self.box.substitute(options, safe=safe_box)
|
| 152 |
+
|
| 153 |
+
def align_text(
|
| 154 |
+
text: Text, width: int, align: str, character: str, style: Style
|
| 155 |
+
) -> Text:
|
| 156 |
+
"""Gets new aligned text.
|
| 157 |
+
|
| 158 |
+
Args:
|
| 159 |
+
text (Text): Title or subtitle text.
|
| 160 |
+
width (int): Desired width.
|
| 161 |
+
align (str): Alignment.
|
| 162 |
+
character (str): Character for alignment.
|
| 163 |
+
style (Style): Border style
|
| 164 |
+
|
| 165 |
+
Returns:
|
| 166 |
+
Text: New text instance
|
| 167 |
+
"""
|
| 168 |
+
text = text.copy()
|
| 169 |
+
text.truncate(width)
|
| 170 |
+
excess_space = width - cell_len(text.plain)
|
| 171 |
+
if excess_space:
|
| 172 |
+
if align == "left":
|
| 173 |
+
return Text.assemble(
|
| 174 |
+
text,
|
| 175 |
+
(character * excess_space, style),
|
| 176 |
+
no_wrap=True,
|
| 177 |
+
end="",
|
| 178 |
+
)
|
| 179 |
+
elif align == "center":
|
| 180 |
+
left = excess_space // 2
|
| 181 |
+
return Text.assemble(
|
| 182 |
+
(character * left, style),
|
| 183 |
+
text,
|
| 184 |
+
(character * (excess_space - left), style),
|
| 185 |
+
no_wrap=True,
|
| 186 |
+
end="",
|
| 187 |
+
)
|
| 188 |
+
else:
|
| 189 |
+
return Text.assemble(
|
| 190 |
+
(character * excess_space, style),
|
| 191 |
+
text,
|
| 192 |
+
no_wrap=True,
|
| 193 |
+
end="",
|
| 194 |
+
)
|
| 195 |
+
return text
|
| 196 |
+
|
| 197 |
+
title_text = self._title
|
| 198 |
+
if title_text is not None:
|
| 199 |
+
title_text.stylize_before(border_style)
|
| 200 |
+
|
| 201 |
+
child_width = (
|
| 202 |
+
width - 2
|
| 203 |
+
if self.expand
|
| 204 |
+
else console.measure(
|
| 205 |
+
renderable, options=options.update_width(width - 2)
|
| 206 |
+
).maximum
|
| 207 |
+
)
|
| 208 |
+
child_height = self.height or options.height or None
|
| 209 |
+
if child_height:
|
| 210 |
+
child_height -= 2
|
| 211 |
+
if title_text is not None:
|
| 212 |
+
child_width = min(
|
| 213 |
+
options.max_width - 2, max(child_width, title_text.cell_len + 2)
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
width = child_width + 2
|
| 217 |
+
child_options = options.update(
|
| 218 |
+
width=child_width, height=child_height, highlight=self.highlight
|
| 219 |
+
)
|
| 220 |
+
lines = console.render_lines(renderable, child_options, style=style)
|
| 221 |
+
|
| 222 |
+
line_start = Segment(box.mid_left, border_style)
|
| 223 |
+
line_end = Segment(f"{box.mid_right}", border_style)
|
| 224 |
+
new_line = Segment.line()
|
| 225 |
+
if title_text is None or width <= 4:
|
| 226 |
+
yield Segment(box.get_top([width - 2]), border_style)
|
| 227 |
+
else:
|
| 228 |
+
title_text = align_text(
|
| 229 |
+
title_text,
|
| 230 |
+
width - 4,
|
| 231 |
+
self.title_align,
|
| 232 |
+
box.top,
|
| 233 |
+
border_style,
|
| 234 |
+
)
|
| 235 |
+
yield Segment(box.top_left + box.top, border_style)
|
| 236 |
+
yield from console.render(title_text, child_options.update_width(width - 4))
|
| 237 |
+
yield Segment(box.top + box.top_right, border_style)
|
| 238 |
+
|
| 239 |
+
yield new_line
|
| 240 |
+
for line in lines:
|
| 241 |
+
yield line_start
|
| 242 |
+
yield from line
|
| 243 |
+
yield line_end
|
| 244 |
+
yield new_line
|
| 245 |
+
|
| 246 |
+
subtitle_text = self._subtitle
|
| 247 |
+
if subtitle_text is not None:
|
| 248 |
+
subtitle_text.stylize_before(border_style)
|
| 249 |
+
|
| 250 |
+
if subtitle_text is None or width <= 4:
|
| 251 |
+
yield Segment(box.get_bottom([width - 2]), border_style)
|
| 252 |
+
else:
|
| 253 |
+
subtitle_text = align_text(
|
| 254 |
+
subtitle_text,
|
| 255 |
+
width - 4,
|
| 256 |
+
self.subtitle_align,
|
| 257 |
+
box.bottom,
|
| 258 |
+
border_style,
|
| 259 |
+
)
|
| 260 |
+
yield Segment(box.bottom_left + box.bottom, border_style)
|
| 261 |
+
yield from console.render(
|
| 262 |
+
subtitle_text, child_options.update_width(width - 4)
|
| 263 |
+
)
|
| 264 |
+
yield Segment(box.bottom + box.bottom_right, border_style)
|
| 265 |
+
|
| 266 |
+
yield new_line
|
| 267 |
+
|
| 268 |
+
def __rich_measure__(
|
| 269 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 270 |
+
) -> "Measurement":
|
| 271 |
+
_title = self._title
|
| 272 |
+
_, right, _, left = Padding.unpack(self.padding)
|
| 273 |
+
padding = left + right
|
| 274 |
+
renderables = [self.renderable, _title] if _title else [self.renderable]
|
| 275 |
+
|
| 276 |
+
if self.width is None:
|
| 277 |
+
width = (
|
| 278 |
+
measure_renderables(
|
| 279 |
+
console,
|
| 280 |
+
options.update_width(options.max_width - padding - 2),
|
| 281 |
+
renderables,
|
| 282 |
+
).maximum
|
| 283 |
+
+ padding
|
| 284 |
+
+ 2
|
| 285 |
+
)
|
| 286 |
+
else:
|
| 287 |
+
width = self.width
|
| 288 |
+
return Measurement(width, width)
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
if __name__ == "__main__": # pragma: no cover
|
| 292 |
+
from .console import Console
|
| 293 |
+
|
| 294 |
+
c = Console()
|
| 295 |
+
|
| 296 |
+
from .box import DOUBLE, ROUNDED
|
| 297 |
+
from .padding import Padding
|
| 298 |
+
|
| 299 |
+
p = Panel(
|
| 300 |
+
"Hello, World!",
|
| 301 |
+
title="rich.Panel",
|
| 302 |
+
style="white on blue",
|
| 303 |
+
box=DOUBLE,
|
| 304 |
+
padding=1,
|
| 305 |
+
)
|
| 306 |
+
|
| 307 |
+
c.print()
|
| 308 |
+
c.print(p)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/pretty.py
ADDED
|
@@ -0,0 +1,994 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import builtins
|
| 2 |
+
import collections
|
| 3 |
+
import dataclasses
|
| 4 |
+
import inspect
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
from array import array
|
| 8 |
+
from collections import Counter, UserDict, UserList, defaultdict, deque
|
| 9 |
+
from dataclasses import dataclass, fields, is_dataclass
|
| 10 |
+
from inspect import isclass
|
| 11 |
+
from itertools import islice
|
| 12 |
+
from types import MappingProxyType
|
| 13 |
+
from typing import (
|
| 14 |
+
TYPE_CHECKING,
|
| 15 |
+
Any,
|
| 16 |
+
Callable,
|
| 17 |
+
DefaultDict,
|
| 18 |
+
Dict,
|
| 19 |
+
Iterable,
|
| 20 |
+
List,
|
| 21 |
+
Optional,
|
| 22 |
+
Sequence,
|
| 23 |
+
Set,
|
| 24 |
+
Tuple,
|
| 25 |
+
Union,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
from pip._vendor.rich.repr import RichReprResult
|
| 29 |
+
|
| 30 |
+
try:
|
| 31 |
+
import attr as _attr_module
|
| 32 |
+
|
| 33 |
+
_has_attrs = hasattr(_attr_module, "ib")
|
| 34 |
+
except ImportError: # pragma: no cover
|
| 35 |
+
_has_attrs = False
|
| 36 |
+
|
| 37 |
+
from . import get_console
|
| 38 |
+
from ._loop import loop_last
|
| 39 |
+
from ._pick import pick_bool
|
| 40 |
+
from .abc import RichRenderable
|
| 41 |
+
from .cells import cell_len
|
| 42 |
+
from .highlighter import ReprHighlighter
|
| 43 |
+
from .jupyter import JupyterMixin, JupyterRenderable
|
| 44 |
+
from .measure import Measurement
|
| 45 |
+
from .text import Text
|
| 46 |
+
|
| 47 |
+
if TYPE_CHECKING:
|
| 48 |
+
from .console import (
|
| 49 |
+
Console,
|
| 50 |
+
ConsoleOptions,
|
| 51 |
+
HighlighterType,
|
| 52 |
+
JustifyMethod,
|
| 53 |
+
OverflowMethod,
|
| 54 |
+
RenderResult,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def _is_attr_object(obj: Any) -> bool:
|
| 59 |
+
"""Check if an object was created with attrs module."""
|
| 60 |
+
return _has_attrs and _attr_module.has(type(obj))
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def _get_attr_fields(obj: Any) -> Sequence["_attr_module.Attribute[Any]"]:
|
| 64 |
+
"""Get fields for an attrs object."""
|
| 65 |
+
return _attr_module.fields(type(obj)) if _has_attrs else []
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def _is_dataclass_repr(obj: object) -> bool:
|
| 69 |
+
"""Check if an instance of a dataclass contains the default repr.
|
| 70 |
+
|
| 71 |
+
Args:
|
| 72 |
+
obj (object): A dataclass instance.
|
| 73 |
+
|
| 74 |
+
Returns:
|
| 75 |
+
bool: True if the default repr is used, False if there is a custom repr.
|
| 76 |
+
"""
|
| 77 |
+
# Digging in to a lot of internals here
|
| 78 |
+
# Catching all exceptions in case something is missing on a non CPython implementation
|
| 79 |
+
try:
|
| 80 |
+
return obj.__repr__.__code__.co_filename == dataclasses.__file__
|
| 81 |
+
except Exception: # pragma: no coverage
|
| 82 |
+
return False
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
_dummy_namedtuple = collections.namedtuple("_dummy_namedtuple", [])
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def _has_default_namedtuple_repr(obj: object) -> bool:
|
| 89 |
+
"""Check if an instance of namedtuple contains the default repr
|
| 90 |
+
|
| 91 |
+
Args:
|
| 92 |
+
obj (object): A namedtuple
|
| 93 |
+
|
| 94 |
+
Returns:
|
| 95 |
+
bool: True if the default repr is used, False if there's a custom repr.
|
| 96 |
+
"""
|
| 97 |
+
obj_file = None
|
| 98 |
+
try:
|
| 99 |
+
obj_file = inspect.getfile(obj.__repr__)
|
| 100 |
+
except (OSError, TypeError):
|
| 101 |
+
# OSError handles case where object is defined in __main__ scope, e.g. REPL - no filename available.
|
| 102 |
+
# TypeError trapped defensively, in case of object without filename slips through.
|
| 103 |
+
pass
|
| 104 |
+
default_repr_file = inspect.getfile(_dummy_namedtuple.__repr__)
|
| 105 |
+
return obj_file == default_repr_file
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def _ipy_display_hook(
|
| 109 |
+
value: Any,
|
| 110 |
+
console: Optional["Console"] = None,
|
| 111 |
+
overflow: "OverflowMethod" = "ignore",
|
| 112 |
+
crop: bool = False,
|
| 113 |
+
indent_guides: bool = False,
|
| 114 |
+
max_length: Optional[int] = None,
|
| 115 |
+
max_string: Optional[int] = None,
|
| 116 |
+
max_depth: Optional[int] = None,
|
| 117 |
+
expand_all: bool = False,
|
| 118 |
+
) -> Union[str, None]:
|
| 119 |
+
# needed here to prevent circular import:
|
| 120 |
+
from .console import ConsoleRenderable
|
| 121 |
+
|
| 122 |
+
# always skip rich generated jupyter renderables or None values
|
| 123 |
+
if _safe_isinstance(value, JupyterRenderable) or value is None:
|
| 124 |
+
return None
|
| 125 |
+
|
| 126 |
+
console = console or get_console()
|
| 127 |
+
|
| 128 |
+
with console.capture() as capture:
|
| 129 |
+
# certain renderables should start on a new line
|
| 130 |
+
if _safe_isinstance(value, ConsoleRenderable):
|
| 131 |
+
console.line()
|
| 132 |
+
console.print(
|
| 133 |
+
value
|
| 134 |
+
if _safe_isinstance(value, RichRenderable)
|
| 135 |
+
else Pretty(
|
| 136 |
+
value,
|
| 137 |
+
overflow=overflow,
|
| 138 |
+
indent_guides=indent_guides,
|
| 139 |
+
max_length=max_length,
|
| 140 |
+
max_string=max_string,
|
| 141 |
+
max_depth=max_depth,
|
| 142 |
+
expand_all=expand_all,
|
| 143 |
+
margin=12,
|
| 144 |
+
),
|
| 145 |
+
crop=crop,
|
| 146 |
+
new_line_start=True,
|
| 147 |
+
end="",
|
| 148 |
+
)
|
| 149 |
+
# strip trailing newline, not usually part of a text repr
|
| 150 |
+
# I'm not sure if this should be prevented at a lower level
|
| 151 |
+
return capture.get().rstrip("\n")
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def _safe_isinstance(
|
| 155 |
+
obj: object, class_or_tuple: Union[type, Tuple[type, ...]]
|
| 156 |
+
) -> bool:
|
| 157 |
+
"""isinstance can fail in rare cases, for example types with no __class__"""
|
| 158 |
+
try:
|
| 159 |
+
return isinstance(obj, class_or_tuple)
|
| 160 |
+
except Exception:
|
| 161 |
+
return False
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def install(
|
| 165 |
+
console: Optional["Console"] = None,
|
| 166 |
+
overflow: "OverflowMethod" = "ignore",
|
| 167 |
+
crop: bool = False,
|
| 168 |
+
indent_guides: bool = False,
|
| 169 |
+
max_length: Optional[int] = None,
|
| 170 |
+
max_string: Optional[int] = None,
|
| 171 |
+
max_depth: Optional[int] = None,
|
| 172 |
+
expand_all: bool = False,
|
| 173 |
+
) -> None:
|
| 174 |
+
"""Install automatic pretty printing in the Python REPL.
|
| 175 |
+
|
| 176 |
+
Args:
|
| 177 |
+
console (Console, optional): Console instance or ``None`` to use global console. Defaults to None.
|
| 178 |
+
overflow (Optional[OverflowMethod], optional): Overflow method. Defaults to "ignore".
|
| 179 |
+
crop (Optional[bool], optional): Enable cropping of long lines. Defaults to False.
|
| 180 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
| 181 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 182 |
+
Defaults to None.
|
| 183 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
| 184 |
+
max_depth (int, optional): Maximum depth of nested data structures, or None for no maximum. Defaults to None.
|
| 185 |
+
expand_all (bool, optional): Expand all containers. Defaults to False.
|
| 186 |
+
max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.
|
| 187 |
+
"""
|
| 188 |
+
from pip._vendor.rich import get_console
|
| 189 |
+
|
| 190 |
+
console = console or get_console()
|
| 191 |
+
assert console is not None
|
| 192 |
+
|
| 193 |
+
def display_hook(value: Any) -> None:
|
| 194 |
+
"""Replacement sys.displayhook which prettifies objects with Rich."""
|
| 195 |
+
if value is not None:
|
| 196 |
+
assert console is not None
|
| 197 |
+
builtins._ = None # type: ignore[attr-defined]
|
| 198 |
+
console.print(
|
| 199 |
+
value
|
| 200 |
+
if _safe_isinstance(value, RichRenderable)
|
| 201 |
+
else Pretty(
|
| 202 |
+
value,
|
| 203 |
+
overflow=overflow,
|
| 204 |
+
indent_guides=indent_guides,
|
| 205 |
+
max_length=max_length,
|
| 206 |
+
max_string=max_string,
|
| 207 |
+
max_depth=max_depth,
|
| 208 |
+
expand_all=expand_all,
|
| 209 |
+
),
|
| 210 |
+
crop=crop,
|
| 211 |
+
)
|
| 212 |
+
builtins._ = value # type: ignore[attr-defined]
|
| 213 |
+
|
| 214 |
+
if "get_ipython" in globals():
|
| 215 |
+
ip = get_ipython() # type: ignore[name-defined]
|
| 216 |
+
from IPython.core.formatters import BaseFormatter
|
| 217 |
+
|
| 218 |
+
class RichFormatter(BaseFormatter): # type: ignore[misc]
|
| 219 |
+
pprint: bool = True
|
| 220 |
+
|
| 221 |
+
def __call__(self, value: Any) -> Any:
|
| 222 |
+
if self.pprint:
|
| 223 |
+
return _ipy_display_hook(
|
| 224 |
+
value,
|
| 225 |
+
console=get_console(),
|
| 226 |
+
overflow=overflow,
|
| 227 |
+
indent_guides=indent_guides,
|
| 228 |
+
max_length=max_length,
|
| 229 |
+
max_string=max_string,
|
| 230 |
+
max_depth=max_depth,
|
| 231 |
+
expand_all=expand_all,
|
| 232 |
+
)
|
| 233 |
+
else:
|
| 234 |
+
return repr(value)
|
| 235 |
+
|
| 236 |
+
# replace plain text formatter with rich formatter
|
| 237 |
+
rich_formatter = RichFormatter()
|
| 238 |
+
ip.display_formatter.formatters["text/plain"] = rich_formatter
|
| 239 |
+
else:
|
| 240 |
+
sys.displayhook = display_hook
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
class Pretty(JupyterMixin):
|
| 244 |
+
"""A rich renderable that pretty prints an object.
|
| 245 |
+
|
| 246 |
+
Args:
|
| 247 |
+
_object (Any): An object to pretty print.
|
| 248 |
+
highlighter (HighlighterType, optional): Highlighter object to apply to result, or None for ReprHighlighter. Defaults to None.
|
| 249 |
+
indent_size (int, optional): Number of spaces in indent. Defaults to 4.
|
| 250 |
+
justify (JustifyMethod, optional): Justify method, or None for default. Defaults to None.
|
| 251 |
+
overflow (OverflowMethod, optional): Overflow method, or None for default. Defaults to None.
|
| 252 |
+
no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to False.
|
| 253 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
| 254 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 255 |
+
Defaults to None.
|
| 256 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
| 257 |
+
max_depth (int, optional): Maximum depth of nested data structures, or None for no maximum. Defaults to None.
|
| 258 |
+
expand_all (bool, optional): Expand all containers. Defaults to False.
|
| 259 |
+
margin (int, optional): Subtrace a margin from width to force containers to expand earlier. Defaults to 0.
|
| 260 |
+
insert_line (bool, optional): Insert a new line if the output has multiple new lines. Defaults to False.
|
| 261 |
+
"""
|
| 262 |
+
|
| 263 |
+
def __init__(
|
| 264 |
+
self,
|
| 265 |
+
_object: Any,
|
| 266 |
+
highlighter: Optional["HighlighterType"] = None,
|
| 267 |
+
*,
|
| 268 |
+
indent_size: int = 4,
|
| 269 |
+
justify: Optional["JustifyMethod"] = None,
|
| 270 |
+
overflow: Optional["OverflowMethod"] = None,
|
| 271 |
+
no_wrap: Optional[bool] = False,
|
| 272 |
+
indent_guides: bool = False,
|
| 273 |
+
max_length: Optional[int] = None,
|
| 274 |
+
max_string: Optional[int] = None,
|
| 275 |
+
max_depth: Optional[int] = None,
|
| 276 |
+
expand_all: bool = False,
|
| 277 |
+
margin: int = 0,
|
| 278 |
+
insert_line: bool = False,
|
| 279 |
+
) -> None:
|
| 280 |
+
self._object = _object
|
| 281 |
+
self.highlighter = highlighter or ReprHighlighter()
|
| 282 |
+
self.indent_size = indent_size
|
| 283 |
+
self.justify: Optional["JustifyMethod"] = justify
|
| 284 |
+
self.overflow: Optional["OverflowMethod"] = overflow
|
| 285 |
+
self.no_wrap = no_wrap
|
| 286 |
+
self.indent_guides = indent_guides
|
| 287 |
+
self.max_length = max_length
|
| 288 |
+
self.max_string = max_string
|
| 289 |
+
self.max_depth = max_depth
|
| 290 |
+
self.expand_all = expand_all
|
| 291 |
+
self.margin = margin
|
| 292 |
+
self.insert_line = insert_line
|
| 293 |
+
|
| 294 |
+
def __rich_console__(
|
| 295 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 296 |
+
) -> "RenderResult":
|
| 297 |
+
pretty_str = pretty_repr(
|
| 298 |
+
self._object,
|
| 299 |
+
max_width=options.max_width - self.margin,
|
| 300 |
+
indent_size=self.indent_size,
|
| 301 |
+
max_length=self.max_length,
|
| 302 |
+
max_string=self.max_string,
|
| 303 |
+
max_depth=self.max_depth,
|
| 304 |
+
expand_all=self.expand_all,
|
| 305 |
+
)
|
| 306 |
+
pretty_text = Text.from_ansi(
|
| 307 |
+
pretty_str,
|
| 308 |
+
justify=self.justify or options.justify,
|
| 309 |
+
overflow=self.overflow or options.overflow,
|
| 310 |
+
no_wrap=pick_bool(self.no_wrap, options.no_wrap),
|
| 311 |
+
style="pretty",
|
| 312 |
+
)
|
| 313 |
+
pretty_text = (
|
| 314 |
+
self.highlighter(pretty_text)
|
| 315 |
+
if pretty_text
|
| 316 |
+
else Text(
|
| 317 |
+
f"{type(self._object)}.__repr__ returned empty string",
|
| 318 |
+
style="dim italic",
|
| 319 |
+
)
|
| 320 |
+
)
|
| 321 |
+
if self.indent_guides and not options.ascii_only:
|
| 322 |
+
pretty_text = pretty_text.with_indent_guides(
|
| 323 |
+
self.indent_size, style="repr.indent"
|
| 324 |
+
)
|
| 325 |
+
if self.insert_line and "\n" in pretty_text:
|
| 326 |
+
yield ""
|
| 327 |
+
yield pretty_text
|
| 328 |
+
|
| 329 |
+
def __rich_measure__(
|
| 330 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 331 |
+
) -> "Measurement":
|
| 332 |
+
pretty_str = pretty_repr(
|
| 333 |
+
self._object,
|
| 334 |
+
max_width=options.max_width,
|
| 335 |
+
indent_size=self.indent_size,
|
| 336 |
+
max_length=self.max_length,
|
| 337 |
+
max_string=self.max_string,
|
| 338 |
+
max_depth=self.max_depth,
|
| 339 |
+
expand_all=self.expand_all,
|
| 340 |
+
)
|
| 341 |
+
text_width = (
|
| 342 |
+
max(cell_len(line) for line in pretty_str.splitlines()) if pretty_str else 0
|
| 343 |
+
)
|
| 344 |
+
return Measurement(text_width, text_width)
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
def _get_braces_for_defaultdict(_object: DefaultDict[Any, Any]) -> Tuple[str, str, str]:
|
| 348 |
+
return (
|
| 349 |
+
f"defaultdict({_object.default_factory!r}, {{",
|
| 350 |
+
"})",
|
| 351 |
+
f"defaultdict({_object.default_factory!r}, {{}})",
|
| 352 |
+
)
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
def _get_braces_for_array(_object: "array[Any]") -> Tuple[str, str, str]:
|
| 356 |
+
return (f"array({_object.typecode!r}, [", "])", f"array({_object.typecode!r})")
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
_BRACES: Dict[type, Callable[[Any], Tuple[str, str, str]]] = {
|
| 360 |
+
os._Environ: lambda _object: ("environ({", "})", "environ({})"),
|
| 361 |
+
array: _get_braces_for_array,
|
| 362 |
+
defaultdict: _get_braces_for_defaultdict,
|
| 363 |
+
Counter: lambda _object: ("Counter({", "})", "Counter()"),
|
| 364 |
+
deque: lambda _object: ("deque([", "])", "deque()"),
|
| 365 |
+
dict: lambda _object: ("{", "}", "{}"),
|
| 366 |
+
UserDict: lambda _object: ("{", "}", "{}"),
|
| 367 |
+
frozenset: lambda _object: ("frozenset({", "})", "frozenset()"),
|
| 368 |
+
list: lambda _object: ("[", "]", "[]"),
|
| 369 |
+
UserList: lambda _object: ("[", "]", "[]"),
|
| 370 |
+
set: lambda _object: ("{", "}", "set()"),
|
| 371 |
+
tuple: lambda _object: ("(", ")", "()"),
|
| 372 |
+
MappingProxyType: lambda _object: ("mappingproxy({", "})", "mappingproxy({})"),
|
| 373 |
+
}
|
| 374 |
+
_CONTAINERS = tuple(_BRACES.keys())
|
| 375 |
+
_MAPPING_CONTAINERS = (dict, os._Environ, MappingProxyType, UserDict)
|
| 376 |
+
|
| 377 |
+
|
| 378 |
+
def is_expandable(obj: Any) -> bool:
|
| 379 |
+
"""Check if an object may be expanded by pretty print."""
|
| 380 |
+
return (
|
| 381 |
+
_safe_isinstance(obj, _CONTAINERS)
|
| 382 |
+
or (is_dataclass(obj))
|
| 383 |
+
or (hasattr(obj, "__rich_repr__"))
|
| 384 |
+
or _is_attr_object(obj)
|
| 385 |
+
) and not isclass(obj)
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
@dataclass
|
| 389 |
+
class Node:
|
| 390 |
+
"""A node in a repr tree. May be atomic or a container."""
|
| 391 |
+
|
| 392 |
+
key_repr: str = ""
|
| 393 |
+
value_repr: str = ""
|
| 394 |
+
open_brace: str = ""
|
| 395 |
+
close_brace: str = ""
|
| 396 |
+
empty: str = ""
|
| 397 |
+
last: bool = False
|
| 398 |
+
is_tuple: bool = False
|
| 399 |
+
is_namedtuple: bool = False
|
| 400 |
+
children: Optional[List["Node"]] = None
|
| 401 |
+
key_separator: str = ": "
|
| 402 |
+
separator: str = ", "
|
| 403 |
+
|
| 404 |
+
def iter_tokens(self) -> Iterable[str]:
|
| 405 |
+
"""Generate tokens for this node."""
|
| 406 |
+
if self.key_repr:
|
| 407 |
+
yield self.key_repr
|
| 408 |
+
yield self.key_separator
|
| 409 |
+
if self.value_repr:
|
| 410 |
+
yield self.value_repr
|
| 411 |
+
elif self.children is not None:
|
| 412 |
+
if self.children:
|
| 413 |
+
yield self.open_brace
|
| 414 |
+
if self.is_tuple and not self.is_namedtuple and len(self.children) == 1:
|
| 415 |
+
yield from self.children[0].iter_tokens()
|
| 416 |
+
yield ","
|
| 417 |
+
else:
|
| 418 |
+
for child in self.children:
|
| 419 |
+
yield from child.iter_tokens()
|
| 420 |
+
if not child.last:
|
| 421 |
+
yield self.separator
|
| 422 |
+
yield self.close_brace
|
| 423 |
+
else:
|
| 424 |
+
yield self.empty
|
| 425 |
+
|
| 426 |
+
def check_length(self, start_length: int, max_length: int) -> bool:
|
| 427 |
+
"""Check the length fits within a limit.
|
| 428 |
+
|
| 429 |
+
Args:
|
| 430 |
+
start_length (int): Starting length of the line (indent, prefix, suffix).
|
| 431 |
+
max_length (int): Maximum length.
|
| 432 |
+
|
| 433 |
+
Returns:
|
| 434 |
+
bool: True if the node can be rendered within max length, otherwise False.
|
| 435 |
+
"""
|
| 436 |
+
total_length = start_length
|
| 437 |
+
for token in self.iter_tokens():
|
| 438 |
+
total_length += cell_len(token)
|
| 439 |
+
if total_length > max_length:
|
| 440 |
+
return False
|
| 441 |
+
return True
|
| 442 |
+
|
| 443 |
+
def __str__(self) -> str:
|
| 444 |
+
repr_text = "".join(self.iter_tokens())
|
| 445 |
+
return repr_text
|
| 446 |
+
|
| 447 |
+
def render(
|
| 448 |
+
self, max_width: int = 80, indent_size: int = 4, expand_all: bool = False
|
| 449 |
+
) -> str:
|
| 450 |
+
"""Render the node to a pretty repr.
|
| 451 |
+
|
| 452 |
+
Args:
|
| 453 |
+
max_width (int, optional): Maximum width of the repr. Defaults to 80.
|
| 454 |
+
indent_size (int, optional): Size of indents. Defaults to 4.
|
| 455 |
+
expand_all (bool, optional): Expand all levels. Defaults to False.
|
| 456 |
+
|
| 457 |
+
Returns:
|
| 458 |
+
str: A repr string of the original object.
|
| 459 |
+
"""
|
| 460 |
+
lines = [_Line(node=self, is_root=True)]
|
| 461 |
+
line_no = 0
|
| 462 |
+
while line_no < len(lines):
|
| 463 |
+
line = lines[line_no]
|
| 464 |
+
if line.expandable and not line.expanded:
|
| 465 |
+
if expand_all or not line.check_length(max_width):
|
| 466 |
+
lines[line_no : line_no + 1] = line.expand(indent_size)
|
| 467 |
+
line_no += 1
|
| 468 |
+
|
| 469 |
+
repr_str = "\n".join(str(line) for line in lines)
|
| 470 |
+
return repr_str
|
| 471 |
+
|
| 472 |
+
|
| 473 |
+
@dataclass
|
| 474 |
+
class _Line:
|
| 475 |
+
"""A line in repr output."""
|
| 476 |
+
|
| 477 |
+
parent: Optional["_Line"] = None
|
| 478 |
+
is_root: bool = False
|
| 479 |
+
node: Optional[Node] = None
|
| 480 |
+
text: str = ""
|
| 481 |
+
suffix: str = ""
|
| 482 |
+
whitespace: str = ""
|
| 483 |
+
expanded: bool = False
|
| 484 |
+
last: bool = False
|
| 485 |
+
|
| 486 |
+
@property
|
| 487 |
+
def expandable(self) -> bool:
|
| 488 |
+
"""Check if the line may be expanded."""
|
| 489 |
+
return bool(self.node is not None and self.node.children)
|
| 490 |
+
|
| 491 |
+
def check_length(self, max_length: int) -> bool:
|
| 492 |
+
"""Check this line fits within a given number of cells."""
|
| 493 |
+
start_length = (
|
| 494 |
+
len(self.whitespace) + cell_len(self.text) + cell_len(self.suffix)
|
| 495 |
+
)
|
| 496 |
+
assert self.node is not None
|
| 497 |
+
return self.node.check_length(start_length, max_length)
|
| 498 |
+
|
| 499 |
+
def expand(self, indent_size: int) -> Iterable["_Line"]:
|
| 500 |
+
"""Expand this line by adding children on their own line."""
|
| 501 |
+
node = self.node
|
| 502 |
+
assert node is not None
|
| 503 |
+
whitespace = self.whitespace
|
| 504 |
+
assert node.children
|
| 505 |
+
if node.key_repr:
|
| 506 |
+
new_line = yield _Line(
|
| 507 |
+
text=f"{node.key_repr}{node.key_separator}{node.open_brace}",
|
| 508 |
+
whitespace=whitespace,
|
| 509 |
+
)
|
| 510 |
+
else:
|
| 511 |
+
new_line = yield _Line(text=node.open_brace, whitespace=whitespace)
|
| 512 |
+
child_whitespace = self.whitespace + " " * indent_size
|
| 513 |
+
tuple_of_one = node.is_tuple and len(node.children) == 1
|
| 514 |
+
for last, child in loop_last(node.children):
|
| 515 |
+
separator = "," if tuple_of_one else node.separator
|
| 516 |
+
line = _Line(
|
| 517 |
+
parent=new_line,
|
| 518 |
+
node=child,
|
| 519 |
+
whitespace=child_whitespace,
|
| 520 |
+
suffix=separator,
|
| 521 |
+
last=last and not tuple_of_one,
|
| 522 |
+
)
|
| 523 |
+
yield line
|
| 524 |
+
|
| 525 |
+
yield _Line(
|
| 526 |
+
text=node.close_brace,
|
| 527 |
+
whitespace=whitespace,
|
| 528 |
+
suffix=self.suffix,
|
| 529 |
+
last=self.last,
|
| 530 |
+
)
|
| 531 |
+
|
| 532 |
+
def __str__(self) -> str:
|
| 533 |
+
if self.last:
|
| 534 |
+
return f"{self.whitespace}{self.text}{self.node or ''}"
|
| 535 |
+
else:
|
| 536 |
+
return (
|
| 537 |
+
f"{self.whitespace}{self.text}{self.node or ''}{self.suffix.rstrip()}"
|
| 538 |
+
)
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
def _is_namedtuple(obj: Any) -> bool:
|
| 542 |
+
"""Checks if an object is most likely a namedtuple. It is possible
|
| 543 |
+
to craft an object that passes this check and isn't a namedtuple, but
|
| 544 |
+
there is only a minuscule chance of this happening unintentionally.
|
| 545 |
+
|
| 546 |
+
Args:
|
| 547 |
+
obj (Any): The object to test
|
| 548 |
+
|
| 549 |
+
Returns:
|
| 550 |
+
bool: True if the object is a namedtuple. False otherwise.
|
| 551 |
+
"""
|
| 552 |
+
try:
|
| 553 |
+
fields = getattr(obj, "_fields", None)
|
| 554 |
+
except Exception:
|
| 555 |
+
# Being very defensive - if we cannot get the attr then its not a namedtuple
|
| 556 |
+
return False
|
| 557 |
+
return isinstance(obj, tuple) and isinstance(fields, tuple)
|
| 558 |
+
|
| 559 |
+
|
| 560 |
+
def traverse(
|
| 561 |
+
_object: Any,
|
| 562 |
+
max_length: Optional[int] = None,
|
| 563 |
+
max_string: Optional[int] = None,
|
| 564 |
+
max_depth: Optional[int] = None,
|
| 565 |
+
) -> Node:
|
| 566 |
+
"""Traverse object and generate a tree.
|
| 567 |
+
|
| 568 |
+
Args:
|
| 569 |
+
_object (Any): Object to be traversed.
|
| 570 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 571 |
+
Defaults to None.
|
| 572 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable truncating.
|
| 573 |
+
Defaults to None.
|
| 574 |
+
max_depth (int, optional): Maximum depth of data structures, or None for no maximum.
|
| 575 |
+
Defaults to None.
|
| 576 |
+
|
| 577 |
+
Returns:
|
| 578 |
+
Node: The root of a tree structure which can be used to render a pretty repr.
|
| 579 |
+
"""
|
| 580 |
+
|
| 581 |
+
def to_repr(obj: Any) -> str:
|
| 582 |
+
"""Get repr string for an object, but catch errors."""
|
| 583 |
+
if (
|
| 584 |
+
max_string is not None
|
| 585 |
+
and _safe_isinstance(obj, (bytes, str))
|
| 586 |
+
and len(obj) > max_string
|
| 587 |
+
):
|
| 588 |
+
truncated = len(obj) - max_string
|
| 589 |
+
obj_repr = f"{obj[:max_string]!r}+{truncated}"
|
| 590 |
+
else:
|
| 591 |
+
try:
|
| 592 |
+
obj_repr = repr(obj)
|
| 593 |
+
except Exception as error:
|
| 594 |
+
obj_repr = f"<repr-error {str(error)!r}>"
|
| 595 |
+
return obj_repr
|
| 596 |
+
|
| 597 |
+
visited_ids: Set[int] = set()
|
| 598 |
+
push_visited = visited_ids.add
|
| 599 |
+
pop_visited = visited_ids.remove
|
| 600 |
+
|
| 601 |
+
def _traverse(obj: Any, root: bool = False, depth: int = 0) -> Node:
|
| 602 |
+
"""Walk the object depth first."""
|
| 603 |
+
|
| 604 |
+
obj_id = id(obj)
|
| 605 |
+
if obj_id in visited_ids:
|
| 606 |
+
# Recursion detected
|
| 607 |
+
return Node(value_repr="...")
|
| 608 |
+
|
| 609 |
+
obj_type = type(obj)
|
| 610 |
+
children: List[Node]
|
| 611 |
+
reached_max_depth = max_depth is not None and depth >= max_depth
|
| 612 |
+
|
| 613 |
+
def iter_rich_args(rich_args: Any) -> Iterable[Union[Any, Tuple[str, Any]]]:
|
| 614 |
+
for arg in rich_args:
|
| 615 |
+
if _safe_isinstance(arg, tuple):
|
| 616 |
+
if len(arg) == 3:
|
| 617 |
+
key, child, default = arg
|
| 618 |
+
if default == child:
|
| 619 |
+
continue
|
| 620 |
+
yield key, child
|
| 621 |
+
elif len(arg) == 2:
|
| 622 |
+
key, child = arg
|
| 623 |
+
yield key, child
|
| 624 |
+
elif len(arg) == 1:
|
| 625 |
+
yield arg[0]
|
| 626 |
+
else:
|
| 627 |
+
yield arg
|
| 628 |
+
|
| 629 |
+
try:
|
| 630 |
+
fake_attributes = hasattr(
|
| 631 |
+
obj, "awehoi234_wdfjwljet234_234wdfoijsdfmmnxpi492"
|
| 632 |
+
)
|
| 633 |
+
except Exception:
|
| 634 |
+
fake_attributes = False
|
| 635 |
+
|
| 636 |
+
rich_repr_result: Optional[RichReprResult] = None
|
| 637 |
+
if not fake_attributes:
|
| 638 |
+
try:
|
| 639 |
+
if hasattr(obj, "__rich_repr__") and not isclass(obj):
|
| 640 |
+
rich_repr_result = obj.__rich_repr__()
|
| 641 |
+
except Exception:
|
| 642 |
+
pass
|
| 643 |
+
|
| 644 |
+
if rich_repr_result is not None:
|
| 645 |
+
push_visited(obj_id)
|
| 646 |
+
angular = getattr(obj.__rich_repr__, "angular", False)
|
| 647 |
+
args = list(iter_rich_args(rich_repr_result))
|
| 648 |
+
class_name = obj.__class__.__name__
|
| 649 |
+
|
| 650 |
+
if args:
|
| 651 |
+
children = []
|
| 652 |
+
append = children.append
|
| 653 |
+
|
| 654 |
+
if reached_max_depth:
|
| 655 |
+
if angular:
|
| 656 |
+
node = Node(value_repr=f"<{class_name}...>")
|
| 657 |
+
else:
|
| 658 |
+
node = Node(value_repr=f"{class_name}(...)")
|
| 659 |
+
else:
|
| 660 |
+
if angular:
|
| 661 |
+
node = Node(
|
| 662 |
+
open_brace=f"<{class_name} ",
|
| 663 |
+
close_brace=">",
|
| 664 |
+
children=children,
|
| 665 |
+
last=root,
|
| 666 |
+
separator=" ",
|
| 667 |
+
)
|
| 668 |
+
else:
|
| 669 |
+
node = Node(
|
| 670 |
+
open_brace=f"{class_name}(",
|
| 671 |
+
close_brace=")",
|
| 672 |
+
children=children,
|
| 673 |
+
last=root,
|
| 674 |
+
)
|
| 675 |
+
for last, arg in loop_last(args):
|
| 676 |
+
if _safe_isinstance(arg, tuple):
|
| 677 |
+
key, child = arg
|
| 678 |
+
child_node = _traverse(child, depth=depth + 1)
|
| 679 |
+
child_node.last = last
|
| 680 |
+
child_node.key_repr = key
|
| 681 |
+
child_node.key_separator = "="
|
| 682 |
+
append(child_node)
|
| 683 |
+
else:
|
| 684 |
+
child_node = _traverse(arg, depth=depth + 1)
|
| 685 |
+
child_node.last = last
|
| 686 |
+
append(child_node)
|
| 687 |
+
else:
|
| 688 |
+
node = Node(
|
| 689 |
+
value_repr=f"<{class_name}>" if angular else f"{class_name}()",
|
| 690 |
+
children=[],
|
| 691 |
+
last=root,
|
| 692 |
+
)
|
| 693 |
+
pop_visited(obj_id)
|
| 694 |
+
elif _is_attr_object(obj) and not fake_attributes:
|
| 695 |
+
push_visited(obj_id)
|
| 696 |
+
children = []
|
| 697 |
+
append = children.append
|
| 698 |
+
|
| 699 |
+
attr_fields = _get_attr_fields(obj)
|
| 700 |
+
if attr_fields:
|
| 701 |
+
if reached_max_depth:
|
| 702 |
+
node = Node(value_repr=f"{obj.__class__.__name__}(...)")
|
| 703 |
+
else:
|
| 704 |
+
node = Node(
|
| 705 |
+
open_brace=f"{obj.__class__.__name__}(",
|
| 706 |
+
close_brace=")",
|
| 707 |
+
children=children,
|
| 708 |
+
last=root,
|
| 709 |
+
)
|
| 710 |
+
|
| 711 |
+
def iter_attrs() -> Iterable[
|
| 712 |
+
Tuple[str, Any, Optional[Callable[[Any], str]]]
|
| 713 |
+
]:
|
| 714 |
+
"""Iterate over attr fields and values."""
|
| 715 |
+
for attr in attr_fields:
|
| 716 |
+
if attr.repr:
|
| 717 |
+
try:
|
| 718 |
+
value = getattr(obj, attr.name)
|
| 719 |
+
except Exception as error:
|
| 720 |
+
# Can happen, albeit rarely
|
| 721 |
+
yield (attr.name, error, None)
|
| 722 |
+
else:
|
| 723 |
+
yield (
|
| 724 |
+
attr.name,
|
| 725 |
+
value,
|
| 726 |
+
attr.repr if callable(attr.repr) else None,
|
| 727 |
+
)
|
| 728 |
+
|
| 729 |
+
for last, (name, value, repr_callable) in loop_last(iter_attrs()):
|
| 730 |
+
if repr_callable:
|
| 731 |
+
child_node = Node(value_repr=str(repr_callable(value)))
|
| 732 |
+
else:
|
| 733 |
+
child_node = _traverse(value, depth=depth + 1)
|
| 734 |
+
child_node.last = last
|
| 735 |
+
child_node.key_repr = name
|
| 736 |
+
child_node.key_separator = "="
|
| 737 |
+
append(child_node)
|
| 738 |
+
else:
|
| 739 |
+
node = Node(
|
| 740 |
+
value_repr=f"{obj.__class__.__name__}()", children=[], last=root
|
| 741 |
+
)
|
| 742 |
+
pop_visited(obj_id)
|
| 743 |
+
elif (
|
| 744 |
+
is_dataclass(obj)
|
| 745 |
+
and not _safe_isinstance(obj, type)
|
| 746 |
+
and not fake_attributes
|
| 747 |
+
and _is_dataclass_repr(obj)
|
| 748 |
+
):
|
| 749 |
+
push_visited(obj_id)
|
| 750 |
+
children = []
|
| 751 |
+
append = children.append
|
| 752 |
+
if reached_max_depth:
|
| 753 |
+
node = Node(value_repr=f"{obj.__class__.__name__}(...)")
|
| 754 |
+
else:
|
| 755 |
+
node = Node(
|
| 756 |
+
open_brace=f"{obj.__class__.__name__}(",
|
| 757 |
+
close_brace=")",
|
| 758 |
+
children=children,
|
| 759 |
+
last=root,
|
| 760 |
+
empty=f"{obj.__class__.__name__}()",
|
| 761 |
+
)
|
| 762 |
+
|
| 763 |
+
for last, field in loop_last(
|
| 764 |
+
field for field in fields(obj) if field.repr
|
| 765 |
+
):
|
| 766 |
+
child_node = _traverse(getattr(obj, field.name), depth=depth + 1)
|
| 767 |
+
child_node.key_repr = field.name
|
| 768 |
+
child_node.last = last
|
| 769 |
+
child_node.key_separator = "="
|
| 770 |
+
append(child_node)
|
| 771 |
+
|
| 772 |
+
pop_visited(obj_id)
|
| 773 |
+
elif _is_namedtuple(obj) and _has_default_namedtuple_repr(obj):
|
| 774 |
+
push_visited(obj_id)
|
| 775 |
+
class_name = obj.__class__.__name__
|
| 776 |
+
if reached_max_depth:
|
| 777 |
+
# If we've reached the max depth, we still show the class name, but not its contents
|
| 778 |
+
node = Node(
|
| 779 |
+
value_repr=f"{class_name}(...)",
|
| 780 |
+
)
|
| 781 |
+
else:
|
| 782 |
+
children = []
|
| 783 |
+
append = children.append
|
| 784 |
+
node = Node(
|
| 785 |
+
open_brace=f"{class_name}(",
|
| 786 |
+
close_brace=")",
|
| 787 |
+
children=children,
|
| 788 |
+
empty=f"{class_name}()",
|
| 789 |
+
)
|
| 790 |
+
for last, (key, value) in loop_last(obj._asdict().items()):
|
| 791 |
+
child_node = _traverse(value, depth=depth + 1)
|
| 792 |
+
child_node.key_repr = key
|
| 793 |
+
child_node.last = last
|
| 794 |
+
child_node.key_separator = "="
|
| 795 |
+
append(child_node)
|
| 796 |
+
pop_visited(obj_id)
|
| 797 |
+
elif _safe_isinstance(obj, _CONTAINERS):
|
| 798 |
+
for container_type in _CONTAINERS:
|
| 799 |
+
if _safe_isinstance(obj, container_type):
|
| 800 |
+
obj_type = container_type
|
| 801 |
+
break
|
| 802 |
+
|
| 803 |
+
push_visited(obj_id)
|
| 804 |
+
|
| 805 |
+
open_brace, close_brace, empty = _BRACES[obj_type](obj)
|
| 806 |
+
|
| 807 |
+
if reached_max_depth:
|
| 808 |
+
node = Node(value_repr=f"{open_brace}...{close_brace}")
|
| 809 |
+
elif obj_type.__repr__ != type(obj).__repr__:
|
| 810 |
+
node = Node(value_repr=to_repr(obj), last=root)
|
| 811 |
+
elif obj:
|
| 812 |
+
children = []
|
| 813 |
+
node = Node(
|
| 814 |
+
open_brace=open_brace,
|
| 815 |
+
close_brace=close_brace,
|
| 816 |
+
children=children,
|
| 817 |
+
last=root,
|
| 818 |
+
)
|
| 819 |
+
append = children.append
|
| 820 |
+
num_items = len(obj)
|
| 821 |
+
last_item_index = num_items - 1
|
| 822 |
+
|
| 823 |
+
if _safe_isinstance(obj, _MAPPING_CONTAINERS):
|
| 824 |
+
iter_items = iter(obj.items())
|
| 825 |
+
if max_length is not None:
|
| 826 |
+
iter_items = islice(iter_items, max_length)
|
| 827 |
+
for index, (key, child) in enumerate(iter_items):
|
| 828 |
+
child_node = _traverse(child, depth=depth + 1)
|
| 829 |
+
child_node.key_repr = to_repr(key)
|
| 830 |
+
child_node.last = index == last_item_index
|
| 831 |
+
append(child_node)
|
| 832 |
+
else:
|
| 833 |
+
iter_values = iter(obj)
|
| 834 |
+
if max_length is not None:
|
| 835 |
+
iter_values = islice(iter_values, max_length)
|
| 836 |
+
for index, child in enumerate(iter_values):
|
| 837 |
+
child_node = _traverse(child, depth=depth + 1)
|
| 838 |
+
child_node.last = index == last_item_index
|
| 839 |
+
append(child_node)
|
| 840 |
+
if max_length is not None and num_items > max_length:
|
| 841 |
+
append(Node(value_repr=f"... +{num_items - max_length}", last=True))
|
| 842 |
+
else:
|
| 843 |
+
node = Node(empty=empty, children=[], last=root)
|
| 844 |
+
|
| 845 |
+
pop_visited(obj_id)
|
| 846 |
+
else:
|
| 847 |
+
node = Node(value_repr=to_repr(obj), last=root)
|
| 848 |
+
node.is_tuple = _safe_isinstance(obj, tuple)
|
| 849 |
+
node.is_namedtuple = _is_namedtuple(obj)
|
| 850 |
+
return node
|
| 851 |
+
|
| 852 |
+
node = _traverse(_object, root=True)
|
| 853 |
+
return node
|
| 854 |
+
|
| 855 |
+
|
| 856 |
+
def pretty_repr(
|
| 857 |
+
_object: Any,
|
| 858 |
+
*,
|
| 859 |
+
max_width: int = 80,
|
| 860 |
+
indent_size: int = 4,
|
| 861 |
+
max_length: Optional[int] = None,
|
| 862 |
+
max_string: Optional[int] = None,
|
| 863 |
+
max_depth: Optional[int] = None,
|
| 864 |
+
expand_all: bool = False,
|
| 865 |
+
) -> str:
|
| 866 |
+
"""Prettify repr string by expanding on to new lines to fit within a given width.
|
| 867 |
+
|
| 868 |
+
Args:
|
| 869 |
+
_object (Any): Object to repr.
|
| 870 |
+
max_width (int, optional): Desired maximum width of repr string. Defaults to 80.
|
| 871 |
+
indent_size (int, optional): Number of spaces to indent. Defaults to 4.
|
| 872 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 873 |
+
Defaults to None.
|
| 874 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable truncating.
|
| 875 |
+
Defaults to None.
|
| 876 |
+
max_depth (int, optional): Maximum depth of nested data structure, or None for no depth.
|
| 877 |
+
Defaults to None.
|
| 878 |
+
expand_all (bool, optional): Expand all containers regardless of available width. Defaults to False.
|
| 879 |
+
|
| 880 |
+
Returns:
|
| 881 |
+
str: A possibly multi-line representation of the object.
|
| 882 |
+
"""
|
| 883 |
+
|
| 884 |
+
if _safe_isinstance(_object, Node):
|
| 885 |
+
node = _object
|
| 886 |
+
else:
|
| 887 |
+
node = traverse(
|
| 888 |
+
_object, max_length=max_length, max_string=max_string, max_depth=max_depth
|
| 889 |
+
)
|
| 890 |
+
repr_str: str = node.render(
|
| 891 |
+
max_width=max_width, indent_size=indent_size, expand_all=expand_all
|
| 892 |
+
)
|
| 893 |
+
return repr_str
|
| 894 |
+
|
| 895 |
+
|
| 896 |
+
def pprint(
|
| 897 |
+
_object: Any,
|
| 898 |
+
*,
|
| 899 |
+
console: Optional["Console"] = None,
|
| 900 |
+
indent_guides: bool = True,
|
| 901 |
+
max_length: Optional[int] = None,
|
| 902 |
+
max_string: Optional[int] = None,
|
| 903 |
+
max_depth: Optional[int] = None,
|
| 904 |
+
expand_all: bool = False,
|
| 905 |
+
) -> None:
|
| 906 |
+
"""A convenience function for pretty printing.
|
| 907 |
+
|
| 908 |
+
Args:
|
| 909 |
+
_object (Any): Object to pretty print.
|
| 910 |
+
console (Console, optional): Console instance, or None to use default. Defaults to None.
|
| 911 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 912 |
+
Defaults to None.
|
| 913 |
+
max_string (int, optional): Maximum length of strings before truncating, or None to disable. Defaults to None.
|
| 914 |
+
max_depth (int, optional): Maximum depth for nested data structures, or None for unlimited depth. Defaults to None.
|
| 915 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to True.
|
| 916 |
+
expand_all (bool, optional): Expand all containers. Defaults to False.
|
| 917 |
+
"""
|
| 918 |
+
_console = get_console() if console is None else console
|
| 919 |
+
_console.print(
|
| 920 |
+
Pretty(
|
| 921 |
+
_object,
|
| 922 |
+
max_length=max_length,
|
| 923 |
+
max_string=max_string,
|
| 924 |
+
max_depth=max_depth,
|
| 925 |
+
indent_guides=indent_guides,
|
| 926 |
+
expand_all=expand_all,
|
| 927 |
+
overflow="ignore",
|
| 928 |
+
),
|
| 929 |
+
soft_wrap=True,
|
| 930 |
+
)
|
| 931 |
+
|
| 932 |
+
|
| 933 |
+
if __name__ == "__main__": # pragma: no cover
|
| 934 |
+
|
| 935 |
+
class BrokenRepr:
|
| 936 |
+
def __repr__(self) -> str:
|
| 937 |
+
1 / 0
|
| 938 |
+
return "this will fail"
|
| 939 |
+
|
| 940 |
+
from typing import NamedTuple
|
| 941 |
+
|
| 942 |
+
class StockKeepingUnit(NamedTuple):
|
| 943 |
+
name: str
|
| 944 |
+
description: str
|
| 945 |
+
price: float
|
| 946 |
+
category: str
|
| 947 |
+
reviews: List[str]
|
| 948 |
+
|
| 949 |
+
d = defaultdict(int)
|
| 950 |
+
d["foo"] = 5
|
| 951 |
+
data = {
|
| 952 |
+
"foo": [
|
| 953 |
+
1,
|
| 954 |
+
"Hello World!",
|
| 955 |
+
100.123,
|
| 956 |
+
323.232,
|
| 957 |
+
432324.0,
|
| 958 |
+
{5, 6, 7, (1, 2, 3, 4), 8},
|
| 959 |
+
],
|
| 960 |
+
"bar": frozenset({1, 2, 3}),
|
| 961 |
+
"defaultdict": defaultdict(
|
| 962 |
+
list, {"crumble": ["apple", "rhubarb", "butter", "sugar", "flour"]}
|
| 963 |
+
),
|
| 964 |
+
"counter": Counter(
|
| 965 |
+
[
|
| 966 |
+
"apple",
|
| 967 |
+
"orange",
|
| 968 |
+
"pear",
|
| 969 |
+
"kumquat",
|
| 970 |
+
"kumquat",
|
| 971 |
+
"durian" * 100,
|
| 972 |
+
]
|
| 973 |
+
),
|
| 974 |
+
"atomic": (False, True, None),
|
| 975 |
+
"namedtuple": StockKeepingUnit(
|
| 976 |
+
"Sparkling British Spring Water",
|
| 977 |
+
"Carbonated spring water",
|
| 978 |
+
0.9,
|
| 979 |
+
"water",
|
| 980 |
+
["its amazing!", "its terrible!"],
|
| 981 |
+
),
|
| 982 |
+
"Broken": BrokenRepr(),
|
| 983 |
+
}
|
| 984 |
+
data["foo"].append(data) # type: ignore[attr-defined]
|
| 985 |
+
|
| 986 |
+
from pip._vendor.rich import print
|
| 987 |
+
|
| 988 |
+
# print(Pretty(data, indent_guides=True, max_string=20))
|
| 989 |
+
|
| 990 |
+
class Thing:
|
| 991 |
+
def __repr__(self) -> str:
|
| 992 |
+
return "Hello\x1b[38;5;239m World!"
|
| 993 |
+
|
| 994 |
+
print(Pretty(Thing()))
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/progress.py
ADDED
|
@@ -0,0 +1,1702 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import io
|
| 2 |
+
import sys
|
| 3 |
+
import typing
|
| 4 |
+
import warnings
|
| 5 |
+
from abc import ABC, abstractmethod
|
| 6 |
+
from collections import deque
|
| 7 |
+
from dataclasses import dataclass, field
|
| 8 |
+
from datetime import timedelta
|
| 9 |
+
from io import RawIOBase, UnsupportedOperation
|
| 10 |
+
from math import ceil
|
| 11 |
+
from mmap import mmap
|
| 12 |
+
from operator import length_hint
|
| 13 |
+
from os import PathLike, stat
|
| 14 |
+
from threading import Event, RLock, Thread
|
| 15 |
+
from types import TracebackType
|
| 16 |
+
from typing import (
|
| 17 |
+
Any,
|
| 18 |
+
BinaryIO,
|
| 19 |
+
Callable,
|
| 20 |
+
ContextManager,
|
| 21 |
+
Deque,
|
| 22 |
+
Dict,
|
| 23 |
+
Generic,
|
| 24 |
+
Iterable,
|
| 25 |
+
List,
|
| 26 |
+
NamedTuple,
|
| 27 |
+
NewType,
|
| 28 |
+
Optional,
|
| 29 |
+
Sequence,
|
| 30 |
+
TextIO,
|
| 31 |
+
Tuple,
|
| 32 |
+
Type,
|
| 33 |
+
TypeVar,
|
| 34 |
+
Union,
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
if sys.version_info >= (3, 8):
|
| 38 |
+
from typing import Literal
|
| 39 |
+
else:
|
| 40 |
+
from pip._vendor.typing_extensions import Literal # pragma: no cover
|
| 41 |
+
|
| 42 |
+
from . import filesize, get_console
|
| 43 |
+
from .console import Console, Group, JustifyMethod, RenderableType
|
| 44 |
+
from .highlighter import Highlighter
|
| 45 |
+
from .jupyter import JupyterMixin
|
| 46 |
+
from .live import Live
|
| 47 |
+
from .progress_bar import ProgressBar
|
| 48 |
+
from .spinner import Spinner
|
| 49 |
+
from .style import StyleType
|
| 50 |
+
from .table import Column, Table
|
| 51 |
+
from .text import Text, TextType
|
| 52 |
+
|
| 53 |
+
TaskID = NewType("TaskID", int)
|
| 54 |
+
|
| 55 |
+
ProgressType = TypeVar("ProgressType")
|
| 56 |
+
|
| 57 |
+
GetTimeCallable = Callable[[], float]
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
_I = typing.TypeVar("_I", TextIO, BinaryIO)
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class _TrackThread(Thread):
|
| 64 |
+
"""A thread to periodically update progress."""
|
| 65 |
+
|
| 66 |
+
def __init__(self, progress: "Progress", task_id: "TaskID", update_period: float):
|
| 67 |
+
self.progress = progress
|
| 68 |
+
self.task_id = task_id
|
| 69 |
+
self.update_period = update_period
|
| 70 |
+
self.done = Event()
|
| 71 |
+
|
| 72 |
+
self.completed = 0
|
| 73 |
+
super().__init__()
|
| 74 |
+
|
| 75 |
+
def run(self) -> None:
|
| 76 |
+
task_id = self.task_id
|
| 77 |
+
advance = self.progress.advance
|
| 78 |
+
update_period = self.update_period
|
| 79 |
+
last_completed = 0
|
| 80 |
+
wait = self.done.wait
|
| 81 |
+
while not wait(update_period):
|
| 82 |
+
completed = self.completed
|
| 83 |
+
if last_completed != completed:
|
| 84 |
+
advance(task_id, completed - last_completed)
|
| 85 |
+
last_completed = completed
|
| 86 |
+
|
| 87 |
+
self.progress.update(self.task_id, completed=self.completed, refresh=True)
|
| 88 |
+
|
| 89 |
+
def __enter__(self) -> "_TrackThread":
|
| 90 |
+
self.start()
|
| 91 |
+
return self
|
| 92 |
+
|
| 93 |
+
def __exit__(
|
| 94 |
+
self,
|
| 95 |
+
exc_type: Optional[Type[BaseException]],
|
| 96 |
+
exc_val: Optional[BaseException],
|
| 97 |
+
exc_tb: Optional[TracebackType],
|
| 98 |
+
) -> None:
|
| 99 |
+
self.done.set()
|
| 100 |
+
self.join()
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def track(
|
| 104 |
+
sequence: Union[Sequence[ProgressType], Iterable[ProgressType]],
|
| 105 |
+
description: str = "Working...",
|
| 106 |
+
total: Optional[float] = None,
|
| 107 |
+
auto_refresh: bool = True,
|
| 108 |
+
console: Optional[Console] = None,
|
| 109 |
+
transient: bool = False,
|
| 110 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 111 |
+
refresh_per_second: float = 10,
|
| 112 |
+
style: StyleType = "bar.back",
|
| 113 |
+
complete_style: StyleType = "bar.complete",
|
| 114 |
+
finished_style: StyleType = "bar.finished",
|
| 115 |
+
pulse_style: StyleType = "bar.pulse",
|
| 116 |
+
update_period: float = 0.1,
|
| 117 |
+
disable: bool = False,
|
| 118 |
+
show_speed: bool = True,
|
| 119 |
+
) -> Iterable[ProgressType]:
|
| 120 |
+
"""Track progress by iterating over a sequence.
|
| 121 |
+
|
| 122 |
+
Args:
|
| 123 |
+
sequence (Iterable[ProgressType]): A sequence (must support "len") you wish to iterate over.
|
| 124 |
+
description (str, optional): Description of task show next to progress bar. Defaults to "Working".
|
| 125 |
+
total: (float, optional): Total number of steps. Default is len(sequence).
|
| 126 |
+
auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
|
| 127 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 128 |
+
console (Console, optional): Console to write to. Default creates internal Console instance.
|
| 129 |
+
refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
|
| 130 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 131 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 132 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 133 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 134 |
+
update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
|
| 135 |
+
disable (bool, optional): Disable display of progress.
|
| 136 |
+
show_speed (bool, optional): Show speed if total isn't known. Defaults to True.
|
| 137 |
+
Returns:
|
| 138 |
+
Iterable[ProgressType]: An iterable of the values in the sequence.
|
| 139 |
+
|
| 140 |
+
"""
|
| 141 |
+
|
| 142 |
+
columns: List["ProgressColumn"] = (
|
| 143 |
+
[TextColumn("[progress.description]{task.description}")] if description else []
|
| 144 |
+
)
|
| 145 |
+
columns.extend(
|
| 146 |
+
(
|
| 147 |
+
BarColumn(
|
| 148 |
+
style=style,
|
| 149 |
+
complete_style=complete_style,
|
| 150 |
+
finished_style=finished_style,
|
| 151 |
+
pulse_style=pulse_style,
|
| 152 |
+
),
|
| 153 |
+
TaskProgressColumn(show_speed=show_speed),
|
| 154 |
+
TimeRemainingColumn(elapsed_when_finished=True),
|
| 155 |
+
)
|
| 156 |
+
)
|
| 157 |
+
progress = Progress(
|
| 158 |
+
*columns,
|
| 159 |
+
auto_refresh=auto_refresh,
|
| 160 |
+
console=console,
|
| 161 |
+
transient=transient,
|
| 162 |
+
get_time=get_time,
|
| 163 |
+
refresh_per_second=refresh_per_second or 10,
|
| 164 |
+
disable=disable,
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
with progress:
|
| 168 |
+
yield from progress.track(
|
| 169 |
+
sequence, total=total, description=description, update_period=update_period
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
class _Reader(RawIOBase, BinaryIO):
|
| 174 |
+
"""A reader that tracks progress while it's being read from."""
|
| 175 |
+
|
| 176 |
+
def __init__(
|
| 177 |
+
self,
|
| 178 |
+
handle: BinaryIO,
|
| 179 |
+
progress: "Progress",
|
| 180 |
+
task: TaskID,
|
| 181 |
+
close_handle: bool = True,
|
| 182 |
+
) -> None:
|
| 183 |
+
self.handle = handle
|
| 184 |
+
self.progress = progress
|
| 185 |
+
self.task = task
|
| 186 |
+
self.close_handle = close_handle
|
| 187 |
+
self._closed = False
|
| 188 |
+
|
| 189 |
+
def __enter__(self) -> "_Reader":
|
| 190 |
+
self.handle.__enter__()
|
| 191 |
+
return self
|
| 192 |
+
|
| 193 |
+
def __exit__(
|
| 194 |
+
self,
|
| 195 |
+
exc_type: Optional[Type[BaseException]],
|
| 196 |
+
exc_val: Optional[BaseException],
|
| 197 |
+
exc_tb: Optional[TracebackType],
|
| 198 |
+
) -> None:
|
| 199 |
+
self.close()
|
| 200 |
+
|
| 201 |
+
def __iter__(self) -> BinaryIO:
|
| 202 |
+
return self
|
| 203 |
+
|
| 204 |
+
def __next__(self) -> bytes:
|
| 205 |
+
line = next(self.handle)
|
| 206 |
+
self.progress.advance(self.task, advance=len(line))
|
| 207 |
+
return line
|
| 208 |
+
|
| 209 |
+
@property
|
| 210 |
+
def closed(self) -> bool:
|
| 211 |
+
return self._closed
|
| 212 |
+
|
| 213 |
+
def fileno(self) -> int:
|
| 214 |
+
return self.handle.fileno()
|
| 215 |
+
|
| 216 |
+
def isatty(self) -> bool:
|
| 217 |
+
return self.handle.isatty()
|
| 218 |
+
|
| 219 |
+
@property
|
| 220 |
+
def mode(self) -> str:
|
| 221 |
+
return self.handle.mode
|
| 222 |
+
|
| 223 |
+
@property
|
| 224 |
+
def name(self) -> str:
|
| 225 |
+
return self.handle.name
|
| 226 |
+
|
| 227 |
+
def readable(self) -> bool:
|
| 228 |
+
return self.handle.readable()
|
| 229 |
+
|
| 230 |
+
def seekable(self) -> bool:
|
| 231 |
+
return self.handle.seekable()
|
| 232 |
+
|
| 233 |
+
def writable(self) -> bool:
|
| 234 |
+
return False
|
| 235 |
+
|
| 236 |
+
def read(self, size: int = -1) -> bytes:
|
| 237 |
+
block = self.handle.read(size)
|
| 238 |
+
self.progress.advance(self.task, advance=len(block))
|
| 239 |
+
return block
|
| 240 |
+
|
| 241 |
+
def readinto(self, b: Union[bytearray, memoryview, mmap]): # type: ignore[no-untyped-def, override]
|
| 242 |
+
n = self.handle.readinto(b) # type: ignore[attr-defined]
|
| 243 |
+
self.progress.advance(self.task, advance=n)
|
| 244 |
+
return n
|
| 245 |
+
|
| 246 |
+
def readline(self, size: int = -1) -> bytes: # type: ignore[override]
|
| 247 |
+
line = self.handle.readline(size)
|
| 248 |
+
self.progress.advance(self.task, advance=len(line))
|
| 249 |
+
return line
|
| 250 |
+
|
| 251 |
+
def readlines(self, hint: int = -1) -> List[bytes]:
|
| 252 |
+
lines = self.handle.readlines(hint)
|
| 253 |
+
self.progress.advance(self.task, advance=sum(map(len, lines)))
|
| 254 |
+
return lines
|
| 255 |
+
|
| 256 |
+
def close(self) -> None:
|
| 257 |
+
if self.close_handle:
|
| 258 |
+
self.handle.close()
|
| 259 |
+
self._closed = True
|
| 260 |
+
|
| 261 |
+
def seek(self, offset: int, whence: int = 0) -> int:
|
| 262 |
+
pos = self.handle.seek(offset, whence)
|
| 263 |
+
self.progress.update(self.task, completed=pos)
|
| 264 |
+
return pos
|
| 265 |
+
|
| 266 |
+
def tell(self) -> int:
|
| 267 |
+
return self.handle.tell()
|
| 268 |
+
|
| 269 |
+
def write(self, s: Any) -> int:
|
| 270 |
+
raise UnsupportedOperation("write")
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
class _ReadContext(ContextManager[_I], Generic[_I]):
|
| 274 |
+
"""A utility class to handle a context for both a reader and a progress."""
|
| 275 |
+
|
| 276 |
+
def __init__(self, progress: "Progress", reader: _I) -> None:
|
| 277 |
+
self.progress = progress
|
| 278 |
+
self.reader: _I = reader
|
| 279 |
+
|
| 280 |
+
def __enter__(self) -> _I:
|
| 281 |
+
self.progress.start()
|
| 282 |
+
return self.reader.__enter__()
|
| 283 |
+
|
| 284 |
+
def __exit__(
|
| 285 |
+
self,
|
| 286 |
+
exc_type: Optional[Type[BaseException]],
|
| 287 |
+
exc_val: Optional[BaseException],
|
| 288 |
+
exc_tb: Optional[TracebackType],
|
| 289 |
+
) -> None:
|
| 290 |
+
self.progress.stop()
|
| 291 |
+
self.reader.__exit__(exc_type, exc_val, exc_tb)
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
def wrap_file(
|
| 295 |
+
file: BinaryIO,
|
| 296 |
+
total: int,
|
| 297 |
+
*,
|
| 298 |
+
description: str = "Reading...",
|
| 299 |
+
auto_refresh: bool = True,
|
| 300 |
+
console: Optional[Console] = None,
|
| 301 |
+
transient: bool = False,
|
| 302 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 303 |
+
refresh_per_second: float = 10,
|
| 304 |
+
style: StyleType = "bar.back",
|
| 305 |
+
complete_style: StyleType = "bar.complete",
|
| 306 |
+
finished_style: StyleType = "bar.finished",
|
| 307 |
+
pulse_style: StyleType = "bar.pulse",
|
| 308 |
+
disable: bool = False,
|
| 309 |
+
) -> ContextManager[BinaryIO]:
|
| 310 |
+
"""Read bytes from a file while tracking progress.
|
| 311 |
+
|
| 312 |
+
Args:
|
| 313 |
+
file (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
|
| 314 |
+
total (int): Total number of bytes to read.
|
| 315 |
+
description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
|
| 316 |
+
auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
|
| 317 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 318 |
+
console (Console, optional): Console to write to. Default creates internal Console instance.
|
| 319 |
+
refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
|
| 320 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 321 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 322 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 323 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 324 |
+
disable (bool, optional): Disable display of progress.
|
| 325 |
+
Returns:
|
| 326 |
+
ContextManager[BinaryIO]: A context manager yielding a progress reader.
|
| 327 |
+
|
| 328 |
+
"""
|
| 329 |
+
|
| 330 |
+
columns: List["ProgressColumn"] = (
|
| 331 |
+
[TextColumn("[progress.description]{task.description}")] if description else []
|
| 332 |
+
)
|
| 333 |
+
columns.extend(
|
| 334 |
+
(
|
| 335 |
+
BarColumn(
|
| 336 |
+
style=style,
|
| 337 |
+
complete_style=complete_style,
|
| 338 |
+
finished_style=finished_style,
|
| 339 |
+
pulse_style=pulse_style,
|
| 340 |
+
),
|
| 341 |
+
DownloadColumn(),
|
| 342 |
+
TimeRemainingColumn(),
|
| 343 |
+
)
|
| 344 |
+
)
|
| 345 |
+
progress = Progress(
|
| 346 |
+
*columns,
|
| 347 |
+
auto_refresh=auto_refresh,
|
| 348 |
+
console=console,
|
| 349 |
+
transient=transient,
|
| 350 |
+
get_time=get_time,
|
| 351 |
+
refresh_per_second=refresh_per_second or 10,
|
| 352 |
+
disable=disable,
|
| 353 |
+
)
|
| 354 |
+
|
| 355 |
+
reader = progress.wrap_file(file, total=total, description=description)
|
| 356 |
+
return _ReadContext(progress, reader)
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
@typing.overload
|
| 360 |
+
def open(
|
| 361 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 362 |
+
mode: Union[Literal["rt"], Literal["r"]],
|
| 363 |
+
buffering: int = -1,
|
| 364 |
+
encoding: Optional[str] = None,
|
| 365 |
+
errors: Optional[str] = None,
|
| 366 |
+
newline: Optional[str] = None,
|
| 367 |
+
*,
|
| 368 |
+
total: Optional[int] = None,
|
| 369 |
+
description: str = "Reading...",
|
| 370 |
+
auto_refresh: bool = True,
|
| 371 |
+
console: Optional[Console] = None,
|
| 372 |
+
transient: bool = False,
|
| 373 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 374 |
+
refresh_per_second: float = 10,
|
| 375 |
+
style: StyleType = "bar.back",
|
| 376 |
+
complete_style: StyleType = "bar.complete",
|
| 377 |
+
finished_style: StyleType = "bar.finished",
|
| 378 |
+
pulse_style: StyleType = "bar.pulse",
|
| 379 |
+
disable: bool = False,
|
| 380 |
+
) -> ContextManager[TextIO]:
|
| 381 |
+
pass
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
@typing.overload
|
| 385 |
+
def open(
|
| 386 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 387 |
+
mode: Literal["rb"],
|
| 388 |
+
buffering: int = -1,
|
| 389 |
+
encoding: Optional[str] = None,
|
| 390 |
+
errors: Optional[str] = None,
|
| 391 |
+
newline: Optional[str] = None,
|
| 392 |
+
*,
|
| 393 |
+
total: Optional[int] = None,
|
| 394 |
+
description: str = "Reading...",
|
| 395 |
+
auto_refresh: bool = True,
|
| 396 |
+
console: Optional[Console] = None,
|
| 397 |
+
transient: bool = False,
|
| 398 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 399 |
+
refresh_per_second: float = 10,
|
| 400 |
+
style: StyleType = "bar.back",
|
| 401 |
+
complete_style: StyleType = "bar.complete",
|
| 402 |
+
finished_style: StyleType = "bar.finished",
|
| 403 |
+
pulse_style: StyleType = "bar.pulse",
|
| 404 |
+
disable: bool = False,
|
| 405 |
+
) -> ContextManager[BinaryIO]:
|
| 406 |
+
pass
|
| 407 |
+
|
| 408 |
+
|
| 409 |
+
def open(
|
| 410 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 411 |
+
mode: Union[Literal["rb"], Literal["rt"], Literal["r"]] = "r",
|
| 412 |
+
buffering: int = -1,
|
| 413 |
+
encoding: Optional[str] = None,
|
| 414 |
+
errors: Optional[str] = None,
|
| 415 |
+
newline: Optional[str] = None,
|
| 416 |
+
*,
|
| 417 |
+
total: Optional[int] = None,
|
| 418 |
+
description: str = "Reading...",
|
| 419 |
+
auto_refresh: bool = True,
|
| 420 |
+
console: Optional[Console] = None,
|
| 421 |
+
transient: bool = False,
|
| 422 |
+
get_time: Optional[Callable[[], float]] = None,
|
| 423 |
+
refresh_per_second: float = 10,
|
| 424 |
+
style: StyleType = "bar.back",
|
| 425 |
+
complete_style: StyleType = "bar.complete",
|
| 426 |
+
finished_style: StyleType = "bar.finished",
|
| 427 |
+
pulse_style: StyleType = "bar.pulse",
|
| 428 |
+
disable: bool = False,
|
| 429 |
+
) -> Union[ContextManager[BinaryIO], ContextManager[TextIO]]:
|
| 430 |
+
"""Read bytes from a file while tracking progress.
|
| 431 |
+
|
| 432 |
+
Args:
|
| 433 |
+
path (Union[str, PathLike[str], BinaryIO]): The path to the file to read, or a file-like object in binary mode.
|
| 434 |
+
mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
|
| 435 |
+
buffering (int): The buffering strategy to use, see :func:`io.open`.
|
| 436 |
+
encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
|
| 437 |
+
errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
|
| 438 |
+
newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`
|
| 439 |
+
total: (int, optional): Total number of bytes to read. Must be provided if reading from a file handle. Default for a path is os.stat(file).st_size.
|
| 440 |
+
description (str, optional): Description of task show next to progress bar. Defaults to "Reading".
|
| 441 |
+
auto_refresh (bool, optional): Automatic refresh, disable to force a refresh after each iteration. Default is True.
|
| 442 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 443 |
+
console (Console, optional): Console to write to. Default creates internal Console instance.
|
| 444 |
+
refresh_per_second (float): Number of times per second to refresh the progress information. Defaults to 10.
|
| 445 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 446 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 447 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 448 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 449 |
+
disable (bool, optional): Disable display of progress.
|
| 450 |
+
encoding (str, optional): The encoding to use when reading in text mode.
|
| 451 |
+
|
| 452 |
+
Returns:
|
| 453 |
+
ContextManager[BinaryIO]: A context manager yielding a progress reader.
|
| 454 |
+
|
| 455 |
+
"""
|
| 456 |
+
|
| 457 |
+
columns: List["ProgressColumn"] = (
|
| 458 |
+
[TextColumn("[progress.description]{task.description}")] if description else []
|
| 459 |
+
)
|
| 460 |
+
columns.extend(
|
| 461 |
+
(
|
| 462 |
+
BarColumn(
|
| 463 |
+
style=style,
|
| 464 |
+
complete_style=complete_style,
|
| 465 |
+
finished_style=finished_style,
|
| 466 |
+
pulse_style=pulse_style,
|
| 467 |
+
),
|
| 468 |
+
DownloadColumn(),
|
| 469 |
+
TimeRemainingColumn(),
|
| 470 |
+
)
|
| 471 |
+
)
|
| 472 |
+
progress = Progress(
|
| 473 |
+
*columns,
|
| 474 |
+
auto_refresh=auto_refresh,
|
| 475 |
+
console=console,
|
| 476 |
+
transient=transient,
|
| 477 |
+
get_time=get_time,
|
| 478 |
+
refresh_per_second=refresh_per_second or 10,
|
| 479 |
+
disable=disable,
|
| 480 |
+
)
|
| 481 |
+
|
| 482 |
+
reader = progress.open(
|
| 483 |
+
file,
|
| 484 |
+
mode=mode,
|
| 485 |
+
buffering=buffering,
|
| 486 |
+
encoding=encoding,
|
| 487 |
+
errors=errors,
|
| 488 |
+
newline=newline,
|
| 489 |
+
total=total,
|
| 490 |
+
description=description,
|
| 491 |
+
)
|
| 492 |
+
return _ReadContext(progress, reader) # type: ignore[return-value, type-var]
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
class ProgressColumn(ABC):
|
| 496 |
+
"""Base class for a widget to use in progress display."""
|
| 497 |
+
|
| 498 |
+
max_refresh: Optional[float] = None
|
| 499 |
+
|
| 500 |
+
def __init__(self, table_column: Optional[Column] = None) -> None:
|
| 501 |
+
self._table_column = table_column
|
| 502 |
+
self._renderable_cache: Dict[TaskID, Tuple[float, RenderableType]] = {}
|
| 503 |
+
self._update_time: Optional[float] = None
|
| 504 |
+
|
| 505 |
+
def get_table_column(self) -> Column:
|
| 506 |
+
"""Get a table column, used to build tasks table."""
|
| 507 |
+
return self._table_column or Column()
|
| 508 |
+
|
| 509 |
+
def __call__(self, task: "Task") -> RenderableType:
|
| 510 |
+
"""Called by the Progress object to return a renderable for the given task.
|
| 511 |
+
|
| 512 |
+
Args:
|
| 513 |
+
task (Task): An object containing information regarding the task.
|
| 514 |
+
|
| 515 |
+
Returns:
|
| 516 |
+
RenderableType: Anything renderable (including str).
|
| 517 |
+
"""
|
| 518 |
+
current_time = task.get_time()
|
| 519 |
+
if self.max_refresh is not None and not task.completed:
|
| 520 |
+
try:
|
| 521 |
+
timestamp, renderable = self._renderable_cache[task.id]
|
| 522 |
+
except KeyError:
|
| 523 |
+
pass
|
| 524 |
+
else:
|
| 525 |
+
if timestamp + self.max_refresh > current_time:
|
| 526 |
+
return renderable
|
| 527 |
+
|
| 528 |
+
renderable = self.render(task)
|
| 529 |
+
self._renderable_cache[task.id] = (current_time, renderable)
|
| 530 |
+
return renderable
|
| 531 |
+
|
| 532 |
+
@abstractmethod
|
| 533 |
+
def render(self, task: "Task") -> RenderableType:
|
| 534 |
+
"""Should return a renderable object."""
|
| 535 |
+
|
| 536 |
+
|
| 537 |
+
class RenderableColumn(ProgressColumn):
|
| 538 |
+
"""A column to insert an arbitrary column.
|
| 539 |
+
|
| 540 |
+
Args:
|
| 541 |
+
renderable (RenderableType, optional): Any renderable. Defaults to empty string.
|
| 542 |
+
"""
|
| 543 |
+
|
| 544 |
+
def __init__(
|
| 545 |
+
self, renderable: RenderableType = "", *, table_column: Optional[Column] = None
|
| 546 |
+
):
|
| 547 |
+
self.renderable = renderable
|
| 548 |
+
super().__init__(table_column=table_column)
|
| 549 |
+
|
| 550 |
+
def render(self, task: "Task") -> RenderableType:
|
| 551 |
+
return self.renderable
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
class SpinnerColumn(ProgressColumn):
|
| 555 |
+
"""A column with a 'spinner' animation.
|
| 556 |
+
|
| 557 |
+
Args:
|
| 558 |
+
spinner_name (str, optional): Name of spinner animation. Defaults to "dots".
|
| 559 |
+
style (StyleType, optional): Style of spinner. Defaults to "progress.spinner".
|
| 560 |
+
speed (float, optional): Speed factor of spinner. Defaults to 1.0.
|
| 561 |
+
finished_text (TextType, optional): Text used when task is finished. Defaults to " ".
|
| 562 |
+
"""
|
| 563 |
+
|
| 564 |
+
def __init__(
|
| 565 |
+
self,
|
| 566 |
+
spinner_name: str = "dots",
|
| 567 |
+
style: Optional[StyleType] = "progress.spinner",
|
| 568 |
+
speed: float = 1.0,
|
| 569 |
+
finished_text: TextType = " ",
|
| 570 |
+
table_column: Optional[Column] = None,
|
| 571 |
+
):
|
| 572 |
+
self.spinner = Spinner(spinner_name, style=style, speed=speed)
|
| 573 |
+
self.finished_text = (
|
| 574 |
+
Text.from_markup(finished_text)
|
| 575 |
+
if isinstance(finished_text, str)
|
| 576 |
+
else finished_text
|
| 577 |
+
)
|
| 578 |
+
super().__init__(table_column=table_column)
|
| 579 |
+
|
| 580 |
+
def set_spinner(
|
| 581 |
+
self,
|
| 582 |
+
spinner_name: str,
|
| 583 |
+
spinner_style: Optional[StyleType] = "progress.spinner",
|
| 584 |
+
speed: float = 1.0,
|
| 585 |
+
) -> None:
|
| 586 |
+
"""Set a new spinner.
|
| 587 |
+
|
| 588 |
+
Args:
|
| 589 |
+
spinner_name (str): Spinner name, see python -m rich.spinner.
|
| 590 |
+
spinner_style (Optional[StyleType], optional): Spinner style. Defaults to "progress.spinner".
|
| 591 |
+
speed (float, optional): Speed factor of spinner. Defaults to 1.0.
|
| 592 |
+
"""
|
| 593 |
+
self.spinner = Spinner(spinner_name, style=spinner_style, speed=speed)
|
| 594 |
+
|
| 595 |
+
def render(self, task: "Task") -> RenderableType:
|
| 596 |
+
text = (
|
| 597 |
+
self.finished_text
|
| 598 |
+
if task.finished
|
| 599 |
+
else self.spinner.render(task.get_time())
|
| 600 |
+
)
|
| 601 |
+
return text
|
| 602 |
+
|
| 603 |
+
|
| 604 |
+
class TextColumn(ProgressColumn):
|
| 605 |
+
"""A column containing text."""
|
| 606 |
+
|
| 607 |
+
def __init__(
|
| 608 |
+
self,
|
| 609 |
+
text_format: str,
|
| 610 |
+
style: StyleType = "none",
|
| 611 |
+
justify: JustifyMethod = "left",
|
| 612 |
+
markup: bool = True,
|
| 613 |
+
highlighter: Optional[Highlighter] = None,
|
| 614 |
+
table_column: Optional[Column] = None,
|
| 615 |
+
) -> None:
|
| 616 |
+
self.text_format = text_format
|
| 617 |
+
self.justify: JustifyMethod = justify
|
| 618 |
+
self.style = style
|
| 619 |
+
self.markup = markup
|
| 620 |
+
self.highlighter = highlighter
|
| 621 |
+
super().__init__(table_column=table_column or Column(no_wrap=True))
|
| 622 |
+
|
| 623 |
+
def render(self, task: "Task") -> Text:
|
| 624 |
+
_text = self.text_format.format(task=task)
|
| 625 |
+
if self.markup:
|
| 626 |
+
text = Text.from_markup(_text, style=self.style, justify=self.justify)
|
| 627 |
+
else:
|
| 628 |
+
text = Text(_text, style=self.style, justify=self.justify)
|
| 629 |
+
if self.highlighter:
|
| 630 |
+
self.highlighter.highlight(text)
|
| 631 |
+
return text
|
| 632 |
+
|
| 633 |
+
|
| 634 |
+
class BarColumn(ProgressColumn):
|
| 635 |
+
"""Renders a visual progress bar.
|
| 636 |
+
|
| 637 |
+
Args:
|
| 638 |
+
bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40.
|
| 639 |
+
style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
|
| 640 |
+
complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
|
| 641 |
+
finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
|
| 642 |
+
pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
|
| 643 |
+
"""
|
| 644 |
+
|
| 645 |
+
def __init__(
|
| 646 |
+
self,
|
| 647 |
+
bar_width: Optional[int] = 40,
|
| 648 |
+
style: StyleType = "bar.back",
|
| 649 |
+
complete_style: StyleType = "bar.complete",
|
| 650 |
+
finished_style: StyleType = "bar.finished",
|
| 651 |
+
pulse_style: StyleType = "bar.pulse",
|
| 652 |
+
table_column: Optional[Column] = None,
|
| 653 |
+
) -> None:
|
| 654 |
+
self.bar_width = bar_width
|
| 655 |
+
self.style = style
|
| 656 |
+
self.complete_style = complete_style
|
| 657 |
+
self.finished_style = finished_style
|
| 658 |
+
self.pulse_style = pulse_style
|
| 659 |
+
super().__init__(table_column=table_column)
|
| 660 |
+
|
| 661 |
+
def render(self, task: "Task") -> ProgressBar:
|
| 662 |
+
"""Gets a progress bar widget for a task."""
|
| 663 |
+
return ProgressBar(
|
| 664 |
+
total=max(0, task.total) if task.total is not None else None,
|
| 665 |
+
completed=max(0, task.completed),
|
| 666 |
+
width=None if self.bar_width is None else max(1, self.bar_width),
|
| 667 |
+
pulse=not task.started,
|
| 668 |
+
animation_time=task.get_time(),
|
| 669 |
+
style=self.style,
|
| 670 |
+
complete_style=self.complete_style,
|
| 671 |
+
finished_style=self.finished_style,
|
| 672 |
+
pulse_style=self.pulse_style,
|
| 673 |
+
)
|
| 674 |
+
|
| 675 |
+
|
| 676 |
+
class TimeElapsedColumn(ProgressColumn):
|
| 677 |
+
"""Renders time elapsed."""
|
| 678 |
+
|
| 679 |
+
def render(self, task: "Task") -> Text:
|
| 680 |
+
"""Show time elapsed."""
|
| 681 |
+
elapsed = task.finished_time if task.finished else task.elapsed
|
| 682 |
+
if elapsed is None:
|
| 683 |
+
return Text("-:--:--", style="progress.elapsed")
|
| 684 |
+
delta = timedelta(seconds=int(elapsed))
|
| 685 |
+
return Text(str(delta), style="progress.elapsed")
|
| 686 |
+
|
| 687 |
+
|
| 688 |
+
class TaskProgressColumn(TextColumn):
|
| 689 |
+
"""Show task progress as a percentage.
|
| 690 |
+
|
| 691 |
+
Args:
|
| 692 |
+
text_format (str, optional): Format for percentage display. Defaults to "[progress.percentage]{task.percentage:>3.0f}%".
|
| 693 |
+
text_format_no_percentage (str, optional): Format if percentage is unknown. Defaults to "".
|
| 694 |
+
style (StyleType, optional): Style of output. Defaults to "none".
|
| 695 |
+
justify (JustifyMethod, optional): Text justification. Defaults to "left".
|
| 696 |
+
markup (bool, optional): Enable markup. Defaults to True.
|
| 697 |
+
highlighter (Optional[Highlighter], optional): Highlighter to apply to output. Defaults to None.
|
| 698 |
+
table_column (Optional[Column], optional): Table Column to use. Defaults to None.
|
| 699 |
+
show_speed (bool, optional): Show speed if total is unknown. Defaults to False.
|
| 700 |
+
"""
|
| 701 |
+
|
| 702 |
+
def __init__(
|
| 703 |
+
self,
|
| 704 |
+
text_format: str = "[progress.percentage]{task.percentage:>3.0f}%",
|
| 705 |
+
text_format_no_percentage: str = "",
|
| 706 |
+
style: StyleType = "none",
|
| 707 |
+
justify: JustifyMethod = "left",
|
| 708 |
+
markup: bool = True,
|
| 709 |
+
highlighter: Optional[Highlighter] = None,
|
| 710 |
+
table_column: Optional[Column] = None,
|
| 711 |
+
show_speed: bool = False,
|
| 712 |
+
) -> None:
|
| 713 |
+
|
| 714 |
+
self.text_format_no_percentage = text_format_no_percentage
|
| 715 |
+
self.show_speed = show_speed
|
| 716 |
+
super().__init__(
|
| 717 |
+
text_format=text_format,
|
| 718 |
+
style=style,
|
| 719 |
+
justify=justify,
|
| 720 |
+
markup=markup,
|
| 721 |
+
highlighter=highlighter,
|
| 722 |
+
table_column=table_column,
|
| 723 |
+
)
|
| 724 |
+
|
| 725 |
+
@classmethod
|
| 726 |
+
def render_speed(cls, speed: Optional[float]) -> Text:
|
| 727 |
+
"""Render the speed in iterations per second.
|
| 728 |
+
|
| 729 |
+
Args:
|
| 730 |
+
task (Task): A Task object.
|
| 731 |
+
|
| 732 |
+
Returns:
|
| 733 |
+
Text: Text object containing the task speed.
|
| 734 |
+
"""
|
| 735 |
+
if speed is None:
|
| 736 |
+
return Text("", style="progress.percentage")
|
| 737 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 738 |
+
int(speed),
|
| 739 |
+
["", "×10³", "×10⁶", "×10⁹", "×10¹²"],
|
| 740 |
+
1000,
|
| 741 |
+
)
|
| 742 |
+
data_speed = speed / unit
|
| 743 |
+
return Text(f"{data_speed:.1f}{suffix} it/s", style="progress.percentage")
|
| 744 |
+
|
| 745 |
+
def render(self, task: "Task") -> Text:
|
| 746 |
+
if task.total is None and self.show_speed:
|
| 747 |
+
return self.render_speed(task.finished_speed or task.speed)
|
| 748 |
+
text_format = (
|
| 749 |
+
self.text_format_no_percentage if task.total is None else self.text_format
|
| 750 |
+
)
|
| 751 |
+
_text = text_format.format(task=task)
|
| 752 |
+
if self.markup:
|
| 753 |
+
text = Text.from_markup(_text, style=self.style, justify=self.justify)
|
| 754 |
+
else:
|
| 755 |
+
text = Text(_text, style=self.style, justify=self.justify)
|
| 756 |
+
if self.highlighter:
|
| 757 |
+
self.highlighter.highlight(text)
|
| 758 |
+
return text
|
| 759 |
+
|
| 760 |
+
|
| 761 |
+
class TimeRemainingColumn(ProgressColumn):
|
| 762 |
+
"""Renders estimated time remaining.
|
| 763 |
+
|
| 764 |
+
Args:
|
| 765 |
+
compact (bool, optional): Render MM:SS when time remaining is less than an hour. Defaults to False.
|
| 766 |
+
elapsed_when_finished (bool, optional): Render time elapsed when the task is finished. Defaults to False.
|
| 767 |
+
"""
|
| 768 |
+
|
| 769 |
+
# Only refresh twice a second to prevent jitter
|
| 770 |
+
max_refresh = 0.5
|
| 771 |
+
|
| 772 |
+
def __init__(
|
| 773 |
+
self,
|
| 774 |
+
compact: bool = False,
|
| 775 |
+
elapsed_when_finished: bool = False,
|
| 776 |
+
table_column: Optional[Column] = None,
|
| 777 |
+
):
|
| 778 |
+
self.compact = compact
|
| 779 |
+
self.elapsed_when_finished = elapsed_when_finished
|
| 780 |
+
super().__init__(table_column=table_column)
|
| 781 |
+
|
| 782 |
+
def render(self, task: "Task") -> Text:
|
| 783 |
+
"""Show time remaining."""
|
| 784 |
+
if self.elapsed_when_finished and task.finished:
|
| 785 |
+
task_time = task.finished_time
|
| 786 |
+
style = "progress.elapsed"
|
| 787 |
+
else:
|
| 788 |
+
task_time = task.time_remaining
|
| 789 |
+
style = "progress.remaining"
|
| 790 |
+
|
| 791 |
+
if task.total is None:
|
| 792 |
+
return Text("", style=style)
|
| 793 |
+
|
| 794 |
+
if task_time is None:
|
| 795 |
+
return Text("--:--" if self.compact else "-:--:--", style=style)
|
| 796 |
+
|
| 797 |
+
# Based on https://github.com/tqdm/tqdm/blob/master/tqdm/std.py
|
| 798 |
+
minutes, seconds = divmod(int(task_time), 60)
|
| 799 |
+
hours, minutes = divmod(minutes, 60)
|
| 800 |
+
|
| 801 |
+
if self.compact and not hours:
|
| 802 |
+
formatted = f"{minutes:02d}:{seconds:02d}"
|
| 803 |
+
else:
|
| 804 |
+
formatted = f"{hours:d}:{minutes:02d}:{seconds:02d}"
|
| 805 |
+
|
| 806 |
+
return Text(formatted, style=style)
|
| 807 |
+
|
| 808 |
+
|
| 809 |
+
class FileSizeColumn(ProgressColumn):
|
| 810 |
+
"""Renders completed filesize."""
|
| 811 |
+
|
| 812 |
+
def render(self, task: "Task") -> Text:
|
| 813 |
+
"""Show data completed."""
|
| 814 |
+
data_size = filesize.decimal(int(task.completed))
|
| 815 |
+
return Text(data_size, style="progress.filesize")
|
| 816 |
+
|
| 817 |
+
|
| 818 |
+
class TotalFileSizeColumn(ProgressColumn):
|
| 819 |
+
"""Renders total filesize."""
|
| 820 |
+
|
| 821 |
+
def render(self, task: "Task") -> Text:
|
| 822 |
+
"""Show data completed."""
|
| 823 |
+
data_size = filesize.decimal(int(task.total)) if task.total is not None else ""
|
| 824 |
+
return Text(data_size, style="progress.filesize.total")
|
| 825 |
+
|
| 826 |
+
|
| 827 |
+
class MofNCompleteColumn(ProgressColumn):
|
| 828 |
+
"""Renders completed count/total, e.g. ' 10/1000'.
|
| 829 |
+
|
| 830 |
+
Best for bounded tasks with int quantities.
|
| 831 |
+
|
| 832 |
+
Space pads the completed count so that progress length does not change as task progresses
|
| 833 |
+
past powers of 10.
|
| 834 |
+
|
| 835 |
+
Args:
|
| 836 |
+
separator (str, optional): Text to separate completed and total values. Defaults to "/".
|
| 837 |
+
"""
|
| 838 |
+
|
| 839 |
+
def __init__(self, separator: str = "/", table_column: Optional[Column] = None):
|
| 840 |
+
self.separator = separator
|
| 841 |
+
super().__init__(table_column=table_column)
|
| 842 |
+
|
| 843 |
+
def render(self, task: "Task") -> Text:
|
| 844 |
+
"""Show completed/total."""
|
| 845 |
+
completed = int(task.completed)
|
| 846 |
+
total = int(task.total) if task.total is not None else "?"
|
| 847 |
+
total_width = len(str(total))
|
| 848 |
+
return Text(
|
| 849 |
+
f"{completed:{total_width}d}{self.separator}{total}",
|
| 850 |
+
style="progress.download",
|
| 851 |
+
)
|
| 852 |
+
|
| 853 |
+
|
| 854 |
+
class DownloadColumn(ProgressColumn):
|
| 855 |
+
"""Renders file size downloaded and total, e.g. '0.5/2.3 GB'.
|
| 856 |
+
|
| 857 |
+
Args:
|
| 858 |
+
binary_units (bool, optional): Use binary units, KiB, MiB etc. Defaults to False.
|
| 859 |
+
"""
|
| 860 |
+
|
| 861 |
+
def __init__(
|
| 862 |
+
self, binary_units: bool = False, table_column: Optional[Column] = None
|
| 863 |
+
) -> None:
|
| 864 |
+
self.binary_units = binary_units
|
| 865 |
+
super().__init__(table_column=table_column)
|
| 866 |
+
|
| 867 |
+
def render(self, task: "Task") -> Text:
|
| 868 |
+
"""Calculate common unit for completed and total."""
|
| 869 |
+
completed = int(task.completed)
|
| 870 |
+
|
| 871 |
+
unit_and_suffix_calculation_base = (
|
| 872 |
+
int(task.total) if task.total is not None else completed
|
| 873 |
+
)
|
| 874 |
+
if self.binary_units:
|
| 875 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 876 |
+
unit_and_suffix_calculation_base,
|
| 877 |
+
["bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"],
|
| 878 |
+
1024,
|
| 879 |
+
)
|
| 880 |
+
else:
|
| 881 |
+
unit, suffix = filesize.pick_unit_and_suffix(
|
| 882 |
+
unit_and_suffix_calculation_base,
|
| 883 |
+
["bytes", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
| 884 |
+
1000,
|
| 885 |
+
)
|
| 886 |
+
precision = 0 if unit == 1 else 1
|
| 887 |
+
|
| 888 |
+
completed_ratio = completed / unit
|
| 889 |
+
completed_str = f"{completed_ratio:,.{precision}f}"
|
| 890 |
+
|
| 891 |
+
if task.total is not None:
|
| 892 |
+
total = int(task.total)
|
| 893 |
+
total_ratio = total / unit
|
| 894 |
+
total_str = f"{total_ratio:,.{precision}f}"
|
| 895 |
+
else:
|
| 896 |
+
total_str = "?"
|
| 897 |
+
|
| 898 |
+
download_status = f"{completed_str}/{total_str} {suffix}"
|
| 899 |
+
download_text = Text(download_status, style="progress.download")
|
| 900 |
+
return download_text
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
class TransferSpeedColumn(ProgressColumn):
|
| 904 |
+
"""Renders human readable transfer speed."""
|
| 905 |
+
|
| 906 |
+
def render(self, task: "Task") -> Text:
|
| 907 |
+
"""Show data transfer speed."""
|
| 908 |
+
speed = task.finished_speed or task.speed
|
| 909 |
+
if speed is None:
|
| 910 |
+
return Text("?", style="progress.data.speed")
|
| 911 |
+
data_speed = filesize.decimal(int(speed))
|
| 912 |
+
return Text(f"{data_speed}/s", style="progress.data.speed")
|
| 913 |
+
|
| 914 |
+
|
| 915 |
+
class ProgressSample(NamedTuple):
|
| 916 |
+
"""Sample of progress for a given time."""
|
| 917 |
+
|
| 918 |
+
timestamp: float
|
| 919 |
+
"""Timestamp of sample."""
|
| 920 |
+
completed: float
|
| 921 |
+
"""Number of steps completed."""
|
| 922 |
+
|
| 923 |
+
|
| 924 |
+
@dataclass
|
| 925 |
+
class Task:
|
| 926 |
+
"""Information regarding a progress task.
|
| 927 |
+
|
| 928 |
+
This object should be considered read-only outside of the :class:`~Progress` class.
|
| 929 |
+
|
| 930 |
+
"""
|
| 931 |
+
|
| 932 |
+
id: TaskID
|
| 933 |
+
"""Task ID associated with this task (used in Progress methods)."""
|
| 934 |
+
|
| 935 |
+
description: str
|
| 936 |
+
"""str: Description of the task."""
|
| 937 |
+
|
| 938 |
+
total: Optional[float]
|
| 939 |
+
"""Optional[float]: Total number of steps in this task."""
|
| 940 |
+
|
| 941 |
+
completed: float
|
| 942 |
+
"""float: Number of steps completed"""
|
| 943 |
+
|
| 944 |
+
_get_time: GetTimeCallable
|
| 945 |
+
"""Callable to get the current time."""
|
| 946 |
+
|
| 947 |
+
finished_time: Optional[float] = None
|
| 948 |
+
"""float: Time task was finished."""
|
| 949 |
+
|
| 950 |
+
visible: bool = True
|
| 951 |
+
"""bool: Indicates if this task is visible in the progress display."""
|
| 952 |
+
|
| 953 |
+
fields: Dict[str, Any] = field(default_factory=dict)
|
| 954 |
+
"""dict: Arbitrary fields passed in via Progress.update."""
|
| 955 |
+
|
| 956 |
+
start_time: Optional[float] = field(default=None, init=False, repr=False)
|
| 957 |
+
"""Optional[float]: Time this task was started, or None if not started."""
|
| 958 |
+
|
| 959 |
+
stop_time: Optional[float] = field(default=None, init=False, repr=False)
|
| 960 |
+
"""Optional[float]: Time this task was stopped, or None if not stopped."""
|
| 961 |
+
|
| 962 |
+
finished_speed: Optional[float] = None
|
| 963 |
+
"""Optional[float]: The last speed for a finished task."""
|
| 964 |
+
|
| 965 |
+
_progress: Deque[ProgressSample] = field(
|
| 966 |
+
default_factory=lambda: deque(maxlen=1000), init=False, repr=False
|
| 967 |
+
)
|
| 968 |
+
|
| 969 |
+
_lock: RLock = field(repr=False, default_factory=RLock)
|
| 970 |
+
"""Thread lock."""
|
| 971 |
+
|
| 972 |
+
def get_time(self) -> float:
|
| 973 |
+
"""float: Get the current time, in seconds."""
|
| 974 |
+
return self._get_time()
|
| 975 |
+
|
| 976 |
+
@property
|
| 977 |
+
def started(self) -> bool:
|
| 978 |
+
"""bool: Check if the task as started."""
|
| 979 |
+
return self.start_time is not None
|
| 980 |
+
|
| 981 |
+
@property
|
| 982 |
+
def remaining(self) -> Optional[float]:
|
| 983 |
+
"""Optional[float]: Get the number of steps remaining, if a non-None total was set."""
|
| 984 |
+
if self.total is None:
|
| 985 |
+
return None
|
| 986 |
+
return self.total - self.completed
|
| 987 |
+
|
| 988 |
+
@property
|
| 989 |
+
def elapsed(self) -> Optional[float]:
|
| 990 |
+
"""Optional[float]: Time elapsed since task was started, or ``None`` if the task hasn't started."""
|
| 991 |
+
if self.start_time is None:
|
| 992 |
+
return None
|
| 993 |
+
if self.stop_time is not None:
|
| 994 |
+
return self.stop_time - self.start_time
|
| 995 |
+
return self.get_time() - self.start_time
|
| 996 |
+
|
| 997 |
+
@property
|
| 998 |
+
def finished(self) -> bool:
|
| 999 |
+
"""Check if the task has finished."""
|
| 1000 |
+
return self.finished_time is not None
|
| 1001 |
+
|
| 1002 |
+
@property
|
| 1003 |
+
def percentage(self) -> float:
|
| 1004 |
+
"""float: Get progress of task as a percentage. If a None total was set, returns 0"""
|
| 1005 |
+
if not self.total:
|
| 1006 |
+
return 0.0
|
| 1007 |
+
completed = (self.completed / self.total) * 100.0
|
| 1008 |
+
completed = min(100.0, max(0.0, completed))
|
| 1009 |
+
return completed
|
| 1010 |
+
|
| 1011 |
+
@property
|
| 1012 |
+
def speed(self) -> Optional[float]:
|
| 1013 |
+
"""Optional[float]: Get the estimated speed in steps per second."""
|
| 1014 |
+
if self.start_time is None:
|
| 1015 |
+
return None
|
| 1016 |
+
with self._lock:
|
| 1017 |
+
progress = self._progress
|
| 1018 |
+
if not progress:
|
| 1019 |
+
return None
|
| 1020 |
+
total_time = progress[-1].timestamp - progress[0].timestamp
|
| 1021 |
+
if total_time == 0:
|
| 1022 |
+
return None
|
| 1023 |
+
iter_progress = iter(progress)
|
| 1024 |
+
next(iter_progress)
|
| 1025 |
+
total_completed = sum(sample.completed for sample in iter_progress)
|
| 1026 |
+
speed = total_completed / total_time
|
| 1027 |
+
return speed
|
| 1028 |
+
|
| 1029 |
+
@property
|
| 1030 |
+
def time_remaining(self) -> Optional[float]:
|
| 1031 |
+
"""Optional[float]: Get estimated time to completion, or ``None`` if no data."""
|
| 1032 |
+
if self.finished:
|
| 1033 |
+
return 0.0
|
| 1034 |
+
speed = self.speed
|
| 1035 |
+
if not speed:
|
| 1036 |
+
return None
|
| 1037 |
+
remaining = self.remaining
|
| 1038 |
+
if remaining is None:
|
| 1039 |
+
return None
|
| 1040 |
+
estimate = ceil(remaining / speed)
|
| 1041 |
+
return estimate
|
| 1042 |
+
|
| 1043 |
+
def _reset(self) -> None:
|
| 1044 |
+
"""Reset progress."""
|
| 1045 |
+
self._progress.clear()
|
| 1046 |
+
self.finished_time = None
|
| 1047 |
+
self.finished_speed = None
|
| 1048 |
+
|
| 1049 |
+
|
| 1050 |
+
class Progress(JupyterMixin):
|
| 1051 |
+
"""Renders an auto-updating progress bar(s).
|
| 1052 |
+
|
| 1053 |
+
Args:
|
| 1054 |
+
console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stdout.
|
| 1055 |
+
auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()`.
|
| 1056 |
+
refresh_per_second (Optional[float], optional): Number of times per second to refresh the progress information or None to use default (10). Defaults to None.
|
| 1057 |
+
speed_estimate_period: (float, optional): Period (in seconds) used to calculate the speed estimate. Defaults to 30.
|
| 1058 |
+
transient: (bool, optional): Clear the progress on exit. Defaults to False.
|
| 1059 |
+
redirect_stdout: (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
|
| 1060 |
+
redirect_stderr: (bool, optional): Enable redirection of stderr. Defaults to True.
|
| 1061 |
+
get_time: (Callable, optional): A callable that gets the current time, or None to use Console.get_time. Defaults to None.
|
| 1062 |
+
disable (bool, optional): Disable progress display. Defaults to False
|
| 1063 |
+
expand (bool, optional): Expand tasks table to fit width. Defaults to False.
|
| 1064 |
+
"""
|
| 1065 |
+
|
| 1066 |
+
def __init__(
|
| 1067 |
+
self,
|
| 1068 |
+
*columns: Union[str, ProgressColumn],
|
| 1069 |
+
console: Optional[Console] = None,
|
| 1070 |
+
auto_refresh: bool = True,
|
| 1071 |
+
refresh_per_second: float = 10,
|
| 1072 |
+
speed_estimate_period: float = 30.0,
|
| 1073 |
+
transient: bool = False,
|
| 1074 |
+
redirect_stdout: bool = True,
|
| 1075 |
+
redirect_stderr: bool = True,
|
| 1076 |
+
get_time: Optional[GetTimeCallable] = None,
|
| 1077 |
+
disable: bool = False,
|
| 1078 |
+
expand: bool = False,
|
| 1079 |
+
) -> None:
|
| 1080 |
+
assert refresh_per_second > 0, "refresh_per_second must be > 0"
|
| 1081 |
+
self._lock = RLock()
|
| 1082 |
+
self.columns = columns or self.get_default_columns()
|
| 1083 |
+
self.speed_estimate_period = speed_estimate_period
|
| 1084 |
+
|
| 1085 |
+
self.disable = disable
|
| 1086 |
+
self.expand = expand
|
| 1087 |
+
self._tasks: Dict[TaskID, Task] = {}
|
| 1088 |
+
self._task_index: TaskID = TaskID(0)
|
| 1089 |
+
self.live = Live(
|
| 1090 |
+
console=console or get_console(),
|
| 1091 |
+
auto_refresh=auto_refresh,
|
| 1092 |
+
refresh_per_second=refresh_per_second,
|
| 1093 |
+
transient=transient,
|
| 1094 |
+
redirect_stdout=redirect_stdout,
|
| 1095 |
+
redirect_stderr=redirect_stderr,
|
| 1096 |
+
get_renderable=self.get_renderable,
|
| 1097 |
+
)
|
| 1098 |
+
self.get_time = get_time or self.console.get_time
|
| 1099 |
+
self.print = self.console.print
|
| 1100 |
+
self.log = self.console.log
|
| 1101 |
+
|
| 1102 |
+
@classmethod
|
| 1103 |
+
def get_default_columns(cls) -> Tuple[ProgressColumn, ...]:
|
| 1104 |
+
"""Get the default columns used for a new Progress instance:
|
| 1105 |
+
- a text column for the description (TextColumn)
|
| 1106 |
+
- the bar itself (BarColumn)
|
| 1107 |
+
- a text column showing completion percentage (TextColumn)
|
| 1108 |
+
- an estimated-time-remaining column (TimeRemainingColumn)
|
| 1109 |
+
If the Progress instance is created without passing a columns argument,
|
| 1110 |
+
the default columns defined here will be used.
|
| 1111 |
+
|
| 1112 |
+
You can also create a Progress instance using custom columns before
|
| 1113 |
+
and/or after the defaults, as in this example:
|
| 1114 |
+
|
| 1115 |
+
progress = Progress(
|
| 1116 |
+
SpinnerColumn(),
|
| 1117 |
+
*Progress.default_columns(),
|
| 1118 |
+
"Elapsed:",
|
| 1119 |
+
TimeElapsedColumn(),
|
| 1120 |
+
)
|
| 1121 |
+
|
| 1122 |
+
This code shows the creation of a Progress display, containing
|
| 1123 |
+
a spinner to the left, the default columns, and a labeled elapsed
|
| 1124 |
+
time column.
|
| 1125 |
+
"""
|
| 1126 |
+
return (
|
| 1127 |
+
TextColumn("[progress.description]{task.description}"),
|
| 1128 |
+
BarColumn(),
|
| 1129 |
+
TaskProgressColumn(),
|
| 1130 |
+
TimeRemainingColumn(),
|
| 1131 |
+
)
|
| 1132 |
+
|
| 1133 |
+
@property
|
| 1134 |
+
def console(self) -> Console:
|
| 1135 |
+
return self.live.console
|
| 1136 |
+
|
| 1137 |
+
@property
|
| 1138 |
+
def tasks(self) -> List[Task]:
|
| 1139 |
+
"""Get a list of Task instances."""
|
| 1140 |
+
with self._lock:
|
| 1141 |
+
return list(self._tasks.values())
|
| 1142 |
+
|
| 1143 |
+
@property
|
| 1144 |
+
def task_ids(self) -> List[TaskID]:
|
| 1145 |
+
"""A list of task IDs."""
|
| 1146 |
+
with self._lock:
|
| 1147 |
+
return list(self._tasks.keys())
|
| 1148 |
+
|
| 1149 |
+
@property
|
| 1150 |
+
def finished(self) -> bool:
|
| 1151 |
+
"""Check if all tasks have been completed."""
|
| 1152 |
+
with self._lock:
|
| 1153 |
+
if not self._tasks:
|
| 1154 |
+
return True
|
| 1155 |
+
return all(task.finished for task in self._tasks.values())
|
| 1156 |
+
|
| 1157 |
+
def start(self) -> None:
|
| 1158 |
+
"""Start the progress display."""
|
| 1159 |
+
if not self.disable:
|
| 1160 |
+
self.live.start(refresh=True)
|
| 1161 |
+
|
| 1162 |
+
def stop(self) -> None:
|
| 1163 |
+
"""Stop the progress display."""
|
| 1164 |
+
self.live.stop()
|
| 1165 |
+
if not self.console.is_interactive:
|
| 1166 |
+
self.console.print()
|
| 1167 |
+
|
| 1168 |
+
def __enter__(self) -> "Progress":
|
| 1169 |
+
self.start()
|
| 1170 |
+
return self
|
| 1171 |
+
|
| 1172 |
+
def __exit__(
|
| 1173 |
+
self,
|
| 1174 |
+
exc_type: Optional[Type[BaseException]],
|
| 1175 |
+
exc_val: Optional[BaseException],
|
| 1176 |
+
exc_tb: Optional[TracebackType],
|
| 1177 |
+
) -> None:
|
| 1178 |
+
self.stop()
|
| 1179 |
+
|
| 1180 |
+
def track(
|
| 1181 |
+
self,
|
| 1182 |
+
sequence: Union[Iterable[ProgressType], Sequence[ProgressType]],
|
| 1183 |
+
total: Optional[float] = None,
|
| 1184 |
+
task_id: Optional[TaskID] = None,
|
| 1185 |
+
description: str = "Working...",
|
| 1186 |
+
update_period: float = 0.1,
|
| 1187 |
+
) -> Iterable[ProgressType]:
|
| 1188 |
+
"""Track progress by iterating over a sequence.
|
| 1189 |
+
|
| 1190 |
+
Args:
|
| 1191 |
+
sequence (Sequence[ProgressType]): A sequence of values you want to iterate over and track progress.
|
| 1192 |
+
total: (float, optional): Total number of steps. Default is len(sequence).
|
| 1193 |
+
task_id: (TaskID): Task to track. Default is new task.
|
| 1194 |
+
description: (str, optional): Description of task, if new task is created.
|
| 1195 |
+
update_period (float, optional): Minimum time (in seconds) between calls to update(). Defaults to 0.1.
|
| 1196 |
+
|
| 1197 |
+
Returns:
|
| 1198 |
+
Iterable[ProgressType]: An iterable of values taken from the provided sequence.
|
| 1199 |
+
"""
|
| 1200 |
+
if total is None:
|
| 1201 |
+
total = float(length_hint(sequence)) or None
|
| 1202 |
+
|
| 1203 |
+
if task_id is None:
|
| 1204 |
+
task_id = self.add_task(description, total=total)
|
| 1205 |
+
else:
|
| 1206 |
+
self.update(task_id, total=total)
|
| 1207 |
+
|
| 1208 |
+
if self.live.auto_refresh:
|
| 1209 |
+
with _TrackThread(self, task_id, update_period) as track_thread:
|
| 1210 |
+
for value in sequence:
|
| 1211 |
+
yield value
|
| 1212 |
+
track_thread.completed += 1
|
| 1213 |
+
else:
|
| 1214 |
+
advance = self.advance
|
| 1215 |
+
refresh = self.refresh
|
| 1216 |
+
for value in sequence:
|
| 1217 |
+
yield value
|
| 1218 |
+
advance(task_id, 1)
|
| 1219 |
+
refresh()
|
| 1220 |
+
|
| 1221 |
+
def wrap_file(
|
| 1222 |
+
self,
|
| 1223 |
+
file: BinaryIO,
|
| 1224 |
+
total: Optional[int] = None,
|
| 1225 |
+
*,
|
| 1226 |
+
task_id: Optional[TaskID] = None,
|
| 1227 |
+
description: str = "Reading...",
|
| 1228 |
+
) -> BinaryIO:
|
| 1229 |
+
"""Track progress file reading from a binary file.
|
| 1230 |
+
|
| 1231 |
+
Args:
|
| 1232 |
+
file (BinaryIO): A file-like object opened in binary mode.
|
| 1233 |
+
total (int, optional): Total number of bytes to read. This must be provided unless a task with a total is also given.
|
| 1234 |
+
task_id (TaskID): Task to track. Default is new task.
|
| 1235 |
+
description (str, optional): Description of task, if new task is created.
|
| 1236 |
+
|
| 1237 |
+
Returns:
|
| 1238 |
+
BinaryIO: A readable file-like object in binary mode.
|
| 1239 |
+
|
| 1240 |
+
Raises:
|
| 1241 |
+
ValueError: When no total value can be extracted from the arguments or the task.
|
| 1242 |
+
"""
|
| 1243 |
+
# attempt to recover the total from the task
|
| 1244 |
+
total_bytes: Optional[float] = None
|
| 1245 |
+
if total is not None:
|
| 1246 |
+
total_bytes = total
|
| 1247 |
+
elif task_id is not None:
|
| 1248 |
+
with self._lock:
|
| 1249 |
+
total_bytes = self._tasks[task_id].total
|
| 1250 |
+
if total_bytes is None:
|
| 1251 |
+
raise ValueError(
|
| 1252 |
+
f"unable to get the total number of bytes, please specify 'total'"
|
| 1253 |
+
)
|
| 1254 |
+
|
| 1255 |
+
# update total of task or create new task
|
| 1256 |
+
if task_id is None:
|
| 1257 |
+
task_id = self.add_task(description, total=total_bytes)
|
| 1258 |
+
else:
|
| 1259 |
+
self.update(task_id, total=total_bytes)
|
| 1260 |
+
|
| 1261 |
+
return _Reader(file, self, task_id, close_handle=False)
|
| 1262 |
+
|
| 1263 |
+
@typing.overload
|
| 1264 |
+
def open(
|
| 1265 |
+
self,
|
| 1266 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 1267 |
+
mode: Literal["rb"],
|
| 1268 |
+
buffering: int = -1,
|
| 1269 |
+
encoding: Optional[str] = None,
|
| 1270 |
+
errors: Optional[str] = None,
|
| 1271 |
+
newline: Optional[str] = None,
|
| 1272 |
+
*,
|
| 1273 |
+
total: Optional[int] = None,
|
| 1274 |
+
task_id: Optional[TaskID] = None,
|
| 1275 |
+
description: str = "Reading...",
|
| 1276 |
+
) -> BinaryIO:
|
| 1277 |
+
pass
|
| 1278 |
+
|
| 1279 |
+
@typing.overload
|
| 1280 |
+
def open(
|
| 1281 |
+
self,
|
| 1282 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 1283 |
+
mode: Union[Literal["r"], Literal["rt"]],
|
| 1284 |
+
buffering: int = -1,
|
| 1285 |
+
encoding: Optional[str] = None,
|
| 1286 |
+
errors: Optional[str] = None,
|
| 1287 |
+
newline: Optional[str] = None,
|
| 1288 |
+
*,
|
| 1289 |
+
total: Optional[int] = None,
|
| 1290 |
+
task_id: Optional[TaskID] = None,
|
| 1291 |
+
description: str = "Reading...",
|
| 1292 |
+
) -> TextIO:
|
| 1293 |
+
pass
|
| 1294 |
+
|
| 1295 |
+
def open(
|
| 1296 |
+
self,
|
| 1297 |
+
file: Union[str, "PathLike[str]", bytes],
|
| 1298 |
+
mode: Union[Literal["rb"], Literal["rt"], Literal["r"]] = "r",
|
| 1299 |
+
buffering: int = -1,
|
| 1300 |
+
encoding: Optional[str] = None,
|
| 1301 |
+
errors: Optional[str] = None,
|
| 1302 |
+
newline: Optional[str] = None,
|
| 1303 |
+
*,
|
| 1304 |
+
total: Optional[int] = None,
|
| 1305 |
+
task_id: Optional[TaskID] = None,
|
| 1306 |
+
description: str = "Reading...",
|
| 1307 |
+
) -> Union[BinaryIO, TextIO]:
|
| 1308 |
+
"""Track progress while reading from a binary file.
|
| 1309 |
+
|
| 1310 |
+
Args:
|
| 1311 |
+
path (Union[str, PathLike[str]]): The path to the file to read.
|
| 1312 |
+
mode (str): The mode to use to open the file. Only supports "r", "rb" or "rt".
|
| 1313 |
+
buffering (int): The buffering strategy to use, see :func:`io.open`.
|
| 1314 |
+
encoding (str, optional): The encoding to use when reading in text mode, see :func:`io.open`.
|
| 1315 |
+
errors (str, optional): The error handling strategy for decoding errors, see :func:`io.open`.
|
| 1316 |
+
newline (str, optional): The strategy for handling newlines in text mode, see :func:`io.open`.
|
| 1317 |
+
total (int, optional): Total number of bytes to read. If none given, os.stat(path).st_size is used.
|
| 1318 |
+
task_id (TaskID): Task to track. Default is new task.
|
| 1319 |
+
description (str, optional): Description of task, if new task is created.
|
| 1320 |
+
|
| 1321 |
+
Returns:
|
| 1322 |
+
BinaryIO: A readable file-like object in binary mode.
|
| 1323 |
+
|
| 1324 |
+
Raises:
|
| 1325 |
+
ValueError: When an invalid mode is given.
|
| 1326 |
+
"""
|
| 1327 |
+
# normalize the mode (always rb, rt)
|
| 1328 |
+
_mode = "".join(sorted(mode, reverse=False))
|
| 1329 |
+
if _mode not in ("br", "rt", "r"):
|
| 1330 |
+
raise ValueError("invalid mode {!r}".format(mode))
|
| 1331 |
+
|
| 1332 |
+
# patch buffering to provide the same behaviour as the builtin `open`
|
| 1333 |
+
line_buffering = buffering == 1
|
| 1334 |
+
if _mode == "br" and buffering == 1:
|
| 1335 |
+
warnings.warn(
|
| 1336 |
+
"line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used",
|
| 1337 |
+
RuntimeWarning,
|
| 1338 |
+
)
|
| 1339 |
+
buffering = -1
|
| 1340 |
+
elif _mode in ("rt", "r"):
|
| 1341 |
+
if buffering == 0:
|
| 1342 |
+
raise ValueError("can't have unbuffered text I/O")
|
| 1343 |
+
elif buffering == 1:
|
| 1344 |
+
buffering = -1
|
| 1345 |
+
|
| 1346 |
+
# attempt to get the total with `os.stat`
|
| 1347 |
+
if total is None:
|
| 1348 |
+
total = stat(file).st_size
|
| 1349 |
+
|
| 1350 |
+
# update total of task or create new task
|
| 1351 |
+
if task_id is None:
|
| 1352 |
+
task_id = self.add_task(description, total=total)
|
| 1353 |
+
else:
|
| 1354 |
+
self.update(task_id, total=total)
|
| 1355 |
+
|
| 1356 |
+
# open the file in binary mode,
|
| 1357 |
+
handle = io.open(file, "rb", buffering=buffering)
|
| 1358 |
+
reader = _Reader(handle, self, task_id, close_handle=True)
|
| 1359 |
+
|
| 1360 |
+
# wrap the reader in a `TextIOWrapper` if text mode
|
| 1361 |
+
if mode in ("r", "rt"):
|
| 1362 |
+
return io.TextIOWrapper(
|
| 1363 |
+
reader,
|
| 1364 |
+
encoding=encoding,
|
| 1365 |
+
errors=errors,
|
| 1366 |
+
newline=newline,
|
| 1367 |
+
line_buffering=line_buffering,
|
| 1368 |
+
)
|
| 1369 |
+
|
| 1370 |
+
return reader
|
| 1371 |
+
|
| 1372 |
+
def start_task(self, task_id: TaskID) -> None:
|
| 1373 |
+
"""Start a task.
|
| 1374 |
+
|
| 1375 |
+
Starts a task (used when calculating elapsed time). You may need to call this manually,
|
| 1376 |
+
if you called ``add_task`` with ``start=False``.
|
| 1377 |
+
|
| 1378 |
+
Args:
|
| 1379 |
+
task_id (TaskID): ID of task.
|
| 1380 |
+
"""
|
| 1381 |
+
with self._lock:
|
| 1382 |
+
task = self._tasks[task_id]
|
| 1383 |
+
if task.start_time is None:
|
| 1384 |
+
task.start_time = self.get_time()
|
| 1385 |
+
|
| 1386 |
+
def stop_task(self, task_id: TaskID) -> None:
|
| 1387 |
+
"""Stop a task.
|
| 1388 |
+
|
| 1389 |
+
This will freeze the elapsed time on the task.
|
| 1390 |
+
|
| 1391 |
+
Args:
|
| 1392 |
+
task_id (TaskID): ID of task.
|
| 1393 |
+
"""
|
| 1394 |
+
with self._lock:
|
| 1395 |
+
task = self._tasks[task_id]
|
| 1396 |
+
current_time = self.get_time()
|
| 1397 |
+
if task.start_time is None:
|
| 1398 |
+
task.start_time = current_time
|
| 1399 |
+
task.stop_time = current_time
|
| 1400 |
+
|
| 1401 |
+
def update(
|
| 1402 |
+
self,
|
| 1403 |
+
task_id: TaskID,
|
| 1404 |
+
*,
|
| 1405 |
+
total: Optional[float] = None,
|
| 1406 |
+
completed: Optional[float] = None,
|
| 1407 |
+
advance: Optional[float] = None,
|
| 1408 |
+
description: Optional[str] = None,
|
| 1409 |
+
visible: Optional[bool] = None,
|
| 1410 |
+
refresh: bool = False,
|
| 1411 |
+
**fields: Any,
|
| 1412 |
+
) -> None:
|
| 1413 |
+
"""Update information associated with a task.
|
| 1414 |
+
|
| 1415 |
+
Args:
|
| 1416 |
+
task_id (TaskID): Task id (returned by add_task).
|
| 1417 |
+
total (float, optional): Updates task.total if not None.
|
| 1418 |
+
completed (float, optional): Updates task.completed if not None.
|
| 1419 |
+
advance (float, optional): Add a value to task.completed if not None.
|
| 1420 |
+
description (str, optional): Change task description if not None.
|
| 1421 |
+
visible (bool, optional): Set visible flag if not None.
|
| 1422 |
+
refresh (bool): Force a refresh of progress information. Default is False.
|
| 1423 |
+
**fields (Any): Additional data fields required for rendering.
|
| 1424 |
+
"""
|
| 1425 |
+
with self._lock:
|
| 1426 |
+
task = self._tasks[task_id]
|
| 1427 |
+
completed_start = task.completed
|
| 1428 |
+
|
| 1429 |
+
if total is not None and total != task.total:
|
| 1430 |
+
task.total = total
|
| 1431 |
+
task._reset()
|
| 1432 |
+
if advance is not None:
|
| 1433 |
+
task.completed += advance
|
| 1434 |
+
if completed is not None:
|
| 1435 |
+
task.completed = completed
|
| 1436 |
+
if description is not None:
|
| 1437 |
+
task.description = description
|
| 1438 |
+
if visible is not None:
|
| 1439 |
+
task.visible = visible
|
| 1440 |
+
task.fields.update(fields)
|
| 1441 |
+
update_completed = task.completed - completed_start
|
| 1442 |
+
|
| 1443 |
+
current_time = self.get_time()
|
| 1444 |
+
old_sample_time = current_time - self.speed_estimate_period
|
| 1445 |
+
_progress = task._progress
|
| 1446 |
+
|
| 1447 |
+
popleft = _progress.popleft
|
| 1448 |
+
while _progress and _progress[0].timestamp < old_sample_time:
|
| 1449 |
+
popleft()
|
| 1450 |
+
if update_completed > 0:
|
| 1451 |
+
_progress.append(ProgressSample(current_time, update_completed))
|
| 1452 |
+
if (
|
| 1453 |
+
task.total is not None
|
| 1454 |
+
and task.completed >= task.total
|
| 1455 |
+
and task.finished_time is None
|
| 1456 |
+
):
|
| 1457 |
+
task.finished_time = task.elapsed
|
| 1458 |
+
|
| 1459 |
+
if refresh:
|
| 1460 |
+
self.refresh()
|
| 1461 |
+
|
| 1462 |
+
def reset(
|
| 1463 |
+
self,
|
| 1464 |
+
task_id: TaskID,
|
| 1465 |
+
*,
|
| 1466 |
+
start: bool = True,
|
| 1467 |
+
total: Optional[float] = None,
|
| 1468 |
+
completed: int = 0,
|
| 1469 |
+
visible: Optional[bool] = None,
|
| 1470 |
+
description: Optional[str] = None,
|
| 1471 |
+
**fields: Any,
|
| 1472 |
+
) -> None:
|
| 1473 |
+
"""Reset a task so completed is 0 and the clock is reset.
|
| 1474 |
+
|
| 1475 |
+
Args:
|
| 1476 |
+
task_id (TaskID): ID of task.
|
| 1477 |
+
start (bool, optional): Start the task after reset. Defaults to True.
|
| 1478 |
+
total (float, optional): New total steps in task, or None to use current total. Defaults to None.
|
| 1479 |
+
completed (int, optional): Number of steps completed. Defaults to 0.
|
| 1480 |
+
visible (bool, optional): Enable display of the task. Defaults to True.
|
| 1481 |
+
description (str, optional): Change task description if not None. Defaults to None.
|
| 1482 |
+
**fields (str): Additional data fields required for rendering.
|
| 1483 |
+
"""
|
| 1484 |
+
current_time = self.get_time()
|
| 1485 |
+
with self._lock:
|
| 1486 |
+
task = self._tasks[task_id]
|
| 1487 |
+
task._reset()
|
| 1488 |
+
task.start_time = current_time if start else None
|
| 1489 |
+
if total is not None:
|
| 1490 |
+
task.total = total
|
| 1491 |
+
task.completed = completed
|
| 1492 |
+
if visible is not None:
|
| 1493 |
+
task.visible = visible
|
| 1494 |
+
if fields:
|
| 1495 |
+
task.fields = fields
|
| 1496 |
+
if description is not None:
|
| 1497 |
+
task.description = description
|
| 1498 |
+
task.finished_time = None
|
| 1499 |
+
self.refresh()
|
| 1500 |
+
|
| 1501 |
+
def advance(self, task_id: TaskID, advance: float = 1) -> None:
|
| 1502 |
+
"""Advance task by a number of steps.
|
| 1503 |
+
|
| 1504 |
+
Args:
|
| 1505 |
+
task_id (TaskID): ID of task.
|
| 1506 |
+
advance (float): Number of steps to advance. Default is 1.
|
| 1507 |
+
"""
|
| 1508 |
+
current_time = self.get_time()
|
| 1509 |
+
with self._lock:
|
| 1510 |
+
task = self._tasks[task_id]
|
| 1511 |
+
completed_start = task.completed
|
| 1512 |
+
task.completed += advance
|
| 1513 |
+
update_completed = task.completed - completed_start
|
| 1514 |
+
old_sample_time = current_time - self.speed_estimate_period
|
| 1515 |
+
_progress = task._progress
|
| 1516 |
+
|
| 1517 |
+
popleft = _progress.popleft
|
| 1518 |
+
while _progress and _progress[0].timestamp < old_sample_time:
|
| 1519 |
+
popleft()
|
| 1520 |
+
while len(_progress) > 1000:
|
| 1521 |
+
popleft()
|
| 1522 |
+
_progress.append(ProgressSample(current_time, update_completed))
|
| 1523 |
+
if (
|
| 1524 |
+
task.total is not None
|
| 1525 |
+
and task.completed >= task.total
|
| 1526 |
+
and task.finished_time is None
|
| 1527 |
+
):
|
| 1528 |
+
task.finished_time = task.elapsed
|
| 1529 |
+
task.finished_speed = task.speed
|
| 1530 |
+
|
| 1531 |
+
def refresh(self) -> None:
|
| 1532 |
+
"""Refresh (render) the progress information."""
|
| 1533 |
+
if not self.disable and self.live.is_started:
|
| 1534 |
+
self.live.refresh()
|
| 1535 |
+
|
| 1536 |
+
def get_renderable(self) -> RenderableType:
|
| 1537 |
+
"""Get a renderable for the progress display."""
|
| 1538 |
+
renderable = Group(*self.get_renderables())
|
| 1539 |
+
return renderable
|
| 1540 |
+
|
| 1541 |
+
def get_renderables(self) -> Iterable[RenderableType]:
|
| 1542 |
+
"""Get a number of renderables for the progress display."""
|
| 1543 |
+
table = self.make_tasks_table(self.tasks)
|
| 1544 |
+
yield table
|
| 1545 |
+
|
| 1546 |
+
def make_tasks_table(self, tasks: Iterable[Task]) -> Table:
|
| 1547 |
+
"""Get a table to render the Progress display.
|
| 1548 |
+
|
| 1549 |
+
Args:
|
| 1550 |
+
tasks (Iterable[Task]): An iterable of Task instances, one per row of the table.
|
| 1551 |
+
|
| 1552 |
+
Returns:
|
| 1553 |
+
Table: A table instance.
|
| 1554 |
+
"""
|
| 1555 |
+
table_columns = (
|
| 1556 |
+
(
|
| 1557 |
+
Column(no_wrap=True)
|
| 1558 |
+
if isinstance(_column, str)
|
| 1559 |
+
else _column.get_table_column().copy()
|
| 1560 |
+
)
|
| 1561 |
+
for _column in self.columns
|
| 1562 |
+
)
|
| 1563 |
+
table = Table.grid(*table_columns, padding=(0, 1), expand=self.expand)
|
| 1564 |
+
|
| 1565 |
+
for task in tasks:
|
| 1566 |
+
if task.visible:
|
| 1567 |
+
table.add_row(
|
| 1568 |
+
*(
|
| 1569 |
+
(
|
| 1570 |
+
column.format(task=task)
|
| 1571 |
+
if isinstance(column, str)
|
| 1572 |
+
else column(task)
|
| 1573 |
+
)
|
| 1574 |
+
for column in self.columns
|
| 1575 |
+
)
|
| 1576 |
+
)
|
| 1577 |
+
return table
|
| 1578 |
+
|
| 1579 |
+
def __rich__(self) -> RenderableType:
|
| 1580 |
+
"""Makes the Progress class itself renderable."""
|
| 1581 |
+
with self._lock:
|
| 1582 |
+
return self.get_renderable()
|
| 1583 |
+
|
| 1584 |
+
def add_task(
|
| 1585 |
+
self,
|
| 1586 |
+
description: str,
|
| 1587 |
+
start: bool = True,
|
| 1588 |
+
total: Optional[float] = 100.0,
|
| 1589 |
+
completed: int = 0,
|
| 1590 |
+
visible: bool = True,
|
| 1591 |
+
**fields: Any,
|
| 1592 |
+
) -> TaskID:
|
| 1593 |
+
"""Add a new 'task' to the Progress display.
|
| 1594 |
+
|
| 1595 |
+
Args:
|
| 1596 |
+
description (str): A description of the task.
|
| 1597 |
+
start (bool, optional): Start the task immediately (to calculate elapsed time). If set to False,
|
| 1598 |
+
you will need to call `start` manually. Defaults to True.
|
| 1599 |
+
total (float, optional): Number of total steps in the progress if known.
|
| 1600 |
+
Set to None to render a pulsing animation. Defaults to 100.
|
| 1601 |
+
completed (int, optional): Number of steps completed so far. Defaults to 0.
|
| 1602 |
+
visible (bool, optional): Enable display of the task. Defaults to True.
|
| 1603 |
+
**fields (str): Additional data fields required for rendering.
|
| 1604 |
+
|
| 1605 |
+
Returns:
|
| 1606 |
+
TaskID: An ID you can use when calling `update`.
|
| 1607 |
+
"""
|
| 1608 |
+
with self._lock:
|
| 1609 |
+
task = Task(
|
| 1610 |
+
self._task_index,
|
| 1611 |
+
description,
|
| 1612 |
+
total,
|
| 1613 |
+
completed,
|
| 1614 |
+
visible=visible,
|
| 1615 |
+
fields=fields,
|
| 1616 |
+
_get_time=self.get_time,
|
| 1617 |
+
_lock=self._lock,
|
| 1618 |
+
)
|
| 1619 |
+
self._tasks[self._task_index] = task
|
| 1620 |
+
if start:
|
| 1621 |
+
self.start_task(self._task_index)
|
| 1622 |
+
new_task_index = self._task_index
|
| 1623 |
+
self._task_index = TaskID(int(self._task_index) + 1)
|
| 1624 |
+
self.refresh()
|
| 1625 |
+
return new_task_index
|
| 1626 |
+
|
| 1627 |
+
def remove_task(self, task_id: TaskID) -> None:
|
| 1628 |
+
"""Delete a task if it exists.
|
| 1629 |
+
|
| 1630 |
+
Args:
|
| 1631 |
+
task_id (TaskID): A task ID.
|
| 1632 |
+
|
| 1633 |
+
"""
|
| 1634 |
+
with self._lock:
|
| 1635 |
+
del self._tasks[task_id]
|
| 1636 |
+
|
| 1637 |
+
|
| 1638 |
+
if __name__ == "__main__": # pragma: no coverage
|
| 1639 |
+
|
| 1640 |
+
import random
|
| 1641 |
+
import time
|
| 1642 |
+
|
| 1643 |
+
from .panel import Panel
|
| 1644 |
+
from .rule import Rule
|
| 1645 |
+
from .syntax import Syntax
|
| 1646 |
+
from .table import Table
|
| 1647 |
+
|
| 1648 |
+
syntax = Syntax(
|
| 1649 |
+
'''def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
|
| 1650 |
+
"""Iterate and generate a tuple with a flag for last value."""
|
| 1651 |
+
iter_values = iter(values)
|
| 1652 |
+
try:
|
| 1653 |
+
previous_value = next(iter_values)
|
| 1654 |
+
except StopIteration:
|
| 1655 |
+
return
|
| 1656 |
+
for value in iter_values:
|
| 1657 |
+
yield False, previous_value
|
| 1658 |
+
previous_value = value
|
| 1659 |
+
yield True, previous_value''',
|
| 1660 |
+
"python",
|
| 1661 |
+
line_numbers=True,
|
| 1662 |
+
)
|
| 1663 |
+
|
| 1664 |
+
table = Table("foo", "bar", "baz")
|
| 1665 |
+
table.add_row("1", "2", "3")
|
| 1666 |
+
|
| 1667 |
+
progress_renderables = [
|
| 1668 |
+
"Text may be printed while the progress bars are rendering.",
|
| 1669 |
+
Panel("In fact, [i]any[/i] renderable will work"),
|
| 1670 |
+
"Such as [magenta]tables[/]...",
|
| 1671 |
+
table,
|
| 1672 |
+
"Pretty printed structures...",
|
| 1673 |
+
{"type": "example", "text": "Pretty printed"},
|
| 1674 |
+
"Syntax...",
|
| 1675 |
+
syntax,
|
| 1676 |
+
Rule("Give it a try!"),
|
| 1677 |
+
]
|
| 1678 |
+
|
| 1679 |
+
from itertools import cycle
|
| 1680 |
+
|
| 1681 |
+
examples = cycle(progress_renderables)
|
| 1682 |
+
|
| 1683 |
+
console = Console(record=True)
|
| 1684 |
+
|
| 1685 |
+
with Progress(
|
| 1686 |
+
SpinnerColumn(),
|
| 1687 |
+
*Progress.get_default_columns(),
|
| 1688 |
+
TimeElapsedColumn(),
|
| 1689 |
+
console=console,
|
| 1690 |
+
transient=False,
|
| 1691 |
+
) as progress:
|
| 1692 |
+
|
| 1693 |
+
task1 = progress.add_task("[red]Downloading", total=1000)
|
| 1694 |
+
task2 = progress.add_task("[green]Processing", total=1000)
|
| 1695 |
+
task3 = progress.add_task("[yellow]Thinking", total=None)
|
| 1696 |
+
|
| 1697 |
+
while not progress.finished:
|
| 1698 |
+
progress.update(task1, advance=0.5)
|
| 1699 |
+
progress.update(task2, advance=0.3)
|
| 1700 |
+
time.sleep(0.01)
|
| 1701 |
+
if random.randint(0, 100) < 1:
|
| 1702 |
+
progress.log(next(examples))
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/progress_bar.py
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 160 |
+
width = min(self.width or options.max_width, options.max_width)
|
| 161 |
+
ascii = options.legacy_windows or options.ascii_only
|
| 162 |
+
should_pulse = self.pulse or self.total is None
|
| 163 |
+
if should_pulse:
|
| 164 |
+
yield from self._render_pulse(console, width, ascii=ascii)
|
| 165 |
+
return
|
| 166 |
+
|
| 167 |
+
completed: Optional[float] = (
|
| 168 |
+
min(self.total, max(0, self.completed)) if self.total is not None else None
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
bar = "-" if ascii else "━"
|
| 172 |
+
half_bar_right = " " if ascii else "╸"
|
| 173 |
+
half_bar_left = " " if ascii else "╺"
|
| 174 |
+
complete_halves = (
|
| 175 |
+
int(width * 2 * completed / self.total)
|
| 176 |
+
if self.total and completed is not None
|
| 177 |
+
else width * 2
|
| 178 |
+
)
|
| 179 |
+
bar_count = complete_halves // 2
|
| 180 |
+
half_bar_count = complete_halves % 2
|
| 181 |
+
style = console.get_style(self.style)
|
| 182 |
+
is_finished = self.total is None or self.completed >= self.total
|
| 183 |
+
complete_style = console.get_style(
|
| 184 |
+
self.finished_style if is_finished else self.complete_style
|
| 185 |
+
)
|
| 186 |
+
_Segment = Segment
|
| 187 |
+
if bar_count:
|
| 188 |
+
yield _Segment(bar * bar_count, complete_style)
|
| 189 |
+
if half_bar_count:
|
| 190 |
+
yield _Segment(half_bar_right * half_bar_count, complete_style)
|
| 191 |
+
|
| 192 |
+
if not console.no_color:
|
| 193 |
+
remaining_bars = width - bar_count - half_bar_count
|
| 194 |
+
if remaining_bars and console.color_system is not None:
|
| 195 |
+
if not half_bar_count and bar_count:
|
| 196 |
+
yield _Segment(half_bar_left, style)
|
| 197 |
+
remaining_bars -= 1
|
| 198 |
+
if remaining_bars:
|
| 199 |
+
yield _Segment(bar * remaining_bars, style)
|
| 200 |
+
|
| 201 |
+
def __rich_measure__(
|
| 202 |
+
self, console: Console, options: ConsoleOptions
|
| 203 |
+
) -> Measurement:
|
| 204 |
+
return (
|
| 205 |
+
Measurement(self.width, self.width)
|
| 206 |
+
if self.width is not None
|
| 207 |
+
else Measurement(4, options.max_width)
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
if __name__ == "__main__": # pragma: no cover
|
| 212 |
+
console = Console()
|
| 213 |
+
bar = ProgressBar(width=50, total=100)
|
| 214 |
+
|
| 215 |
+
import time
|
| 216 |
+
|
| 217 |
+
console.show_cursor(False)
|
| 218 |
+
for n in range(0, 101, 1):
|
| 219 |
+
bar.update(n)
|
| 220 |
+
console.print(bar)
|
| 221 |
+
console.file.write("\r")
|
| 222 |
+
time.sleep(0.05)
|
| 223 |
+
console.show_cursor(True)
|
| 224 |
+
console.print()
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/prompt.py
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
show_default (bool, optional): Show default in prompt. Defaults to True.
|
| 40 |
+
show_choices (bool, optional): Show choices in prompt. Defaults to True.
|
| 41 |
+
"""
|
| 42 |
+
|
| 43 |
+
response_type: type = str
|
| 44 |
+
|
| 45 |
+
validate_error_message = "[prompt.invalid]Please enter a valid value"
|
| 46 |
+
illegal_choice_message = (
|
| 47 |
+
"[prompt.invalid.choice]Please select one of the available options"
|
| 48 |
+
)
|
| 49 |
+
prompt_suffix = ": "
|
| 50 |
+
|
| 51 |
+
choices: Optional[List[str]] = None
|
| 52 |
+
|
| 53 |
+
def __init__(
|
| 54 |
+
self,
|
| 55 |
+
prompt: TextType = "",
|
| 56 |
+
*,
|
| 57 |
+
console: Optional[Console] = None,
|
| 58 |
+
password: bool = False,
|
| 59 |
+
choices: Optional[List[str]] = None,
|
| 60 |
+
show_default: bool = True,
|
| 61 |
+
show_choices: bool = True,
|
| 62 |
+
) -> None:
|
| 63 |
+
self.console = console or get_console()
|
| 64 |
+
self.prompt = (
|
| 65 |
+
Text.from_markup(prompt, style="prompt")
|
| 66 |
+
if isinstance(prompt, str)
|
| 67 |
+
else prompt
|
| 68 |
+
)
|
| 69 |
+
self.password = password
|
| 70 |
+
if choices is not None:
|
| 71 |
+
self.choices = choices
|
| 72 |
+
self.show_default = show_default
|
| 73 |
+
self.show_choices = show_choices
|
| 74 |
+
|
| 75 |
+
@classmethod
|
| 76 |
+
@overload
|
| 77 |
+
def ask(
|
| 78 |
+
cls,
|
| 79 |
+
prompt: TextType = "",
|
| 80 |
+
*,
|
| 81 |
+
console: Optional[Console] = None,
|
| 82 |
+
password: bool = False,
|
| 83 |
+
choices: Optional[List[str]] = None,
|
| 84 |
+
show_default: bool = True,
|
| 85 |
+
show_choices: bool = True,
|
| 86 |
+
default: DefaultType,
|
| 87 |
+
stream: Optional[TextIO] = None,
|
| 88 |
+
) -> Union[DefaultType, PromptType]:
|
| 89 |
+
...
|
| 90 |
+
|
| 91 |
+
@classmethod
|
| 92 |
+
@overload
|
| 93 |
+
def ask(
|
| 94 |
+
cls,
|
| 95 |
+
prompt: TextType = "",
|
| 96 |
+
*,
|
| 97 |
+
console: Optional[Console] = None,
|
| 98 |
+
password: bool = False,
|
| 99 |
+
choices: Optional[List[str]] = None,
|
| 100 |
+
show_default: bool = True,
|
| 101 |
+
show_choices: bool = True,
|
| 102 |
+
stream: Optional[TextIO] = None,
|
| 103 |
+
) -> PromptType:
|
| 104 |
+
...
|
| 105 |
+
|
| 106 |
+
@classmethod
|
| 107 |
+
def ask(
|
| 108 |
+
cls,
|
| 109 |
+
prompt: TextType = "",
|
| 110 |
+
*,
|
| 111 |
+
console: Optional[Console] = None,
|
| 112 |
+
password: bool = False,
|
| 113 |
+
choices: Optional[List[str]] = None,
|
| 114 |
+
show_default: bool = True,
|
| 115 |
+
show_choices: bool = True,
|
| 116 |
+
default: Any = ...,
|
| 117 |
+
stream: Optional[TextIO] = None,
|
| 118 |
+
) -> Any:
|
| 119 |
+
"""Shortcut to construct and run a prompt loop and return the result.
|
| 120 |
+
|
| 121 |
+
Example:
|
| 122 |
+
>>> filename = Prompt.ask("Enter a filename")
|
| 123 |
+
|
| 124 |
+
Args:
|
| 125 |
+
prompt (TextType, optional): Prompt text. Defaults to "".
|
| 126 |
+
console (Console, optional): A Console instance or None to use global console. Defaults to None.
|
| 127 |
+
password (bool, optional): Enable password input. Defaults to False.
|
| 128 |
+
choices (List[str], optional): A list of valid choices. Defaults to None.
|
| 129 |
+
show_default (bool, optional): Show default in prompt. Defaults to True.
|
| 130 |
+
show_choices (bool, optional): Show choices in prompt. Defaults to True.
|
| 131 |
+
stream (TextIO, optional): Optional text file open for reading to get input. Defaults to None.
|
| 132 |
+
"""
|
| 133 |
+
_prompt = cls(
|
| 134 |
+
prompt,
|
| 135 |
+
console=console,
|
| 136 |
+
password=password,
|
| 137 |
+
choices=choices,
|
| 138 |
+
show_default=show_default,
|
| 139 |
+
show_choices=show_choices,
|
| 140 |
+
)
|
| 141 |
+
return _prompt(default=default, stream=stream)
|
| 142 |
+
|
| 143 |
+
def render_default(self, default: DefaultType) -> Text:
|
| 144 |
+
"""Turn the supplied default in to a Text instance.
|
| 145 |
+
|
| 146 |
+
Args:
|
| 147 |
+
default (DefaultType): Default value.
|
| 148 |
+
|
| 149 |
+
Returns:
|
| 150 |
+
Text: Text containing rendering of default value.
|
| 151 |
+
"""
|
| 152 |
+
return Text(f"({default})", "prompt.default")
|
| 153 |
+
|
| 154 |
+
def make_prompt(self, default: DefaultType) -> Text:
|
| 155 |
+
"""Make prompt text.
|
| 156 |
+
|
| 157 |
+
Args:
|
| 158 |
+
default (DefaultType): Default value.
|
| 159 |
+
|
| 160 |
+
Returns:
|
| 161 |
+
Text: Text to display in prompt.
|
| 162 |
+
"""
|
| 163 |
+
prompt = self.prompt.copy()
|
| 164 |
+
prompt.end = ""
|
| 165 |
+
|
| 166 |
+
if self.show_choices and self.choices:
|
| 167 |
+
_choices = "/".join(self.choices)
|
| 168 |
+
choices = f"[{_choices}]"
|
| 169 |
+
prompt.append(" ")
|
| 170 |
+
prompt.append(choices, "prompt.choices")
|
| 171 |
+
|
| 172 |
+
if (
|
| 173 |
+
default != ...
|
| 174 |
+
and self.show_default
|
| 175 |
+
and isinstance(default, (str, self.response_type))
|
| 176 |
+
):
|
| 177 |
+
prompt.append(" ")
|
| 178 |
+
_default = self.render_default(default)
|
| 179 |
+
prompt.append(_default)
|
| 180 |
+
|
| 181 |
+
prompt.append(self.prompt_suffix)
|
| 182 |
+
|
| 183 |
+
return prompt
|
| 184 |
+
|
| 185 |
+
@classmethod
|
| 186 |
+
def get_input(
|
| 187 |
+
cls,
|
| 188 |
+
console: Console,
|
| 189 |
+
prompt: TextType,
|
| 190 |
+
password: bool,
|
| 191 |
+
stream: Optional[TextIO] = None,
|
| 192 |
+
) -> str:
|
| 193 |
+
"""Get input from user.
|
| 194 |
+
|
| 195 |
+
Args:
|
| 196 |
+
console (Console): Console instance.
|
| 197 |
+
prompt (TextType): Prompt text.
|
| 198 |
+
password (bool): Enable password entry.
|
| 199 |
+
|
| 200 |
+
Returns:
|
| 201 |
+
str: String from user.
|
| 202 |
+
"""
|
| 203 |
+
return console.input(prompt, password=password, stream=stream)
|
| 204 |
+
|
| 205 |
+
def check_choice(self, value: str) -> bool:
|
| 206 |
+
"""Check value is in the list of valid choices.
|
| 207 |
+
|
| 208 |
+
Args:
|
| 209 |
+
value (str): Value entered by user.
|
| 210 |
+
|
| 211 |
+
Returns:
|
| 212 |
+
bool: True if choice was valid, otherwise False.
|
| 213 |
+
"""
|
| 214 |
+
assert self.choices is not None
|
| 215 |
+
return value.strip() in self.choices
|
| 216 |
+
|
| 217 |
+
def process_response(self, value: str) -> PromptType:
|
| 218 |
+
"""Process response from user, convert to prompt type.
|
| 219 |
+
|
| 220 |
+
Args:
|
| 221 |
+
value (str): String typed by user.
|
| 222 |
+
|
| 223 |
+
Raises:
|
| 224 |
+
InvalidResponse: If ``value`` is invalid.
|
| 225 |
+
|
| 226 |
+
Returns:
|
| 227 |
+
PromptType: The value to be returned from ask method.
|
| 228 |
+
"""
|
| 229 |
+
value = value.strip()
|
| 230 |
+
try:
|
| 231 |
+
return_value: PromptType = self.response_type(value)
|
| 232 |
+
except ValueError:
|
| 233 |
+
raise InvalidResponse(self.validate_error_message)
|
| 234 |
+
|
| 235 |
+
if self.choices is not None and not self.check_choice(value):
|
| 236 |
+
raise InvalidResponse(self.illegal_choice_message)
|
| 237 |
+
|
| 238 |
+
return return_value
|
| 239 |
+
|
| 240 |
+
def on_validate_error(self, value: str, error: InvalidResponse) -> None:
|
| 241 |
+
"""Called to handle validation error.
|
| 242 |
+
|
| 243 |
+
Args:
|
| 244 |
+
value (str): String entered by user.
|
| 245 |
+
error (InvalidResponse): Exception instance the initiated the error.
|
| 246 |
+
"""
|
| 247 |
+
self.console.print(error)
|
| 248 |
+
|
| 249 |
+
def pre_prompt(self) -> None:
|
| 250 |
+
"""Hook to display something before the prompt."""
|
| 251 |
+
|
| 252 |
+
@overload
|
| 253 |
+
def __call__(self, *, stream: Optional[TextIO] = None) -> PromptType:
|
| 254 |
+
...
|
| 255 |
+
|
| 256 |
+
@overload
|
| 257 |
+
def __call__(
|
| 258 |
+
self, *, default: DefaultType, stream: Optional[TextIO] = None
|
| 259 |
+
) -> Union[PromptType, DefaultType]:
|
| 260 |
+
...
|
| 261 |
+
|
| 262 |
+
def __call__(self, *, default: Any = ..., stream: Optional[TextIO] = None) -> Any:
|
| 263 |
+
"""Run the prompt loop.
|
| 264 |
+
|
| 265 |
+
Args:
|
| 266 |
+
default (Any, optional): Optional default value.
|
| 267 |
+
|
| 268 |
+
Returns:
|
| 269 |
+
PromptType: Processed value.
|
| 270 |
+
"""
|
| 271 |
+
while True:
|
| 272 |
+
self.pre_prompt()
|
| 273 |
+
prompt = self.make_prompt(default)
|
| 274 |
+
value = self.get_input(self.console, prompt, self.password, stream=stream)
|
| 275 |
+
if value == "" and default != ...:
|
| 276 |
+
return default
|
| 277 |
+
try:
|
| 278 |
+
return_value = self.process_response(value)
|
| 279 |
+
except InvalidResponse as error:
|
| 280 |
+
self.on_validate_error(value, error)
|
| 281 |
+
continue
|
| 282 |
+
else:
|
| 283 |
+
return return_value
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
class Prompt(PromptBase[str]):
|
| 287 |
+
"""A prompt that returns a str.
|
| 288 |
+
|
| 289 |
+
Example:
|
| 290 |
+
>>> name = Prompt.ask("Enter your name")
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
"""
|
| 294 |
+
|
| 295 |
+
response_type = str
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
class IntPrompt(PromptBase[int]):
|
| 299 |
+
"""A prompt that returns an integer.
|
| 300 |
+
|
| 301 |
+
Example:
|
| 302 |
+
>>> burrito_count = IntPrompt.ask("How many burritos do you want to order")
|
| 303 |
+
|
| 304 |
+
"""
|
| 305 |
+
|
| 306 |
+
response_type = int
|
| 307 |
+
validate_error_message = "[prompt.invalid]Please enter a valid integer number"
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class FloatPrompt(PromptBase[int]):
|
| 311 |
+
"""A prompt that returns a float.
|
| 312 |
+
|
| 313 |
+
Example:
|
| 314 |
+
>>> temperature = FloatPrompt.ask("Enter desired temperature")
|
| 315 |
+
|
| 316 |
+
"""
|
| 317 |
+
|
| 318 |
+
response_type = float
|
| 319 |
+
validate_error_message = "[prompt.invalid]Please enter a number"
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
class Confirm(PromptBase[bool]):
|
| 323 |
+
"""A yes / no confirmation prompt.
|
| 324 |
+
|
| 325 |
+
Example:
|
| 326 |
+
>>> if Confirm.ask("Continue"):
|
| 327 |
+
run_job()
|
| 328 |
+
|
| 329 |
+
"""
|
| 330 |
+
|
| 331 |
+
response_type = bool
|
| 332 |
+
validate_error_message = "[prompt.invalid]Please enter Y or N"
|
| 333 |
+
choices: List[str] = ["y", "n"]
|
| 334 |
+
|
| 335 |
+
def render_default(self, default: DefaultType) -> Text:
|
| 336 |
+
"""Render the default as (y) or (n) rather than True/False."""
|
| 337 |
+
yes, no = self.choices
|
| 338 |
+
return Text(f"({yes})" if default else f"({no})", style="prompt.default")
|
| 339 |
+
|
| 340 |
+
def process_response(self, value: str) -> bool:
|
| 341 |
+
"""Convert choices to a bool."""
|
| 342 |
+
value = value.strip().lower()
|
| 343 |
+
if value not in self.choices:
|
| 344 |
+
raise InvalidResponse(self.validate_error_message)
|
| 345 |
+
return value == self.choices[0]
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
if __name__ == "__main__": # pragma: no cover
|
| 349 |
+
|
| 350 |
+
from pip._vendor.rich import print
|
| 351 |
+
|
| 352 |
+
if Confirm.ask("Run [i]prompt[/i] tests?", default=True):
|
| 353 |
+
while True:
|
| 354 |
+
result = IntPrompt.ask(
|
| 355 |
+
":rocket: Enter a number between [b]1[/b] and [b]10[/b]", default=5
|
| 356 |
+
)
|
| 357 |
+
if result >= 1 and result <= 10:
|
| 358 |
+
break
|
| 359 |
+
print(":pile_of_poo: [prompt.invalid]Number must be between 1 and 10")
|
| 360 |
+
print(f"number={result}")
|
| 361 |
+
|
| 362 |
+
while True:
|
| 363 |
+
password = Prompt.ask(
|
| 364 |
+
"Please enter a password [cyan](must be at least 5 characters)",
|
| 365 |
+
password=True,
|
| 366 |
+
)
|
| 367 |
+
if len(password) >= 5:
|
| 368 |
+
break
|
| 369 |
+
print("[prompt.invalid]password too short")
|
| 370 |
+
print(f"password={password!r}")
|
| 371 |
+
|
| 372 |
+
fruit = Prompt.ask("Enter a fruit", choices=["apple", "orange", "pear"])
|
| 373 |
+
print(f"fruit={fruit!r}")
|
| 374 |
+
|
| 375 |
+
else:
|
| 376 |
+
print("[b]OK :loudly_crying_face:")
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/protocol.py
ADDED
|
@@ -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)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/region.py
ADDED
|
@@ -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
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/repr.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import inspect
|
| 2 |
+
from functools import partial
|
| 3 |
+
from typing import (
|
| 4 |
+
Any,
|
| 5 |
+
Callable,
|
| 6 |
+
Iterable,
|
| 7 |
+
List,
|
| 8 |
+
Optional,
|
| 9 |
+
Tuple,
|
| 10 |
+
Type,
|
| 11 |
+
TypeVar,
|
| 12 |
+
Union,
|
| 13 |
+
overload,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
T = TypeVar("T")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
Result = Iterable[Union[Any, Tuple[Any], Tuple[str, Any], Tuple[str, Any, Any]]]
|
| 20 |
+
RichReprResult = Result
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class ReprError(Exception):
|
| 24 |
+
"""An error occurred when attempting to build a repr."""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@overload
|
| 28 |
+
def auto(cls: Optional[Type[T]]) -> Type[T]:
|
| 29 |
+
...
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
@overload
|
| 33 |
+
def auto(*, angular: bool = False) -> Callable[[Type[T]], Type[T]]:
|
| 34 |
+
...
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def auto(
|
| 38 |
+
cls: Optional[Type[T]] = None, *, angular: Optional[bool] = None
|
| 39 |
+
) -> Union[Type[T], Callable[[Type[T]], Type[T]]]:
|
| 40 |
+
"""Class decorator to create __repr__ from __rich_repr__"""
|
| 41 |
+
|
| 42 |
+
def do_replace(cls: Type[T], angular: Optional[bool] = None) -> Type[T]:
|
| 43 |
+
def auto_repr(self: T) -> str:
|
| 44 |
+
"""Create repr string from __rich_repr__"""
|
| 45 |
+
repr_str: List[str] = []
|
| 46 |
+
append = repr_str.append
|
| 47 |
+
|
| 48 |
+
angular: bool = getattr(self.__rich_repr__, "angular", False) # type: ignore[attr-defined]
|
| 49 |
+
for arg in self.__rich_repr__(): # type: ignore[attr-defined]
|
| 50 |
+
if isinstance(arg, tuple):
|
| 51 |
+
if len(arg) == 1:
|
| 52 |
+
append(repr(arg[0]))
|
| 53 |
+
else:
|
| 54 |
+
key, value, *default = arg
|
| 55 |
+
if key is None:
|
| 56 |
+
append(repr(value))
|
| 57 |
+
else:
|
| 58 |
+
if default and default[0] == value:
|
| 59 |
+
continue
|
| 60 |
+
append(f"{key}={value!r}")
|
| 61 |
+
else:
|
| 62 |
+
append(repr(arg))
|
| 63 |
+
if angular:
|
| 64 |
+
return f"<{self.__class__.__name__} {' '.join(repr_str)}>"
|
| 65 |
+
else:
|
| 66 |
+
return f"{self.__class__.__name__}({', '.join(repr_str)})"
|
| 67 |
+
|
| 68 |
+
def auto_rich_repr(self: Type[T]) -> Result:
|
| 69 |
+
"""Auto generate __rich_rep__ from signature of __init__"""
|
| 70 |
+
try:
|
| 71 |
+
signature = inspect.signature(self.__init__)
|
| 72 |
+
for name, param in signature.parameters.items():
|
| 73 |
+
if param.kind == param.POSITIONAL_ONLY:
|
| 74 |
+
yield getattr(self, name)
|
| 75 |
+
elif param.kind in (
|
| 76 |
+
param.POSITIONAL_OR_KEYWORD,
|
| 77 |
+
param.KEYWORD_ONLY,
|
| 78 |
+
):
|
| 79 |
+
if param.default == param.empty:
|
| 80 |
+
yield getattr(self, param.name)
|
| 81 |
+
else:
|
| 82 |
+
yield param.name, getattr(self, param.name), param.default
|
| 83 |
+
except Exception as error:
|
| 84 |
+
raise ReprError(
|
| 85 |
+
f"Failed to auto generate __rich_repr__; {error}"
|
| 86 |
+
) from None
|
| 87 |
+
|
| 88 |
+
if not hasattr(cls, "__rich_repr__"):
|
| 89 |
+
auto_rich_repr.__doc__ = "Build a rich repr"
|
| 90 |
+
cls.__rich_repr__ = auto_rich_repr # type: ignore[attr-defined]
|
| 91 |
+
|
| 92 |
+
auto_repr.__doc__ = "Return repr(self)"
|
| 93 |
+
cls.__repr__ = auto_repr # type: ignore[assignment]
|
| 94 |
+
if angular is not None:
|
| 95 |
+
cls.__rich_repr__.angular = angular # type: ignore[attr-defined]
|
| 96 |
+
return cls
|
| 97 |
+
|
| 98 |
+
if cls is None:
|
| 99 |
+
return partial(do_replace, angular=angular)
|
| 100 |
+
else:
|
| 101 |
+
return do_replace(cls, angular=angular)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
@overload
|
| 105 |
+
def rich_repr(cls: Optional[Type[T]]) -> Type[T]:
|
| 106 |
+
...
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
@overload
|
| 110 |
+
def rich_repr(*, angular: bool = False) -> Callable[[Type[T]], Type[T]]:
|
| 111 |
+
...
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def rich_repr(
|
| 115 |
+
cls: Optional[Type[T]] = None, *, angular: bool = False
|
| 116 |
+
) -> Union[Type[T], Callable[[Type[T]], Type[T]]]:
|
| 117 |
+
if cls is None:
|
| 118 |
+
return auto(angular=angular)
|
| 119 |
+
else:
|
| 120 |
+
return auto(cls)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
if __name__ == "__main__":
|
| 124 |
+
|
| 125 |
+
@auto
|
| 126 |
+
class Foo:
|
| 127 |
+
def __rich_repr__(self) -> Result:
|
| 128 |
+
yield "foo"
|
| 129 |
+
yield "bar", {"shopping": ["eggs", "ham", "pineapple"]}
|
| 130 |
+
yield "buy", "hand sanitizer"
|
| 131 |
+
|
| 132 |
+
foo = Foo()
|
| 133 |
+
from pip._vendor.rich.console import Console
|
| 134 |
+
|
| 135 |
+
console = Console()
|
| 136 |
+
|
| 137 |
+
console.rule("Standard repr")
|
| 138 |
+
console.print(foo)
|
| 139 |
+
|
| 140 |
+
console.print(foo, width=60)
|
| 141 |
+
console.print(foo, width=30)
|
| 142 |
+
|
| 143 |
+
console.rule("Angular repr")
|
| 144 |
+
Foo.__rich_repr__.angular = True # type: ignore[attr-defined]
|
| 145 |
+
|
| 146 |
+
console.print(foo)
|
| 147 |
+
|
| 148 |
+
console.print(foo, width=60)
|
| 149 |
+
console.print(foo, width=30)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/rule.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Union
|
| 2 |
+
|
| 3 |
+
from .align import AlignMethod
|
| 4 |
+
from .cells import cell_len, set_cell_size
|
| 5 |
+
from .console import Console, ConsoleOptions, RenderResult
|
| 6 |
+
from .jupyter import JupyterMixin
|
| 7 |
+
from .measure import Measurement
|
| 8 |
+
from .style import Style
|
| 9 |
+
from .text import Text
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Rule(JupyterMixin):
|
| 13 |
+
"""A console renderable to draw a horizontal rule (line).
|
| 14 |
+
|
| 15 |
+
Args:
|
| 16 |
+
title (Union[str, Text], optional): Text to render in the rule. Defaults to "".
|
| 17 |
+
characters (str, optional): Character(s) used to draw the line. Defaults to "─".
|
| 18 |
+
style (StyleType, optional): Style of Rule. Defaults to "rule.line".
|
| 19 |
+
end (str, optional): Character at end of Rule. defaults to "\\\\n"
|
| 20 |
+
align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center".
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
title: Union[str, Text] = "",
|
| 26 |
+
*,
|
| 27 |
+
characters: str = "─",
|
| 28 |
+
style: Union[str, Style] = "rule.line",
|
| 29 |
+
end: str = "\n",
|
| 30 |
+
align: AlignMethod = "center",
|
| 31 |
+
) -> None:
|
| 32 |
+
if cell_len(characters) < 1:
|
| 33 |
+
raise ValueError(
|
| 34 |
+
"'characters' argument must have a cell width of at least 1"
|
| 35 |
+
)
|
| 36 |
+
if align not in ("left", "center", "right"):
|
| 37 |
+
raise ValueError(
|
| 38 |
+
f'invalid value for align, expected "left", "center", "right" (not {align!r})'
|
| 39 |
+
)
|
| 40 |
+
self.title = title
|
| 41 |
+
self.characters = characters
|
| 42 |
+
self.style = style
|
| 43 |
+
self.end = end
|
| 44 |
+
self.align = align
|
| 45 |
+
|
| 46 |
+
def __repr__(self) -> str:
|
| 47 |
+
return f"Rule({self.title!r}, {self.characters!r})"
|
| 48 |
+
|
| 49 |
+
def __rich_console__(
|
| 50 |
+
self, console: Console, options: ConsoleOptions
|
| 51 |
+
) -> RenderResult:
|
| 52 |
+
width = options.max_width
|
| 53 |
+
|
| 54 |
+
characters = (
|
| 55 |
+
"-"
|
| 56 |
+
if (options.ascii_only and not self.characters.isascii())
|
| 57 |
+
else self.characters
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
chars_len = cell_len(characters)
|
| 61 |
+
if not self.title:
|
| 62 |
+
yield self._rule_line(chars_len, width)
|
| 63 |
+
return
|
| 64 |
+
|
| 65 |
+
if isinstance(self.title, Text):
|
| 66 |
+
title_text = self.title
|
| 67 |
+
else:
|
| 68 |
+
title_text = console.render_str(self.title, style="rule.text")
|
| 69 |
+
|
| 70 |
+
title_text.plain = title_text.plain.replace("\n", " ")
|
| 71 |
+
title_text.expand_tabs()
|
| 72 |
+
|
| 73 |
+
required_space = 4 if self.align == "center" else 2
|
| 74 |
+
truncate_width = max(0, width - required_space)
|
| 75 |
+
if not truncate_width:
|
| 76 |
+
yield self._rule_line(chars_len, width)
|
| 77 |
+
return
|
| 78 |
+
|
| 79 |
+
rule_text = Text(end=self.end)
|
| 80 |
+
if self.align == "center":
|
| 81 |
+
title_text.truncate(truncate_width, overflow="ellipsis")
|
| 82 |
+
side_width = (width - cell_len(title_text.plain)) // 2
|
| 83 |
+
left = Text(characters * (side_width // chars_len + 1))
|
| 84 |
+
left.truncate(side_width - 1)
|
| 85 |
+
right_length = width - cell_len(left.plain) - cell_len(title_text.plain)
|
| 86 |
+
right = Text(characters * (side_width // chars_len + 1))
|
| 87 |
+
right.truncate(right_length)
|
| 88 |
+
rule_text.append(left.plain + " ", self.style)
|
| 89 |
+
rule_text.append(title_text)
|
| 90 |
+
rule_text.append(" " + right.plain, self.style)
|
| 91 |
+
elif self.align == "left":
|
| 92 |
+
title_text.truncate(truncate_width, overflow="ellipsis")
|
| 93 |
+
rule_text.append(title_text)
|
| 94 |
+
rule_text.append(" ")
|
| 95 |
+
rule_text.append(characters * (width - rule_text.cell_len), self.style)
|
| 96 |
+
elif self.align == "right":
|
| 97 |
+
title_text.truncate(truncate_width, overflow="ellipsis")
|
| 98 |
+
rule_text.append(characters * (width - title_text.cell_len - 1), self.style)
|
| 99 |
+
rule_text.append(" ")
|
| 100 |
+
rule_text.append(title_text)
|
| 101 |
+
|
| 102 |
+
rule_text.plain = set_cell_size(rule_text.plain, width)
|
| 103 |
+
yield rule_text
|
| 104 |
+
|
| 105 |
+
def _rule_line(self, chars_len: int, width: int) -> Text:
|
| 106 |
+
rule_text = Text(self.characters * ((width // chars_len) + 1), self.style)
|
| 107 |
+
rule_text.truncate(width)
|
| 108 |
+
rule_text.plain = set_cell_size(rule_text.plain, width)
|
| 109 |
+
return rule_text
|
| 110 |
+
|
| 111 |
+
def __rich_measure__(
|
| 112 |
+
self, console: Console, options: ConsoleOptions
|
| 113 |
+
) -> Measurement:
|
| 114 |
+
return Measurement(1, 1)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
if __name__ == "__main__": # pragma: no cover
|
| 118 |
+
import sys
|
| 119 |
+
|
| 120 |
+
from pip._vendor.rich.console import Console
|
| 121 |
+
|
| 122 |
+
try:
|
| 123 |
+
text = sys.argv[1]
|
| 124 |
+
except IndexError:
|
| 125 |
+
text = "Hello, World"
|
| 126 |
+
console = Console()
|
| 127 |
+
console.print(Rule(title=text))
|
| 128 |
+
|
| 129 |
+
console = Console()
|
| 130 |
+
console.print(Rule("foo"), width=4)
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/scope.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections.abc import Mapping
|
| 2 |
+
from typing import TYPE_CHECKING, Any, Optional, Tuple
|
| 3 |
+
|
| 4 |
+
from .highlighter import ReprHighlighter
|
| 5 |
+
from .panel import Panel
|
| 6 |
+
from .pretty import Pretty
|
| 7 |
+
from .table import Table
|
| 8 |
+
from .text import Text, TextType
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from .console import ConsoleRenderable
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def render_scope(
|
| 15 |
+
scope: "Mapping[str, Any]",
|
| 16 |
+
*,
|
| 17 |
+
title: Optional[TextType] = None,
|
| 18 |
+
sort_keys: bool = True,
|
| 19 |
+
indent_guides: bool = False,
|
| 20 |
+
max_length: Optional[int] = None,
|
| 21 |
+
max_string: Optional[int] = None,
|
| 22 |
+
) -> "ConsoleRenderable":
|
| 23 |
+
"""Render python variables in a given scope.
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
scope (Mapping): A mapping containing variable names and values.
|
| 27 |
+
title (str, optional): Optional title. Defaults to None.
|
| 28 |
+
sort_keys (bool, optional): Enable sorting of items. Defaults to True.
|
| 29 |
+
indent_guides (bool, optional): Enable indentation guides. Defaults to False.
|
| 30 |
+
max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
|
| 31 |
+
Defaults to None.
|
| 32 |
+
max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.
|
| 33 |
+
|
| 34 |
+
Returns:
|
| 35 |
+
ConsoleRenderable: A renderable object.
|
| 36 |
+
"""
|
| 37 |
+
highlighter = ReprHighlighter()
|
| 38 |
+
items_table = Table.grid(padding=(0, 1), expand=False)
|
| 39 |
+
items_table.add_column(justify="right")
|
| 40 |
+
|
| 41 |
+
def sort_items(item: Tuple[str, Any]) -> Tuple[bool, str]:
|
| 42 |
+
"""Sort special variables first, then alphabetically."""
|
| 43 |
+
key, _ = item
|
| 44 |
+
return (not key.startswith("__"), key.lower())
|
| 45 |
+
|
| 46 |
+
items = sorted(scope.items(), key=sort_items) if sort_keys else scope.items()
|
| 47 |
+
for key, value in items:
|
| 48 |
+
key_text = Text.assemble(
|
| 49 |
+
(key, "scope.key.special" if key.startswith("__") else "scope.key"),
|
| 50 |
+
(" =", "scope.equals"),
|
| 51 |
+
)
|
| 52 |
+
items_table.add_row(
|
| 53 |
+
key_text,
|
| 54 |
+
Pretty(
|
| 55 |
+
value,
|
| 56 |
+
highlighter=highlighter,
|
| 57 |
+
indent_guides=indent_guides,
|
| 58 |
+
max_length=max_length,
|
| 59 |
+
max_string=max_string,
|
| 60 |
+
),
|
| 61 |
+
)
|
| 62 |
+
return Panel.fit(
|
| 63 |
+
items_table,
|
| 64 |
+
title=title,
|
| 65 |
+
border_style="scope.border",
|
| 66 |
+
padding=(0, 1),
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
if __name__ == "__main__": # pragma: no cover
|
| 71 |
+
from pip._vendor.rich import print
|
| 72 |
+
|
| 73 |
+
print()
|
| 74 |
+
|
| 75 |
+
def test(foo: float, bar: float) -> None:
|
| 76 |
+
list_of_things = [1, 2, 3, None, 4, True, False, "Hello World"]
|
| 77 |
+
dict_of_things = {
|
| 78 |
+
"version": "1.1",
|
| 79 |
+
"method": "confirmFruitPurchase",
|
| 80 |
+
"params": [["apple", "orange", "mangoes", "pomelo"], 1.123],
|
| 81 |
+
"id": "194521489",
|
| 82 |
+
}
|
| 83 |
+
print(render_scope(locals(), title="[i]locals", sort_keys=False))
|
| 84 |
+
|
| 85 |
+
test(20.3423, 3.1427)
|
| 86 |
+
print()
|
.venv/lib/python3.12/site-packages/pip/_vendor/rich/screen.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional, TYPE_CHECKING
|
| 2 |
+
|
| 3 |
+
from .segment import Segment
|
| 4 |
+
from .style import StyleType
|
| 5 |
+
from ._loop import loop_last
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if TYPE_CHECKING:
|
| 9 |
+
from .console import (
|
| 10 |
+
Console,
|
| 11 |
+
ConsoleOptions,
|
| 12 |
+
RenderResult,
|
| 13 |
+
RenderableType,
|
| 14 |
+
Group,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class Screen:
|
| 19 |
+
"""A renderable that fills the terminal screen and crops excess.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
renderable (RenderableType): Child renderable.
|
| 23 |
+
style (StyleType, optional): Optional background style. Defaults to None.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
renderable: "RenderableType"
|
| 27 |
+
|
| 28 |
+
def __init__(
|
| 29 |
+
self,
|
| 30 |
+
*renderables: "RenderableType",
|
| 31 |
+
style: Optional[StyleType] = None,
|
| 32 |
+
application_mode: bool = False,
|
| 33 |
+
) -> None:
|
| 34 |
+
from pip._vendor.rich.console import Group
|
| 35 |
+
|
| 36 |
+
self.renderable = Group(*renderables)
|
| 37 |
+
self.style = style
|
| 38 |
+
self.application_mode = application_mode
|
| 39 |
+
|
| 40 |
+
def __rich_console__(
|
| 41 |
+
self, console: "Console", options: "ConsoleOptions"
|
| 42 |
+
) -> "RenderResult":
|
| 43 |
+
width, height = options.size
|
| 44 |
+
style = console.get_style(self.style) if self.style else None
|
| 45 |
+
render_options = options.update(width=width, height=height)
|
| 46 |
+
lines = console.render_lines(
|
| 47 |
+
self.renderable or "", render_options, style=style, pad=True
|
| 48 |
+
)
|
| 49 |
+
lines = Segment.set_shape(lines, width, height, style=style)
|
| 50 |
+
new_line = Segment("\n\r") if self.application_mode else Segment.line()
|
| 51 |
+
for last, line in loop_last(lines):
|
| 52 |
+
yield from line
|
| 53 |
+
if not last:
|
| 54 |
+
yield new_line
|