vim-eof-comment 0.5.3__tar.gz → 0.6.0__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.5.3 → vim_eof_comment-0.6.0}/Makefile +2 -5
  2. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/PKG-INFO +1 -1
  3. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/pyproject.toml +1 -1
  4. vim_eof_comment-0.6.0/version.txt +1 -0
  5. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/args/completion.py +2 -2
  6. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/args/completion.pyi +1 -2
  7. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/args/parsing.py +3 -3
  8. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/comments/generator.py +6 -6
  9. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/comments/generator.pyi +4 -4
  10. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/eof.py +10 -10
  11. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/eof.pyi +1 -3
  12. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/file.py +2 -1
  13. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/file.pyi +3 -1
  14. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/types.py +234 -26
  15. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/types.pyi +168 -24
  16. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/util.py +6 -6
  17. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/util.pyi +4 -4
  18. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/version.py +3 -4
  19. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/version.pyi +2 -4
  20. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment.egg-info/PKG-INFO +1 -1
  21. vim_eof_comment-0.5.3/version.txt +0 -1
  22. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.flake8 +0 -0
  23. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.gitattributes +0 -0
  24. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.github/CODEOWNERS +0 -0
  25. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.github/FUNDING.yml +0 -0
  26. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.github/workflows/flake8-lint.yml +0 -0
  27. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.github/workflows/mypy-lint.yml +0 -0
  28. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.github/workflows/release.yml +0 -0
  29. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.github/workflows/vim-eof-comment.yml +0 -0
  30. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/.pre-commit-config.yaml +0 -0
  31. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/CHANGELOG.md +0 -0
  32. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/LICENSE +0 -0
  33. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/README.md +0 -0
  34. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/docs/Makefile +0 -0
  35. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/docs/make.bat +0 -0
  36. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/docs/source/conf.py +0 -0
  37. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/docs/source/functions.rst +0 -0
  38. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/docs/source/index.rst +0 -0
  39. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/docs/source/installation.rst +0 -0
  40. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/requirements.txt +0 -0
  41. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/setup.cfg +0 -0
  42. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/taplo.toml +0 -0
  43. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/__init__.py +0 -0
  44. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/__init__.pyi +0 -0
  45. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/__main__.py +0 -0
  46. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/args/__init__.py +0 -0
  47. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/args/__init__.pyi +0 -0
  48. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/args/parsing.pyi +0 -0
  49. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/comments/__init__.py +0 -0
  50. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/comments/__init__.pyi +0 -0
  51. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/comments/filetypes.json +0 -0
  52. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/py.typed +0 -0
  53. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/regex.py +0 -0
  54. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment/regex.pyi +0 -0
  55. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment.egg-info/SOURCES.txt +0 -0
  56. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment.egg-info/dependency_links.txt +0 -0
  57. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment.egg-info/entry_points.txt +0 -0
  58. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment.egg-info/requires.txt +0 -0
  59. {vim_eof_comment-0.5.3 → vim_eof_comment-0.6.0}/vim_eof_comment.egg-info/top_level.txt +0 -0
@@ -34,12 +34,9 @@ help:
34
34
 
35
35
  lint:
36
36
  @echo "Linting..."
37
- @flake8 --statistics --show-source --color=always --max-line-length=100 --ignore=D401 \
38
- --per-file-ignores=__init__.py:F401 \
39
- --exclude .tox,.git,*staticfiles*,build,locale,docs,tools,venv,.venv,*migrations*,*.pyc,*.pyi,__pycache__,test_*.py \
40
- vim_eof_comment
37
+ @flake8 vim_eof_comment
41
38
  @pydocstyle --convention=numpy --match='.*\.py' vim_eof_comment
42
- @autopep8 --aggressive --aggressive --aggressive --in-place --recursive vim_eof_comment
39
+ # @autopep8 --aggressive --aggressive --aggressive --in-place --recursive vim_eof_comment
43
40
  $(eval files := $(shell fd --full-path vim_eof_comment -e py))
44
41
  @numpydoc lint $(files)
45
42
  @echo "Done!"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vim-eof-comment
3
- Version: 0.5.3
3
+ Version: 0.6.0
4
4
  Summary: Adds Vim EOF modeline 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>
@@ -40,7 +40,7 @@ maintainers = [{ name = "Guennadi Maximov C", email = "g.maxc.fox@protonmail.com
40
40
  name = "vim-eof-comment"
41
41
  readme = "README.md"
42
42
  requires-python = ">=3.10"
43
- version = "0.5.3"
43
+ version = "0.6.0"
44
44
 
45
45
  [project.scripts]
46
46
  vim-eof-comment = "vim_eof_comment.eof:main"
@@ -0,0 +1 @@
1
+ 0.6.0
@@ -8,7 +8,7 @@ Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
8
8
  __all__ = ["complete_parser", "complete_validator"]
9
9
 
10
10
  from argparse import ArgumentParser
11
- from typing import List, NoReturn
11
+ from typing import List
12
12
 
13
13
  from argcomplete import autocomplete
14
14
 
@@ -32,7 +32,7 @@ def complete_validator(completion_candidate: List[str], current_input: str) -> b
32
32
  return current_input in completion_candidate
33
33
 
34
34
 
35
- def complete_parser(parser: ArgumentParser, **kwargs) -> NoReturn:
35
+ def complete_parser(parser: ArgumentParser, **kwargs) -> None:
36
36
  """
37
37
  Complete the script argument parser.
38
38
 
@@ -1,5 +1,4 @@
1
1
  from argparse import ArgumentParser
2
- from typing import NoReturn
3
2
 
4
3
  __all__ = ['complete_parser', 'complete_validator']
5
4
 
@@ -19,7 +18,7 @@ def complete_validator(completion_candidate: list[str], current_input: str) -> b
19
18
  bool
20
19
  Whether the current input fits the completion candidates pool.
21
20
  """
22
- def complete_parser(parser: ArgumentParser, **kwargs) -> NoReturn:
21
+ def complete_parser(parser: ArgumentParser, **kwargs) -> None:
23
22
  """
24
23
  Complete the script argument parser.
25
24
 
@@ -51,9 +51,9 @@ def bootstrap_args(parser: ArgumentParser, specs: List[ParserSpec]) -> Namespace
51
51
  The generated ``argparse.Namespace`` object.
52
52
  """
53
53
  for spec in specs:
54
- opts, kwargs = spec["opts"], spec["kwargs"]
55
- if spec["completer"] is not None:
56
- parser.add_argument(*opts, **kwargs).completer = spec["completer"]
54
+ opts, kwargs = spec.opts, spec.kwargs
55
+ if spec.completer is not None:
56
+ parser.add_argument(*opts, **kwargs).completer = spec.completer
57
57
  else:
58
58
  parser.add_argument(*opts, **kwargs)
59
59
 
@@ -17,7 +17,7 @@ import json
17
17
  import os
18
18
  from io import TextIOWrapper
19
19
  from os.path import exists, isdir, realpath
20
- from typing import Dict, Iterator, List, NoReturn, Tuple
20
+ from typing import Dict, Iterator, List, Tuple
21
21
 
22
22
  from colorama import Fore, Style
23
23
  from colorama import init as color_init
@@ -119,9 +119,9 @@ class Comments():
119
119
  if not (self.__is_available(lang)) or len(mapping) == 0:
120
120
  continue
121
121
 
122
- indent, expandtab = mapping["level"], True
122
+ indent, expandtab = mapping.level, True
123
123
  if len(mapping) > 1:
124
- expandtab = mapping["expandtab"]
124
+ expandtab = mapping.expandtab
125
125
 
126
126
  langs[lang] = IndentMap(level=indent, expandtab=expandtab)
127
127
 
@@ -148,7 +148,7 @@ class Comments():
148
148
  """
149
149
  return lang in self.__DEFAULT.keys()
150
150
 
151
- def __fill_langs(self, langs: Dict[str, IndentMap]) -> NoReturn:
151
+ def __fill_langs(self, langs: Dict[str, IndentMap]) -> None:
152
152
  """
153
153
  Fill languages dict.
154
154
 
@@ -242,7 +242,7 @@ def generate_list_items(ft: str, level: int, expandtab: str) -> str:
242
242
  return txt
243
243
 
244
244
 
245
- def list_filetypes() -> NoReturn:
245
+ def list_filetypes() -> None:
246
246
  """List all available filetypes."""
247
247
  color_init()
248
248
 
@@ -262,7 +262,7 @@ def list_filetypes() -> NoReturn:
262
262
  die(*txt, code=0, sep="\n")
263
263
 
264
264
 
265
- def export_json() -> NoReturn:
265
+ def export_json() -> None:
266
266
  """Export default vars to JSON."""
267
267
  if not (exists("./vim_eof_comment/comments") and isdir("./vim_eof_comment/comments")):
268
268
  return
@@ -1,4 +1,4 @@
1
- from typing import Iterator, NoReturn
1
+ from typing import Iterator
2
2
 
3
3
  from ..types import IndentMap
4
4
 
@@ -72,7 +72,7 @@ class Comments:
72
72
  bool
73
73
  Represents whether the file extension has been included in the defaults.
74
74
  """
75
- def __fill_langs(self, langs: dict[str, IndentMap]) -> NoReturn:
75
+ def __fill_langs(self, langs: dict[str, IndentMap]) -> None:
76
76
  """
77
77
  Fill languages dict.
78
78
 
@@ -132,9 +132,9 @@ def generate_list_items(ft: str, level: int, expandtab: str) -> str:
132
132
  str
133
133
  The generated string.
134
134
  '''
135
- def list_filetypes() -> NoReturn:
135
+ def list_filetypes() -> None:
136
136
  """List all available filetypes."""
137
- def export_json() -> NoReturn:
137
+ def export_json() -> None:
138
138
  """Export default vars to JSON."""
139
139
 
140
140
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -9,7 +9,7 @@ Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
9
9
  __all__ = ["append_eof_comment", "eof_comment_search", "main"]
10
10
 
11
11
  from io import TextIOWrapper
12
- from typing import Dict, List, NoReturn, Tuple
12
+ from typing import Dict, List, Tuple
13
13
 
14
14
  from colorama import Fore, Style
15
15
  from colorama import init as color_init
@@ -67,17 +67,17 @@ def eof_comment_search(
67
67
 
68
68
  verbose_print(f"{_RESET}Analyzing files...\n", verbose=verbose)
69
69
  for path, file in files.items():
70
- file_obj: TextIOWrapper = file["file"]
71
- ext: str = file["ft_ext"]
70
+ file_obj: TextIOWrapper = file.file
71
+ ext: str = file.ft_ext
72
72
 
73
73
  wrapper = get_last_line(file_obj)
74
- last_line, had_nwl, crlf = wrapper["line"], wrapper["had_nwl"], wrapper["crlf"]
74
+ last_line, had_nwl, crlf = wrapper.line, wrapper.had_nwl, wrapper.crlf
75
75
 
76
76
  verbose_print(f"{_RESET} - {path} ==> ", verbose=verbose, end="", sep="")
77
77
  if last_line != comment_map[ext] or (newline and not had_nwl):
78
78
  verbose_print(f"{_BRIGHT}{_RED}CHANGED", verbose=verbose)
79
79
  result[path] = EOFCommentSearch(
80
- state=IOWrapperBool(file=open(path, "r"), had_nwl=had_nwl),
80
+ state=IOWrapperBool(file=open(path, "r"), had_nwl=had_nwl, crlf=crlf),
81
81
  lang=ext,
82
82
  match=matches(last_line)
83
83
  )
@@ -92,7 +92,7 @@ def append_eof_comment(
92
92
  comments: Comments,
93
93
  newline: bool,
94
94
  crlf: bool
95
- ) -> NoReturn:
95
+ ) -> None:
96
96
  """
97
97
  Append a Vim EOF comment to files missing it.
98
98
 
@@ -109,10 +109,10 @@ def append_eof_comment(
109
109
  """
110
110
  comment_map = comments.generate()
111
111
  for path, file in files.items():
112
- file_obj = file["state"]["file"]
113
- had_nwl = file["state"]["had_nwl"]
114
- matching = file["match"]
115
- ext = file["lang"]
112
+ file_obj = file.state.file
113
+ had_nwl = file.state.had_nwl
114
+ matching = file.match
115
+ ext = file.lang
116
116
 
117
117
  txt = modify_file(
118
118
  file_obj,
@@ -1,5 +1,3 @@
1
- from typing import NoReturn
2
-
3
1
  from .comments.generator import Comments
4
2
  from .types import BatchPathDict, EOFCommentSearch
5
3
 
@@ -30,7 +28,7 @@ def eof_comment_search(files: dict[str, BatchPathDict], comments: Comments, **kw
30
28
  vim_eof_comment.types.EOFCommentSearch
31
29
  The object type for the returning dictionary values.
32
30
  """
33
- def append_eof_comment(files: dict[str, EOFCommentSearch], comments: Comments, newline: bool, crlf: bool) -> NoReturn:
31
+ def append_eof_comment(files: dict[str, EOFCommentSearch], comments: Comments, newline: bool, crlf: bool) -> None:
34
32
  """
35
33
  Append a Vim EOF comment to files missing it.
36
34
 
@@ -6,6 +6,7 @@ File management utilities.
6
6
  Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
8
  __all__ = [
9
+ "EXCLUDED_DIRS",
9
10
  "bootstrap_paths",
10
11
  "get_last_line",
11
12
  "modify_file",
@@ -108,7 +109,7 @@ def open_batch_paths(paths: List[BatchPairDict]) -> Dict[str, BatchPathDict]:
108
109
  """
109
110
  result: Dict[str, BatchPathDict] = dict()
110
111
  for path in paths:
111
- fpath, ext = path["fpath"], path["ft_ext"]
112
+ fpath, ext = path.fpath, path.ft_ext
112
113
  if not try_open(fpath):
113
114
  continue
114
115
 
@@ -2,7 +2,9 @@ from io import TextIOWrapper
2
2
 
3
3
  from .types import BatchPairDict, BatchPathDict, LineBool
4
4
 
5
- __all__ = ['bootstrap_paths', 'get_last_line', 'modify_file', 'open_batch_paths', 'try_open']
5
+ __all__ = ['EXCLUDED_DIRS', 'bootstrap_paths', 'get_last_line', 'modify_file', 'open_batch_paths', 'try_open']
6
+
7
+ EXCLUDED_DIRS: list[str]
6
8
 
7
9
  def try_open(fpath: str) -> bool:
8
10
  """
@@ -23,7 +23,7 @@ from typing import Any, Dict, List, TextIO, Tuple, TypedDict
23
23
  import argcomplete
24
24
 
25
25
 
26
- class VersionInfo():
26
+ class VersionInfo:
27
27
  """
28
28
  A ``sys.version_info``-like object type.
29
29
 
@@ -142,7 +142,6 @@ class VersionInfo():
142
142
  if not isinstance(b, VersionInfo):
143
143
  return False
144
144
 
145
- b: VersionInfo = b
146
145
  return self.major == b.major and self.minor == b.minor and self.patch == b.patch
147
146
 
148
147
  def get_current_version(self) -> Tuple[int, int, int]:
@@ -189,11 +188,18 @@ class VersionInfo():
189
188
  return result
190
189
 
191
190
 
192
- class ParserSpec(TypedDict):
191
+ class ParserSpec:
193
192
  """
194
193
  Stores the spec for ``argparse`` operations in a constant value.
195
194
 
196
- This is a ``TypedDict``-like object.
195
+ Parameters
196
+ ----------
197
+ opts : List[str]
198
+ A list containing all the relevant iterations of the same option.
199
+ kwargs : Dict[str, Any]
200
+ Extra arguments for ``argparse.ArgumentParser``.
201
+ completer : argcomplete.DirectoriesCompleter
202
+ An ``argcomplete`` completer object.
197
203
 
198
204
  Attributes
199
205
  ----------
@@ -209,12 +215,40 @@ class ParserSpec(TypedDict):
209
215
  kwargs: Dict[str, Any]
210
216
  completer: argcomplete.DirectoriesCompleter
211
217
 
218
+ def __init__(
219
+ self,
220
+ opts: List[str],
221
+ kwargs: Dict[str, Any],
222
+ completer: argcomplete.DirectoriesCompleter
223
+ ):
224
+ self.opts = opts
225
+ self.kwargs = kwargs
226
+ self.completer = completer
227
+
228
+ def __iterables(self) -> Tuple[List[str], Dict[str, Any], argcomplete.DirectoriesCompleter]:
229
+ """
230
+ Generate iterables.
231
+
232
+ Returns
233
+ -------
234
+ Tuple[List[str], Dict[str, Any], argcomplete.DirectoriesCompleter]
235
+ The ``opts``, ``kwargs`` and ``completer`` attributes.
236
+ """
237
+ return (self.opts, self.kwargs, self.completer)
238
+
239
+ def __iter__(self):
240
+ """Iterate over objects."""
241
+ yield from self.__iterables()
212
242
 
213
- class CommentMap(TypedDict):
243
+
244
+ class CommentMap:
214
245
  """
215
- Stores a dict with a ``level`` key.
246
+ An object containing ``level``.
216
247
 
217
- This is a ``TypedDict``-like object.
248
+ Parameters
249
+ ----------
250
+ level : int
251
+ The indentation level.
218
252
 
219
253
  Attributes
220
254
  ----------
@@ -224,12 +258,28 @@ class CommentMap(TypedDict):
224
258
 
225
259
  level: int
226
260
 
261
+ def __init__(self, level: int):
262
+ self.level = level
263
+
264
+ def __iterables(self) -> Tuple[int]:
265
+ """
266
+ Generate iterables.
267
+
268
+ Returns
269
+ -------
270
+ Tuple[int]
271
+ The ``opts`` attribute (inside a tuple).
272
+ """
273
+ return (self.level,)
274
+
275
+ def __iter__(self):
276
+ """Iterate over objects."""
277
+ yield from self.__iterables()
278
+
227
279
 
228
280
  class IndentMap(TypedDict):
229
281
  """
230
- A dict containing ``level`` and ``expandtab`` as keys.
231
-
232
- This is a ``TypedDict``-like object.
282
+ An object containing ``level`` and ``expandtab``.
233
283
 
234
284
  Attributes
235
285
  ----------
@@ -243,11 +293,18 @@ class IndentMap(TypedDict):
243
293
  expandtab: bool
244
294
 
245
295
 
246
- class IndentHandler(TypedDict):
296
+ class IndentHandler:
247
297
  """
248
- A dict containing ``ft_ext``, ``level`` and ``expandtab`` as keys.
298
+ An object containing ``ft_ext``, ``level`` and ``expandtab``.
249
299
 
250
- This is a ``TypedDict``-like object.
300
+ Parameters
301
+ ----------
302
+ ft_ext : str
303
+ The file-extension/file-type.
304
+ level : str
305
+ The string representation of the indent level.
306
+ expandtab : bool
307
+ Whether to expand tabs or not.
251
308
 
252
309
  Attributes
253
310
  ----------
@@ -263,12 +320,39 @@ class IndentHandler(TypedDict):
263
320
  level: str
264
321
  expandtab: bool
265
322
 
323
+ def __init__(self, ft_ext: str, level: str, expandtab: bool):
324
+ self.ft_ext = ft_ext
325
+ self.level = level
326
+ self.expandtab = expandtab
327
+
328
+ def __iterables(self) -> Tuple[str, str, bool]:
329
+ """
330
+ Generate iterables.
331
+
332
+ Returns
333
+ -------
334
+ Tuple[str, str, bool]
335
+ The ``ft_ext``, ``level`` and ``expandtab`` attributes.
336
+ """
337
+ return (self.ft_ext, self.level, self.expandtab)
338
+
339
+ def __iter__(self):
340
+ """Iterate over objects."""
341
+ yield from self.__iterables()
266
342
 
267
- class IOWrapperBool(TypedDict):
343
+
344
+ class IOWrapperBool:
268
345
  """
269
- A dict containing ``file``, ``had_nwl`` and ``crlf`` as keys.
346
+ An object containing ``file``, ``had_nwl`` and ``crlf``.
270
347
 
271
- This is a ``TypedDict``-like object.
348
+ Parameters
349
+ ----------
350
+ file : TextIO
351
+ The opened file as a ``TextIO`` wrapper.
352
+ had_nwl : bool
353
+ Whether the file has a newline or not.
354
+ crlf : bool
355
+ Whether the file is CRLF-terminated.
272
356
 
273
357
  Attributes
274
358
  ----------
@@ -284,12 +368,39 @@ class IOWrapperBool(TypedDict):
284
368
  had_nwl: bool
285
369
  crlf: bool
286
370
 
371
+ def __init__(self, file: TextIO, had_nwl: bool, crlf: bool):
372
+ self.file = file
373
+ self.had_nwl = had_nwl
374
+ self.crlf = crlf
375
+
376
+ def __iterables(self) -> Tuple[TextIO, bool, bool]:
377
+ """
378
+ Generate iterables.
379
+
380
+ Returns
381
+ -------
382
+ Tuple[TextIO, bool, bool]
383
+ The ``file``, ``had_nwl`` and ``crlf`` attributes.
384
+ """
385
+ return (self.file, self.had_nwl, self.crlf)
386
+
387
+ def __iter__(self):
388
+ """Iterate over objects."""
389
+ yield from self.__iterables()
390
+
287
391
 
288
- class LineBool(TypedDict):
392
+ class LineBool:
289
393
  """
290
- A dict containing ``line``, ``had_nwl`` and ``crlf`` as keys.
394
+ An object containing ``line``, ``had_nwl`` and ``crlf``.
291
395
 
292
- This is a ``TypedDict``-like object.
396
+ Parameters
397
+ ----------
398
+ line : str
399
+ The last line of the target file.
400
+ had_nwl : bool
401
+ Whether the file has a newline or not.
402
+ crlf : bool
403
+ Whether the file is CRLF-terminated.
293
404
 
294
405
  Attributes
295
406
  ----------
@@ -305,12 +416,37 @@ class LineBool(TypedDict):
305
416
  had_nwl: bool
306
417
  crlf: bool
307
418
 
419
+ def __init__(self, line: str, had_nwl: bool, crlf: bool):
420
+ self.line = line
421
+ self.had_nwl = had_nwl
422
+ self.crlf = crlf
423
+
424
+ def __iterables(self) -> Tuple[str, bool, bool]:
425
+ """
426
+ Generate iterables.
427
+
428
+ Returns
429
+ -------
430
+ Tuple[str, bool, bool]
431
+ The ``line``, ``had_nwl`` and ``crlf`` attributes.
432
+ """
433
+ return (self.line, self.had_nwl, self.crlf)
434
+
435
+ def __iter__(self):
436
+ """Iterate over objects."""
437
+ yield from self.__iterables()
308
438
 
309
- class BatchPathDict(TypedDict):
439
+
440
+ class BatchPathDict:
310
441
  """
311
- A dict containing ``file`` and ``ft_ext`` as keys.
442
+ An object containing ``file`` and ``ft_ext``.
312
443
 
313
- This is a ``TypedDict``-like object.
444
+ Parameters
445
+ ----------
446
+ file : TextIO
447
+ The opened file as a ``TextIO`` wrapper.
448
+ ft_ext : str
449
+ The file-type/file-extension.
314
450
 
315
451
  Attributes
316
452
  ----------
@@ -323,12 +459,36 @@ class BatchPathDict(TypedDict):
323
459
  file: TextIO
324
460
  ft_ext: str
325
461
 
462
+ def __init__(self, file: TextIO, ft_ext: str):
463
+ self.file = file
464
+ self.ft_ext = ft_ext
465
+
466
+ def __iterables(self) -> Tuple[TextIO, str]:
467
+ """
468
+ Generate iterables.
469
+
470
+ Returns
471
+ -------
472
+ Tuple[TextIO, str]
473
+ The ``file`` and ``ft_ext`` attributes.
474
+ """
475
+ return (self.file, self.ft_ext)
476
+
477
+ def __iter__(self):
478
+ """Iterate over objects."""
479
+ yield from self.__iterables()
480
+
326
481
 
327
- class BatchPairDict(TypedDict):
482
+ class BatchPairDict:
328
483
  """
329
- A dict containing ``fpath`` and ``ft_ext`` as keys.
484
+ An object containing ``fpath`` and ``ft_ext``.
330
485
 
331
- This is a ``TypedDict``-like object.
486
+ Parameters
487
+ ----------
488
+ fpath : str
489
+ The target file's path.
490
+ ft_ext : str
491
+ The file-type/file-extension.
332
492
 
333
493
  Attributes
334
494
  ----------
@@ -341,13 +501,41 @@ class BatchPairDict(TypedDict):
341
501
  fpath: str
342
502
  ft_ext: str
343
503
 
504
+ def __init__(self, fpath: str, ft_ext: str):
505
+ self.fpath = fpath
506
+ self.ft_ext = ft_ext
507
+
508
+ def __iterables(self) -> Tuple[str, str]:
509
+ """
510
+ Generate iterables.
511
+
512
+ Returns
513
+ -------
514
+ Tuple[str, str]
515
+ The ``fpath`` and ``ft_ext`` attributes.
516
+ """
517
+ return (self.fpath, self.ft_ext)
518
+
519
+ def __iter__(self):
520
+ """Iterate over objects."""
521
+ yield from self.__iterables()
344
522
 
345
- class EOFCommentSearch(TypedDict):
523
+
524
+ class EOFCommentSearch:
346
525
  """
347
526
  A dict containing ``state``, ``lang`` and ``match`` as keys.
348
527
 
349
528
  This is a ``TypedDict``-like object.
350
529
 
530
+ Parameters
531
+ ----------
532
+ state : IOWrapperBool
533
+ The target ``IOWrapperBool`` object.
534
+ lang : str
535
+ The file language.
536
+ match : bool
537
+ Whether it has a variation of an EOF comment at the end.
538
+
351
539
  Attributes
352
540
  ----------
353
541
  state : IOWrapperBool
@@ -362,4 +550,24 @@ class EOFCommentSearch(TypedDict):
362
550
  lang: str
363
551
  match: bool
364
552
 
553
+ def __init__(self, state: IOWrapperBool, lang: str, match: bool):
554
+ self.state = state
555
+ self.lang = lang
556
+ self.match = match
557
+
558
+ def __iterables(self) -> Tuple[IOWrapperBool, str, bool]:
559
+ """
560
+ Generate iterables.
561
+
562
+ Returns
563
+ -------
564
+ Tuple[IOWrapperBool, str, bool]
565
+ The ``state``, ``lang`` and ``match`` attributes.
566
+ """
567
+ return (self.state, self.lang, self.match)
568
+
569
+ def __iter__(self):
570
+ """Iterate over objects."""
571
+ yield from self.__iterables()
572
+
365
573
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -139,11 +139,18 @@ class VersionInfo:
139
139
  0.0.3 (latest)
140
140
  """
141
141
 
142
- class ParserSpec(TypedDict):
142
+ class ParserSpec:
143
143
  """
144
144
  Stores the spec for ``argparse`` operations in a constant value.
145
145
 
146
- This is a ``TypedDict``-like object.
146
+ Parameters
147
+ ----------
148
+ opts : List[str]
149
+ A list containing all the relevant iterations of the same option.
150
+ kwargs : Dict[str, Any]
151
+ Extra arguments for ``argparse.ArgumentParser``.
152
+ completer : argcomplete.DirectoriesCompleter
153
+ An ``argcomplete`` completer object.
147
154
 
148
155
  Attributes
149
156
  ----------
@@ -157,12 +164,27 @@ class ParserSpec(TypedDict):
157
164
  opts: list[str]
158
165
  kwargs: dict[str, Any]
159
166
  completer: argcomplete.DirectoriesCompleter
167
+ def __init__(self, opts: list[str], kwargs: dict[str, Any], completer: argcomplete.DirectoriesCompleter) -> None: ...
168
+ def __iterables(self) -> tuple[list[str], dict[str, Any], argcomplete.DirectoriesCompleter]:
169
+ """
170
+ Generate iterables.
171
+
172
+ Returns
173
+ -------
174
+ Tuple[List[str], Dict[str, Any], argcomplete.DirectoriesCompleter]
175
+ The ``opts``, ``kwargs`` and ``completer`` attributes.
176
+ """
177
+ def __iter__(self):
178
+ """Iterate over objects."""
160
179
 
161
- class CommentMap(TypedDict):
180
+ class CommentMap:
162
181
  """
163
- Stores a dict with a ``level`` key.
182
+ An object containing ``level``.
164
183
 
165
- This is a ``TypedDict``-like object.
184
+ Parameters
185
+ ----------
186
+ level : int
187
+ The indentation level.
166
188
 
167
189
  Attributes
168
190
  ----------
@@ -170,12 +192,22 @@ class CommentMap(TypedDict):
170
192
  The indentation level.
171
193
  """
172
194
  level: int
195
+ def __init__(self, level: int) -> None: ...
196
+ def __iterables(self) -> tuple[int]:
197
+ """
198
+ Generate iterables.
199
+
200
+ Returns
201
+ -------
202
+ Tuple[int]
203
+ The ``opts`` attribute (inside a tuple).
204
+ """
205
+ def __iter__(self):
206
+ """Iterate over objects."""
173
207
 
174
208
  class IndentMap(TypedDict):
175
209
  """
176
- A dict containing ``level`` and ``expandtab`` as keys.
177
-
178
- This is a ``TypedDict``-like object.
210
+ An object containing ``level`` and ``expandtab``.
179
211
 
180
212
  Attributes
181
213
  ----------
@@ -187,11 +219,18 @@ class IndentMap(TypedDict):
187
219
  level: int
188
220
  expandtab: bool
189
221
 
190
- class IndentHandler(TypedDict):
222
+ class IndentHandler:
191
223
  """
192
- A dict containing ``ft_ext``, ``level`` and ``expandtab`` as keys.
224
+ An object containing ``ft_ext``, ``level`` and ``expandtab``.
193
225
 
194
- This is a ``TypedDict``-like object.
226
+ Parameters
227
+ ----------
228
+ ft_ext : str
229
+ The file-extension/file-type.
230
+ level : str
231
+ The string representation of the indent level.
232
+ expandtab : bool
233
+ Whether to expand tabs or not.
195
234
 
196
235
  Attributes
197
236
  ----------
@@ -205,12 +244,31 @@ class IndentHandler(TypedDict):
205
244
  ft_ext: str
206
245
  level: str
207
246
  expandtab: bool
247
+ def __init__(self, ft_ext: str, level: str, expandtab: bool) -> None: ...
248
+ def __iterables(self) -> tuple[str, str, bool]:
249
+ """
250
+ Generate iterables.
251
+
252
+ Returns
253
+ -------
254
+ Tuple[str, str, bool]
255
+ The ``ft_ext``, ``level`` and ``expandtab`` attributes.
256
+ """
257
+ def __iter__(self):
258
+ """Iterate over objects."""
208
259
 
209
- class IOWrapperBool(TypedDict):
260
+ class IOWrapperBool:
210
261
  """
211
- A dict containing ``file``, ``had_nwl`` and ``crlf`` as keys.
262
+ An object containing ``file``, ``had_nwl`` and ``crlf``.
212
263
 
213
- This is a ``TypedDict``-like object.
264
+ Parameters
265
+ ----------
266
+ file : TextIO
267
+ The opened file as a ``TextIO`` wrapper.
268
+ had_nwl : bool
269
+ Whether the file has a newline or not.
270
+ crlf : bool
271
+ Whether the file is CRLF-terminated.
214
272
 
215
273
  Attributes
216
274
  ----------
@@ -224,12 +282,31 @@ class IOWrapperBool(TypedDict):
224
282
  file: TextIO
225
283
  had_nwl: bool
226
284
  crlf: bool
285
+ def __init__(self, file: TextIO, had_nwl: bool, crlf: bool) -> None: ...
286
+ def __iterables(self) -> tuple[TextIO, bool, bool]:
287
+ """
288
+ Generate iterables.
289
+
290
+ Returns
291
+ -------
292
+ Tuple[TextIO, bool, bool]
293
+ The ``file``, ``had_nwl`` and ``crlf`` attributes.
294
+ """
295
+ def __iter__(self):
296
+ """Iterate over objects."""
227
297
 
228
- class LineBool(TypedDict):
298
+ class LineBool:
229
299
  """
230
- A dict containing ``line``, ``had_nwl`` and ``crlf`` as keys.
300
+ An object containing ``line``, ``had_nwl`` and ``crlf``.
231
301
 
232
- This is a ``TypedDict``-like object.
302
+ Parameters
303
+ ----------
304
+ line : str
305
+ The last line of the target file.
306
+ had_nwl : bool
307
+ Whether the file has a newline or not.
308
+ crlf : bool
309
+ Whether the file is CRLF-terminated.
233
310
 
234
311
  Attributes
235
312
  ----------
@@ -243,12 +320,29 @@ class LineBool(TypedDict):
243
320
  line: str
244
321
  had_nwl: bool
245
322
  crlf: bool
323
+ def __init__(self, line: str, had_nwl: bool, crlf: bool) -> None: ...
324
+ def __iterables(self) -> tuple[str, bool, bool]:
325
+ """
326
+ Generate iterables.
246
327
 
247
- class BatchPathDict(TypedDict):
328
+ Returns
329
+ -------
330
+ Tuple[str, bool, bool]
331
+ The ``line``, ``had_nwl`` and ``crlf`` attributes.
332
+ """
333
+ def __iter__(self):
334
+ """Iterate over objects."""
335
+
336
+ class BatchPathDict:
248
337
  """
249
- A dict containing ``file`` and ``ft_ext`` as keys.
338
+ An object containing ``file`` and ``ft_ext``.
250
339
 
251
- This is a ``TypedDict``-like object.
340
+ Parameters
341
+ ----------
342
+ file : TextIO
343
+ The opened file as a ``TextIO`` wrapper.
344
+ ft_ext : str
345
+ The file-type/file-extension.
252
346
 
253
347
  Attributes
254
348
  ----------
@@ -259,12 +353,29 @@ class BatchPathDict(TypedDict):
259
353
  """
260
354
  file: TextIO
261
355
  ft_ext: str
356
+ def __init__(self, file: TextIO, ft_ext: str) -> None: ...
357
+ def __iterables(self) -> tuple[TextIO, str]:
358
+ """
359
+ Generate iterables.
360
+
361
+ Returns
362
+ -------
363
+ Tuple[TextIO, str]
364
+ The ``file`` and ``ft_ext`` attributes.
365
+ """
366
+ def __iter__(self):
367
+ """Iterate over objects."""
262
368
 
263
- class BatchPairDict(TypedDict):
369
+ class BatchPairDict:
264
370
  """
265
- A dict containing ``fpath`` and ``ft_ext`` as keys.
371
+ An object containing ``fpath`` and ``ft_ext``.
266
372
 
267
- This is a ``TypedDict``-like object.
373
+ Parameters
374
+ ----------
375
+ fpath : str
376
+ The target file's path.
377
+ ft_ext : str
378
+ The file-type/file-extension.
268
379
 
269
380
  Attributes
270
381
  ----------
@@ -275,13 +386,34 @@ class BatchPairDict(TypedDict):
275
386
  """
276
387
  fpath: str
277
388
  ft_ext: str
389
+ def __init__(self, fpath: str, ft_ext: str) -> None: ...
390
+ def __iterables(self) -> tuple[str, str]:
391
+ """
392
+ Generate iterables.
393
+
394
+ Returns
395
+ -------
396
+ Tuple[str, str]
397
+ The ``fpath`` and ``ft_ext`` attributes.
398
+ """
399
+ def __iter__(self):
400
+ """Iterate over objects."""
278
401
 
279
- class EOFCommentSearch(TypedDict):
402
+ class EOFCommentSearch:
280
403
  """
281
404
  A dict containing ``state``, ``lang`` and ``match`` as keys.
282
405
 
283
406
  This is a ``TypedDict``-like object.
284
407
 
408
+ Parameters
409
+ ----------
410
+ state : IOWrapperBool
411
+ The target ``IOWrapperBool`` object.
412
+ lang : str
413
+ The file language.
414
+ match : bool
415
+ Whether it has a variation of an EOF comment at the end.
416
+
285
417
  Attributes
286
418
  ----------
287
419
  state : IOWrapperBool
@@ -294,5 +426,17 @@ class EOFCommentSearch(TypedDict):
294
426
  state: IOWrapperBool
295
427
  lang: str
296
428
  match: bool
429
+ def __init__(self, state: IOWrapperBool, lang: str, match: bool) -> None: ...
430
+ def __iterables(self) -> tuple[IOWrapperBool, str, bool]:
431
+ """
432
+ Generate iterables.
433
+
434
+ Returns
435
+ -------
436
+ Tuple[IOWrapperBool, str, bool]
437
+ The ``state``, ``lang`` and ``match`` attributes.
438
+ """
439
+ def __iter__(self):
440
+ """Iterate over objects."""
297
441
 
298
442
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
@@ -14,12 +14,12 @@ __all__ = [
14
14
 
15
15
  from sys import exit as Exit
16
16
  from sys import stderr, stdout
17
- from typing import Callable, Dict, List, NoReturn, TextIO
17
+ from typing import Callable, Dict, List, TextIO
18
18
 
19
19
  from .types import IndentHandler, IndentMap
20
20
 
21
21
 
22
- def error(*msg, **kwargs) -> NoReturn:
22
+ def error(*msg, **kwargs) -> None:
23
23
  """
24
24
  Print to stderr.
25
25
 
@@ -40,7 +40,7 @@ def error(*msg, **kwargs) -> NoReturn:
40
40
  print(*msg, file=stderr, end=end, sep=sep, flush=flush)
41
41
 
42
42
 
43
- def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwargs) -> NoReturn:
43
+ def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwargs) -> None:
44
44
  """
45
45
  Kill the program execution.
46
46
 
@@ -98,7 +98,7 @@ def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwa
98
98
  Exit(code)
99
99
 
100
100
 
101
- def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> NoReturn:
101
+ def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> None:
102
102
  """
103
103
  Only prints the given data if verbose mode is activated.
104
104
 
@@ -153,14 +153,14 @@ def gen_indent_maps(maps: List[IndentHandler]) -> Dict[str, IndentMap] | None:
153
153
  if mapping_len <= 1:
154
154
  raise ValueError(f"One of the custom mappings is not formatted properly! (`{mapping}`)")
155
155
 
156
- ext, level = mapping["ft_ext"], mapping["level"]
156
+ ext, level = mapping.ft_ext, mapping.level
157
157
  if ext in map_d.keys():
158
158
  continue
159
159
 
160
160
  mapping_len = mapping_len if mapping_len <= 3 else 3
161
161
  map_d[ext] = IndentMap(
162
162
  level=level,
163
- expandtab=True if mapping_len == 2 else mapping["expandtab"]
163
+ expandtab=True if mapping_len == 2 else mapping.expandtab
164
164
  )
165
165
 
166
166
  return map_d
@@ -1,10 +1,10 @@
1
- from typing import Callable, NoReturn, TextIO
1
+ from typing import Callable, TextIO
2
2
 
3
3
  from .types import IndentHandler, IndentMap
4
4
 
5
5
  __all__ = ['die', 'error', 'gen_indent_maps', 'verbose_print']
6
6
 
7
- def error(*msg, **kwargs) -> NoReturn:
7
+ def error(*msg, **kwargs) -> None:
8
8
  """
9
9
  Print to stderr.
10
10
 
@@ -19,7 +19,7 @@ def error(*msg, **kwargs) -> NoReturn:
19
19
  --------
20
20
  print : This function is essentially being wrapped around here.
21
21
  """
22
- def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwargs) -> NoReturn:
22
+ def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwargs) -> None:
23
23
  '''
24
24
  Kill the program execution.
25
25
 
@@ -60,7 +60,7 @@ def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwa
60
60
  >>> die("foo", "bar")
61
61
  foo bar
62
62
  '''
63
- def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> NoReturn:
63
+ def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> None:
64
64
  """
65
65
  Only prints the given data if verbose mode is activated.
66
66
 
@@ -7,8 +7,6 @@ Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
8
  __all__ = ["VersionInfo", "list_versions", "version_info", "version_print", "__version__"]
9
9
 
10
- from typing import NoReturn
11
-
12
10
  from .types import VersionInfo
13
11
  from .util import die
14
12
 
@@ -84,17 +82,18 @@ version_info = VersionInfo([
84
82
  (0, 5, 1),
85
83
  (0, 5, 2),
86
84
  (0, 5, 3),
85
+ (0, 6, 0),
87
86
  ])
88
87
 
89
88
  __version__: str = str(version_info)
90
89
 
91
90
 
92
- def list_versions() -> NoReturn:
91
+ def list_versions() -> None:
93
92
  """List all versions."""
94
93
  die(version_info.get_all_versions(), code=0)
95
94
 
96
95
 
97
- def version_print(version: str) -> NoReturn:
96
+ def version_print(version: str) -> None:
98
97
  """
99
98
  Print project version, then exit.
100
99
 
@@ -1,5 +1,3 @@
1
- from typing import NoReturn
2
-
3
1
  from _typeshed import Incomplete
4
2
 
5
3
  from .types import VersionInfo as VersionInfo
@@ -9,9 +7,9 @@ __all__ = ['VersionInfo', 'list_versions', 'version_info', 'version_print', '__v
9
7
  version_info: Incomplete
10
8
  __version__: str
11
9
 
12
- def list_versions() -> NoReturn:
10
+ def list_versions() -> None:
13
11
  """List all versions."""
14
- def version_print(version: str) -> NoReturn:
12
+ def version_print(version: str) -> None:
15
13
  """
16
14
  Print project version, then exit.
17
15
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vim-eof-comment
3
- Version: 0.5.3
3
+ Version: 0.6.0
4
4
  Summary: Adds Vim EOF modeline 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>
@@ -1 +0,0 @@
1
- 0.5.3
File without changes
File without changes