vim-eof-comment 0.4.1__py3-none-any.whl → 0.5.0__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.
@@ -5,7 +5,7 @@ Argument parsing completion utilities for ``vim-eof-comment``.
5
5
 
6
6
  Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
- __all__ = ["complete_parser"]
8
+ __all__ = ["complete_parser", "complete_validator"]
9
9
 
10
10
  from argparse import ArgumentParser
11
11
  from typing import List, NoReturn
@@ -1,8 +1,24 @@
1
1
  from argparse import ArgumentParser
2
2
  from typing import NoReturn
3
3
 
4
- __all__ = ['complete_parser']
4
+ __all__ = ['complete_parser', 'complete_validator']
5
5
 
6
+ def complete_validator(completion_candidate: list[str], current_input: str) -> bool:
7
+ """
8
+ Complete non-prefix substring matches.
9
+
10
+ Parameters
11
+ ----------
12
+ completion_candidate : List[str]
13
+ All the completion candidates.
14
+ current_input : str
15
+ The current input string.
16
+
17
+ Returns
18
+ -------
19
+ bool
20
+ Whether the current input fits the completion candidates pool.
21
+ """
6
22
  def complete_parser(parser: ArgumentParser, **kwargs) -> NoReturn:
7
23
  """
8
24
  Complete the script argument parser.
@@ -17,7 +17,7 @@ from ..util import die
17
17
  from .completion import complete_parser
18
18
 
19
19
 
20
- def gen_parser_specs(*specs) -> Tuple[ParserSpec]:
20
+ def gen_parser_specs(*specs) -> List[ParserSpec]:
21
21
  """
22
22
  Generate a ``ParserSpec`` object.
23
23
 
@@ -28,13 +28,13 @@ def gen_parser_specs(*specs) -> Tuple[ParserSpec]:
28
28
 
29
29
  Returns
30
30
  -------
31
- Tuple[ParserSpec]
32
- The converted dictionaries inside a tuple.
31
+ List[ParserSpec]
32
+ The converted dictionaries inside a list.
33
33
  """
34
- return tuple([ParserSpec(**d) for d in [*specs]])
34
+ return [ParserSpec(**d) for d in [*specs]]
35
35
 
36
36
 
37
- def bootstrap_args(parser: ArgumentParser, specs: Tuple[ParserSpec]) -> Namespace:
37
+ def bootstrap_args(parser: ArgumentParser, specs: List[ParserSpec]) -> Namespace:
38
38
  """
39
39
  Bootstrap the program arguments.
40
40
 
@@ -92,7 +92,7 @@ def arg_parser_init(prog: str = "vim-eof-comment") -> Tuple[ArgumentParser, Name
92
92
  add_help=True,
93
93
  allow_abbrev=True
94
94
  )
95
- spec: Tuple[ParserSpec] = gen_parser_specs(
95
+ spec: List[ParserSpec] = gen_parser_specs(
96
96
  {
97
97
  "opts": ["directories"],
98
98
  "kwargs": {
@@ -4,7 +4,7 @@ from ..types import IndentHandler, ParserSpec
4
4
 
5
5
  __all__ = ['gen_parser_specs', 'bootstrap_args', 'arg_parser_init', 'indent_handler']
6
6
 
7
- def gen_parser_specs(*specs) -> tuple[ParserSpec]:
7
+ def gen_parser_specs(*specs) -> list[ParserSpec]:
8
8
  """
9
9
  Generate a ``ParserSpec`` object.
10
10
 
@@ -15,10 +15,10 @@ def gen_parser_specs(*specs) -> tuple[ParserSpec]:
15
15
 
16
16
  Returns
17
17
  -------
18
- Tuple[ParserSpec]
19
- The converted dictionaries inside a tuple.
18
+ List[ParserSpec]
19
+ The converted dictionaries inside a list.
20
20
  """
21
- def bootstrap_args(parser: ArgumentParser, specs: tuple[ParserSpec]) -> Namespace:
21
+ def bootstrap_args(parser: ArgumentParser, specs: list[ParserSpec]) -> Namespace:
22
22
  """
23
23
  Bootstrap the program arguments.
24
24
 
@@ -5,7 +5,13 @@ Per-filetype modeline comment class.
5
5
 
6
6
  Copyright (c) 2025 Guennadi Maximov C. All Rights Reserved.
7
7
  """
8
- __all__ = ["Comments", "export_json", "import_json", "list_filetypes"]
8
+ __all__ = [
9
+ "Comments",
10
+ "export_json",
11
+ "generate_list_items",
12
+ "import_json",
13
+ "list_filetypes",
14
+ ]
9
15
 
10
16
  import json
11
17
  import os
@@ -22,7 +28,6 @@ from ..util import die
22
28
  COMMENT_STR: str = "vim: set ts={ts} sts={sts} sw={sw} {et} ai si sta:"
23
29
 
24
30
  _JSON_FILE: str = realpath("./vim_eof_comment/comments/filetypes.json")
25
-
26
31
  _BLUE: int = Fore.BLUE
27
32
  _YELLOW: int = Fore.YELLOW
28
33
  _CYAN: int = Fore.CYAN
@@ -88,6 +93,7 @@ class Comments():
88
93
  __is_available(lang)
89
94
  __fill_langs(langs)
90
95
  get_defaults()
96
+ get_ft()
91
97
  """
92
98
 
93
99
  __DEFAULT: Dict[str, IndentMap] = _DEFAULT.copy()
@@ -108,7 +114,7 @@ class Comments():
108
114
  self.langs = self.__DEFAULT.copy()
109
115
  return
110
116
 
111
- langs = dict()
117
+ langs: Dict[str, IndentMap] = dict()
112
118
  for lang, mapping in mappings.items():
113
119
  if not (self.__is_available(lang)) or len(mapping) == 0:
114
120
  continue
@@ -117,7 +123,7 @@ class Comments():
117
123
  if len(mapping) > 1:
118
124
  expandtab = mapping["expandtab"]
119
125
 
120
- langs[lang] = {"level": indent, "expandtab": expandtab}
126
+ langs[lang] = IndentMap(level=indent, expandtab=expandtab)
121
127
 
122
128
  self.__fill_langs(langs)
123
129
 
@@ -2,7 +2,7 @@ from typing import Iterator, NoReturn
2
2
 
3
3
  from ..types import IndentMap
4
4
 
5
- __all__ = ['Comments', 'export_json', 'import_json', 'list_filetypes']
5
+ __all__ = ['Comments', 'export_json', 'generate_list_items', 'import_json', 'list_filetypes']
6
6
 
7
7
  def import_json() -> tuple[dict[str, str], dict[str, IndentMap]]:
8
8
  """
@@ -41,6 +41,7 @@ class Comments:
41
41
  __is_available(lang)
42
42
  __fill_langs(langs)
43
43
  get_defaults()
44
+ get_ft()
44
45
  """
45
46
  __DEFAULT: dict[str, IndentMap]
46
47
  __formats: dict[str, str]
@@ -113,6 +114,24 @@ class Comments:
113
114
  Either the file extension string, or if not available then ``None``.
114
115
  """
115
116
 
117
+ def generate_list_items(ft: str, level: int, expandtab: str) -> str:
118
+ '''
119
+ Generate a colored string for filetypes listing.
120
+
121
+ Parameters
122
+ ----------
123
+ ft : str
124
+ The filetype item in question.
125
+ level : int
126
+ Indent size.
127
+ expandtab : str
128
+ Either ``"Yes"`` or ``"No"``.
129
+
130
+ Returns
131
+ -------
132
+ str
133
+ The generated string.
134
+ '''
116
135
  def list_filetypes() -> NoReturn:
117
136
  """List all available filetypes."""
118
137
  def export_json() -> NoReturn:
vim_eof_comment/eof.py CHANGED
@@ -153,10 +153,9 @@ def main() -> int:
153
153
  dirs: List[str] = ns.directories
154
154
  exts: List[str] = ns.exts.split(",")
155
155
  newline: bool = ns.newline
156
- indent: List[IndentHandler] = indent_handler(ns.indent)
157
156
  verbose: bool = ns.verbose
158
-
159
157
  dry_run: bool = ns.dry_run
158
+ indent: List[IndentHandler] = indent_handler(ns.indent)
160
159
 
161
160
  if dry_run:
162
161
  verbose = True
vim_eof_comment/file.py CHANGED
@@ -106,14 +106,14 @@ def open_batch_paths(paths: List[BatchPairDict]) -> Dict[str, BatchPathDict]:
106
106
  Dict[str, BatchPathDict]
107
107
  A ``str`` to ``BatchPathDict``` dictionary.
108
108
  """
109
- result = dict()
109
+ result: Dict[str, BatchPathDict] = dict()
110
110
  for path in paths:
111
111
  fpath, ext = path["fpath"], path["ft_ext"]
112
112
  if not try_open(fpath):
113
113
  continue
114
114
 
115
115
  try:
116
- result[fpath] = {"file": open(fpath, "r"), "ft_ext": ext}
116
+ result[fpath] = BatchPathDict(file=open(fpath, "r"), ft_ext=ext)
117
117
  except KeyboardInterrupt:
118
118
  die("\nProgram interrupted!", code=1) # Kills the program
119
119
  except FileNotFoundError:
vim_eof_comment/types.py CHANGED
@@ -15,11 +15,178 @@ __all__ = [
15
15
  "IndentMap",
16
16
  "LineBool",
17
17
  "ParserSpec",
18
+ "VersionInfo",
18
19
  ]
19
20
 
20
- from typing import Any, Dict, List, TextIO, TypedDict
21
+ from typing import Any, Dict, List, TextIO, Tuple, TypedDict
21
22
 
22
- from argcomplete.completers import DirectoriesCompleter
23
+ import argcomplete
24
+
25
+
26
+ class VersionInfo():
27
+ """
28
+ A ``sys.version_info``-like object type.
29
+
30
+ Parameters
31
+ ----------
32
+ all_versions : List[Tuple[int, int, int]]
33
+ A list of three number tuples, containing (in order) the major, minor and patch
34
+ components.
35
+
36
+ Attributes
37
+ ----------
38
+ major : int
39
+ The major component of the version.
40
+ minor : int
41
+ The minor component of the version.
42
+ patch : int
43
+ The patch component of the version.
44
+ all_versions : List[Tuple[int, int, int]]
45
+ A list of tuples containing all the versions in the object instance.
46
+
47
+ Methods
48
+ -------
49
+ get_all_versions()
50
+ """
51
+
52
+ major: int
53
+ minor: int
54
+ patch: int
55
+ all_versions: List[Tuple[int, int, int]]
56
+
57
+ def __init__(self, all_versions: List[Tuple[int, int, int]]):
58
+ """
59
+ Initialize VersionInfo object.
60
+
61
+ Parameters
62
+ ----------
63
+ all_versions : List[Tuple[int, int, int]]
64
+ A list of tuples of three-integers, containing (in order) the major, minor and patch
65
+ components.
66
+ """
67
+ self.all_versions = all_versions.copy()
68
+
69
+ all_versions = all_versions.copy()[::-1]
70
+ self.major = all_versions[0][0]
71
+ self.minor = all_versions[0][1]
72
+ self.patch = all_versions[0][2]
73
+
74
+ def __str__(self) -> str:
75
+ """
76
+ Representate this object as a string.
77
+
78
+ This is what is returned when using ``str(VersionInfo(...))``.
79
+
80
+ Returns
81
+ -------
82
+ str
83
+ The string representation of the instance.
84
+
85
+ Examples
86
+ --------
87
+ Only one definition in constructor.
88
+
89
+ >>> from vim_eof_comment.version import VersionInfo
90
+ >>> print(str(VersionInfo([(0, 0, 1)])))
91
+ 0.0.1
92
+
93
+ Multiple definitions in constructor.
94
+
95
+ >>> from vim_eof_comment.version import VersionInfo
96
+ >>> print(str(VersionInfo([(0, 0, 1), (0, 0, 2)])))
97
+ 0.0.2
98
+ """
99
+ return f"{self.major}.{self.minor}.{self.patch}"
100
+
101
+ def __repr__(self) -> str:
102
+ """
103
+ Representate this object as a string.
104
+
105
+ This is what is returned when using ``print(VersionInfo(...))``.
106
+
107
+ Returns
108
+ -------
109
+ str
110
+ The string representation of the instance.
111
+
112
+ Examples
113
+ --------
114
+ Only one definition in constructor.
115
+
116
+ >>> from vim_eof_comment.version import VersionInfo
117
+ >>> print(repr(VersionInfo([(0, 0, 1)])))
118
+ 0.0.1
119
+
120
+ Multiple definitions in constructor.
121
+
122
+ >>> from vim_eof_comment.version import VersionInfo
123
+ >>> print(repr(VersionInfo([(0, 0, 1), (0, 0, 2)])))
124
+ 0.0.2
125
+ """
126
+ return self.__str__()
127
+
128
+ def __eq__(self, b) -> bool:
129
+ """
130
+ Check the equality between two ``VersionInfo`` instances.
131
+
132
+ Parameters
133
+ ----------
134
+ b : VersionInfo
135
+ The other instance to compare.
136
+
137
+ Returns
138
+ -------
139
+ bool
140
+ Whether they are equal or not.
141
+ """
142
+ if not isinstance(b, VersionInfo):
143
+ return False
144
+
145
+ b: VersionInfo = b
146
+ return self.major == b.major and self.minor == b.minor and self.patch == b.patch
147
+
148
+ def get_current_version(self) -> Tuple[int, int, int]:
149
+ """
150
+ Get a tuple representing the current version.
151
+
152
+ Returns
153
+ -------
154
+ major : int
155
+ Major component.
156
+ minor : int
157
+ Minor component.
158
+ patch : int
159
+ Patch component.
160
+ """
161
+ return (self.major, self. minor, self.patch)
162
+
163
+ def get_all_versions(self) -> str:
164
+ """
165
+ Retrieve all versions as a string.
166
+
167
+ Returns
168
+ -------
169
+ str
170
+ A string, containing the program versions, in ascending order.
171
+
172
+ Examples
173
+ --------
174
+ To generate a single string.
175
+ >>> from vim_eof_comment.version import VersionInfo
176
+ >>> print(VersionInfo([(0, 0, 1), (0, 0, 2), (0, 1, 0)]).get_all_versions())
177
+ 0.0.1
178
+ 0.0.2
179
+ 0.0.3 (latest)
180
+ """
181
+ result = ""
182
+ for i, info in enumerate(self.all_versions):
183
+ result += f"{info[0]}.{info[1]}.{info[2]}"
184
+ if i == len(self.all_versions) - 1:
185
+ result += " (latest)"
186
+ else:
187
+ result += "\n"
188
+
189
+ return result
23
190
 
24
191
 
25
192
  class ParserSpec(TypedDict):
@@ -40,7 +207,7 @@ class ParserSpec(TypedDict):
40
207
 
41
208
  opts: List[str]
42
209
  kwargs: Dict[str, Any]
43
- completer: DirectoriesCompleter
210
+ completer: argcomplete.DirectoriesCompleter
44
211
 
45
212
 
46
213
  class CommentMap(TypedDict):
vim_eof_comment/types.pyi CHANGED
@@ -1,8 +1,143 @@
1
1
  from typing import Any, TextIO, TypedDict
2
2
 
3
- from argcomplete.completers import DirectoriesCompleter
3
+ import argcomplete
4
4
 
5
- __all__ = ['BatchPairDict', 'BatchPathDict', 'CommentMap', 'EOFCommentSearch', 'IOWrapperBool', 'IndentHandler', 'IndentMap', 'LineBool', 'ParserSpec']
5
+ __all__ = ['BatchPairDict', 'BatchPathDict', 'CommentMap', 'EOFCommentSearch', 'IOWrapperBool', 'IndentHandler', 'IndentMap', 'LineBool', 'ParserSpec', 'VersionInfo']
6
+
7
+ class VersionInfo:
8
+ """
9
+ A ``sys.version_info``-like object type.
10
+
11
+ Parameters
12
+ ----------
13
+ all_versions : List[Tuple[int, int, int]]
14
+ A list of three number tuples, containing (in order) the major, minor and patch
15
+ components.
16
+
17
+ Attributes
18
+ ----------
19
+ major : int
20
+ The major component of the version.
21
+ minor : int
22
+ The minor component of the version.
23
+ patch : int
24
+ The patch component of the version.
25
+ all_versions : List[Tuple[int, int, int]]
26
+ A list of tuples containing all the versions in the object instance.
27
+
28
+ Methods
29
+ -------
30
+ get_all_versions()
31
+ """
32
+ major: int
33
+ minor: int
34
+ patch: int
35
+ all_versions: list[tuple[int, int, int]]
36
+ def __init__(self, all_versions: list[tuple[int, int, int]]) -> None:
37
+ """
38
+ Initialize VersionInfo object.
39
+
40
+ Parameters
41
+ ----------
42
+ all_versions : List[Tuple[int, int, int]]
43
+ A list of tuples of three-integers, containing (in order) the major, minor and patch
44
+ components.
45
+ """
46
+ def __str__(self) -> str:
47
+ """
48
+ Representate this object as a string.
49
+
50
+ This is what is returned when using ``str(VersionInfo(...))``.
51
+
52
+ Returns
53
+ -------
54
+ str
55
+ The string representation of the instance.
56
+
57
+ Examples
58
+ --------
59
+ Only one definition in constructor.
60
+
61
+ >>> from vim_eof_comment.version import VersionInfo
62
+ >>> print(str(VersionInfo([(0, 0, 1)])))
63
+ 0.0.1
64
+
65
+ Multiple definitions in constructor.
66
+
67
+ >>> from vim_eof_comment.version import VersionInfo
68
+ >>> print(str(VersionInfo([(0, 0, 1), (0, 0, 2)])))
69
+ 0.0.2
70
+ """
71
+ def __repr__(self) -> str:
72
+ """
73
+ Representate this object as a string.
74
+
75
+ This is what is returned when using ``print(VersionInfo(...))``.
76
+
77
+ Returns
78
+ -------
79
+ str
80
+ The string representation of the instance.
81
+
82
+ Examples
83
+ --------
84
+ Only one definition in constructor.
85
+
86
+ >>> from vim_eof_comment.version import VersionInfo
87
+ >>> print(repr(VersionInfo([(0, 0, 1)])))
88
+ 0.0.1
89
+
90
+ Multiple definitions in constructor.
91
+
92
+ >>> from vim_eof_comment.version import VersionInfo
93
+ >>> print(repr(VersionInfo([(0, 0, 1), (0, 0, 2)])))
94
+ 0.0.2
95
+ """
96
+ def __eq__(self, b) -> bool:
97
+ """
98
+ Check the equality between two ``VersionInfo`` instances.
99
+
100
+ Parameters
101
+ ----------
102
+ b : VersionInfo
103
+ The other instance to compare.
104
+
105
+ Returns
106
+ -------
107
+ bool
108
+ Whether they are equal or not.
109
+ """
110
+ def get_current_version(self) -> tuple[int, int, int]:
111
+ """
112
+ Get a tuple representing the current version.
113
+
114
+ Returns
115
+ -------
116
+ major : int
117
+ Major component.
118
+ minor : int
119
+ Minor component.
120
+ patch : int
121
+ Patch component.
122
+ """
123
+ def get_all_versions(self) -> str:
124
+ """
125
+ Retrieve all versions as a string.
126
+
127
+ Returns
128
+ -------
129
+ str
130
+ A string, containing the program versions, in ascending order.
131
+
132
+ Examples
133
+ --------
134
+ To generate a single string.
135
+ >>> from vim_eof_comment.version import VersionInfo
136
+ >>> print(VersionInfo([(0, 0, 1), (0, 0, 2), (0, 1, 0)]).get_all_versions())
137
+ 0.0.1
138
+ 0.0.2
139
+ 0.0.3 (latest)
140
+ """
6
141
 
7
142
  class ParserSpec(TypedDict):
8
143
  """
@@ -21,7 +156,7 @@ class ParserSpec(TypedDict):
21
156
  """
22
157
  opts: list[str]
23
158
  kwargs: dict[str, Any]
24
- completer: DirectoriesCompleter
159
+ completer: argcomplete.DirectoriesCompleter
25
160
 
26
161
  class CommentMap(TypedDict):
27
162
  """
vim_eof_comment/util.py CHANGED
@@ -5,7 +5,12 @@ 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"]
8
+ __all__ = [
9
+ "die",
10
+ "error",
11
+ "gen_indent_maps",
12
+ "verbose_print",
13
+ ]
9
14
 
10
15
  from sys import exit as Exit
11
16
  from sys import stderr, stdout
@@ -15,7 +20,7 @@ from .types import IndentHandler, IndentMap
15
20
 
16
21
 
17
22
  def error(*msg, **kwargs) -> NoReturn:
18
- r"""
23
+ """
19
24
  Print to stderr.
20
25
 
21
26
  Parameters
@@ -29,11 +34,14 @@ def error(*msg, **kwargs) -> NoReturn:
29
34
  --------
30
35
  print : This function is essentially being wrapped around here.
31
36
  """
32
- print(*msg, file=stderr, **kwargs)
37
+ end: str = kwargs.get("end", "\n")
38
+ sep: str = kwargs.get("sep", " ")
39
+ flush: bool = kwargs.get("flush", False)
40
+ print(*msg, file=stderr, end=end, sep=sep, flush=flush)
33
41
 
34
42
 
35
43
  def die(*msg, code: int = 0, func: Callable[[TextIO], None] | None = None, **kwargs) -> NoReturn:
36
- r"""
44
+ """
37
45
  Kill the program execution.
38
46
 
39
47
  Summons ``sys.exit()`` with a provided code and optionally prints code to stderr or stdout
@@ -107,13 +115,13 @@ def verbose_print(*msg, verbose: bool | None = None, **kwargs) -> NoReturn:
107
115
  --------
108
116
  print : This function is essentially being wrapped around here.
109
117
  """
118
+ if verbose is None or not verbose:
119
+ return
120
+
110
121
  end: str = kwargs.get("end", "\n")
111
122
  sep: str = kwargs.get("sep", " ")
112
123
  flush: bool = kwargs.get("flush", False)
113
124
 
114
- if verbose is None or not verbose:
115
- return
116
-
117
125
  print(*msg, end=end, sep=sep, flush=flush)
118
126
 
119
127
 
@@ -150,10 +158,10 @@ def gen_indent_maps(maps: List[IndentHandler]) -> Dict[str, IndentMap] | None:
150
158
  continue
151
159
 
152
160
  mapping_len = mapping_len if mapping_len <= 3 else 3
153
- map_d[ext] = {
154
- "level": level,
155
- "expandtab": True if mapping_len == 2 else mapping["expandtab"],
156
- }
161
+ map_d[ext] = IndentMap(
162
+ level=level,
163
+ expandtab=True if mapping_len == 2 else mapping["expandtab"]
164
+ )
157
165
 
158
166
  return map_d
159
167
 
@@ -7,162 +7,11 @@ 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 List, NoReturn, Tuple
10
+ from typing import NoReturn
11
11
 
12
+ from .types import VersionInfo
12
13
  from .util import die
13
14
 
14
-
15
- class VersionInfo():
16
- """
17
- A ``sys.version_info``-like object type.
18
-
19
- Parameters
20
- ----------
21
- all_versions : List[Tuple[int, int, int]]
22
- A list of three number tuples, containing (in order) the major, minor and patch
23
- components.
24
-
25
- Attributes
26
- ----------
27
- major : int
28
- The major component of the version.
29
- minor : int
30
- The minor component of the version.
31
- patch : int
32
- The patch component of the version.
33
- all_versions : List[Tuple[int, int, int]]
34
- A list of tuples containing all the versions in the object instance.
35
-
36
- Methods
37
- -------
38
- get_all_versions()
39
- """
40
-
41
- major: int
42
- minor: int
43
- patch: int
44
- all_versions: List[Tuple[int, int, int]]
45
-
46
- def __init__(self, all_versions: List[Tuple[int, int, int]]):
47
- """
48
- Initialize VersionInfo object.
49
-
50
- Parameters
51
- ----------
52
- all_versions : List[Tuple[int, int, int]]
53
- A list of tuples of three-integers, containing (in order) the major, minor and patch
54
- components.
55
- """
56
- self.all_versions = all_versions.copy()
57
-
58
- all_versions = all_versions.copy()[::-1]
59
- self.major = all_versions[0][0]
60
- self.minor = all_versions[0][1]
61
- self.patch = all_versions[0][2]
62
-
63
- def __str__(self) -> str:
64
- """
65
- Representate this object as a string.
66
-
67
- This is what is returned when using ``str(VersionInfo(...))``.
68
-
69
- Returns
70
- -------
71
- str
72
- The string representation of the instance.
73
-
74
- Examples
75
- --------
76
- Only one definition in constructor.
77
-
78
- >>> from vim_eof_comment.version import VersionInfo
79
- >>> print(str(VersionInfo([(0, 0, 1)])))
80
- 0.0.1
81
-
82
- Multiple definitions in constructor.
83
-
84
- >>> from vim_eof_comment.version import VersionInfo
85
- >>> print(str(VersionInfo([(0, 0, 1), (0, 0, 2)])))
86
- 0.0.2
87
- """
88
- return f"{self.major}.{self.minor}.{self.patch}"
89
-
90
- def __repr__(self) -> str:
91
- """
92
- Representate this object as a string.
93
-
94
- This is what is returned when using ``print(VersionInfo(...))``.
95
-
96
- Returns
97
- -------
98
- str
99
- The string representation of the instance.
100
-
101
- Examples
102
- --------
103
- Only one definition in constructor.
104
-
105
- >>> from vim_eof_comment.version import VersionInfo
106
- >>> print(repr(VersionInfo([(0, 0, 1)])))
107
- 0.0.1
108
-
109
- Multiple definitions in constructor.
110
-
111
- >>> from vim_eof_comment.version import VersionInfo
112
- >>> print(repr(VersionInfo([(0, 0, 1), (0, 0, 2)])))
113
- 0.0.2
114
- """
115
- return self.__str__()
116
-
117
- def __eq__(self, b) -> bool:
118
- """
119
- Check the equality between two ``VersionInfo`` instances.
120
-
121
- Parameters
122
- ----------
123
- b : VersionInfo
124
- The other instance to compare.
125
-
126
- Returns
127
- -------
128
- bool
129
- Whether they are equal or not.
130
- """
131
- if not isinstance(b, VersionInfo):
132
- return False
133
-
134
- b: VersionInfo = b
135
- return self.major == b.major and self.minor == b.minor and self.patch == b.patch
136
-
137
- def get_all_versions(self) -> str:
138
- r"""
139
- Retrieve all versions as a string.
140
-
141
- Returns
142
- -------
143
- str
144
- A string, containing the program versions, in ascending order.
145
-
146
- Examples
147
- --------
148
- To generate a single string.
149
- >>> from vim_eof_comment.version import VersionInfo
150
- >>> print(VersionInfo([(0, 0, 1), (0, 0, 2), (0, 1, 0)]).get_all_versions())
151
- 0.0.1
152
- 0.0.2
153
- 0.0.3 (latest)
154
- """
155
- result = ""
156
- for i, info in enumerate(self.all_versions):
157
- result += f"{info[0]}.{info[1]}.{info[2]}"
158
- if i == len(self.all_versions) - 1:
159
- result += " (latest)"
160
- else:
161
- result += "\n"
162
-
163
- return result
164
-
165
-
166
15
  version_info = VersionInfo([
167
16
  (0, 1, 1),
168
17
  (0, 1, 2),
@@ -230,6 +79,8 @@ version_info = VersionInfo([
230
79
  (0, 3, 21),
231
80
  (0, 4, 0),
232
81
  (0, 4, 1),
82
+ (0, 4, 2),
83
+ (0, 5, 0),
233
84
  ])
234
85
 
235
86
  __version__: str = str(version_info)
@@ -2,129 +2,9 @@ from typing import NoReturn
2
2
 
3
3
  from _typeshed import Incomplete
4
4
 
5
- __all__ = ['VersionInfo', 'list_versions', 'version_info', 'version_print', '__version__']
6
-
7
- class VersionInfo:
8
- """
9
- A ``sys.version_info``-like object type.
10
-
11
- Parameters
12
- ----------
13
- all_versions : List[Tuple[int, int, int]]
14
- A list of three number tuples, containing (in order) the major, minor and patch
15
- components.
16
-
17
- Attributes
18
- ----------
19
- major : int
20
- The major component of the version.
21
- minor : int
22
- The minor component of the version.
23
- patch : int
24
- The patch component of the version.
25
- all_versions : List[Tuple[int, int, int]]
26
- A list of tuples containing all the versions in the object instance.
27
-
28
- Methods
29
- -------
30
- get_all_versions()
31
- """
32
- major: int
33
- minor: int
34
- patch: int
35
- all_versions: list[tuple[int, int, int]]
36
- def __init__(self, all_versions: list[tuple[int, int, int]]) -> None:
37
- """
38
- Initialize VersionInfo object.
39
-
40
- Parameters
41
- ----------
42
- all_versions : List[Tuple[int, int, int]]
43
- A list of tuples of three-integers, containing (in order) the major, minor and patch
44
- components.
45
- """
46
- def __str__(self) -> str:
47
- """
48
- Representate this object as a string.
49
-
50
- This is what is returned when using ``str(VersionInfo(...))``.
51
-
52
- Returns
53
- -------
54
- str
55
- The string representation of the instance.
56
-
57
- Examples
58
- --------
59
- Only one definition in constructor.
5
+ from .types import VersionInfo as VersionInfo
60
6
 
61
- >>> from vim_eof_comment.version import VersionInfo
62
- >>> print(str(VersionInfo([(0, 0, 1)])))
63
- 0.0.1
64
-
65
- Multiple definitions in constructor.
66
-
67
- >>> from vim_eof_comment.version import VersionInfo
68
- >>> print(str(VersionInfo([(0, 0, 1), (0, 0, 2)])))
69
- 0.0.2
70
- """
71
- def __repr__(self) -> str:
72
- """
73
- Representate this object as a string.
74
-
75
- This is what is returned when using ``print(VersionInfo(...))``.
76
-
77
- Returns
78
- -------
79
- str
80
- The string representation of the instance.
81
-
82
- Examples
83
- --------
84
- Only one definition in constructor.
85
-
86
- >>> from vim_eof_comment.version import VersionInfo
87
- >>> print(repr(VersionInfo([(0, 0, 1)])))
88
- 0.0.1
89
-
90
- Multiple definitions in constructor.
91
-
92
- >>> from vim_eof_comment.version import VersionInfo
93
- >>> print(repr(VersionInfo([(0, 0, 1), (0, 0, 2)])))
94
- 0.0.2
95
- """
96
- def __eq__(self, b) -> bool:
97
- """
98
- Check the equality between two ``VersionInfo`` instances.
99
-
100
- Parameters
101
- ----------
102
- b : VersionInfo
103
- The other instance to compare.
104
-
105
- Returns
106
- -------
107
- bool
108
- Whether they are equal or not.
109
- """
110
- def get_all_versions(self) -> str:
111
- """
112
- Retrieve all versions as a string.
113
-
114
- Returns
115
- -------
116
- str
117
- A string, containing the program versions, in ascending order.
118
-
119
- Examples
120
- --------
121
- To generate a single string.
122
- >>> from vim_eof_comment.version import VersionInfo
123
- >>> print(VersionInfo([(0, 0, 1), (0, 0, 2), (0, 1, 0)]).get_all_versions())
124
- 0.0.1
125
- 0.0.2
126
- 0.0.3 (latest)
127
- """
7
+ __all__ = ['VersionInfo', 'list_versions', 'version_info', 'version_print', '__version__']
128
8
 
129
9
  version_info: Incomplete
130
10
  __version__: str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vim-eof-comment
3
- Version: 0.4.1
3
+ Version: 0.5.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>
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
23
24
  Classifier: Programming Language :: Python
24
25
  Classifier: Topic :: Text Processing :: Filters
25
26
  Classifier: Topic :: Utilities
@@ -30,8 +31,6 @@ License-File: LICENSE
30
31
  Requires-Dist: argcomplete
31
32
  Requires-Dist: argparse
32
33
  Requires-Dist: colorama
33
- Requires-Dist: setuptools
34
- Requires-Dist: wheel
35
34
  Dynamic: license-file
36
35
 
37
36
  # vim-eof-comment
@@ -7,33 +7,33 @@ docs/source/installation.rst,sha256=PkiS3E_ujNTWeKXicZ7aBPch2l1R0TsRRL6pFj_oMJI,
7
7
  vim_eof_comment/__init__.py,sha256=ESbmhca9mTst3TYMer8zFw73IRsJvn5EESci_RpfLbQ,487
8
8
  vim_eof_comment/__init__.pyi,sha256=Eh8FQwE_F9TrQEiT7CR1mdGHBT6fHUzfV6VP8uSN33g,478
9
9
  vim_eof_comment/__main__.py,sha256=0AFVSkz8RuxSuPbJJWycyxs6u5Yypl8FKUMR3ZVLJbk,343
10
- vim_eof_comment/eof.py,sha256=vKVVg_-HRa9ccqTrnyMfzczQk7aQpzxpuaDNb5DfFQk,5159
10
+ vim_eof_comment/eof.py,sha256=3iCP_fL3aUrPndKve3DoSpikZSvyIR0kwaE46EAlJqA,5158
11
11
  vim_eof_comment/eof.pyi,sha256=BTw9brhrHBTX12fYuwfO8_D-Gyrf0387ErmgrcTdvh0,1786
12
- vim_eof_comment/file.py,sha256=r6vRI7CrZVqNrqkQE4TesbuDTIXT2x7W9i9FRP44BS8,5067
12
+ vim_eof_comment/file.py,sha256=HNtwUMteUeKldBcVJEjdxlHLWNDXPbgjswJ-9PKRlQA,5100
13
13
  vim_eof_comment/file.pyi,sha256=S02kb4Ta5kDXpC3fYAVboC89jSUzHv6AHoll5HMICUg,2265
14
14
  vim_eof_comment/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  vim_eof_comment/regex.py,sha256=rGfFIBMbfWlIxAScXqvgBlB-tMJBUxQwTVjEkoxDZ3o,1007
16
16
  vim_eof_comment/regex.pyi,sha256=LJt6HN9s0Vo1B5plpaYURVZ3okmtl5jnV6kKdn1KyqA,433
17
- vim_eof_comment/types.py,sha256=ofo6X9sbNG1ONsofMFganJPlYYsCZmriMWuZHj7dukg,3832
18
- vim_eof_comment/types.pyi,sha256=dJcnOLxqVShYHSyafbNZEQJ4D3MC42A-oDtlJArApRE,3562
19
- vim_eof_comment/util.py,sha256=0-SUdHqpgMdwHauZawaY3KL5FkIfe1u2zA1AHb80ez8,4125
17
+ vim_eof_comment/types.py,sha256=YumpVIUl1wxbn_QIEkWeUbxsa9b9RJYdVEBzx-Kt4xo,8195
18
+ vim_eof_comment/types.pyi,sha256=r6QziOKE9nKaZ02TR1NZDWCtEcLtMCnsOqnDNXvXJfw,7083
19
+ vim_eof_comment/util.py,sha256=MHLt-FJz4uhsa56J2sug74uqk6W3S0mVLugvz7KNRUU,4287
20
20
  vim_eof_comment/util.pyi,sha256=5RQukLgpVZTwbALhBOtd1NqFkiqC-V6JEWeT1_B9-2k,2675
21
- vim_eof_comment/version.py,sha256=alJ1lTKfAe1VxRi5BEt3bid6qhgJ1pPcXSz5ppYIwQU,5828
22
- vim_eof_comment/version.pyi,sha256=suF5VwVtpA0rVOuKpa6cvJ8TNocXgtJiI51DRrpzOTs,3692
21
+ vim_eof_comment/version.py,sha256=TQzYqwQZB_r20lmzgs1-xwdDTAIin2dVYGP88Io2jUc,1883
22
+ vim_eof_comment/version.pyi,sha256=P90IRWMKlsG_YU8G8a1e1eyTd8rC-6fUGvQrD3zjwbE,525
23
23
  vim_eof_comment/args/__init__.py,sha256=Hyqun15456NVFLAJ3cpdtuNEz5XaFH93vfVlbC-aeuc,318
24
24
  vim_eof_comment/args/__init__.pyi,sha256=cXK7nEpYBveD4kxtVTe2x8oUxT9mhENS5r3wK3AAX2U,151
25
- vim_eof_comment/args/completion.py,sha256=ddK6xcpR6SpcGXH7m6m6h9DhB5QMoai324WVvtwwplw,1248
26
- vim_eof_comment/args/completion.pyi,sha256=svMFBL6vfiqctncHkOMwxzuufzV3y5VfGic3o71UU4o,455
27
- vim_eof_comment/args/parsing.py,sha256=AOHLN-K0vzbXBwsOjUv4ZcXMDbF_BDEONonZJFwwazo,6617
28
- vim_eof_comment/args/parsing.pyi,sha256=czQNpDTfgUCv1P_bxHykUD9WDn5A8tnz396TT7oEdkY,1745
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
29
  vim_eof_comment/comments/__init__.py,sha256=KIFAbugEKa8arCASaf7pKNHdzUC99N_T18D1CfaCOQs,292
30
30
  vim_eof_comment/comments/__init__.pyi,sha256=cecbbrShh0If8btwJ8zKYpBt9dIsMwrDXbdaBQqwUus,104
31
31
  vim_eof_comment/comments/filetypes.json,sha256=JpSrnBNO2AivLYi-C5--8yVocyBwye3IkMesNIz1uHA,2973
32
- vim_eof_comment/comments/generator.py,sha256=Mi3Yi0j-8aXQnVUsXqI1VE1yW71tWemooWgO9smSilI,7731
33
- vim_eof_comment/comments/generator.pyi,sha256=Nj33jwria5FWUuydUD_uZSH__PxSZ3yPxOPYF1_TIpM,3272
34
- vim_eof_comment-0.4.1.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
35
- vim_eof_comment-0.4.1.dist-info/METADATA,sha256=sYnxoPd1Ypiar4SglzMRtQJaiFibzMOelZ7Cto6185c,2762
36
- vim_eof_comment-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- vim_eof_comment-0.4.1.dist-info/entry_points.txt,sha256=vm47g4hoUbow4elcHr9yylYfj6IvAs10wSFKqwqTu6E,61
38
- vim_eof_comment-0.4.1.dist-info/top_level.txt,sha256=TkaQ5vuhVzXaJnfUdcLJCQ81ILK2V6OtvX5-hIMZAc0,21
39
- vim_eof_comment-0.4.1.dist-info/RECORD,,
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.0.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
35
+ vim_eof_comment-0.5.0.dist-info/METADATA,sha256=eri3jmB75CaTiK42raTS2kZSMUSWWyModjqc1v_Wp0o,2766
36
+ vim_eof_comment-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ vim_eof_comment-0.5.0.dist-info/entry_points.txt,sha256=vm47g4hoUbow4elcHr9yylYfj6IvAs10wSFKqwqTu6E,61
38
+ vim_eof_comment-0.5.0.dist-info/top_level.txt,sha256=TkaQ5vuhVzXaJnfUdcLJCQ81ILK2V6OtvX5-hIMZAc0,21
39
+ vim_eof_comment-0.5.0.dist-info/RECORD,,