comparison env/lib/python3.9/site-packages/pip/_vendor/progress/counter.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
4 #
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
17 from __future__ import unicode_literals
18 from . import Infinite, Progress
19
20
21 class Counter(Infinite):
22 def update(self):
23 self.write(str(self.index))
24
25
26 class Countdown(Progress):
27 def update(self):
28 self.write(str(self.remaining))
29
30
31 class Stack(Progress):
32 phases = (' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█')
33
34 def update(self):
35 nphases = len(self.phases)
36 i = min(nphases - 1, int(self.progress * nphases))
37 self.write(self.phases[i])
38
39
40 class Pie(Stack):
41 phases = ('○', '◔', '◑', '◕', '●')