CMT-SALanguages 1.0.0__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.
@@ -0,0 +1,51 @@
1
+ """
2
+ CMT-SALanguages — Programming in South Africa's Official Languages
3
+ Developed by Mzwandile
4
+
5
+ Usage:
6
+ from CMT_SALanguages import isizulu as CAL
7
+ from CMT_SALanguages import isixhosa as CAL
8
+ from CMT_SALanguages import afrikaans as CAL
9
+ from CMT_SALanguages import sesotho as CAL
10
+ from CMT_SALanguages import setswana as CAL
11
+ from CMT_SALanguages import sepedi as CAL
12
+ from CMT_SALanguages import siswati as CAL
13
+ from CMT_SALanguages import isindebele as CAL
14
+ from CMT_SALanguages import tshivenda as CAL
15
+ from CMT_SALanguages import xitsonga as CAL
16
+ from CMT_SALanguages import english as CAL
17
+
18
+ CAL.sebenza('phrinta("Sawubona Mzansi!")')
19
+ """
20
+
21
+ from . import isizulu
22
+ from . import isixhosa
23
+ from . import afrikaans
24
+ from . import sesotho
25
+ from . import setswana
26
+ from . import sepedi
27
+ from . import siswati
28
+ from . import isindebele
29
+ from . import tshivenda
30
+ from . import xitsonga
31
+ from . import english
32
+
33
+ __version__ = "1.0.0"
34
+ __author__ = "Mzwandile Zulu"
35
+
36
+ LANGUAGES = [
37
+ "isizulu", "isixhosa", "afrikaans", "sesotho", "setswana",
38
+ "sepedi", "siswati", "isindebele", "tshivenda", "xitsonga", "english",
39
+ ]
40
+
41
+ __all__ = LANGUAGES + ["LANGUAGES"]
42
+
43
+
44
+ def list_languages():
45
+ """Print all 11 supported South African languages."""
46
+ print("\nCMT-SALanguages — 11 Official South African Languages")
47
+ print("─" * 50)
48
+ for lang in LANGUAGES:
49
+ module = globals()[lang]
50
+ print(f" {lang:<15} → {module.LANGUAGE_NAME}")
51
+ print()
@@ -0,0 +1,220 @@
1
+ """
2
+ CMT-SALanguages — shared transpiler engine.
3
+
4
+ Each language module (isizulu, isixhosa, afrikaans, etc.) provides its own
5
+ KEYWORDS / CALLABLE_KEYWORDS / METHOD_KEYWORDS / MODULE_AND_EXCEPTION_KEYWORDS
6
+ dictionaries and calls into this engine to do the actual transpilation.
7
+ """
8
+
9
+ import re
10
+ import os
11
+ import sys
12
+ import subprocess
13
+ import tempfile
14
+
15
+
16
+ def transpile(source: str, keywords: dict, callable_keywords: dict,
17
+ method_keywords: dict, module_exception_keywords: dict) -> str:
18
+ """
19
+ Transpile source code written with the given language's keyword maps
20
+ into valid Python code.
21
+ """
22
+ lines = source.splitlines()
23
+ output_lines = []
24
+
25
+ for line in lines:
26
+ converted = _convert_line(
27
+ line, keywords, callable_keywords, method_keywords, module_exception_keywords
28
+ )
29
+ output_lines.append(converted)
30
+
31
+ return "\n".join(output_lines)
32
+
33
+
34
+ def _convert_line(line, keywords, callable_keywords, method_keywords, module_exception_keywords):
35
+ stripped = line.lstrip()
36
+ indent = line[: len(line) - len(stripped)]
37
+
38
+ if not stripped:
39
+ return line
40
+
41
+ if stripped.startswith("#"):
42
+ return line
43
+
44
+ converted = _replace_keywords(
45
+ stripped, keywords, callable_keywords, method_keywords, module_exception_keywords
46
+ )
47
+ return indent + converted
48
+
49
+
50
+ def _replace_keywords(text, keywords, callable_keywords, method_keywords, module_exception_keywords):
51
+ segments = _split_strings(text)
52
+ result = []
53
+
54
+ for is_string, segment in segments:
55
+ if is_string:
56
+ result.append(segment)
57
+ continue
58
+
59
+ converted = segment
60
+
61
+ # 1. Always-reserved keywords
62
+ for word, python in sorted(keywords.items(), key=lambda x: -len(x[0])):
63
+ converted = re.sub(r"\b" + re.escape(word) + r"\b", python, converted)
64
+
65
+ # 2. Method keywords — only after a dot
66
+ for word, python in sorted(method_keywords.items(), key=lambda x: -len(x[0])):
67
+ converted = re.sub(
68
+ r"\.\s*" + re.escape(word) + r"\b",
69
+ "." + python,
70
+ converted,
71
+ )
72
+
73
+ # 3. Callable keywords — only when followed by "(" (function call).
74
+ # NOT on "." — that would wrongly convert variable names that
75
+ # happen to match a type/builtin name (e.g. "uhlelo" meaning both
76
+ # "list" the type and a natural variable name "list/plan").
77
+ for word, python in sorted(callable_keywords.items(), key=lambda x: -len(x[0])):
78
+ converted = re.sub(
79
+ r"\b" + re.escape(word) + r"\b(?=\s*\()",
80
+ python,
81
+ converted,
82
+ )
83
+
84
+ # 4. Module & exception keywords — unless followed by "=" (assignment)
85
+ for word, python in sorted(module_exception_keywords.items(), key=lambda x: -len(x[0])):
86
+ converted = re.sub(
87
+ r"\b" + re.escape(word) + r"\b(?!\s*=(?!=))",
88
+ python,
89
+ converted,
90
+ )
91
+
92
+ result.append(converted)
93
+
94
+ return "".join(result)
95
+
96
+
97
+ def _split_strings(text: str):
98
+ pattern = re.compile(r'(\"(?:[^\"\\]|\\.)*\"|\'(?:[^\'\\]|\\.)*\')')
99
+ parts = pattern.split(text)
100
+ result = []
101
+ for i, part in enumerate(parts):
102
+ result.append((i % 2 == 1, part))
103
+ return result
104
+
105
+
106
+ def run_code(source: str, keywords, callable_keywords, method_keywords, module_exception_keywords):
107
+ """Transpile and execute a string of code, printing its output."""
108
+ python_code = transpile(source, keywords, callable_keywords, method_keywords, module_exception_keywords)
109
+
110
+ with tempfile.NamedTemporaryFile(suffix=".py", mode="w", delete=False, encoding="utf-8") as tmp:
111
+ tmp.write(python_code)
112
+ tmp_path = tmp.name
113
+
114
+ try:
115
+ subprocess.run([sys.executable, tmp_path])
116
+ finally:
117
+ os.unlink(tmp_path)
118
+
119
+
120
+ def run_file(filepath: str, keywords, callable_keywords, method_keywords, module_exception_keywords):
121
+ """Transpile and execute a source file."""
122
+ if not os.path.exists(filepath):
123
+ print(f"CMT-SALanguages Error: File not found — {filepath}")
124
+ return
125
+
126
+ with open(filepath, encoding="utf-8") as f:
127
+ source = f.read()
128
+
129
+ run_code(source, keywords, callable_keywords, method_keywords, module_exception_keywords)
130
+
131
+
132
+ def get_output(source: str, keywords, callable_keywords, method_keywords, module_exception_keywords) -> str:
133
+ """Transpile and execute, returning captured stdout as a string."""
134
+ python_code = transpile(source, keywords, callable_keywords, method_keywords, module_exception_keywords)
135
+
136
+ with tempfile.NamedTemporaryFile(suffix=".py", mode="w", delete=False, encoding="utf-8") as tmp:
137
+ tmp.write(python_code)
138
+ tmp_path = tmp.name
139
+
140
+ try:
141
+ result = subprocess.run([sys.executable, tmp_path], capture_output=True, text=True)
142
+ return result.stdout
143
+ finally:
144
+ os.unlink(tmp_path)
145
+
146
+
147
+ def print_keywords(keywords, callable_keywords, method_keywords, module_exception_keywords, language_name):
148
+ """Print all keywords for a language."""
149
+ all_kw = {**keywords, **callable_keywords, **method_keywords, **module_exception_keywords}
150
+ print(f"\n{language_name:<25} {'Python'}")
151
+ print("─" * 40)
152
+ for word, python in sorted(all_kw.items()):
153
+ print(f"{word:<25} {python}")
154
+ print()
155
+
156
+
157
+ def live_editor(keywords, callable_keywords, method_keywords, module_exception_keywords, language_name, prefix="sebenza"):
158
+ """
159
+ Generic live editor. `prefix` is unused now — kept for API compatibility.
160
+ Uses universal commands: 'run', 'clear', 'quit' work in every language,
161
+ plus each language can define its own native words for these.
162
+ """
163
+ _clear_screen()
164
+ _print_live_header(language_name)
165
+
166
+ lines = []
167
+
168
+ while True:
169
+ try:
170
+ line = input(">>> ")
171
+ except (EOFError, KeyboardInterrupt):
172
+ print("\nGoodbye!")
173
+ break
174
+
175
+ stripped = line.strip().lower()
176
+
177
+ if stripped in ("quit", "exit", "phuma"):
178
+ print("Goodbye!")
179
+ break
180
+
181
+ elif stripped in ("clear", "sula"):
182
+ lines = []
183
+ _clear_screen()
184
+ _print_live_header(language_name)
185
+
186
+ elif stripped in ("run", "sebenza"):
187
+ if not lines:
188
+ print(" (no code to run — type your code first!)\n")
189
+ continue
190
+ source = "\n".join(lines)
191
+ print()
192
+ print("─" * 52)
193
+ run_code(source, keywords, callable_keywords, method_keywords, module_exception_keywords)
194
+ print("─" * 52)
195
+ print()
196
+
197
+ elif stripped == "":
198
+ continue
199
+
200
+ else:
201
+ lines.append(line)
202
+ print(f" [line {len(lines)} saved]")
203
+
204
+
205
+ def _print_live_header(language_name):
206
+ print("=" * 52)
207
+ print(f" CMT-SALanguages — {language_name} Live Editor")
208
+ print(" Developed by Mzwandile")
209
+ print("=" * 52)
210
+ print(" Type your code line by line.")
211
+ print()
212
+ print(" run / sebenza -> run your code")
213
+ print(" clear / sula -> clear and start fresh")
214
+ print(" quit / phuma -> quit")
215
+ print("=" * 52)
216
+ print()
217
+
218
+
219
+ def _clear_screen():
220
+ os.system("cls" if os.name == "nt" else "clear")
@@ -0,0 +1,102 @@
1
+ """
2
+ CMT-SALanguages — Afrikaans
3
+
4
+ Usage:
5
+ from CMT_SALanguages import afrikaans as CAL
6
+ CAL.sebenza('druk("Hallo!")')
7
+ """
8
+
9
+ from . import _engine as _e
10
+
11
+ LANGUAGE_NAME = "Afrikaans"
12
+
13
+ KEYWORDS = {
14
+ "as": "if", "anders_as": "elif", "anders": "else", "terwyl": "while",
15
+ "vir": "for", "in": "in", "breek": "break", "gaan_voort": "continue",
16
+ "verbygaan": "pass", "funksie": "def", "klas": "class", "gee_terug": "return",
17
+ "self": "self", "_begin_": "__init__", "_klas_": "__class__", "_naam_": "__name__",
18
+ "voer_in": "import", "vanaf": "from", "waar": "True", "onwaar": "False",
19
+ "geen": "None", "en": "and", "of": "or", "nie": "not",
20
+ "probeer": "try", "behalwe": "except", "uiteindelik": "finally", "gooi": "raise",
21
+ "vir_funksie": "lambda", "globaal": "global", "nieplaaslik": "nonlocal", "met": "with",
22
+ "as_": "as", "lewer": "yield", "verseker": "assert", "verwyder": "del",
23
+ "asinkroon": "async", "wag": "await", "pasmaak": "match", "geval": "case",
24
+ }
25
+
26
+ CALLABLE_KEYWORDS = {
27
+ "string": "str", "heelgetal": "int", "wisselgetal": "float", "lys": "list",
28
+ "woordeboek": "dict", "versameling": "set", "boole": "bool", "grepe": "bytes",
29
+ "tupel": "tuple", "druk": "print", "lengte": "len", "reeks": "range", "tipe": "type",
30
+ "invoer": "input", "is_tipe": "isinstance", "maak_oop": "open", "sorteer": "sorted",
31
+ "omgekeerd": "reversed", "saamvoeg": "zip", "verbeeld": "map", "filtreer": "filter",
32
+ "som": "sum", "maksimum": "max", "minimum": "min", "almal": "all",
33
+ "enige": "any", "tel_op": "enumerate", "super": "super", "absoluut": "abs",
34
+ "rond_af": "round", "hulp": "help", "gids": "dir", "id_van": "id", "binêr": "bin",
35
+ "heksadesimaal": "hex", "oktaal": "oct", "mag": "pow",
36
+ "herhaal": "iter", "volgende": "next", "eiendom": "property",
37
+ "klasmetode": "classmethod", "statiesemetode": "staticmethod",
38
+ }
39
+
40
+ METHOD_KEYWORDS = {
41
+ "maak_toe": "close", "skryf": "write", "lees": "read", "lees_lyne": "readlines",
42
+ "skryf_lyne": "writelines", "formateer": "format", "verdeel": "split",
43
+ "saamvoeg_woorde": "join", "stroop": "strip", "vervang": "replace",
44
+ "hoofletters": "upper", "kleinletters": "lower", "begin_met": "startswith", "eindig_met": "endswith",
45
+ "vind": "find", "tel": "count", "voeg_by": "append", "voeg_alles_by": "extend",
46
+ "voeg_in": "insert", "haal_uit": "pop", "verwyder_item": "remove", "maak_skoon": "clear",
47
+ "kopieer": "copy", "sleutels": "keys", "waardes": "values", "items": "items",
48
+ "kry": "get", "bywerk": "update",
49
+ }
50
+
51
+ MODULE_AND_EXCEPTION_KEYWORDS = {
52
+ "fout": "Exception", "waardefout": "ValueError", "tipefout": "TypeError",
53
+ "indeksfout": "IndexError", "sleutelfout": "KeyError",
54
+ "lêerfout": "FileNotFoundError", "delingfout": "ZeroDivisionError",
55
+ "eienskapfout": "AttributeError", "invoerfout": "ImportError",
56
+ "looptydfout": "RuntimeError", "stopiterasie": "StopIteration",
57
+ "wiskunde": "math", "lukraak": "random", "datumtyd": "datetime",
58
+ "bedryfstelsel": "os", "stelsel": "sys", "lêerpad": "pathlib",
59
+ "grafiekgereedskap": "matplotlib", "dataanalise": "pandas",
60
+ "numeriesereekse": "numpy", "drade": "threading",
61
+ "veelvoudigeprosesse": "multiprocessing", "patroonsoektog": "re", "versoeke": "requests",
62
+ "databasis": "sqlite3", "webwerf": "flask", "teller": "Counter",
63
+ "tweekantrak": "deque", "verstekwoordeboek": "defaultdict",
64
+ "genoemdetupel": "namedtuple", "kettingkaart": "ChainMap",
65
+ "geordendewoordeboek": "OrderedDict",
66
+ }
67
+
68
+ ALL_KEYWORDS = {**KEYWORDS, **CALLABLE_KEYWORDS, **METHOD_KEYWORDS, **MODULE_AND_EXCEPTION_KEYWORDS}
69
+
70
+
71
+ def transpile(kode: str) -> str:
72
+ return _e.transpile(kode, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
73
+
74
+
75
+ def hardloop(kode: str):
76
+ _e.run_code(kode, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
77
+
78
+
79
+ def lêer(pad: str):
80
+ _e.run_file(pad, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
81
+
82
+
83
+ def uitset(kode: str) -> str:
84
+ return _e.get_output(kode, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
85
+
86
+
87
+ def woorde():
88
+ _e.print_keywords(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
89
+
90
+
91
+ def regstreeks():
92
+ _e.live_editor(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
93
+
94
+
95
+ run = hardloop
96
+ run_code = hardloop
97
+ sebenza = hardloop
98
+ guqula = transpile
99
+ live = regstreeks
100
+ fayela = lêer
101
+ phendula = uitset
102
+ amagama = woorde
@@ -0,0 +1,64 @@
1
+ """
2
+ CMT-SALanguages — English (South African)
3
+
4
+ English is already Python's native language, so this module is mostly a
5
+ pass-through. It exists so the 11th official SA language has an entry in
6
+ this collection, and adds a few South African English colloquialisms as
7
+ optional extra keywords (e.g. "howzit" as a greeting print shortcut).
8
+
9
+ Usage:
10
+ from CMT_SALanguages import english as CAL
11
+ CAL.sebenza('print("Howzit South Africa!")')
12
+ """
13
+
14
+ from . import _engine as _e
15
+
16
+ LANGUAGE_NAME = "English (South Africa)"
17
+
18
+ # English IS Python — no reserved-word translation needed.
19
+ KEYWORDS = {}
20
+
21
+ # A few South African English colloquial aliases for built-ins
22
+ CALLABLE_KEYWORDS = {
23
+ "howzit": "print", # SA greeting slang -> print
24
+ "lekker": "print", # "nice" -> also maps to print for fun
25
+ "shout": "print",
26
+ "ask": "input",
27
+ "size": "len",
28
+ }
29
+
30
+ METHOD_KEYWORDS = {}
31
+
32
+ MODULE_AND_EXCEPTION_KEYWORDS = {}
33
+
34
+ ALL_KEYWORDS = {**KEYWORDS, **CALLABLE_KEYWORDS, **METHOD_KEYWORDS, **MODULE_AND_EXCEPTION_KEYWORDS}
35
+
36
+
37
+ def transpile(code: str) -> str:
38
+ return _e.transpile(code, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
39
+
40
+
41
+ def sebenza(code: str):
42
+ _e.run_code(code, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
43
+
44
+
45
+ def fayela(path: str):
46
+ _e.run_file(path, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
47
+
48
+
49
+ def phendula(code: str) -> str:
50
+ return _e.get_output(code, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
51
+
52
+
53
+ def amagama():
54
+ _e.print_keywords(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
55
+
56
+
57
+ def shwela():
58
+ _e.live_editor(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
59
+
60
+
61
+ run = sebenza
62
+ run_code = sebenza
63
+ guqula = transpile
64
+ live = shwela
@@ -0,0 +1,101 @@
1
+ """
2
+ CMT-SALanguages — isiNdebele
3
+
4
+ Usage:
5
+ from CMT_SALanguages import isindebele as CAL
6
+ CAL.sebenza('print_ndebele("Lotjhani!")')
7
+ """
8
+
9
+ from . import _engine as _e
10
+
11
+ LANGUAGE_NAME = "isiNdebele"
12
+
13
+ KEYWORDS = {
14
+ "uma": "if", "kobe": "elif", "kodwana": "else", "lokha": "while",
15
+ "ngakho": "for", "ku": "in", "yima": "break", "qhubeka": "continue",
16
+ "yeyisa": "pass", "sebenza": "def", "isigaba": "class", "buyisela": "return",
17
+ "lo": "self", "_thoma_": "__init__", "_isigaba_": "__class__", "_ibizo_": "__name__",
18
+ "ngenisa": "import", "kusukela": "from", "iqiniso": "True", "amanga": "False",
19
+ "ize": "None", "begodu": "and", "namkha": "or", "nange": "not",
20
+ "zama": "try", "thintela": "except", "ekugcineni": "finally", "phakamisa": "raise",
21
+ "ngebanga": "lambda", "global": "global", "nonlocal": "nonlocal", "nge": "with",
22
+ "njenge": "as", "khipha": "yield", "qinisekisa": "assert", "susa": "del",
23
+ "ngokurhabako": "async", "linda": "await", "thelekisa": "match", "isimo": "case",
24
+ }
25
+
26
+ CALLABLE_KEYWORDS = {
27
+ "ibizo": "str", "inomba": "int", "inomba_ekhulu": "float", "irhelo": "list",
28
+ "isihlathululo": "dict", "isethi": "set", "iqiniso_amanga": "bool", "ibhayithi": "bytes",
29
+ "ithupula": "tuple", "print_ndebele": "print", "ubude": "len", "irenji": "range", "uhlobo": "type",
30
+ "faka": "input", "qala_uhlobo": "isinstance", "vula": "open", "hlela": "sorted",
31
+ "buyisela_emuva": "reversed", "hlanganisa": "zip", "yenza_kuyo_yoke": "map", "hlungela": "filter",
32
+ "ihlanganisela": "sum", "okukhulu": "max", "okuncani": "min", "kokukhe": "all",
33
+ "loyihlobo": "any", "bala_nenomba": "enumerate", "umkhulu": "super", "isilinganiso": "abs",
34
+ "buyisela_kude": "round", "usizo": "help", "tjengisa": "dir", "isazisi": "id", "okubili": "bin",
35
+ "okulitjhumi_nesithandathu": "hex", "okusiyazi_8": "oct", "amandla": "pow",
36
+ "phinda": "iter", "okulandelako": "next", "umfaneko": "property",
37
+ "indlela_yesigaba": "classmethod", "indlela_engatjhugulukiko": "staticmethod",
38
+ }
39
+
40
+ METHOD_KEYWORDS = {
41
+ "vala": "close", "tlola": "write", "funda": "read", "funda_imigca": "readlines",
42
+ "tlola_imigca": "writelines", "hlela_isimo": "format", "ahlukanisa": "split",
43
+ "hlanganisa_amagama": "join", "susa_isikhala": "strip", "tjhugulula": "replace",
44
+ "okukhulwana": "upper", "okuncanyana": "lower", "thoma_nge": "startswith", "phela_nge": "endswith",
45
+ "thola": "find", "bala_izinto": "count", "hlomelela": "append", "hlomelela_koke": "extend",
46
+ "faka_endaweni": "insert", "khipha_engenhla": "pop", "susa_into": "remove", "hlwengisa": "clear",
47
+ "kobisa": "copy", "amakhiya": "keys", "amanani": "values", "izinto": "items",
48
+ "thola_ngekhiya": "get", "thuthukisa": "update",
49
+ }
50
+
51
+ MODULE_AND_EXCEPTION_KEYWORDS = {
52
+ "isiphazamiso": "Exception", "isiphazamiso_senani": "ValueError", "isiphazamiso_sehlobo": "TypeError",
53
+ "isiphazamiso_senomba": "IndexError", "isiphazamiso_sekhiya": "KeyError",
54
+ "isiphazamiso_sefayela": "FileNotFoundError", "isiphazamiso_sokuhlukanisa": "ZeroDivisionError",
55
+ "isiphazamiso_somfaneko": "AttributeError", "isiphazamiso_sokungenisa": "ImportError",
56
+ "isiphazamiso_sokusebenza": "RuntimeError", "ukuphela_kokulandelelana": "StopIteration",
57
+ "izibalo": "math", "ngokungahlelekileko": "random", "isikhathi": "datetime",
58
+ "uhlelo_lwefayela": "os", "uhlelo_lwesistimu": "sys", "indlela_yefayela": "pathlib",
59
+ "amathuluzi_omfanekiso": "matplotlib", "ukuhlathululwa_kwedatha": "pandas",
60
+ "amanomba_ahlelekileko": "numpy", "ukucindezelwa": "threading",
61
+ "iinqubo_ezinengi": "multiprocessing", "indlela_yamagama": "re", "izicelo": "requests",
62
+ "isisekelo_sedatha": "sqlite3", "iwebhu": "flask", "ibalo": "Counter",
63
+ "umqobo": "deque", "isihlathululo_esizenzakalelako": "defaultdict",
64
+ "ithupula_eqanjwe": "namedtuple", "uchungechunge_lwesihlathululo": "ChainMap",
65
+ "isihlathululo_esilandelako": "OrderedDict",
66
+ }
67
+
68
+ ALL_KEYWORDS = {**KEYWORDS, **CALLABLE_KEYWORDS, **METHOD_KEYWORDS, **MODULE_AND_EXCEPTION_KEYWORDS}
69
+
70
+
71
+ def transpile(ikhowudu: str) -> str:
72
+ return _e.transpile(ikhowudu, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
73
+
74
+
75
+ def sebenza_kwakhona(ikhowudu: str):
76
+ _e.run_code(ikhowudu, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
77
+
78
+
79
+ def ifayela(indlela: str):
80
+ _e.run_file(indlela, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
81
+
82
+
83
+ def imphendulo(ikhowudu: str) -> str:
84
+ return _e.get_output(ikhowudu, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
85
+
86
+
87
+ def amagama():
88
+ _e.print_keywords(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
89
+
90
+
91
+ def ukuphila():
92
+ _e.live_editor(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
93
+
94
+
95
+ run = sebenza_kwakhona
96
+ run_code = sebenza_kwakhona
97
+ sebenza = sebenza_kwakhona
98
+ guqula = transpile
99
+ live = ukuphila
100
+ fayela = ifayela
101
+ phendula = imphendulo
@@ -0,0 +1,101 @@
1
+ """
2
+ CMT-SALanguages — isiXhosa
3
+
4
+ Usage:
5
+ from CMT_SALanguages import isixhosa as CAL
6
+ CAL.sebenza('shicilela("Molo!")')
7
+ """
8
+
9
+ from . import _engine as _e
10
+
11
+ LANGUAGE_NAME = "isiXhosa"
12
+
13
+ KEYWORDS = {
14
+ "ukuba": "if", "okanye": "elif", "ngokunye": "else", "ngelixa": "while",
15
+ "ngalo": "for", "ku": "in", "yeka": "break", "qhubeka": "continue",
16
+ "yedlulisa": "pass", "yenza": "def", "udidi": "class", "buyisela": "return",
17
+ "lo": "self", "_qala_": "__init__", "_udidi_": "__class__", "_igama_": "__name__",
18
+ "ngenisa": "import", "ukususela": "from", "yinyaniso": "True", "ubuxoki": "False",
19
+ "akukho": "None", "kunye": "and", "okanyenye": "or", "akuyiyo": "not",
20
+ "zama": "try", "phantse": "except", "ekugqibeleni": "finally", "phakamisa": "raise",
21
+ "ngenxa": "lambda", "global": "global", "nonlocal": "nonlocal", "nge": "with",
22
+ "ngoku": "as", "velisa": "yield", "qinisekisa": "assert", "cima": "del",
23
+ "ngokukhawuleza": "async", "linda": "await", "thelekisa": "match", "imeko": "case",
24
+ }
25
+
26
+ CALLABLE_KEYWORDS = {
27
+ "igama": "str", "inombolo": "int", "inombolo_enkulu": "float", "uluhlu": "list",
28
+ "isichazi": "dict", "iseti": "set", "yinyaniso_ubuxoki": "bool", "izinto_zekhowudi": "bytes",
29
+ "iqela": "tuple", "shicilela": "print", "ubude": "len", "uluhlu_lwamanani": "range", "uhlobo": "type",
30
+ "faka": "input", "jonga_uhlobo": "isinstance", "vula": "open", "hlela": "sorted",
31
+ "buyisela_emva": "reversed", "manyanisa": "zip", "senza": "map", "cola": "filter",
32
+ "hlanganisa": "sum", "okukhulu": "max", "okuncinci": "min", "konke": "all",
33
+ "nakuphi": "any", "balula": "enumerate", "ndlovu": "super", "elilodwa": "abs",
34
+ "qengqeleza": "round", "nceda": "help", "khombisa": "dir", "isazisi": "id", "okubini": "bin",
35
+ "ishumi_elinesithandathu": "hex", "okusibhozo": "oct", "amandla": "pow",
36
+ "phinda": "iter", "okulandelayo": "next", "umhlobiso": "property",
37
+ "kudidi": "classmethod", "kwemiyo": "staticmethod",
38
+ }
39
+
40
+ METHOD_KEYWORDS = {
41
+ "vala": "close", "bhala": "write", "funda": "read", "funda_imigca": "readlines",
42
+ "bhala_imigca": "writelines", "lungelelanisa": "format", "qhekeza": "split",
43
+ "manyanisa_amagama": "join", "susa_izithuba": "strip", "faka_endaweni": "replace",
44
+ "phezulu": "upper", "ezantsi": "lower", "qala_nge": "startswith", "phela_nge": "endswith",
45
+ "fumana": "find", "bala": "count", "ongeza": "append", "ongeza_konke": "extend",
46
+ "faka_kwindawo": "insert", "khupha": "pop", "susa_into": "remove", "cima_konke": "clear",
47
+ "kopa": "copy", "izitshixo": "keys", "amaxabiso": "values", "izinto": "items",
48
+ "fumana_isitshixo": "get", "hlaziya": "update",
49
+ }
50
+
51
+ MODULE_AND_EXCEPTION_KEYWORDS = {
52
+ "impazamo": "Exception", "impazamo_yexabiso": "ValueError", "impazamo_yohlobo": "TypeError",
53
+ "impazamo_yenombolo": "IndexError", "impazamo_yesitshixo": "KeyError",
54
+ "impazamo_yefayile": "FileNotFoundError", "impazamo_yokwahlula": "ZeroDivisionError",
55
+ "impazamo_yepropati": "AttributeError", "impazamo_yokungenisa": "ImportError",
56
+ "impazamo_yokusebenza": "RuntimeError", "impazamo_yokuphela": "StopIteration",
57
+ "izibalo": "math", "ngokungahleliwe": "random", "ixesha": "datetime",
58
+ "inkqubo_yefayile": "os", "inkqubo_yesistim": "sys", "indlela_yefayile": "pathlib",
59
+ "izixhobo_zomzobo": "matplotlib", "uhlalutyo": "pandas",
60
+ "amanani_alungelelaniswe": "numpy", "ukucinezela": "threading",
61
+ "iinkqubo": "multiprocessing", "umgaqo_wamagama": "re", "izicelo": "requests",
62
+ "isiseko_sedatha": "sqlite3", "iwebhu": "flask", "isibalo": "Counter",
63
+ "ikhwelo": "deque", "isichazi_esizenzekelayo": "defaultdict",
64
+ "iqela_elibhalwe": "namedtuple", "uchungechunge_lwezichazi": "ChainMap",
65
+ "isichazi_esilandelayo": "OrderedDict",
66
+ }
67
+
68
+ ALL_KEYWORDS = {**KEYWORDS, **CALLABLE_KEYWORDS, **METHOD_KEYWORDS, **MODULE_AND_EXCEPTION_KEYWORDS}
69
+
70
+
71
+ def transpile(ikhowudi: str) -> str:
72
+ return _e.transpile(ikhowudi, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
73
+
74
+
75
+ def yenza_lo(ikhowudi: str):
76
+ _e.run_code(ikhowudi, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
77
+
78
+
79
+ def ifayile(indlela: str):
80
+ _e.run_file(indlela, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
81
+
82
+
83
+ def impendulo(ikhowudi: str) -> str:
84
+ return _e.get_output(ikhowudi, KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS)
85
+
86
+
87
+ def amagama():
88
+ _e.print_keywords(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
89
+
90
+
91
+ def shwela():
92
+ _e.live_editor(KEYWORDS, CALLABLE_KEYWORDS, METHOD_KEYWORDS, MODULE_AND_EXCEPTION_KEYWORDS, LANGUAGE_NAME)
93
+
94
+
95
+ run = yenza_lo
96
+ run_code = yenza_lo
97
+ sebenza = yenza_lo # cross-language alias for familiarity
98
+ guqula = transpile
99
+ live = shwela
100
+ fayela = ifayile
101
+ phendula = impendulo