robotframework-debug 4.4.0__tar.gz → 4.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/PKG-INFO +1 -1
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/RobotDebug.py +1 -1
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/cmdcompleter.py +36 -23
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/debugcmd.py +7 -5
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/globals.py +2 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/history_app.py +7 -3
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/lexer.py +1 -2
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/prompttoolkitcmd.py +1 -1
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/robotkeyword.py +1 -3
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/robotlib.py +3 -1
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/sourcelines.py +6 -2
- robotframework-debug-4.5.0/RobotDebug/version.py +1 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/pyproject.toml +3 -3
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/PKG-INFO +1 -1
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/SOURCES.txt +1 -0
- robotframework-debug-4.5.0/tests/debug.robot +4 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/tests/step.robot +1 -0
- robotframework-debug-4.4.0/RobotDebug/version.py +0 -1
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/.coveragerc +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/.gitpod.yml +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/ChangeLog +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/CreateWheel.sh +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/LICENSE +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/MANIFEST.in +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/README.rst +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/__init__.py +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/shell.py +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/RobotDebug/styles.py +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/_config.yml +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/dependency_links.txt +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/entry_points.txt +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/not-zip-safe +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/requires.txt +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/top_level.txt +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/setup.cfg +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/setup.py +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/tests/__init__.py +0 -0
- {robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/tests/test_debuglibrary.py +0 -0
|
@@ -44,7 +44,7 @@ class Listener:
|
|
|
44
44
|
|
|
45
45
|
path = attrs["source"]
|
|
46
46
|
if path and Path(path).exists() and path not in self.source_files:
|
|
47
|
-
self.source_files[path] = Path(path).open().readlines()
|
|
47
|
+
self.source_files[path] = Path(path).open().readlines() # noqa: SIM115
|
|
48
48
|
lineno = attrs["lineno"]
|
|
49
49
|
self.library.current_source_path = path
|
|
50
50
|
self.library.current_source_line = lineno
|
|
@@ -8,7 +8,7 @@ from prompt_toolkit.document import Document
|
|
|
8
8
|
from robot.libraries.BuiltIn import BuiltIn
|
|
9
9
|
from robot.parsing.parser.parser import _tokens_to_statements
|
|
10
10
|
|
|
11
|
-
from .globals import IS_RF_7
|
|
11
|
+
from .globals import IS_RF_7, KEYWORD_SEP
|
|
12
12
|
from .lexer import get_robot_token, get_variable_token
|
|
13
13
|
from .prompttoolkitcmd import PromptToolkitCmd
|
|
14
14
|
from .robotkeyword import normalize_kw
|
|
@@ -69,9 +69,16 @@ class StatementInformation:
|
|
|
69
69
|
|
|
70
70
|
def _find_token_at_cursor(self):
|
|
71
71
|
for token in self.statement.tokens:
|
|
72
|
-
if
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
if token.type in [
|
|
73
|
+
"KEYWORD",
|
|
74
|
+
"IF",
|
|
75
|
+
"FOR",
|
|
76
|
+
"ELSE",
|
|
77
|
+
"ELSE IF",
|
|
78
|
+
"TRY",
|
|
79
|
+
"WHILE",
|
|
80
|
+
"VAR",
|
|
81
|
+
]: # TODO: Commented to get all tokens in debug. lets see the impact
|
|
75
82
|
self.statement_type = token.type
|
|
76
83
|
if (
|
|
77
84
|
token.lineno == self.cursor_row + 1
|
|
@@ -93,6 +100,12 @@ class CmdCompleter(Completer):
|
|
|
93
100
|
self.helps = helps
|
|
94
101
|
self.libs = libs
|
|
95
102
|
self.keywords = list(keywords)
|
|
103
|
+
self.keywords_catalog = {}
|
|
104
|
+
for keyword in self.keywords:
|
|
105
|
+
self.keywords_catalog[normalize_kw(keyword.name)] = keyword
|
|
106
|
+
self.keywords_catalog[
|
|
107
|
+
f"{normalize_kw(keyword.parent.name)}.{normalize_kw(keyword.name)}"
|
|
108
|
+
] = keyword
|
|
96
109
|
self.current_statement = None
|
|
97
110
|
for name, display, display_meta in self.get_commands():
|
|
98
111
|
self.names.append(name)
|
|
@@ -163,28 +176,28 @@ class CmdCompleter(Completer):
|
|
|
163
176
|
)
|
|
164
177
|
|
|
165
178
|
def _get_argument_completer(self, text):
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
else:
|
|
178
|
-
yield from self.get_pos_arg_completion(args, set_pos_args)
|
|
179
|
+
keyword = self.keywords_catalog.get(
|
|
180
|
+
normalize_kw(self.current_statement.statement.keyword), None
|
|
181
|
+
)
|
|
182
|
+
if keyword:
|
|
183
|
+
data_tokens = self.current_statement.statement.data_tokens
|
|
184
|
+
args = keyword.args
|
|
185
|
+
set_named_args, set_pos_args = self.get_set_args(args, data_tokens)
|
|
186
|
+
if set_named_args:
|
|
187
|
+
yield from self.get_named_arg_completion(args, set_named_args, set_pos_args)
|
|
188
|
+
else:
|
|
189
|
+
yield from self.get_pos_arg_completion(args, set_pos_args)
|
|
179
190
|
|
|
180
|
-
def get_pos_arg_completion(
|
|
191
|
+
def get_pos_arg_completion(
|
|
192
|
+
self, args, set_pos_args
|
|
193
|
+
): # TODO: here is an issue. if more positional args are set, than existing, named_only will be removed from proposal
|
|
181
194
|
for index, arg in enumerate([*args.positional_or_named, *args.named_only]):
|
|
182
195
|
if index + 1 > len(set_pos_args):
|
|
183
|
-
suffix = "=" if arg in [*args.positional_or_named, *args.named_only] else ""
|
|
196
|
+
# suffix = "=" if arg in [*args.positional_or_named, *args.named_only] else ""
|
|
184
197
|
yield Completion(
|
|
185
|
-
f"{arg}",
|
|
198
|
+
f"{arg}=",
|
|
186
199
|
0,
|
|
187
|
-
display=f"{arg}
|
|
200
|
+
display=f"{arg}=",
|
|
188
201
|
display_meta=str(args.defaults.get(arg, "")),
|
|
189
202
|
)
|
|
190
203
|
|
|
@@ -338,7 +351,7 @@ class CmdCompleter(Completer):
|
|
|
338
351
|
):
|
|
339
352
|
yield from [
|
|
340
353
|
Completion(
|
|
341
|
-
|
|
354
|
+
var,
|
|
342
355
|
-cursor_pos,
|
|
343
356
|
display=var,
|
|
344
357
|
display_meta=repr(val),
|
|
@@ -365,7 +378,7 @@ class KeywordAutoSuggestion(AutoSuggest):
|
|
|
365
378
|
def get_suggestion(self, buffer: Buffer, document: Document) -> Union[Suggestion, None]:
|
|
366
379
|
text = document.text
|
|
367
380
|
completions = [compl.text for compl in self.completer.get_completions(document, None)]
|
|
368
|
-
last_word =
|
|
381
|
+
last_word = KEYWORD_SEP.split(text)[-1]
|
|
369
382
|
matches = [kw for kw in completions if kw.startswith(last_word)]
|
|
370
383
|
matches.extend([kw for kw in completions if kw.lower().startswith(last_word.lower())])
|
|
371
384
|
return Suggestion(matches[0][len(last_word) :] if matches else "")
|
|
@@ -8,6 +8,8 @@ from prompt_toolkit.styles import merge_styles
|
|
|
8
8
|
from robot.api import logger
|
|
9
9
|
from robot.errors import ExecutionFailed, HandlerExecutionFailed
|
|
10
10
|
from robot.libraries.BuiltIn import BuiltIn
|
|
11
|
+
from robot.running import Keyword
|
|
12
|
+
from robot.running.context import _ExecutionContext
|
|
11
13
|
from robot.running.signalhandler import STOP_SIGNAL_MONITOR
|
|
12
14
|
from robot.variables import is_variable
|
|
13
15
|
|
|
@@ -100,7 +102,7 @@ Access https://github.com/imbus/robotframework-debug for more details.\
|
|
|
100
102
|
self.run_robot_command(command)
|
|
101
103
|
|
|
102
104
|
def run_robot_command(self, command):
|
|
103
|
-
"""Run command in
|
|
105
|
+
"""Run command in robotframework environment."""
|
|
104
106
|
if not command:
|
|
105
107
|
return
|
|
106
108
|
result = []
|
|
@@ -309,8 +311,8 @@ def run_command(dbg_cmd, command: str) -> List[Tuple[str, str]]:
|
|
|
309
311
|
return []
|
|
310
312
|
|
|
311
313
|
|
|
312
|
-
def run_keyword(keyword, context):
|
|
313
|
-
if IS_RF_7
|
|
314
|
-
|
|
315
|
-
return keyword.run(
|
|
314
|
+
def run_keyword(keyword: Keyword, context: _ExecutionContext):
|
|
315
|
+
if IS_RF_7:
|
|
316
|
+
test = context.test or context.suite
|
|
317
|
+
return keyword.run(test, context)
|
|
316
318
|
return keyword.run(context)
|
|
@@ -136,10 +136,14 @@ def get_history_content(his, pure_commands: bool = True):
|
|
|
136
136
|
[
|
|
137
137
|
e
|
|
138
138
|
for e in dict.fromkeys(
|
|
139
|
-
reversed(
|
|
139
|
+
reversed(
|
|
140
|
+
[
|
|
141
|
+
re.sub(r"(?:(?<![\n ])(?:[ \t]{2,}|\t))", " " * 4, v).strip()
|
|
142
|
+
for v in his.get_strings()
|
|
143
|
+
]
|
|
144
|
+
)
|
|
140
145
|
)
|
|
141
|
-
if (
|
|
142
|
-
or (HEADER_MATCHER.match(e) and not pure_commands)
|
|
146
|
+
if bool(HEADER_MATCHER.match(e)) != pure_commands
|
|
143
147
|
]
|
|
144
148
|
)
|
|
145
149
|
)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import re
|
|
2
1
|
import tempfile
|
|
3
2
|
from pathlib import Path
|
|
4
3
|
from typing import Iterator, List, Tuple
|
|
@@ -14,10 +13,9 @@ except ImportError:
|
|
|
14
13
|
from robot.running import ResourceFile
|
|
15
14
|
from robot.variables.search import is_variable
|
|
16
15
|
|
|
16
|
+
from .globals import KEYWORD_SEP
|
|
17
17
|
from .robotlib import ImportedLibraryDocBuilder, ImportedResourceDocBuilder, get_libs
|
|
18
18
|
|
|
19
|
-
KEYWORD_SEP = re.compile(" +|\t")
|
|
20
|
-
|
|
21
19
|
_lib_keywords_cache = {}
|
|
22
20
|
_resource_keywords_cache = {}
|
|
23
21
|
temp_resources = []
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from copy import deepcopy
|
|
2
|
+
|
|
1
3
|
from robot.libdocpkg.model import LibraryDoc
|
|
2
4
|
from robot.libdocpkg.robotbuilder import (
|
|
3
5
|
KeywordDocBuilder,
|
|
@@ -44,7 +46,7 @@ class ImportedResourceDocBuilder(ResourceDocBuilder):
|
|
|
44
46
|
type="RESOURCE",
|
|
45
47
|
scope="GLOBAL",
|
|
46
48
|
)
|
|
47
|
-
libdoc.keywords = KeywordDocBuilder().build_keywords(resource)
|
|
49
|
+
libdoc.keywords = KeywordDocBuilder().build_keywords(deepcopy(resource))
|
|
48
50
|
return libdoc
|
|
49
51
|
|
|
50
52
|
|
|
@@ -16,7 +16,9 @@ def print_source_lines(style, source_file, lineno, before_and_after=5):
|
|
|
16
16
|
if not source_file or not lineno:
|
|
17
17
|
return
|
|
18
18
|
|
|
19
|
-
Path(
|
|
19
|
+
Path(
|
|
20
|
+
source_file
|
|
21
|
+
).open().readlines() # noqa: SIM115 TODO: not sure why i did this. Maybe to check if file is actually readable...
|
|
20
22
|
prefixed_token = get_pygments_token_from_file(lineno, source_file)
|
|
21
23
|
printable_token = filter_token_by_lineno(
|
|
22
24
|
prefixed_token, lineno - before_and_after, lineno + before_and_after + 1
|
|
@@ -28,7 +30,9 @@ def print_test_case_lines(style, source_file, current_lineno):
|
|
|
28
30
|
if not source_file or not current_lineno:
|
|
29
31
|
return
|
|
30
32
|
|
|
31
|
-
Path(
|
|
33
|
+
Path(
|
|
34
|
+
source_file
|
|
35
|
+
).open().readlines() # noqa: SIM115 TODO: not sure why i did this. Maybe to check if file is actually readable...
|
|
32
36
|
prefixed_token = get_pygments_token_from_file(current_lineno, source_file)
|
|
33
37
|
printable_token = filter_token_by_scope(prefixed_token, current_lineno)
|
|
34
38
|
print_pygments_styles(printable_token, style)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "4.5.0"
|
|
@@ -3,12 +3,12 @@ target-version = ['py37']
|
|
|
3
3
|
line-length = 100
|
|
4
4
|
|
|
5
5
|
[tool.ruff]
|
|
6
|
-
unfixable = []
|
|
6
|
+
lint.unfixable = []
|
|
7
7
|
exclude = [
|
|
8
8
|
"__pycache__",
|
|
9
9
|
"tests/"
|
|
10
10
|
]
|
|
11
|
-
ignore = [
|
|
11
|
+
lint.ignore = [
|
|
12
12
|
"B008", # do not perform function calls in argument defaults
|
|
13
13
|
"E501", # line too long
|
|
14
14
|
"N815", # mixedCase variable in class scope
|
|
@@ -19,7 +19,7 @@ ignore = [
|
|
|
19
19
|
"PLR0913", # too many arguments
|
|
20
20
|
]
|
|
21
21
|
target-version = "py37"
|
|
22
|
-
select = [
|
|
22
|
+
lint.select = [
|
|
23
23
|
"E",
|
|
24
24
|
"F",
|
|
25
25
|
"W",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "4.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{robotframework-debug-4.4.0 → robotframework-debug-4.5.0}/robotframework_debug.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|