pyscript-programming-language 1.12.10__tar.gz → 1.12.11__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.12.10 → pyscript_programming_language-1.12.11}/PKG-INFO +1 -1
- pyscript_programming_language-1.12.11/changelog.md +13 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyproject.toml +1 -1
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/__main__.py +71 -63
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/cache.py +13 -22
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/editor/gui.py +5 -3
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/exceptions.py +9 -3
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/interpreter.py +111 -70
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/mapping.py +0 -2
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/parser.py +3 -3
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/pysbuiltins.py +19 -25
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/results.py +3 -6
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/runner.py +3 -1
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/shell.py +36 -43
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/token.py +2 -2
- pyscript_programming_language-1.12.11/pyscript/core/utils/module.py +42 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/path.py +2 -5
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/version.py +2 -2
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/ast/ast_literal_eval.py +3 -3
- pyscript_programming_language-1.12.11/pyscript/lib/site.pys +131 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/tokenize/__init__.pys +2 -1
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript_programming_language.egg-info/PKG-INFO +1 -1
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/setup.py +1 -1
- pyscript_programming_language-1.12.10/changelog.md +0 -20
- pyscript_programming_language-1.12.10/pyscript/core/utils/module.py +0 -27
- pyscript_programming_language-1.12.10/pyscript/lib/site.pys +0 -55
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/MANIFEST.in +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/README.md +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/__init__.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/__init__.pyi +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/__init__.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/analyzer.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/bases.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/buffer.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/checks.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/constants.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/context.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/editor/__init__.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/editor/bases.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/editor/terminal.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/handlers.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/highlight.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/lexer.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/nodes.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/position.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/pystypes.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/symtab.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/__init__.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/ansi.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/debug.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/decorators.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/generic.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/similarity.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/core/utils/string.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/__hello__.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/ansi.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/ast/__init__.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/ast/ast_dump.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/ast/ast_unparse.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/ast/ast_walk.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/brainfuck.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/code.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/dis.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/explorer.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/fpstimer/__init__.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/fpstimer/py_fpstimer.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/getch/__init__.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/getch/py_getch.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/history.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/inspect.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/jsdict.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/keyword.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/opcode.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/parser.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/pdisplay.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/symtable.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/token.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/lib/tokenize/tok_untokenize.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/other/.nomedia +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/other/PyScript.ico +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/other/copyright +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/other/credits +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/other/license +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/site-packages/this.pys +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript/this.py +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript_programming_language.egg-info/SOURCES.txt +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript_programming_language.egg-info/requires.txt +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/pyscript_programming_language.egg-info/top_level.txt +0 -0
- {pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/setup.cfg +0 -0
{pyscript_programming_language-1.12.10 → pyscript_programming_language-1.12.11}/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.12.
|
|
7
|
+
version = "1.12.11"
|
|
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.12.10 → pyscript_programming_language-1.12.11}/pyscript/__main__.py
RENAMED
|
@@ -12,8 +12,8 @@ from .core.highlight import (
|
|
|
12
12
|
from .core.runner import _normalize_namespace, pys_runner, pys_shell
|
|
13
13
|
from .core.utils.debug import USE_NOTEBOOK
|
|
14
14
|
from .core.utils.generic import is_environ
|
|
15
|
-
from .core.utils.module import remove_python_path
|
|
16
|
-
from .core.utils.path import getcwd,
|
|
15
|
+
from .core.utils.module import find_module_path, remove_python_path
|
|
16
|
+
from .core.utils.path import getcwd, base, normpath
|
|
17
17
|
from .core.version import __version__
|
|
18
18
|
|
|
19
19
|
if PYGMENTS:
|
|
@@ -52,7 +52,7 @@ for supported, name, class_editor in [
|
|
|
52
52
|
EDITOR_MAP[name] = class_editor
|
|
53
53
|
|
|
54
54
|
parser = ArgumentParser(
|
|
55
|
-
prog=f'{
|
|
55
|
+
prog=f'{base(sys.executable)} -m pyscript',
|
|
56
56
|
description=f'PyScript Launcher for Python Version {".".join(map(str, sys.version_info))}'
|
|
57
57
|
)
|
|
58
58
|
|
|
@@ -66,6 +66,7 @@ parser.add_argument(
|
|
|
66
66
|
'-c', '--command',
|
|
67
67
|
type=str,
|
|
68
68
|
default=None,
|
|
69
|
+
metavar='STRING',
|
|
69
70
|
help="execute program from a string argument",
|
|
70
71
|
)
|
|
71
72
|
|
|
@@ -102,6 +103,14 @@ parser.add_argument(
|
|
|
102
103
|
help="generate highlight code from a 'file'"
|
|
103
104
|
)
|
|
104
105
|
|
|
106
|
+
parser.add_argument(
|
|
107
|
+
'-m', '--module',
|
|
108
|
+
type=str,
|
|
109
|
+
default=None,
|
|
110
|
+
metavar='NAME',
|
|
111
|
+
help="run library module as a script"
|
|
112
|
+
)
|
|
113
|
+
|
|
105
114
|
parser.add_argument(
|
|
106
115
|
'-n', '--no-color',
|
|
107
116
|
action='store_true',
|
|
@@ -118,6 +127,7 @@ parser.add_argument(
|
|
|
118
127
|
'-r', '--py-recursion',
|
|
119
128
|
type=int,
|
|
120
129
|
default=None,
|
|
130
|
+
metavar='UINTEGER',
|
|
121
131
|
help="set a Python recursion limit"
|
|
122
132
|
)
|
|
123
133
|
|
|
@@ -169,11 +179,16 @@ file_idx = sum(1 for arg in argv if arg.startswith('-'))
|
|
|
169
179
|
end_idx = argv.index('--', 0, file_idx) if '--' in argv[:file_idx] else -1
|
|
170
180
|
end_com = file_idx if end_idx == -1 else end_idx
|
|
171
181
|
arg_com = argv[:end_com]
|
|
182
|
+
|
|
172
183
|
com_idx = argv.index('-c', 0, end_com) if '-c' in arg_com else \
|
|
173
184
|
(argv.index('--command', 0, end_com) if '--command' in arg_com else -1)
|
|
185
|
+
mod_idx = argv.index('-m', 0, end_com) if '-m' in arg_com else \
|
|
186
|
+
(argv.index('--module', 0, end_com) if '--module' in arg_com else -1)
|
|
187
|
+
|
|
188
|
+
ofs_idx = max(com_idx, mod_idx)
|
|
174
189
|
|
|
175
|
-
args = parser.parse_args(argv if
|
|
176
|
-
arg = args.arg if
|
|
190
|
+
args = parser.parse_args(argv if ofs_idx == -1 else argv[:ofs_idx + 2])
|
|
191
|
+
arg = args.arg if ofs_idx == -1 else argv[ofs_idx + 2:]
|
|
177
192
|
|
|
178
193
|
if args.terminal:
|
|
179
194
|
|
|
@@ -238,8 +253,8 @@ try:
|
|
|
238
253
|
del (
|
|
239
254
|
ENV_PYSCRIPT_NO_COLOR_PROMPT, ENV_PYSCRIPT_CLASSIC_LINE_SHELL, DEFAULT, DEBUG, CLASSIC_LINE_SHELL,
|
|
240
255
|
NO_COLOR_PROMPT, NOTEBOOK, GUI_SUPPORT, TERMINAL_SUPPORT, PYGMENTS, HLFMT_ANSI, HLFMT_HTML, HLFMT_BBCODE,
|
|
241
|
-
USE_NOTEBOOK, OPTIONAL, REMAINDER, file_idx, end_idx, end_com, arg_com, com_idx, arg, pys_sys,
|
|
242
|
-
is_environ, remove_python_path, getcwd,
|
|
256
|
+
USE_NOTEBOOK, OPTIONAL, REMAINDER, file_idx, end_idx, end_com, arg_com, com_idx, mod_idx, ofs_idx, arg, pys_sys,
|
|
257
|
+
__version__, is_environ, remove_python_path, getcwd, base, PysGUIEditor, PysTerminalEditor, ArgumentParser
|
|
243
258
|
)
|
|
244
259
|
|
|
245
260
|
del (
|
|
@@ -248,30 +263,56 @@ try:
|
|
|
248
263
|
except:
|
|
249
264
|
pass
|
|
250
265
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
path = normpath(args.file)
|
|
254
|
-
|
|
266
|
+
def load_file(path):
|
|
267
|
+
file = PysFileBuffer('', path)
|
|
255
268
|
try:
|
|
256
269
|
with open(path, 'r', encoding='utf-8') as file:
|
|
257
270
|
file = PysFileBuffer(file, path)
|
|
258
271
|
except FileNotFoundError:
|
|
259
|
-
if EDITOR_MAP and args.editor:
|
|
260
|
-
|
|
261
|
-
else:
|
|
262
|
-
parser.error(f"can't open file {path!r}: No such file or directory")
|
|
272
|
+
if not (EDITOR_MAP and args.editor):
|
|
273
|
+
argument_error('file', f"can't open file \"{path}\": No such file or directory")
|
|
263
274
|
except PermissionError:
|
|
264
|
-
|
|
275
|
+
argument_error('file', f"can't open file \"{path}\": Permission denied")
|
|
265
276
|
except IsADirectoryError:
|
|
266
|
-
|
|
277
|
+
argument_error('file', f"can't open file \"{path}\": Path is not a file")
|
|
267
278
|
except NotADirectoryError:
|
|
268
|
-
|
|
279
|
+
argument_error('file', f"can't open file \"{path}\": Attempting to access directory from file")
|
|
269
280
|
except (OSError, IOError):
|
|
270
|
-
|
|
281
|
+
argument_error('file', f"can't open file \"{path}\": Attempting to access a system directory or file")
|
|
271
282
|
except UnicodeDecodeError:
|
|
272
|
-
|
|
283
|
+
argument_error('file', f"can't read file \"{path}\": Bad file")
|
|
273
284
|
except BaseException as e:
|
|
274
|
-
|
|
285
|
+
argument_error('file', f"file \"{path}\": Unexpected error: {e}")
|
|
286
|
+
return file
|
|
287
|
+
|
|
288
|
+
def execute(file):
|
|
289
|
+
result = pys_runner(
|
|
290
|
+
file=file,
|
|
291
|
+
mode='exec',
|
|
292
|
+
symbol_table=_normalize_namespace(undefined, file),
|
|
293
|
+
flags=flags
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
code, _ = result.end_process()
|
|
297
|
+
|
|
298
|
+
if args.inspect:
|
|
299
|
+
if sys.stdout.closed or sys.stderr.closed:
|
|
300
|
+
return 1
|
|
301
|
+
elif sys.stdin.closed:
|
|
302
|
+
print("Can't run interactive shell: sys.stdin closed", file=sys.stderr)
|
|
303
|
+
return 1
|
|
304
|
+
else:
|
|
305
|
+
return pys_shell(
|
|
306
|
+
globals=result.context.symbol_table,
|
|
307
|
+
flags=result.context.flags | DONT_SHOW_BANNER_ON_SHELL,
|
|
308
|
+
parser_flags=result.parser_flags
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
return code
|
|
312
|
+
|
|
313
|
+
if args.file is not None:
|
|
314
|
+
argv[0] = args.file
|
|
315
|
+
file = load_file(normpath(args.file))
|
|
275
316
|
|
|
276
317
|
if EDITOR_MAP and args.editor:
|
|
277
318
|
try:
|
|
@@ -300,53 +341,20 @@ if args.file is not None:
|
|
|
300
341
|
argument_error('-l/--highlight', e)
|
|
301
342
|
|
|
302
343
|
else:
|
|
303
|
-
|
|
304
|
-
file=file,
|
|
305
|
-
mode='exec',
|
|
306
|
-
symbol_table=_normalize_namespace(undefined, file),
|
|
307
|
-
flags=flags
|
|
308
|
-
)
|
|
344
|
+
code = execute(file)
|
|
309
345
|
|
|
310
|
-
|
|
346
|
+
elif args.module is not None:
|
|
347
|
+
_, module_path = find_module_path(None, args.module, '__main__')
|
|
348
|
+
if module_path is None:
|
|
349
|
+
argument_error('-m/--module', f"can't find module \"{args.module}\"")
|
|
311
350
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
elif sys.stdin.closed:
|
|
316
|
-
print("Can't run interactive shell: sys.stdin closed", file=sys.stderr)
|
|
317
|
-
code = 1
|
|
318
|
-
else:
|
|
319
|
-
code = pys_shell(
|
|
320
|
-
globals=result.context.symbol_table,
|
|
321
|
-
flags=result.context.flags | DONT_SHOW_BANNER_ON_SHELL,
|
|
322
|
-
parser_flags=result.parser_flags
|
|
323
|
-
)
|
|
351
|
+
file = load_file(module_path)
|
|
352
|
+
argv[0] = file.name
|
|
353
|
+
code = execute(file)
|
|
324
354
|
|
|
325
355
|
elif args.command is not None:
|
|
326
356
|
argv[0] = '-c'
|
|
327
|
-
|
|
328
|
-
file = PysFileBuffer(args.command, '<arg-command>')
|
|
329
|
-
result = pys_runner(
|
|
330
|
-
file=file,
|
|
331
|
-
mode='exec',
|
|
332
|
-
symbol_table=_normalize_namespace(undefined, file),
|
|
333
|
-
flags=flags
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
code, _ = result.end_process()
|
|
337
|
-
|
|
338
|
-
if args.inspect:
|
|
339
|
-
if sys.stdout.closed or sys.stderr.closed:
|
|
340
|
-
code = 1
|
|
341
|
-
elif sys.stdin.closed:
|
|
342
|
-
print("Can't run interactive shell: sys.stdin closed", file=sys.stderr)
|
|
343
|
-
code = 1
|
|
344
|
-
else:
|
|
345
|
-
code = pys_shell(
|
|
346
|
-
globals=result.context.symbol_table,
|
|
347
|
-
flags=result.context.flags | DONT_SHOW_BANNER_ON_SHELL,
|
|
348
|
-
parser_flags=result.parser_flags
|
|
349
|
-
)
|
|
357
|
+
code = execute(PysFileBuffer(args.command, '<arg-command>'))
|
|
350
358
|
|
|
351
359
|
else:
|
|
352
360
|
code = pys_shell(
|
|
@@ -17,40 +17,31 @@ pys_sys = ModuleType(
|
|
|
17
17
|
|
|
18
18
|
pys_sys.__running_shell__ = False
|
|
19
19
|
pys_sys.__running_breakpoint__ = False
|
|
20
|
+
pys_sys.path = [SITE_PACKAGES_PATH, LIBRARIES_PATH]
|
|
21
|
+
pys_sys.loading_modules = set()
|
|
22
|
+
pys_sys.modules = {}
|
|
23
|
+
pys_sys.singletons = {}
|
|
20
24
|
pys_sys.argv = ['']
|
|
21
25
|
pys_sys.flags = DEFAULT
|
|
22
26
|
pys_sys.displayhook = print_display
|
|
23
27
|
pys_sys.excepthook = print_traceback
|
|
24
28
|
pys_sys.clearhook = clear_shell
|
|
25
|
-
pys_sys.
|
|
29
|
+
pys_sys.pyscript_path = PYSCRIPT_PATH
|
|
26
30
|
pys_sys.core_path = CORE_PATH
|
|
27
31
|
pys_sys.libraries_path = LIBRARIES_PATH
|
|
28
32
|
pys_sys.site_packages_path = SITE_PACKAGES_PATH
|
|
29
33
|
pys_sys.executable = f'"{sys.executable}" -m pyscript'
|
|
30
34
|
pys_sys.ps1 = '>>> '
|
|
31
35
|
pys_sys.ps2 = '... '
|
|
32
|
-
pys_sys.float_info = sys.float_info
|
|
33
|
-
pys_sys.int_info = sys.int_info
|
|
34
|
-
pys_sys.hash_info = sys.hash_info
|
|
35
|
-
pys_sys.stderr = sys.stderr
|
|
36
|
-
pys_sys.stdout = sys.stdout
|
|
37
|
-
pys_sys.stdin = sys.stdin
|
|
38
|
-
pys_sys.platform = sys.platform
|
|
39
|
-
pys_sys.exit = sys.exit
|
|
40
|
-
pys_sys.getrecursionlimit = sys.getrecursionlimit
|
|
41
|
-
pys_sys.getrefcount = sys.getrefcount
|
|
42
|
-
pys_sys.getsizeof = sys.getsizeof
|
|
43
|
-
pys_sys.setrecursionlimit = sys.setrecursionlimit
|
|
44
|
-
|
|
45
|
-
# added in python>=3.10.7
|
|
46
|
-
if hasattr(sys, 'get_int_max_str_digits') and hasattr(sys, 'set_int_max_str_digits'):
|
|
47
|
-
pys_sys.get_int_max_str_digits = sys.get_int_max_str_digits
|
|
48
|
-
pys_sys.set_int_max_str_digits = sys.set_int_max_str_digits
|
|
49
36
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
for name in (
|
|
38
|
+
'exit', 'float_info', 'float_repr_style', 'get_int_max_str_digits', 'getdefaultencoding',
|
|
39
|
+
'getfilesystemencodeerrors', 'getfilesystemencoding', 'getrecursionlimit', 'getrefcount', 'getsizeof',
|
|
40
|
+
'gettotalrefcount', 'hash_info', 'hexversion', 'int_info', 'intern', 'maxsize', 'maxunicode', 'platform',
|
|
41
|
+
'set_int_max_str_digits', 'setrecursionlimit', 'stderr', 'stdin', 'stdout', 'thread_info'
|
|
42
|
+
):
|
|
43
|
+
if hasattr(sys, name):
|
|
44
|
+
setattr(pys_sys, name, getattr(sys, name))
|
|
54
45
|
|
|
55
46
|
@singleton
|
|
56
47
|
@inheritable
|
|
@@ -89,6 +89,9 @@ try:
|
|
|
89
89
|
yscrollcommand=self.scrollbar.set
|
|
90
90
|
)
|
|
91
91
|
|
|
92
|
+
self.scrollbar.pack_configure(side='right', fill='y')
|
|
93
|
+
self.scrollbar.configure(command=self.text.yview)
|
|
94
|
+
|
|
92
95
|
self.text.pack_configure(side='left', expand=True, fill='both')
|
|
93
96
|
|
|
94
97
|
self.text.insert('1.0', self.file.text)
|
|
@@ -99,9 +102,6 @@ try:
|
|
|
99
102
|
self.text.bind('<Prior>', on_page_up)
|
|
100
103
|
self.text.bind('<Next>', on_page_down)
|
|
101
104
|
|
|
102
|
-
self.scrollbar.pack_configure(side='right', fill='y')
|
|
103
|
-
self.scrollbar.configure(command=self.text.yview)
|
|
104
|
-
|
|
105
105
|
self.bind_all('<Control-S>', on_save)
|
|
106
106
|
self.bind_all('<Control-s>', on_save)
|
|
107
107
|
self.bind_all('<Control-W>', on_toggle_wrap)
|
|
@@ -111,6 +111,8 @@ try:
|
|
|
111
111
|
self.bind_all('<Control-equal>', on_change_font(1, lambda size : size < 128))
|
|
112
112
|
self.bind_all('<Control-plus>', on_change_font(5, lambda size : size < 128))
|
|
113
113
|
|
|
114
|
+
# self.wm_geometry('800x600')
|
|
115
|
+
self.wm_minsize(300, 250)
|
|
114
116
|
self.wm_protocol('WM_DELETE_WINDOW', on_close)
|
|
115
117
|
|
|
116
118
|
if colored:
|
|
@@ -24,6 +24,12 @@ class PysTraceback(Pys):
|
|
|
24
24
|
primary: Optional['PysTraceback'] = None,
|
|
25
25
|
implicit: bool = False
|
|
26
26
|
) -> None:
|
|
27
|
+
# circular import problem solved
|
|
28
|
+
from .cache import pys_sys
|
|
29
|
+
|
|
30
|
+
pys_sys.last_type = type(exception) if isinstance(exception, BaseException) else exception
|
|
31
|
+
pys_sys.last_value = exception if isinstance(exception, BaseException) else None
|
|
32
|
+
pys_sys.last_traceback = self
|
|
27
33
|
|
|
28
34
|
setimuattr(self, 'exception', exception)
|
|
29
35
|
setimuattr(self, 'context', context)
|
|
@@ -32,7 +38,7 @@ class PysTraceback(Pys):
|
|
|
32
38
|
setimuattr(self, 'implicit', implicit)
|
|
33
39
|
|
|
34
40
|
def __repr__(self) -> str:
|
|
35
|
-
return f'<traceback of
|
|
41
|
+
return f'<traceback of {self.exception!r}>'
|
|
36
42
|
|
|
37
43
|
def string_traceback(self) -> str:
|
|
38
44
|
# circular import problem solved
|
|
@@ -60,9 +66,9 @@ class PysTraceback(Pys):
|
|
|
60
66
|
|
|
61
67
|
frames.append(
|
|
62
68
|
f' File {magenta}"{position.file.name}"{reset}' +
|
|
63
|
-
('' if is_positionless
|
|
69
|
+
('' if is_positionless else f', line {magenta}{position.start_line}{reset}') +
|
|
64
70
|
('' if context_name is None else f', in {magenta}{context_name}{reset}') +
|
|
65
|
-
('' if is_positionless
|
|
71
|
+
('' if is_positionless else f'\n{indent(format_error_arrow(position, colored), 4)}')
|
|
66
72
|
)
|
|
67
73
|
|
|
68
74
|
position = context.parent_entry_position
|