File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
jsonpath/function_extensions Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,15 @@ def __init__(
4646 debug : bool = False ,
4747 thread_safe : bool = False ,
4848 ):
49- self .cache : LRUCache [str , Optional [re .Pattern [ str ]]] = (
49+ self .cache : LRUCache [str , Optional [re .Pattern ]] = ( # type: ignore
5050 ThreadSafeLRUCache (capacity = cache_capacity )
5151 if thread_safe
5252 else LRUCache (capacity = cache_capacity )
5353 )
5454
5555 self .debug = debug
5656
57- def check_cache (self , pattern : str ) -> Optional [re .Pattern [ str ]]:
57+ def check_cache (self , pattern : str ) -> Optional [re .Pattern ]: # type: ignore
5858 """Return a compiled re pattern if `pattern` is valid, or `None` otherwise."""
5959 try :
6060 _pattern = self .cache [pattern ]
Original file line number Diff line number Diff line change 1+ try :
2+ import regex as re
3+
4+ REGEX_AVAILABLE = True
5+ except ImportError :
6+ import re # type: ignore
7+
8+ REGEX_AVAILABLE = False
9+
110try :
211 import iregexp_check # noqa: F401
312
@@ -39,7 +48,7 @@ def test_debug_regex_patterns() -> None:
3948 search_func = Search (cache_capacity = 2 , debug = True )
4049 assert len (search_func .cache ) == 0
4150
42- with pytest .raises (JSONPathError ):
51+ with pytest .raises (( JSONPathError , re . error ) ):
4352 search_func ("abcdef" , "bc[" )
4453
4554
You can’t perform that action at this time.
0 commit comments