Skip to content

Commit

Permalink
use Match and Pattern from typing module
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
  • Loading branch information
InvincibleRMC committed Nov 1, 2024
1 parent bfa2194 commit 3582a1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rosidl_parser/rosidl_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from typing import Dict
from typing import List
from typing import Literal
from typing import Match
from typing import Optional
from typing import Pattern
from typing import TYPE_CHECKING
from typing import Union

Expand Down Expand Up @@ -733,7 +735,7 @@ def get_string_literal_value(string_literal: 'Branch[Token]', *,
return str_value


def _get_escape_sequences_regex(*, allow_unicode: bool) -> re.Pattern[str]:
def _get_escape_sequences_regex(*, allow_unicode: bool) -> Pattern[str]:
# IDL Table 7-9: Escape sequences
pattern = '('
# newline, horizontal tab, vertical tab, backspace, carriage return,
Expand All @@ -751,5 +753,5 @@ def _get_escape_sequences_regex(*, allow_unicode: bool) -> re.Pattern[str]:
return re.compile(pattern)


def _decode_escape_sequence(match: re.Match[str]) -> str:
def _decode_escape_sequence(match: Match[str]) -> str:
return codecs.decode(match.group(0), 'unicode-escape')

0 comments on commit 3582a1e

Please sign in to comment.