baseconvert 2.0.0__tar.gz → 2.0.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,9 +1,9 @@
1
- The MIT License (MIT)
2
- Copyright (c) 2023 BreadMakesYouFull
3
- Copyright (c) 2016 squdle
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+ Copyright (c) 2023 BreadMakesYouFull
3
+ Copyright (c) 2016 squdle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,5 +1,5 @@
1
- # Include the license file
2
- include LICENSE.txt
3
- include VERSION.txt
4
- include README.md
1
+ # Include the license file
2
+ include LICENSE.txt
3
+ include VERSION.txt
4
+ include README.md
5
5
  include README.rst
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: baseconvert
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: Convert numbers between bases.
5
5
  Home-page: https://github.com/BreadMakesYouFull/baseconvert.git
6
6
  Author: squdle, BreadMakesYouFull
@@ -14,156 +14,166 @@ Classifier: Topic :: Scientific/Engineering :: Mathematics
14
14
  Classifier: Intended Audience :: Education
15
15
  Classifier: License :: OSI Approved :: MIT License
16
16
  License-File: LICENSE.txt
17
- Requires-Dist: pyside6
18
-
19
- baseconvert
20
- ===========
21
-
22
- Convert any rational number, from any (positive integer) base, to any
23
- (positive integer) base. Output numbers as tuple or string.
24
-
25
- - Any rational number
26
- - Arbitrary precision
27
- - Fractions
28
- - Recurring/repeating fractional digits.
29
- - Input numbers as tuple or string or number.
30
- - Output numbers as tuple or string.
31
-
32
- MIT License (MIT) Copyright (c) 2016 BreadMakesYouFull
33
- MIT License (MIT) Copyright (c) 2016 squdle
34
-
35
- `github <https://github.com/BreadMakesYouFull/baseconvert>`__
36
-
37
- Requires
38
- --------
39
-
40
- - Python 3
41
-
42
- Install / Uninstall
43
- -------------------
44
-
45
- Install:
46
-
47
- ::
48
-
49
- pip install baseconvert
50
-
51
- Uninstall:
52
-
53
- ::
54
-
55
- pip uninstall baseconvert
56
-
57
- Quickstart
58
- ----------
59
-
60
- ::
61
-
62
- # base(number, input_base, output_base)
63
-
64
- >>> base((15, 15, 0, ".", 8), 16, 10)
65
- (4, 0, 8, 0, '.', 5)
66
-
67
- >>> base("FF0.8", 16, 10, string=True)
68
- '4080.5'
69
-
70
- >>> base("4080.5", 10, 16, string=True)
71
- 'FF0.8'
72
-
73
- Or from command line
74
-
75
- ::
76
-
77
- $ echo 4080.5 | python -m baseconvert -i 10 -o 16
78
- FF0.8
79
-
80
- $ python -m baseconvert -n 4080.5 -i 10 -o 16
81
- FF0.8
82
-
83
- Tuple representation
84
- --------------------
85
-
86
- Numbers are represented as a sequence of digits. Each digit is a base-10
87
- integer value. The radix point, which separates the integer and
88
- fractional parts, is denoted by a string period.
89
-
90
- ::
91
-
92
- (int, int, int, ... , '.', ... , int, int, int)
93
- ( integer part , '.', fractional part )
94
-
95
- String representation
96
- ---------------------
97
-
98
- String digits (after z the values are in ascending Unicode):
99
-
100
- ::
101
-
102
- 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
103
-
104
- | Value | Representation |
105
- |---------|----------------|
106
- | 0 - 9 | 0 - 9 |
107
- | 10 - 53 | A - Z |
108
- | 36 - 61 | a - z |
109
- | 62 + | unicode 123 + |
110
-
111
- For bases higher than 61 it's recommended to use tuple representation.
112
-
113
- Examples
114
- --------
115
-
116
- ::
117
-
118
- # base(number, input_base, output_base)
119
- >>> n = (15,15,".",0,8)
120
- >>> base(n, 16, 10)
121
- (2, 5, 5, '.', 0, 3, 1, 2, 5)
122
- >>> base(n, 16, 10, string=True)
123
- '255.03125'
124
-
125
- >>> base("FF.08", 16, 10) == base((15,15,".",0,8), 16, 10)
126
- True
127
-
128
- # A callable BaseConverter object can also be created.
129
- # This is useful for when several numbers need to be converted.
130
-
131
- >>> b = BaseConverter(input_base=16, output_base=8)
132
- >>> b("FF")
133
- (3, 7, 7)
134
- >>> b((15, 15))
135
- (3, 7, 7)
136
- >>> b("FF") == b((15,15))
137
- True
138
-
139
- >>> base(0.1, 3, 10, string=True)
140
- '0.[3]'
141
-
142
- Recurring digits
143
- ~~~~~~~~~~~~~~~~
144
-
145
- Recurring digits at the end of a fractional part will be enclosed by "["
146
- and "]" in both string and tuple representation. This behavior can be
147
- turned off by setting the recurring argument of base or BaseConverter
148
- object to False.
149
-
150
- ::
151
-
152
- >>> base("0.1", 3, 10, string=True)
153
- '0.[3]'
154
- >>> base("0.1", 3, 10, string=True, recurring=False)
155
- '0.3333333333'
156
-
157
- Max fractional depth
158
- ~~~~~~~~~~~~~~~~~~~~
159
-
160
- Integer parts are always of arbitrary size. Fractional depth (number of
161
- digits) can must be specified by setting the max\_depth argument of base
162
- or a BaseConverter object (default 10).
163
-
164
- ::
165
-
166
- >>> base("0.2", 10, 8)
167
- (0, '.', 1, 4, 6, 3, 1, 4, 6, 3, 1, 4)
168
- >>> base("0.2", 10, 8, max_depth=1)
169
- (0, '.', 1)
17
+ Provides-Extra: gui
18
+ Requires-Dist: pyside6; extra == "gui"
19
+
20
+ baseconvert
21
+ ===========
22
+
23
+ Convert any rational number, from any (positive integer) base, to any
24
+ (positive integer) base. Output numbers as tuple or string.
25
+
26
+ - Any rational number
27
+ - Arbitrary precision
28
+ - Fractions
29
+ - Recurring/repeating fractional digits.
30
+ - Input numbers as tuple or string or number.
31
+ - Output numbers as tuple or string.
32
+
33
+ MIT License (MIT) Copyright (c) 2024 BreadMakesYouFull
34
+ MIT License (MIT) Copyright (c) 2016 squdle
35
+
36
+ `github <https://github.com/BreadMakesYouFull/baseconvert>`__
37
+
38
+ Requires
39
+ --------
40
+
41
+ - Python 3
42
+
43
+ Install / Uninstall
44
+ -------------------
45
+
46
+ Install:
47
+
48
+ ::
49
+
50
+ pip install baseconvert
51
+
52
+ Optionally install GUI frontend and launch:
53
+
54
+ ::
55
+
56
+ # Install with pyside6
57
+ pip install baseconvert[gui]
58
+ # Run GUI frontend
59
+ baseconvert
60
+
61
+ Uninstall:
62
+
63
+ ::
64
+
65
+ pip uninstall baseconvert
66
+
67
+ Quickstart
68
+ ----------
69
+
70
+ ::
71
+
72
+ # base(number, input_base, output_base)
73
+
74
+ >>> base((15, 15, 0, ".", 8), 16, 10)
75
+ (4, 0, 8, 0, '.', 5)
76
+
77
+ >>> base("FF0.8", 16, 10, string=True)
78
+ '4080.5'
79
+
80
+ >>> base("4080.5", 10, 16, string=True)
81
+ 'FF0.8'
82
+
83
+ Or from command line
84
+
85
+ ::
86
+
87
+ $ echo 4080.5 | python -m baseconvert -i 10 -o 16
88
+ FF0.8
89
+
90
+ $ python -m baseconvert -n 4080.5 -i 10 -o 16
91
+ FF0.8
92
+
93
+ Tuple representation
94
+ --------------------
95
+
96
+ Numbers are represented as a sequence of digits. Each digit is a base-10
97
+ integer value. The radix point, which separates the integer and
98
+ fractional parts, is denoted by a string period.
99
+
100
+ ::
101
+
102
+ (int, int, int, ... , '.', ... , int, int, int)
103
+ ( integer part , '.', fractional part )
104
+
105
+ String representation
106
+ ---------------------
107
+
108
+ String digits (after z the values are in ascending Unicode):
109
+
110
+ ::
111
+
112
+ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
113
+
114
+ | Value | Representation |
115
+ |---------|----------------|
116
+ | 0 - 9 | 0 - 9 |
117
+ | 10 - 53 | A - Z |
118
+ | 36 - 61 | a - z |
119
+ | 62 + | unicode 123 + |
120
+
121
+ For bases higher than 61 it's recommended to use tuple representation.
122
+
123
+ Examples
124
+ --------
125
+
126
+ ::
127
+
128
+ # base(number, input_base, output_base)
129
+ >>> n = (15,15,".",0,8)
130
+ >>> base(n, 16, 10)
131
+ (2, 5, 5, '.', 0, 3, 1, 2, 5)
132
+ >>> base(n, 16, 10, string=True)
133
+ '255.03125'
134
+
135
+ >>> base("FF.08", 16, 10) == base((15,15,".",0,8), 16, 10)
136
+ True
137
+
138
+ # A callable BaseConverter object can also be created.
139
+ # This is useful for when several numbers need to be converted.
140
+
141
+ >>> b = BaseConverter(input_base=16, output_base=8)
142
+ >>> b("FF")
143
+ (3, 7, 7)
144
+ >>> b((15, 15))
145
+ (3, 7, 7)
146
+ >>> b("FF") == b((15,15))
147
+ True
148
+
149
+ >>> base(0.1, 3, 10, string=True)
150
+ '0.[3]'
151
+
152
+ Recurring digits
153
+ ~~~~~~~~~~~~~~~~
154
+
155
+ Recurring digits at the end of a fractional part will be enclosed by "["
156
+ and "]" in both string and tuple representation. This behavior can be
157
+ turned off by setting the recurring argument of base or BaseConverter
158
+ object to False.
159
+
160
+ ::
161
+
162
+ >>> base("0.1", 3, 10, string=True)
163
+ '0.[3]'
164
+ >>> base("0.1", 3, 10, string=True, recurring=False)
165
+ '0.3333333333'
166
+
167
+ Max fractional depth
168
+ ~~~~~~~~~~~~~~~~~~~~
169
+
170
+ Integer parts are always of arbitrary size. Fractional depth (number of
171
+ digits) can must be specified by setting the max\_depth argument of base
172
+ or a BaseConverter object (default 10).
173
+
174
+ ::
175
+
176
+ >>> base("0.2", 10, 8)
177
+ (0, '.', 1, 4, 6, 3, 1, 4, 6, 3, 1, 4)
178
+ >>> base("0.2", 10, 8, max_depth=1)
179
+ (0, '.', 1)
@@ -1,145 +1,150 @@
1
- baseconvert
2
- ===========
3
-
4
- Convert rational numbers between bases.
5
-
6
- ![](./preview.gif)
7
-
8
- [https://github.com/BreadMakesYouFull/baseconvert](https://github.com/BreadMakesYouFull/baseconvert)
9
-
10
- ## Install
11
-
12
- Requires:
13
- * python 3
14
- * pyside6 for GUI
15
-
16
- ```
17
- # Install from pypi via pip
18
- pip install baseconvert
19
-
20
- # ...or install from source
21
- git clone https://github.com/BreadMakesYouFull/baseconvert
22
- python -m venv venv
23
- # (pyside6 can be removed from setup.py if needed)
24
- ./venv/bin/pip install .
25
-
26
- ```
27
-
28
- ## Run UI
29
-
30
- ```
31
- baseconvert
32
- ```
33
-
34
- ## Python Library
35
-
36
- Convert any rational number, from any positive integer base, to any positive integer base.
37
-
38
- Output numbers as tuple or string.
39
-
40
- - Any rational number
41
- - Arbitrary precision
42
- - Fractions
43
- - Recurring/repeating fractional digits.
44
- - Input numbers as tuple or string or number.
45
- - Output numbers as tuple or string.
46
-
47
- ```
48
- # base(number, input_base, output_base)
49
- >>> base((15, 15, 0, ".", 8), 16, 10)
50
- (4, 0, 8, 0, '.', 5)
51
-
52
- >>> base("FF0.8", 16, 10, string=True)
53
- '4080.5'
54
-
55
- >>> base("4080.5", 10, 16, string=True)
56
- 'FF0.8'
57
- ```
58
-
59
- Or from command line
60
-
61
- $ echo 4080.5 | python -m baseconvert -i 10 -o 16
62
- FF0.8
63
-
64
- $ python -m baseconvert -n 4080.5 -i 10 -o 16
65
- FF0.8
66
-
67
- ### Tuple representation
68
-
69
- Numbers are represented as a sequence of digits.
70
- Each digit is a base-10 integer value.
71
- The radix point, which separates the integer and fractional parts,
72
- is denoted by a string period.
73
-
74
- (int, int, int, ... , '.', ... , int, int, int)
75
- ( integer part , '.', fractional part )
76
-
77
- ### String representation
78
-
79
- String digits (after z the values are in ascending Unicode):
80
-
81
- 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
82
-
83
- | Value | Representation |
84
- |---------|----------------|
85
- | 0 - 9 | 0 - 9 |
86
- | 10 - 35 | A - Z |
87
- | 36 - 61 | a - z |
88
- | 62 + | unicode 123 + |
89
-
90
- For higher bases it's recommended to use tuple representation.
91
-
92
- ### Examples
93
-
94
- # base(number, input_base, output_base)
95
- >>> n = (15,15,".",0,8)
96
- >>> base(n, 16, 10)
97
- (2, 5, 5, '.', 0, 3, 1, 2, 5)
98
- >>> base(n, 16, 10, string=True)
99
- '255.03125'
100
-
101
- >>> base("FF.08", 16, 10) == base((15,15,".",0,8), 16, 10)
102
- True
103
-
104
- # A callable BaseConverter object can also be created.
105
- # This is useful for when several numbers need to be converted.
106
-
107
- >>> b = BaseConverter(input_base=16, output_base=8)
108
- >>> b("FF")
109
- (3, 7, 7)
110
- >>> b((15, 15))
111
- (3, 7, 7)
112
- >>> b("FF") == b((15,15))
113
- True
114
-
115
- >>> base(0.1, 3, 10, string=True)
116
- '0.[3]'
117
-
118
- ### Recurring digits
119
-
120
- Recurring digits at the end of a fractional part will be enclosed by
121
- "[" and "]" in both string and tuple representation.
122
- This behavior can be turned off by setting the recurring argument of base or
123
- BaseConverter object to False.
124
-
125
- >>> base("0.1", 3, 10, string=True)
126
- '0.[3]'
127
- >>> base("0.1", 3, 10, string=True, recurring=False)
128
- '0.3333333333'
129
-
130
- ### Max fractional depth
131
-
132
- Integer parts are always of arbitrary size.
133
- Fractional depth (number of digits) can must be specified by setting the
134
- max_depth argument of base or a BaseConverter object (default 10).
135
-
136
- >>> base("0.2", 10, 8)
137
- (0, '.', 1, 4, 6, 3, 1, 4, 6, 3, 1, 4)
138
- >>> base("0.2", 10, 8, max_depth=1)
139
- (0, '.', 1)
140
-
141
- ### Exact...ish
142
-
143
- You can also set ``max_depth=0`` or use the flag ``exact=True``, which are equivalent. These "Exact" results will be only precise only up to the value of ``baseconvert.baseconvert.MAX_DEPTH`` which you may also override, but is limited by default for speed.
144
-
145
- This is only relevant for fractional numbers, integer values should always be accurate.
1
+ baseconvert
2
+ ===========
3
+
4
+ Convert rational numbers between bases.
5
+
6
+ ![](./preview.gif)
7
+
8
+ [https://github.com/BreadMakesYouFull/baseconvert](https://github.com/BreadMakesYouFull/baseconvert)
9
+
10
+ ## Install
11
+
12
+ Requires:
13
+ * python 3
14
+ * pyside6 for GUI
15
+
16
+ ```
17
+ # Install from pypi via pip
18
+ # Without GUI:
19
+ pip install baseconvert
20
+ # With GUI:
21
+ pip install baseconvert[gui]
22
+
23
+ # ...or install from source
24
+ git clone https://github.com/BreadMakesYouFull/baseconvert
25
+ python -m venv venv
26
+ # With GUI
27
+ ./venv/bin/pip install .[gui]
28
+ # Without GUI
29
+ ./venv/bin/pip install .
30
+
31
+ ```
32
+
33
+ ## Run UI
34
+
35
+ ```
36
+ baseconvert
37
+ ```
38
+
39
+ ## Python Library
40
+
41
+ Convert any rational number, from any positive integer base, to any positive integer base.
42
+
43
+ Output numbers as tuple or string.
44
+
45
+ - Any rational number
46
+ - Arbitrary precision
47
+ - Fractions
48
+ - Recurring/repeating fractional digits.
49
+ - Input numbers as tuple or string or number.
50
+ - Output numbers as tuple or string.
51
+
52
+ ```
53
+ # base(number, input_base, output_base)
54
+ >>> base((15, 15, 0, ".", 8), 16, 10)
55
+ (4, 0, 8, 0, '.', 5)
56
+
57
+ >>> base("FF0.8", 16, 10, string=True)
58
+ '4080.5'
59
+
60
+ >>> base("4080.5", 10, 16, string=True)
61
+ 'FF0.8'
62
+ ```
63
+
64
+ Or from command line
65
+
66
+ $ echo 4080.5 | python -m baseconvert -i 10 -o 16
67
+ FF0.8
68
+
69
+ $ python -m baseconvert -n 4080.5 -i 10 -o 16
70
+ FF0.8
71
+
72
+ ### Tuple representation
73
+
74
+ Numbers are represented as a sequence of digits.
75
+ Each digit is a base-10 integer value.
76
+ The radix point, which separates the integer and fractional parts,
77
+ is denoted by a string period.
78
+
79
+ (int, int, int, ... , '.', ... , int, int, int)
80
+ ( integer part , '.', fractional part )
81
+
82
+ ### String representation
83
+
84
+ String digits (after z the values are in ascending Unicode):
85
+
86
+ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
87
+
88
+ | Value | Representation |
89
+ |---------|----------------|
90
+ | 0 - 9 | 0 - 9 |
91
+ | 10 - 35 | A - Z |
92
+ | 36 - 61 | a - z |
93
+ | 62 + | unicode 123 + |
94
+
95
+ For higher bases it's recommended to use tuple representation.
96
+
97
+ ### Examples
98
+
99
+ # base(number, input_base, output_base)
100
+ >>> n = (15,15,".",0,8)
101
+ >>> base(n, 16, 10)
102
+ (2, 5, 5, '.', 0, 3, 1, 2, 5)
103
+ >>> base(n, 16, 10, string=True)
104
+ '255.03125'
105
+
106
+ >>> base("FF.08", 16, 10) == base((15,15,".",0,8), 16, 10)
107
+ True
108
+
109
+ # A callable BaseConverter object can also be created.
110
+ # This is useful for when several numbers need to be converted.
111
+
112
+ >>> b = BaseConverter(input_base=16, output_base=8)
113
+ >>> b("FF")
114
+ (3, 7, 7)
115
+ >>> b((15, 15))
116
+ (3, 7, 7)
117
+ >>> b("FF") == b((15,15))
118
+ True
119
+
120
+ >>> base(0.1, 3, 10, string=True)
121
+ '0.[3]'
122
+
123
+ ### Recurring digits
124
+
125
+ Recurring digits at the end of a fractional part will be enclosed by
126
+ "[" and "]" in both string and tuple representation.
127
+ This behavior can be turned off by setting the recurring argument of base or
128
+ BaseConverter object to False.
129
+
130
+ >>> base("0.1", 3, 10, string=True)
131
+ '0.[3]'
132
+ >>> base("0.1", 3, 10, string=True, recurring=False)
133
+ '0.3333333333'
134
+
135
+ ### Max fractional depth
136
+
137
+ Integer parts are always of arbitrary size.
138
+ Fractional depth (number of digits) can must be specified by setting the
139
+ max_depth argument of base or a BaseConverter object (default 10).
140
+
141
+ >>> base("0.2", 10, 8)
142
+ (0, '.', 1, 4, 6, 3, 1, 4, 6, 3, 1, 4)
143
+ >>> base("0.2", 10, 8, max_depth=1)
144
+ (0, '.', 1)
145
+
146
+ ### Exact...ish
147
+
148
+ You can also set ``max_depth=0`` or use the flag ``exact=True``, which are equivalent. These "Exact" results will be only precise only up to the value of ``baseconvert.baseconvert.MAX_DEPTH`` which you may also override, but is limited by default for speed.
149
+
150
+ This is only relevant for fractional numbers, integer values should always be accurate.