istr-python 1.1.39__tar.gz → 1.1.39.post0__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.39 → istr_python-1.1.39.post0}/PKG-INFO +1 -1
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr/istr.py +27 -4
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr_python.egg-info/PKG-INFO +1 -1
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/pyproject.toml +1 -1
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/README.md +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr/LICENSE.txt +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr/__init__.py +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr/istr - Copy.py +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/setup.cfg +0 -0
- {istr_python-1.1.39 → istr_python-1.1.39.post0}/tests/test_istr.py +0 -0
|
@@ -868,10 +868,9 @@ class istr(str):
|
|
|
868
868
|
|
|
869
869
|
lines = []
|
|
870
870
|
if len(number)%2==1:
|
|
871
|
-
pairs=
|
|
872
|
-
pairs[0]=pairs[0][1]
|
|
871
|
+
pairs=istr.chain(number[0],istr.batched(number[1:],2,join=True))
|
|
873
872
|
else:
|
|
874
|
-
pairs=
|
|
873
|
+
pairs=istr.batched(number,2,join=True)
|
|
875
874
|
|
|
876
875
|
root = istr(0)
|
|
877
876
|
remainder = 0
|
|
@@ -897,7 +896,7 @@ class istr(str):
|
|
|
897
896
|
lines = [root] + [number] + lines[1:]
|
|
898
897
|
if as_str:
|
|
899
898
|
result = []
|
|
900
|
-
extra = len(
|
|
899
|
+
extra = len(number)%2==0
|
|
901
900
|
result.append(f" {extra*' '}{' '.join(lines[0])}")
|
|
902
901
|
result.append(f" {len(lines[1])*'-'}")
|
|
903
902
|
result.append(f"\/{lines[1]}")
|
|
@@ -920,6 +919,30 @@ class istr(str):
|
|
|
920
919
|
return "\n".join(result)
|
|
921
920
|
else:
|
|
922
921
|
return lines
|
|
922
|
+
|
|
923
|
+
def long_multiplication(self, number,as_str=False):
|
|
924
|
+
number0 = istr(istr.interpret_as_str(self))
|
|
925
|
+
number1=istr(number)
|
|
926
|
+
lines=[number0,number1]
|
|
927
|
+
for i in number1.reversed():
|
|
928
|
+
lines.append(number0*i)
|
|
929
|
+
lines.append(number0*number1)
|
|
930
|
+
if as_str:
|
|
931
|
+
result=[]
|
|
932
|
+
n=len(lines[-1])
|
|
933
|
+
result.append(f'{lines[0]:>{n}}')
|
|
934
|
+
result.append(f'{lines[1]:>{n}}')
|
|
935
|
+
result.append(f"{n*'-'} x")
|
|
936
|
+
for i,line in enumerate(lines[2:-1]):
|
|
937
|
+
result.append(f"{line:>{n-i}}")
|
|
938
|
+
result.append(f"{n*'-'}")
|
|
939
|
+
result.append(lines[-1])
|
|
940
|
+
return '\n'.join(result)
|
|
941
|
+
else:
|
|
942
|
+
return lines
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
923
946
|
|
|
924
947
|
def this_base(self):
|
|
925
948
|
return self._this_base
|
|
@@ -10,7 +10,7 @@ authors = [
|
|
|
10
10
|
{ name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
|
|
11
11
|
]
|
|
12
12
|
description = "istr - strings you can count on"
|
|
13
|
-
version = "1.1.39"
|
|
13
|
+
version = "1.1.39.post0"
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.10"
|
|
16
16
|
dependencies = []
|
|
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
|