basebender 0.2.1__py3-none-any.whl
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.
- basebender/STRUCTURE.md +13 -0
- basebender/__init__.py +8 -0
- basebender/api/STRUCTURE.md +7 -0
- basebender/api/main.py +249 -0
- basebender/cli.py +231 -0
- basebender/gui/STRUCTURE.md +8 -0
- basebender/gui/__init__.py +3 -0
- basebender/gui/main_window.py +546 -0
- basebender/rebaser/STRUCTURE.md +16 -0
- basebender/rebaser/__init__.py +4 -0
- basebender/rebaser/config_loader.py +269 -0
- basebender/rebaser/digit_set_rebaser.py +303 -0
- basebender/rebaser/digit_sets.py +84 -0
- basebender/rebaser/generated/STRUCTURE.md +10 -0
- basebender/rebaser/generated/__init__.py +0 -0
- basebender/rebaser/generated/app_resources_rc.py +204 -0
- basebender/rebaser/models.py +38 -0
- basebender/rebaser/resources/STRUCTURE.md +12 -0
- basebender/rebaser/resources/app_resources.qrc +8 -0
- basebender/rebaser/resources/data/STRUCTURE.md +7 -0
- basebender/rebaser/resources/data/default_digit_sets.toml +27 -0
- basebender/rebaser/resources/icons/STRUCTURE.md +10 -0
- basebender/rebaser/resources/icons/input.svg +5 -0
- basebender/rebaser/resources/icons/output.svg +4 -0
- basebender/rebaser/resources/icons/source.svg +5 -0
- basebender/rebaser/resources/icons/target.svg +5 -0
- basebender-0.2.1.dist-info/METADATA +174 -0
- basebender-0.2.1.dist-info/RECORD +31 -0
- basebender-0.2.1.dist-info/WHEEL +4 -0
- basebender-0.2.1.dist-info/entry_points.txt +4 -0
- basebender-0.2.1.dist-info/licenses/LICENSE +9 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Resource object code (Python 3)
|
|
2
|
+
# Created by: object code
|
|
3
|
+
# Created by: The Resource Compiler for Qt version 6.11.1
|
|
4
|
+
# WARNING! All changes made in this file will be lost!
|
|
5
|
+
|
|
6
|
+
from PySide6 import QtCore
|
|
7
|
+
|
|
8
|
+
qt_resource_data = b"\
|
|
9
|
+
\x00\x00\x02\x98\
|
|
10
|
+
<\
|
|
11
|
+
svg width=\x2224\x22 h\
|
|
12
|
+
eight=\x2224\x22 viewB\
|
|
13
|
+
ox=\x220 0 24 24\x22 f\
|
|
14
|
+
ill=\x22none\x22 xmlns\
|
|
15
|
+
=\x22http://www.w3.\
|
|
16
|
+
org/2000/svg\x22>\x0a<\
|
|
17
|
+
path d=\x22M12 22C1\
|
|
18
|
+
7.5228 22 22 17.\
|
|
19
|
+
5228 22 12C22 6.\
|
|
20
|
+
47715 17.5228 2 \
|
|
21
|
+
12 2C6.47715 2 2\
|
|
22
|
+
6.47715 2 12C2 \
|
|
23
|
+
17.5228 6.47715 \
|
|
24
|
+
22 12 22Z\x22 strok\
|
|
25
|
+
e=\x22#333333\x22 stro\
|
|
26
|
+
ke-width=\x222\x22 str\
|
|
27
|
+
oke-linecap=\x22rou\
|
|
28
|
+
nd\x22 stroke-linej\
|
|
29
|
+
oin=\x22round\x22/>\x0a<p\
|
|
30
|
+
ath d=\x22M12 17C14\
|
|
31
|
+
.7614 17 17 14.7\
|
|
32
|
+
614 17 12C17 9.2\
|
|
33
|
+
3858 14.7614 7 1\
|
|
34
|
+
2 7C9.23858 7 7 \
|
|
35
|
+
9.23858 7 12C7 1\
|
|
36
|
+
4.7614 9.23858 1\
|
|
37
|
+
7 12 17Z\x22 stroke\
|
|
38
|
+
=\x22#333333\x22 strok\
|
|
39
|
+
e-width=\x222\x22 stro\
|
|
40
|
+
ke-linecap=\x22roun\
|
|
41
|
+
d\x22 stroke-linejo\
|
|
42
|
+
in=\x22round\x22/>\x0a<pa\
|
|
43
|
+
th d=\x22M12 14C13.\
|
|
44
|
+
1046 14 14 13.10\
|
|
45
|
+
46 14 12C14 10.8\
|
|
46
|
+
954 13.1046 10 1\
|
|
47
|
+
2 10C10.8954 10 \
|
|
48
|
+
10 10.8954 10 12\
|
|
49
|
+
C10 13.1046 10.8\
|
|
50
|
+
954 14 12 14Z\x22 f\
|
|
51
|
+
ill=\x22#333333\x22/>\x0a\
|
|
52
|
+
</svg>\x0a\
|
|
53
|
+
\x00\x00\x02\x09\
|
|
54
|
+
<\
|
|
55
|
+
svg width=\x2224\x22 h\
|
|
56
|
+
eight=\x2224\x22 viewB\
|
|
57
|
+
ox=\x220 0 24 24\x22 f\
|
|
58
|
+
ill=\x22none\x22 xmlns\
|
|
59
|
+
=\x22http://www.w3.\
|
|
60
|
+
org/2000/svg\x22>\x0a<\
|
|
61
|
+
path d=\x22M19 4H5C\
|
|
62
|
+
3.89543 4 3 4.89\
|
|
63
|
+
543 3 6V18C3 19.\
|
|
64
|
+
1046 3.89543 20 \
|
|
65
|
+
5 20H19C20.1046 \
|
|
66
|
+
20 21 19.1046 21\
|
|
67
|
+
18V6C21 4.89543\
|
|
68
|
+
20.1046 4 19 4Z\
|
|
69
|
+
\x22 stroke=\x22#33333\
|
|
70
|
+
3\x22 stroke-width=\
|
|
71
|
+
\x222\x22 stroke-linec\
|
|
72
|
+
ap=\x22round\x22 strok\
|
|
73
|
+
e-linejoin=\x22roun\
|
|
74
|
+
d\x22/>\x0a<path d=\x22M9\
|
|
75
|
+
10H15\x22 stroke=\x22\
|
|
76
|
+
#333333\x22 stroke-\
|
|
77
|
+
width=\x222\x22 stroke\
|
|
78
|
+
-linecap=\x22round\x22\
|
|
79
|
+
stroke-linejoin\
|
|
80
|
+
=\x22round\x22/>\x0a<path\
|
|
81
|
+
d=\x22M9 14H15\x22 st\
|
|
82
|
+
roke=\x22#333333\x22 s\
|
|
83
|
+
troke-width=\x222\x22 \
|
|
84
|
+
stroke-linecap=\x22\
|
|
85
|
+
round\x22 stroke-li\
|
|
86
|
+
nejoin=\x22round\x22/>\
|
|
87
|
+
\x0a</svg>\x0a\
|
|
88
|
+
\x00\x00\x01\xa5\
|
|
89
|
+
<\
|
|
90
|
+
svg width=\x2224\x22 h\
|
|
91
|
+
eight=\x2224\x22 viewB\
|
|
92
|
+
ox=\x220 0 24 24\x22 f\
|
|
93
|
+
ill=\x22none\x22 xmlns\
|
|
94
|
+
=\x22http://www.w3.\
|
|
95
|
+
org/2000/svg\x22>\x0a<\
|
|
96
|
+
path d=\x22M9 12L11\
|
|
97
|
+
14L15 10\x22 strok\
|
|
98
|
+
e=\x22#333333\x22 stro\
|
|
99
|
+
ke-width=\x222\x22 str\
|
|
100
|
+
oke-linecap=\x22rou\
|
|
101
|
+
nd\x22 stroke-linej\
|
|
102
|
+
oin=\x22round\x22/>\x0a<p\
|
|
103
|
+
ath d=\x22M12 22C17\
|
|
104
|
+
.5228 22 22 17.5\
|
|
105
|
+
228 22 12C22 6.4\
|
|
106
|
+
7715 17.5228 2 1\
|
|
107
|
+
2 2C6.47715 2 2 \
|
|
108
|
+
6.47715 2 12C2 1\
|
|
109
|
+
7.5228 6.47715 2\
|
|
110
|
+
2 12 22Z\x22 stroke\
|
|
111
|
+
=\x22#333333\x22 strok\
|
|
112
|
+
e-width=\x222\x22 stro\
|
|
113
|
+
ke-linecap=\x22roun\
|
|
114
|
+
d\x22 stroke-linejo\
|
|
115
|
+
in=\x22round\x22/>\x0a</s\
|
|
116
|
+
vg>\x0a\
|
|
117
|
+
\x00\x00\x02\x02\
|
|
118
|
+
<\
|
|
119
|
+
svg width=\x2224\x22 h\
|
|
120
|
+
eight=\x2224\x22 viewB\
|
|
121
|
+
ox=\x220 0 24 24\x22 f\
|
|
122
|
+
ill=\x22none\x22 xmlns\
|
|
123
|
+
=\x22http://www.w3.\
|
|
124
|
+
org/2000/svg\x22>\x0a<\
|
|
125
|
+
path d=\x22M12 22C1\
|
|
126
|
+
7.5228 22 22 17.\
|
|
127
|
+
5228 22 12C22 6.\
|
|
128
|
+
47715 17.5228 2 \
|
|
129
|
+
12 2C6.47715 2 2\
|
|
130
|
+
6.47715 2 12C2 \
|
|
131
|
+
17.5228 6.47715 \
|
|
132
|
+
22 12 22Z\x22 strok\
|
|
133
|
+
e=\x22#333333\x22 stro\
|
|
134
|
+
ke-width=\x222\x22 str\
|
|
135
|
+
oke-linecap=\x22rou\
|
|
136
|
+
nd\x22 stroke-linej\
|
|
137
|
+
oin=\x22round\x22/>\x0a<p\
|
|
138
|
+
ath d=\x22M8 12H16\x22\
|
|
139
|
+
stroke=\x22#333333\
|
|
140
|
+
\x22 stroke-width=\x22\
|
|
141
|
+
2\x22 stroke-lineca\
|
|
142
|
+
p=\x22round\x22 stroke\
|
|
143
|
+
-linejoin=\x22round\
|
|
144
|
+
\x22/>\x0a<path d=\x22M12\
|
|
145
|
+
8V16\x22 stroke=\x22#\
|
|
146
|
+
333333\x22 stroke-w\
|
|
147
|
+
idth=\x222\x22 stroke-\
|
|
148
|
+
linecap=\x22round\x22 \
|
|
149
|
+
stroke-linejoin=\
|
|
150
|
+
\x22round\x22/>\x0a</svg>\
|
|
151
|
+
\x0a\
|
|
152
|
+
"
|
|
153
|
+
|
|
154
|
+
qt_resource_name = b"\
|
|
155
|
+
\x00\x03\
|
|
156
|
+
\x00\x00hp\
|
|
157
|
+
\x00a\
|
|
158
|
+
\x00p\x00p\
|
|
159
|
+
\x00\x05\
|
|
160
|
+
\x00o\xa6S\
|
|
161
|
+
\x00i\
|
|
162
|
+
\x00c\x00o\x00n\x00s\
|
|
163
|
+
\x00\x0a\
|
|
164
|
+
\x0d\xc8\x0b\xc7\
|
|
165
|
+
\x00t\
|
|
166
|
+
\x00a\x00r\x00g\x00e\x00t\x00.\x00s\x00v\x00g\
|
|
167
|
+
\x00\x09\
|
|
168
|
+
\x07\xc7\xbag\
|
|
169
|
+
\x00i\
|
|
170
|
+
\x00n\x00p\x00u\x00t\x00.\x00s\x00v\x00g\
|
|
171
|
+
\x00\x0a\
|
|
172
|
+
\x07\xc9\x83\xa7\
|
|
173
|
+
\x00o\
|
|
174
|
+
\x00u\x00t\x00p\x00u\x00t\x00.\x00s\x00v\x00g\
|
|
175
|
+
\x00\x0a\
|
|
176
|
+
\x08\x9b\x17G\
|
|
177
|
+
\x00s\
|
|
178
|
+
\x00o\x00u\x00r\x00c\x00e\x00.\x00s\x00v\x00g\
|
|
179
|
+
"
|
|
180
|
+
|
|
181
|
+
qt_resource_struct = b"\
|
|
182
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
|
183
|
+
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
184
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
|
185
|
+
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
186
|
+
\x00\x00\x00\x0c\x00\x02\x00\x00\x00\x04\x00\x00\x00\x03\
|
|
187
|
+
\x00\x00\x00\x00\x00\x00\x00\x00\
|
|
188
|
+
\x00\x00\x006\x00\x00\x00\x00\x00\x01\x00\x00\x02\x9c\
|
|
189
|
+
\x00\x00\x01\x9e\xd1H\x0c\xcd\
|
|
190
|
+
\x00\x00\x00N\x00\x00\x00\x00\x00\x01\x00\x00\x04\xa9\
|
|
191
|
+
\x00\x00\x01\x9e\xd1H\x0c\xcd\
|
|
192
|
+
\x00\x00\x00h\x00\x00\x00\x00\x00\x01\x00\x00\x06R\
|
|
193
|
+
\x00\x00\x01\x9e\xd1H\x0c\xcd\
|
|
194
|
+
\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
|
195
|
+
\x00\x00\x01\x9e\xd1H\x0c\xcd\
|
|
196
|
+
"
|
|
197
|
+
|
|
198
|
+
def qInitResources():
|
|
199
|
+
QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
|
200
|
+
|
|
201
|
+
def qCleanupResources():
|
|
202
|
+
QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
|
|
203
|
+
|
|
204
|
+
qInitResources()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module defines data models used across the BaseBender application.
|
|
3
|
+
|
|
4
|
+
It includes the `DigitSet` dataclass, which represents a set of characters
|
|
5
|
+
used in a positional number system, along with its name and source.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class DigitSet:
|
|
13
|
+
"""
|
|
14
|
+
Represents a digit set used in a positional number system.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
name (str): The human-readable name of the digit set (e.g., "Binary",
|
|
18
|
+
"Decimal").
|
|
19
|
+
digits (str): The string containing all unique characters that form the
|
|
20
|
+
digit set, ordered by their value (e.g., "01" for binary,
|
|
21
|
+
"0123456789" for decimal).
|
|
22
|
+
source (str): The origin of the digit set (e.g., "package", "system",
|
|
23
|
+
"user", "cli_input", "gui_input").
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
name: str
|
|
27
|
+
digits: str
|
|
28
|
+
source: str
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def deduplicate_digits(digits: str) -> str:
|
|
32
|
+
"""Removes duplicate characters while preserving order of first appearance."""
|
|
33
|
+
return "".join(dict.fromkeys(digits))
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def sorted_digits(digits: str) -> str:
|
|
37
|
+
"""Sorts characters alphabetically."""
|
|
38
|
+
return "".join(sorted(digits))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# `src/rebaser/resources/` Directory Structure
|
|
2
|
+
|
|
3
|
+
This directory contains resources such as data files and icons used by the rebaser module.
|
|
4
|
+
|
|
5
|
+
## Folders:
|
|
6
|
+
|
|
7
|
+
* [`data/`](src/rebaser/resources/data/STRUCTURE.md): Contains default data files, such as pre-defined digit sets.
|
|
8
|
+
* [`icons/`](src/rebaser/resources/icons/STRUCTURE.md): Contains SVG icon files used in the GUI.
|
|
9
|
+
|
|
10
|
+
## Files:
|
|
11
|
+
|
|
12
|
+
* [`app_resources.qrc`](src/rebaser/resources/app_resources.qrc): Qt Resource Collection file, listing resources embedded in the application.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# `src/rebaser/resources/data/` Directory Structure
|
|
2
|
+
|
|
3
|
+
This directory contains default data files, such as pre-defined digit sets.
|
|
4
|
+
|
|
5
|
+
## Files:
|
|
6
|
+
|
|
7
|
+
* [`default_digit_sets.toml`](src/rebaser/resources/data/default_digit_sets.toml): Default pre-defined digit sets in TOML format.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[[digit_sets]]
|
|
2
|
+
name = "Binary"
|
|
3
|
+
digits = "01"
|
|
4
|
+
|
|
5
|
+
[[digit_sets]]
|
|
6
|
+
name = "Octal"
|
|
7
|
+
digits = "01234567"
|
|
8
|
+
|
|
9
|
+
[[digit_sets]]
|
|
10
|
+
name = "Decimal"
|
|
11
|
+
digits = "0123456789"
|
|
12
|
+
|
|
13
|
+
[[digit_sets]]
|
|
14
|
+
name = "Hexadecimal"
|
|
15
|
+
digits = "0123456789ABCDEF"
|
|
16
|
+
|
|
17
|
+
[[digit_sets]]
|
|
18
|
+
name = "Base64"
|
|
19
|
+
digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
|
20
|
+
|
|
21
|
+
[[digit_sets]]
|
|
22
|
+
name = "ASCII Printable"
|
|
23
|
+
digits = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
|
24
|
+
|
|
25
|
+
[[digit_sets]]
|
|
26
|
+
name = "Clock Emojis"
|
|
27
|
+
digits = "🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜🕝🕞🕟🕠🕡🕢🕣🕤🕥🕦🕧"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# `src/rebaser/resources/icons/` Directory Structure
|
|
2
|
+
|
|
3
|
+
This directory contains SVG icon files used in the GUI.
|
|
4
|
+
|
|
5
|
+
## Files:
|
|
6
|
+
|
|
7
|
+
* [`input.svg`](src/rebaser/resources/icons/input.svg): Icon representing input.
|
|
8
|
+
* [`output.svg`](src/rebaser/resources/icons/output.svg): Icon representing output.
|
|
9
|
+
* [`source.svg`](src/rebaser/resources/icons/source.svg): Icon representing the source digit set.
|
|
10
|
+
* [`target.svg`](src/rebaser/resources/icons/target.svg): Icon representing the target digit set.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M19 4H5C3.89543 4 3 4.89543 3 6V18C3 19.1046 3.89543 20 5 20H19C20.1046 20 21 19.1046 21 18V6C21 4.89543 20.1046 4 19 4Z" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M9 10H15" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M9 14H15" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9 12L11 14L15 10" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M8 12H16" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M12 8V16" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M12 17C14.7614 17 17 14.7614 17 12C17 9.23858 14.7614 7 12 7C9.23858 7 7 9.23858 7 12C7 14.7614 9.23858 17 12 17Z" stroke="#333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14Z" fill="#333333"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: basebender
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: A Python module for rebaseing strings between different digit sets (positional number systems).
|
|
5
|
+
Project-URL: Homepage, https://github.com/meXc/BaseBender
|
|
6
|
+
Project-URL: Repository, https://github.com/meXc/BaseBender.git
|
|
7
|
+
Project-URL: Issues, https://github.com/meXc/BaseBender/issues
|
|
8
|
+
Author: by.a.mexc@gmail.com
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright 2025 @mexc
|
|
12
|
+
|
|
13
|
+
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:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Python: <3.15,>=3.14
|
|
20
|
+
Requires-Dist: fastapi<1.0.0,>=0.115.12
|
|
21
|
+
Requires-Dist: platformdirs<5.0.0,>=4.2.0
|
|
22
|
+
Requires-Dist: pyside6<7.0.0,>=6.9.0
|
|
23
|
+
Requires-Dist: toml<0.11.0,>=0.10.2
|
|
24
|
+
Requires-Dist: uvicorn<1.0.0,>=0.34.3
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# BaseBender
|
|
28
|
+
|
|
29
|
+
[](https://github.com/meXc/BaseBender/actions/workflows/ci.yaml)
|
|
30
|
+
[](https://pypi.org/project/basebender/)
|
|
31
|
+
[](https://pypi.org/project/basebender/)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
|
|
34
|
+
This project provides a Python module for rebaseing strings between different digit sets (positional number systems). It also includes a command-line interface (CLI) for easy usage.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
## Project Goal
|
|
39
|
+
|
|
40
|
+
The primary goal is to provide a flexible and efficient tool for rebaseing numbers between different digit sets.
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
* **Flexible Digit Set Definition**: Define source and target digit sets using simple strings, supporting rebaseing between standard and non-standard positional number systems (e.g., different Unicode symbol sets of varying lengths).
|
|
45
|
+
* **Tiered Configuration for Digit Sets**: Load pre-defined digit sets from package, system, and user-specific TOML configuration files, allowing for easy extension and customization.
|
|
46
|
+
* **Intelligent Digit Set Discovery**: Suggests relevant pre-defined digit sets based on the input string's content, enhancing usability for the GUI.
|
|
47
|
+
* **Dynamic Input Digit Set**: Automatically derives the input digit set from the input string if not explicitly provided. In the GUI, selecting "Derived from Input" from the preset dropdown will populate the input digit set field with the currently derived digit set. When the input digit set field is empty and the input string is not empty, its placeholder text will dynamically display the derived digit set from the input string, along with a visual cue. If both the input string and input digit set field are empty, the default placeholder text will be shown.
|
|
48
|
+
* **Efficient Rebaseing**: Utilizes bit-packing to minimize space during intermediate rebase.
|
|
49
|
+
* **Enhanced Error Handling**: Provides clear and informative error messages across CLI, API, and GUI, with structured error responses for the API.
|
|
50
|
+
* **Command-Line Interface (CLI)**: Rebase strings directly from the terminal with improved help text and error reporting.
|
|
51
|
+
* **Graphical User Interface (GUI)**: An intuitive interface for rebaseing, featuring digit set manipulation, tooltips, and a clear status bar for error messages.
|
|
52
|
+
* **Flexible Rebase Behavior**: Handles empty input strings, empty output digit sets, and single-character output digit sets gracefully.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Prerequisites
|
|
57
|
+
|
|
58
|
+
- Python 3.13+
|
|
59
|
+
- [uv](https://docs.astral.sh/uv/) (fast Python package manager)
|
|
60
|
+
|
|
61
|
+
### Setup
|
|
62
|
+
|
|
63
|
+
1. **Clone the repository**:
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/mexc/base-bender.git
|
|
66
|
+
cd base-bender
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Install dependencies using uv**:
|
|
70
|
+
```bash
|
|
71
|
+
uv sync
|
|
72
|
+
```
|
|
73
|
+
This will create a virtual environment and install all project dependencies.
|
|
74
|
+
|
|
75
|
+
3. **Generate GUI resource files**:
|
|
76
|
+
```bash
|
|
77
|
+
uv run bin/generate_resources.py
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Running the Application
|
|
81
|
+
|
|
82
|
+
This project provides several entry points for different interfaces: a command-line interface (CLI), a graphical user interface (GUI), and a web API. You can run them using uv:
|
|
83
|
+
|
|
84
|
+
* **Command-Line Interface (CLI)**:
|
|
85
|
+
```bash
|
|
86
|
+
uv run basebender --help
|
|
87
|
+
```
|
|
88
|
+
This will display the help message for the CLI. For detailed usage examples, refer to [CLI Examples](docs/cli_examples.md).
|
|
89
|
+
|
|
90
|
+
* **Graphical User Interface (GUI)**:
|
|
91
|
+
```bash
|
|
92
|
+
uv run basebender-gui
|
|
93
|
+
```
|
|
94
|
+
This will launch the desktop application.
|
|
95
|
+
|
|
96
|
+
* **Web API**:
|
|
97
|
+
```bash
|
|
98
|
+
uv run basebender-api
|
|
99
|
+
```
|
|
100
|
+
This will start the FastAPI server, typically accessible at `http://127.0.0.1:8000`. For detailed API usage examples, refer to [API Examples](docs/api_examples.md).
|
|
101
|
+
|
|
102
|
+
## Configuration
|
|
103
|
+
|
|
104
|
+
The BaseBender supports loading pre-defined digit sets from tiered TOML configuration files. This allows for a flexible and extensible way to manage common digit sets.
|
|
105
|
+
|
|
106
|
+
### Configuration File Locations (in order of precedence: User > System > Package)
|
|
107
|
+
|
|
108
|
+
* **Package Configuration**:
|
|
109
|
+
* Location: `rebaser/resources/data/default_digit_sets.toml` within the installed package.
|
|
110
|
+
* Purpose: Contains a comprehensive set of standard, built-in digit sets (e.g., Binary, Decimal, Hexadecimal, Base64, ASCII Printable).
|
|
111
|
+
* Example content:
|
|
112
|
+
```toml
|
|
113
|
+
[[digit_sets]]
|
|
114
|
+
name = "Binary"
|
|
115
|
+
digits = "01"
|
|
116
|
+
|
|
117
|
+
[[digit_sets]]
|
|
118
|
+
name = "Decimal"
|
|
119
|
+
digits = "0123456789"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
* **System Configuration**:
|
|
123
|
+
* Location (Linux/macOS): `/etc/digit_set_rebaser/digit_sets.toml`
|
|
124
|
+
* Location (Windows): `%PROGRAMDATA%\digit_set_rebaser\digit_sets.toml`
|
|
125
|
+
* Purpose: Allows system administrators to define digit sets available to all users on the system.
|
|
126
|
+
|
|
127
|
+
* **User Configuration**:
|
|
128
|
+
* Location (Linux/macOS): `~/.config/digit_set_rebaser/digit_sets.toml`
|
|
129
|
+
* Location (Windows): `%APPDATA%\digit_set_rebaser\digit_sets.toml`
|
|
130
|
+
* Purpose: Allows individual users to define their own custom digit sets or override system/package defaults.
|
|
131
|
+
|
|
132
|
+
### Adding Custom Digit Sets
|
|
133
|
+
|
|
134
|
+
To add your own custom digit sets, create or edit the `digit_sets.toml` file in your user configuration directory (or system directory for system-wide availability). Follow the TOML format shown in the example above. Digit sets defined in higher precedence tiers will override those with the same `name` in lower tiers.
|
|
135
|
+
|
|
136
|
+
## Usage
|
|
137
|
+
|
|
138
|
+
For detailed CLI usage examples, refer to [CLI Examples](docs/cli_examples.md).
|
|
139
|
+
For detailed API usage examples, refer to [API Examples](docs/api_examples.md).
|
|
140
|
+
|
|
141
|
+
## Running Tests
|
|
142
|
+
|
|
143
|
+
To run the unit tests, use uv:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
uv run pytest
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Project Structure
|
|
150
|
+
|
|
151
|
+
This project is organized into several key directories and files at the root level. For detailed descriptions of files within subdirectories, please refer to their respective `STRUCTURE.md` files:
|
|
152
|
+
|
|
153
|
+
* [bin/](bin/STRUCTURE.md) - Contains utility scripts for project setup and updates.
|
|
154
|
+
* [docs/](docs/STRUCTURE.md) - Houses documentation files, including API and CLI usage examples.
|
|
155
|
+
* [src/](src/STRUCTURE.md) - Contains the core source code for the application, including API, CLI, GUI, and rebaser logic.
|
|
156
|
+
* [tests/](tests/STRUCTURE.md) - Holds unit tests for the project's modules.
|
|
157
|
+
|
|
158
|
+
### Root Level Files:
|
|
159
|
+
|
|
160
|
+
* `.gitattributes`: Configures Git attributes for various paths.
|
|
161
|
+
* `.gitignore`: Specifies intentionally untracked files to ignore.
|
|
162
|
+
* `.pre-commit-config.yaml`: Configuration for pre-commit hooks to enforce code quality.
|
|
163
|
+
* `CONTRIBUTING.md`: Guidelines for contributing to the project.
|
|
164
|
+
* `LICENSE`: The project's license file (MIT License).
|
|
165
|
+
* `README.md`: The main project README, providing an overview and entry point.
|
|
166
|
+
* `pyproject.toml`: Project metadata and dependencies managed by uv.
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
Contributions are welcome! Please refer to the [Contribution Guidelines](CONTRIBUTING.md) for more details.
|
|
171
|
+
|
|
172
|
+
## License
|
|
173
|
+
|
|
174
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
basebender/STRUCTURE.md,sha256=NreucZj0kCNqZ-vpiyqQ7q6tnQ-OV2mlTfQwE7rNSpc,483
|
|
2
|
+
basebender/__init__.py,sha256=_4W_nlu880gcYl5RJYHTpOLzRMKCQ4kjNkhTKYkORf4,320
|
|
3
|
+
basebender/cli.py,sha256=fMXB9prwcb9uTYmBoNDX9FDxSqiWPKDJNg_a1RjNeu8,7470
|
|
4
|
+
basebender/api/STRUCTURE.md,sha256=AZnfA8MJayVLsWUQSxaU5Xmjq6Sh4npVJeIhtSPGkEY,201
|
|
5
|
+
basebender/api/main.py,sha256=HYRLWuf0qnxrfTMLuFUjEntSbPzI9tAhMbjrruZ2XaQ,8701
|
|
6
|
+
basebender/gui/STRUCTURE.md,sha256=g2cjTaIwBNzt_s5Q3rJU7WWcYYICaquG5wYcy3rgfuU,280
|
|
7
|
+
basebender/gui/__init__.py,sha256=ZwzstGPTqzhD42K3eVvYIIeAT2fV_reXv2bTgxdQ95Y,84
|
|
8
|
+
basebender/gui/main_window.py,sha256=6eS6j0ugcv-ooNDXjk5cVzfHNjggyxKEsNvkPM2CF54,22823
|
|
9
|
+
basebender/rebaser/STRUCTURE.md,sha256=n6OZSV4sYeshan0yp47n1zgkfRb5YXZnU9Fdo0QAl98,825
|
|
10
|
+
basebender/rebaser/__init__.py,sha256=S4hnbIbL4iqb8_iHRW57_P55kXLaDrZ2oGbwN6GWiOE,162
|
|
11
|
+
basebender/rebaser/config_loader.py,sha256=ZYYyGzAUB39-km3xgCbSh69huBrYGP2pJ81SFJdoM7k,10015
|
|
12
|
+
basebender/rebaser/digit_set_rebaser.py,sha256=M4qI-pK-huTOCNiTgM9JQvIuVmzg8YLcrAU9pyxd8as,11051
|
|
13
|
+
basebender/rebaser/digit_sets.py,sha256=bfXc7wwU9QKBskocnebkCpV3QDdjL4XgClbIRhRnk6s,3050
|
|
14
|
+
basebender/rebaser/models.py,sha256=_eyWTmRqugOLk9SzwJI2SC-RN8FjrFdyTAYxrI7StAo,1246
|
|
15
|
+
basebender/rebaser/generated/STRUCTURE.md,sha256=OBLvdTx_LDFS9MBVYU0oR8W-nXcL-WxuiWB075DWo7M,285
|
|
16
|
+
basebender/rebaser/generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
+
basebender/rebaser/generated/app_resources_rc.py,sha256=Coq0m81_Pz4ha_Oicg9RuAjmkGDoRZMaJ5mLY--mdnU,4528
|
|
18
|
+
basebender/rebaser/resources/STRUCTURE.md,sha256=FMX_qUI0A_EaOsCc4pDFa4mfuEtuUxmz6_WLevJRJ-E,525
|
|
19
|
+
basebender/rebaser/resources/app_resources.qrc,sha256=QY7HjfqzjXctOy-O02aCNfAP3TteAmpDLaUgFKg_UII,215
|
|
20
|
+
basebender/rebaser/resources/data/STRUCTURE.md,sha256=jUJnYPVYG4jG9cqP0-eiH2hPiH3N1KrnNJa9epyNtLs,273
|
|
21
|
+
basebender/rebaser/resources/data/default_digit_sets.toml,sha256=128CsDoV_KKZquMSVNnDGzBZUR_7sb4M4xDxaBsMPFc,620
|
|
22
|
+
basebender/rebaser/resources/icons/STRUCTURE.md,sha256=tLGdJVemIGh9wbLMNXam4Tj0LBzo3FrRRH2ycE0JPZE,491
|
|
23
|
+
basebender/rebaser/resources/icons/input.svg,sha256=jCLm5ty8cjWAgJtuV8e8B6Q1YshpGVMTy7rgVNeqmRE,521
|
|
24
|
+
basebender/rebaser/resources/icons/output.svg,sha256=LeRTqLC3KqZHvntnOJFCSuLJSZjHx2o6bVUuTu5lO3A,421
|
|
25
|
+
basebender/rebaser/resources/icons/source.svg,sha256=1t2nry4U5Bhxs4v4K87HqnRcX_TWSMFbhCxcjb4fOVg,514
|
|
26
|
+
basebender/rebaser/resources/icons/target.svg,sha256=KdK4xPXhEgT9U6XGp2N2RWY2zrbKe_qtXoJyLerOVHU,664
|
|
27
|
+
basebender-0.2.1.dist-info/METADATA,sha256=QKOuaht8Kl6UWtFQ_ubFt3bdddDzV8fcfzNq5fDerUE,8990
|
|
28
|
+
basebender-0.2.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
29
|
+
basebender-0.2.1.dist-info/entry_points.txt,sha256=Q458HDDtoBvuZOvZFJzu0yRNCMjc2L1FE4YY5fWcKco,150
|
|
30
|
+
basebender-0.2.1.dist-info/licenses/LICENSE,sha256=9dJlGq0Iy6uk40sYO9h819HTJpVLXXLAnq6RrROZJD0,1066
|
|
31
|
+
basebender-0.2.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 @mexc
|
|
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.
|