pyscript-programming-language 1.13.1__tar.gz → 1.13.2__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.
- {pyscript_programming_language-1.13.1/pyscript_programming_language.egg-info → pyscript_programming_language-1.13.2}/PKG-INFO +1 -1
- pyscript_programming_language-1.13.2/changelog.md +7 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyproject.toml +1 -1
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/cache.py +14 -4
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/exceptions.py +1 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/interpreter.py +3 -10
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/mapping.py +3 -2
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/nodes.py +1 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/pysbuiltins.py +5 -1
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/results.py +1 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/shell.py +3 -2
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/token.py +2 -1
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/debug.py +5 -5
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/module.py +3 -1
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/version.py +2 -2
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ast/ast_literal_eval.py +10 -6
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/tokenize/tok_untokenize.py +3 -3
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2/pyscript_programming_language.egg-info}/PKG-INFO +1 -1
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/setup.py +1 -1
- pyscript_programming_language-1.13.1/changelog.md +0 -12
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/MANIFEST.in +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/README.md +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/__init__.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/__init__.pyi +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/__main__.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/__init__.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/analyzer.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/bases.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/buffer.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/checks.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/constants.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/context.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/editor/__init__.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/editor/bases.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/editor/gui.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/editor/terminal.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/handlers.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/highlight.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/lexer.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/parser.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/position.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/pystypes.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/runner.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/symtab.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/__init__.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/ansi.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/decorators.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/generic.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/path.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/similarity.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/utils/string.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/__hello__.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ansi.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ast/__init__.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ast/ast_dump.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ast/ast_unparse.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ast/ast_walk.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/brainfuck.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/code.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/dis.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/explorer.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/fpstimer/__init__.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/fpstimer/py_fpstimer.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/getch/__init__.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/getch/py_getch.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/history.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/inspect.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/jsdict.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/keyword.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/opcode.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/parser.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/pdisplay.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/site.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/symtable.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/token.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/tokenize/__init__.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/.nomedia +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/PyScript.ico +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/copyright +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/credits +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/license +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/site-packages/this.pys +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/this.py +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript_programming_language.egg-info/SOURCES.txt +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript_programming_language.egg-info/requires.txt +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript_programming_language.egg-info/top_level.txt +0 -0
- {pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/setup.cfg +0 -0
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyproject.toml
RENAMED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pyscript-programming-language"
|
|
7
|
-
version = "1.13.
|
|
7
|
+
version = "1.13.2"
|
|
8
8
|
description = "PyScript Programming Language"
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
requires-python = ">=3.10"
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/cache.py
RENAMED
|
@@ -2,12 +2,14 @@ from .bases import Pys
|
|
|
2
2
|
from .constants import PYSCRIPT_PATH, CORE_PATH, LIBRARIES_PATH, SITE_PACKAGES_PATH, CONFIGURATIONS_PATH, DEFAULT
|
|
3
3
|
from .utils.debug import print_display, print_traceback, clear_shell
|
|
4
4
|
from .utils.decorators import inheritable, singleton
|
|
5
|
+
from .utils.module import get_module_candidate
|
|
5
6
|
from .utils.path import base
|
|
6
7
|
|
|
7
8
|
from types import ModuleType
|
|
8
9
|
from typing import Literal
|
|
9
10
|
|
|
10
11
|
import sys
|
|
12
|
+
import os
|
|
11
13
|
|
|
12
14
|
pys_sys = ModuleType(
|
|
13
15
|
'sys',
|
|
@@ -18,6 +20,11 @@ pys_sys = ModuleType(
|
|
|
18
20
|
|
|
19
21
|
pys_sys.__running_shell__ = False
|
|
20
22
|
pys_sys.__running_breakpoint__ = False
|
|
23
|
+
pys_sys.builtin_module_names = tuple(
|
|
24
|
+
os.path.splitext(module)[0]
|
|
25
|
+
for module in os.listdir(LIBRARIES_PATH)
|
|
26
|
+
if get_module_candidate(os.path.join(LIBRARIES_PATH, module)) is not None
|
|
27
|
+
)
|
|
21
28
|
pys_sys.path = [LIBRARIES_PATH, SITE_PACKAGES_PATH]
|
|
22
29
|
pys_sys.loading_modules = set()
|
|
23
30
|
pys_sys.modules = {}
|
|
@@ -32,16 +39,19 @@ pys_sys.core_path = CORE_PATH
|
|
|
32
39
|
pys_sys.libraries_path = LIBRARIES_PATH
|
|
33
40
|
pys_sys.site_packages_path = SITE_PACKAGES_PATH
|
|
34
41
|
pys_sys.configurations_path = CONFIGURATIONS_PATH
|
|
42
|
+
pys_sys.platlibdir = base(LIBRARIES_PATH)
|
|
35
43
|
pys_sys.executable = f'{base(sys.executable)} -m pyscript'
|
|
36
44
|
pys_sys.ps1 = '>>> '
|
|
37
45
|
pys_sys.ps2 = '... '
|
|
38
46
|
pys_sys._is_gil_enabled = lambda : pys_sys.gil
|
|
39
47
|
|
|
40
48
|
for name in (
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
49
|
+
'_clear_internal_caches', '_is_immortal', '_is_interned', 'byteorder', 'exit', 'float_info', 'float_repr_style',
|
|
50
|
+
'get_int_max_str_digits', 'getallocatedblocks', 'getdefaultencoding', 'getfilesystemencodeerrors',
|
|
51
|
+
'getfilesystemencoding', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval', 'gettotalrefcount',
|
|
52
|
+
'getunicodeinternedsize', 'hash_info', 'hexversion', 'int_info', 'intern', 'is_finalizing', 'maxsize', 'maxunicode',
|
|
53
|
+
'platform', 'set_int_max_str_digits', 'setrecursionlimit', 'setswitchinterval', 'stderr', 'stdin', 'stdout',
|
|
54
|
+
'thread_info'
|
|
45
55
|
):
|
|
46
56
|
if hasattr(sys, name):
|
|
47
57
|
setattr(pys_sys, name, getattr(sys, name))
|
|
@@ -22,16 +22,12 @@ from typing import Any, Callable
|
|
|
22
22
|
|
|
23
23
|
T_STRING = TOKENS['STRING']
|
|
24
24
|
T_AND = TOKENS['DOUBLE_AMPERSAND']
|
|
25
|
+
T_INCREMENT = TOKENS['DOUBLE_PLUS']
|
|
25
26
|
T_NULLISH = TOKENS['DOUBLE_QUESTION']
|
|
26
27
|
T_OR = TOKENS['DOUBLE_PIPE']
|
|
27
28
|
T_CE = TOKENS['EQUAL_TILDE']
|
|
28
29
|
T_NCE = TOKENS['EXCLAMATION_TILDE']
|
|
29
30
|
|
|
30
|
-
get_incremental_function = {
|
|
31
|
-
TOKENS['DOUBLE_PLUS']: increment,
|
|
32
|
-
TOKENS['DOUBLE_MINUS']: decrement
|
|
33
|
-
}.__getitem__
|
|
34
|
-
|
|
35
31
|
get_value_from_keyword = {
|
|
36
32
|
'True': True,
|
|
37
33
|
'False': False,
|
|
@@ -381,18 +377,15 @@ def visit_IncrementalNode(node: PysIncrementalNode, context: PysContext) -> PysR
|
|
|
381
377
|
result._context = context
|
|
382
378
|
result._position = nposition = node.position
|
|
383
379
|
with result:
|
|
384
|
-
function =
|
|
380
|
+
function = increment if node.operand.type == T_INCREMENT else decrement
|
|
385
381
|
handle_call(function, context, nposition)
|
|
386
382
|
increast_value = function(value)
|
|
387
383
|
|
|
388
|
-
if node.operand_position == 'left':
|
|
389
|
-
value = increast_value
|
|
390
|
-
|
|
391
384
|
register(visit_declaration_from_AssignmentNode(ntarget, context, increast_value))
|
|
392
385
|
if should_return():
|
|
393
386
|
return result
|
|
394
387
|
|
|
395
|
-
return result.success(value)
|
|
388
|
+
return result.success(increast_value if node.operand_position == 'left' else value)
|
|
396
389
|
|
|
397
390
|
return result
|
|
398
391
|
|
|
@@ -2,8 +2,9 @@ from .token import TOKENS
|
|
|
2
2
|
from .utils.ansi import BOLD, acolor
|
|
3
3
|
|
|
4
4
|
from operator import (
|
|
5
|
-
not_, is_, is_not, eq, ne, lt, gt, le, ge, add, sub, mul, truediv, floordiv, pow, matmul, mod, and_, or_, xor,
|
|
6
|
-
rshift, iadd, isub, imul, itruediv, ifloordiv, ipow, imatmul, imod, iand, ior, ixor, ilshift, irshift, pos,
|
|
5
|
+
not_, is_, is_not, eq, ne, lt, gt, le, ge, add, sub, mul, truediv, floordiv, pow, matmul, mod, and_, or_, xor,
|
|
6
|
+
lshift, rshift, iadd, isub, imul, itruediv, ifloordiv, ipow, imatmul, imod, iand, ior, ixor, ilshift, irshift, pos,
|
|
7
|
+
neg, inv
|
|
7
8
|
)
|
|
8
9
|
from types import MappingProxyType
|
|
9
10
|
|
|
@@ -195,6 +195,7 @@ def require(context, position, name):
|
|
|
195
195
|
except BaseException as e:
|
|
196
196
|
raise ImportError(f"Cannot import module named {name!r}: {e}") from e
|
|
197
197
|
|
|
198
|
+
# circular import problem solved
|
|
198
199
|
from .runner import pys_runner
|
|
199
200
|
|
|
200
201
|
symbol_table, module = new_module_namespace(file=module_path, name=base(path))
|
|
@@ -256,6 +257,7 @@ def breakpoint(context, position):
|
|
|
256
257
|
if getattr(pys_sys, '__running_breakpoint__', False):
|
|
257
258
|
raise RuntimeError("another breakpoint is still running")
|
|
258
259
|
|
|
260
|
+
# circular import problem solved
|
|
259
261
|
from .runner import pys_runner
|
|
260
262
|
|
|
261
263
|
flags = context.flags
|
|
@@ -373,7 +375,7 @@ def globals(context, position):
|
|
|
373
375
|
result = {}
|
|
374
376
|
|
|
375
377
|
while symbol_table:
|
|
376
|
-
result
|
|
378
|
+
result = symbol_table.symbols | result
|
|
377
379
|
symbol_table = symbol_table.parent
|
|
378
380
|
|
|
379
381
|
return result
|
|
@@ -431,6 +433,7 @@ def exec(context, position, source, globals=None):
|
|
|
431
433
|
if not isinstance(globals, optional_mapping):
|
|
432
434
|
raise TypeError("exec(): globals must be dict")
|
|
433
435
|
|
|
436
|
+
# circular import problem solved
|
|
434
437
|
from .runner import pys_runner
|
|
435
438
|
|
|
436
439
|
result = pys_runner(
|
|
@@ -460,6 +463,7 @@ def eval(context, position, source, globals=None):
|
|
|
460
463
|
if not isinstance(globals, optional_mapping):
|
|
461
464
|
raise TypeError("eval(): globals must be dict")
|
|
462
465
|
|
|
466
|
+
# circular import problem solved
|
|
463
467
|
from .runner import pys_runner
|
|
464
468
|
|
|
465
469
|
result = pys_runner(
|
|
@@ -175,6 +175,7 @@ class PysExecuteResult(PysResult):
|
|
|
175
175
|
elif type(self.error.exception) is SystemExit:
|
|
176
176
|
return self.error.exception.code, True
|
|
177
177
|
elif (excepthook := pys_sys.excepthook) is not None:
|
|
178
|
+
# circular import problem solved
|
|
178
179
|
from .handlers import handle_call
|
|
179
180
|
handle_call(excepthook, context, position)
|
|
180
181
|
excepthook(*get_traceback_info(self.error))
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/shell.py
RENAMED
|
@@ -255,6 +255,8 @@ try:
|
|
|
255
255
|
if os.path.isfile(HISTORY_PATH):
|
|
256
256
|
|
|
257
257
|
def add_to_string():
|
|
258
|
+
if not lines:
|
|
259
|
+
return
|
|
258
260
|
strings.append('\n'.join(lines))
|
|
259
261
|
lines.clear()
|
|
260
262
|
|
|
@@ -267,8 +269,7 @@ try:
|
|
|
267
269
|
line = line[1:]
|
|
268
270
|
lines.append(line)
|
|
269
271
|
|
|
270
|
-
|
|
271
|
-
add_to_string()
|
|
272
|
+
add_to_string()
|
|
272
273
|
|
|
273
274
|
else:
|
|
274
275
|
update_history = True
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/token.py
RENAMED
|
@@ -6,6 +6,7 @@ from types import MappingProxyType
|
|
|
6
6
|
from typing import TYPE_CHECKING, Any, Optional
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
|
+
# circular import problem solved
|
|
9
10
|
from .position import PysPosition
|
|
10
11
|
|
|
11
12
|
DOUBLE = 2**8
|
|
@@ -102,7 +103,7 @@ class PysToken(Pys):
|
|
|
102
103
|
if TYPECHECK_STACK > 0:
|
|
103
104
|
if not isinstance(type, int):
|
|
104
105
|
raise TypeError('type must be integer')
|
|
105
|
-
# circular import solved
|
|
106
|
+
# circular import problem solved
|
|
106
107
|
from .position import PysPosition
|
|
107
108
|
if not isinstance(position, PysPosition):
|
|
108
109
|
raise TypeError('position must be pyscript.core.position.PysPosition')
|
|
@@ -16,14 +16,14 @@ def print_display(value: Any) -> None:
|
|
|
16
16
|
def print_traceback(exc_type: type[BaseException], exc_value: BaseException | None, exc_tb: PysTraceback) -> None:
|
|
17
17
|
print(exc_tb.string_traceback(), file=sys.stderr)
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def pys_excepthook(exc_type: type[BaseException], exc_value: BaseException | None, exc_tb: TracebackType) -> None:
|
|
20
20
|
if exc_type is PysSignal and (traceback := exc_value.result.error) is not None:
|
|
21
21
|
print_traceback(None, None, traceback)
|
|
22
22
|
print('\nThe above PyScript exception was the direct cause of the following exception:\n', file=sys.stderr)
|
|
23
23
|
excepthook(exc_type, exc_value, exc_tb)
|
|
24
24
|
|
|
25
|
-
def
|
|
26
|
-
|
|
25
|
+
def single_excepthook(args) -> None:
|
|
26
|
+
pys_excepthook(args.exc_type, args.exc_value, args.exc_traceback)
|
|
27
27
|
|
|
28
28
|
def import_readline() -> Literal[False]:
|
|
29
29
|
return False
|
|
@@ -75,5 +75,5 @@ def get_traceback_info(traceback: PysTraceback | None) -> tuple[type[BaseExcepti
|
|
|
75
75
|
if not is_environ(ENV_PYSCRIPT_NO_EXCEPTHOOK):
|
|
76
76
|
import threading
|
|
77
77
|
|
|
78
|
-
sys.excepthook =
|
|
79
|
-
threading.excepthook =
|
|
78
|
+
sys.excepthook = pys_excepthook
|
|
79
|
+
sys.unraisablehook = threading.excepthook = single_excepthook
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from ..cache import pys_sys
|
|
2
1
|
from .path import getcwd, extension, normpath
|
|
3
2
|
|
|
4
3
|
import os
|
|
@@ -20,6 +19,9 @@ def get_module_candidate(path: str, entry: str = '__init__') -> str | None:
|
|
|
20
19
|
return candidate
|
|
21
20
|
|
|
22
21
|
def find_module_path(filename: str | None, name: str, entry: str = '__init__') -> tuple[str | None, str | None]:
|
|
22
|
+
# circular import problem solved
|
|
23
|
+
from ..cache import pys_sys
|
|
24
|
+
|
|
23
25
|
for path in pys_sys.path:
|
|
24
26
|
path = normpath(path, name)
|
|
25
27
|
module_path = get_module_candidate(path, entry)
|
|
@@ -6,8 +6,8 @@ from types import MappingProxyType
|
|
|
6
6
|
|
|
7
7
|
import re
|
|
8
8
|
|
|
9
|
-
__version__ = '1.13.
|
|
10
|
-
__date__ = '
|
|
9
|
+
__version__ = '1.13.2'
|
|
10
|
+
__date__ = '27 May 2026, 12:30 UTC+7'
|
|
11
11
|
__author__ = ('Azzam Muhyala',)
|
|
12
12
|
|
|
13
13
|
version = pys_sys.version = f'{__version__} ({__date__})'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from pyscript.core.interpreter import get_value_from_keyword
|
|
2
|
-
from pyscript.core.mapping import GET_BINARY_FUNCTION, GET_UNARY_FUNCTION
|
|
3
2
|
from pyscript.core.nodes import (
|
|
4
3
|
PysNode, PysNumberNode, PysStringNode, PysKeywordNode, PysIdentifierNode, PysDictionaryNode, PysSetNode,
|
|
5
4
|
PysListNode, PysTupleNode, PysCallNode, PysUnaryOperatorNode, PysBinaryOperatorNode, PysEllipsisNode
|
|
@@ -11,7 +10,8 @@ from pyscript.core.token import TOKENS, REVERSE_TOKENS
|
|
|
11
10
|
from types import EllipsisType
|
|
12
11
|
from typing import Any, Callable
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
T_ADD = TOKENS['PLUS']
|
|
14
|
+
T_SUB = TOKENS['MINUS']
|
|
15
15
|
|
|
16
16
|
get_identifier = {
|
|
17
17
|
'Ellipsis': pys_builtins.Ellipsis,
|
|
@@ -72,14 +72,18 @@ def visit_CallNode(node: PysCallNode) -> set:
|
|
|
72
72
|
|
|
73
73
|
def visit_UnaryOperatorNode(node: PysUnaryOperatorNode) -> Any:
|
|
74
74
|
operand = node.operand.type
|
|
75
|
-
if
|
|
76
|
-
return
|
|
75
|
+
if operand == T_SUB:
|
|
76
|
+
return -visit(node.value)
|
|
77
|
+
elif operand == T_ADD:
|
|
78
|
+
return +visit(node.value)
|
|
77
79
|
raise _error(ValueError(f"invalid unary operator node: {REVERSE_TOKENS[operand]}"), node.position)
|
|
78
80
|
|
|
79
81
|
def visit_BinaryOperatorNode(node: PysBinaryOperatorNode) -> Any:
|
|
80
82
|
operand = node.operand.type
|
|
81
|
-
if
|
|
82
|
-
return
|
|
83
|
+
if operand == T_ADD:
|
|
84
|
+
return visit(node.left) + visit(node.right)
|
|
85
|
+
elif operand == T_SUB:
|
|
86
|
+
return visit(node.left) - visit(node.right)
|
|
83
87
|
raise _error(ValueError(f"invalid binary operator node: {REVERSE_TOKENS[operand]}"), node.position)
|
|
84
88
|
|
|
85
89
|
def visit_EllipsisNode(node: PysEllipsisNode) -> EllipsisType:
|
|
@@ -10,14 +10,14 @@ from typing import Iterable
|
|
|
10
10
|
@inheritable
|
|
11
11
|
@singleton
|
|
12
12
|
class TokenValueError:
|
|
13
|
-
|
|
14
13
|
def __repr__(self):
|
|
15
14
|
return '\\ERROR'
|
|
16
15
|
|
|
17
16
|
token_value_error = TokenValueError()
|
|
18
17
|
|
|
19
|
-
def untokenize(iterable: Iterable[PysToken]) -> str:
|
|
18
|
+
def untokenize(iterable: Iterable[PysToken], *, indent: int = 4) -> str:
|
|
20
19
|
iterable = tuple(iterable)
|
|
20
|
+
indent_character = ' ' * indent
|
|
21
21
|
|
|
22
22
|
parts = []
|
|
23
23
|
add_space = False
|
|
@@ -51,7 +51,7 @@ def untokenize(iterable: Iterable[PysToken]) -> str:
|
|
|
51
51
|
if brackets_stack > 0 and is_right_bracket(get_sequence(iterable, i + 1, token).type) else
|
|
52
52
|
brackets_stack
|
|
53
53
|
)
|
|
54
|
-
parts.append(f'\n{
|
|
54
|
+
parts.append(f'\n{indent_character * stack}')
|
|
55
55
|
newline = True
|
|
56
56
|
add_space = False
|
|
57
57
|
continue
|
|
@@ -9,7 +9,7 @@ with open('./README.md', 'r', encoding='utf-8') as file:
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name='pyscript-programming-language',
|
|
12
|
-
version='1.13.
|
|
12
|
+
version='1.13.2',
|
|
13
13
|
description='PyScript Programming Language',
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type='text/markdown',
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Change Logs
|
|
2
|
-
|
|
3
|
-
## [1.13.1] - 16/05/2026
|
|
4
|
-
|
|
5
|
-
### Added
|
|
6
|
-
- `__builtins__` is available in the module namespace.
|
|
7
|
-
- The editor can save multiple configurations.
|
|
8
|
-
|
|
9
|
-
### Fixed
|
|
10
|
-
- Changed the order of `instanceof` operation.
|
|
11
|
-
- Fixed some bugs.
|
|
12
|
-
- _etc._
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/__init__.py
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/__init__.pyi
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/bases.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/core/lexer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/ansi.pys
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/code.pys
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/dis.pys
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/site.pys
RENAMED
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/lib/token.pys
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/credits
RENAMED
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/other/license
RENAMED
|
File without changes
|
|
File without changes
|
{pyscript_programming_language-1.13.1 → pyscript_programming_language-1.13.2}/pyscript/this.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|