Mercurial > repos > guerler > hhblits
comparison lib/python3.8/site-packages/pip/_vendor/progress/counter.py @ 0:9e54283cc701 draft
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
| author | guerler | 
|---|---|
| date | Mon, 27 Jul 2020 03:47:31 -0400 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| -1:000000000000 | 0:9e54283cc701 | 
|---|---|
| 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 = ('○', '◔', '◑', '◕', '●') | 
