File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
packages/robot/src/robotcode/robot Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 12
12
)
13
13
14
14
from robot .parsing .lexer .tokens import Token
15
+ from robot .variables .search import search_variable
15
16
from robotcode .core .lsp .types import Position , Range
17
+ from robotcode .robot .utils .match import normalize
16
18
17
19
from ..utils .ast import range_from_token
18
20
@@ -131,9 +133,6 @@ class InvalidVariableError(Exception):
131
133
132
134
class VariableMatcher :
133
135
def __init__ (self , name : str ) -> None :
134
- from robot .variables .search import search_variable
135
- from robotcode .robot .utils .match import normalize
136
-
137
136
self .name = name
138
137
139
138
match = search_variable (name , "$@&%" , ignore_errors = True )
@@ -146,9 +145,6 @@ def __init__(self, name: str) -> None:
146
145
self .normalized_name = str (normalize (self .base ))
147
146
148
147
def __eq__ (self , o : object ) -> bool :
149
- from robot .utils .normalizing import normalize
150
- from robot .variables .search import search_variable
151
-
152
148
if isinstance (o , VariableMatcher ):
153
149
return o .normalized_name == self .normalized_name
154
150
Original file line number Diff line number Diff line change 86
86
from robotcode .robot .utils .stubs import HasError , HasErrors
87
87
88
88
if get_robot_version () < (7 , 0 ):
89
- from robot .running .handlers import _PythonHandler , _PythonInitHandler
90
- from robot .running .model import ResourceFile
91
- from robot .running .usererrorhandler import UserErrorHandler
92
- from robot .running .userkeyword import UserLibrary
89
+ from robot .running .handlers import _PythonHandler , _PythonInitHandler # pyright: ignore[reportMissingImports]
90
+ from robot .running .model import ResourceFile # pyright: ignore[reportMissingImports]
91
+ from robot .running .usererrorhandler import UserErrorHandler # pyright: ignore[reportMissingImports]
92
+ from robot .running .userkeyword import UserLibrary # pyright: ignore[reportMissingImports]
93
93
94
94
robot_notset = ArgInfo .NOTSET
95
95
Original file line number Diff line number Diff line change 1
1
from functools import lru_cache
2
2
3
+ _transform_table = str .maketrans ("" , "" , "_ " )
4
+
3
5
4
6
@lru_cache (maxsize = 5000 )
5
7
def normalize (text : str ) -> str :
6
- return text .lower ().replace ("_" , "" ).replace (" " , "" )
8
+ # return text.lower().replace("_", "").replace(" ", "")
9
+ return text .casefold ().translate (_transform_table )
7
10
8
11
9
12
@lru_cache (maxsize = 5000 )
You can’t perform that action at this time.
0 commit comments