vim-eof-comment 0.3.10__tar.gz → 0.3.12__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.
- vim_eof_comment-0.3.12/.gitattributes +1 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/Makefile +3 -1
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/PKG-INFO +6 -2
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/Pipfile +1 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/docs/source/conf.py +17 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/docs/source/index.rst +1 -1
- vim_eof_comment-0.3.12/docs/source/installation.rst +14 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/pyproject.toml +50 -6
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/requirements.txt +4 -0
- vim_eof_comment-0.3.12/version.txt +1 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/__init__.py +2 -4
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/__init__.pyi +4 -3
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/args/parsing.py +1 -1
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/comments/__init__.py +2 -2
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/comments/__init__.pyi +1 -2
- vim_eof_comment-0.3.12/vim_eof_comment/comments/filetypes.json +1 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/comments/generator.py +28 -28
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/comments/generator.pyi +23 -23
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/eof.py +5 -8
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/eof.pyi +1 -1
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/file.py +4 -4
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/file.pyi +1 -1
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/regex.py +2 -2
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/regex.pyi +2 -2
- vim_eof_comment-0.3.12/vim_eof_comment/types.py +192 -0
- vim_eof_comment-0.3.12/vim_eof_comment/types.pyi +157 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/util.py +1 -1
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/version.py +7 -3
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/version.pyi +4 -3
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment.egg-info/PKG-INFO +6 -2
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment.egg-info/SOURCES.txt +4 -6
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment.egg-info/top_level.txt +2 -0
- vim_eof_comment-0.3.10/.gitignore +0 -210
- vim_eof_comment-0.3.10/docs/source/usage.rst +0 -11
- vim_eof_comment-0.3.10/version.txt +0 -1
- vim_eof_comment-0.3.10/vim_eof_comment/comments/filetypes.json +0 -1
- vim_eof_comment-0.3.10/vim_eof_comment/comments/types.py +0 -76
- vim_eof_comment-0.3.10/vim_eof_comment/comments/types.pyi +0 -65
- vim_eof_comment-0.3.10/vim_eof_comment/types.py +0 -122
- vim_eof_comment-0.3.10/vim_eof_comment/types.pyi +0 -87
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/.flake8 +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/.github/CODEOWNERS +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/.github/workflows/flake8-lint.yml +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/.github/workflows/mypy-lint.yml +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/.github/workflows/release.yml +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/.pre-commit-config.yaml +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/LICENSE +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/README.md +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/docs/Makefile +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/docs/make.bat +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/docs/source/functions.rst +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/setup.cfg +0 -0
- /vim_eof_comment-0.3.10/.taplo.toml → /vim_eof_comment-0.3.12/taplo.toml +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/__main__.py +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/args/__init__.py +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/args/__init__.pyi +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/args/completion.py +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/args/completion.pyi +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/args/parsing.pyi +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/py.typed +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment/util.pyi +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment.egg-info/dependency_links.txt +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment.egg-info/entry_points.txt +0 -0
- {vim_eof_comment-0.3.10 → vim_eof_comment-0.3.12}/vim_eof_comment.egg-info/requires.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gitignore export-ignore
|
|
@@ -43,6 +43,8 @@ lint:
|
|
|
43
43
|
vim_eof_comment
|
|
44
44
|
@pydocstyle --convention=numpy --match='.*\.py' vim_eof_comment
|
|
45
45
|
@autopep8 --aggressive --aggressive --aggressive --in-place --recursive vim_eof_comment
|
|
46
|
+
$(eval files := $(shell fd --full-path vim_eof_comment -e py))
|
|
47
|
+
@numpydoc lint $(files)
|
|
46
48
|
@echo -e "\nDone!"
|
|
47
49
|
|
|
48
50
|
stubs: lint
|
|
@@ -58,7 +60,7 @@ stubs: lint
|
|
|
58
60
|
|
|
59
61
|
build: stubs
|
|
60
62
|
@echo -e "Building...\n"
|
|
61
|
-
@python3 -m build
|
|
63
|
+
@python3 -m build
|
|
62
64
|
@echo -e "\nDone!"
|
|
63
65
|
|
|
64
66
|
sign: build
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vim-eof-comment
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.12
|
|
4
4
|
Summary: Adds Vim EOF comments for given filetypes in given directories
|
|
5
5
|
Author-email: Guennadi Maximov C <g.maxc.fox@protonmail.com>
|
|
6
6
|
Maintainer-email: Guennadi Maximov C <g.maxc.fox@protonmail.com>
|
|
7
7
|
License-Expression: GPL-2.0-only
|
|
8
8
|
Project-URL: Issues, https://github.com/DrKJeff16/vim-eof-comment/issues
|
|
9
9
|
Project-URL: Repository, https://github.com/DrKJeff16/vim-eof-comment
|
|
10
|
-
|
|
10
|
+
Project-URL: Download, https://github.com/DrKJeff16/vim-eof-comment/releases/latest
|
|
11
|
+
Keywords: eof comments,eof,files,preprocessing,text,vim modeline,vim,vim-eof
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
13
|
Classifier: Environment :: Console
|
|
12
14
|
Classifier: Intended Audience :: Developers
|
|
13
15
|
Classifier: Intended Audience :: End Users/Desktop
|
|
14
16
|
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -22,8 +22,10 @@ release: str = '0.1.33'
|
|
|
22
22
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
23
23
|
|
|
24
24
|
extensions: List[str] = [
|
|
25
|
+
'numpydoc',
|
|
25
26
|
'sphinx.ext.autodoc',
|
|
26
27
|
'sphinx.ext.autosectionlabel',
|
|
28
|
+
'sphinx.ext.autosummary',
|
|
27
29
|
'sphinx.ext.duration',
|
|
28
30
|
]
|
|
29
31
|
|
|
@@ -36,4 +38,19 @@ exclude_patterns: List[str] = []
|
|
|
36
38
|
html_theme: str = 'sphinx_rtd_theme'
|
|
37
39
|
html_static_path: List[str] = ['_static']
|
|
38
40
|
|
|
41
|
+
# -- Options for numpydoc ----------------------------------------------------
|
|
42
|
+
numpydoc_xref_param_type = True
|
|
43
|
+
numpydoc_validation_checks = {
|
|
44
|
+
"all", # report on all checks, except the below
|
|
45
|
+
"ES01",
|
|
46
|
+
"EX01",
|
|
47
|
+
"SA01",
|
|
48
|
+
}
|
|
49
|
+
numpydoc_xref_aliases = {
|
|
50
|
+
'TextIO': 'typing.TextIO',
|
|
51
|
+
'List': 'list',
|
|
52
|
+
'Dict': 'dict',
|
|
53
|
+
'Tuple': 'tuple',
|
|
54
|
+
}
|
|
55
|
+
|
|
39
56
|
# vim: set ts=4 sts=4 sw=4 et ai si sta:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Installation
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
To install *vim-eof-comment*, first install it using ``pip``:
|
|
5
|
+
|
|
6
|
+
.. code-block:: console
|
|
7
|
+
|
|
8
|
+
$ pip install -U vim-eof-comment
|
|
9
|
+
|
|
10
|
+
You may also use ``pipenv`` or any other virtual environment:
|
|
11
|
+
|
|
12
|
+
.. code-block:: console
|
|
13
|
+
|
|
14
|
+
$ pipenv install vim-eof-comment
|
|
@@ -5,11 +5,13 @@ requires = ["setuptools", "setuptools-scm>=8.0"]
|
|
|
5
5
|
[project]
|
|
6
6
|
authors = [{ name = "Guennadi Maximov C", email = "g.maxc.fox@protonmail.com" }]
|
|
7
7
|
classifiers = [
|
|
8
|
-
"Development Status ::
|
|
8
|
+
"Development Status :: 4 - Beta",
|
|
9
9
|
"Environment :: Console",
|
|
10
10
|
"Intended Audience :: Developers",
|
|
11
11
|
"Intended Audience :: End Users/Desktop",
|
|
12
12
|
"Operating System :: OS Independent",
|
|
13
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
13
15
|
"Programming Language :: Python :: 3.10",
|
|
14
16
|
"Programming Language :: Python :: 3.11",
|
|
15
17
|
"Programming Language :: Python :: 3.12",
|
|
@@ -29,12 +31,23 @@ dependencies = [
|
|
|
29
31
|
"wheel",
|
|
30
32
|
]
|
|
31
33
|
description = "Adds Vim EOF comments for given filetypes in given directories"
|
|
34
|
+
keywords = [
|
|
35
|
+
"eof comments",
|
|
36
|
+
"eof",
|
|
37
|
+
"files",
|
|
38
|
+
"preprocessing",
|
|
39
|
+
"text",
|
|
40
|
+
"vim modeline",
|
|
41
|
+
"vim",
|
|
42
|
+
"vim-eof",
|
|
43
|
+
]
|
|
32
44
|
license = "GPL-2.0-only"
|
|
45
|
+
license-files = ["LICEN[CS]E"]
|
|
33
46
|
maintainers = [{ name = "Guennadi Maximov C", email = "g.maxc.fox@protonmail.com" }]
|
|
34
47
|
name = "vim-eof-comment"
|
|
35
48
|
readme = "README.md"
|
|
36
49
|
requires-python = ">=3.10"
|
|
37
|
-
version = "0.3.
|
|
50
|
+
version = "0.3.12"
|
|
38
51
|
|
|
39
52
|
[project.scripts]
|
|
40
53
|
vim-eof-comment = "vim_eof_comment.eof:main"
|
|
@@ -42,13 +55,14 @@ version = "0.3.10"
|
|
|
42
55
|
[project.urls]
|
|
43
56
|
Issues = "https://github.com/DrKJeff16/vim-eof-comment/issues"
|
|
44
57
|
Repository = "https://github.com/DrKJeff16/vim-eof-comment"
|
|
58
|
+
Download = "https://github.com/DrKJeff16/vim-eof-comment/releases/latest"
|
|
45
59
|
|
|
46
60
|
[tool.numpydoc_validation]
|
|
47
61
|
checks = [
|
|
62
|
+
"all", # report on all checks, except the below
|
|
48
63
|
"ES01",
|
|
49
64
|
"EX01",
|
|
50
65
|
"SA01",
|
|
51
|
-
"all", # report on all checks, except the below
|
|
52
66
|
]
|
|
53
67
|
exclude = [
|
|
54
68
|
'\.undocumented_method$',
|
|
@@ -61,8 +75,15 @@ exclude = [
|
|
|
61
75
|
]
|
|
62
76
|
exclude_files = ['^module/gui.*', '^tests/.*']
|
|
63
77
|
|
|
78
|
+
[tool.setuptools.packages.find]
|
|
79
|
+
where = ["."]
|
|
80
|
+
|
|
81
|
+
[tool.setuptools.package-dir]
|
|
82
|
+
vim-eof-comment = "vim_eof_comment"
|
|
83
|
+
|
|
64
84
|
[tool.setuptools.package-data]
|
|
65
|
-
"
|
|
85
|
+
"docs" = ["*.rst"]
|
|
86
|
+
"vim_eof_comment" = ["*.json", "*.py", "*.pyi"]
|
|
66
87
|
|
|
67
88
|
[tool.mypy]
|
|
68
89
|
exclude_gitignore = true
|
|
@@ -84,6 +105,29 @@ recursive = true
|
|
|
84
105
|
verbose = true
|
|
85
106
|
|
|
86
107
|
[tool.isort]
|
|
87
|
-
line_length
|
|
88
|
-
skip_glob = ["docs/*"]
|
|
108
|
+
line_length = 100
|
|
89
109
|
skip_gitignore = true
|
|
110
|
+
skip_glob = ["docs/*"]
|
|
111
|
+
|
|
112
|
+
[tool.rope]
|
|
113
|
+
automatic_soa = true
|
|
114
|
+
ignored_resources = [
|
|
115
|
+
"*.pyc",
|
|
116
|
+
"*~",
|
|
117
|
+
".git",
|
|
118
|
+
".hg",
|
|
119
|
+
".ropeproject",
|
|
120
|
+
".svn",
|
|
121
|
+
".tox",
|
|
122
|
+
".venv",
|
|
123
|
+
"_svn",
|
|
124
|
+
"build",
|
|
125
|
+
"docs",
|
|
126
|
+
"venv",
|
|
127
|
+
]
|
|
128
|
+
indent_size = 4
|
|
129
|
+
perform_doa = true
|
|
130
|
+
save_history = true
|
|
131
|
+
save_objectdb = true
|
|
132
|
+
split_imports = false
|
|
133
|
+
validate_objectdb = true
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
argcomplete==3.6.3; python_version >= '3.8'
|
|
3
3
|
argparse==1.4.0
|
|
4
4
|
colorama==0.4.6; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
|
|
5
|
+
greenlet==3.3.0; python_version >= '3.10'
|
|
6
|
+
msgpack==1.1.2; python_version >= '3.9'
|
|
7
|
+
pynvim==0.6.0; python_version >= '3.7'
|
|
5
8
|
pyproject==1!0.1.2; python_version >= '3.12'
|
|
9
|
+
python-magic==0.4.27; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
|
|
6
10
|
setuptools==80.9.0; python_version >= '3.9'
|
|
7
11
|
typing==3.7.4.3; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
|
|
8
12
|
typing-extensions==4.15.0; python_version >= '3.9'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.12
|
|
@@ -6,6 +6,7 @@ Ensure EOF Vim comments.
|
|
|
6
6
|
Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
|
|
7
7
|
"""
|
|
8
8
|
__all__ = [
|
|
9
|
+
"__version__",
|
|
9
10
|
"args",
|
|
10
11
|
"comments",
|
|
11
12
|
"eof",
|
|
@@ -15,13 +16,10 @@ __all__ = [
|
|
|
15
16
|
"types",
|
|
16
17
|
"util",
|
|
17
18
|
"version",
|
|
18
|
-
"version_info",
|
|
19
19
|
]
|
|
20
20
|
|
|
21
21
|
from . import args, comments, eof, file, regex, types, util
|
|
22
22
|
from .eof import main
|
|
23
|
-
from .version import
|
|
24
|
-
|
|
25
|
-
version: str = str(version_info)
|
|
23
|
+
from .version import __version__
|
|
26
24
|
|
|
27
25
|
# vim: set ts=4 sts=4 sw=4 et ai si sta:
|
|
@@ -6,10 +6,11 @@ from . import regex as regex
|
|
|
6
6
|
from . import types as types
|
|
7
7
|
from . import util as util
|
|
8
8
|
from .eof import main as main
|
|
9
|
-
from .version import
|
|
9
|
+
from .version import __version__ as __version__
|
|
10
10
|
|
|
11
|
-
__all__ = ['args', 'comments', 'eof', 'file', 'main', 'regex', 'types', 'util', 'version'
|
|
11
|
+
__all__ = ['__version__', 'args', 'comments', 'eof', 'file', 'main', 'regex', 'types', 'util', 'version']
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
# Names in __all__ with no definition:
|
|
14
|
+
# version
|
|
14
15
|
|
|
15
16
|
# vim: set ts=4 sts=4 sw=4 et ai si sta:
|
|
@@ -220,7 +220,7 @@ def indent_handler(indent: str) -> List[IndentHandler]:
|
|
|
220
220
|
if len(inds) >= 3 and inds[2].upper() in ("Y", "N"):
|
|
221
221
|
et = not inds[2].upper() == "N"
|
|
222
222
|
|
|
223
|
-
maps.append(IndentHandler(
|
|
223
|
+
maps.append(IndentHandler(ft_ext=ext, level=ind_level, expandtab=et))
|
|
224
224
|
|
|
225
225
|
return maps
|
|
226
226
|
|
|
@@ -5,8 +5,8 @@ Comment class module for ``vim-eof-comment``.
|
|
|
5
5
|
|
|
6
6
|
Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
|
|
7
7
|
"""
|
|
8
|
-
__all__ = ["generator"
|
|
8
|
+
__all__ = ["generator"]
|
|
9
9
|
|
|
10
|
-
from . import generator
|
|
10
|
+
from . import generator
|
|
11
11
|
|
|
12
12
|
# vim: set ts=4 sts=4 sw=4 et ai si sta:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{ "C": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "H": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "Makefile": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "bash": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "c": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "cc": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "cpp": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "css": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "fish": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "h": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "hh": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "hpp": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "htm": "<!-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: -->", "html": "<!-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: -->", "javascript": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "javascriptreact": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "js": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "jsx": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "latex": "% vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "lua": "-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "make": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "markdown": "<!-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: -->", "md": "<!-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: -->", "mk": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "py": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "pyi": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "python": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "rb": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "rs": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "ruby": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "rust": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "sh": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "tex": "% vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "toml": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "ts": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "tsx": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "typescript": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "typescriptreact": "/* vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: */", "xhtml": "<!-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: -->", "xml": "<!-- vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta: -->", "yaml": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "yml": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:", "zsh": "# vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:" }, { "C": { "level": 2, "expandtab": true }, "H": { "level": 2, "expandtab": true }, "Makefile": { "level": 4, "expandtab": false }, "bash": { "level": 4, "expandtab": true }, "c": { "level": 2, "expandtab": true }, "cc": { "level": 2, "expandtab": true }, "cpp": { "level": 2, "expandtab": true }, "css": { "level": 4, "expandtab": true }, "fish": { "level": 4, "expandtab": true }, "h": { "level": 2, "expandtab": true }, "hh": { "level": 2, "expandtab": true }, "hpp": { "level": 2, "expandtab": true }, "htm": { "level": 2, "expandtab": true }, "html": { "level": 2, "expandtab": true }, "javascript": { "level": 4, "expandtab": true }, "javascriptreact": { "level": 4, "expandtab": true }, "js": { "level": 4, "expandtab": true }, "jsx": { "level": 4, "expandtab": true }, "latex": { "level": 2, "expandtab": true }, "lua": { "level": 4, "expandtab": true }, "make": { "level": 4, "expandtab": false }, "markdown": { "level": 2, "expandtab": true }, "md": { "level": 2, "expandtab": true }, "mk": { "level": 4, "expandtab": false }, "py": { "level": 4, "expandtab": true }, "pyi": { "level": 4, "expandtab": true }, "python": { "level": 4, "expandtab": true }, "rb": { "level": 2, "expandtab": true }, "rs": { "level": 4, "expandtab": true }, "ruby": { "level": 2, "expandtab": true }, "rust": { "level": 4, "expandtab": true }, "sh": { "level": 4, "expandtab": true }, "tex": { "level": 2, "expandtab": true }, "toml": { "level": 4, "expandtab": true }, "ts": { "level": 4, "expandtab": true }, "tsx": { "level": 4, "expandtab": true }, "typescript": { "level": 4, "expandtab": true }, "typescriptreact": { "level": 4, "expandtab": true }, "xhtml": { "level": 2, "expandtab": true }, "xml": { "level": 2, "expandtab": true }, "yaml": { "level": 2, "expandtab": true }, "yml": { "level": 2, "expandtab": true }, "zsh": { "level": 4, "expandtab": true } }]
|
|
@@ -13,22 +13,22 @@ from io import TextIOWrapper
|
|
|
13
13
|
from os.path import exists, isdir, realpath
|
|
14
14
|
from typing import Dict, Iterator, List, NoReturn, Tuple
|
|
15
15
|
|
|
16
|
+
from ..types import IndentMap
|
|
16
17
|
from ..util import die
|
|
17
|
-
from .types import GeneratedEOFComments, IndentMapDict
|
|
18
18
|
|
|
19
19
|
_JSON_FILE: str = realpath("./vim_eof_comment/comments/filetypes.json")
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def import_json() -> Tuple[
|
|
22
|
+
def import_json() -> Tuple[Dict[str, str], Dict[str, IndentMap]]:
|
|
23
23
|
"""
|
|
24
24
|
Import default vars from JSON file.
|
|
25
25
|
|
|
26
26
|
Returns
|
|
27
27
|
-------
|
|
28
|
-
comments :
|
|
29
|
-
The default ``
|
|
30
|
-
map_dict :
|
|
31
|
-
The default
|
|
28
|
+
comments : Dict[str, str]
|
|
29
|
+
The default ``Dict[str, str]``.
|
|
30
|
+
map_dict : Dict[str, IndentMap]
|
|
31
|
+
The default indent mappings dict.
|
|
32
32
|
"""
|
|
33
33
|
splitter: str = "/" if os.name != "nt" else "\\"
|
|
34
34
|
split = __file__.split(splitter)
|
|
@@ -39,7 +39,7 @@ def import_json() -> Tuple[GeneratedEOFComments, IndentMapDict]:
|
|
|
39
39
|
data: str = "".join(file.read().split("\n"))
|
|
40
40
|
file.close()
|
|
41
41
|
|
|
42
|
-
result: Tuple[
|
|
42
|
+
result: Tuple[Dict[str, str], Dict[str, IndentMap]] = json.loads(data)
|
|
43
43
|
|
|
44
44
|
return result[0], result[1]
|
|
45
45
|
|
|
@@ -53,18 +53,18 @@ class Comments():
|
|
|
53
53
|
|
|
54
54
|
Parameters
|
|
55
55
|
----------
|
|
56
|
-
mappings :
|
|
56
|
+
mappings : Dict[str, IndentMap], optional, default=None
|
|
57
57
|
The ``str`` to ``IndentMap`` dictionary.
|
|
58
58
|
|
|
59
59
|
Attributes
|
|
60
60
|
----------
|
|
61
|
-
__DEFAULT :
|
|
61
|
+
__DEFAULT : Dict[str, IndentMap]
|
|
62
62
|
The default/fallback alternative to ``langs``.
|
|
63
|
-
__formats :
|
|
63
|
+
__formats : Dict[str, str]
|
|
64
64
|
The default/fallback alternative to ``comments``.
|
|
65
|
-
langs :
|
|
65
|
+
langs : Dict[str, IndentMap]
|
|
66
66
|
A dictionary of ``IndentMap`` type objects.
|
|
67
|
-
comments :
|
|
67
|
+
comments : Dict[str, str]
|
|
68
68
|
A dictionary of file-extension-to-EOF-comment mappings.
|
|
69
69
|
|
|
70
70
|
Methods
|
|
@@ -74,18 +74,18 @@ class Comments():
|
|
|
74
74
|
get_defaults()
|
|
75
75
|
"""
|
|
76
76
|
|
|
77
|
-
__DEFAULT:
|
|
78
|
-
__formats:
|
|
79
|
-
comments:
|
|
80
|
-
langs:
|
|
77
|
+
__DEFAULT: Dict[str, IndentMap] = _DEFAULT.copy()
|
|
78
|
+
__formats: Dict[str, str] = _formats.copy()
|
|
79
|
+
comments: Dict[str, str]
|
|
80
|
+
langs: Dict[str, IndentMap]
|
|
81
81
|
|
|
82
|
-
def __init__(self, mappings:
|
|
82
|
+
def __init__(self, mappings: Dict[str, IndentMap] | None = None):
|
|
83
83
|
"""
|
|
84
84
|
Create a new Vim EOF comment object.
|
|
85
85
|
|
|
86
86
|
Parameters
|
|
87
87
|
----------
|
|
88
|
-
mappings :
|
|
88
|
+
mappings : Dict[str, IndentMap], optional, default=None
|
|
89
89
|
The ``str`` to ``IndentMap`` dictionary.
|
|
90
90
|
"""
|
|
91
91
|
if mappings is None or len(mappings) == 0:
|
|
@@ -126,13 +126,13 @@ class Comments():
|
|
|
126
126
|
"""
|
|
127
127
|
return lang in self.__DEFAULT.keys()
|
|
128
128
|
|
|
129
|
-
def __fill_langs(self, langs:
|
|
129
|
+
def __fill_langs(self, langs: Dict[str, IndentMap]) -> NoReturn:
|
|
130
130
|
"""
|
|
131
131
|
Fill languages dict.
|
|
132
132
|
|
|
133
133
|
Parameters
|
|
134
134
|
----------
|
|
135
|
-
langs :
|
|
135
|
+
langs : Dict[str, IndentMap]
|
|
136
136
|
A dictionary of ``IndentMap`` type objects.
|
|
137
137
|
"""
|
|
138
138
|
if len(langs) == 0:
|
|
@@ -142,26 +142,26 @@ class Comments():
|
|
|
142
142
|
for lang, mapping in self.__DEFAULT.items():
|
|
143
143
|
langs[lang] = langs.get(lang, mapping)
|
|
144
144
|
|
|
145
|
-
self.langs =
|
|
145
|
+
self.langs = langs.copy()
|
|
146
146
|
|
|
147
|
-
def get_defaults(self) ->
|
|
147
|
+
def get_defaults(self) -> Dict[str, IndentMap]:
|
|
148
148
|
"""
|
|
149
149
|
Retrieve the default comment dictionary.
|
|
150
150
|
|
|
151
151
|
Returns
|
|
152
152
|
-------
|
|
153
|
-
|
|
153
|
+
Dict[str, IndentMap]
|
|
154
154
|
A dictionary of ``IndentMap`` type objects.
|
|
155
155
|
"""
|
|
156
156
|
return self.__DEFAULT
|
|
157
157
|
|
|
158
|
-
def generate(self) ->
|
|
158
|
+
def generate(self) -> Dict[str, str]:
|
|
159
159
|
"""
|
|
160
160
|
Generate the comments list.
|
|
161
161
|
|
|
162
162
|
Returns
|
|
163
163
|
-------
|
|
164
|
-
|
|
164
|
+
Dict[str, str]
|
|
165
165
|
The customly generated comments dictionary.
|
|
166
166
|
"""
|
|
167
167
|
comments: Dict[str, str] = dict()
|
|
@@ -174,7 +174,7 @@ class Comments():
|
|
|
174
174
|
|
|
175
175
|
comments[lang] = fmt.format(ts=lvl, sts=lvl, sw=sw, et=et)
|
|
176
176
|
|
|
177
|
-
self.comments:
|
|
177
|
+
self.comments: Dict[str, str] = comments.copy()
|
|
178
178
|
return self.comments
|
|
179
179
|
|
|
180
180
|
def get_ft(self, ext: str) -> str | None:
|
|
@@ -191,7 +191,7 @@ class Comments():
|
|
|
191
191
|
str or None
|
|
192
192
|
Either the file extension string, or if not available then ``None``.
|
|
193
193
|
"""
|
|
194
|
-
comments:
|
|
194
|
+
comments: Dict[str, str] = self.generate()
|
|
195
195
|
return comments.get(ext, None)
|
|
196
196
|
|
|
197
197
|
|
|
@@ -200,7 +200,7 @@ def list_filetypes() -> NoReturn:
|
|
|
200
200
|
txt: List[str] = [""]
|
|
201
201
|
|
|
202
202
|
c: Comments = Comments()
|
|
203
|
-
defaults:
|
|
203
|
+
defaults: Dict[str, IndentMap] = c.get_defaults()
|
|
204
204
|
for ext, indents in defaults.items():
|
|
205
205
|
txt.append(f"- {ext}: {indents}")
|
|
206
206
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
from typing import Iterator, NoReturn
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from ..types import IndentMap
|
|
4
4
|
|
|
5
5
|
__all__ = ['Comments', 'export_json', 'import_json', 'list_filetypes']
|
|
6
6
|
|
|
7
|
-
def import_json() -> tuple[
|
|
7
|
+
def import_json() -> tuple[dict[str, str], dict[str, IndentMap]]:
|
|
8
8
|
"""
|
|
9
9
|
Import default vars from JSON file.
|
|
10
10
|
|
|
11
11
|
Returns
|
|
12
12
|
-------
|
|
13
|
-
comments :
|
|
14
|
-
The default ``
|
|
15
|
-
map_dict :
|
|
16
|
-
The default
|
|
13
|
+
comments : Dict[str, str]
|
|
14
|
+
The default ``Dict[str, str]``.
|
|
15
|
+
map_dict : Dict[str, IndentMap]
|
|
16
|
+
The default indent mappings dict.
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
class Comments:
|
|
@@ -22,18 +22,18 @@ class Comments:
|
|
|
22
22
|
|
|
23
23
|
Parameters
|
|
24
24
|
----------
|
|
25
|
-
mappings :
|
|
25
|
+
mappings : Dict[str, IndentMap], optional, default=None
|
|
26
26
|
The ``str`` to ``IndentMap`` dictionary.
|
|
27
27
|
|
|
28
28
|
Attributes
|
|
29
29
|
----------
|
|
30
|
-
__DEFAULT :
|
|
30
|
+
__DEFAULT : Dict[str, IndentMap]
|
|
31
31
|
The default/fallback alternative to ``langs``.
|
|
32
|
-
__formats :
|
|
32
|
+
__formats : Dict[str, str]
|
|
33
33
|
The default/fallback alternative to ``comments``.
|
|
34
|
-
langs :
|
|
34
|
+
langs : Dict[str, IndentMap]
|
|
35
35
|
A dictionary of ``IndentMap`` type objects.
|
|
36
|
-
comments :
|
|
36
|
+
comments : Dict[str, str]
|
|
37
37
|
A dictionary of file-extension-to-EOF-comment mappings.
|
|
38
38
|
|
|
39
39
|
Methods
|
|
@@ -42,17 +42,17 @@ class Comments:
|
|
|
42
42
|
__fill_langs(langs)
|
|
43
43
|
get_defaults()
|
|
44
44
|
"""
|
|
45
|
-
__DEFAULT:
|
|
46
|
-
__formats:
|
|
47
|
-
comments:
|
|
48
|
-
langs:
|
|
49
|
-
def __init__(self, mappings:
|
|
45
|
+
__DEFAULT: dict[str, IndentMap]
|
|
46
|
+
__formats: dict[str, str]
|
|
47
|
+
comments: dict[str, str]
|
|
48
|
+
langs: dict[str, IndentMap]
|
|
49
|
+
def __init__(self, mappings: dict[str, IndentMap] | None = None) -> None:
|
|
50
50
|
"""
|
|
51
51
|
Create a new Vim EOF comment object.
|
|
52
52
|
|
|
53
53
|
Parameters
|
|
54
54
|
----------
|
|
55
|
-
mappings :
|
|
55
|
+
mappings : Dict[str, IndentMap], optional, default=None
|
|
56
56
|
The ``str`` to ``IndentMap`` dictionary.
|
|
57
57
|
"""
|
|
58
58
|
def __iter__(self) -> Iterator[str]:
|
|
@@ -71,31 +71,31 @@ class Comments:
|
|
|
71
71
|
bool
|
|
72
72
|
Represents whether the file extension has been included in the defaults.
|
|
73
73
|
"""
|
|
74
|
-
def __fill_langs(self, langs:
|
|
74
|
+
def __fill_langs(self, langs: dict[str, IndentMap]) -> NoReturn:
|
|
75
75
|
"""
|
|
76
76
|
Fill languages dict.
|
|
77
77
|
|
|
78
78
|
Parameters
|
|
79
79
|
----------
|
|
80
|
-
langs :
|
|
80
|
+
langs : Dict[str, IndentMap]
|
|
81
81
|
A dictionary of ``IndentMap`` type objects.
|
|
82
82
|
"""
|
|
83
|
-
def get_defaults(self) ->
|
|
83
|
+
def get_defaults(self) -> dict[str, IndentMap]:
|
|
84
84
|
"""
|
|
85
85
|
Retrieve the default comment dictionary.
|
|
86
86
|
|
|
87
87
|
Returns
|
|
88
88
|
-------
|
|
89
|
-
|
|
89
|
+
Dict[str, IndentMap]
|
|
90
90
|
A dictionary of ``IndentMap`` type objects.
|
|
91
91
|
"""
|
|
92
|
-
def generate(self) ->
|
|
92
|
+
def generate(self) -> dict[str, str]:
|
|
93
93
|
"""
|
|
94
94
|
Generate the comments list.
|
|
95
95
|
|
|
96
96
|
Returns
|
|
97
97
|
-------
|
|
98
|
-
|
|
98
|
+
Dict[str, str]
|
|
99
99
|
The customly generated comments dictionary.
|
|
100
100
|
"""
|
|
101
101
|
def get_ft(self, ext: str) -> str | None:
|
|
@@ -20,7 +20,7 @@ from .file import bootstrap_paths, get_last_line, modify_file, open_batch_paths
|
|
|
20
20
|
from .regex import matches
|
|
21
21
|
from .types import BatchPathDict, EOFCommentSearch, IndentHandler, IOWrapperBool
|
|
22
22
|
from .util import die, gen_indent_maps, verbose_print, version_print
|
|
23
|
-
from .version import
|
|
23
|
+
from .version import __version__, list_versions
|
|
24
24
|
|
|
25
25
|
_RED: int = Fore.LIGHTRED_EX
|
|
26
26
|
_GREEN: int = Fore.LIGHTGREEN_EX
|
|
@@ -41,7 +41,7 @@ def eof_comment_search(
|
|
|
41
41
|
files : Dict[str, BatchPathDict]
|
|
42
42
|
A dictionary of ``str`` to ``BatchPathDict`` objects.
|
|
43
43
|
comments : Comments
|
|
44
|
-
The ``Comments`` object containing the hardcoded comments per file
|
|
44
|
+
The ``Comments`` object containing the hardcoded comments per file-type/file-extension.
|
|
45
45
|
**kwargs
|
|
46
46
|
COntains the ``verbose`` and ``newline`` boolean options.
|
|
47
47
|
|
|
@@ -68,7 +68,7 @@ def eof_comment_search(
|
|
|
68
68
|
verbose_print(f"{_RESET}Analyzing files...\n", verbose=verbose)
|
|
69
69
|
for path, file in files.items():
|
|
70
70
|
file_obj: TextIOWrapper = file["file"]
|
|
71
|
-
ext: str = file["
|
|
71
|
+
ext: str = file["ft_ext"]
|
|
72
72
|
|
|
73
73
|
wrapper = get_last_line(file_obj)
|
|
74
74
|
last_line, has_nwl = wrapper["line"], wrapper["has_nwl"]
|
|
@@ -139,7 +139,7 @@ def main() -> int:
|
|
|
139
139
|
parser, ns = arg_parser_init()
|
|
140
140
|
|
|
141
141
|
if ns.version:
|
|
142
|
-
version_print(
|
|
142
|
+
version_print(__version__)
|
|
143
143
|
|
|
144
144
|
if ns.list_fts:
|
|
145
145
|
list_filetypes()
|
|
@@ -161,15 +161,12 @@ def main() -> int:
|
|
|
161
161
|
if dry_run:
|
|
162
162
|
verbose = True
|
|
163
163
|
|
|
164
|
-
indent = gen_indent_maps(indent.copy())
|
|
165
|
-
|
|
166
|
-
comments = Comments(indent)
|
|
167
|
-
|
|
168
164
|
files = open_batch_paths(bootstrap_paths(dirs, exts))
|
|
169
165
|
if len(files) == 0:
|
|
170
166
|
code = 1 if not dry_run else 0
|
|
171
167
|
die("No matching files found!", code=code)
|
|
172
168
|
|
|
169
|
+
comments = Comments(gen_indent_maps(indent.copy()))
|
|
173
170
|
results = eof_comment_search(files, comments, verbose=verbose, newline=newline)
|
|
174
171
|
if len(results) > 0 and not dry_run:
|
|
175
172
|
append_eof_comment(results, comments, newline)
|
|
@@ -14,7 +14,7 @@ def eof_comment_search(files: dict[str, BatchPathDict], comments: Comments, **kw
|
|
|
14
14
|
files : Dict[str, BatchPathDict]
|
|
15
15
|
A dictionary of ``str`` to ``BatchPathDict`` objects.
|
|
16
16
|
comments : Comments
|
|
17
|
-
The ``Comments`` object containing the hardcoded comments per file
|
|
17
|
+
The ``Comments`` object containing the hardcoded comments per file-type/file-extension.
|
|
18
18
|
**kwargs
|
|
19
19
|
COntains the ``verbose`` and ``newline`` boolean options.
|
|
20
20
|
|