vim-eof-comment 0.3.9__tar.gz → 0.3.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.
Files changed (61) hide show
  1. vim_eof_comment-0.3.11/.gitattributes +1 -0
  2. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.pre-commit-config.yaml +9 -1
  3. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/Makefile +5 -3
  4. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/PKG-INFO +3 -2
  5. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/pyproject.toml +68 -3
  6. vim_eof_comment-0.3.11/version.txt +1 -0
  7. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/__init__.py +2 -4
  8. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/__init__.pyi +4 -3
  9. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/args/parsing.py +2 -3
  10. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/comments/__init__.py +2 -2
  11. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/comments/__init__.pyi +1 -2
  12. vim_eof_comment-0.3.11/vim_eof_comment/comments/filetypes.json +1 -0
  13. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/comments/generator.py +29 -29
  14. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/comments/generator.pyi +24 -24
  15. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/eof.py +8 -11
  16. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/eof.pyi +1 -1
  17. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/file.py +4 -4
  18. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/file.pyi +1 -1
  19. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/types.py +6 -6
  20. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/types.pyi +6 -6
  21. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/util.py +1 -1
  22. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/version.py +7 -3
  23. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/version.pyi +4 -3
  24. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment.egg-info/PKG-INFO +3 -2
  25. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment.egg-info/SOURCES.txt +2 -4
  26. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment.egg-info/top_level.txt +2 -0
  27. vim_eof_comment-0.3.9/.gitignore +0 -210
  28. vim_eof_comment-0.3.9/version.txt +0 -1
  29. vim_eof_comment-0.3.9/vim_eof_comment/comments/filetypes.json +0 -1
  30. vim_eof_comment-0.3.9/vim_eof_comment/comments/types.py +0 -76
  31. vim_eof_comment-0.3.9/vim_eof_comment/comments/types.pyi +0 -65
  32. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.flake8 +0 -0
  33. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.github/CODEOWNERS +0 -0
  34. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.github/workflows/flake8-lint.yml +0 -0
  35. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.github/workflows/mypy-lint.yml +0 -0
  36. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.github/workflows/release.yml +0 -0
  37. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/.taplo.toml +0 -0
  38. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/LICENSE +0 -0
  39. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/Pipfile +0 -0
  40. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/README.md +0 -0
  41. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/docs/Makefile +0 -0
  42. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/docs/make.bat +0 -0
  43. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/docs/source/conf.py +0 -0
  44. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/docs/source/functions.rst +0 -0
  45. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/docs/source/index.rst +0 -0
  46. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/docs/source/usage.rst +0 -0
  47. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/requirements.txt +0 -0
  48. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/setup.cfg +0 -0
  49. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/__main__.py +0 -0
  50. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/args/__init__.py +0 -0
  51. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/args/__init__.pyi +0 -0
  52. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/args/completion.py +0 -0
  53. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/args/completion.pyi +0 -0
  54. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/args/parsing.pyi +0 -0
  55. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/py.typed +0 -0
  56. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/regex.py +0 -0
  57. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/regex.pyi +0 -0
  58. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment/util.pyi +0 -0
  59. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment.egg-info/dependency_links.txt +0 -0
  60. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment.egg-info/entry_points.txt +0 -0
  61. {vim_eof_comment-0.3.9 → vim_eof_comment-0.3.11}/vim_eof_comment.egg-info/requires.txt +0 -0
@@ -0,0 +1 @@
1
+ .gitignore export-ignore
@@ -1,20 +1,28 @@
1
1
  repos:
2
+ - repo: https://github.com/pycqa/isort
3
+ rev: 7.0.0
4
+ hooks:
5
+ - id: isort
6
+ verbose: true
2
7
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
8
  rev: v6.0.0
4
9
  hooks:
5
10
  - id: end-of-file-fixer
11
+ verbose: true
6
12
  - repo: https://github.com/Lucas-C/pre-commit-hooks
7
13
  rev: v1.5.5
8
14
  hooks:
9
15
  - id: remove-crlf
16
+ verbose: true
10
17
  - id: forbid-crlf # Forbid files containing CRLF end-lines to be committed
18
+ verbose: true
11
19
  - repo: local
12
20
  hooks:
13
21
  - id: lint
14
22
  name: Lint Script
15
23
  language: system
16
24
  types: [python]
17
- files: ^(vim_eof_comment/.*\.py|Makefile)$
25
+ files: ^(vim_eof_comment/.*\.pyi?|Makefile)$
18
26
  entry: make lint
19
27
  verbose: true
20
28
  - id: run_script
@@ -40,12 +40,14 @@ lint:
40
40
  @flake8 --statistics --show-source --color=always --max-line-length=100 --ignore=D401 \
41
41
  --per-file-ignores=__init__.py:F401 \
42
42
  --exclude .tox,.git,*staticfiles*,build,locale,docs,tools,venv,.venv,*migrations*,*.pyc,*.pyi,__pycache__,test_*.py \
43
- .
43
+ vim_eof_comment
44
+ @pydocstyle --convention=numpy --match='.*\.py' vim_eof_comment
45
+ @autopep8 --aggressive --aggressive --aggressive --in-place --recursive vim_eof_comment
44
46
  @echo -e "\nDone!"
45
47
 
46
48
  stubs: lint
47
49
  @echo -e "Generating stubs...\n"
48
- @stubgen --include-docstrings --include-private -p vim_eof_comment -o .
50
+ @stubgen --include-docstrings --include-private -v -p vim_eof_comment -o .
49
51
  @echo -e "\nDone!"
50
52
  @echo -e "\nRunning isort...\n"
51
53
  @isort vim_eof_comment
@@ -56,7 +58,7 @@ stubs: lint
56
58
 
57
59
  build: stubs
58
60
  @echo -e "Building...\n"
59
- @python3 -m build &> /dev/null
61
+ @python3 -m build
60
62
  @echo -e "\nDone!"
61
63
 
62
64
  sign: build
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vim-eof-comment
3
- Version: 0.3.9
3
+ Version: 0.3.11
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
- Classifier: Development Status :: 3 - Alpha
10
+ Keywords: eof comments,eof,files,preprocessing,text,vim modeline,vim,vim-eof
11
+ Classifier: Development Status :: 4 - Beta
11
12
  Classifier: Environment :: Console
12
13
  Classifier: Intended Audience :: Developers
13
14
  Classifier: Intended Audience :: End Users/Desktop
@@ -5,7 +5,7 @@ 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 :: 3 - Alpha",
8
+ "Development Status :: 4 - Beta",
9
9
  "Environment :: Console",
10
10
  "Intended Audience :: Developers",
11
11
  "Intended Audience :: End Users/Desktop",
@@ -29,12 +29,23 @@ dependencies = [
29
29
  "wheel",
30
30
  ]
31
31
  description = "Adds Vim EOF comments for given filetypes in given directories"
32
+ keywords = [
33
+ "eof comments",
34
+ "eof",
35
+ "files",
36
+ "preprocessing",
37
+ "text",
38
+ "vim modeline",
39
+ "vim",
40
+ "vim-eof",
41
+ ]
32
42
  license = "GPL-2.0-only"
43
+ license-files = ["LICEN[CS]E"]
33
44
  maintainers = [{ name = "Guennadi Maximov C", email = "g.maxc.fox@protonmail.com" }]
34
45
  name = "vim-eof-comment"
35
46
  readme = "README.md"
36
47
  requires-python = ">=3.10"
37
- version = "0.3.9"
48
+ version = "0.3.11"
38
49
 
39
50
  [project.scripts]
40
51
  vim-eof-comment = "vim_eof_comment.eof:main"
@@ -61,5 +72,59 @@ exclude = [
61
72
  ]
62
73
  exclude_files = ['^module/gui.*', '^tests/.*']
63
74
 
75
+ [tool.setuptools.packages.find]
76
+ where = ["."]
77
+
78
+ [tool.setuptools.package-dir]
79
+ vim-eof-comment = "vim_eof_comment"
80
+
64
81
  [tool.setuptools.package-data]
65
- "*" = ["*.json"]
82
+ "docs" = ["*.rst"]
83
+ "vim_eof_comment" = ["*.json", "*.py", "*.pyi"]
84
+
85
+ [tool.mypy]
86
+ exclude_gitignore = true
87
+ follow_untyped_imports = true
88
+ python_version = "3.13"
89
+ warn_return_any = true
90
+ warn_unused_configs = true
91
+
92
+ [tool.pydocstyle]
93
+ convention = "numpy"
94
+ match = ".*\\.py"
95
+ verbose = true
96
+
97
+ [tool.autopep8]
98
+ aggressive = 3
99
+ in-place = true
100
+ max_line_length = 100
101
+ recursive = true
102
+ verbose = true
103
+
104
+ [tool.isort]
105
+ line_length = 100
106
+ skip_gitignore = true
107
+ skip_glob = ["docs/*"]
108
+
109
+ [tool.rope]
110
+ automatic_soa = true
111
+ ignored_resources = [
112
+ "*.pyc",
113
+ "*~",
114
+ ".git",
115
+ ".hg",
116
+ ".ropeproject",
117
+ ".svn",
118
+ ".tox",
119
+ ".venv",
120
+ "_svn",
121
+ "build",
122
+ "docs",
123
+ "venv",
124
+ ]
125
+ indent_size = 4
126
+ perform_doa = true
127
+ save_history = true
128
+ save_objectdb = true
129
+ split_imports = false
130
+ validate_objectdb = true
@@ -0,0 +1 @@
1
+ 0.3.11
@@ -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 version_info
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 version_info as version_info
9
+ from .version import __version__ as __version__
10
10
 
11
- __all__ = ['args', 'comments', 'eof', 'file', 'main', 'regex', 'types', 'util', 'version', 'version_info']
11
+ __all__ = ['__version__', 'args', 'comments', 'eof', 'file', 'main', 'regex', 'types', 'util', 'version']
12
12
 
13
- version: str
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:
@@ -7,8 +7,7 @@ Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
8
  __all__ = ["gen_parser_specs", "bootstrap_args", "arg_parser_init", "indent_handler"]
9
9
 
10
- from argparse import (ArgumentDefaultsHelpFormatter, ArgumentError,
11
- ArgumentParser, Namespace)
10
+ from argparse import ArgumentDefaultsHelpFormatter, ArgumentError, ArgumentParser, Namespace
12
11
  from typing import List, Tuple
13
12
 
14
13
  from argcomplete.completers import DirectoriesCompleter
@@ -221,7 +220,7 @@ def indent_handler(indent: str) -> List[IndentHandler]:
221
220
  if len(inds) >= 3 and inds[2].upper() in ("Y", "N"):
222
221
  et = not inds[2].upper() == "N"
223
222
 
224
- maps.append(IndentHandler(ext=ext, level=ind_level, expandtab=et))
223
+ maps.append(IndentHandler(ft_ext=ext, level=ind_level, expandtab=et))
225
224
 
226
225
  return maps
227
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", "types"]
8
+ __all__ = ["generator"]
9
9
 
10
- from . import generator, types
10
+ from . import generator
11
11
 
12
12
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -1,6 +1,5 @@
1
1
  from . import generator as generator
2
- from . import types as types
3
2
 
4
- __all__ = ['generator', 'types']
3
+ __all__ = ['generator']
5
4
 
6
5
  # 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[GeneratedEOFComments, IndentMapDict]:
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 : GeneratedEOFComments
29
- The default ``GeneratedEOFComments``.
30
- map_dict : IndentMapDict
31
- The default ``IndentMapDict``.
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[GeneratedEOFComments, IndentMapDict] = json.loads(data)
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 : IndentMapDict, optional, default=None
56
+ mappings : Dict[str, IndentMap], optional, default=None
57
57
  The ``str`` to ``IndentMap`` dictionary.
58
58
 
59
59
  Attributes
60
60
  ----------
61
- __DEFAULT : IndentMapDict
61
+ __DEFAULT : Dict[str, IndentMap]
62
62
  The default/fallback alternative to ``langs``.
63
- __formats : GeneratedEOFComments
63
+ __formats : Dict[str, str]
64
64
  The default/fallback alternative to ``comments``.
65
- langs : IndentMapDict
65
+ langs : Dict[str, IndentMap]
66
66
  A dictionary of ``IndentMap`` type objects.
67
- comments : GeneratedEOFComments
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: IndentMapDict = _DEFAULT.copy()
78
- __formats: GeneratedEOFComments = _formats.copy()
79
- comments: GeneratedEOFComments
80
- langs: IndentMapDict
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: IndentMapDict | None = None):
82
+ def __init__(self, mappings: Dict[str, IndentMap] | None = None):
83
83
  """
84
- Creates a new Vim EOF comment object.
84
+ Create a new Vim EOF comment object.
85
85
 
86
86
  Parameters
87
87
  ----------
88
- mappings : IndentMapDict, optional, default=None
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: IndentMapDict) -> NoReturn:
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 : IndentMapDict
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 = IndentMapDict(**langs)
145
+ self.langs = langs.copy()
146
146
 
147
- def get_defaults(self) -> IndentMapDict:
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
- IndentMapDict
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) -> GeneratedEOFComments:
158
+ def generate(self) -> Dict[str, str]:
159
159
  """
160
160
  Generate the comments list.
161
161
 
162
162
  Returns
163
163
  -------
164
- GeneratedEOFComments
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: GeneratedEOFComments = GeneratedEOFComments(**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: GeneratedEOFComments = self.generate()
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: IndentMapDict = c.get_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 .types import GeneratedEOFComments, IndentMapDict
3
+ from ..types import IndentMap
4
4
 
5
5
  __all__ = ['Comments', 'export_json', 'import_json', 'list_filetypes']
6
6
 
7
- def import_json() -> tuple[GeneratedEOFComments, IndentMapDict]:
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 : GeneratedEOFComments
14
- The default ``GeneratedEOFComments``.
15
- map_dict : IndentMapDict
16
- The default ``IndentMapDict``.
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 : IndentMapDict, optional, default=None
25
+ mappings : Dict[str, IndentMap], optional, default=None
26
26
  The ``str`` to ``IndentMap`` dictionary.
27
27
 
28
28
  Attributes
29
29
  ----------
30
- __DEFAULT : IndentMapDict
30
+ __DEFAULT : Dict[str, IndentMap]
31
31
  The default/fallback alternative to ``langs``.
32
- __formats : GeneratedEOFComments
32
+ __formats : Dict[str, str]
33
33
  The default/fallback alternative to ``comments``.
34
- langs : IndentMapDict
34
+ langs : Dict[str, IndentMap]
35
35
  A dictionary of ``IndentMap`` type objects.
36
- comments : GeneratedEOFComments
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: IndentMapDict
46
- __formats: GeneratedEOFComments
47
- comments: GeneratedEOFComments
48
- langs: IndentMapDict
49
- def __init__(self, mappings: IndentMapDict | None = None) -> None:
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
- Creates a new Vim EOF comment object.
51
+ Create a new Vim EOF comment object.
52
52
 
53
53
  Parameters
54
54
  ----------
55
- mappings : IndentMapDict, optional, default=None
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: IndentMapDict) -> NoReturn:
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 : IndentMapDict
80
+ langs : Dict[str, IndentMap]
81
81
  A dictionary of ``IndentMap`` type objects.
82
82
  """
83
- def get_defaults(self) -> IndentMapDict:
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
- IndentMapDict
89
+ Dict[str, IndentMap]
90
90
  A dictionary of ``IndentMap`` type objects.
91
91
  """
92
- def generate(self) -> GeneratedEOFComments:
92
+ def generate(self) -> dict[str, str]:
93
93
  """
94
94
  Generate the comments list.
95
95
 
96
96
  Returns
97
97
  -------
98
- GeneratedEOFComments
98
+ Dict[str, str]
99
99
  The customly generated comments dictionary.
100
100
  """
101
101
  def get_ft(self, ext: str) -> str | None:
@@ -18,10 +18,9 @@ from .args.parsing import arg_parser_init, indent_handler
18
18
  from .comments.generator import Comments, list_filetypes
19
19
  from .file import bootstrap_paths, get_last_line, modify_file, open_batch_paths
20
20
  from .regex import matches
21
- from .types import (BatchPathDict, EOFCommentSearch, IndentHandler,
22
- IOWrapperBool)
21
+ from .types import BatchPathDict, EOFCommentSearch, IndentHandler, IOWrapperBool
23
22
  from .util import die, gen_indent_maps, verbose_print, version_print
24
- from .version import list_versions, version_info
23
+ from .version import __version__, list_versions
25
24
 
26
25
  _RED: int = Fore.LIGHTRED_EX
27
26
  _GREEN: int = Fore.LIGHTGREEN_EX
@@ -42,7 +41,7 @@ def eof_comment_search(
42
41
  files : Dict[str, BatchPathDict]
43
42
  A dictionary of ``str`` to ``BatchPathDict`` objects.
44
43
  comments : Comments
45
- The ``Comments`` object containing the hardcoded comments per file extension.
44
+ The ``Comments`` object containing the hardcoded comments per file-type/file-extension.
46
45
  **kwargs
47
46
  COntains the ``verbose`` and ``newline`` boolean options.
48
47
 
@@ -69,7 +68,7 @@ def eof_comment_search(
69
68
  verbose_print(f"{_RESET}Analyzing files...\n", verbose=verbose)
70
69
  for path, file in files.items():
71
70
  file_obj: TextIOWrapper = file["file"]
72
- ext: str = file["ext"]
71
+ ext: str = file["ft_ext"]
73
72
 
74
73
  wrapper = get_last_line(file_obj)
75
74
  last_line, has_nwl = wrapper["line"], wrapper["has_nwl"]
@@ -140,7 +139,7 @@ def main() -> int:
140
139
  parser, ns = arg_parser_init()
141
140
 
142
141
  if ns.version:
143
- version_print(str(version_info))
142
+ version_print(__version__)
144
143
 
145
144
  if ns.list_fts:
146
145
  list_filetypes()
@@ -162,14 +161,12 @@ def main() -> int:
162
161
  if dry_run:
163
162
  verbose = True
164
163
 
165
- indent = gen_indent_maps(indent.copy())
166
-
167
- comments = Comments(indent)
168
-
169
164
  files = open_batch_paths(bootstrap_paths(dirs, exts))
170
165
  if len(files) == 0:
171
- die("No matching files found!", code=1)
166
+ code = 1 if not dry_run else 0
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 extension.
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
 
@@ -44,7 +44,7 @@ def bootstrap_paths(paths: List[str], exts: List[str]) -> List[BatchPairDict]:
44
44
  if not file.endswith(ext):
45
45
  continue
46
46
 
47
- result.append(BatchPairDict(fpath=join(root, file), ext=ext))
47
+ result.append(BatchPairDict(fpath=join(root, file), ft_ext=ext))
48
48
 
49
49
  return result
50
50
 
@@ -65,9 +65,9 @@ def open_batch_paths(paths: List[BatchPairDict]) -> Dict[str, BatchPathDict]:
65
65
  """
66
66
  result = dict()
67
67
  for path in paths:
68
- fpath, ext = path["fpath"], path["ext"]
68
+ fpath, ext = path["fpath"], path["ft_ext"]
69
69
  try:
70
- result[fpath] = {"file": open(fpath, "r"), "ext": ext}
70
+ result[fpath] = {"file": open(fpath, "r"), "ft_ext": ext}
71
71
  except KeyboardInterrupt:
72
72
  die("\nProgram interrupted!", code=1) # Kills the program
73
73
  except FileNotFoundError:
@@ -89,7 +89,7 @@ def modify_file(file: TextIOWrapper, comments: Dict[str, str], ext: str, **kwarg
89
89
  comments : Dict[str, str]
90
90
  A filetype-to-comment dictionary.
91
91
  ext : str
92
- The filetype extension given by the user.
92
+ The file-type/file-extension given by the user.
93
93
  **kwargs
94
94
  Contains the ``newline``, and ``matching`` boolean attributes.
95
95
 
@@ -45,7 +45,7 @@ def modify_file(file: TextIOWrapper, comments: dict[str, str], ext: str, **kwarg
45
45
  comments : Dict[str, str]
46
46
  A filetype-to-comment dictionary.
47
47
  ext : str
48
- The filetype extension given by the user.
48
+ The file-type/file-extension given by the user.
49
49
  **kwargs
50
50
  Contains the ``newline``, and ``matching`` boolean attributes.
51
51