pymastring 1.0.0__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.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ProgVM
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymastring
3
+ Version: 1.0.0
4
+ Summary: A chaotic monkey-patch library that brings heavy math, matrix operations, and custom weight-based logic to native Python strings.
5
+ Author-email: ProgVM <progvminc@gmail.com>
6
+ Project-URL: Homepage, https://github.com/ProgVM/pymastring
7
+ Project-URL: Bug-Tracker, https://github.com/ProgVM/pymastring/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: forbiddenfruit>=0.1.4
17
+ Dynamic: license-file
18
+
19
+ # pymastring
20
+
21
+ `pymastring` is a highly unorthodox utility package that globally overrides the runtime behavior of Python's built-in primitive `str` class via deep C-level monkey-patching. It breaks standard structural limitations to allow direct mathematical calculations, matrix equations, bitwise interactions, and custom serialization paradigms natively on raw string literals.
22
+
23
+ ---
24
+
25
+ ## Technical Concept
26
+
27
+ Python's built-in `str` instances are hardcoded at the C-API level to prevent arbitrary mutation. `pymastring` bypasses this defense mechanism by using `forbiddenfruit` to overwrite core slots within the `PyTypeObject` of the native string type.
28
+
29
+ Every mathematical operation maps the characters of the string to their respective **Unicode Code Points** (via `ord()`), runs numerical adjustments, applies an auto-overflow modulo bounds-check (`% 1114112`), and returns the resulting value shifted back into strings (via `chr()`).
30
+
31
+ ---
32
+
33
+ ## Installation
34
+
35
+ Install the package locally in editable development mode or via local source directory distribution:
36
+
37
+ ```bash
38
+ pip install .
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Core Features & Extended API Specification
44
+
45
+ ### 1. Advanced Arithmetic Operators (`**`, `/`, `-`, `%`)
46
+ Standard string literals can be manipulated mathematically with integers and floating-point elements.
47
+ * **Exponentiation (`**`):** Exponentiates the individual internal weight of every distinct character.
48
+ * **Division (`/`):** Divides character codes uniformly.
49
+ * **Subtraction (`-`):** Subtraction by an integer/float dynamically reduces unicode codes. Subtraction by another string removes all structural occurrences of those bytes.
50
+ * **Modulo (`%`):** Determines remainder against character weights. Falls back to default string formatting if `%s`, `%d`, or `%f` structural placeholders are present.
51
+
52
+ ```python
53
+ import pymastring
54
+
55
+ print("abc" ** 2) # Exponentiates character codes
56
+ print("xyz" / 2) # Uniform code points scaling
57
+ print("python" - 5) # Left-shifts unicode positions
58
+ print("abcdef" - "bd") # Drops exact target slices -> Outputs: "acef"
59
+ print("hello" % 3) # Inline remainder extraction
60
+ ```
61
+
62
+ ### 2. Matrix Cross-Multiplication Vector Behavior (`@`)
63
+ Using the `@` operator evaluates the structural linear algebra dot product between two string arrays. It multiplies the scalar weight vectors of matching index elements and accumulates the mathematical sum. Short strings automatically pad using standard null bytes (`\x00`).
64
+
65
+ ```python
66
+ # Calculates: (ord('a') * ord('b')) -> 97 * 98
67
+ result = "a" @ "b"
68
+ print(result) # Outputs integer: 9506
69
+ ```
70
+
71
+ ### 3. Dynamic Structural Weight Evaluation (`len()`)
72
+ The global `len()` invocation is intercepted. Instead of reporting the primitive flat character index array offset count, it computes and returns the complete integrated sum of all unicode sequence code weights.
73
+
74
+ ```python
75
+ # Traditional len("abc") returns 3
76
+ # Patched version evaluates: 97 + 98 + 99
77
+ print(len("abc")) # Outputs integer: 294
78
+ ```
79
+
80
+ ### 4. Bitwise Vector Conversions (`<<`, `>>`, `&`, `|`, `^`)
81
+ Direct byte-level array transformations across registers using standard binary operational parameters.
82
+
83
+ ```python
84
+ print("abc" << 2) # Left shift bit positions
85
+ print("secret" ^ 42) # XOR encryption mask mapping
86
+ print("hello" & "world") # Matrix intersection overlay
87
+ ```
88
+
89
+ ### 5. Total-Weight Context Comparisons (`>`, `<`, `>=`, `<=`)
90
+ Rich comparative sorting algorithms base logic on total calculated inner array vector weight sums, replacing default sequential alphabetic ASCII sorting structures.
91
+
92
+ ```python
93
+ print("short" > "longer") # Strictly evaluates length/weight conditions
94
+ ```
95
+
96
+ ### 6. Typified Generator Array Extraction & Iteration
97
+ Loops parsing raw string sequences yield special operational wrappers (`MathChar`) inheriting full operational capabilities rather than flat string parts.
98
+
99
+ ```python
100
+ for char in "xyz":
101
+ # Loops pull fully functioning MathChar objects allowing immediate manipulation
102
+ print(char ** 1.5)
103
+ ```
104
+
105
+ ### 7. Custom JSON Serialization Engine (`MathJSONEncoder`)
106
+ To prevent internal character objects from breaking standard data transfers, use our targeted serialization mapping profile.
107
+
108
+ ```python
109
+ import json
110
+
111
+ data = {"payload": "abc" ** 2}
112
+ json_string = json.dumps(data, cls=pymastring.MathJSONEncoder)
113
+ ```
114
+
@@ -0,0 +1,96 @@
1
+ # pymastring
2
+
3
+ `pymastring` is a highly unorthodox utility package that globally overrides the runtime behavior of Python's built-in primitive `str` class via deep C-level monkey-patching. It breaks standard structural limitations to allow direct mathematical calculations, matrix equations, bitwise interactions, and custom serialization paradigms natively on raw string literals.
4
+
5
+ ---
6
+
7
+ ## Technical Concept
8
+
9
+ Python's built-in `str` instances are hardcoded at the C-API level to prevent arbitrary mutation. `pymastring` bypasses this defense mechanism by using `forbiddenfruit` to overwrite core slots within the `PyTypeObject` of the native string type.
10
+
11
+ Every mathematical operation maps the characters of the string to their respective **Unicode Code Points** (via `ord()`), runs numerical adjustments, applies an auto-overflow modulo bounds-check (`% 1114112`), and returns the resulting value shifted back into strings (via `chr()`).
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ Install the package locally in editable development mode or via local source directory distribution:
18
+
19
+ ```bash
20
+ pip install .
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Core Features & Extended API Specification
26
+
27
+ ### 1. Advanced Arithmetic Operators (`**`, `/`, `-`, `%`)
28
+ Standard string literals can be manipulated mathematically with integers and floating-point elements.
29
+ * **Exponentiation (`**`):** Exponentiates the individual internal weight of every distinct character.
30
+ * **Division (`/`):** Divides character codes uniformly.
31
+ * **Subtraction (`-`):** Subtraction by an integer/float dynamically reduces unicode codes. Subtraction by another string removes all structural occurrences of those bytes.
32
+ * **Modulo (`%`):** Determines remainder against character weights. Falls back to default string formatting if `%s`, `%d`, or `%f` structural placeholders are present.
33
+
34
+ ```python
35
+ import pymastring
36
+
37
+ print("abc" ** 2) # Exponentiates character codes
38
+ print("xyz" / 2) # Uniform code points scaling
39
+ print("python" - 5) # Left-shifts unicode positions
40
+ print("abcdef" - "bd") # Drops exact target slices -> Outputs: "acef"
41
+ print("hello" % 3) # Inline remainder extraction
42
+ ```
43
+
44
+ ### 2. Matrix Cross-Multiplication Vector Behavior (`@`)
45
+ Using the `@` operator evaluates the structural linear algebra dot product between two string arrays. It multiplies the scalar weight vectors of matching index elements and accumulates the mathematical sum. Short strings automatically pad using standard null bytes (`\x00`).
46
+
47
+ ```python
48
+ # Calculates: (ord('a') * ord('b')) -> 97 * 98
49
+ result = "a" @ "b"
50
+ print(result) # Outputs integer: 9506
51
+ ```
52
+
53
+ ### 3. Dynamic Structural Weight Evaluation (`len()`)
54
+ The global `len()` invocation is intercepted. Instead of reporting the primitive flat character index array offset count, it computes and returns the complete integrated sum of all unicode sequence code weights.
55
+
56
+ ```python
57
+ # Traditional len("abc") returns 3
58
+ # Patched version evaluates: 97 + 98 + 99
59
+ print(len("abc")) # Outputs integer: 294
60
+ ```
61
+
62
+ ### 4. Bitwise Vector Conversions (`<<`, `>>`, `&`, `|`, `^`)
63
+ Direct byte-level array transformations across registers using standard binary operational parameters.
64
+
65
+ ```python
66
+ print("abc" << 2) # Left shift bit positions
67
+ print("secret" ^ 42) # XOR encryption mask mapping
68
+ print("hello" & "world") # Matrix intersection overlay
69
+ ```
70
+
71
+ ### 5. Total-Weight Context Comparisons (`>`, `<`, `>=`, `<=`)
72
+ Rich comparative sorting algorithms base logic on total calculated inner array vector weight sums, replacing default sequential alphabetic ASCII sorting structures.
73
+
74
+ ```python
75
+ print("short" > "longer") # Strictly evaluates length/weight conditions
76
+ ```
77
+
78
+ ### 6. Typified Generator Array Extraction & Iteration
79
+ Loops parsing raw string sequences yield special operational wrappers (`MathChar`) inheriting full operational capabilities rather than flat string parts.
80
+
81
+ ```python
82
+ for char in "xyz":
83
+ # Loops pull fully functioning MathChar objects allowing immediate manipulation
84
+ print(char ** 1.5)
85
+ ```
86
+
87
+ ### 7. Custom JSON Serialization Engine (`MathJSONEncoder`)
88
+ To prevent internal character objects from breaking standard data transfers, use our targeted serialization mapping profile.
89
+
90
+ ```python
91
+ import json
92
+
93
+ data = {"payload": "abc" ** 2}
94
+ json_string = json.dumps(data, cls=pymastring.MathJSONEncoder)
95
+ ```
96
+
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pymastring"
7
+ version = "1.0.0"
8
+ authors = [
9
+ { name = "ProgVM", email = "progvminc@gmail.com" }
10
+ ]
11
+ description = "A chaotic monkey-patch library that brings heavy math, matrix operations, and custom weight-based logic to native Python strings."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ ]
21
+ dependencies = [
22
+ "forbiddenfruit>=0.1.4"
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/ProgVM/pymastring"
27
+ Bug-Tracker = "https://github.com/ProgVM/pymastring/issues"
28
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ # Standard internal python structure for package initialization
2
+ from .core import patch_strings, MathJSONEncoder, MathChar
3
+
4
+ # Automatically apply forbiddenfruit patches on package import
5
+ patch_strings()
6
+
7
+ __all__ = ["MathJSONEncoder", "MathChar"]
8
+
@@ -0,0 +1,261 @@
1
+ import json
2
+ from forbiddenfruit import curse
3
+
4
+ # --- Custom String Elements for Advanced Iteration ---
5
+
6
+ class MathChar(str):
7
+ """
8
+ A single-character string wrapper that retains all custom mathematical properties
9
+ when extracting or iterating over string elements.
10
+ """
11
+ pass
12
+
13
+ class StringMathIterator:
14
+ """
15
+ Custom iterator to yield MathChar instances instead of standard primitive strings.
16
+ """
17
+ def __init__(self, text):
18
+ # Store as standard primitive to avoid recursion during internal processing
19
+ self.text = str(text)
20
+ self.index = 0
21
+
22
+ def __iter__(self):
23
+ return self
24
+
25
+ def __next__(self):
26
+ if self.index < len(self.text):
27
+ char = self.text[self.index]
28
+ self.index += 1
29
+ return MathChar(char)
30
+ raise StopIteration
31
+
32
+
33
+ # --- Custom JSON Serialization Support ---
34
+
35
+ class MathJSONEncoder(json.JSONEncoder):
36
+ """
37
+ Custom JSON Encoder to ensure MathChar objects and heavily mutated strings
38
+ serialize safely into standard JSON representations without metadata corruption.
39
+ """
40
+ def default(self, obj):
41
+ if isinstance(obj, MathChar):
42
+ return str(obj)
43
+ return super().default(obj)
44
+
45
+
46
+ # --- Core Mathematical Operators ---
47
+
48
+ def string_pow(self, power):
49
+ """ Hook function to replace the standard behavior of str.__pow__ (**). """
50
+ if not isinstance(power, (int, float)):
51
+ class_name = self.__class__.__name__
52
+ power_name = type(power).__name__
53
+ raise TypeError(f"unsupported operand type(s) for ** or pow(): '{class_name}' and '{power_name}'")
54
+
55
+ result_chars = []
56
+ for char in self:
57
+ char_code = ord(char)
58
+ powered_code = char_code ** power
59
+ final_code = int(powered_code) % 1114112
60
+ result_chars.append(chr(final_code))
61
+ return "".join(result_chars)
62
+
63
+ def string_truediv(self, divisor):
64
+ """ Hook function to replace the standard behavior of str.__truediv__ (/). """
65
+ if not isinstance(divisor, (int, float)):
66
+ class_name = self.__class__.__name__
67
+ divisor_name = type(divisor).__name__
68
+ raise TypeError(f"unsupported operand type(s) for /: '{class_name}' and '{divisor_name}'")
69
+
70
+ if divisor == 0:
71
+ raise ZeroDivisionError("string division by zero")
72
+
73
+ result_chars = []
74
+ for char in self:
75
+ char_code = ord(char)
76
+ divided_code = int(char_code / divisor) % 1114112
77
+ result_chars.append(chr(divided_code))
78
+ return "".join(result_chars)
79
+
80
+ def string_sub(self, other):
81
+ """ Hook function to replace the standard behavior of str.__sub__ (-). """
82
+ if isinstance(other, str):
83
+ result = self
84
+ for char in other:
85
+ result = result.replace(char, "")
86
+ return result
87
+ elif isinstance(other, (int, float)):
88
+ result_chars = []
89
+ for char in self:
90
+ final_code = int(ord(char) - int(other)) % 1114112
91
+ result_chars.append(chr(final_code))
92
+ return "".join(result_chars)
93
+ else:
94
+ class_name = self.__class__.__name__
95
+ other_name = type(other).__name__
96
+ raise TypeError(f"unsupported operand type(s) for -: '{class_name}' and '{other_name}'")
97
+
98
+ def string_mod(self, other):
99
+ """ Hook function to patch str.__mod__ (%). """
100
+ if "%s" in self or "%d" in self or "%f" in self:
101
+ # Fallback to standard C-level string formatting if placeholders exist
102
+ return NotImplemented
103
+
104
+ if not isinstance(other, (int, float)):
105
+ class_name = self.__class__.__name__
106
+ other_name = type(other).__name__
107
+ raise TypeError(f"unsupported operand type(s) for %: '{class_name}' and '{other_name}'")
108
+
109
+ if other == 0:
110
+ raise ZeroDivisionError("string modulo by zero")
111
+
112
+ result_chars = []
113
+ for char in self:
114
+ final_code = int(ord(char) % other) % 1114112
115
+ result_chars.append(chr(final_code))
116
+ return "".join(result_chars)
117
+
118
+
119
+ # --- Matrix Multiplication (@) ---
120
+
121
+ def string_matmul(self, other):
122
+ """ Hook function to patch str.__matmul__ (@). Calculates scalar dot product. """
123
+ if not isinstance(other, str):
124
+ class_name = self.__class__.__name__
125
+ other_name = type(other).__name__
126
+ raise TypeError(f"unsupported operand type(s) for @: '{class_name}' and '{other_name}'")
127
+
128
+ max_len = max(len(self), len(other))
129
+ s1 = self.ljust(max_len, '\x00')
130
+ s2 = other.ljust(max_len, '\x00')
131
+
132
+ # Secure raw length call bypassing our patched __len__ to prevent semantic mess here
133
+ dot_product = sum(ord(c1) * ord(c2) for c1, c2 in zip(s1, s2))
134
+ return dot_product
135
+
136
+
137
+ # --- Custom Advanced Length Hook (len()) ---
138
+
139
+ def string_len(self):
140
+ """
141
+ Hook function to dynamically modify the native behavior of len(str).
142
+ Calculates total Unicode weight instead of counting raw character positions.
143
+ Uses continuous native generation to strictly prevent deep recursion loops.
144
+ """
145
+ total_weight = 0
146
+ # Use standard C-level character iteration to bypass custom Python __iter__ hook
147
+ for i in range(super(str, self).__len__()):
148
+ total_weight += ord(self[i])
149
+ return total_weight
150
+
151
+
152
+ # --- Bitwise Operators (<<, >>, &, |, ^) ---
153
+
154
+ def string_lshift(self, shift):
155
+ """ Hook function to patch str.__lshift__ (<<). """
156
+ if not isinstance(shift, int):
157
+ class_name = self.__class__.__name__
158
+ shift_name = type(shift).__name__
159
+ raise TypeError(f"unsupported operand type(s) for <<: '{class_name}' and '{shift_name}'")
160
+
161
+ result_chars = []
162
+ for char in self:
163
+ final_code = (ord(char) << shift) % 1114112
164
+ result_chars.append(chr(final_code))
165
+ return "".join(result_chars)
166
+
167
+ def string_rshift(self, shift):
168
+ """ Hook function to patch str.__rshift__ (>>). """
169
+ if not isinstance(shift, int):
170
+ class_name = self.__class__.__name__
171
+ shift_name = type(shift).__name__
172
+ raise TypeError(f"unsupported operand type(s) for >>: '{class_name}' and '{shift_name}'")
173
+
174
+ result_chars = []
175
+ for char in self:
176
+ final_code = (ord(char) >> shift) % 1114112
177
+ result_chars.append(chr(final_code))
178
+ return "".join(result_chars)
179
+
180
+ def _bitwise_base(self, other, op_func, op_symbol):
181
+ if isinstance(other, int):
182
+ result_chars = []
183
+ for char in self:
184
+ final_code = op_func(ord(char), other) % 1114112
185
+ result_chars.append(chr(final_code))
186
+ return "".join(result_chars)
187
+ elif isinstance(other, str):
188
+ max_len = max(super(str, self).__len__(), super(str, other).__len__())
189
+ s1 = self.ljust(max_len, '\x00')
190
+ s2 = other.ljust(max_len, '\x00')
191
+
192
+ result_chars = []
193
+ for c1, c2 in zip(s1, s2):
194
+ final_code = op_func(ord(c1), ord(c2)) % 1114112
195
+ result_chars.append(chr(final_code))
196
+ return "".join(result_chars)
197
+ else:
198
+ class_name = self.__class__.__name__
199
+ other_name = type(other).__name__
200
+ raise TypeError(f"unsupported operand type(s) for {op_symbol}: '{class_name}' and '{other_name}'")
201
+
202
+ def string_and(self, other): return _bitwise_base(self, other, lambda x, y: x & y, '&')
203
+ def string_or(self, other): return _bitwise_base(self, other, lambda x, y: x | y, '|')
204
+ def string_xor(self, other): return _bitwise_base(self, other, lambda x, y: x ^ y, '^')
205
+
206
+
207
+ # --- Logical Comparison Operators ---
208
+
209
+ def _compare_strings(self, other, op):
210
+ if not isinstance(other, str):
211
+ class_name = self.__class__.__name__
212
+ other_name = type(other).__name__
213
+ raise TypeError(f"not supported between instances of '{class_name}' and '{other_name}'")
214
+
215
+ return op(string_len(self), string_len(other))
216
+
217
+ def string_gt(self, other): return _compare_strings(self, other, lambda x, y: x > y)
218
+ def string_lt(self, other): return _compare_strings(self, other, lambda x, y: x < y)
219
+ def string_ge(self, other): return _compare_strings(self, other, lambda x, y: x >= y)
220
+ def string_le(self, other): return _compare_strings(self, other, lambda x, y: x <= y)
221
+
222
+
223
+ # --- Custom Iteration Hook ---
224
+
225
+ def string_iter(self):
226
+ """ Hook function to replace standard str.__iter__. """
227
+ return StringMathIterator(self)
228
+
229
+
230
+ # --- Global Monkey-Patch Executor ---
231
+
232
+ def patch_strings():
233
+ """ Injects all mathematical, matrix, bitwise, logical, length and iteration hooks into native 'str'. """
234
+ # Math & Matrix
235
+ curse(str, "__pow__", string_pow)
236
+ curse(str, "__truediv__", string_truediv)
237
+ curse(str, "__sub__", string_sub)
238
+ curse(str, "__mod__", string_mod)
239
+ curse(str, "__matmul__", string_matmul)
240
+ # Custom Length
241
+ curse(str, "__len__", string_len)
242
+ # Bitwise
243
+ curse(str, "__lshift__", string_lshift)
244
+ curse(str, "__rshift__", string_rshift)
245
+ curse(str, "__and__", string_and)
246
+ curse(str, "__or__", string_or)
247
+ curse(str, "__xor__", string_xor)
248
+ # Logic
249
+ curse(str, "__gt__", string_gt)
250
+ curse(str, "__lt__", string_lt)
251
+ curse(str, "__ge__", string_ge)
252
+ curse(str, "__le__", string_le)
253
+ # Iteration
254
+ curse(str, "__iter__", string_iter)
255
+
256
+ # Dynamically synchronize the custom MathChar fallback operations
257
+ for method in ["__pow__", "__truediv__", "__sub__", "__mod__", "__matmul__", "__len__",
258
+ "__lshift__", "__rshift__", "__and__", "__or__", "__xor__",
259
+ "__gt__", "__lt__", "__ge__", "__le__", "__iter__"]:
260
+ setattr(MathChar, method, locals()[f"string_{method.strip('_')}"])
261
+
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymastring
3
+ Version: 1.0.0
4
+ Summary: A chaotic monkey-patch library that brings heavy math, matrix operations, and custom weight-based logic to native Python strings.
5
+ Author-email: ProgVM <progvminc@gmail.com>
6
+ Project-URL: Homepage, https://github.com/ProgVM/pymastring
7
+ Project-URL: Bug-Tracker, https://github.com/ProgVM/pymastring/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: forbiddenfruit>=0.1.4
17
+ Dynamic: license-file
18
+
19
+ # pymastring
20
+
21
+ `pymastring` is a highly unorthodox utility package that globally overrides the runtime behavior of Python's built-in primitive `str` class via deep C-level monkey-patching. It breaks standard structural limitations to allow direct mathematical calculations, matrix equations, bitwise interactions, and custom serialization paradigms natively on raw string literals.
22
+
23
+ ---
24
+
25
+ ## Technical Concept
26
+
27
+ Python's built-in `str` instances are hardcoded at the C-API level to prevent arbitrary mutation. `pymastring` bypasses this defense mechanism by using `forbiddenfruit` to overwrite core slots within the `PyTypeObject` of the native string type.
28
+
29
+ Every mathematical operation maps the characters of the string to their respective **Unicode Code Points** (via `ord()`), runs numerical adjustments, applies an auto-overflow modulo bounds-check (`% 1114112`), and returns the resulting value shifted back into strings (via `chr()`).
30
+
31
+ ---
32
+
33
+ ## Installation
34
+
35
+ Install the package locally in editable development mode or via local source directory distribution:
36
+
37
+ ```bash
38
+ pip install .
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Core Features & Extended API Specification
44
+
45
+ ### 1. Advanced Arithmetic Operators (`**`, `/`, `-`, `%`)
46
+ Standard string literals can be manipulated mathematically with integers and floating-point elements.
47
+ * **Exponentiation (`**`):** Exponentiates the individual internal weight of every distinct character.
48
+ * **Division (`/`):** Divides character codes uniformly.
49
+ * **Subtraction (`-`):** Subtraction by an integer/float dynamically reduces unicode codes. Subtraction by another string removes all structural occurrences of those bytes.
50
+ * **Modulo (`%`):** Determines remainder against character weights. Falls back to default string formatting if `%s`, `%d`, or `%f` structural placeholders are present.
51
+
52
+ ```python
53
+ import pymastring
54
+
55
+ print("abc" ** 2) # Exponentiates character codes
56
+ print("xyz" / 2) # Uniform code points scaling
57
+ print("python" - 5) # Left-shifts unicode positions
58
+ print("abcdef" - "bd") # Drops exact target slices -> Outputs: "acef"
59
+ print("hello" % 3) # Inline remainder extraction
60
+ ```
61
+
62
+ ### 2. Matrix Cross-Multiplication Vector Behavior (`@`)
63
+ Using the `@` operator evaluates the structural linear algebra dot product between two string arrays. It multiplies the scalar weight vectors of matching index elements and accumulates the mathematical sum. Short strings automatically pad using standard null bytes (`\x00`).
64
+
65
+ ```python
66
+ # Calculates: (ord('a') * ord('b')) -> 97 * 98
67
+ result = "a" @ "b"
68
+ print(result) # Outputs integer: 9506
69
+ ```
70
+
71
+ ### 3. Dynamic Structural Weight Evaluation (`len()`)
72
+ The global `len()` invocation is intercepted. Instead of reporting the primitive flat character index array offset count, it computes and returns the complete integrated sum of all unicode sequence code weights.
73
+
74
+ ```python
75
+ # Traditional len("abc") returns 3
76
+ # Patched version evaluates: 97 + 98 + 99
77
+ print(len("abc")) # Outputs integer: 294
78
+ ```
79
+
80
+ ### 4. Bitwise Vector Conversions (`<<`, `>>`, `&`, `|`, `^`)
81
+ Direct byte-level array transformations across registers using standard binary operational parameters.
82
+
83
+ ```python
84
+ print("abc" << 2) # Left shift bit positions
85
+ print("secret" ^ 42) # XOR encryption mask mapping
86
+ print("hello" & "world") # Matrix intersection overlay
87
+ ```
88
+
89
+ ### 5. Total-Weight Context Comparisons (`>`, `<`, `>=`, `<=`)
90
+ Rich comparative sorting algorithms base logic on total calculated inner array vector weight sums, replacing default sequential alphabetic ASCII sorting structures.
91
+
92
+ ```python
93
+ print("short" > "longer") # Strictly evaluates length/weight conditions
94
+ ```
95
+
96
+ ### 6. Typified Generator Array Extraction & Iteration
97
+ Loops parsing raw string sequences yield special operational wrappers (`MathChar`) inheriting full operational capabilities rather than flat string parts.
98
+
99
+ ```python
100
+ for char in "xyz":
101
+ # Loops pull fully functioning MathChar objects allowing immediate manipulation
102
+ print(char ** 1.5)
103
+ ```
104
+
105
+ ### 7. Custom JSON Serialization Engine (`MathJSONEncoder`)
106
+ To prevent internal character objects from breaking standard data transfers, use our targeted serialization mapping profile.
107
+
108
+ ```python
109
+ import json
110
+
111
+ data = {"payload": "abc" ** 2}
112
+ json_string = json.dumps(data, cls=pymastring.MathJSONEncoder)
113
+ ```
114
+
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/pymastring/__init__.py
5
+ src/pymastring/core.py
6
+ src/pymastring.egg-info/PKG-INFO
7
+ src/pymastring.egg-info/SOURCES.txt
8
+ src/pymastring.egg-info/dependency_links.txt
9
+ src/pymastring.egg-info/requires.txt
10
+ src/pymastring.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ forbiddenfruit>=0.1.4
@@ -0,0 +1 @@
1
+ pymastring