Replace use of cast()

This commit is contained in:
Kovid Goyal 2020-03-24 22:03:10 +05:30
parent 4e58062025
commit a46c3f7007
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -6,7 +6,7 @@ import re
from functools import partial from functools import partial
from typing import ( from typing import (
Any, Callable, Dict, Generator, Iterable, List, Match, Optional, Sequence, Any, Callable, Dict, Generator, Iterable, List, Match, Optional, Sequence,
Set, Tuple, Union, cast, get_type_hints Set, Tuple, Union, get_type_hints
) )
from .utils import to_bool from .utils import to_bool
@ -156,7 +156,7 @@ def remove_markup(text: str) -> str:
'layouts': 'https://sw.kovidgoyal.net/kitty/index.html#layouts', 'layouts': 'https://sw.kovidgoyal.net/kitty/index.html#layouts',
'sessions': 'https://sw.kovidgoyal.net/kitty/index.html#sessions', 'sessions': 'https://sw.kovidgoyal.net/kitty/index.html#sessions',
}[m.group(2)] }[m.group(2)]
return cast(str, m.group(2)) return str(m.group(2))
return re.sub(r':([a-zA-Z0-9]+):`(.+?)`', sub, text, flags=re.DOTALL) return re.sub(r':([a-zA-Z0-9]+):`(.+?)`', sub, text, flags=re.DOTALL)