Skip to content

Commit

Permalink
Fix more pytype errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoluan committed Jan 13, 2023
1 parent fab75bc commit 91ec12e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aiosmtpd/docs/_exts/autoprogramm.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from docutils.statemachine import StringList
from functools import reduce
from sphinx.util.nodes import nested_parse_with_titles
from typing import Any, Dict, List, Optional, Tuple
from typing import Any, Dict, List, Optional, Tuple, cast


__all__ = ("AutoprogrammDirective", "import_object", "scan_programs", "setup")
Expand Down Expand Up @@ -112,7 +112,11 @@ def scan_options(actions: list):

def format_positional_argument(arg: argparse.Action) -> Tuple[List[str], str]:
desc: str = (arg.help or "") % {"default": arg.default}
name: str = arg.metavar or arg.dest or ""
name: str
if isinstance(arg.metavar, tuple):
name = arg.metavar[0]
else:
name = arg.metavar or arg.dest or ""
return [name], desc


Expand Down

0 comments on commit 91ec12e

Please sign in to comment.