Skip to content

Commit 8e43980

Browse files
committed
-
1 parent 89badac commit 8e43980

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

source_py2/python_toolbox/cute_iter_tools.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import numbers
1515

1616
from python_toolbox import sequence_tools
17+
from python_toolbox import misc_tools
1718
from python_toolbox import math_tools
1819

1920
infinity = float('inf')
@@ -374,7 +375,7 @@ def _call_until_exception(function, exception):
374375

375376

376377
@misc_tools.limit_positional_arguments(1)
377-
def get_single_if_any(iterable, *,
378+
def get_single_if_any(iterable,
378379
exception_on_multiple=True, none_on_multiple=False):
379380
'''
380381
Get the single item of `iterable`, if any.
@@ -415,7 +416,7 @@ def get_single_if_any(iterable, *,
415416
return first_item
416417

417418

418-
def are_equal(*sequences, easy_types=(sequence_tools.CuteRange,)):
419+
def are_equal(*sequences, **kwargs):
419420
'''
420421
Are the given sequences equal?
421422
@@ -430,6 +431,8 @@ def are_equal(*sequences, easy_types=(sequence_tools.CuteRange,)):
430431
from python_toolbox import logic_tools
431432
sequence_types = set(map(type, sequences))
432433

434+
easy_types = kwargs.get('easy_types', (sequence_tools.CuteRange,))
435+
433436
# Trying cheap comparison:
434437
if len(sequence_types) == 1 and issubclass(
435438
get_single_if_any(sequence_types), easy_types):
@@ -448,7 +451,8 @@ def are_equal(*sequences, easy_types=(sequence_tools.CuteRange,)):
448451
return True
449452

450453

451-
def is_sorted(iterable, *, rising=True, strict=False, key=None):
454+
@misc_tools.limit_positional_arguments(1)
455+
def is_sorted(iterable, rising=True, strict=False, key=None):
452456
'''
453457
Is `iterable` sorted?
454458

source_py2/python_toolbox/math_tools/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ class _PossiblyInfiniteIntegralType(abc.ABCMeta):
1414
def __instancecheck__(self, thing):
1515
return isinstance(thing, numbers.Integral) or (thing in infinities)
1616
class PossiblyInfiniteIntegral(numbers.Number):
17-
__metaclass__ =_PossiblyInfiniteIntegralType
17+
__metaclass__ = _PossiblyInfiniteIntegralType
1818
'''An integer or infinity (including negative infinity.)'''
1919

2020
class _PossiblyInfiniteRealType(abc.ABCMeta):
2121
def __instancecheck__(self, thing):
2222
return isinstance(thing, numbers.Real) or (thing in infinities)
2323
class PossiblyInfiniteReal(numbers.Number):
24-
__metaclass__ =__PossiblyInfiniteRealType
24+
__metaclass__ = _PossiblyInfiniteRealType
2525
'''A real number or infinity (including negative infinity.)'''
2626

2727
class _NaturalType(abc.ABCMeta):
2828
def __instancecheck__(self, thing):
2929
return isinstance(thing, numbers.Integral) and thing >= 1
3030
class Natural(numbers.Number):
31-
__metaclass__ =__NaturalType
31+
__metaclass__ = _NaturalType
3232
'''A natural number, meaning a positive integer (0 not included.)'''

source_py2/python_toolbox/misc_tools/misc_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import sys
1515
import threading
1616

17+
from python_toolbox import decorator_tools
18+
1719

1820
_email_pattern = re.compile(
1921
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*"

0 commit comments

Comments
 (0)