textmate-grammar-python 0.5.3__tar.gz → 0.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/PKG-INFO +2 -1
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/pyproject.toml +6 -5
- textmate_grammar_python-0.6.1/src/textmate_grammar/__init__.py +1 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/handler.py +4 -3
- textmate_grammar_python-0.5.3/src/textmate_grammar/__init__.py +0 -1
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/LICENSE +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/README.md +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/elements.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parser.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/__init__.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/base.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/markdown/LICENSE.txt +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/markdown/__init__.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/markdown/grammar.yaml +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/matlab/__init__.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/matlab/grammar.yaml +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/matlab/license.txt +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/py.typed +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/utils/__init__.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/utils/cache.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/utils/exceptions.py +0 -0
- {textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/utils/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: textmate-grammar-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: A lexer and tokenizer for grammar files as defined by TextMate and used in VSCode, implemented in Python.
|
|
5
5
|
Home-page: https://github.com/watermarkhu/textmate-grammar-python
|
|
6
6
|
License: MIT
|
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Requires-Dist: PyYAML (>=6.0.1,<7.0.0)
|
|
18
|
+
Requires-Dist: charset-normalizer (>=3.3.2,<4.0.0)
|
|
18
19
|
Requires-Dist: onigurumacffi (>=1.3.0,<2.0.0)
|
|
19
20
|
Project-URL: Documentation, https://textmate-grammar-python.readthedocs.io
|
|
20
21
|
Project-URL: Repository, https://github.com/watermarkhu/textmate-grammar-python
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "textmate-grammar-python"
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
[build-system]
|
|
6
5
|
requires = ["poetry-core"]
|
|
7
6
|
build-backend = "poetry.core.masonry.api"
|
|
8
7
|
|
|
9
8
|
[tool.poetry]
|
|
10
9
|
name = "textmate-grammar-python"
|
|
11
|
-
version = "0.
|
|
10
|
+
version = "0.6.1"
|
|
12
11
|
description = "A lexer and tokenizer for grammar files as defined by TextMate and used in VSCode, implemented in Python."
|
|
13
12
|
authors = ["Mark Shui Hu <watermarkhu@gmail.com>"]
|
|
14
13
|
license = "MIT"
|
|
@@ -25,6 +24,7 @@ managed = true
|
|
|
25
24
|
python = "^3.9"
|
|
26
25
|
onigurumacffi = "^1.3.0"
|
|
27
26
|
PyYAML = "^6.0.1"
|
|
27
|
+
charset-normalizer = "^3.3.2"
|
|
28
28
|
|
|
29
29
|
[tool.poetry.group.test.dependencies]
|
|
30
30
|
pytest = ">=7.3.1,<9.0.0"
|
|
@@ -33,15 +33,16 @@ tox = "^4.11.4"
|
|
|
33
33
|
|
|
34
34
|
[tool.poetry.group.dev.dependencies]
|
|
35
35
|
pre-commit = "^3.6.0"
|
|
36
|
-
mypy = "^1.
|
|
37
|
-
ruff = "^0.
|
|
36
|
+
mypy = "^1.10.0"
|
|
37
|
+
ruff = "^0.5.0"
|
|
38
38
|
types-pyyaml = "^6.0.12.12"
|
|
39
|
+
poetry-plugin-export = "^1.8.0"
|
|
39
40
|
poetry-bumpversion = "^0.3.2"
|
|
40
41
|
|
|
41
42
|
[tool.poetry.group.doc.dependencies]
|
|
42
43
|
sphinx = "^7.2.6"
|
|
43
44
|
sphinx-autodoc2 = "^0.5.0"
|
|
44
|
-
myst-parser = "^
|
|
45
|
+
myst-parser = "^3.0.0"
|
|
45
46
|
furo = "^2024.1.29"
|
|
46
47
|
sphinxcontrib-mermaid = "^0.9.2"
|
|
47
48
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.1"
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/handler.py
RENAMED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Callable
|
|
5
5
|
|
|
6
|
+
import charset_normalizer as charset
|
|
6
7
|
from onigurumacffi import _Match as Match
|
|
7
8
|
from onigurumacffi import _Pattern as Pattern
|
|
8
9
|
from onigurumacffi import compile
|
|
@@ -44,6 +45,7 @@ class ContentHandler:
|
|
|
44
45
|
:ivar line_lengths: A list of lengths of each line in the source code.
|
|
45
46
|
:ivar anchor: The current position in the source code.
|
|
46
47
|
"""
|
|
48
|
+
# Proprocess the content, replace all newline characters with \n
|
|
47
49
|
prepared_content = pre_processor(content.replace("\r\n", "\n").replace("\r", "\n"))
|
|
48
50
|
|
|
49
51
|
self.content = prepared_content
|
|
@@ -58,9 +60,8 @@ class ContentHandler:
|
|
|
58
60
|
if not file_path.exists():
|
|
59
61
|
raise FileNotFound(str(file_path))
|
|
60
62
|
|
|
61
|
-
# Open file
|
|
62
|
-
|
|
63
|
-
content = file.read()
|
|
63
|
+
# Open file with best guess encoding from charset_normalizer
|
|
64
|
+
content = str(charset.from_path(file_path).best())
|
|
64
65
|
|
|
65
66
|
return cls(content, **kwargs)
|
|
66
67
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.3"
|
|
File without changes
|
|
File without changes
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/elements.py
RENAMED
|
File without changes
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parser.py
RENAMED
|
File without changes
|
|
File without changes
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/parsers/base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/utils/cache.py
RENAMED
|
File without changes
|
|
File without changes
|
{textmate_grammar_python-0.5.3 → textmate_grammar_python-0.6.1}/src/textmate_grammar/utils/logger.py
RENAMED
|
File without changes
|