robotframework-debug 3.5.2__py3-none-any.whl → 3.6.0__py3-none-any.whl

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.
@@ -4,9 +4,11 @@ import re
4
4
 
5
5
  from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
6
6
  from prompt_toolkit.buffer import Buffer
7
+ from prompt_toolkit.cursor_shapes import CursorShape
7
8
  from prompt_toolkit.history import FileHistory
8
9
  from prompt_toolkit.key_binding import KeyBindings
9
10
  from prompt_toolkit.lexers import PygmentsLexer
11
+ from prompt_toolkit.output import ColorDepth
10
12
  from prompt_toolkit.shortcuts import CompleteStyle, prompt
11
13
  from pygments.lexer import Lexer
12
14
  from pygments.lexers.robotframework import (
@@ -21,6 +23,8 @@ from pygments.lexers.robotframework import (
21
23
  _Table,
22
24
  )
23
25
 
26
+ from .robotkeyword import get_rprompt_text
27
+
24
28
 
25
29
  class KeywordCall(Tokenizer):
26
30
  _tokens = (KEYWORD, ARGUMENT)
@@ -306,6 +310,9 @@ Type "help" for more information.\
306
310
  BaseCmd.__init__(self, completekey, stdin, stdout)
307
311
  self.history = FileHistory(os.path.expanduser(history_path))
308
312
 
313
+ def prompt_continuation(self, width, line_number, is_soft_wrap):
314
+ return " " * width
315
+
309
316
  def get_input(self):
310
317
  kwargs = {}
311
318
  if self.get_prompt_tokens:
@@ -315,6 +322,7 @@ Type "help" for more information.\
315
322
  prompt_str = self.prompt
316
323
  try:
317
324
  line = prompt(
325
+ color_depth=ColorDepth.DEPTH_24_BIT,
318
326
  message=prompt_str,
319
327
  history=self.history,
320
328
  auto_suggest=AutoSuggestFromHistory(),
@@ -323,6 +331,10 @@ Type "help" for more information.\
323
331
  complete_style=CompleteStyle.COLUMN,
324
332
  key_bindings=kb,
325
333
  lexer=PygmentsLexer(RobotFrameworkLexer),
334
+ rprompt=get_rprompt_text(),
335
+ prompt_continuation=self.prompt_continuation,
336
+ mouse_support=True,
337
+ cursor=CursorShape.BLINKING_BEAM,
326
338
  **kwargs
327
339
  )
328
340
  except EOFError:
@@ -1,5 +1,6 @@
1
1
  import re
2
2
  import tempfile
3
+ import time
3
4
  from pathlib import Path
4
5
  from typing import List, Tuple
5
6
 
@@ -14,6 +15,7 @@ KEYWORD_SEP = re.compile(" +|\t")
14
15
 
15
16
  _lib_keywords_cache = {}
16
17
  temp_resources = []
18
+ last_keyword_exec_time = 0
17
19
 
18
20
 
19
21
  def parse_keyword(command) -> Tuple[List[str], str, List[str]]:
@@ -72,6 +74,8 @@ def find_keyword(keyword_name):
72
74
 
73
75
  def run_command(builtin, command: str) -> List[Tuple[str, str]]:
74
76
  """Run a command in robotframewrk environment."""
77
+ global last_keyword_exec_time
78
+ last_keyword_exec_time = 0
75
79
  if not command:
76
80
  return []
77
81
  if is_variable(command):
@@ -80,20 +84,23 @@ def run_command(builtin, command: str) -> List[Tuple[str, str]]:
80
84
  if command.startswith("***"):
81
85
  _import_resource_from_string(command)
82
86
  return []
83
-
84
87
  test = get_test_body_from_string(command)
85
88
  if len(test.body) > 1:
89
+ start = time.monotonic()
86
90
  for kw in test.body:
87
91
  kw.run(ctx)
92
+ last_keyword_exec_time = time.monotonic() - start
88
93
  return_val = None
89
94
  else:
90
95
  kw = test.body[0]
96
+ start = time.monotonic()
91
97
  return_val = kw.run(ctx)
98
+ last_keyword_exec_time = time.monotonic() - start
92
99
  assign = set(_get_assignments(test))
93
100
  if not assign and return_val is not None:
94
101
  return [("<", repr(return_val))]
95
102
  elif assign:
96
- output = [("<", repr(return_val))] if return_val is not None else []
103
+ output = [] # [("<", repr(return_val))] if return_val is not None else []
97
104
  for variable in assign:
98
105
  variable = variable.rstrip("=").strip()
99
106
  val = BuiltIn().get_variable_value(variable)
@@ -103,6 +110,13 @@ def run_command(builtin, command: str) -> List[Tuple[str, str]]:
103
110
  return []
104
111
 
105
112
 
113
+ def get_rprompt_text():
114
+ """Get text for bottom toolbar."""
115
+ if last_keyword_exec_time == 0:
116
+ return
117
+ return [("class:pygments.comment", f"# ΔT: {last_keyword_exec_time:.3f}s")]
118
+
119
+
106
120
  def get_test_body_from_string(command):
107
121
  if "\n" in command:
108
122
  command = "\n ".join(command.split("\n"))
RobotDebug/styles.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from prompt_toolkit import print_formatted_text
2
2
  from prompt_toolkit.completion import Completion
3
3
  from prompt_toolkit.formatted_text import FormattedText
4
- from prompt_toolkit.styles import Style, style_from_pygments_cls
4
+ from prompt_toolkit.styles import Style, merge_styles, style_from_pygments_cls
5
5
  from pygments.styles import get_all_styles, get_style_by_name
6
6
 
7
7
  NORMAL_STYLE = Style.from_dict(
@@ -11,13 +11,19 @@ NORMAL_STYLE = Style.from_dict(
11
11
  }
12
12
  )
13
13
 
14
- ERROR_STYLE = Style.from_dict(
15
- {
16
- "head": "fg:red"
17
- }
18
- )
14
+ ERROR_STYLE = Style.from_dict({"head": "fg:red"})
19
15
 
20
- DEBUG_PROMPT_STYLE = style_from_pygments_cls(get_style_by_name("solarized-dark"))
16
+ DEBUG_PROMPT_STYLE = merge_styles(
17
+ [
18
+ Style.from_dict(
19
+ {
20
+ "pygments.name.function": "bold",
21
+ "pygments.literal.string": "italic",
22
+ }
23
+ ),
24
+ style_from_pygments_cls(get_style_by_name("solarized-dark")),
25
+ ]
26
+ )
21
27
 
22
28
 
23
29
  def get_pygments_styles():
@@ -65,6 +71,9 @@ def _get_style_completions(text):
65
71
  start,
66
72
  display=name,
67
73
  display_meta="",
74
+ style=dict(style_from_pygments_cls(get_style_by_name(name)).style_rules).get(
75
+ "pygments.name.function"
76
+ ),
68
77
  )
69
78
  for name in get_pygments_styles()
70
79
  if (name.lower().strip().startswith(style_part))
RobotDebug/version.py CHANGED
@@ -1 +1 @@
1
- VERSION = "3.5.2"
1
+ VERSION = "3.6.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: robotframework-debug
3
- Version: 3.5.2
3
+ Version: 3.6.0
4
4
  Summary: RobotFramework debug shell
5
5
  Home-page: https://github.com/imbus/robotframework-debug/
6
6
  Author: René Rohner
@@ -3,19 +3,19 @@ RobotDebug/cmdcompleter.py,sha256=Jr2Nr1UXu81j5nX4LAq_oTuSPM5Kl2mHYWGMMq-K89k,46
3
3
  RobotDebug/debugcmd.py,sha256=2fNutZQ3xUXpASVMVlHK--oD97ogYDU6oSUh80GukMc,9502
4
4
  RobotDebug/globals.py,sha256=AquYBTzu8X9NKa_io-SZv2iwPn2CTdmycDRKzp1YJCg,379
5
5
  RobotDebug/keywords.py,sha256=kUrpIVELX5Dch8coYW4aN0RBJZxbhEt-xR1p4JIYI24,1421
6
- RobotDebug/prompttoolkitcmd.py,sha256=CO0CL4wETFG5GybpsNhhVxsqMrqG1IR8a-JPIaIlZ9M,8918
6
+ RobotDebug/prompttoolkitcmd.py,sha256=zCSAjgnBqZ6twoxPWDwUQStSGzhtBewuimkcoHQ6g5M,9402
7
7
  RobotDebug/robotapp.py,sha256=gHylpx9kUq_dxqUc05lawR11t1AbcZeiI48xoNntUHc,543
8
- RobotDebug/robotkeyword.py,sha256=_8tVdKDCV9Li5nNDuWw-YxNfOhZzwsYwMaS7mK0AXlc,4170
8
+ RobotDebug/robotkeyword.py,sha256=jIXGE84sRZlXctVpGBDrkxjYEdL0K1gftQjpxSttW7I,4658
9
9
  RobotDebug/robotlib.py,sha256=7y5zxUoAXp6fTqJaNHSqkeCabdb5hzvvtCGTygthErk,1277
10
10
  RobotDebug/robotvar.py,sha256=1rbMiQ8voex96zk-SL4NS4PF-X4JlO2GyuXc_3oQDPM,256
11
11
  RobotDebug/shell.py,sha256=Lo3BpHGXzCoDtz3mSZi63rIuQsRsF7YMp0Z0eGOf19E,1097
12
12
  RobotDebug/sourcelines.py,sha256=RsMt5mHRemGc7ZjXaUklUhikdPv_z1VQWiq0hMcG47o,2171
13
13
  RobotDebug/steplistener.py,sha256=ZgU-KC86Fv7sL6dhKs4No04Tt6YPiL8fVYvSaxq-5iE,2069
14
- RobotDebug/styles.py,sha256=pfz4kkD7yA-Y4wpjvQzUBqwZSHW9Efz9yWDynoIjqkE,1868
15
- RobotDebug/version.py,sha256=FUx65akiBkNReYh1JPqxwZgs8jP41tBRIu_COWW1ouA,18
16
- robotframework_debug-3.5.2.dist-info/LICENSE,sha256=gQ99jiepkqR855TecTsQwnukNze2z8VnYlwf0nOoLaQ,1471
17
- robotframework_debug-3.5.2.dist-info/METADATA,sha256=Guu-jm74sj-hHmUNh18mbFlBThBEa2mMTKiXFo8R2TA,6125
18
- robotframework_debug-3.5.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
19
- robotframework_debug-3.5.2.dist-info/entry_points.txt,sha256=DKb6p0-MiuLHJQOh0QYigUQhUVeLWRkIgDtflQfBZrY,86
20
- robotframework_debug-3.5.2.dist-info/top_level.txt,sha256=U-hVxtF0cYhz4KDYDvlUj20iv3vKAQaSvWiFr__jJy4,11
21
- robotframework_debug-3.5.2.dist-info/RECORD,,
14
+ RobotDebug/styles.py,sha256=IyHBKIsEf9Vra6hxW7UN1GDmiaz7oKCfjblUO7PKkDk,2212
15
+ RobotDebug/version.py,sha256=hT6veETpVNpRqhpKNh8-nn9DTHHxeJX2gMeYNPF1jGk,18
16
+ robotframework_debug-3.6.0.dist-info/LICENSE,sha256=gQ99jiepkqR855TecTsQwnukNze2z8VnYlwf0nOoLaQ,1471
17
+ robotframework_debug-3.6.0.dist-info/METADATA,sha256=NjyreVQdT2kCE8124Hc1S-Y9qpRgPMKKTr1whP4f3S8,6125
18
+ robotframework_debug-3.6.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
19
+ robotframework_debug-3.6.0.dist-info/entry_points.txt,sha256=DKb6p0-MiuLHJQOh0QYigUQhUVeLWRkIgDtflQfBZrY,86
20
+ robotframework_debug-3.6.0.dist-info/top_level.txt,sha256=U-hVxtF0cYhz4KDYDvlUj20iv3vKAQaSvWiFr__jJy4,11
21
+ robotframework_debug-3.6.0.dist-info/RECORD,,