Created starter files for the project.
This commit is contained in:
commit
73f0c0db42
1992 changed files with 769897 additions and 0 deletions
177
venv/Lib/site-packages/pip/_vendor/progress/__init__.py
Normal file
177
venv/Lib/site-packages/pip/_vendor/progress/__init__.py
Normal file
|
@ -0,0 +1,177 @@
|
|||
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import division, print_function
|
||||
|
||||
from collections import deque
|
||||
from datetime import timedelta
|
||||
from math import ceil
|
||||
from sys import stderr
|
||||
try:
|
||||
from time import monotonic
|
||||
except ImportError:
|
||||
from time import time as monotonic
|
||||
|
||||
|
||||
__version__ = '1.5'
|
||||
|
||||
HIDE_CURSOR = '\x1b[?25l'
|
||||
SHOW_CURSOR = '\x1b[?25h'
|
||||
|
||||
|
||||
class Infinite(object):
|
||||
file = stderr
|
||||
sma_window = 10 # Simple Moving Average window
|
||||
check_tty = True
|
||||
hide_cursor = True
|
||||
|
||||
def __init__(self, message='', **kwargs):
|
||||
self.index = 0
|
||||
self.start_ts = monotonic()
|
||||
self.avg = 0
|
||||
self._avg_update_ts = self.start_ts
|
||||
self._ts = self.start_ts
|
||||
self._xput = deque(maxlen=self.sma_window)
|
||||
for key, val in kwargs.items():
|
||||
setattr(self, key, val)
|
||||
|
||||
self._width = 0
|
||||
self.message = message
|
||||
|
||||
if self.file and self.is_tty():
|
||||
if self.hide_cursor:
|
||||
print(HIDE_CURSOR, end='', file=self.file)
|
||||
print(self.message, end='', file=self.file)
|
||||
self.file.flush()
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key.startswith('_'):
|
||||
return None
|
||||
return getattr(self, key, None)
|
||||
|
||||
@property
|
||||
def elapsed(self):
|
||||
return int(monotonic() - self.start_ts)
|
||||
|
||||
@property
|
||||
def elapsed_td(self):
|
||||
return timedelta(seconds=self.elapsed)
|
||||
|
||||
def update_avg(self, n, dt):
|
||||
if n > 0:
|
||||
xput_len = len(self._xput)
|
||||
self._xput.append(dt / n)
|
||||
now = monotonic()
|
||||
# update when we're still filling _xput, then after every second
|
||||
if (xput_len < self.sma_window or
|
||||
now - self._avg_update_ts > 1):
|
||||
self.avg = sum(self._xput) / len(self._xput)
|
||||
self._avg_update_ts = now
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def start(self):
|
||||
pass
|
||||
|
||||
def clearln(self):
|
||||
if self.file and self.is_tty():
|
||||
print('\r\x1b[K', end='', file=self.file)
|
||||
|
||||
def write(self, s):
|
||||
if self.file and self.is_tty():
|
||||
line = self.message + s.ljust(self._width)
|
||||
print('\r' + line, end='', file=self.file)
|
||||
self._width = max(self._width, len(s))
|
||||
self.file.flush()
|
||||
|
||||
def writeln(self, line):
|
||||
if self.file and self.is_tty():
|
||||
self.clearln()
|
||||
print(line, end='', file=self.file)
|
||||
self.file.flush()
|
||||
|
||||
def finish(self):
|
||||
if self.file and self.is_tty():
|
||||
print(file=self.file)
|
||||
if self.hide_cursor:
|
||||
print(SHOW_CURSOR, end='', file=self.file)
|
||||
|
||||
def is_tty(self):
|
||||
return self.file.isatty() if self.check_tty else True
|
||||
|
||||
def next(self, n=1):
|
||||
now = monotonic()
|
||||
dt = now - self._ts
|
||||
self.update_avg(n, dt)
|
||||
self._ts = now
|
||||
self.index = self.index + n
|
||||
self.update()
|
||||
|
||||
def iter(self, it):
|
||||
with self:
|
||||
for x in it:
|
||||
yield x
|
||||
self.next()
|
||||
|
||||
def __enter__(self):
|
||||
self.start()
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.finish()
|
||||
|
||||
|
||||
class Progress(Infinite):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Progress, self).__init__(*args, **kwargs)
|
||||
self.max = kwargs.get('max', 100)
|
||||
|
||||
@property
|
||||
def eta(self):
|
||||
return int(ceil(self.avg * self.remaining))
|
||||
|
||||
@property
|
||||
def eta_td(self):
|
||||
return timedelta(seconds=self.eta)
|
||||
|
||||
@property
|
||||
def percent(self):
|
||||
return self.progress * 100
|
||||
|
||||
@property
|
||||
def progress(self):
|
||||
return min(1, self.index / self.max)
|
||||
|
||||
@property
|
||||
def remaining(self):
|
||||
return max(self.max - self.index, 0)
|
||||
|
||||
def start(self):
|
||||
self.update()
|
||||
|
||||
def goto(self, index):
|
||||
incr = index - self.index
|
||||
self.next(incr)
|
||||
|
||||
def iter(self, it):
|
||||
try:
|
||||
self.max = len(it)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
with self:
|
||||
for x in it:
|
||||
yield x
|
||||
self.next()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
91
venv/Lib/site-packages/pip/_vendor/progress/bar.py
Normal file
91
venv/Lib/site-packages/pip/_vendor/progress/bar.py
Normal file
|
@ -0,0 +1,91 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
|
||||
from . import Progress
|
||||
|
||||
|
||||
class Bar(Progress):
|
||||
width = 32
|
||||
suffix = '%(index)d/%(max)d'
|
||||
bar_prefix = ' |'
|
||||
bar_suffix = '| '
|
||||
empty_fill = ' '
|
||||
fill = '#'
|
||||
|
||||
def update(self):
|
||||
filled_length = int(self.width * self.progress)
|
||||
empty_length = self.width - filled_length
|
||||
|
||||
message = self.message % self
|
||||
bar = self.fill * filled_length
|
||||
empty = self.empty_fill * empty_length
|
||||
suffix = self.suffix % self
|
||||
line = ''.join([message, self.bar_prefix, bar, empty, self.bar_suffix,
|
||||
suffix])
|
||||
self.writeln(line)
|
||||
|
||||
|
||||
class ChargingBar(Bar):
|
||||
suffix = '%(percent)d%%'
|
||||
bar_prefix = ' '
|
||||
bar_suffix = ' '
|
||||
empty_fill = '∙'
|
||||
fill = '█'
|
||||
|
||||
|
||||
class FillingSquaresBar(ChargingBar):
|
||||
empty_fill = '▢'
|
||||
fill = '▣'
|
||||
|
||||
|
||||
class FillingCirclesBar(ChargingBar):
|
||||
empty_fill = '◯'
|
||||
fill = '◉'
|
||||
|
||||
|
||||
class IncrementalBar(Bar):
|
||||
if sys.platform.startswith('win'):
|
||||
phases = (u' ', u'▌', u'█')
|
||||
else:
|
||||
phases = (' ', '▏', '▎', '▍', '▌', '▋', '▊', '▉', '█')
|
||||
|
||||
def update(self):
|
||||
nphases = len(self.phases)
|
||||
filled_len = self.width * self.progress
|
||||
nfull = int(filled_len) # Number of full chars
|
||||
phase = int((filled_len - nfull) * nphases) # Phase of last char
|
||||
nempty = self.width - nfull # Number of empty chars
|
||||
|
||||
message = self.message % self
|
||||
bar = self.phases[-1] * nfull
|
||||
current = self.phases[phase] if phase > 0 else ''
|
||||
empty = self.empty_fill * max(0, nempty - len(current))
|
||||
suffix = self.suffix % self
|
||||
line = ''.join([message, self.bar_prefix, bar, current, empty,
|
||||
self.bar_suffix, suffix])
|
||||
self.writeln(line)
|
||||
|
||||
|
||||
class PixelBar(IncrementalBar):
|
||||
phases = ('⡀', '⡄', '⡆', '⡇', '⣇', '⣧', '⣷', '⣿')
|
||||
|
||||
|
||||
class ShadyBar(IncrementalBar):
|
||||
phases = (' ', '░', '▒', '▓', '█')
|
41
venv/Lib/site-packages/pip/_vendor/progress/counter.py
Normal file
41
venv/Lib/site-packages/pip/_vendor/progress/counter.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from . import Infinite, Progress
|
||||
|
||||
|
||||
class Counter(Infinite):
|
||||
def update(self):
|
||||
self.write(str(self.index))
|
||||
|
||||
|
||||
class Countdown(Progress):
|
||||
def update(self):
|
||||
self.write(str(self.remaining))
|
||||
|
||||
|
||||
class Stack(Progress):
|
||||
phases = (' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█')
|
||||
|
||||
def update(self):
|
||||
nphases = len(self.phases)
|
||||
i = min(nphases - 1, int(self.progress * nphases))
|
||||
self.write(self.phases[i])
|
||||
|
||||
|
||||
class Pie(Stack):
|
||||
phases = ('○', '◔', '◑', '◕', '●')
|
43
venv/Lib/site-packages/pip/_vendor/progress/spinner.py
Normal file
43
venv/Lib/site-packages/pip/_vendor/progress/spinner.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from . import Infinite
|
||||
|
||||
|
||||
class Spinner(Infinite):
|
||||
phases = ('-', '\\', '|', '/')
|
||||
hide_cursor = True
|
||||
|
||||
def update(self):
|
||||
i = self.index % len(self.phases)
|
||||
self.write(self.phases[i])
|
||||
|
||||
|
||||
class PieSpinner(Spinner):
|
||||
phases = ['◷', '◶', '◵', '◴']
|
||||
|
||||
|
||||
class MoonSpinner(Spinner):
|
||||
phases = ['◑', '◒', '◐', '◓']
|
||||
|
||||
|
||||
class LineSpinner(Spinner):
|
||||
phases = ['⎺', '⎻', '⎼', '⎽', '⎼', '⎻']
|
||||
|
||||
|
||||
class PixelSpinner(Spinner):
|
||||
phases = ['⣾', '⣷', '⣯', '⣟', '⡿', '⢿', '⣻', '⣽']
|
Loading…
Add table
Add a link
Reference in a new issue