istr-python 1.0.4__tar.gz → 1.0.6__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.egg-info → istr_python-1.0.6}/PKG-INFO +61 -8
- istr_python-1.0.4/PKG-INFO → istr_python-1.0.6/README.md +711 -671
- {istr_python-1.0.4 → istr_python-1.0.6}/istr/istr.py +15 -4
- istr_python-1.0.4/README.md → istr_python-1.0.6/istr_python.egg-info/PKG-INFO +724 -658
- {istr_python-1.0.4 → istr_python-1.0.6}/pyproject.toml +1 -1
- {istr_python-1.0.4 → istr_python-1.0.6}/tests/test_istr.py +35 -0
- {istr_python-1.0.4 → istr_python-1.0.6}/istr/LICENSE.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.6}/istr/__init__.py +0 -0
- {istr_python-1.0.4 → istr_python-1.0.6}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.6}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.6}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.0.4 → istr_python-1.0.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: istr-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6
|
|
4
4
|
Summary: istr - strings you can count on
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/istr
|
|
@@ -399,6 +399,58 @@ istr('0') a
|
|
|
399
399
|
istr('1') b
|
|
400
400
|
istr('2') c
|
|
401
401
|
```
|
|
402
|
+
#### itertools with istrs
|
|
403
|
+
All methods in itertools are also available directly from istr.
|
|
404
|
+
Note that the result is istr-ed (apart from groupby and tee).
|
|
405
|
+
|
|
406
|
+
The following class methods are supported (provided their counterpart exists in the installed Python version's itertools):
|
|
407
|
+
|
|
408
|
+
- istr.accumulate
|
|
409
|
+
- istr.chain
|
|
410
|
+
- istr.combinations
|
|
411
|
+
- istr.combinations_with_replacement
|
|
412
|
+
- istr.compress
|
|
413
|
+
- istr.count
|
|
414
|
+
- istr.cycle
|
|
415
|
+
- istr.dropwhile
|
|
416
|
+
- istr.filterfalse
|
|
417
|
+
- istr.groupby (not istr-ed)
|
|
418
|
+
- istr.islice
|
|
419
|
+
- istr.pairwise
|
|
420
|
+
- istr.permutations
|
|
421
|
+
- istr.product
|
|
422
|
+
- istr.repeat
|
|
423
|
+
- istr.starmap
|
|
424
|
+
- istr.takewhile
|
|
425
|
+
- istr.tee (not istr-ed)
|
|
426
|
+
- istr.zip_longest
|
|
427
|
+
|
|
428
|
+
This can be handy as these methods don't have to be imported from itertools anymore.
|
|
429
|
+
|
|
430
|
+
All methods have exactly the same (optional) parameters as their itertools counterpart.
|
|
431
|
+
|
|
432
|
+
For example:
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
list(istr.repeat(1, 4)) ==> [istr('1'), istr('1'), istr('1'), istr('1')]
|
|
436
|
+
next(istr.count(3)) ==> istr('3')
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
One more example:
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
for t in istr.permutations(range(3)):
|
|
443
|
+
print(t)
|
|
444
|
+
```
|
|
445
|
+
results in
|
|
446
|
+
```
|
|
447
|
+
(istr('0'), istr('1'), istr('2'))
|
|
448
|
+
(istr('0'), istr('2'), istr('1'))
|
|
449
|
+
(istr('1'), istr('0'), istr('2'))
|
|
450
|
+
(istr('1'), istr('2'), istr('0'))
|
|
451
|
+
(istr('2'), istr('0'), istr('1'))
|
|
452
|
+
(istr('2'), istr('1'), istr('0'))
|
|
453
|
+
```
|
|
402
454
|
|
|
403
455
|
#### concatenate an iterable
|
|
404
456
|
|
|
@@ -638,22 +690,23 @@ _ x istr(20) - 3 ==> istr('17')
|
|
|
638
690
|
% x istr(20) % 3 ==> istr('2')
|
|
639
691
|
divmod x divmod(istr(20), 3) ==> (istr('6'), istr('2'))
|
|
640
692
|
** x istr(2) ** 3 ==> istr('8')
|
|
641
|
-
|
|
642
|
-
== x x istr(20) == 20 ==> True | istr(20) == '20' ==> True
|
|
643
|
-
| x istr(20) | 5 ==> istr('205')
|
|
693
|
+
<=, <, >, >= x istr('100') > istr('2') ==> True
|
|
644
694
|
abs x abs(istr(-20)) ==> istr('20')
|
|
695
|
+
== x x istr(20) == 20 ==> True | istr(20) == '20' ==> True
|
|
645
696
|
bool x x *) bool(istr(' 0 ')) ==> False | istr('') ==> False
|
|
646
|
-
|
|
697
|
+
@ x istr(20) @ 3 ==> istr('202020')
|
|
698
|
+
| x istr(20) | '5' ==> istr('205')
|
|
647
699
|
slicing x istr(12345)[1:3] ==> istr('23')
|
|
648
|
-
iterate x [x for x in istr(20)] ==> [istr('2'), istr('0')
|
|
700
|
+
iterate x [x for x in istr(20)] ==> [istr('2'), istr('0')]
|
|
649
701
|
len x len(istr(' 20 ')) ==> 4
|
|
650
|
-
count x istr(100)
|
|
702
|
+
count x istr(100).count('0') ==> 2
|
|
651
703
|
index x istr(' 100 ').index('0') ==> 2
|
|
652
704
|
split x istr('1 2').split() ==> (istr('1'), istr('2'))
|
|
653
|
-
string format x f"|{istr(
|
|
705
|
+
string format x f"|{istr(1234):6}|" ==> '|1234 |'
|
|
654
706
|
other string methods x istr('aAbBcC').lower() ==> istr('aabbcc')
|
|
655
707
|
istr('aAbBcC').islower() ==> False
|
|
656
708
|
istr(' abc ').strip() ==> istr('abc')
|
|
709
|
+
...
|
|
657
710
|
-----------------------------------------------------------------------------------------
|
|
658
711
|
*) str is applied if is_int() is False
|
|
659
712
|
|