istr-python 1.1.1__tar.gz → 1.1.3__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.1 → istr_python-1.1.3}/PKG-INFO +25 -17
- {istr_python-1.1.1 → istr_python-1.1.3}/README.md +23 -15
- {istr_python-1.1.1 → istr_python-1.1.3}/istr/istr.py +13 -1
- {istr_python-1.1.1 → istr_python-1.1.3}/istr_python.egg-info/PKG-INFO +25 -17
- {istr_python-1.1.1 → istr_python-1.1.3}/pyproject.toml +35 -30
- {istr_python-1.1.1 → istr_python-1.1.3}/tests/test_istr.py +10 -9
- {istr_python-1.1.1 → istr_python-1.1.3}/istr/LICENSE.txt +0 -0
- {istr_python-1.1.1 → istr_python-1.1.3}/istr/__init__.py +0 -0
- {istr_python-1.1.1 → istr_python-1.1.3}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-1.1.1 → istr_python-1.1.3}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-1.1.1 → istr_python-1.1.3}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-1.1.1 → istr_python-1.1.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: istr-python
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
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
|
|
@@ -28,10 +28,9 @@ M O N E Y
|
|
|
28
28
|
```
|
|
29
29
|
can be nicely, albeit not very efficient, coded as:
|
|
30
30
|
```
|
|
31
|
-
import
|
|
32
|
-
from istr import istr
|
|
31
|
+
import istr
|
|
33
32
|
|
|
34
|
-
for s, e, n, d, m, o, r, y in istr
|
|
33
|
+
for s, e, n, d, m, o, r, y in istr.permutations(range(10), 8):
|
|
35
34
|
if m and ((s|e|n|d) + (m|o|r|e) == (m|o|n|e|y)):
|
|
36
35
|
print(f' {s|e|n|d}')
|
|
37
36
|
print(f' {m|o|r|e}')
|
|
@@ -50,11 +49,11 @@ And the module is a demonstration of extending a class (str) with extra and chan
|
|
|
50
49
|
### Installation
|
|
51
50
|
Installing istr with pip is easy.
|
|
52
51
|
```
|
|
53
|
-
|
|
52
|
+
pip install istr-python
|
|
54
53
|
```
|
|
55
54
|
or when you want to upgrade,
|
|
56
55
|
```
|
|
57
|
-
|
|
56
|
+
pip install istr-python --upgrade
|
|
58
57
|
```
|
|
59
58
|
Alternatively, istr.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istr).
|
|
60
59
|
|
|
@@ -65,13 +64,19 @@ No dependencies!
|
|
|
65
64
|
|
|
66
65
|
Just start with
|
|
67
66
|
|
|
67
|
+
```
|
|
68
|
+
import istr
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
or the more conventional, more verbose:
|
|
72
|
+
|
|
68
73
|
```
|
|
69
74
|
from istr import istr
|
|
70
75
|
```
|
|
71
76
|
|
|
72
77
|
#### Use istr as int
|
|
73
78
|
|
|
74
|
-
We can define an istr:
|
|
79
|
+
We can define an istr, like:
|
|
75
80
|
```
|
|
76
81
|
four = istr('4')
|
|
77
82
|
five = istr('5')
|
|
@@ -81,7 +86,7 @@ The variables `four` and `five` can now be used as if they were int:
|
|
|
81
86
|
```
|
|
82
87
|
twenty = four * five
|
|
83
88
|
```
|
|
84
|
-
, after which
|
|
89
|
+
, after which twenty is `istr('20')`
|
|
85
90
|
|
|
86
91
|
The same can be done with
|
|
87
92
|
|
|
@@ -106,7 +111,7 @@ is `istr('16')`
|
|
|
106
111
|
We can do all the usual arithmetic operations on istrs, e.g.
|
|
107
112
|
|
|
108
113
|
```
|
|
109
|
-
-four + (twenty / 2)
|
|
114
|
+
- four + (twenty / 2)
|
|
110
115
|
```
|
|
111
116
|
|
|
112
117
|
is `istr('6')`
|
|
@@ -118,7 +123,7 @@ twenty == 20
|
|
|
118
123
|
```
|
|
119
124
|
is True.
|
|
120
125
|
|
|
121
|
-
But istrs are
|
|
126
|
+
But istrs are actually strings! So
|
|
122
127
|
|
|
123
128
|
```
|
|
124
129
|
twenty == '20'
|
|
@@ -126,7 +131,7 @@ twenty == '20'
|
|
|
126
131
|
|
|
127
132
|
is also True!
|
|
128
133
|
|
|
129
|
-
For the order comparisons (<=, <, >, >=),
|
|
134
|
+
For the order comparisons (<=, <, >, >=), an istr is always interpreted as an int.
|
|
130
135
|
|
|
131
136
|
That means that
|
|
132
137
|
```
|
|
@@ -151,11 +156,10 @@ four, five = istr(4, 5)
|
|
|
151
156
|
```
|
|
152
157
|
|
|
153
158
|
##### Important
|
|
154
|
-
>
|
|
155
|
-
> All calculations are strictly integer calculations. That means that if a float or decimal variable is ever produced it will be converted to an int.
|
|
159
|
+
>All calculations are strictly integer calculations. That means that if a float or decimal variable is ever produced it will be converted to an int.
|
|
156
160
|
> Also divisions are always floor divisions!
|
|
157
161
|
|
|
158
|
-
#### Use istr as
|
|
162
|
+
#### Use istr as a string
|
|
159
163
|
|
|
160
164
|
We should realize that istrs are in fact strings.
|
|
161
165
|
|
|
@@ -238,11 +242,13 @@ is `False`.
|
|
|
238
242
|
The `bool` operator works normally on the integer value of an istr. So
|
|
239
243
|
|
|
240
244
|
`bool(istr('0'))` ==> `False`
|
|
245
|
+
|
|
241
246
|
`bool(istr('1'))` ==> `True`
|
|
242
247
|
|
|
243
248
|
But if the istr can't be interpreted as an int, the string value will be used to test. So
|
|
244
249
|
|
|
245
250
|
`bool(istr('abc'))` ==> `True`
|
|
251
|
+
|
|
246
252
|
`bool(istr(''))` ==> `False`
|
|
247
253
|
|
|
248
254
|
#### Other operators
|
|
@@ -506,7 +512,7 @@ to `istr` and then concatenate these.
|
|
|
506
512
|
|
|
507
513
|
```
|
|
508
514
|
list(istr.concat(((1,2),(3,4))) ==> istr([12,34])
|
|
509
|
-
list(istr.concat(
|
|
515
|
+
list(istr.concat(istr.permutations(range(3),2))) ==>
|
|
510
516
|
[istr('01'), istr('02'), istr('10'), istr('12'), istr('20'), istr('21')]
|
|
511
517
|
```
|
|
512
518
|
|
|
@@ -558,7 +564,7 @@ When a class is derived from istr, all methods will return that newly derived cl
|
|
|
558
564
|
|
|
559
565
|
E.g.
|
|
560
566
|
```
|
|
561
|
-
class jstr(istr):
|
|
567
|
+
class jstr(istr.type):
|
|
562
568
|
...
|
|
563
569
|
|
|
564
570
|
print(repr(jstr(4) * jstr(5)))
|
|
@@ -761,7 +767,9 @@ There's an extensive pytest script in the `\tests` directory.
|
|
|
761
767
|
|
|
762
768
|
This script also shows clearly the ways istr can be used, including several edge cases. Highly recommended to have a look at.
|
|
763
769
|
|
|
770
|
+
### Contact info
|
|
764
771
|
|
|
772
|
+
You can contact Ruud van der Ham, the core developer, via ruud@salabim.org .
|
|
765
773
|
|
|
766
774
|
### Badges
|
|
767
775
|
  
|
|
@@ -15,10 +15,9 @@ M O N E Y
|
|
|
15
15
|
```
|
|
16
16
|
can be nicely, albeit not very efficient, coded as:
|
|
17
17
|
```
|
|
18
|
-
import
|
|
19
|
-
from istr import istr
|
|
18
|
+
import istr
|
|
20
19
|
|
|
21
|
-
for s, e, n, d, m, o, r, y in istr
|
|
20
|
+
for s, e, n, d, m, o, r, y in istr.permutations(range(10), 8):
|
|
22
21
|
if m and ((s|e|n|d) + (m|o|r|e) == (m|o|n|e|y)):
|
|
23
22
|
print(f' {s|e|n|d}')
|
|
24
23
|
print(f' {m|o|r|e}')
|
|
@@ -37,11 +36,11 @@ And the module is a demonstration of extending a class (str) with extra and chan
|
|
|
37
36
|
### Installation
|
|
38
37
|
Installing istr with pip is easy.
|
|
39
38
|
```
|
|
40
|
-
|
|
39
|
+
pip install istr-python
|
|
41
40
|
```
|
|
42
41
|
or when you want to upgrade,
|
|
43
42
|
```
|
|
44
|
-
|
|
43
|
+
pip install istr-python --upgrade
|
|
45
44
|
```
|
|
46
45
|
Alternatively, istr.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istr).
|
|
47
46
|
|
|
@@ -52,13 +51,19 @@ No dependencies!
|
|
|
52
51
|
|
|
53
52
|
Just start with
|
|
54
53
|
|
|
54
|
+
```
|
|
55
|
+
import istr
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
or the more conventional, more verbose:
|
|
59
|
+
|
|
55
60
|
```
|
|
56
61
|
from istr import istr
|
|
57
62
|
```
|
|
58
63
|
|
|
59
64
|
#### Use istr as int
|
|
60
65
|
|
|
61
|
-
We can define an istr:
|
|
66
|
+
We can define an istr, like:
|
|
62
67
|
```
|
|
63
68
|
four = istr('4')
|
|
64
69
|
five = istr('5')
|
|
@@ -68,7 +73,7 @@ The variables `four` and `five` can now be used as if they were int:
|
|
|
68
73
|
```
|
|
69
74
|
twenty = four * five
|
|
70
75
|
```
|
|
71
|
-
, after which
|
|
76
|
+
, after which twenty is `istr('20')`
|
|
72
77
|
|
|
73
78
|
The same can be done with
|
|
74
79
|
|
|
@@ -93,7 +98,7 @@ is `istr('16')`
|
|
|
93
98
|
We can do all the usual arithmetic operations on istrs, e.g.
|
|
94
99
|
|
|
95
100
|
```
|
|
96
|
-
-four + (twenty / 2)
|
|
101
|
+
- four + (twenty / 2)
|
|
97
102
|
```
|
|
98
103
|
|
|
99
104
|
is `istr('6')`
|
|
@@ -105,7 +110,7 @@ twenty == 20
|
|
|
105
110
|
```
|
|
106
111
|
is True.
|
|
107
112
|
|
|
108
|
-
But istrs are
|
|
113
|
+
But istrs are actually strings! So
|
|
109
114
|
|
|
110
115
|
```
|
|
111
116
|
twenty == '20'
|
|
@@ -113,7 +118,7 @@ twenty == '20'
|
|
|
113
118
|
|
|
114
119
|
is also True!
|
|
115
120
|
|
|
116
|
-
For the order comparisons (<=, <, >, >=),
|
|
121
|
+
For the order comparisons (<=, <, >, >=), an istr is always interpreted as an int.
|
|
117
122
|
|
|
118
123
|
That means that
|
|
119
124
|
```
|
|
@@ -138,11 +143,10 @@ four, five = istr(4, 5)
|
|
|
138
143
|
```
|
|
139
144
|
|
|
140
145
|
##### Important
|
|
141
|
-
>
|
|
142
|
-
> All calculations are strictly integer calculations. That means that if a float or decimal variable is ever produced it will be converted to an int.
|
|
146
|
+
>All calculations are strictly integer calculations. That means that if a float or decimal variable is ever produced it will be converted to an int.
|
|
143
147
|
> Also divisions are always floor divisions!
|
|
144
148
|
|
|
145
|
-
#### Use istr as
|
|
149
|
+
#### Use istr as a string
|
|
146
150
|
|
|
147
151
|
We should realize that istrs are in fact strings.
|
|
148
152
|
|
|
@@ -225,11 +229,13 @@ is `False`.
|
|
|
225
229
|
The `bool` operator works normally on the integer value of an istr. So
|
|
226
230
|
|
|
227
231
|
`bool(istr('0'))` ==> `False`
|
|
232
|
+
|
|
228
233
|
`bool(istr('1'))` ==> `True`
|
|
229
234
|
|
|
230
235
|
But if the istr can't be interpreted as an int, the string value will be used to test. So
|
|
231
236
|
|
|
232
237
|
`bool(istr('abc'))` ==> `True`
|
|
238
|
+
|
|
233
239
|
`bool(istr(''))` ==> `False`
|
|
234
240
|
|
|
235
241
|
#### Other operators
|
|
@@ -493,7 +499,7 @@ to `istr` and then concatenate these.
|
|
|
493
499
|
|
|
494
500
|
```
|
|
495
501
|
list(istr.concat(((1,2),(3,4))) ==> istr([12,34])
|
|
496
|
-
list(istr.concat(
|
|
502
|
+
list(istr.concat(istr.permutations(range(3),2))) ==>
|
|
497
503
|
[istr('01'), istr('02'), istr('10'), istr('12'), istr('20'), istr('21')]
|
|
498
504
|
```
|
|
499
505
|
|
|
@@ -545,7 +551,7 @@ When a class is derived from istr, all methods will return that newly derived cl
|
|
|
545
551
|
|
|
546
552
|
E.g.
|
|
547
553
|
```
|
|
548
|
-
class jstr(istr):
|
|
554
|
+
class jstr(istr.type):
|
|
549
555
|
...
|
|
550
556
|
|
|
551
557
|
print(repr(jstr(4) * jstr(5)))
|
|
@@ -748,7 +754,9 @@ There's an extensive pytest script in the `\tests` directory.
|
|
|
748
754
|
|
|
749
755
|
This script also shows clearly the ways istr can be used, including several edge cases. Highly recommended to have a look at.
|
|
750
756
|
|
|
757
|
+
### Contact info
|
|
751
758
|
|
|
759
|
+
You can contact Ruud van der Ham, the core developer, via ruud@salabim.org .
|
|
752
760
|
|
|
753
761
|
### Badges
|
|
754
762
|
  
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# |_||___/ \__||_|
|
|
6
6
|
# strings you can count on
|
|
7
7
|
|
|
8
|
-
__version__ = "1.1.
|
|
8
|
+
__version__ = "1.1.3"
|
|
9
9
|
import functools
|
|
10
10
|
import math
|
|
11
11
|
import itertools
|
|
@@ -602,10 +602,22 @@ class istr(str):
|
|
|
602
602
|
cls._digits_cache[key] = result
|
|
603
603
|
return result
|
|
604
604
|
|
|
605
|
+
istr.type=type(istr(0))
|
|
606
|
+
|
|
605
607
|
|
|
606
608
|
def main():
|
|
607
609
|
...
|
|
608
610
|
|
|
611
|
+
class istrModule(types.ModuleType):
|
|
612
|
+
def __call__(self, *args, **kwargs):
|
|
613
|
+
return istr.__call__(*args, **kwargs)
|
|
614
|
+
def __setattr__(self, item, value):
|
|
615
|
+
setattr(istr,item,value)
|
|
616
|
+
def __getattr__(self, item,):
|
|
617
|
+
return getattr(istr,item)
|
|
618
|
+
|
|
619
|
+
sys.modules["istr"].__class__ = istrModule
|
|
620
|
+
|
|
609
621
|
if __name__ == "__main__":
|
|
610
622
|
main()
|
|
611
623
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: istr-python
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
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
|
|
@@ -28,10 +28,9 @@ M O N E Y
|
|
|
28
28
|
```
|
|
29
29
|
can be nicely, albeit not very efficient, coded as:
|
|
30
30
|
```
|
|
31
|
-
import
|
|
32
|
-
from istr import istr
|
|
31
|
+
import istr
|
|
33
32
|
|
|
34
|
-
for s, e, n, d, m, o, r, y in istr
|
|
33
|
+
for s, e, n, d, m, o, r, y in istr.permutations(range(10), 8):
|
|
35
34
|
if m and ((s|e|n|d) + (m|o|r|e) == (m|o|n|e|y)):
|
|
36
35
|
print(f' {s|e|n|d}')
|
|
37
36
|
print(f' {m|o|r|e}')
|
|
@@ -50,11 +49,11 @@ And the module is a demonstration of extending a class (str) with extra and chan
|
|
|
50
49
|
### Installation
|
|
51
50
|
Installing istr with pip is easy.
|
|
52
51
|
```
|
|
53
|
-
|
|
52
|
+
pip install istr-python
|
|
54
53
|
```
|
|
55
54
|
or when you want to upgrade,
|
|
56
55
|
```
|
|
57
|
-
|
|
56
|
+
pip install istr-python --upgrade
|
|
58
57
|
```
|
|
59
58
|
Alternatively, istr.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istr).
|
|
60
59
|
|
|
@@ -65,13 +64,19 @@ No dependencies!
|
|
|
65
64
|
|
|
66
65
|
Just start with
|
|
67
66
|
|
|
67
|
+
```
|
|
68
|
+
import istr
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
or the more conventional, more verbose:
|
|
72
|
+
|
|
68
73
|
```
|
|
69
74
|
from istr import istr
|
|
70
75
|
```
|
|
71
76
|
|
|
72
77
|
#### Use istr as int
|
|
73
78
|
|
|
74
|
-
We can define an istr:
|
|
79
|
+
We can define an istr, like:
|
|
75
80
|
```
|
|
76
81
|
four = istr('4')
|
|
77
82
|
five = istr('5')
|
|
@@ -81,7 +86,7 @@ The variables `four` and `five` can now be used as if they were int:
|
|
|
81
86
|
```
|
|
82
87
|
twenty = four * five
|
|
83
88
|
```
|
|
84
|
-
, after which
|
|
89
|
+
, after which twenty is `istr('20')`
|
|
85
90
|
|
|
86
91
|
The same can be done with
|
|
87
92
|
|
|
@@ -106,7 +111,7 @@ is `istr('16')`
|
|
|
106
111
|
We can do all the usual arithmetic operations on istrs, e.g.
|
|
107
112
|
|
|
108
113
|
```
|
|
109
|
-
-four + (twenty / 2)
|
|
114
|
+
- four + (twenty / 2)
|
|
110
115
|
```
|
|
111
116
|
|
|
112
117
|
is `istr('6')`
|
|
@@ -118,7 +123,7 @@ twenty == 20
|
|
|
118
123
|
```
|
|
119
124
|
is True.
|
|
120
125
|
|
|
121
|
-
But istrs are
|
|
126
|
+
But istrs are actually strings! So
|
|
122
127
|
|
|
123
128
|
```
|
|
124
129
|
twenty == '20'
|
|
@@ -126,7 +131,7 @@ twenty == '20'
|
|
|
126
131
|
|
|
127
132
|
is also True!
|
|
128
133
|
|
|
129
|
-
For the order comparisons (<=, <, >, >=),
|
|
134
|
+
For the order comparisons (<=, <, >, >=), an istr is always interpreted as an int.
|
|
130
135
|
|
|
131
136
|
That means that
|
|
132
137
|
```
|
|
@@ -151,11 +156,10 @@ four, five = istr(4, 5)
|
|
|
151
156
|
```
|
|
152
157
|
|
|
153
158
|
##### Important
|
|
154
|
-
>
|
|
155
|
-
> All calculations are strictly integer calculations. That means that if a float or decimal variable is ever produced it will be converted to an int.
|
|
159
|
+
>All calculations are strictly integer calculations. That means that if a float or decimal variable is ever produced it will be converted to an int.
|
|
156
160
|
> Also divisions are always floor divisions!
|
|
157
161
|
|
|
158
|
-
#### Use istr as
|
|
162
|
+
#### Use istr as a string
|
|
159
163
|
|
|
160
164
|
We should realize that istrs are in fact strings.
|
|
161
165
|
|
|
@@ -238,11 +242,13 @@ is `False`.
|
|
|
238
242
|
The `bool` operator works normally on the integer value of an istr. So
|
|
239
243
|
|
|
240
244
|
`bool(istr('0'))` ==> `False`
|
|
245
|
+
|
|
241
246
|
`bool(istr('1'))` ==> `True`
|
|
242
247
|
|
|
243
248
|
But if the istr can't be interpreted as an int, the string value will be used to test. So
|
|
244
249
|
|
|
245
250
|
`bool(istr('abc'))` ==> `True`
|
|
251
|
+
|
|
246
252
|
`bool(istr(''))` ==> `False`
|
|
247
253
|
|
|
248
254
|
#### Other operators
|
|
@@ -506,7 +512,7 @@ to `istr` and then concatenate these.
|
|
|
506
512
|
|
|
507
513
|
```
|
|
508
514
|
list(istr.concat(((1,2),(3,4))) ==> istr([12,34])
|
|
509
|
-
list(istr.concat(
|
|
515
|
+
list(istr.concat(istr.permutations(range(3),2))) ==>
|
|
510
516
|
[istr('01'), istr('02'), istr('10'), istr('12'), istr('20'), istr('21')]
|
|
511
517
|
```
|
|
512
518
|
|
|
@@ -558,7 +564,7 @@ When a class is derived from istr, all methods will return that newly derived cl
|
|
|
558
564
|
|
|
559
565
|
E.g.
|
|
560
566
|
```
|
|
561
|
-
class jstr(istr):
|
|
567
|
+
class jstr(istr.type):
|
|
562
568
|
...
|
|
563
569
|
|
|
564
570
|
print(repr(jstr(4) * jstr(5)))
|
|
@@ -761,7 +767,9 @@ There's an extensive pytest script in the `\tests` directory.
|
|
|
761
767
|
|
|
762
768
|
This script also shows clearly the ways istr can be used, including several edge cases. Highly recommended to have a look at.
|
|
763
769
|
|
|
770
|
+
### Contact info
|
|
764
771
|
|
|
772
|
+
You can contact Ruud van der Ham, the core developer, via ruud@salabim.org .
|
|
765
773
|
|
|
766
774
|
### Badges
|
|
767
775
|
  
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[
|
|
29
|
-
"
|
|
30
|
-
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "istr-python"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
|
|
11
|
+
]
|
|
12
|
+
description = "istr - strings you can count on"
|
|
13
|
+
version = "1.1.3"
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.7"
|
|
16
|
+
dependencies = []
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/salabim/istr"
|
|
25
|
+
Repository = "https://github.com/salabim/istr"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools]
|
|
28
|
+
packages = [
|
|
29
|
+
"istr",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.package-data]
|
|
33
|
+
"*" = [
|
|
34
|
+
"*.txt",
|
|
35
|
+
]
|
|
@@ -5,14 +5,14 @@ import sys
|
|
|
5
5
|
import re
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
|
-
if __name__ == "__main__": # to make the tests run without the pytest cli
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
# if __name__ == "__main__": # to make the tests run without the pytest cli
|
|
9
|
+
# file_folder = os.path.dirname(__file__)
|
|
10
|
+
# os.chdir(file_folder)
|
|
11
|
+
# sys.path.insert(0, file_folder + "/../istr")
|
|
12
12
|
|
|
13
13
|
import pytest
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
import istr
|
|
16
16
|
|
|
17
17
|
istr.equals = lambda self, other: type(self) == type(other) and (str(self) == str(other))
|
|
18
18
|
# this method tests whether self and other are exactly the same
|
|
@@ -358,17 +358,17 @@ def test_join():
|
|
|
358
358
|
s = istr("").join(("4", "5", "6"))
|
|
359
359
|
assert s == "456"
|
|
360
360
|
assert s == 456
|
|
361
|
-
assert type(s) == istr
|
|
361
|
+
assert type(s) == istr.type
|
|
362
362
|
|
|
363
363
|
s = istr("").join(istr(("4", "5", "6")))
|
|
364
364
|
assert s == "456"
|
|
365
365
|
assert s == 456
|
|
366
|
-
assert type(s) == istr
|
|
366
|
+
assert type(s) == istr.type
|
|
367
367
|
|
|
368
368
|
s = istr("").join(istr(("", "", "6")))
|
|
369
369
|
assert s == "6"
|
|
370
370
|
assert s == 6
|
|
371
|
-
assert type(s) == istr
|
|
371
|
+
assert type(s) == istr.type
|
|
372
372
|
|
|
373
373
|
|
|
374
374
|
def test_or():
|
|
@@ -677,7 +677,8 @@ def test_all_distinct():
|
|
|
677
677
|
|
|
678
678
|
|
|
679
679
|
def test_subclassing():
|
|
680
|
-
class jstr(istr):
|
|
680
|
+
class jstr(istr.type):
|
|
681
|
+
...
|
|
681
682
|
|
|
682
683
|
assert jstr(5).equals(jstr(5))
|
|
683
684
|
assert repr(jstr(*range(3))) == "(jstr('0'), jstr('1'), jstr('2'))"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|