pyscript-programming-language 1.13.2__tar.gz → 1.13.4__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.
Files changed (89) hide show
  1. {pyscript_programming_language-1.13.2/pyscript_programming_language.egg-info → pyscript_programming_language-1.13.4}/PKG-INFO +18 -18
  2. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/README.md +15 -15
  3. pyscript_programming_language-1.13.4/changelog.md +20 -0
  4. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyproject.toml +2 -2
  5. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/__init__.py +4 -3
  6. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/__init__.pyi +2 -1
  7. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/__main__.py +28 -20
  8. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/cache.py +6 -1
  9. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/checks.py +3 -3
  10. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/constants.py +7 -6
  11. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/context.py +6 -6
  12. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/editor/bases.py +4 -3
  13. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/editor/terminal.py +2 -2
  14. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/exceptions.py +0 -6
  15. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/highlight.py +8 -26
  16. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/interpreter.py +2 -13
  17. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/lexer.py +18 -38
  18. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/mapping.py +63 -0
  19. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/parser.py +38 -7
  20. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/pysbuiltins.py +16 -15
  21. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/pystypes.py +5 -11
  22. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/runner.py +6 -5
  23. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/shell.py +5 -5
  24. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/symtab.py +1 -1
  25. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/similarity.py +2 -3
  26. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/string.py +4 -1
  27. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/version.py +6 -15
  28. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_literal_eval.py +2 -3
  29. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/fpstimer/py_fpstimer.py +11 -1
  30. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/history.pys +2 -3
  31. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/parser.pys +5 -1
  32. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/site.pys +2 -2
  33. pyscript_programming_language-1.13.4/pyscript/site-packages/anniversary.pys +4 -0
  34. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/this.py +2 -2
  35. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4/pyscript_programming_language.egg-info}/PKG-INFO +18 -18
  36. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/SOURCES.txt +1 -0
  37. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/setup.py +2 -3
  38. pyscript_programming_language-1.13.2/changelog.md +0 -7
  39. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/MANIFEST.in +0 -0
  40. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/__init__.py +0 -0
  41. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/analyzer.py +0 -0
  42. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/bases.py +0 -0
  43. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/buffer.py +0 -0
  44. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/editor/__init__.py +0 -0
  45. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/editor/gui.py +0 -0
  46. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/handlers.py +0 -0
  47. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/nodes.py +0 -0
  48. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/position.py +0 -0
  49. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/results.py +0 -0
  50. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/token.py +0 -0
  51. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/__init__.py +0 -0
  52. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/ansi.py +0 -0
  53. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/debug.py +0 -0
  54. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/decorators.py +0 -0
  55. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/generic.py +0 -0
  56. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/module.py +0 -0
  57. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/core/utils/path.py +0 -0
  58. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/__hello__.pys +0 -0
  59. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/ansi.pys +0 -0
  60. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/__init__.pys +0 -0
  61. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_dump.py +0 -0
  62. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_unparse.py +0 -0
  63. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/ast/ast_walk.py +0 -0
  64. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/brainfuck.pys +0 -0
  65. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/code.pys +0 -0
  66. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/dis.pys +0 -0
  67. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/explorer.pys +0 -0
  68. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/fpstimer/__init__.pys +0 -0
  69. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/getch/__init__.pys +0 -0
  70. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/getch/py_getch.py +0 -0
  71. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/inspect.pys +0 -0
  72. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/jsdict.pys +0 -0
  73. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/keyword.pys +0 -0
  74. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/opcode.pys +0 -0
  75. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/pdisplay.pys +0 -0
  76. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/symtable.pys +0 -0
  77. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/token.pys +0 -0
  78. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/tokenize/__init__.pys +0 -0
  79. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/lib/tokenize/tok_untokenize.py +0 -0
  80. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/other/.nomedia +0 -0
  81. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/other/PyScript.ico +0 -0
  82. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/other/copyright +0 -0
  83. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/other/credits +0 -0
  84. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/other/license +0 -0
  85. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript/site-packages/this.pys +0 -0
  86. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/dependency_links.txt +0 -0
  87. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/requires.txt +0 -0
  88. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/pyscript_programming_language.egg-info/top_level.txt +0 -0
  89. {pyscript_programming_language-1.13.2 → pyscript_programming_language-1.13.4}/setup.cfg +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyscript-programming-language
3
- Version: 1.13.2
3
+ Version: 1.13.4
4
4
  Summary: PyScript Programming Language
5
5
  Home-page: https://azzammuhyala.github.io/pyscript
6
- Author: Azzam Muhyala
7
- Author-email: Azzam Muhyala <azzammuhyala@gmail.com>
6
+ Author: AzzamMuhyala
7
+ Author-email: AzzamMuhyala <azzammuhyala@gmail.com>
8
8
  License-Expression: MIT
9
9
  Project-URL: Homepage, https://azzammuhyala.github.io/pyscript
10
10
  Project-URL: Documentation, https://azzammuhyala.github.io/pyscript
@@ -39,7 +39,7 @@ Dynamic: requires-python
39
39
  <img src="https://static.pepy.tech/personalized-badge/pyscript-programming-language?period=total&units=NONE&left_color=GRAY&right_color=GREEN&left_text=downloads" alt="PyPI Downloads">
40
40
  </a>
41
41
  <a href="https://en.wikipedia.org/wiki/MIT_License">
42
- <img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
42
+ <img src="https://img.shields.io/badge/license-MIT-orange" alt="MIT License">
43
43
  </a>
44
44
  <a href="https://www.python.org/">
45
45
  <img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
@@ -50,10 +50,10 @@ PyScript is a programming language built on top of Python. It combines some synt
50
50
  you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
51
51
 
52
52
  ## Introduction 📖
53
- PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
54
- running Python in a browser. Since it's inception, the language was inspired by Python and JavaScript, which are
55
- relatively easy for humans to read. This name was chosen because it wasn't immediately known whether this name was
56
- already in use.
53
+ The name of "PyScript" was previously used by a well-known framework designed to run Python directly in the browser.
54
+ Designed from the outset with inspiration from both Python and JavaScript, this language emphasizes human readability.
55
+ Its name was derived by combining **Py**thon and Java**Script**. Please note that this language is an independent
56
+ programming language project written in Python and has no affiliation with the aforementioned PyScript framework.
57
57
 
58
58
  This language wasn't designed to compete with other modern programming languages, but rather as a learning for
59
59
  understanding how programming languages ​​work and how human written code can be understood by machines. Furthermore, this
@@ -105,15 +105,15 @@ Familiar? There it is!
105
105
  |:--:|:------------------|:----------------------:|
106
106
  | 1 | `argparse` | **required** |
107
107
  | 2 | `builtins` | **required** |
108
- | 3 | `collections.abc` | **required** |
109
- | 4 | `functools` | **required** |
110
- | 5 | `html` | **required** |
111
- | 6 | `importlib` | **required** |
112
- | 7 | `inspect` | **required** |
113
- | 8 | `io` | **required** |
114
- | 9 | `itertools` | **required** |
115
- | 10 | `json` | **required** |
116
- | 11 | `math` | **required** |
108
+ | 3 | `cmath` | **required** |
109
+ | 4 | `collections.abc` | **required** |
110
+ | 5 | `functools` | **required** |
111
+ | 6 | `html` | **required** |
112
+ | 7 | `importlib` | **required** |
113
+ | 8 | `inspect` | **required** |
114
+ | 9 | `io` | **required** |
115
+ | 10 | `itertools` | **required** |
116
+ | 11 | `json` | **required** |
117
117
  | 12 | `operator` | **required** |
118
118
  | 13 | `os` | **required** |
119
119
  | 14 | `re` | **required** |
@@ -145,7 +145,7 @@ Familiar? There it is!
145
145
  - **optional**: Not required, but if it is present, some features can be used without issue.
146
146
 
147
147
  ## Highlights 🎨
148
- - [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.1/plugin.zip)
148
+ - [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.3/plugin-1.0.2.zip)
149
149
  - [PyScript nano for Linux](https://github.com/azzammuhyala/pyscript/tree/main/highlight/nano)
150
150
  - [PyScript extension for VSCode](https://marketplace.visualstudio.com/items?itemName=azzammuhyala.pyslang)
151
151
 
@@ -7,7 +7,7 @@
7
7
  <img src="https://static.pepy.tech/personalized-badge/pyscript-programming-language?period=total&units=NONE&left_color=GRAY&right_color=GREEN&left_text=downloads" alt="PyPI Downloads">
8
8
  </a>
9
9
  <a href="https://en.wikipedia.org/wiki/MIT_License">
10
- <img src="https://img.shields.io/badge/license-MIT-orange" alt="License MIT">
10
+ <img src="https://img.shields.io/badge/license-MIT-orange" alt="MIT License">
11
11
  </a>
12
12
  <a href="https://www.python.org/">
13
13
  <img src="https://img.shields.io/badge/python-3.10+-yellow" alt="Python 3.10+">
@@ -18,10 +18,10 @@ PyScript is a programming language built on top of Python. It combines some synt
18
18
  you're already familiar with Python, JavaScript or both, it should be quite easy to learn.
19
19
 
20
20
  ## Introduction 📖
21
- PyScript may not be the language we'll be discussing, but the name PyScript already exists, a flexible and platform for
22
- running Python in a browser. Since it's inception, the language was inspired by Python and JavaScript, which are
23
- relatively easy for humans to read. This name was chosen because it wasn't immediately known whether this name was
24
- already in use.
21
+ The name of "PyScript" was previously used by a well-known framework designed to run Python directly in the browser.
22
+ Designed from the outset with inspiration from both Python and JavaScript, this language emphasizes human readability.
23
+ Its name was derived by combining **Py**thon and Java**Script**. Please note that this language is an independent
24
+ programming language project written in Python and has no affiliation with the aforementioned PyScript framework.
25
25
 
26
26
  This language wasn't designed to compete with other modern programming languages, but rather as a learning for
27
27
  understanding how programming languages ​​work and how human written code can be understood by machines. Furthermore, this
@@ -73,15 +73,15 @@ Familiar? There it is!
73
73
  |:--:|:------------------|:----------------------:|
74
74
  | 1 | `argparse` | **required** |
75
75
  | 2 | `builtins` | **required** |
76
- | 3 | `collections.abc` | **required** |
77
- | 4 | `functools` | **required** |
78
- | 5 | `html` | **required** |
79
- | 6 | `importlib` | **required** |
80
- | 7 | `inspect` | **required** |
81
- | 8 | `io` | **required** |
82
- | 9 | `itertools` | **required** |
83
- | 10 | `json` | **required** |
84
- | 11 | `math` | **required** |
76
+ | 3 | `cmath` | **required** |
77
+ | 4 | `collections.abc` | **required** |
78
+ | 5 | `functools` | **required** |
79
+ | 6 | `html` | **required** |
80
+ | 7 | `importlib` | **required** |
81
+ | 8 | `inspect` | **required** |
82
+ | 9 | `io` | **required** |
83
+ | 10 | `itertools` | **required** |
84
+ | 11 | `json` | **required** |
85
85
  | 12 | `operator` | **required** |
86
86
  | 13 | `os` | **required** |
87
87
  | 14 | `re` | **required** |
@@ -113,7 +113,7 @@ Familiar? There it is!
113
113
  - **optional**: Not required, but if it is present, some features can be used without issue.
114
114
 
115
115
  ## Highlights 🎨
116
- - [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.1/plugin.zip)
116
+ - [PyScript plugin for Acode (Ace Editor)](https://github.com/azzammuhyala/pyscript/releases/download/v1.13.3/plugin-1.0.2.zip)
117
117
  - [PyScript nano for Linux](https://github.com/azzammuhyala/pyscript/tree/main/highlight/nano)
118
118
  - [PyScript extension for VSCode](https://marketplace.visualstudio.com/items?itemName=azzammuhyala.pyslang)
119
119
 
@@ -0,0 +1,20 @@
1
+ # Change Logs
2
+
3
+ ## [1.13.4] - 01/09/2026
4
+
5
+ ### Added
6
+ - Added comparison support for complex objects in the builtin `ce` and `nce` functions.
7
+ - Default maximum input history lines for Pygments to 2048.
8
+ - Configured `open()` encoding based on `pys_sys.encoding` (PyScript `sys.encoding`).
9
+ - The `else` keyword is alias for `default` in `switch` statements.
10
+ - The `fpstimer` module now stores the default framerate value.
11
+ - Added `NO_WARNING` flag.
12
+ - _etc._
13
+
14
+ ### Fixed
15
+ - Fixed some bugs.
16
+ - The builtins `inf`, `infj`, `nan`, and `nanj` come from the `cmath` module.
17
+ - _etc._
18
+
19
+ ### Removed
20
+ - The attributes of `pys_sys` namely `last_type`, `last_value`, and `last_traceback`.
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyscript-programming-language"
7
- version = "1.13.2"
7
+ version = "1.13.4"
8
8
  description = "PyScript Programming Language"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  requires-python = ">=3.10"
11
11
  license = "MIT"
12
12
 
13
13
  authors = [
14
- { name = "Azzam Muhyala", email = "azzammuhyala@gmail.com" }
14
+ { name = "AzzamMuhyala", email = "azzammuhyala@gmail.com" }
15
15
  ]
16
16
 
17
17
  keywords = [
@@ -9,8 +9,8 @@ if __import__('sys').version_info < (3, 10):
9
9
  from . import core
10
10
 
11
11
  from .core.constants import (
12
- DEFAULT, NO_COLOR, DEBUG, SILENT, RETURN_RESULT, DONT_SHOW_BANNER_ON_SHELL, CLASSIC_LINE_SHELL, NO_COLOR_PROMPT,
13
- NOTEBOOK, LEXER_HIGHLIGHT, DICT_TO_JSDICT
12
+ DEFAULT, NO_COLOR, NO_WARNING, SILENT, DEBUG, RETURN_RESULT, DONT_SHOW_BANNER_ON_SHELL, CLASSIC_LINE_SHELL,
13
+ NO_COLOR_PROMPT, NOTEBOOK, LEXER_HIGHLIGHT, DICT_TO_JSDICT
14
14
  )
15
15
  from .core.cache import undefined
16
16
  from .core.highlight import (
@@ -24,8 +24,9 @@ __all__ = (
24
24
  'core',
25
25
  'DEFAULT',
26
26
  'NO_COLOR',
27
- 'DEBUG',
27
+ 'NO_WARNING',
28
28
  'SILENT',
29
+ 'DEBUG',
29
30
  'RETURN_RESULT',
30
31
  'DONT_SHOW_BANNER_ON_SHELL',
31
32
  'CLASSIC_LINE_SHELL',
@@ -22,8 +22,9 @@ from .core.highlight import (
22
22
 
23
23
  DEFAULT: int
24
24
  NO_COLOR: int
25
- DEBUG: int
25
+ NO_WARNING: int
26
26
  SILENT: int
27
+ DEBUG: int
27
28
  RETURN_RESULT: int
28
29
  DONT_SHOW_BANNER_ON_SHELL: int
29
30
  CLASSIC_LINE_SHELL: int
@@ -1,8 +1,8 @@
1
1
  from .core.buffer import PysFileBuffer
2
2
  from .core.cache import pys_sys, undefined
3
3
  from .core.constants import (
4
- ENV_PYSCRIPT_NO_COLOR_PROMPT, ENV_PYSCRIPT_CLASSIC_LINE_SHELL, DEFAULT, DEBUG, NO_COLOR, DONT_SHOW_BANNER_ON_SHELL,
5
- CLASSIC_LINE_SHELL, NO_COLOR_PROMPT, NOTEBOOK
4
+ ENV_PYSCRIPT_NO_COLOR_PROMPT, ENV_PYSCRIPT_CLASSIC_LINE_SHELL, DEFAULT, NO_COLOR, NO_WARNING, DEBUG,
5
+ DONT_SHOW_BANNER_ON_SHELL, CLASSIC_LINE_SHELL, NO_COLOR_PROMPT, NOTEBOOK
6
6
  )
7
7
  from .core.editor.gui import PysGUIEditor, GUI_SUPPORT
8
8
  from .core.editor.terminal import PysTerminalEditor, TERMINAL_SUPPORT
@@ -13,7 +13,7 @@ from .core.runner import _namespace_to_symbol_table, pys_runner, pys_shell
13
13
  from .core.utils.debug import USE_NOTEBOOK
14
14
  from .core.utils.generic import is_environ
15
15
  from .core.utils.module import find_module_path, remove_python_path
16
- from .core.utils.path import getcwd, base
16
+ from .core.utils.path import getcwd, base, normpath
17
17
  from .core.version import __version__
18
18
 
19
19
  if PYGMENTS:
@@ -100,7 +100,7 @@ parser.add_argument(
100
100
 
101
101
  parser.add_argument(
102
102
  '-l', '--highlight',
103
- choices=tuple(FORMATER_HIGHLIGHT_MAP.keys()) + tuple(FORMATER_PYGMENTS_MAP.keys() if PYGMENTS else ()),
103
+ choices=tuple(FORMATER_HIGHLIGHT_MAP.keys()) + (tuple(FORMATER_PYGMENTS_MAP.keys()) if PYGMENTS else ()),
104
104
  default=None,
105
105
  help="generate highlight code from a 'file'"
106
106
  )
@@ -139,6 +139,12 @@ parser.add_argument(
139
139
  help="configure terminal encoding to UTF-8 and enable ANSI escape code processing on Windows"
140
140
  )
141
141
 
142
+ parser.add_argument(
143
+ '-w', '--no-warning',
144
+ action='store_true',
145
+ help="disabled warning (especially syntax warnings)"
146
+ )
147
+
142
148
  parser.add_argument(
143
149
  '-q',
144
150
  action='store_true',
@@ -240,6 +246,7 @@ for condition, flag in [
240
246
  (args.no_color or is_environ('NO_COLOR'), NO_COLOR),
241
247
  (args.no_color_prompt or is_environ(ENV_PYSCRIPT_NO_COLOR_PROMPT), NO_COLOR_PROMPT),
242
248
  (args.debug, DEBUG),
249
+ (args.no_warning, NO_WARNING),
243
250
  (args.q, DONT_SHOW_BANNER_ON_SHELL)
244
251
  ]:
245
252
  if condition:
@@ -258,13 +265,13 @@ def clean_up() -> None:
258
265
  'ArgumentParser', 'BBCodeFormatter', 'CLASSIC_LINE_SHELL', 'DEBUG', 'DEFAULT', 'EDITOR_MAP',
259
266
  'ENV_PYSCRIPT_CLASSIC_LINE_SHELL', 'ENV_PYSCRIPT_NO_COLOR_PROMPT', 'FORMATER_HIGHLIGHT_MAP',
260
267
  'FORMATER_PYGMENTS_MAP', 'GUI_SUPPORT', 'HLFMT_ANSI', 'HLFMT_BBCODE', 'HLFMT_HTML', 'HtmlFormatter',
261
- 'LatexFormatter', 'NOTEBOOK', 'NO_COLOR', 'NO_COLOR_PROMPT', 'OPTIONAL', 'PYGMENTS', 'PygmentsPyScriptLexer',
262
- 'PygmentsPyScriptStyle', 'PysFileBuffer', 'PysGUIEditor', 'PysTerminalEditor', 'REMAINDER', 'TERMINAL_SUPPORT',
263
- 'Terminal256Formatter', 'TerminalFormatter', 'TerminalTrueColorFormatter', 'USE_NOTEBOOK', '__version__',
264
- '_namespace_to_symbol_table', 'arg', 'arg_index', 'argc', 'args', 'argument_error', 'arguments_requiring_value',
265
- 'argv', 'base', 'clean_up', 'condition', 'ctypes', 'execute', 'fd', 'file', 'find_module_path', 'flag',
266
- 'getcwd', 'highlight', 'i', 'index', 'is_environ', 'kernel32', 'load_file', 'module_path', 'parser',
267
- 'pys_highlight', 'pys_sys', 'remove_python_path'
268
+ 'LatexFormatter', 'NOTEBOOK', 'NO_COLOR', 'NO_WARNING', 'NO_COLOR_PROMPT', 'OPTIONAL', 'PYGMENTS',
269
+ 'PygmentsPyScriptLexer', 'PygmentsPyScriptStyle', 'PysFileBuffer', 'PysGUIEditor', 'PysTerminalEditor',
270
+ 'REMAINDER', 'TERMINAL_SUPPORT', 'Terminal256Formatter', 'TerminalFormatter', 'TerminalTrueColorFormatter',
271
+ 'USE_NOTEBOOK', '__version__', '_namespace_to_symbol_table', 'arg', 'arg_index', 'argc', 'args',
272
+ 'argument_error', 'arguments_requiring_value', 'argv', 'base', 'clean_up', 'condition', 'ctypes', 'execute',
273
+ 'fd', 'file', 'find_module_path', 'flag', 'getcwd', 'highlight', 'i', 'index', 'is_environ', 'kernel32',
274
+ 'load_file', 'module_path', 'parser', 'pys_highlight', 'pys_sys', 'remove_python_path'
268
275
  }:
269
276
  try:
270
277
  del g[name]
@@ -272,24 +279,25 @@ def clean_up() -> None:
272
279
  continue
273
280
 
274
281
  def load_file(path) -> PysFileBuffer:
282
+ normalized = normpath(path)
275
283
  try:
276
- with open(path, 'r', encoding='utf-8') as file:
277
- return PysFileBuffer(file, path)
284
+ with open(normalized, 'r', encoding=pys_sys.encoding) as file:
285
+ return PysFileBuffer(file, normalized)
278
286
  except FileNotFoundError:
279
287
  if not (EDITOR_MAP and args.editor):
280
- argument_error('file', f"can't open file \"{path}\": No such file or directory")
288
+ argument_error('file', f"can't open file \"{normalized}\": No such file or directory")
281
289
  except PermissionError:
282
- argument_error('file', f"can't open file \"{path}\": Permission denied")
290
+ argument_error('file', f"can't open file \"{normalized}\": Permission denied")
283
291
  except IsADirectoryError:
284
- argument_error('file', f"can't open file \"{path}\": Path is not a file")
292
+ argument_error('file', f"can't open file \"{normalized}\": Path is not a file")
285
293
  except NotADirectoryError:
286
- argument_error('file', f"can't open file \"{path}\": Attempting to access directory from file")
294
+ argument_error('file', f"can't open file \"{normalized}\": Attempting to access directory from file")
287
295
  except (OSError, IOError):
288
- argument_error('file', f"can't open file \"{path}\": Attempting to access a system directory or file")
296
+ argument_error('file', f"can't open file \"{normalized}\": Attempting to access a system directory or file")
289
297
  except UnicodeDecodeError:
290
- argument_error('file', f"can't read file \"{path}\": Bad file")
298
+ argument_error('file', f"can't read file \"{normalized}\": Bad file")
291
299
  except BaseException as e:
292
- argument_error('file', f"file \"{path}\": Unexpected error: {e}")
300
+ argument_error('file', f"file \"{normalized}\": Unexpected error: {e}")
293
301
  return PysFileBuffer('', path)
294
302
 
295
303
  def execute(file: PysFileBuffer) -> None:
@@ -6,7 +6,7 @@ from .utils.module import get_module_candidate
6
6
  from .utils.path import base
7
7
 
8
8
  from types import ModuleType
9
- from typing import Literal
9
+ from typing import Any, Literal
10
10
 
11
11
  import sys
12
12
  import os
@@ -28,8 +28,10 @@ pys_sys.builtin_module_names = tuple(
28
28
  pys_sys.path = [LIBRARIES_PATH, SITE_PACKAGES_PATH]
29
29
  pys_sys.loading_modules = set()
30
30
  pys_sys.modules = {}
31
+ pys_sys.interns = {}
31
32
  pys_sys.singletons = {}
32
33
  pys_sys.argv = ['']
34
+ pys_sys.encoding = 'utf-8'
33
35
  pys_sys.flags = DEFAULT
34
36
  pys_sys.displayhook = print_display
35
37
  pys_sys.excepthook = print_traceback
@@ -56,6 +58,9 @@ for name in (
56
58
  if hasattr(sys, name):
57
59
  setattr(pys_sys, name, getattr(sys, name))
58
60
 
61
+ def intern_object(object: Any) -> Any:
62
+ return pys_sys.interns.setdefault((type(object), object), object)
63
+
59
64
  # sentinel
60
65
  @singleton
61
66
  @inheritable
@@ -20,9 +20,9 @@ is_sequence = frozenset([
20
20
  PysSetNode, PysListNode, PysTupleNode
21
21
  ]).__contains__
22
22
 
23
- is_constant = frozenset([
24
- PysKeywordNode, PysDebugNode
25
- ])
23
+ is_literal = frozenset([
24
+ PysNumberNode, PysStringNode
25
+ ]).__contains__
26
26
 
27
27
  is_keyword = frozenset(KEYWORDS).__contains__
28
28
  is_constant_keyword = frozenset(CONSTANT_KEYWORDS).__contains__
@@ -34,12 +34,13 @@ CONSTANT_KEYWORDS = (
34
34
 
35
35
  DEFAULT = 0
36
36
  NO_COLOR = 1 << 0
37
- DEBUG = 1 << 1
38
- SILENT = 1 << 2
39
- RETURN_RESULT = 1 << 3
40
- DONT_SHOW_BANNER_ON_SHELL = 1 << 4
41
- CLASSIC_LINE_SHELL = 1 << 5
42
- NO_COLOR_PROMPT = 1 << 6
37
+ NO_WARNING = 1 << 1
38
+ SILENT = 1 << 2 | NO_WARNING
39
+ DEBUG = 1 << 3
40
+ RETURN_RESULT = 1 << 4
41
+ DONT_SHOW_BANNER_ON_SHELL = 1 << 5
42
+ CLASSIC_LINE_SHELL = 1 << 6
43
+ NO_COLOR_PROMPT = 1 << 7
43
44
  NOTEBOOK = CLASSIC_LINE_SHELL | NO_COLOR_PROMPT
44
45
 
45
46
  LEXER_HIGHLIGHT = 1 << 0
@@ -28,12 +28,12 @@ class PysContext(Pys):
28
28
  if flags is None and parent:
29
29
  flags = parent.flags
30
30
 
31
- setimuattr(self, 'file', file)
32
- setimuattr(self, 'name', name)
33
- setimuattr(self, 'qualname', qualname)
34
- setimuattr(self, 'flags', DEFAULT if flags is None else flags)
35
- setimuattr(self, 'symbol_table', symbol_table)
36
- setimuattr(self, 'parent', parent)
31
+ setimuattr(self, 'file', file)
32
+ setimuattr(self, 'name', name)
33
+ setimuattr(self, 'qualname', qualname)
34
+ setimuattr(self, 'flags', DEFAULT if flags is None else flags)
35
+ setimuattr(self, 'symbol_table', symbol_table)
36
+ setimuattr(self, 'parent', parent)
37
37
  setimuattr(self, 'parent_entry_position', parent_entry_position)
38
38
 
39
39
  class PysClassContext(PysContext):
@@ -1,5 +1,6 @@
1
1
  from ..bases import Pys
2
2
  from ..buffer import PysFileBuffer
3
+ from ..cache import pys_sys
3
4
  from ..constants import CONFIGURATIONS_PATH
4
5
  from ..utils.decorators import typecheck, inheritable
5
6
  from ..utils.generic import setimuattr
@@ -26,7 +27,7 @@ class PysEditor(Pys):
26
27
 
27
28
  def load_configuration(self) -> None:
28
29
  try:
29
- with open(CONFIGURATIONS_PATH, 'r', encoding='utf-8') as file:
30
+ with open(CONFIGURATIONS_PATH, 'r', encoding=pys_sys.encoding) as file:
30
31
  result = load(file)
31
32
  if not isinstance(result, dict):
32
33
  raise ValueError
@@ -48,7 +49,7 @@ class PysEditor(Pys):
48
49
 
49
50
  def save_configuration(self) -> None:
50
51
  try:
51
- with open(CONFIGURATIONS_PATH, 'w', encoding='utf-8') as file:
52
+ with open(CONFIGURATIONS_PATH, 'w', encoding=pys_sys.encoding) as file:
52
53
  dump(self.configurations, file, separators=(',', ':'))
53
54
  except:
54
55
  pass
@@ -56,7 +57,7 @@ class PysEditor(Pys):
56
57
  def save(self, text) -> None:
57
58
  try:
58
59
  text = normstr(text)
59
- with open(self.file.name, 'w', encoding='utf-8') as file:
60
+ with open(self.file.name, 'w', encoding=pys_sys.encoding) as file:
60
61
  file.write(text)
61
62
  setimuattr(self.file, 'text', text)
62
63
  except:
@@ -181,8 +181,8 @@ try:
181
181
  floats=[
182
182
  Float(
183
183
  content=self.exit_container,
184
- left=2,
185
- bottom=1
184
+ width=43,
185
+ height=2,
186
186
  )
187
187
  ]
188
188
  )
@@ -25,8 +25,6 @@ class PysTraceback(Pys):
25
25
  primary: Optional['PysTraceback'] = None,
26
26
  implicit: bool = False
27
27
  ) -> None:
28
- # circular import problem solved
29
- from .cache import pys_sys
30
28
 
31
29
  setimuattr(self, 'exception', exception)
32
30
  setimuattr(self, 'context', context)
@@ -34,10 +32,6 @@ class PysTraceback(Pys):
34
32
  setimuattr(self, 'primary', primary)
35
33
  setimuattr(self, 'implicit', implicit)
36
34
 
37
- pys_sys.last_type = type(exception) if isinstance(exception, BaseException) else exception
38
- pys_sys.last_value = exception if isinstance(exception, BaseException) else None
39
- pys_sys.last_traceback = self
40
-
41
35
  def __repr__(self) -> str:
42
36
  return f'<traceback of {self.exception!r}>'
43
37
 
@@ -3,7 +3,7 @@ from .buffer import PysFileBuffer
3
3
  from .checks import is_constant_keyword, is_left_bracket, is_bracket, is_public_attribute
4
4
  from .constants import KEYWORDS, CONSTANT_KEYWORDS, LEXER_HIGHLIGHT
5
5
  from .lexer import PysLexer
6
- from .mapping import BRACKETS_MAP
6
+ from .mapping import HIGHLIGHT_MAP, BRACKETS_MAP
7
7
  from .position import PysPosition
8
8
  from .pysbuiltins import pys_builtins
9
9
  from .token import TOKENS
@@ -12,28 +12,8 @@ from .utils.decorators import typecheck
12
12
  from .utils.string import normstr
13
13
 
14
14
  from html import escape as html_escape
15
- from types import MappingProxyType
16
15
  from typing import Callable, Optional
17
16
 
18
- HIGHLIGHT_MAP = MappingProxyType({
19
- 'default': '#D4D4D4',
20
- 'keyword': '#C586C0',
21
- 'keyword-constant': '#307CD6',
22
- 'keyword-other': '#1F52B3',
23
- 'identifier': '#8CDCFE',
24
- 'identifier-constant': '#2EA3FF',
25
- 'identifier-function': '#DCDCAA',
26
- 'identifier-type': '#4EC9B0',
27
- 'number': '#B5CEA8',
28
- 'string': '#CE9178',
29
- 'escape': '#D7BA71',
30
- 'brackets-0': '#FFD705',
31
- 'brackets-1': '#D45DBA',
32
- 'brackets-2': '#1A9FFF',
33
- 'comment': '#549952',
34
- 'invalid': '#B51819'
35
- })
36
-
37
17
  BUILTIN_TYPES = frozenset(
38
18
  name
39
19
  for name, object in pys_builtins.__dict__.items()
@@ -204,7 +184,7 @@ try:
204
184
  bygroups(Number.Affix, Number.Hex, Number.Affix)
205
185
  ),
206
186
  (
207
- rf'\b((?:(?:{_integer})?\.{_integer}|{_integer}\.){_scientific}?)({_imaginary})\b',
187
+ rf'(?<![\w.])((?:(?:{_integer})?\.{_integer}|{_integer}\.){_scientific}?)({_imaginary})(?![\w.])',
208
188
  bygroups(Number.Float, Number.Affix)
209
189
  ),
210
190
  (
@@ -448,6 +428,7 @@ def pys_highlight(
448
428
  formatter: Optional[Callable[[str, PysPosition, str], str]] = None,
449
429
  max_bracket_level: int = 3
450
430
  ) -> str:
431
+
451
432
  """
452
433
  Highlight a PyScript code from source given.
453
434
 
@@ -498,6 +479,7 @@ def pys_highlight(
498
479
  for i, token in enumerate(tokens):
499
480
  ttype = token.type
500
481
  tvalue = token.value
482
+ tposition = token.position
501
483
 
502
484
  if ttype == T_NULL:
503
485
  type_format = 'end'
@@ -553,13 +535,13 @@ def pys_highlight(
553
535
  else:
554
536
  type_format = 'default'
555
537
 
556
- if space := text[last_index:token.position.start]:
557
- result += formatter('default', PysPosition(file, last_index, token.position.start), space)
558
- result += formatter(type_format, token.position, text[token.position.start:token.position.end])
538
+ if space := text[last_index:tposition.start]:
539
+ result += formatter('default', PysPosition(file, last_index, tposition.start), space)
540
+ result += formatter(type_format, tposition, text[tposition.start:tposition.end])
559
541
 
560
542
  if ttype == T_NULL:
561
543
  break
562
544
 
563
- last_index = token.position.end
545
+ last_index = tposition.end
564
546
 
565
547
  return result
@@ -6,7 +6,7 @@ from .checks import is_sequence, is_equal, is_public_attribute
6
6
  from .context import PysContext, PysClassContext
7
7
  from .exceptions import PysTraceback
8
8
  from .handlers import handle_call
9
- from .mapping import GET_BINARY_FUNCTION, GET_UNARY_FUNCTION
9
+ from .mapping import GET_BINARY_FUNCTION, GET_UNARY_FUNCTION, GET_VALUE_FROM_CONSTANT_KEYWORDS
10
10
  from .nodes import *
11
11
  from .pysbuiltins import ce, nce, increment, decrement
12
12
  from .pystypes import PysFunction
@@ -28,17 +28,6 @@ T_OR = TOKENS['DOUBLE_PIPE']
28
28
  T_CE = TOKENS['EQUAL_TILDE']
29
29
  T_NCE = TOKENS['EXCLAMATION_TILDE']
30
30
 
31
- get_value_from_keyword = {
32
- 'True': True,
33
- 'False': False,
34
- 'None': None,
35
- 'true': True,
36
- 'false': False,
37
- 'nil': None,
38
- 'none': None,
39
- 'null': None
40
- }.__getitem__
41
-
42
31
  def visit_NumberNode(node: PysNumberNode, context: PysContext) -> PysRunTimeResult:
43
32
  return PysRunTimeResult().success(node.value.value)
44
33
 
@@ -46,7 +35,7 @@ def visit_StringNode(node: PysStringNode, context: PysContext) -> PysRunTimeResu
46
35
  return PysRunTimeResult().success(node.value.value)
47
36
 
48
37
  def visit_KeywordNode(node: PysKeywordNode, context: PysContext) -> PysRunTimeResult:
49
- return PysRunTimeResult().success(get_value_from_keyword(node.name.value))
38
+ return PysRunTimeResult().success(GET_VALUE_FROM_CONSTANT_KEYWORDS(node.name.value))
50
39
 
51
40
  def visit_DebugNode(node: PysDebugNode, context: PysContext) -> PysRunTimeResult:
52
41
  return PysRunTimeResult().success(True if context.flags & DEBUG else False)