diff --git a/lib/tokenize_rt.py b/lib/tokenize_rt.py index f0922c16..ae91cc40 100644 --- a/lib/tokenize_rt.py +++ b/lib/tokenize_rt.py @@ -18,7 +18,7 @@ if ( # pragma: no branch callable(getattr(tokenize, '_compile', None)) ): # pragma: <3.10 cover from functools import lru_cache - tokenize._compile = lru_cache()(tokenize._compile) + tokenize._compile = lru_cache(tokenize._compile) ESCAPED_NL = 'ESCAPED_NL' UNIMPORTANT_WS = 'UNIMPORTANT_WS' @@ -40,6 +40,9 @@ class Token(NamedTuple): def offset(self) -> Offset: return Offset(self.line, self.utf8_byte_offset) + def matches(self, *, name: str, src: str) -> bool: + return self.name == name and self.src == src + _string_re = re.compile('^([^\'"]*)(.*)$', re.DOTALL) _escaped_nl_re = re.compile(r'\\(\n|\r\n|\r)') diff --git a/requirements.txt b/requirements.txt index 5abbaaa8..8fd57e4d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -42,7 +42,7 @@ rumps==0.4.0; platform_system == "Darwin" simplejson==3.19.1 six==1.16.0 tempora==5.5.0 -tokenize-rt==5.0.0 +tokenize-rt==5.2.0 tzdata==2023.3 tzlocal==4.2 urllib3<2