mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Bump future from 0.18.2 to 0.18.3 (#1970)
* Bump future from 0.18.2 to 0.18.3 Bumps [future](https://github.com/PythonCharmers/python-future) from 0.18.2 to 0.18.3. - [Release notes](https://github.com/PythonCharmers/python-future/releases) - [Changelog](https://github.com/PythonCharmers/python-future/blob/master/docs/changelog.rst) - [Commits](https://github.com/PythonCharmers/python-future/compare/v0.18.2...v0.18.3) --- updated-dependencies: - dependency-name: future dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Update future==0.18.3 --------- 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
cc78f17be5
commit
9f727d0086
18 changed files with 196 additions and 115 deletions
|
@ -1,6 +1,8 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import inspect
|
||||
import math
|
||||
import numbers
|
||||
|
||||
from future.utils import PY2, PY3, exec_
|
||||
|
||||
|
@ -29,8 +31,67 @@ if PY3:
|
|||
cmp(x, y) -> integer
|
||||
|
||||
Return negative if x<y, zero if x==y, positive if x>y.
|
||||
Python2 had looser comparison allowing cmp None and non Numerical types and collections.
|
||||
Try to match the old behavior
|
||||
"""
|
||||
return (x > y) - (x < y)
|
||||
if isinstance(x, set) and isinstance(y, set):
|
||||
raise TypeError('cannot compare sets using cmp()',)
|
||||
try:
|
||||
if isinstance(x, numbers.Number) and math.isnan(x):
|
||||
if not isinstance(y, numbers.Number):
|
||||
raise TypeError('cannot compare float("nan"), {type_y} with cmp'.format(type_y=type(y)))
|
||||
if isinstance(y, int):
|
||||
return 1
|
||||
else:
|
||||
return -1
|
||||
if isinstance(y, numbers.Number) and math.isnan(y):
|
||||
if not isinstance(x, numbers.Number):
|
||||
raise TypeError('cannot compare {type_x}, float("nan") with cmp'.format(type_x=type(x)))
|
||||
if isinstance(x, int):
|
||||
return -1
|
||||
else:
|
||||
return 1
|
||||
return (x > y) - (x < y)
|
||||
except TypeError:
|
||||
if x == y:
|
||||
return 0
|
||||
type_order = [
|
||||
type(None),
|
||||
numbers.Number,
|
||||
dict, list,
|
||||
set,
|
||||
(str, bytes),
|
||||
]
|
||||
x_type_index = y_type_index = None
|
||||
for i, type_match in enumerate(type_order):
|
||||
if isinstance(x, type_match):
|
||||
x_type_index = i
|
||||
if isinstance(y, type_match):
|
||||
y_type_index = i
|
||||
if cmp(x_type_index, y_type_index) == 0:
|
||||
if isinstance(x, bytes) and isinstance(y, str):
|
||||
return cmp(x.decode('ascii'), y)
|
||||
if isinstance(y, bytes) and isinstance(x, str):
|
||||
return cmp(x, y.decode('ascii'))
|
||||
elif isinstance(x, list):
|
||||
# if both arguments are lists take the comparison of the first non equal value
|
||||
for x_elem, y_elem in zip(x, y):
|
||||
elem_cmp_val = cmp(x_elem, y_elem)
|
||||
if elem_cmp_val != 0:
|
||||
return elem_cmp_val
|
||||
# if all elements are equal, return equal/0
|
||||
return 0
|
||||
elif isinstance(x, dict):
|
||||
if len(x) != len(y):
|
||||
return cmp(len(x), len(y))
|
||||
else:
|
||||
x_key = min(a for a in x if a not in y or x[a] != y[a])
|
||||
y_key = min(b for b in y if b not in x or x[b] != y[b])
|
||||
if x_key != y_key:
|
||||
return cmp(x_key, y_key)
|
||||
else:
|
||||
return cmp(x[x_key], y[y_key])
|
||||
return cmp(x_type_index, y_type_index)
|
||||
|
||||
from sys import intern
|
||||
|
||||
|
@ -42,7 +103,13 @@ if PY3:
|
|||
return '0' + builtins.oct(number)[2:]
|
||||
|
||||
raw_input = input
|
||||
from imp import reload
|
||||
|
||||
try:
|
||||
from importlib import reload
|
||||
except ImportError:
|
||||
# for python2, python3 <= 3.4
|
||||
from imp import reload
|
||||
|
||||
unicode = str
|
||||
unichr = chr
|
||||
xrange = range
|
||||
|
@ -82,7 +149,7 @@ if PY3:
|
|||
if not isinstance(mylocals, Mapping):
|
||||
raise TypeError('locals must be a mapping')
|
||||
with open(filename, "rb") as fin:
|
||||
source = fin.read()
|
||||
source = fin.read()
|
||||
code = compile(source, filename, "exec")
|
||||
exec_(code, myglobals, mylocals)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue