istr-python 0.0.0__tar.gz → 0.0.2__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.
@@ -1,29 +1,31 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: istr-python
3
- Version: 0.0.0
4
- Summary: istr description
3
+ Version: 0.0.2
4
+ Summary: istr is a module to use strings as if they were integers.
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Requires-Python: >=3.7
7
7
  Description-Content-Type: text/markdown
8
8
 
9
9
  # Introduction
10
10
 
11
- The istrlib module has exactly one class: istr.
11
+ The istr module has exactly one class: istr.
12
12
 
13
- With this it is possible to interpret string as if they were integers. This can be very handy for solving
14
- puzzles, but also for other purposes.
13
+ With this it is possible to interpret string as if they were integers.
14
+
15
+ This can be very handy for solving puzzles, but also for other purposes.
16
+
17
+ And it is a nice demonstration of extending a class (str) with extra and changed functionality.
15
18
 
16
19
  # Installation
17
- Installing istrlib with pip is easy.
20
+ Installing istr with pip is easy.
18
21
  ```
19
- $ pip install istrlib
22
+ $ pip install istr-python
20
23
  ```
21
24
  or when you want to upgrade,
22
25
  ```
23
- $ pip install istrlib --upgrade
26
+ $ pip install istr-python --upgrade
24
27
  ```
25
-
26
- Alternatively, istrlib.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istrlib).
28
+ Alternatively, istr.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istr).
27
29
 
28
30
  No dependencies!
29
31
 
@@ -31,7 +33,7 @@ No dependencies!
31
33
  Just start with
32
34
 
33
35
  ```
34
- from istrlib import istr
36
+ from istr import istr
35
37
  ```
36
38
 
37
39
  Now we can define some istrs:
@@ -43,19 +45,19 @@ Them we can do
43
45
  ```
44
46
  x= four * five
45
47
  ```
46
- , after which x is `istr("40")`
48
+ , after which x is `istr("20")`
47
49
 
48
50
  And now we can do
49
51
  ```
50
- print(x == 40)
51
- print(x == "40")
52
+ print(x == 20)
53
+ print(x == "20")
52
54
  ```
53
55
  resulting in two times `True`. That's because istr instances are treated as int, although they are strings.
54
56
 
55
57
  That means that we can also say
56
58
  ```
57
- print(x < 50)
58
- print(x >= "30")
59
+ print(x < 30)
60
+ print(x >= "10")
59
61
  ```
60
62
  again resulting in two times `True`.
61
63
 
@@ -103,7 +105,7 @@ Note that all calculations are strictly integer calculations. That means that if
103
105
  Also divisions are always floor divisions!
104
106
 
105
107
  There's a special case for `istr("")`. This is a proper empty string, but also represents the value of 0.
106
- That is to allow for istr("").join(i for i in "01234"
108
+ That is to allow for istr("").join(i for i in "01234)"
107
109
 
108
110
  Sorting a list of istrs is based on the integer value, not the string. So
109
111
 
@@ -121,3 +123,5 @@ is
121
123
 
122
124
  `'0 1 2 3 4 5 6 7 8 9 10 11'`
123
125
 
126
+ # Additional methods
127
+ It is possible to test for even/odd
@@ -1,21 +1,23 @@
1
1
  # Introduction
2
2
 
3
- The istrlib module has exactly one class: istr.
3
+ The istr module has exactly one class: istr.
4
4
 
5
- With this it is possible to interpret string as if they were integers. This can be very handy for solving
6
- puzzles, but also for other purposes.
5
+ With this it is possible to interpret string as if they were integers.
6
+
7
+ This can be very handy for solving puzzles, but also for other purposes.
8
+
9
+ And it is a nice demonstration of extending a class (str) with extra and changed functionality.
7
10
 
8
11
  # Installation
9
- Installing istrlib with pip is easy.
12
+ Installing istr with pip is easy.
10
13
  ```
11
- $ pip install istrlib
14
+ $ pip install istr-python
12
15
  ```
13
16
  or when you want to upgrade,
14
17
  ```
15
- $ pip install istrlib --upgrade
18
+ $ pip install istr-python --upgrade
16
19
  ```
17
-
18
- Alternatively, istrlib.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istrlib).
20
+ Alternatively, istr.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istr).
19
21
 
20
22
  No dependencies!
21
23
 
@@ -23,7 +25,7 @@ No dependencies!
23
25
  Just start with
24
26
 
25
27
  ```
26
- from istrlib import istr
28
+ from istr import istr
27
29
  ```
28
30
 
29
31
  Now we can define some istrs:
@@ -35,19 +37,19 @@ Them we can do
35
37
  ```
36
38
  x= four * five
37
39
  ```
38
- , after which x is `istr("40")`
40
+ , after which x is `istr("20")`
39
41
 
40
42
  And now we can do
41
43
  ```
42
- print(x == 40)
43
- print(x == "40")
44
+ print(x == 20)
45
+ print(x == "20")
44
46
  ```
45
47
  resulting in two times `True`. That's because istr instances are treated as int, although they are strings.
46
48
 
47
49
  That means that we can also say
48
50
  ```
49
- print(x < 50)
50
- print(x >= "30")
51
+ print(x < 30)
52
+ print(x >= "10")
51
53
  ```
52
54
  again resulting in two times `True`.
53
55
 
@@ -95,7 +97,7 @@ Note that all calculations are strictly integer calculations. That means that if
95
97
  Also divisions are always floor divisions!
96
98
 
97
99
  There's a special case for `istr("")`. This is a proper empty string, but also represents the value of 0.
98
- That is to allow for istr("").join(i for i in "01234"
100
+ That is to allow for istr("").join(i for i in "01234)"
99
101
 
100
102
  Sorting a list of istrs is based on the integer value, not the string. So
101
103
 
@@ -113,3 +115,5 @@ is
113
115
 
114
116
  `'0 1 2 3 4 5 6 7 8 9 10 11'`
115
117
 
118
+ # Additional methods
119
+ It is possible to test for even/odd
@@ -0,0 +1 @@
1
+ from .istr import *
@@ -344,8 +344,7 @@ class istr(str):
344
344
 
345
345
 
346
346
  def main():
347
- print(repr(istr("").join(istr.range(5))))
348
-
347
+ ...
349
348
 
350
349
  if __name__ == "__main__":
351
350
  main()
@@ -0,0 +1,11 @@
1
+ import itertools
2
+ from istr import istr
3
+ print(istr)
4
+
5
+ for s, e, n, d, m, o, r, y in istr(itertools.permutations("0123456789", 8)):
6
+ if (m > 0) and ((s | e | n | d) + (m | o | r | e) == (m | o | n | e | y)):
7
+ print(f" {s|e|n|d}")
8
+ print(f" {m|o|r|e}")
9
+ print("-----")
10
+ print(m | o | n | e | y)
11
+
@@ -1,29 +1,31 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: istr-python
3
- Version: 0.0.0
4
- Summary: istr description
3
+ Version: 0.0.2
4
+ Summary: istr is a module to use strings as if they were integers.
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Requires-Python: >=3.7
7
7
  Description-Content-Type: text/markdown
8
8
 
9
9
  # Introduction
10
10
 
11
- The istrlib module has exactly one class: istr.
11
+ The istr module has exactly one class: istr.
12
12
 
13
- With this it is possible to interpret string as if they were integers. This can be very handy for solving
14
- puzzles, but also for other purposes.
13
+ With this it is possible to interpret string as if they were integers.
14
+
15
+ This can be very handy for solving puzzles, but also for other purposes.
16
+
17
+ And it is a nice demonstration of extending a class (str) with extra and changed functionality.
15
18
 
16
19
  # Installation
17
- Installing istrlib with pip is easy.
20
+ Installing istr with pip is easy.
18
21
  ```
19
- $ pip install istrlib
22
+ $ pip install istr-python
20
23
  ```
21
24
  or when you want to upgrade,
22
25
  ```
23
- $ pip install istrlib --upgrade
26
+ $ pip install istr-python --upgrade
24
27
  ```
25
-
26
- Alternatively, istrlib.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istrlib).
28
+ Alternatively, istr.py can be just copied into you current work directory from GitHub (https://github.com/salabim/istr).
27
29
 
28
30
  No dependencies!
29
31
 
@@ -31,7 +33,7 @@ No dependencies!
31
33
  Just start with
32
34
 
33
35
  ```
34
- from istrlib import istr
36
+ from istr import istr
35
37
  ```
36
38
 
37
39
  Now we can define some istrs:
@@ -43,19 +45,19 @@ Them we can do
43
45
  ```
44
46
  x= four * five
45
47
  ```
46
- , after which x is `istr("40")`
48
+ , after which x is `istr("20")`
47
49
 
48
50
  And now we can do
49
51
  ```
50
- print(x == 40)
51
- print(x == "40")
52
+ print(x == 20)
53
+ print(x == "20")
52
54
  ```
53
55
  resulting in two times `True`. That's because istr instances are treated as int, although they are strings.
54
56
 
55
57
  That means that we can also say
56
58
  ```
57
- print(x < 50)
58
- print(x >= "30")
59
+ print(x < 30)
60
+ print(x >= "10")
59
61
  ```
60
62
  again resulting in two times `True`.
61
63
 
@@ -103,7 +105,7 @@ Note that all calculations are strictly integer calculations. That means that if
103
105
  Also divisions are always floor divisions!
104
106
 
105
107
  There's a special case for `istr("")`. This is a proper empty string, but also represents the value of 0.
106
- That is to allow for istr("").join(i for i in "01234"
108
+ That is to allow for istr("").join(i for i in "01234)"
107
109
 
108
110
  Sorting a list of istrs is based on the integer value, not the string. So
109
111
 
@@ -121,3 +123,5 @@ is
121
123
 
122
124
  `'0 1 2 3 4 5 6 7 8 9 10 11'`
123
125
 
126
+ # Additional methods
127
+ It is possible to test for even/odd
@@ -3,8 +3,9 @@ pyproject.toml
3
3
  istr/__init__.py
4
4
  istr/install istr.py
5
5
  istr/istr.py
6
+ istr/sendmoremoney.py
6
7
  istr_python.egg-info/PKG-INFO
7
8
  istr_python.egg-info/SOURCES.txt
8
9
  istr_python.egg-info/dependency_links.txt
9
10
  istr_python.egg-info/top_level.txt
10
- test/test_istrlib.py
11
+ tests/test_istr.py
@@ -7,8 +7,9 @@ name = "istr-python"
7
7
  authors = [
8
8
  {name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com"}
9
9
  ]
10
- description = "istr description"
11
- version = "0.0.0"
10
+ description = "istr is a module to use strings as if they were integers."
11
+
12
+ version = "0.0.2"
12
13
  readme = "README.md"
13
14
  requires-python = ">=3.7"
14
15
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  from __future__ import print_function
2
2
  from __future__ import division
3
- from istrlib import istr
3
+ from istr import istr
4
4
  import math
5
5
 
6
6
  import pytest
File without changes
File without changes