synx-format 1.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.
File without changes
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: synx-format
3
+ Version: 1.0.1
4
+ Summary: SYNX: The Active Data Format engine for Python
5
+ Author-email: APERTURESyndicate <support@aperturesyndicate.com>
6
+ Project-URL: Homepage, https://github.com/kaiserrberg/synx-format
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
File without changes
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "synx-format"
7
+ version = "1.0.1"
8
+ authors = [
9
+ { name="APERTURESyndicate", email="support@aperturesyndicate.com" },
10
+ ]
11
+ description = "SYNX: The Active Data Format engine for Python"
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ [project.urls]
21
+ "Homepage" = "https://github.com/kaiserrberg/synx-format"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ # src/synx/__init__.py
2
+ from .engine import Synx
3
+
4
+ __version__ = "1.0.1"
5
+ __author__ = "APERTURE Syndicate"
6
+
7
+ __all__ = ["Synx"]
@@ -0,0 +1,55 @@
1
+ import os
2
+ import random
3
+ import re
4
+
5
+ class Synx:
6
+ @staticmethod
7
+ def parse(text):
8
+ lines = text.splitlines()
9
+ result = {}
10
+ stack = [( -1, result)]
11
+
12
+ for line in lines:
13
+ stripped = line.strip()
14
+ if not stripped or stripped.startswith('#'): continue
15
+
16
+ indent = len(line) - len(line.lstrip())
17
+
18
+ match = re.match(r'^([^\s:\[]+)(?:\[.*?\])?(?::([\w:]+))?(?:\s+(.*))?$', stripped)
19
+ if not match: continue
20
+
21
+ key, marker, value = match.groups()
22
+
23
+ final_value = Synx._resolve_logic(marker, value)
24
+
25
+ while stack and indent <= stack[-1][0]:
26
+ stack.pop()
27
+
28
+ current_dict = stack[-1][1]
29
+
30
+ if final_value is None:
31
+ new_node = {}
32
+ current_dict[key] = new_node
33
+ stack.append((indent, new_node))
34
+ else:
35
+ current_dict[key] = final_value
36
+
37
+ return result
38
+
39
+ @staticmethod
40
+ def _resolve_logic(marker, value):
41
+ if not marker: return value
42
+
43
+ if "random" in marker:
44
+ return value if value else None
45
+
46
+ if "calc" in marker and value:
47
+ try:
48
+ return eval(value, {"__builtins__": {}}, {})
49
+ except:
50
+ return value
51
+
52
+ if "env" in marker and value:
53
+ return os.getenv(value, f"MISSING_ENV_{value}")
54
+
55
+ return value
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: synx-format
3
+ Version: 1.0.1
4
+ Summary: SYNX: The Active Data Format engine for Python
5
+ Author-email: APERTURESyndicate <support@aperturesyndicate.com>
6
+ Project-URL: Homepage, https://github.com/kaiserrberg/synx-format
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.7
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/synx/__init__.py
5
+ src/synx/engine.py
6
+ src/synx_format.egg-info/PKG-INFO
7
+ src/synx_format.egg-info/SOURCES.txt
8
+ src/synx_format.egg-info/dependency_links.txt
9
+ src/synx_format.egg-info/top_level.txt