3030 supports_optionals_as_positionals ,
3131)
3232from ._completions import ShtabAction
33- from ._deprecated import deprecated
33+ from ._deprecated import HelpFormatterDeprecations
3434from ._link_arguments import ActionLink
3535from ._namespace import Namespace , NSKeyError
3636from ._optionals import import_ruyaml
@@ -119,7 +119,7 @@ def set_comments(cfg, prefix="", depth=0):
119119 def set_yaml_start_comment (
120120 self ,
121121 text : str ,
122- cfg : " ruyamlCommentedMap" ,
122+ cfg : ruyamlCommentedMap ,
123123 ):
124124 """Sets the start comment to a ruyaml object.
125125
@@ -132,7 +132,7 @@ def set_yaml_start_comment(
132132 def set_yaml_group_comment (
133133 self ,
134134 text : str ,
135- cfg : " ruyamlCommentedMap" ,
135+ cfg : ruyamlCommentedMap ,
136136 key : str ,
137137 depth : int ,
138138 ):
@@ -149,7 +149,7 @@ def set_yaml_group_comment(
149149 def set_yaml_argument_comment (
150150 self ,
151151 text : str ,
152- cfg : " ruyamlCommentedMap" ,
152+ cfg : ruyamlCommentedMap ,
153153 key : str ,
154154 depth : int ,
155155 ):
@@ -164,7 +164,7 @@ def set_yaml_argument_comment(
164164 cfg .yaml_set_comment_before_after_key (key , before = "\n " + text , indent = 2 * depth )
165165
166166
167- class DefaultHelpFormatter (HelpFormatter ):
167+ class DefaultHelpFormatter (HelpFormatterDeprecations , HelpFormatter ):
168168 """Help message formatter that includes types, default values and env var names.
169169
170170 This class is an extension of `argparse.HelpFormatter
@@ -174,69 +174,6 @@ class DefaultHelpFormatter(HelpFormatter):
174174 the respective environment variable name is included preceded by 'ENV:'.
175175 """
176176
177- def __init__ (self , * args , ** kwargs ):
178- super ().__init__ (* args , ** kwargs )
179- self ._yaml_formatter = YAMLCommentFormatter (self )
180-
181- @deprecated (
182- """
183- The add_yaml_comments method is deprecated and will be removed in a future version.
184- Use :class:`YAMLCommentFormatter` instead.
185- """
186- )
187- def add_yaml_comments (self , cfg : str ) -> str :
188- """Adds help text as yaml comments."""
189- return self ._yaml_formatter .add_yaml_comments (cfg )
190-
191- @deprecated (
192- """
193- The set_yaml_start_comment method is deprecated and will be removed in a future version.
194- Use :class:`YAMLCommentFormatter` instead.
195- """
196- )
197- def set_yaml_start_comment (self , text : str , cfg : "ruyamlCommentedMap" ):
198- """Sets the start comment to a ruyaml object.
199-
200- Args:
201- text: The content to use for the comment.
202- cfg: The ruyaml object.
203- """
204- self ._yaml_formatter .set_yaml_start_comment (text , cfg )
205-
206- @deprecated (
207- """
208- The set_yaml_group_comment method is deprecated and will be removed in a future version.
209- Use :class:`YAMLCommentFormatter` instead.
210- """
211- )
212- def set_yaml_group_comment (self , text : str , cfg : "ruyamlCommentedMap" , key : str , depth : int ):
213- """Sets the comment for a group to a ruyaml object.
214-
215- Args:
216- text: The content to use for the comment.
217- cfg: The parent ruyaml object.
218- key: The key of the group.
219- depth: The nested level of the group.
220- """
221- self ._yaml_formatter .set_yaml_group_comment (text , cfg , key , depth )
222-
223- @deprecated (
224- """
225- The set_yaml_argument_comment method is deprecated and will be removed in a future version.
226- Use :class:`YAMLCommentFormatter` instead.
227- """
228- )
229- def set_yaml_argument_comment (self , text : str , cfg : "ruyamlCommentedMap" , key : str , depth : int ):
230- """Sets the comment for an argument to a ruyaml object.
231-
232- Args:
233- text: The content to use for the comment.
234- cfg: The parent ruyaml object.
235- key: The key of the argument.
236- depth: The nested level of the argument.
237- """
238- self ._yaml_formatter .set_yaml_argument_comment (text , cfg , key , depth )
239-
240177 def _get_help_string (self , action : Action ) -> str :
241178 action_help = " " if action .help == empty_help else action .help
242179 assert isinstance (action_help , str )
0 commit comments