[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-04-13 00:00:18 +00:00
parent 72ad6dc953
commit f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions

View file

@ -11,8 +11,7 @@
# 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 __future__ import annotations
from collections import deque
from datetime import timedelta
@ -30,7 +29,7 @@ HIDE_CURSOR = '\x1b[?25l'
SHOW_CURSOR = '\x1b[?25h'
class Infinite(object):
class Infinite:
file = stderr
sma_window = 10 # Simple Moving Average window
check_tty = True
@ -79,8 +78,10 @@ class Infinite(object):
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):
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
@ -142,7 +143,7 @@ class Infinite(object):
class Progress(Infinite):
def __init__(self, *args, **kwargs):
super(Progress, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.max = kwargs.get('max', 100)
@property

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Georgios Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
@ -13,8 +11,7 @@
# 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 __future__ import annotations
import sys
@ -39,8 +36,10 @@ class Bar(Progress):
bar = color(self.fill * filled_length, fg=self.color)
empty = self.empty_fill * empty_length
suffix = self.suffix % self
line = ''.join([message, self.bar_prefix, bar, empty, self.bar_suffix,
suffix])
line = ''.join([
message, self.bar_prefix, bar, empty, self.bar_suffix,
suffix,
])
self.writeln(line)
@ -64,7 +63,7 @@ class FillingCirclesBar(ChargingBar):
class IncrementalBar(Bar):
if sys.platform.startswith('win'):
phases = (u' ', u'', u'')
phases = (' ', '', '')
else:
phases = (' ', '', '', '', '', '', '', '', '')
@ -80,8 +79,10 @@ class IncrementalBar(Bar):
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])
line = ''.join([
message, self.bar_prefix, bar, current, empty,
self.bar_suffix, suffix,
])
self.writeln(line)

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Georgios Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
@ -13,14 +11,19 @@
# 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 annotations
from functools import partial
COLORS = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan',
'white')
STYLES = ('bold', 'faint', 'italic', 'underline', 'blink', 'blink2',
'negative', 'concealed', 'crossed')
COLORS = (
'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan',
'white',
)
STYLES = (
'bold', 'faint', 'italic', 'underline', 'blink', 'blink2',
'negative', 'concealed', 'crossed',
)
def color(s, fg=None, bg=None, style=None):

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Georgios Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
@ -13,9 +11,10 @@
# 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 annotations
from __future__ import unicode_literals
from . import Infinite, Progress
from . import Infinite
from . import Progress
class Counter(Infinite):

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Georgios Verigakis <verigak@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
@ -13,8 +11,8 @@
# 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 annotations
from __future__ import unicode_literals
from . import Infinite