vim-eof-comment 0.3.12__tar.gz → 0.3.13__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 (59) hide show
  1. vim_eof_comment-0.3.13/.github/workflows/vim-eof-comment.yml +40 -0
  2. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/PKG-INFO +1 -1
  3. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/pyproject.toml +1 -1
  4. vim_eof_comment-0.3.13/version.txt +1 -0
  5. vim_eof_comment-0.3.13/vim_eof_comment/args/completion.py +48 -0
  6. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/args/completion.pyi +1 -1
  7. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/comments/generator.py +47 -5
  8. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/eof.py +2 -2
  9. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/util.py +1 -17
  10. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/util.pyi +1 -14
  11. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/version.py +17 -5
  12. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/version.pyi +14 -3
  13. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment.egg-info/PKG-INFO +1 -1
  14. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment.egg-info/SOURCES.txt +1 -0
  15. vim_eof_comment-0.3.12/version.txt +0 -1
  16. vim_eof_comment-0.3.12/vim_eof_comment/args/completion.py +0 -30
  17. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.flake8 +0 -0
  18. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.gitattributes +0 -0
  19. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.github/CODEOWNERS +0 -0
  20. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.github/workflows/flake8-lint.yml +0 -0
  21. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.github/workflows/mypy-lint.yml +0 -0
  22. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.github/workflows/release.yml +0 -0
  23. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/.pre-commit-config.yaml +0 -0
  24. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/LICENSE +0 -0
  25. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/Makefile +0 -0
  26. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/Pipfile +0 -0
  27. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/README.md +0 -0
  28. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/docs/Makefile +0 -0
  29. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/docs/make.bat +0 -0
  30. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/docs/source/conf.py +0 -0
  31. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/docs/source/functions.rst +0 -0
  32. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/docs/source/index.rst +0 -0
  33. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/docs/source/installation.rst +0 -0
  34. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/requirements.txt +0 -0
  35. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/setup.cfg +0 -0
  36. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/taplo.toml +0 -0
  37. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/__init__.py +0 -0
  38. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/__init__.pyi +0 -0
  39. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/__main__.py +0 -0
  40. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/args/__init__.py +0 -0
  41. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/args/__init__.pyi +0 -0
  42. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/args/parsing.py +0 -0
  43. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/args/parsing.pyi +0 -0
  44. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/comments/__init__.py +0 -0
  45. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/comments/__init__.pyi +0 -0
  46. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/comments/filetypes.json +0 -0
  47. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/comments/generator.pyi +0 -0
  48. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/eof.pyi +0 -0
  49. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/file.py +0 -0
  50. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/file.pyi +0 -0
  51. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/py.typed +0 -0
  52. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/regex.py +0 -0
  53. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/regex.pyi +0 -0
  54. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/types.py +0 -0
  55. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment/types.pyi +0 -0
  56. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment.egg-info/dependency_links.txt +0 -0
  57. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment.egg-info/entry_points.txt +0 -0
  58. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment.egg-info/requires.txt +0 -0
  59. {vim_eof_comment-0.3.12 → vim_eof_comment-0.3.13}/vim_eof_comment.egg-info/top_level.txt +0 -0
@@ -0,0 +1,40 @@
1
+ # GitHub Actions example
2
+ name: Run vim-eof-comment
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ branches:
11
+ - main
12
+ jobs:
13
+ vim_eof_comment:
14
+ name: vim-eof-comment
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v6
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v6.1.0
23
+ with:
24
+ python-version: '3.10'
25
+ - name: Install pipenv
26
+ run: |
27
+ python -m pip install -U pip
28
+ pip install pipenv
29
+ - name: Install vim-eof-comment
30
+ run: |
31
+ pipenv install --dev vim-eof-comment
32
+ - name: Run vim-eof-comment
33
+ run: |
34
+ pipenv run vim-eof-comment -e lua,md,Makefile,yaml,toml -i lua:2:Y,md:2:Y -v .
35
+ - name: Auto Commit Changes
36
+ uses: stefanzweifel/git-auto-commit-action@v7.1.0
37
+ with:
38
+ commit_message: "chore: format files with `vim-eof-comment`"
39
+ commit_options: "--signoff"
40
+ branch: ${{ github.head_ref }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vim-eof-comment
3
- Version: 0.3.12
3
+ Version: 0.3.13
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>
@@ -47,7 +47,7 @@ maintainers = [{ name = "Guennadi Maximov C", email = "g.maxc.fox@protonmail.com
47
47
  name = "vim-eof-comment"
48
48
  readme = "README.md"
49
49
  requires-python = ">=3.10"
50
- version = "0.3.12"
50
+ version = "0.3.13"
51
51
 
52
52
  [project.scripts]
53
53
  vim-eof-comment = "vim_eof_comment.eof:main"
@@ -0,0 +1 @@
1
+ 0.3.13
@@ -0,0 +1,48 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
3
+ """
4
+ Argument parsing completion utilities for ``vim-eof-comment``.
5
+
6
+ Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
+ """
8
+ __all__ = ["complete_parser"]
9
+
10
+ from argparse import ArgumentParser
11
+ from typing import List, NoReturn
12
+
13
+ from argcomplete import autocomplete
14
+
15
+
16
+ def complete_validator(completion_candidate: List[str], current_input: str) -> bool:
17
+ """
18
+ Complete non-prefix substring matches.
19
+
20
+ Parameters
21
+ ----------
22
+ completion_candidate : List[str]
23
+ All the completion candidates.
24
+ current_input : str
25
+ The current input string.
26
+
27
+ Returns
28
+ -------
29
+ bool
30
+ Whether the current input fits the completion candidates pool.
31
+ """
32
+ return current_input in completion_candidate
33
+
34
+
35
+ def complete_parser(parser: ArgumentParser, **kwargs) -> NoReturn:
36
+ """
37
+ Complete the script argument parser.
38
+
39
+ Parameters
40
+ ----------
41
+ parser : argparse.ArgumentParser
42
+ The ``ArgumentParser`` object.
43
+ **kwargs
44
+ Extra parameters to be passed to ``argcomplete.autocomplete()``.
45
+ """
46
+ autocomplete(parser, validator=complete_validator, **kwargs)
47
+
48
+ # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -12,7 +12,7 @@ def complete_parser(parser: ArgumentParser, **kwargs) -> NoReturn:
12
12
  parser : argparse.ArgumentParser
13
13
  The ``ArgumentParser`` object.
14
14
  **kwargs
15
- Extra parameters.
15
+ Extra parameters to be passed to ``argcomplete.autocomplete()``.
16
16
  """
17
17
 
18
18
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -13,11 +13,20 @@ 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 colorama import Fore, Style
17
+ from colorama import init as color_init
18
+
16
19
  from ..types import IndentMap
17
20
  from ..util import die
18
21
 
19
22
  _JSON_FILE: str = realpath("./vim_eof_comment/comments/filetypes.json")
20
23
 
24
+ _BLUE: int = Fore.BLUE
25
+ _YELLOW: int = Fore.YELLOW
26
+ _CYAN: int = Fore.CYAN
27
+ _BRIGHT: int = Style.BRIGHT
28
+ _RESET: int = Style.RESET_ALL
29
+
21
30
 
22
31
  def import_json() -> Tuple[Dict[str, str], Dict[str, IndentMap]]:
23
32
  """
@@ -195,15 +204,48 @@ class Comments():
195
204
  return comments.get(ext, None)
196
205
 
197
206
 
207
+ def generate_list_items(ft: str, level: int, expandtab: str) -> str:
208
+ """
209
+ Generate a colored string for filetypes listing.
210
+
211
+ Parameters
212
+ ----------
213
+ ft : str
214
+ The filetype item in question.
215
+ level : int
216
+ Indent size.
217
+ expandtab : str
218
+ Either ``"Yes"`` or ``"No"``.
219
+
220
+ Returns
221
+ -------
222
+ str
223
+ The generated string.
224
+ """
225
+ txt = f"{_RESET}{_BRIGHT}{_BLUE}{ft}\n"
226
+ txt += f" {_RESET}{_BRIGHT}indent size{_RESET}{_BRIGHT} ==> {_CYAN}{level}\n"
227
+ txt += f" {_RESET}{_BRIGHT}expandtab{_RESET}{_BRIGHT} ==> {_CYAN}{expandtab}"
228
+
229
+ return txt
230
+
231
+
198
232
  def list_filetypes() -> NoReturn:
199
233
  """List all available filetypes."""
200
- txt: List[str] = [""]
234
+ color_init()
235
+
236
+ defaults = Comments().get_defaults()
237
+ items: Dict[str, Tuple[int, str]] = dict()
238
+ for ft_ext, indents in defaults.items():
239
+ level: int = indents.get("level", 4)
240
+ et = "Yes" if indents.get("expandtab") else "No"
241
+ items[ft_ext] = (level, et)
242
+
243
+ keys: List[str] = list(items.keys())
244
+ keys.sort()
201
245
 
202
- c: Comments = Comments()
203
- defaults: Dict[str, IndentMap] = c.get_defaults()
204
- for ext, indents in defaults.items():
205
- txt.append(f"- {ext}: {indents}")
246
+ sorted_items: Dict[str, Tuple[int, str]] = {i: items[i] for i in keys}
206
247
 
248
+ txt = [generate_list_items(k, v[0], v[1]) for k, v in sorted_items.items()]
207
249
  die(*txt, code=0, sep="\n")
208
250
 
209
251
 
@@ -19,8 +19,8 @@ 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
21
  from .types import BatchPathDict, EOFCommentSearch, IndentHandler, IOWrapperBool
22
- from .util import die, gen_indent_maps, verbose_print, version_print
23
- from .version import __version__, list_versions
22
+ from .util import die, gen_indent_maps, verbose_print
23
+ from .version import __version__, list_versions, version_print
24
24
 
25
25
  _RED: int = Fore.LIGHTRED_EX
26
26
  _GREEN: int = Fore.LIGHTGREEN_EX
@@ -5,7 +5,7 @@ EOF comments checker utilities.
5
5
 
6
6
  Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
- __all__ = ["die", "error", "gen_indent_maps", "verbose_print", "version_print"]
8
+ __all__ = ["die", "error", "gen_indent_maps", "verbose_print"]
9
9
 
10
10
  from sys import exit as Exit
11
11
  from sys import stderr, stdout
@@ -117,22 +117,6 @@ def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> NoReturn:
117
117
  print(*msg, end=end, sep=sep, flush=flush)
118
118
 
119
119
 
120
- def version_print(version: str) -> NoReturn:
121
- """
122
- Print project version, then exit.
123
-
124
- Parameters
125
- ----------
126
- version : str
127
- The version string.
128
-
129
- See Also
130
- --------
131
- vim_eof_comment.util.die : The function used for this function.
132
- """
133
- die(f"vim-eof-comment-{version}", code=0)
134
-
135
-
136
120
  def gen_indent_maps(maps: List[IndentHandler]) -> Dict[str, IndentMap] | None:
137
121
  """
138
122
  Generate a dictionary from the custom indent maps.
@@ -2,7 +2,7 @@ from typing import Callable, NoReturn, TextIO
2
2
 
3
3
  from .types import IndentHandler, IndentMap
4
4
 
5
- __all__ = ['die', 'error', 'gen_indent_maps', 'verbose_print', 'version_print']
5
+ __all__ = ['die', 'error', 'gen_indent_maps', 'verbose_print']
6
6
 
7
7
  def error(*msg, **kwargs) -> NoReturn:
8
8
  """
@@ -77,19 +77,6 @@ def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> NoReturn:
77
77
  --------
78
78
  print : This function is essentially being wrapped around here.
79
79
  """
80
- def version_print(version: str) -> NoReturn:
81
- """
82
- Print project version, then exit.
83
-
84
- Parameters
85
- ----------
86
- version : str
87
- The version string.
88
-
89
- See Also
90
- --------
91
- vim_eof_comment.util.die : The function used for this function.
92
- """
93
80
  def gen_indent_maps(maps: list[IndentHandler]) -> dict[str, IndentMap] | None:
94
81
  """
95
82
  Generate a dictionary from the custom indent maps.
@@ -5,7 +5,7 @@ Custom vim-eof-comment versioning objects.
5
5
 
6
6
  Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
- __all__ = ["VersionInfo", "list_versions", "version_info", "__version__"]
8
+ __all__ = ["VersionInfo", "list_versions", "version_info", "version_print", "__version__"]
9
9
 
10
10
  from typing import List, NoReturn, Tuple
11
11
 
@@ -103,7 +103,7 @@ class VersionInfo():
103
103
  Only one definition in constructor.
104
104
 
105
105
  >>> from vim_eof_comment.version import VersionInfo
106
- >>> print(VersionInfo([(0, 0, 1)]))
106
+ >>> print(repr(VersionInfo([(0, 0, 1)])))
107
107
  0.0.1
108
108
 
109
109
  Multiple definitions in constructor.
@@ -163,7 +163,7 @@ class VersionInfo():
163
163
  return result
164
164
 
165
165
 
166
- version_info: VersionInfo = VersionInfo([
166
+ version_info = VersionInfo([
167
167
  (0, 1, 1),
168
168
  (0, 1, 2),
169
169
  (0, 1, 3),
@@ -219,6 +219,7 @@ version_info: VersionInfo = VersionInfo([
219
219
  (0, 3, 10),
220
220
  (0, 3, 11),
221
221
  (0, 3, 12),
222
+ (0, 3, 13),
222
223
  ])
223
224
 
224
225
  __version__: str = str(version_info)
@@ -226,7 +227,18 @@ __version__: str = str(version_info)
226
227
 
227
228
  def list_versions() -> NoReturn:
228
229
  """List all versions."""
229
- all_versions: str = version_info.get_all_versions()
230
- die(all_versions, code=0)
230
+ die(version_info.get_all_versions(), code=0)
231
+
232
+
233
+ def version_print(version: str) -> NoReturn:
234
+ """
235
+ Print project version, then exit.
236
+
237
+ Parameters
238
+ ----------
239
+ version : str
240
+ The version string.
241
+ """
242
+ die(f"vim-eof-comment-{version}", code=0)
231
243
 
232
244
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -1,6 +1,8 @@
1
1
  from typing import NoReturn
2
2
 
3
- __all__ = ['VersionInfo', 'list_versions', 'version_info', '__version__']
3
+ from _typeshed import Incomplete
4
+
5
+ __all__ = ['VersionInfo', 'list_versions', 'version_info', 'version_print', '__version__']
4
6
 
5
7
  class VersionInfo:
6
8
  """
@@ -82,7 +84,7 @@ class VersionInfo:
82
84
  Only one definition in constructor.
83
85
 
84
86
  >>> from vim_eof_comment.version import VersionInfo
85
- >>> print(VersionInfo([(0, 0, 1)]))
87
+ >>> print(repr(VersionInfo([(0, 0, 1)])))
86
88
  0.0.1
87
89
 
88
90
  Multiple definitions in constructor.
@@ -124,10 +126,19 @@ class VersionInfo:
124
126
  0.0.3 (latest)
125
127
  """
126
128
 
127
- version_info: VersionInfo
129
+ version_info: Incomplete
128
130
  __version__: str
129
131
 
130
132
  def list_versions() -> NoReturn:
131
133
  """List all versions."""
134
+ def version_print(version: str) -> NoReturn:
135
+ """
136
+ Print project version, then exit.
137
+
138
+ Parameters
139
+ ----------
140
+ version : str
141
+ The version string.
142
+ """
132
143
 
133
144
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vim-eof-comment
3
- Version: 0.3.12
3
+ Version: 0.3.13
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>
@@ -13,6 +13,7 @@ version.txt
13
13
  .github/workflows/flake8-lint.yml
14
14
  .github/workflows/mypy-lint.yml
15
15
  .github/workflows/release.yml
16
+ .github/workflows/vim-eof-comment.yml
16
17
  docs/Makefile
17
18
  docs/make.bat
18
19
  docs/source/conf.py
@@ -1 +0,0 @@
1
- 0.3.12
@@ -1,30 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
3
- """
4
- Argument parsing completion utilities for ``vim-eof-comment``.
5
-
6
- Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
- """
8
- __all__ = ["complete_parser"]
9
-
10
- from argparse import ArgumentParser
11
- from typing import NoReturn
12
-
13
- from argcomplete import autocomplete
14
- from argcomplete.finders import default_validator
15
-
16
-
17
- def complete_parser(parser: ArgumentParser, **kwargs) -> NoReturn:
18
- """
19
- Complete the script argument parser.
20
-
21
- Parameters
22
- ----------
23
- parser : argparse.ArgumentParser
24
- The ``ArgumentParser`` object.
25
- **kwargs
26
- Extra parameters.
27
- """
28
- autocomplete(parser, validator=default_validator, **kwargs)
29
-
30
- # vim: set ts=4 sts=4 sw=4 et ai si sta: