istr-python 1.1.40__tar.gz → 1.1.41__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {istr_python-1.1.40 → istr_python-1.1.41}/PKG-INFO +1 -1
- {istr_python-1.1.40 → istr_python-1.1.41}/istr/istr.py +13 -6
- {istr_python-1.1.40 → istr_python-1.1.41}/istr_python.egg-info/PKG-INFO +1 -1
- {istr_python-1.1.40 → istr_python-1.1.41}/pyproject.toml +1 -1
- {istr_python-1.1.40 → istr_python-1.1.41}/README.md +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/istr/LICENSE.txt +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/istr/__init__.py +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/istr/istr - Copy.py +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/setup.cfg +0 -0
- {istr_python-1.1.40 → istr_python-1.1.41}/tests/test_istr.py +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# |_||___/ \__||_|
|
|
6
6
|
# strings you can count on
|
|
7
7
|
|
|
8
|
-
__version__ = "1.1.
|
|
8
|
+
__version__ = "1.1.41"
|
|
9
9
|
import functools
|
|
10
10
|
import itertools
|
|
11
11
|
import types
|
|
@@ -767,6 +767,13 @@ class istr(str):
|
|
|
767
767
|
|
|
768
768
|
return str(self)
|
|
769
769
|
|
|
770
|
+
def interpret_as_istr(self):
|
|
771
|
+
# ignore leading zeroes
|
|
772
|
+
if isinstance(self, collections.abc.Iterable) and not isinstance(self, str):
|
|
773
|
+
return istr.join(self)*1
|
|
774
|
+
|
|
775
|
+
return istr(self)*1
|
|
776
|
+
|
|
770
777
|
def _str_method(self, name, *args, **kwargs):
|
|
771
778
|
return self.__class__(getattr(super(), name)(*args, **kwargs))
|
|
772
779
|
|
|
@@ -864,7 +871,7 @@ class istr(str):
|
|
|
864
871
|
if as_str is True, a formatted output will be returned
|
|
865
872
|
"""
|
|
866
873
|
|
|
867
|
-
number = istr
|
|
874
|
+
number = istr.interpret_as_istr(self)
|
|
868
875
|
|
|
869
876
|
lines = []
|
|
870
877
|
if len(number)%2==1:
|
|
@@ -921,8 +928,8 @@ class istr(str):
|
|
|
921
928
|
return lines
|
|
922
929
|
|
|
923
930
|
def long_multiplication(self, number,as_str=False):
|
|
924
|
-
number0 = istr
|
|
925
|
-
number1=istr(number)
|
|
931
|
+
number0 = istr.interpret_as_istr(self)
|
|
932
|
+
number1=istr.interpret_as_istr(number)
|
|
926
933
|
lines=[number0,number1]
|
|
927
934
|
for i in number1.reversed():
|
|
928
935
|
lines.append(number0*i)
|
|
@@ -942,8 +949,8 @@ class istr(str):
|
|
|
942
949
|
return lines
|
|
943
950
|
|
|
944
951
|
def long_division(self, divisor, as_str=False):
|
|
945
|
-
dividend = istr
|
|
946
|
-
divisor = istr(divisor)
|
|
952
|
+
dividend = istr.interpret_as_istr(self)
|
|
953
|
+
divisor = istr.interpret_as_istr(divisor)
|
|
947
954
|
|
|
948
955
|
if dividend < 0:
|
|
949
956
|
raise ValueError("dividend must be non-negative.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|