mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Bump cherrypy from 18.9.0 to 18.10.0 (#2353)
* Bump cherrypy from 18.9.0 to 18.10.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.9.0 to 18.10.0. - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.9.0...v18.10.0) --- updated-dependencies: - dependency-name: cherrypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cherrypy==18.10.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
5e977c044a
commit
a528f052b9
73 changed files with 1713 additions and 1008 deletions
|
@ -7,6 +7,7 @@ Some backward-compatible usability improvements have been made.
|
|||
.. [1] http://docs.python.org/library/itertools.html#recipes
|
||||
|
||||
"""
|
||||
|
||||
import math
|
||||
import operator
|
||||
|
||||
|
@ -74,6 +75,7 @@ __all__ = [
|
|||
'totient',
|
||||
'transpose',
|
||||
'triplewise',
|
||||
'unique',
|
||||
'unique_everseen',
|
||||
'unique_justseen',
|
||||
]
|
||||
|
@ -198,7 +200,7 @@ def nth(iterable, n, default=None):
|
|||
return next(islice(iterable, n, None), default)
|
||||
|
||||
|
||||
def all_equal(iterable):
|
||||
def all_equal(iterable, key=None):
|
||||
"""
|
||||
Returns ``True`` if all the elements are equal to each other.
|
||||
|
||||
|
@ -207,9 +209,16 @@ def all_equal(iterable):
|
|||
>>> all_equal('aaab')
|
||||
False
|
||||
|
||||
A function that accepts a single argument and returns a transformed version
|
||||
of each input item can be specified with *key*:
|
||||
|
||||
>>> all_equal('AaaA', key=str.casefold)
|
||||
True
|
||||
>>> all_equal([1, 2, 3], key=lambda x: x < 10)
|
||||
True
|
||||
|
||||
"""
|
||||
g = groupby(iterable)
|
||||
return next(g, True) and not next(g, False)
|
||||
return len(list(islice(groupby(iterable, key), 2))) <= 1
|
||||
|
||||
|
||||
def quantify(iterable, pred=bool):
|
||||
|
@ -410,16 +419,11 @@ def roundrobin(*iterables):
|
|||
iterables is small).
|
||||
|
||||
"""
|
||||
# Recipe credited to George Sakkis
|
||||
pending = len(iterables)
|
||||
nexts = cycle(iter(it).__next__ for it in iterables)
|
||||
while pending:
|
||||
try:
|
||||
for next in nexts:
|
||||
yield next()
|
||||
except StopIteration:
|
||||
pending -= 1
|
||||
nexts = cycle(islice(nexts, pending))
|
||||
# Algorithm credited to George Sakkis
|
||||
iterators = map(iter, iterables)
|
||||
for num_active in range(len(iterables), 0, -1):
|
||||
iterators = cycle(islice(iterators, num_active))
|
||||
yield from map(next, iterators)
|
||||
|
||||
|
||||
def partition(pred, iterable):
|
||||
|
@ -458,16 +462,14 @@ def powerset(iterable):
|
|||
|
||||
:func:`powerset` will operate on iterables that aren't :class:`set`
|
||||
instances, so repeated elements in the input will produce repeated elements
|
||||
in the output. Use :func:`unique_everseen` on the input to avoid generating
|
||||
duplicates:
|
||||
in the output.
|
||||
|
||||
>>> seq = [1, 1, 0]
|
||||
>>> list(powerset(seq))
|
||||
[(), (1,), (1,), (0,), (1, 1), (1, 0), (1, 0), (1, 1, 0)]
|
||||
>>> from more_itertools import unique_everseen
|
||||
>>> list(powerset(unique_everseen(seq)))
|
||||
[(), (1,), (0,), (1, 0)]
|
||||
|
||||
For a variant that efficiently yields actual :class:`set` instances, see
|
||||
:func:`powerset_of_sets`.
|
||||
"""
|
||||
s = list(iterable)
|
||||
return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))
|
||||
|
@ -533,6 +535,25 @@ def unique_justseen(iterable, key=None):
|
|||
return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
|
||||
|
||||
|
||||
def unique(iterable, key=None, reverse=False):
|
||||
"""Yields unique elements in sorted order.
|
||||
|
||||
>>> list(unique([[1, 2], [3, 4], [1, 2]]))
|
||||
[[1, 2], [3, 4]]
|
||||
|
||||
*key* and *reverse* are passed to :func:`sorted`.
|
||||
|
||||
>>> list(unique('ABBcCAD', str.casefold))
|
||||
['A', 'B', 'c', 'D']
|
||||
>>> list(unique('ABBcCAD', str.casefold, reverse=True))
|
||||
['D', 'c', 'B', 'A']
|
||||
|
||||
The elements in *iterable* need not be hashable, but they must be
|
||||
comparable for sorting to work.
|
||||
"""
|
||||
return unique_justseen(sorted(iterable, key=key, reverse=reverse), key=key)
|
||||
|
||||
|
||||
def iter_except(func, exception, first=None):
|
||||
"""Yields results from a function repeatedly until an exception is raised.
|
||||
|
||||
|
@ -827,8 +848,6 @@ def iter_index(iterable, value, start=0, stop=None):
|
|||
"""Yield the index of each place in *iterable* that *value* occurs,
|
||||
beginning with index *start* and ending before index *stop*.
|
||||
|
||||
See :func:`locate` for a more general means of finding the indexes
|
||||
associated with particular values.
|
||||
|
||||
>>> list(iter_index('AABCADEAF', 'A'))
|
||||
[0, 1, 4, 7]
|
||||
|
@ -836,6 +855,19 @@ def iter_index(iterable, value, start=0, stop=None):
|
|||
[1, 4, 7]
|
||||
>>> list(iter_index('AABCADEAF', 'A', 1, 7)) # stop index is not inclusive
|
||||
[1, 4]
|
||||
|
||||
The behavior for non-scalar *values* matches the built-in Python types.
|
||||
|
||||
>>> list(iter_index('ABCDABCD', 'AB'))
|
||||
[0, 4]
|
||||
>>> list(iter_index([0, 1, 2, 3, 0, 1, 2, 3], [0, 1]))
|
||||
[]
|
||||
>>> list(iter_index([[0, 1], [2, 3], [0, 1], [2, 3]], [0, 1]))
|
||||
[0, 2]
|
||||
|
||||
See :func:`locate` for a more general means of finding the indexes
|
||||
associated with particular values.
|
||||
|
||||
"""
|
||||
seq_index = getattr(iterable, 'index', None)
|
||||
if seq_index is None:
|
||||
|
@ -1006,7 +1038,9 @@ def totient(n):
|
|||
>>> totient(12)
|
||||
4
|
||||
"""
|
||||
for p in unique_justseen(factor(n)):
|
||||
# The itertools docs use unique_justseen instead of set; see
|
||||
# https://github.com/more-itertools/more-itertools/issues/823
|
||||
for p in set(factor(n)):
|
||||
n = n // p * (p - 1)
|
||||
|
||||
return n
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue