istr-python 1.0.4__tar.gz → 1.0.5__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.0.4 → istr_python-1.0.5}/PKG-INFO +1 -1
- {istr_python-1.0.4 → istr_python-1.0.5}/istr/istr.py +9 -3
- {istr_python-1.0.4 → istr_python-1.0.5}/istr_python.egg-info/PKG-INFO +1 -1
- {istr_python-1.0.4 → istr_python-1.0.5}/pyproject.toml +1 -1
- {istr_python-1.0.4 → istr_python-1.0.5}/tests/test_istr.py +12 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/README.md +0 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/istr/LICENSE.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/istr/__init__.py +0 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.5}/setup.cfg +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# |_||___/ \__||_|
|
|
6
6
|
# strings you can count on
|
|
7
7
|
|
|
8
|
-
__version__ = "1.0.
|
|
8
|
+
__version__ = "1.0.5"
|
|
9
9
|
import functools
|
|
10
10
|
import math
|
|
11
11
|
import copy
|
|
@@ -501,7 +501,7 @@ class istr(str):
|
|
|
501
501
|
"""
|
|
502
502
|
key = (args, cls._base, cls._int_format, cls._repr_mode)
|
|
503
503
|
if key in cls._digits_cache:
|
|
504
|
-
return cls.
|
|
504
|
+
return cls._digits_cache[key]
|
|
505
505
|
result = []
|
|
506
506
|
if not args:
|
|
507
507
|
args = ["0-9"]
|
|
@@ -539,7 +539,13 @@ class istr(str):
|
|
|
539
539
|
|
|
540
540
|
|
|
541
541
|
def main():
|
|
542
|
-
|
|
542
|
+
print(istr.digits())
|
|
543
|
+
|
|
544
|
+
print(repr(istr.digits()))
|
|
545
|
+
print(int(istr.digits()))
|
|
546
|
+
|
|
547
|
+
with istr.base(16):
|
|
548
|
+
print(int(istr.digits()))
|
|
543
549
|
|
|
544
550
|
if __name__ == "__main__":
|
|
545
551
|
main()
|
|
@@ -577,6 +577,18 @@ def test_digits():
|
|
|
577
577
|
assert ef == 239
|
|
578
578
|
|
|
579
579
|
|
|
580
|
+
def test_digits_cache():
|
|
581
|
+
d = istr.digits()
|
|
582
|
+
assert id(d) == id(istr.digits())
|
|
583
|
+
assert int(d) == 123456789
|
|
584
|
+
|
|
585
|
+
with istr.base(16):
|
|
586
|
+
d = istr.digits()
|
|
587
|
+
assert id(d) == id(istr.digits())
|
|
588
|
+
assert int(d) == 4886718345
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
|
|
580
592
|
def test_all_distinct():
|
|
581
593
|
assert istr("abcdef").all_distinct()
|
|
582
594
|
assert not istr("aabcdef").all_distinct()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|