istr-python 0.1.6__tar.gz → 0.1.8__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-0.1.6 → istr_python-0.1.8}/PKG-INFO +19 -18
- {istr_python-0.1.6 → istr_python-0.1.8}/README.md +18 -17
- {istr_python-0.1.6 → istr_python-0.1.8}/istr_python.egg-info/PKG-INFO +19 -18
- {istr_python-0.1.6 → istr_python-0.1.8}/pyproject.toml +1 -1
- {istr_python-0.1.6 → istr_python-0.1.8}/istr/__init__.py +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/istr/install istr.py +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/istr/istr.py +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/istr_python.egg-info/SOURCES.txt +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/istr_python.egg-info/dependency_links.txt +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/istr_python.egg-info/top_level.txt +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/setup.cfg +0 -0
- {istr_python-0.1.6 → istr_python-0.1.8}/tests/test_istr.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: istr-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
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
|
|
@@ -13,7 +13,7 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
|
|
14
14
|
<img src="https://www.salabim.org/istr_logo.png" width=500>
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## Introduction
|
|
17
17
|
|
|
18
18
|
The istr module has exactly one class: istr.
|
|
19
19
|
|
|
@@ -42,7 +42,7 @@ for s, e, n, d, m, o, r, y in istr(itertools.permutations(range(10), 8)):
|
|
|
42
42
|
|
|
43
43
|
And it is a nice demonstration of extending a class (str) with extra and changed functionality.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
## Installation
|
|
46
46
|
Installing istr with pip is easy.
|
|
47
47
|
```
|
|
48
48
|
$ pip install istr-python
|
|
@@ -55,7 +55,7 @@ Alternatively, istr.py can be just copied into you current work directory from G
|
|
|
55
55
|
|
|
56
56
|
No dependencies!
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
## Usage
|
|
59
59
|
Just start with
|
|
60
60
|
|
|
61
61
|
```
|
|
@@ -171,7 +171,7 @@ is
|
|
|
171
171
|
|
|
172
172
|
`"0 1 2 3 4 5 6 7 8 9 10 11"`
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
## Using other values for istr than numeric value or str
|
|
175
175
|
Apart from with simple numeric (to be interpreted as an int) or str, istr can be initialized with
|
|
176
176
|
several other types:
|
|
177
177
|
|
|
@@ -191,7 +191,7 @@ several other types:
|
|
|
191
191
|
|
|
192
192
|
`istr((0, 1, 4))` ==> `(istr("0"), istr("1"), istr("4"))`
|
|
193
193
|
|
|
194
|
-
`istr({0, 1, 4})` ==> `{istr("4"), istr("0"), istr("1")}
|
|
194
|
+
`istr({0, 1, 4})` ==> `{istr("4"), istr("0"), istr("1")} ## or similar`
|
|
195
195
|
|
|
196
196
|
- if a range, an istr.range instance will be returned
|
|
197
197
|
|
|
@@ -203,14 +203,14 @@ several other types:
|
|
|
203
203
|
|
|
204
204
|
- if an istr.range instance, the same istr.range will be returned
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
## More than one parameter for istr
|
|
207
207
|
It is possible to give more than one parameter, in which case a tuple
|
|
208
208
|
of the istrs of the parameters will be returned, which can be handy
|
|
209
209
|
to unpack multiple values, e.g.
|
|
210
210
|
|
|
211
211
|
`a, b, c = istr(5, 6, 7)` ==> `a=istr("5") , b=istr("6"), c=istr("7")`
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
## test for even/odd
|
|
214
214
|
It is possible to test for even/odd with the
|
|
215
215
|
|
|
216
216
|
`is_even` and `is_odd` method, e.g.
|
|
@@ -221,7 +221,7 @@ print(istr(5).is_odd())
|
|
|
221
221
|
```
|
|
222
222
|
This will print `True` twice.
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
## reverse an istr
|
|
225
225
|
The method `istr.reversed()` will return the an istr with the reversed content:
|
|
226
226
|
```
|
|
227
227
|
print(repr(istr(456).reversed()))
|
|
@@ -239,7 +239,7 @@ print(repr(istr("0456")[::-1]))
|
|
|
239
239
|
```
|
|
240
240
|
Note that is impossible to reverse a negative istr.
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
## enumerate with istrs
|
|
243
243
|
|
|
244
244
|
The `istr.enumerate` method can be used just as the builtin enumerate function.
|
|
245
245
|
The iteration counter however is an istr rather than an int. E.g.
|
|
@@ -254,7 +254,7 @@ istr('1') b
|
|
|
254
254
|
istr('2') c
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
## concatenate an iterable
|
|
258
258
|
|
|
259
259
|
The `istr.concat1 method can be useful to map all items of an iterable
|
|
260
260
|
to `istr` and then concatenate these.
|
|
@@ -263,7 +263,7 @@ to `istr` and then concatenate these.
|
|
|
263
263
|
|
|
264
264
|
`list(istr.concat(itertools.permutations(range(3),2)))` ==> `[istr('01'), istr('02'), istr('10'), istr('12'), istr('20'), istr('21')]`
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
## Subclassing istr
|
|
267
267
|
When a class is derived from istr, all methods will return that newly derived class.
|
|
268
268
|
|
|
269
269
|
E.g.
|
|
@@ -275,7 +275,7 @@ print(repr(jstr(4) * jstr(5)))
|
|
|
275
275
|
```
|
|
276
276
|
will print `jstr('20')`
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
## Changing the way repr works
|
|
279
279
|
|
|
280
280
|
It is possible to control the way an `istr` instance will be repr'ed.
|
|
281
281
|
|
|
@@ -318,7 +318,7 @@ print(repr(istr.repr_mode()))
|
|
|
318
318
|
```
|
|
319
319
|
will output `istr`.
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
## Changing the base system
|
|
322
322
|
|
|
323
323
|
By default, `istr` works in base 10. However it is possible to change the base system with the `istr.base()` context manager / method.
|
|
324
324
|
|
|
@@ -360,7 +360,7 @@ print(istr.base())
|
|
|
360
360
|
```
|
|
361
361
|
will result in `10`.
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
## Changing the format of the string
|
|
364
364
|
|
|
365
365
|
By default, `istr` does not change the way an istr is stored when a str is to initialize:
|
|
366
366
|
|
|
@@ -415,12 +415,13 @@ will result in `istr('0012')`
|
|
|
415
415
|
|
|
416
416
|
Remark: For bases other than 10, the string will never be reformatted!
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
## Test script
|
|
419
419
|
There's an extensive pytest script in the `\tests` directory.
|
|
420
420
|
|
|
421
421
|
This script also shows clearly the ways istr can be used.
|
|
422
422
|
|
|
423
|
-
|
|
423
|
+
## Badges
|
|
424
|
+
  
|
|
424
425
|
|
|
425
|
-
 
|
|
426
|
+
 
|
|
426
427
|

|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<img src="https://www.salabim.org/istr_logo.png" width=500>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Introduction
|
|
4
4
|
|
|
5
5
|
The istr module has exactly one class: istr.
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ for s, e, n, d, m, o, r, y in istr(itertools.permutations(range(10), 8)):
|
|
|
29
29
|
|
|
30
30
|
And it is a nice demonstration of extending a class (str) with extra and changed functionality.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
## Installation
|
|
33
33
|
Installing istr with pip is easy.
|
|
34
34
|
```
|
|
35
35
|
$ pip install istr-python
|
|
@@ -42,7 +42,7 @@ Alternatively, istr.py can be just copied into you current work directory from G
|
|
|
42
42
|
|
|
43
43
|
No dependencies!
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
## Usage
|
|
46
46
|
Just start with
|
|
47
47
|
|
|
48
48
|
```
|
|
@@ -158,7 +158,7 @@ is
|
|
|
158
158
|
|
|
159
159
|
`"0 1 2 3 4 5 6 7 8 9 10 11"`
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
## Using other values for istr than numeric value or str
|
|
162
162
|
Apart from with simple numeric (to be interpreted as an int) or str, istr can be initialized with
|
|
163
163
|
several other types:
|
|
164
164
|
|
|
@@ -178,7 +178,7 @@ several other types:
|
|
|
178
178
|
|
|
179
179
|
`istr((0, 1, 4))` ==> `(istr("0"), istr("1"), istr("4"))`
|
|
180
180
|
|
|
181
|
-
`istr({0, 1, 4})` ==> `{istr("4"), istr("0"), istr("1")}
|
|
181
|
+
`istr({0, 1, 4})` ==> `{istr("4"), istr("0"), istr("1")} ## or similar`
|
|
182
182
|
|
|
183
183
|
- if a range, an istr.range instance will be returned
|
|
184
184
|
|
|
@@ -190,14 +190,14 @@ several other types:
|
|
|
190
190
|
|
|
191
191
|
- if an istr.range instance, the same istr.range will be returned
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
## More than one parameter for istr
|
|
194
194
|
It is possible to give more than one parameter, in which case a tuple
|
|
195
195
|
of the istrs of the parameters will be returned, which can be handy
|
|
196
196
|
to unpack multiple values, e.g.
|
|
197
197
|
|
|
198
198
|
`a, b, c = istr(5, 6, 7)` ==> `a=istr("5") , b=istr("6"), c=istr("7")`
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
## test for even/odd
|
|
201
201
|
It is possible to test for even/odd with the
|
|
202
202
|
|
|
203
203
|
`is_even` and `is_odd` method, e.g.
|
|
@@ -208,7 +208,7 @@ print(istr(5).is_odd())
|
|
|
208
208
|
```
|
|
209
209
|
This will print `True` twice.
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
## reverse an istr
|
|
212
212
|
The method `istr.reversed()` will return the an istr with the reversed content:
|
|
213
213
|
```
|
|
214
214
|
print(repr(istr(456).reversed()))
|
|
@@ -226,7 +226,7 @@ print(repr(istr("0456")[::-1]))
|
|
|
226
226
|
```
|
|
227
227
|
Note that is impossible to reverse a negative istr.
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
## enumerate with istrs
|
|
230
230
|
|
|
231
231
|
The `istr.enumerate` method can be used just as the builtin enumerate function.
|
|
232
232
|
The iteration counter however is an istr rather than an int. E.g.
|
|
@@ -241,7 +241,7 @@ istr('1') b
|
|
|
241
241
|
istr('2') c
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
## concatenate an iterable
|
|
245
245
|
|
|
246
246
|
The `istr.concat1 method can be useful to map all items of an iterable
|
|
247
247
|
to `istr` and then concatenate these.
|
|
@@ -250,7 +250,7 @@ to `istr` and then concatenate these.
|
|
|
250
250
|
|
|
251
251
|
`list(istr.concat(itertools.permutations(range(3),2)))` ==> `[istr('01'), istr('02'), istr('10'), istr('12'), istr('20'), istr('21')]`
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
## Subclassing istr
|
|
254
254
|
When a class is derived from istr, all methods will return that newly derived class.
|
|
255
255
|
|
|
256
256
|
E.g.
|
|
@@ -262,7 +262,7 @@ print(repr(jstr(4) * jstr(5)))
|
|
|
262
262
|
```
|
|
263
263
|
will print `jstr('20')`
|
|
264
264
|
|
|
265
|
-
|
|
265
|
+
## Changing the way repr works
|
|
266
266
|
|
|
267
267
|
It is possible to control the way an `istr` instance will be repr'ed.
|
|
268
268
|
|
|
@@ -305,7 +305,7 @@ print(repr(istr.repr_mode()))
|
|
|
305
305
|
```
|
|
306
306
|
will output `istr`.
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
## Changing the base system
|
|
309
309
|
|
|
310
310
|
By default, `istr` works in base 10. However it is possible to change the base system with the `istr.base()` context manager / method.
|
|
311
311
|
|
|
@@ -347,7 +347,7 @@ print(istr.base())
|
|
|
347
347
|
```
|
|
348
348
|
will result in `10`.
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
## Changing the format of the string
|
|
351
351
|
|
|
352
352
|
By default, `istr` does not change the way an istr is stored when a str is to initialize:
|
|
353
353
|
|
|
@@ -402,12 +402,13 @@ will result in `istr('0012')`
|
|
|
402
402
|
|
|
403
403
|
Remark: For bases other than 10, the string will never be reformatted!
|
|
404
404
|
|
|
405
|
-
|
|
405
|
+
## Test script
|
|
406
406
|
There's an extensive pytest script in the `\tests` directory.
|
|
407
407
|
|
|
408
408
|
This script also shows clearly the ways istr can be used.
|
|
409
409
|
|
|
410
|
-
|
|
410
|
+
## Badges
|
|
411
|
+
  
|
|
411
412
|
|
|
412
|
-
 
|
|
413
|
+
 
|
|
413
414
|

|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: istr-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
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
|
|
@@ -13,7 +13,7 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
|
|
14
14
|
<img src="https://www.salabim.org/istr_logo.png" width=500>
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## Introduction
|
|
17
17
|
|
|
18
18
|
The istr module has exactly one class: istr.
|
|
19
19
|
|
|
@@ -42,7 +42,7 @@ for s, e, n, d, m, o, r, y in istr(itertools.permutations(range(10), 8)):
|
|
|
42
42
|
|
|
43
43
|
And it is a nice demonstration of extending a class (str) with extra and changed functionality.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
## Installation
|
|
46
46
|
Installing istr with pip is easy.
|
|
47
47
|
```
|
|
48
48
|
$ pip install istr-python
|
|
@@ -55,7 +55,7 @@ Alternatively, istr.py can be just copied into you current work directory from G
|
|
|
55
55
|
|
|
56
56
|
No dependencies!
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
## Usage
|
|
59
59
|
Just start with
|
|
60
60
|
|
|
61
61
|
```
|
|
@@ -171,7 +171,7 @@ is
|
|
|
171
171
|
|
|
172
172
|
`"0 1 2 3 4 5 6 7 8 9 10 11"`
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
## Using other values for istr than numeric value or str
|
|
175
175
|
Apart from with simple numeric (to be interpreted as an int) or str, istr can be initialized with
|
|
176
176
|
several other types:
|
|
177
177
|
|
|
@@ -191,7 +191,7 @@ several other types:
|
|
|
191
191
|
|
|
192
192
|
`istr((0, 1, 4))` ==> `(istr("0"), istr("1"), istr("4"))`
|
|
193
193
|
|
|
194
|
-
`istr({0, 1, 4})` ==> `{istr("4"), istr("0"), istr("1")}
|
|
194
|
+
`istr({0, 1, 4})` ==> `{istr("4"), istr("0"), istr("1")} ## or similar`
|
|
195
195
|
|
|
196
196
|
- if a range, an istr.range instance will be returned
|
|
197
197
|
|
|
@@ -203,14 +203,14 @@ several other types:
|
|
|
203
203
|
|
|
204
204
|
- if an istr.range instance, the same istr.range will be returned
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
## More than one parameter for istr
|
|
207
207
|
It is possible to give more than one parameter, in which case a tuple
|
|
208
208
|
of the istrs of the parameters will be returned, which can be handy
|
|
209
209
|
to unpack multiple values, e.g.
|
|
210
210
|
|
|
211
211
|
`a, b, c = istr(5, 6, 7)` ==> `a=istr("5") , b=istr("6"), c=istr("7")`
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
## test for even/odd
|
|
214
214
|
It is possible to test for even/odd with the
|
|
215
215
|
|
|
216
216
|
`is_even` and `is_odd` method, e.g.
|
|
@@ -221,7 +221,7 @@ print(istr(5).is_odd())
|
|
|
221
221
|
```
|
|
222
222
|
This will print `True` twice.
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
## reverse an istr
|
|
225
225
|
The method `istr.reversed()` will return the an istr with the reversed content:
|
|
226
226
|
```
|
|
227
227
|
print(repr(istr(456).reversed()))
|
|
@@ -239,7 +239,7 @@ print(repr(istr("0456")[::-1]))
|
|
|
239
239
|
```
|
|
240
240
|
Note that is impossible to reverse a negative istr.
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
## enumerate with istrs
|
|
243
243
|
|
|
244
244
|
The `istr.enumerate` method can be used just as the builtin enumerate function.
|
|
245
245
|
The iteration counter however is an istr rather than an int. E.g.
|
|
@@ -254,7 +254,7 @@ istr('1') b
|
|
|
254
254
|
istr('2') c
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
## concatenate an iterable
|
|
258
258
|
|
|
259
259
|
The `istr.concat1 method can be useful to map all items of an iterable
|
|
260
260
|
to `istr` and then concatenate these.
|
|
@@ -263,7 +263,7 @@ to `istr` and then concatenate these.
|
|
|
263
263
|
|
|
264
264
|
`list(istr.concat(itertools.permutations(range(3),2)))` ==> `[istr('01'), istr('02'), istr('10'), istr('12'), istr('20'), istr('21')]`
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
## Subclassing istr
|
|
267
267
|
When a class is derived from istr, all methods will return that newly derived class.
|
|
268
268
|
|
|
269
269
|
E.g.
|
|
@@ -275,7 +275,7 @@ print(repr(jstr(4) * jstr(5)))
|
|
|
275
275
|
```
|
|
276
276
|
will print `jstr('20')`
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
## Changing the way repr works
|
|
279
279
|
|
|
280
280
|
It is possible to control the way an `istr` instance will be repr'ed.
|
|
281
281
|
|
|
@@ -318,7 +318,7 @@ print(repr(istr.repr_mode()))
|
|
|
318
318
|
```
|
|
319
319
|
will output `istr`.
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
## Changing the base system
|
|
322
322
|
|
|
323
323
|
By default, `istr` works in base 10. However it is possible to change the base system with the `istr.base()` context manager / method.
|
|
324
324
|
|
|
@@ -360,7 +360,7 @@ print(istr.base())
|
|
|
360
360
|
```
|
|
361
361
|
will result in `10`.
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
## Changing the format of the string
|
|
364
364
|
|
|
365
365
|
By default, `istr` does not change the way an istr is stored when a str is to initialize:
|
|
366
366
|
|
|
@@ -415,12 +415,13 @@ will result in `istr('0012')`
|
|
|
415
415
|
|
|
416
416
|
Remark: For bases other than 10, the string will never be reformatted!
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
## Test script
|
|
419
419
|
There's an extensive pytest script in the `\tests` directory.
|
|
420
420
|
|
|
421
421
|
This script also shows clearly the ways istr can be used.
|
|
422
422
|
|
|
423
|
-
|
|
423
|
+
## Badges
|
|
424
|
+
  
|
|
424
425
|
|
|
425
|
-
 
|
|
426
|
+
 
|
|
426
427
|

|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|