66import shutil
77import sys
88from argparse import ArgumentParser
9- from typing import TYPE_CHECKING , cast
9+ from typing import TYPE_CHECKING , ClassVar , cast
1010
1111from docutils import nodes
1212from docutils .frontend import get_default_settings
@@ -179,7 +179,7 @@ def print_action_groups(
179179 arg = []
180180 if 'choices' in entry :
181181 arg .append (
182- f" Possible choices: { ', ' .join (str (c ) for c in entry [' choices' ])} \n "
182+ f' Possible choices: { ", " .join (str (c ) for c in entry [" choices" ])} \n '
183183 )
184184 if 'help' in entry :
185185 arg .append (entry ['help' ])
@@ -524,7 +524,7 @@ def _print_subcommands(self, data, nested_content, markdown_help=False, settings
524524 definitions = map_nested_definitions (nested_content )
525525 items = []
526526 full_subcommand_name_true = self .config .sphinxarg_full_subcommand_name
527- domain = cast (ArgParseDomain , self .env .domains [ArgParseDomain .name ])
527+ domain = cast (' ArgParseDomain' , self .env .domains [ArgParseDomain .name ])
528528
529529 if 'children' in data :
530530 full_command = command_pos_args (data )
@@ -667,7 +667,7 @@ def _print_action_groups(
667667 arg = []
668668 if 'choices' in entry :
669669 arg .append (
670- f" Possible choices: { ', ' .join (map (str , entry [' choices' ]))} \n "
670+ f' Possible choices: { ", " .join (map (str , entry [" choices" ]))} \n '
671671 )
672672 if 'help' in entry :
673673 arg .append (entry ['help' ])
@@ -814,7 +814,7 @@ def run(self):
814814 self .set_source_info (target )
815815 self .state .document .note_explicit_target (target )
816816
817- domain = cast (ArgParseDomain , self .env .get_domain (ArgParseDomain .name ))
817+ domain = cast (' ArgParseDomain' , self .env .get_domain (ArgParseDomain .name ))
818818 domain .add_argparse_command (result , node_id , self .index_groups )
819819
820820 items .append (nodes .literal_block (text = result ['usage' ]))
@@ -888,8 +888,8 @@ class ArgParseDomain(Domain):
888888 'command' : XRefRole (),
889889 }
890890 indices = []
891- initial_data : dict [
892- str , list [_ObjectDescriptionTuple ] | dict [str , list [_ObjectDescriptionTuple ]]
891+ initial_data : ClassVar [
892+ dict [ str , list [_ObjectDescriptionTuple ] | dict [str , list [_ObjectDescriptionTuple ] ]]
893893 ] = {
894894 'commands' : [],
895895 'commands-by-group' : {},
@@ -948,7 +948,7 @@ def add_argparse_command(self, result: dict, anchor: str, groups: Sequence[str]
948948
949949def _delete_temporary_files (app : Sphinx , _err ) -> None :
950950 assert app .env is not None
951- domain = cast (ArgParseDomain , app .env .domains [ArgParseDomain .name ])
951+ domain = cast (' ArgParseDomain' , app .env .domains [ArgParseDomain .name ])
952952 for fpath in domain .temporary_index_files :
953953 fpath .unlink (missing_ok = True )
954954
@@ -973,12 +973,12 @@ def _create_temporary_dummy_file(
973973 f'Creating this temporary file enables you to add { docname } to the toctree.' ,
974974 ))
975975 dummy_file .write_text (content , encoding = 'utf-8' )
976- domain = cast (ArgParseDomain , domain )
976+ domain = cast (' ArgParseDomain' , domain )
977977 domain .temporary_index_files .append (dummy_file )
978978
979979
980980def configure_ext (app : Sphinx ) -> None :
981- domain = cast (ArgParseDomain , app .env .domains [ArgParseDomain .name ])
981+ domain = cast (' ArgParseDomain' , app .env .domains [ArgParseDomain .name ])
982982 build_index = False
983983 build_by_group_index = False
984984
0 commit comments