istr-python 0.1.0__tar.gz → 0.1.1__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,17 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: istr-python
3
- Version: 0.1.0
4
- Summary: istr is a module to use strings as if they were integers.
3
+ Version: 0.1.1
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
7
7
  Project-URL: Repository, https://github.com/salabim/istr
8
- Classifier: Development Status :: 4 - Beta
8
+ Classifier: Development Status :: 5 - Production/Stable
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
 
14
- <img src="https://www.salabim.org/istr.png" width=500>
14
+ <img src="https://www.salabim.org/istr1.png" width=500>
15
15
 
16
16
  # Introduction
17
17
 
@@ -1,4 +1,4 @@
1
- <img src="https://www.salabim.org/istr.png" width=500>
1
+ <img src="https://www.salabim.org/istr1.png" width=500>
2
2
 
3
3
  # Introduction
4
4
 
@@ -1,14 +1,16 @@
1
1
  import functools
2
2
  import math
3
3
 
4
-
5
- # _ _
6
- # (_) ___ | |_ _ __
7
- # | |/ __|| __|| '__|
8
- # | |\__ \| |_ | |
9
- # |_||___/ \__||_| use strings as integers
10
-
11
- __version__ = "0.1.0"
4
+ # _ _
5
+ # (_) ___ | |_ _ __
6
+ # | |/ __|| __|| '__|
7
+ # | |\__ \| |_ | |
8
+ # |_||___/ \__||_|
9
+ # strings you can count on
10
+
11
+ __version__ = "0.1.1"
12
+ import functools
13
+ import math
12
14
 
13
15
  """
14
16
  changelog
@@ -256,7 +258,7 @@ class istr(str):
256
258
  as_int = 0
257
259
  else:
258
260
  as_int = cls._to_int(value)
259
- if cls._format == "" or cls._base != 10:
261
+ if (cls._format == "" or cls._base != 10) and not isinstance(value,istr):
260
262
  if isinstance(value, str):
261
263
  as_str = value
262
264
  else:
@@ -491,19 +493,13 @@ class istr(str):
491
493
 
492
494
 
493
495
  def main():
494
- print(repr(istr(" 12")))
495
496
  with istr.base(16):
496
- print(repr(istr(" 12")))
497
-
498
-
499
- with istr.format("05"):
500
- print(repr(istr(" 12")))
501
- print(repr(istr(12)))
502
- with istr.base(16):
503
- print(repr(istr(" 12")))
504
-
497
+ a = istr(15)
498
+ b = a * a
499
+ print(b)
500
+ c=istr(a)
501
+ print(repr(c))
505
502
 
506
503
 
507
504
  if __name__ == "__main__":
508
- main()
509
-
505
+ main()
@@ -1,17 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: istr-python
3
- Version: 0.1.0
4
- Summary: istr is a module to use strings as if they were integers.
3
+ Version: 0.1.1
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
7
7
  Project-URL: Repository, https://github.com/salabim/istr
8
- Classifier: Development Status :: 4 - Beta
8
+ Classifier: Development Status :: 5 - Production/Stable
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3 :: Only
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
 
14
- <img src="https://www.salabim.org/istr.png" width=500>
14
+ <img src="https://www.salabim.org/istr1.png" width=500>
15
15
 
16
16
  # Introduction
17
17
 
@@ -7,19 +7,14 @@ 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 is a module to use strings as if they were integers."
11
- version = "0.1.0"
10
+ description = "istr - strings you can count on"
11
+ version = "0.1.1"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.7"
14
14
  dependencies = [
15
15
  ]
16
16
  classifiers = [
17
- # How mature is this project? Common values are
18
- # 3 - Alpha
19
- # 4 - Beta
20
- # 5 - Production/Stable
21
- "Development Status :: 4 - Beta",
22
-
17
+ "Development Status :: 5 - Production/Stable",
23
18
  "License :: OSI Approved :: MIT License",
24
19
  "Programming Language :: Python :: 3 :: Only"
25
20
  ]
@@ -439,6 +439,16 @@ def test_base():
439
439
  with istr.base(16):
440
440
  istr(-1)
441
441
 
442
+ with istr.base(16):
443
+ a = istr(15)
444
+ with istr.base(10):
445
+ assert a * a == 225
446
+ with pytest.raises(ValueError):
447
+ assert a | a # FF can't be converted to base 10
448
+
449
+
450
+
451
+
442
452
 
443
453
  def test_subclassing():
444
454
  class jstr(istr):
File without changes