vim-eof-comment 0.5.3__py3-none-any.whl → 0.6.1__py3-none-any.whl

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.
@@ -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
@@ -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:
vim_eof_comment/eof.py CHANGED
@@ -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,
vim_eof_comment/eof.pyi CHANGED
@@ -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
 
vim_eof_comment/file.py CHANGED
@@ -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
 
vim_eof_comment/file.pyi CHANGED
@@ -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
  """
vim_eof_comment/types.py CHANGED
@@ -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
  ----------
@@ -245,9 +295,7 @@ class IndentMap(TypedDict):
245
295
 
246
296
  class IndentHandler(TypedDict):
247
297
  """
248
- A dict containing ``ft_ext``, ``level`` and ``expandtab`` as keys.
249
-
250
- This is a ``TypedDict``-like object.
298
+ An object containing ``ft_ext``, ``level`` and ``expandtab``.
251
299
 
252
300
  Attributes
253
301
  ----------
@@ -264,11 +312,18 @@ class IndentHandler(TypedDict):
264
312
  expandtab: bool
265
313
 
266
314
 
267
- class IOWrapperBool(TypedDict):
315
+ class IOWrapperBool:
268
316
  """
269
- A dict containing ``file``, ``had_nwl`` and ``crlf`` as keys.
317
+ An object containing ``file``, ``had_nwl`` and ``crlf``.
270
318
 
271
- This is a ``TypedDict``-like object.
319
+ Parameters
320
+ ----------
321
+ file : TextIO
322
+ The opened file as a ``TextIO`` wrapper.
323
+ had_nwl : bool
324
+ Whether the file has a newline or not.
325
+ crlf : bool
326
+ Whether the file is CRLF-terminated.
272
327
 
273
328
  Attributes
274
329
  ----------
@@ -284,12 +339,39 @@ class IOWrapperBool(TypedDict):
284
339
  had_nwl: bool
285
340
  crlf: bool
286
341
 
342
+ def __init__(self, file: TextIO, had_nwl: bool, crlf: bool):
343
+ self.file = file
344
+ self.had_nwl = had_nwl
345
+ self.crlf = crlf
346
+
347
+ def __iterables(self) -> Tuple[TextIO, bool, bool]:
348
+ """
349
+ Generate iterables.
350
+
351
+ Returns
352
+ -------
353
+ Tuple[TextIO, bool, bool]
354
+ The ``file``, ``had_nwl`` and ``crlf`` attributes.
355
+ """
356
+ return (self.file, self.had_nwl, self.crlf)
357
+
358
+ def __iter__(self):
359
+ """Iterate over objects."""
360
+ yield from self.__iterables()
361
+
287
362
 
288
- class LineBool(TypedDict):
363
+ class LineBool:
289
364
  """
290
- A dict containing ``line``, ``had_nwl`` and ``crlf`` as keys.
365
+ An object containing ``line``, ``had_nwl`` and ``crlf``.
291
366
 
292
- This is a ``TypedDict``-like object.
367
+ Parameters
368
+ ----------
369
+ line : str
370
+ The last line of the target file.
371
+ had_nwl : bool
372
+ Whether the file has a newline or not.
373
+ crlf : bool
374
+ Whether the file is CRLF-terminated.
293
375
 
294
376
  Attributes
295
377
  ----------
@@ -305,12 +387,37 @@ class LineBool(TypedDict):
305
387
  had_nwl: bool
306
388
  crlf: bool
307
389
 
390
+ def __init__(self, line: str, had_nwl: bool, crlf: bool):
391
+ self.line = line
392
+ self.had_nwl = had_nwl
393
+ self.crlf = crlf
394
+
395
+ def __iterables(self) -> Tuple[str, bool, bool]:
396
+ """
397
+ Generate iterables.
398
+
399
+ Returns
400
+ -------
401
+ Tuple[str, bool, bool]
402
+ The ``line``, ``had_nwl`` and ``crlf`` attributes.
403
+ """
404
+ return (self.line, self.had_nwl, self.crlf)
308
405
 
309
- class BatchPathDict(TypedDict):
406
+ def __iter__(self):
407
+ """Iterate over objects."""
408
+ yield from self.__iterables()
409
+
410
+
411
+ class BatchPathDict:
310
412
  """
311
- A dict containing ``file`` and ``ft_ext`` as keys.
413
+ An object containing ``file`` and ``ft_ext``.
312
414
 
313
- This is a ``TypedDict``-like object.
415
+ Parameters
416
+ ----------
417
+ file : TextIO
418
+ The opened file as a ``TextIO`` wrapper.
419
+ ft_ext : str
420
+ The file-type/file-extension.
314
421
 
315
422
  Attributes
316
423
  ----------
@@ -323,12 +430,36 @@ class BatchPathDict(TypedDict):
323
430
  file: TextIO
324
431
  ft_ext: str
325
432
 
433
+ def __init__(self, file: TextIO, ft_ext: str):
434
+ self.file = file
435
+ self.ft_ext = ft_ext
436
+
437
+ def __iterables(self) -> Tuple[TextIO, str]:
438
+ """
439
+ Generate iterables.
440
+
441
+ Returns
442
+ -------
443
+ Tuple[TextIO, str]
444
+ The ``file`` and ``ft_ext`` attributes.
445
+ """
446
+ return (self.file, self.ft_ext)
447
+
448
+ def __iter__(self):
449
+ """Iterate over objects."""
450
+ yield from self.__iterables()
326
451
 
327
- class BatchPairDict(TypedDict):
452
+
453
+ class BatchPairDict:
328
454
  """
329
- A dict containing ``fpath`` and ``ft_ext`` as keys.
455
+ An object containing ``fpath`` and ``ft_ext``.
330
456
 
331
- This is a ``TypedDict``-like object.
457
+ Parameters
458
+ ----------
459
+ fpath : str
460
+ The target file's path.
461
+ ft_ext : str
462
+ The file-type/file-extension.
332
463
 
333
464
  Attributes
334
465
  ----------
@@ -341,13 +472,41 @@ class BatchPairDict(TypedDict):
341
472
  fpath: str
342
473
  ft_ext: str
343
474
 
475
+ def __init__(self, fpath: str, ft_ext: str):
476
+ self.fpath = fpath
477
+ self.ft_ext = ft_ext
478
+
479
+ def __iterables(self) -> Tuple[str, str]:
480
+ """
481
+ Generate iterables.
482
+
483
+ Returns
484
+ -------
485
+ Tuple[str, str]
486
+ The ``fpath`` and ``ft_ext`` attributes.
487
+ """
488
+ return (self.fpath, self.ft_ext)
489
+
490
+ def __iter__(self):
491
+ """Iterate over objects."""
492
+ yield from self.__iterables()
493
+
344
494
 
345
- class EOFCommentSearch(TypedDict):
495
+ class EOFCommentSearch:
346
496
  """
347
497
  A dict containing ``state``, ``lang`` and ``match`` as keys.
348
498
 
349
499
  This is a ``TypedDict``-like object.
350
500
 
501
+ Parameters
502
+ ----------
503
+ state : IOWrapperBool
504
+ The target ``IOWrapperBool`` object.
505
+ lang : str
506
+ The file language.
507
+ match : bool
508
+ Whether it has a variation of an EOF comment at the end.
509
+
351
510
  Attributes
352
511
  ----------
353
512
  state : IOWrapperBool
@@ -362,4 +521,24 @@ class EOFCommentSearch(TypedDict):
362
521
  lang: str
363
522
  match: bool
364
523
 
524
+ def __init__(self, state: IOWrapperBool, lang: str, match: bool):
525
+ self.state = state
526
+ self.lang = lang
527
+ self.match = match
528
+
529
+ def __iterables(self) -> Tuple[IOWrapperBool, str, bool]:
530
+ """
531
+ Generate iterables.
532
+
533
+ Returns
534
+ -------
535
+ Tuple[IOWrapperBool, str, bool]
536
+ The ``state``, ``lang`` and ``match`` attributes.
537
+ """
538
+ return (self.state, self.lang, self.match)
539
+
540
+ def __iter__(self):
541
+ """Iterate over objects."""
542
+ yield from self.__iterables()
543
+
365
544
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
vim_eof_comment/types.pyi CHANGED
@@ -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
  ----------
@@ -189,9 +221,7 @@ class IndentMap(TypedDict):
189
221
 
190
222
  class IndentHandler(TypedDict):
191
223
  """
192
- A dict containing ``ft_ext``, ``level`` and ``expandtab`` as keys.
193
-
194
- This is a ``TypedDict``-like object.
224
+ An object containing ``ft_ext``, ``level`` and ``expandtab``.
195
225
 
196
226
  Attributes
197
227
  ----------
@@ -206,11 +236,18 @@ class IndentHandler(TypedDict):
206
236
  level: str
207
237
  expandtab: bool
208
238
 
209
- class IOWrapperBool(TypedDict):
239
+ class IOWrapperBool:
210
240
  """
211
- A dict containing ``file``, ``had_nwl`` and ``crlf`` as keys.
241
+ An object containing ``file``, ``had_nwl`` and ``crlf``.
212
242
 
213
- This is a ``TypedDict``-like object.
243
+ Parameters
244
+ ----------
245
+ file : TextIO
246
+ The opened file as a ``TextIO`` wrapper.
247
+ had_nwl : bool
248
+ Whether the file has a newline or not.
249
+ crlf : bool
250
+ Whether the file is CRLF-terminated.
214
251
 
215
252
  Attributes
216
253
  ----------
@@ -224,12 +261,31 @@ class IOWrapperBool(TypedDict):
224
261
  file: TextIO
225
262
  had_nwl: bool
226
263
  crlf: bool
264
+ def __init__(self, file: TextIO, had_nwl: bool, crlf: bool) -> None: ...
265
+ def __iterables(self) -> tuple[TextIO, bool, bool]:
266
+ """
267
+ Generate iterables.
268
+
269
+ Returns
270
+ -------
271
+ Tuple[TextIO, bool, bool]
272
+ The ``file``, ``had_nwl`` and ``crlf`` attributes.
273
+ """
274
+ def __iter__(self):
275
+ """Iterate over objects."""
227
276
 
228
- class LineBool(TypedDict):
277
+ class LineBool:
229
278
  """
230
- A dict containing ``line``, ``had_nwl`` and ``crlf`` as keys.
279
+ An object containing ``line``, ``had_nwl`` and ``crlf``.
231
280
 
232
- This is a ``TypedDict``-like object.
281
+ Parameters
282
+ ----------
283
+ line : str
284
+ The last line of the target file.
285
+ had_nwl : bool
286
+ Whether the file has a newline or not.
287
+ crlf : bool
288
+ Whether the file is CRLF-terminated.
233
289
 
234
290
  Attributes
235
291
  ----------
@@ -243,12 +299,29 @@ class LineBool(TypedDict):
243
299
  line: str
244
300
  had_nwl: bool
245
301
  crlf: bool
302
+ def __init__(self, line: str, had_nwl: bool, crlf: bool) -> None: ...
303
+ def __iterables(self) -> tuple[str, bool, bool]:
304
+ """
305
+ Generate iterables.
306
+
307
+ Returns
308
+ -------
309
+ Tuple[str, bool, bool]
310
+ The ``line``, ``had_nwl`` and ``crlf`` attributes.
311
+ """
312
+ def __iter__(self):
313
+ """Iterate over objects."""
246
314
 
247
- class BatchPathDict(TypedDict):
315
+ class BatchPathDict:
248
316
  """
249
- A dict containing ``file`` and ``ft_ext`` as keys.
317
+ An object containing ``file`` and ``ft_ext``.
250
318
 
251
- This is a ``TypedDict``-like object.
319
+ Parameters
320
+ ----------
321
+ file : TextIO
322
+ The opened file as a ``TextIO`` wrapper.
323
+ ft_ext : str
324
+ The file-type/file-extension.
252
325
 
253
326
  Attributes
254
327
  ----------
@@ -259,12 +332,29 @@ class BatchPathDict(TypedDict):
259
332
  """
260
333
  file: TextIO
261
334
  ft_ext: str
335
+ def __init__(self, file: TextIO, ft_ext: str) -> None: ...
336
+ def __iterables(self) -> tuple[TextIO, str]:
337
+ """
338
+ Generate iterables.
339
+
340
+ Returns
341
+ -------
342
+ Tuple[TextIO, str]
343
+ The ``file`` and ``ft_ext`` attributes.
344
+ """
345
+ def __iter__(self):
346
+ """Iterate over objects."""
262
347
 
263
- class BatchPairDict(TypedDict):
348
+ class BatchPairDict:
264
349
  """
265
- A dict containing ``fpath`` and ``ft_ext`` as keys.
350
+ An object containing ``fpath`` and ``ft_ext``.
266
351
 
267
- This is a ``TypedDict``-like object.
352
+ Parameters
353
+ ----------
354
+ fpath : str
355
+ The target file's path.
356
+ ft_ext : str
357
+ The file-type/file-extension.
268
358
 
269
359
  Attributes
270
360
  ----------
@@ -275,13 +365,34 @@ class BatchPairDict(TypedDict):
275
365
  """
276
366
  fpath: str
277
367
  ft_ext: str
368
+ def __init__(self, fpath: str, ft_ext: str) -> None: ...
369
+ def __iterables(self) -> tuple[str, str]:
370
+ """
371
+ Generate iterables.
372
+
373
+ Returns
374
+ -------
375
+ Tuple[str, str]
376
+ The ``fpath`` and ``ft_ext`` attributes.
377
+ """
378
+ def __iter__(self):
379
+ """Iterate over objects."""
278
380
 
279
- class EOFCommentSearch(TypedDict):
381
+ class EOFCommentSearch:
280
382
  """
281
383
  A dict containing ``state``, ``lang`` and ``match`` as keys.
282
384
 
283
385
  This is a ``TypedDict``-like object.
284
386
 
387
+ Parameters
388
+ ----------
389
+ state : IOWrapperBool
390
+ The target ``IOWrapperBool`` object.
391
+ lang : str
392
+ The file language.
393
+ match : bool
394
+ Whether it has a variation of an EOF comment at the end.
395
+
285
396
  Attributes
286
397
  ----------
287
398
  state : IOWrapperBool
@@ -294,5 +405,17 @@ class EOFCommentSearch(TypedDict):
294
405
  state: IOWrapperBool
295
406
  lang: str
296
407
  match: bool
408
+ def __init__(self, state: IOWrapperBool, lang: str, match: bool) -> None: ...
409
+ def __iterables(self) -> tuple[IOWrapperBool, str, bool]:
410
+ """
411
+ Generate iterables.
412
+
413
+ Returns
414
+ -------
415
+ Tuple[IOWrapperBool, str, bool]
416
+ The ``state``, ``lang`` and ``match`` attributes.
417
+ """
418
+ def __iter__(self):
419
+ """Iterate over objects."""
297
420
 
298
421
  # vim: set ts=4 sts=4 sw=4 et ai si sta:
vim_eof_comment/util.py CHANGED
@@ -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
 
vim_eof_comment/util.pyi CHANGED
@@ -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,19 @@ version_info = VersionInfo([
84
82
  (0, 5, 1),
85
83
  (0, 5, 2),
86
84
  (0, 5, 3),
85
+ (0, 6, 0),
86
+ (0, 6, 1),
87
87
  ])
88
88
 
89
89
  __version__: str = str(version_info)
90
90
 
91
91
 
92
- def list_versions() -> NoReturn:
92
+ def list_versions() -> None:
93
93
  """List all versions."""
94
94
  die(version_info.get_all_versions(), code=0)
95
95
 
96
96
 
97
- def version_print(version: str) -> NoReturn:
97
+ def version_print(version: str) -> None:
98
98
  """
99
99
  Print project version, then exit.
100
100
 
@@ -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.1
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>
@@ -0,0 +1,39 @@
1
+ docs/Makefile,sha256=1rYkueTz6GC8AAF0rtOIJIv7sX-hMxVQBumHEqvbFEI,684
2
+ docs/make.bat,sha256=0qjrzODegavKd7LLwmr9ADhaYftiTnBgqOVAL9kApyo,769
3
+ docs/source/conf.py,sha256=nqU9B3qBpI-hZ8-L2oJuh2xY4Ob-GCD3nN00JiZbRHg,1729
4
+ docs/source/functions.rst,sha256=erouYhzblZATxkA5yB6aUvF8baSvBcPQ9HwySWATTdI,20
5
+ docs/source/index.rst,sha256=q7DKNrR1ztwLflzGbZDnIhFwkUTcjInqZV8uRqSq2N0,457
6
+ docs/source/installation.rst,sha256=PkiS3E_ujNTWeKXicZ7aBPch2l1R0TsRRL6pFj_oMJI,276
7
+ vim_eof_comment/__init__.py,sha256=ESbmhca9mTst3TYMer8zFw73IRsJvn5EESci_RpfLbQ,487
8
+ vim_eof_comment/__init__.pyi,sha256=Eh8FQwE_F9TrQEiT7CR1mdGHBT6fHUzfV6VP8uSN33g,478
9
+ vim_eof_comment/__main__.py,sha256=0AFVSkz8RuxSuPbJJWycyxs6u5Yypl8FKUMR3ZVLJbk,343
10
+ vim_eof_comment/eof.py,sha256=rGKPqO6JbDzdJcsp20Ma9LLdyNHuUjC9ddU9F5nZqDE,5259
11
+ vim_eof_comment/eof.pyi,sha256=xmAMsxOyiKQs4BqZP8h8rqP4a-ONifnb491sAzbu2Y8,1839
12
+ vim_eof_comment/file.py,sha256=k1pX1RMZYtUkTXqTrAPsamn86Owl_OZ86XKHvV-q1Qo,5410
13
+ vim_eof_comment/file.pyi,sha256=yqZh8ipC4X0GpMLVTUsw1UyiQ0JO6dY-_-0qGzJ3HF4,2317
14
+ vim_eof_comment/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ vim_eof_comment/regex.py,sha256=48oxUO3YDdM30U0qAsqyH_AycYCrcnaQ6cghy3NXHrw,903
16
+ vim_eof_comment/regex.pyi,sha256=W0ZX_J9mLRckCdBNE-Bl09hsQ61VFqjuLwDlevEeeUM,336
17
+ vim_eof_comment/types.py,sha256=nMW7hGgWSDk1VvrRPUi6AzMccd3xnrZyA3u77i5DmZ4,12865
18
+ vim_eof_comment/types.pyi,sha256=AresdpyvrIsdIiuqFD2TX8XzZmHjv0E66Cd7mnGX9cg,10753
19
+ vim_eof_comment/util.py,sha256=syo6rX6e_b7rhE3BLWS9tMZBkXwFa4PVsbHF7n6BHsw,4265
20
+ vim_eof_comment/util.pyi,sha256=twD4qk_fIL4ftQGbaGYmTSbKqE-RycAs5WTYBZ-HZsc,2653
21
+ vim_eof_comment/version.py,sha256=BsTwvHBToNlkyeTWPwt0u36P4IzWeki09M-PIjBt_5Q,1921
22
+ vim_eof_comment/version.pyi,sha256=aiA3TyTJOk5eZFt7glPNzRBvVgCwSJDlOFSUqoMPFG4,488
23
+ vim_eof_comment/args/__init__.py,sha256=Hyqun15456NVFLAJ3cpdtuNEz5XaFH93vfVlbC-aeuc,318
24
+ vim_eof_comment/args/__init__.pyi,sha256=cXK7nEpYBveD4kxtVTe2x8oUxT9mhENS5r3wK3AAX2U,151
25
+ vim_eof_comment/args/completion.py,sha256=X2O-02QHeKBNF6alJHM9qka0l3-aY5TUTAqnHLY0bSY,1256
26
+ vim_eof_comment/args/completion.pyi,sha256=nrKI8BYBe3cEXGOwkBDkeWgofjQpdGYL8mJR6ts1c9U,859
27
+ vim_eof_comment/args/parsing.py,sha256=Clp23emNb1X0KVbnwIY1egA4G1BJjMHiOPkoaNMdq2E,6593
28
+ vim_eof_comment/args/parsing.pyi,sha256=wJMDnW_dtIlv8NfTvf_JyTB7qwk_ZwLvCizp3GkFWhw,1741
29
+ vim_eof_comment/comments/__init__.py,sha256=KIFAbugEKa8arCASaf7pKNHdzUC99N_T18D1CfaCOQs,292
30
+ vim_eof_comment/comments/__init__.pyi,sha256=cecbbrShh0If8btwJ8zKYpBt9dIsMwrDXbdaBQqwUus,104
31
+ vim_eof_comment/comments/filetypes.json,sha256=JpSrnBNO2AivLYi-C5--8yVocyBwye3IkMesNIz1uHA,2973
32
+ vim_eof_comment/comments/generator.py,sha256=k4C7w-C4wNJtEu9clf2f4vp-WzJlzzTfGtynV0FIwSE,7792
33
+ vim_eof_comment/comments/generator.pyi,sha256=MAT7N0bPQE2IswSWOyiELnldbsBcjVsnIwSj4ltkI4g,3665
34
+ vim_eof_comment-0.6.1.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
35
+ vim_eof_comment-0.6.1.dist-info/METADATA,sha256=4pksGMdkeG7sh13AuYq3e-JQwrRdNWf99rlaNqsJMHU,2826
36
+ vim_eof_comment-0.6.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
37
+ vim_eof_comment-0.6.1.dist-info/entry_points.txt,sha256=vm47g4hoUbow4elcHr9yylYfj6IvAs10wSFKqwqTu6E,61
38
+ vim_eof_comment-0.6.1.dist-info/top_level.txt,sha256=TkaQ5vuhVzXaJnfUdcLJCQ81ILK2V6OtvX5-hIMZAc0,21
39
+ vim_eof_comment-0.6.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.10.1)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,39 +0,0 @@
1
- docs/Makefile,sha256=1rYkueTz6GC8AAF0rtOIJIv7sX-hMxVQBumHEqvbFEI,684
2
- docs/make.bat,sha256=0qjrzODegavKd7LLwmr9ADhaYftiTnBgqOVAL9kApyo,769
3
- docs/source/conf.py,sha256=nqU9B3qBpI-hZ8-L2oJuh2xY4Ob-GCD3nN00JiZbRHg,1729
4
- docs/source/functions.rst,sha256=erouYhzblZATxkA5yB6aUvF8baSvBcPQ9HwySWATTdI,20
5
- docs/source/index.rst,sha256=q7DKNrR1ztwLflzGbZDnIhFwkUTcjInqZV8uRqSq2N0,457
6
- docs/source/installation.rst,sha256=PkiS3E_ujNTWeKXicZ7aBPch2l1R0TsRRL6pFj_oMJI,276
7
- vim_eof_comment/__init__.py,sha256=ESbmhca9mTst3TYMer8zFw73IRsJvn5EESci_RpfLbQ,487
8
- vim_eof_comment/__init__.pyi,sha256=Eh8FQwE_F9TrQEiT7CR1mdGHBT6fHUzfV6VP8uSN33g,478
9
- vim_eof_comment/__main__.py,sha256=0AFVSkz8RuxSuPbJJWycyxs6u5Yypl8FKUMR3ZVLJbk,343
10
- vim_eof_comment/eof.py,sha256=gWq0mVc0PcRNW4R41BBRlDw3B2etCvv0qXUSHOiH72Q,5295
11
- vim_eof_comment/eof.pyi,sha256=eFaIkPQ3ZXS3CE6QpTEA9QCQmJpmG_5N3Kb3_Iz_tOo,1872
12
- vim_eof_comment/file.py,sha256=jR3VBVZ_yT9bMbi0SXQKMGexYgtWrvWkJEtodAIksrg,5395
13
- vim_eof_comment/file.pyi,sha256=XOYsJnW72i7Zt9N0jSLpscls-ggzL08aQKXpxrLFiwY,2274
14
- vim_eof_comment/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- vim_eof_comment/regex.py,sha256=48oxUO3YDdM30U0qAsqyH_AycYCrcnaQ6cghy3NXHrw,903
16
- vim_eof_comment/regex.pyi,sha256=W0ZX_J9mLRckCdBNE-Bl09hsQ61VFqjuLwDlevEeeUM,336
17
- vim_eof_comment/types.py,sha256=kujXMK19J0Nngf6eoHyg04ZfD-WKAB_Cdna7uRVJTKQ,8367
18
- vim_eof_comment/types.pyi,sha256=OnXme5rgPq9vt8LHTRCSeOpkBAuc2J_7pcwcXFHOk1A,7255
19
- vim_eof_comment/util.py,sha256=MHLt-FJz4uhsa56J2sug74uqk6W3S0mVLugvz7KNRUU,4287
20
- vim_eof_comment/util.pyi,sha256=5RQukLgpVZTwbALhBOtd1NqFkiqC-V6JEWeT1_B9-2k,2675
21
- vim_eof_comment/version.py,sha256=bP9IxYQS_QivEBpnNsL4Cl70-Q3Y0cP591byW2XmQYQ,1928
22
- vim_eof_comment/version.pyi,sha256=P90IRWMKlsG_YU8G8a1e1eyTd8rC-6fUGvQrD3zjwbE,525
23
- vim_eof_comment/args/__init__.py,sha256=Hyqun15456NVFLAJ3cpdtuNEz5XaFH93vfVlbC-aeuc,318
24
- vim_eof_comment/args/__init__.pyi,sha256=cXK7nEpYBveD4kxtVTe2x8oUxT9mhENS5r3wK3AAX2U,151
25
- vim_eof_comment/args/completion.py,sha256=xpfMKeo1-LBMeU-5icO1Jh5ixml55sK5ExHbi5sSXKg,1270
26
- vim_eof_comment/args/completion.pyi,sha256=bEMpcLKYUZEGj3V9yiYifpLxfuNC69etdIf-gdsdtJc,891
27
- vim_eof_comment/args/parsing.py,sha256=Zp1u4--4t4lfQF8RZLhCFfE6Khlc5rcG7gHcPXaPthw,6605
28
- vim_eof_comment/args/parsing.pyi,sha256=wJMDnW_dtIlv8NfTvf_JyTB7qwk_ZwLvCizp3GkFWhw,1741
29
- vim_eof_comment/comments/__init__.py,sha256=KIFAbugEKa8arCASaf7pKNHdzUC99N_T18D1CfaCOQs,292
30
- vim_eof_comment/comments/__init__.pyi,sha256=cecbbrShh0If8btwJ8zKYpBt9dIsMwrDXbdaBQqwUus,104
31
- vim_eof_comment/comments/filetypes.json,sha256=JpSrnBNO2AivLYi-C5--8yVocyBwye3IkMesNIz1uHA,2973
32
- vim_eof_comment/comments/generator.py,sha256=yuRvTuVd6qQ1ei496w8NQ0c1MR1e3qJHf1pOTalXlv8,7814
33
- vim_eof_comment/comments/generator.pyi,sha256=ue8oMa7yEoKfgQDJbeTzx0Qm5Wck2gHrDb_wF00xIyo,3687
34
- vim_eof_comment-0.5.3.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
35
- vim_eof_comment-0.5.3.dist-info/METADATA,sha256=lexJQiJJA7rL5pP1DRU_VkQvRFXLy5nSbIXAk-pwP3I,2826
36
- vim_eof_comment-0.5.3.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
37
- vim_eof_comment-0.5.3.dist-info/entry_points.txt,sha256=vm47g4hoUbow4elcHr9yylYfj6IvAs10wSFKqwqTu6E,61
38
- vim_eof_comment-0.5.3.dist-info/top_level.txt,sha256=TkaQ5vuhVzXaJnfUdcLJCQ81ILK2V6OtvX5-hIMZAc0,21
39
- vim_eof_comment-0.5.3.dist-info/RECORD,,