robotcode-repl-server 0.100.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- robotcode/repl_server/__init__.py +0 -0
- robotcode/repl_server/__version__.py +1 -0
- robotcode/repl_server/cli.py +235 -0
- robotcode/repl_server/hooks.py +12 -0
- robotcode/repl_server/html_writer.py +324 -0
- robotcode/repl_server/interpreter.py +365 -0
- robotcode/repl_server/protocol.py +32 -0
- robotcode/repl_server/py.typed +1 -0
- robotcode/repl_server/server.py +24 -0
- robotcode_repl_server-0.100.0.dist-info/METADATA +51 -0
- robotcode_repl_server-0.100.0.dist-info/RECORD +14 -0
- robotcode_repl_server-0.100.0.dist-info/WHEEL +4 -0
- robotcode_repl_server-0.100.0.dist-info/entry_points.txt +2 -0
- robotcode_repl_server-0.100.0.dist-info/licenses/LICENSE.txt +73 -0
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.100.0"
|
@@ -0,0 +1,235 @@
|
|
1
|
+
import asyncio
|
2
|
+
import threading
|
3
|
+
import time
|
4
|
+
from pathlib import Path
|
5
|
+
from typing import Any, Optional, Sequence, Tuple
|
6
|
+
|
7
|
+
import click
|
8
|
+
|
9
|
+
from robotcode.core.concurrent import Task, run_as_debugpy_hidden_task
|
10
|
+
from robotcode.core.types import ServerMode, TcpParams
|
11
|
+
from robotcode.plugin import Application, pass_application
|
12
|
+
from robotcode.plugin.click_helper.options import (
|
13
|
+
resolve_server_options,
|
14
|
+
server_options,
|
15
|
+
)
|
16
|
+
from robotcode.plugin.click_helper.types import AddressesPort, add_options
|
17
|
+
from robotcode.repl.run import run_repl
|
18
|
+
|
19
|
+
from .__version__ import __version__
|
20
|
+
from .interpreter import Interpreter
|
21
|
+
from .server import TCP_DEFAULT_PORT, ReplServer
|
22
|
+
|
23
|
+
REPL_SERVER_DEFAULT_PORT = TCP_DEFAULT_PORT
|
24
|
+
|
25
|
+
_server: Optional[ReplServer] = None
|
26
|
+
_server_lock = threading.RLock()
|
27
|
+
|
28
|
+
|
29
|
+
def get_server() -> Optional["ReplServer"]:
|
30
|
+
with _server_lock:
|
31
|
+
return _server
|
32
|
+
|
33
|
+
|
34
|
+
def set_server(value: Optional["ReplServer"]) -> None:
|
35
|
+
with _server_lock:
|
36
|
+
global _server
|
37
|
+
_server = value
|
38
|
+
|
39
|
+
|
40
|
+
def wait_for_server(task: "Task[Any]", timeout: float = 10) -> "ReplServer":
|
41
|
+
start_time = time.monotonic()
|
42
|
+
while get_server() is None and time.monotonic() - start_time < timeout:
|
43
|
+
time.sleep(0.005)
|
44
|
+
|
45
|
+
result = get_server()
|
46
|
+
|
47
|
+
if result is None:
|
48
|
+
task.result(5)
|
49
|
+
raise RuntimeError("Timeout to get server instance.")
|
50
|
+
|
51
|
+
return result
|
52
|
+
|
53
|
+
|
54
|
+
def run_jsonrpc_server_async(
|
55
|
+
mode: ServerMode,
|
56
|
+
port: Optional[int],
|
57
|
+
bind: Optional[Sequence[str]],
|
58
|
+
pipe_name: Optional[str],
|
59
|
+
interpreter: Interpreter,
|
60
|
+
) -> None:
|
61
|
+
with ReplServer(
|
62
|
+
interpreter,
|
63
|
+
ServerMode(mode),
|
64
|
+
tcp_params=TcpParams(bind or "127.0.0.1", port if port is not None else REPL_SERVER_DEFAULT_PORT),
|
65
|
+
pipe_name=pipe_name,
|
66
|
+
) as server:
|
67
|
+
set_server(server)
|
68
|
+
try:
|
69
|
+
server.run()
|
70
|
+
finally:
|
71
|
+
set_server(None)
|
72
|
+
|
73
|
+
|
74
|
+
def run_jsonrpc_server(
|
75
|
+
mode: ServerMode,
|
76
|
+
port: Optional[int],
|
77
|
+
bind: Optional[Sequence[str]],
|
78
|
+
pipe_name: Optional[str],
|
79
|
+
interpreter: Interpreter,
|
80
|
+
) -> None:
|
81
|
+
loop = asyncio.new_event_loop()
|
82
|
+
asyncio.set_event_loop(loop)
|
83
|
+
run_jsonrpc_server_async(mode, port, bind, pipe_name, interpreter)
|
84
|
+
|
85
|
+
|
86
|
+
@click.command(
|
87
|
+
context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
|
88
|
+
add_help_option=True,
|
89
|
+
)
|
90
|
+
@add_options(*server_options(ServerMode.STDIO, default_port=REPL_SERVER_DEFAULT_PORT))
|
91
|
+
@click.option(
|
92
|
+
"-v",
|
93
|
+
"--variable",
|
94
|
+
metavar="name:value",
|
95
|
+
type=str,
|
96
|
+
multiple=True,
|
97
|
+
help="Set variables in the test data. see `robot --variable` option.",
|
98
|
+
)
|
99
|
+
@click.option(
|
100
|
+
"-V",
|
101
|
+
"--variablefile",
|
102
|
+
metavar="PATH",
|
103
|
+
type=str,
|
104
|
+
multiple=True,
|
105
|
+
help="Python or YAML file file to read variables from. see `robot --variablefile` option.",
|
106
|
+
)
|
107
|
+
@click.option(
|
108
|
+
"-P",
|
109
|
+
"--pythonpath",
|
110
|
+
metavar="PATH",
|
111
|
+
type=str,
|
112
|
+
multiple=True,
|
113
|
+
help="Additional locations where to search test libraries"
|
114
|
+
" and other extensions when they are imported. see `robot --pythonpath` option.",
|
115
|
+
)
|
116
|
+
@click.option(
|
117
|
+
"-d",
|
118
|
+
"--outputdir",
|
119
|
+
metavar="DIR",
|
120
|
+
type=str,
|
121
|
+
help="Where to create output files. see `robot --outputdir` option.",
|
122
|
+
)
|
123
|
+
@click.option(
|
124
|
+
"-o",
|
125
|
+
"--output",
|
126
|
+
metavar="FILE",
|
127
|
+
type=str,
|
128
|
+
help="XML output file. see `robot --output` option.",
|
129
|
+
)
|
130
|
+
@click.option(
|
131
|
+
"-r",
|
132
|
+
"--report",
|
133
|
+
metavar="FILE",
|
134
|
+
type=str,
|
135
|
+
help="HTML output file. see `robot --report` option.",
|
136
|
+
)
|
137
|
+
@click.option(
|
138
|
+
"-l",
|
139
|
+
"--log",
|
140
|
+
metavar="FILE",
|
141
|
+
type=str,
|
142
|
+
help="HTML log file. see `robot --log` option.",
|
143
|
+
)
|
144
|
+
@click.option(
|
145
|
+
"-x",
|
146
|
+
"--xunit",
|
147
|
+
metavar="FILE",
|
148
|
+
type=str,
|
149
|
+
help="xUnit output file. see `robot --xunit` option.",
|
150
|
+
)
|
151
|
+
@click.version_option(version=__version__, prog_name="RobotCode REPL Server")
|
152
|
+
@click.option(
|
153
|
+
"-s",
|
154
|
+
"--source",
|
155
|
+
type=click.Path(path_type=Path),
|
156
|
+
metavar="FILE",
|
157
|
+
help="Specifies the path to a source file. This file must not exist and will neither be read nor written. "
|
158
|
+
"It is used solely to set the current working directory for the REPL script "
|
159
|
+
"and to assign a name to the internal suite.",
|
160
|
+
)
|
161
|
+
@click.argument(
|
162
|
+
"files",
|
163
|
+
type=click.Path(exists=True, dir_okay=False, path_type=Path),
|
164
|
+
nargs=-1,
|
165
|
+
required=False,
|
166
|
+
)
|
167
|
+
@pass_application
|
168
|
+
@click.pass_context
|
169
|
+
def repl_server(
|
170
|
+
ctx: click.Context,
|
171
|
+
app: Application,
|
172
|
+
mode: ServerMode,
|
173
|
+
port: Optional[int],
|
174
|
+
bind: Optional[Sequence[str]],
|
175
|
+
pipe_name: Optional[str],
|
176
|
+
tcp: Optional[AddressesPort],
|
177
|
+
socket: Optional[AddressesPort],
|
178
|
+
stdio: Optional[bool],
|
179
|
+
pipe: Optional[str],
|
180
|
+
pipe_server: Optional[str],
|
181
|
+
variable: Tuple[str, ...],
|
182
|
+
variablefile: Tuple[str, ...],
|
183
|
+
pythonpath: Tuple[str, ...],
|
184
|
+
outputdir: Optional[str],
|
185
|
+
output: Optional[str],
|
186
|
+
report: Optional[str],
|
187
|
+
log: Optional[str],
|
188
|
+
xunit: Optional[str],
|
189
|
+
source: Optional[Path],
|
190
|
+
files: Tuple[Path, ...],
|
191
|
+
) -> None:
|
192
|
+
"""\
|
193
|
+
Start a REPL server, client can connect to the server and run the REPL scripts.
|
194
|
+
"""
|
195
|
+
|
196
|
+
mode, port, bind, pipe_name = resolve_server_options(
|
197
|
+
ctx,
|
198
|
+
app,
|
199
|
+
mode,
|
200
|
+
port,
|
201
|
+
bind,
|
202
|
+
pipe_name,
|
203
|
+
tcp,
|
204
|
+
socket,
|
205
|
+
stdio,
|
206
|
+
pipe,
|
207
|
+
pipe_server,
|
208
|
+
)
|
209
|
+
|
210
|
+
interpreter = Interpreter(list(files))
|
211
|
+
|
212
|
+
server_task = run_as_debugpy_hidden_task(run_jsonrpc_server, mode, port, bind, pipe_name, interpreter)
|
213
|
+
|
214
|
+
server = wait_for_server(server_task)
|
215
|
+
|
216
|
+
try:
|
217
|
+
run_repl(
|
218
|
+
interpreter=interpreter,
|
219
|
+
app=app,
|
220
|
+
variablefile=variable,
|
221
|
+
variable=variablefile,
|
222
|
+
pythonpath=pythonpath,
|
223
|
+
outputdir=outputdir,
|
224
|
+
output=output,
|
225
|
+
report=report,
|
226
|
+
log=log,
|
227
|
+
xunit=xunit,
|
228
|
+
source=source,
|
229
|
+
files=files,
|
230
|
+
)
|
231
|
+
finally:
|
232
|
+
if server is not None:
|
233
|
+
server.loop.stop()
|
234
|
+
|
235
|
+
server_task.result(5)
|
@@ -0,0 +1,324 @@
|
|
1
|
+
from contextlib import contextmanager
|
2
|
+
from datetime import datetime, timedelta
|
3
|
+
from typing import Any, Dict, Generator, List, Optional, Sequence, TypeVar, Union
|
4
|
+
|
5
|
+
from robot.utils.robottime import elapsed_time_to_string
|
6
|
+
|
7
|
+
from robotcode.repl.base_interpreter import is_true
|
8
|
+
from robotcode.robot.utils import get_robot_version
|
9
|
+
|
10
|
+
|
11
|
+
class ElementDataBase:
|
12
|
+
def as_str(self, indent: int = 0) -> str:
|
13
|
+
raise NotImplementedError
|
14
|
+
|
15
|
+
def __str__(self) -> str:
|
16
|
+
return self.as_str(0)
|
17
|
+
|
18
|
+
|
19
|
+
_T = TypeVar("_T", bound=ElementDataBase)
|
20
|
+
|
21
|
+
|
22
|
+
class TextElement(ElementDataBase):
|
23
|
+
def __init__(self, text: str) -> None:
|
24
|
+
self.text = text
|
25
|
+
|
26
|
+
def as_str(self, indent: int = 0) -> str:
|
27
|
+
return f"{' '*indent}{self.text}"
|
28
|
+
|
29
|
+
|
30
|
+
class RawElement(ElementDataBase):
|
31
|
+
def __init__(self, text: str) -> None:
|
32
|
+
self.text = text
|
33
|
+
|
34
|
+
def as_str(self, indent: int = 0) -> str:
|
35
|
+
return f"{' '*indent}{self.text}"
|
36
|
+
|
37
|
+
|
38
|
+
class Element(ElementDataBase):
|
39
|
+
def __init__(
|
40
|
+
self,
|
41
|
+
tag_name: str,
|
42
|
+
text: Optional[str] = None,
|
43
|
+
classes: Optional[List[str]] = None,
|
44
|
+
styles: Optional[Dict[str, str]] = None,
|
45
|
+
attributes: Optional[Dict[str, str]] = None,
|
46
|
+
**kwargs: Any,
|
47
|
+
) -> None:
|
48
|
+
self.tag_name = tag_name
|
49
|
+
self.classes = classes
|
50
|
+
self.styles = styles
|
51
|
+
if attributes is None:
|
52
|
+
attributes = {}
|
53
|
+
attributes.update(kwargs)
|
54
|
+
self.attributes = attributes
|
55
|
+
self.children: List[ElementDataBase] = []
|
56
|
+
|
57
|
+
if text is not None:
|
58
|
+
self.add_element(TextElement(text))
|
59
|
+
|
60
|
+
def add_element(self, child: _T) -> _T:
|
61
|
+
self.children.append(child)
|
62
|
+
return child
|
63
|
+
|
64
|
+
@contextmanager
|
65
|
+
def tag(
|
66
|
+
self,
|
67
|
+
tag_name: str,
|
68
|
+
*,
|
69
|
+
text: Optional[str] = None,
|
70
|
+
classes: Optional[List[str]] = None,
|
71
|
+
styles: Optional[Dict[str, str]] = None,
|
72
|
+
attributes: Optional[Dict[str, str]] = None,
|
73
|
+
**kwargs: Any,
|
74
|
+
) -> Generator["Element", None, None]:
|
75
|
+
element = Element(tag_name, text=text, classes=classes, styles=styles, attributes=attributes, **kwargs)
|
76
|
+
|
77
|
+
yield element
|
78
|
+
|
79
|
+
self.add_element(element)
|
80
|
+
|
81
|
+
def add_raw(self, text: Any) -> None:
|
82
|
+
self.add_element(RawElement(str(text)))
|
83
|
+
|
84
|
+
def add_text(self, text: Any) -> None:
|
85
|
+
self.add_element(TextElement(str(text)))
|
86
|
+
|
87
|
+
def _build_attributes(self) -> str:
|
88
|
+
result = []
|
89
|
+
if self.classes:
|
90
|
+
result.append(f'class="{" ".join(s for s in self.classes if s)}"')
|
91
|
+
if self.styles:
|
92
|
+
result.append(f'style="{"; ".join(f"{k}: {v}" for k, v in self.styles.items() if v)}"')
|
93
|
+
if self.attributes:
|
94
|
+
result.extend(f'{k}="{v}"' for k, v in self.attributes.items())
|
95
|
+
|
96
|
+
return " ".join(result)
|
97
|
+
|
98
|
+
NON_BREAKABLE_TAGS = {"span", "a", "b", "i", "u", "strong", "em", "code", "pre", "tt", "samp", "kbd", "var", "td"}
|
99
|
+
|
100
|
+
def as_str(self, indent: int = 0, *, only_children: bool = False) -> str:
|
101
|
+
if not only_children:
|
102
|
+
attributes = self._build_attributes()
|
103
|
+
|
104
|
+
if attributes:
|
105
|
+
start_tag = f"<{self.tag_name} {attributes}>"
|
106
|
+
else:
|
107
|
+
start_tag = f"<{self.tag_name}>"
|
108
|
+
|
109
|
+
end_tag = f"</{self.tag_name}>"
|
110
|
+
|
111
|
+
result = " " * indent + start_tag
|
112
|
+
else:
|
113
|
+
result = ""
|
114
|
+
end_tag = None
|
115
|
+
|
116
|
+
if self.children:
|
117
|
+
result += "\n" if self.tag_name not in self.NON_BREAKABLE_TAGS else ""
|
118
|
+
for child in self.children:
|
119
|
+
result += child.as_str((indent + 1) if self.tag_name not in self.NON_BREAKABLE_TAGS else 0) + (
|
120
|
+
"\n" if self.tag_name not in self.NON_BREAKABLE_TAGS else ""
|
121
|
+
)
|
122
|
+
result += (" " * indent) if self.tag_name not in self.NON_BREAKABLE_TAGS else ""
|
123
|
+
|
124
|
+
if end_tag:
|
125
|
+
result += end_tag
|
126
|
+
|
127
|
+
return result
|
128
|
+
|
129
|
+
|
130
|
+
def create_keyword_html(
|
131
|
+
id: Optional[str] = None,
|
132
|
+
name: Optional[str] = "",
|
133
|
+
owner: Optional[str] = None,
|
134
|
+
source_name: Optional[str] = None,
|
135
|
+
doc: Optional[str] = "",
|
136
|
+
args: Sequence[str] = (),
|
137
|
+
assign: Sequence[str] = (),
|
138
|
+
tags: Sequence[str] = (),
|
139
|
+
timeout: Optional[str] = None,
|
140
|
+
type: str = "KEYWORD",
|
141
|
+
status: str = "FAIL",
|
142
|
+
message: str = "",
|
143
|
+
start_time: Union[datetime, str, None] = None,
|
144
|
+
end_time: Union[datetime, str, None] = None,
|
145
|
+
elapsed_time: Union[timedelta, int, float, None] = None,
|
146
|
+
shadow_root_id: Optional[str] = None,
|
147
|
+
) -> Element:
|
148
|
+
result = Element("div", classes=["keyword"], id=id)
|
149
|
+
|
150
|
+
elapsed_time_str = (
|
151
|
+
(
|
152
|
+
elapsed_time_to_string(elapsed_time)
|
153
|
+
if get_robot_version() < (7, 0)
|
154
|
+
else elapsed_time_to_string(elapsed_time, seconds=True)
|
155
|
+
)
|
156
|
+
if elapsed_time is not None
|
157
|
+
else ""
|
158
|
+
)
|
159
|
+
|
160
|
+
with result.tag(
|
161
|
+
"div",
|
162
|
+
classes=["element-header", "closed" if status not in ["FAIL"] else ""],
|
163
|
+
onclick=f"toggleKeyword('{id}', '{shadow_root_id}')",
|
164
|
+
) as e_element_header:
|
165
|
+
with e_element_header.tag(
|
166
|
+
"div",
|
167
|
+
classes=["element-header-left"],
|
168
|
+
title=f"{type.upper()} {owner}.{name} [{status}]",
|
169
|
+
) as e_header_left:
|
170
|
+
if elapsed_time is not None:
|
171
|
+
with e_header_left.tag("span", classes=["elapsed"]) as e_elapsed:
|
172
|
+
e_elapsed.add_text(elapsed_time_str)
|
173
|
+
with e_header_left.tag("span", classes=["label", status.lower()]) as e_label:
|
174
|
+
e_label.add_text(str(type).upper())
|
175
|
+
with e_header_left.tag("span", classes=["assign"]) as e_assign:
|
176
|
+
e_assign.add_text(" ".join(assign))
|
177
|
+
with e_header_left.tag("span", classes=["name"]) as e_name:
|
178
|
+
with e_name.tag("span", classes=["parent-name"]) as parent_name:
|
179
|
+
parent_name.add_text((owner + " . ") if owner else "")
|
180
|
+
e_name.add_text(name)
|
181
|
+
e_header_left.add_raw(" ")
|
182
|
+
with e_header_left.tag("span", classes=["arg"]) as args_tag:
|
183
|
+
args_tag.add_text(" ".join(args))
|
184
|
+
with e_element_header.tag("div", classes=["element-header-right"]) as e_header_right:
|
185
|
+
with e_header_right.tag(
|
186
|
+
"div",
|
187
|
+
classes=["expand"],
|
188
|
+
title="Expand all",
|
189
|
+
onclick=f"expandAll(event, '{id}', '{shadow_root_id}')",
|
190
|
+
):
|
191
|
+
pass
|
192
|
+
with e_header_right.tag(
|
193
|
+
"div",
|
194
|
+
classes=["collapse"],
|
195
|
+
title="Collapse all",
|
196
|
+
onclick=f"collapseAll(event, '{id}', '{shadow_root_id}')",
|
197
|
+
):
|
198
|
+
pass
|
199
|
+
with e_header_right.tag(
|
200
|
+
"div",
|
201
|
+
classes=["link"],
|
202
|
+
title="Highlight this item",
|
203
|
+
onclick=f"makeElementVisible(event, '{id}', '{shadow_root_id}')",
|
204
|
+
):
|
205
|
+
pass
|
206
|
+
with e_element_header.tag("div", classes=["element-header-toggle"], title="Toggle visibility"):
|
207
|
+
pass
|
208
|
+
|
209
|
+
with result.tag(
|
210
|
+
"div", classes=["children", "populated"], styles={"display": "none" if status not in ["FAIL"] else "block"}
|
211
|
+
) as e_children:
|
212
|
+
with e_children.tag("table", classes=["metadata", "keyword-metadata"]) as e_body:
|
213
|
+
if doc:
|
214
|
+
with e_body.tag("tr") as tr:
|
215
|
+
with tr.tag("th", text="Documentation:"):
|
216
|
+
pass
|
217
|
+
with tr.tag("td", classes=["doc"]) as td:
|
218
|
+
td.add_text(doc)
|
219
|
+
if tags:
|
220
|
+
with e_body.tag("tr") as tr:
|
221
|
+
with tr.tag("th", text="Tags:"):
|
222
|
+
pass
|
223
|
+
with tr.tag("td", classes=["tags"]) as td:
|
224
|
+
td.add_text(", ".join(tags))
|
225
|
+
if timeout:
|
226
|
+
with e_body.tag("tr") as tr:
|
227
|
+
with tr.tag("th", text="Timeout:"):
|
228
|
+
pass
|
229
|
+
with tr.tag("td", classes=["timeout"]) as td:
|
230
|
+
td.add_text(timeout)
|
231
|
+
if source_name:
|
232
|
+
with e_body.tag("tr") as tr:
|
233
|
+
with tr.tag("th", text="Source:"):
|
234
|
+
pass
|
235
|
+
with tr.tag("td", classes=["source"]) as td:
|
236
|
+
td.add_text(source_name)
|
237
|
+
with e_body.tag("tr") as tr:
|
238
|
+
with tr.tag("th", text="Start / End / Elapsed:"):
|
239
|
+
pass
|
240
|
+
with tr.tag("td", classes=["message"]) as td:
|
241
|
+
td.add_text(str(start_time) + " / " + str(end_time) + " / " + elapsed_time_str)
|
242
|
+
if message:
|
243
|
+
with e_body.tag("tr") as tr:
|
244
|
+
with tr.tag("th", text="Message:"):
|
245
|
+
pass
|
246
|
+
with tr.tag("td", classes=["message"]) as td:
|
247
|
+
td.add_text(message)
|
248
|
+
|
249
|
+
return result
|
250
|
+
|
251
|
+
|
252
|
+
def create_message_html(
|
253
|
+
id: str,
|
254
|
+
message: str,
|
255
|
+
level: str,
|
256
|
+
html: Union[str, bool] = False,
|
257
|
+
timestamp: Union[datetime, str, None] = None,
|
258
|
+
shadow_root_id: Optional[str] = None,
|
259
|
+
) -> Element:
|
260
|
+
result = Element("table", classes=["messages", f"{level.lower()}-message"], id=id)
|
261
|
+
|
262
|
+
with result.tag("tr", classes=["message-row"]) as tr:
|
263
|
+
with tr.tag("td", classes=["time"]) as td:
|
264
|
+
if isinstance(timestamp, datetime):
|
265
|
+
td.add_text(timestamp.strftime("%H:%M:%S"))
|
266
|
+
else:
|
267
|
+
td.add_text(timestamp)
|
268
|
+
with tr.tag("td", classes=["level", level.lower()]) as td:
|
269
|
+
with td.tag("span", classes=["label", level.lower()]) as sp:
|
270
|
+
sp.add_text(level.upper())
|
271
|
+
with tr.tag("td", classes=["message"]) as td:
|
272
|
+
if is_true(html):
|
273
|
+
td.add_raw(message)
|
274
|
+
else:
|
275
|
+
td.add_text(message)
|
276
|
+
with tr.tag(
|
277
|
+
"td",
|
278
|
+
classes=["select-message"],
|
279
|
+
onclick=f"selectMessage('{id}', '{shadow_root_id}')",
|
280
|
+
title="Select message text",
|
281
|
+
) as td:
|
282
|
+
with td.tag("div"):
|
283
|
+
pass
|
284
|
+
|
285
|
+
return result
|
286
|
+
|
287
|
+
|
288
|
+
if __name__ == "__main__":
|
289
|
+
# div = Element("div", id="main", classes=["test", "test2"], styles={"color": "red", "font-size": "12px"})
|
290
|
+
# p = div.add_element(Element("p", text="Hello, world!"))
|
291
|
+
# p.add_element(Element("span", text="This is a test"))
|
292
|
+
# print(div)
|
293
|
+
|
294
|
+
# body = Element("body")
|
295
|
+
# with body.tag("div", id="main", classes=["test", "test2"], styles={"color": "red"}) as div:
|
296
|
+
# with div.tag("p") as p:
|
297
|
+
# p.add_text("Hello, world!")
|
298
|
+
# with p.tag("span") as span:
|
299
|
+
# span.add_text("This is a test")
|
300
|
+
# with span.tag("br"):
|
301
|
+
# pass
|
302
|
+
# span.add_text("This is a test")
|
303
|
+
# with span.tag("br", id="test"):
|
304
|
+
# pass
|
305
|
+
# print(body)
|
306
|
+
|
307
|
+
# r = create_keyword_html(
|
308
|
+
# id="ts-1-2-3-4-5-6",
|
309
|
+
# name="Test Keyword",
|
310
|
+
# owner="Test Library",
|
311
|
+
# doc="This is a test keyword",
|
312
|
+
# args=("arg1", "arg2"),
|
313
|
+
# assign=("${var1}", "${var2}"),
|
314
|
+
# tags=("tag1", "tag2"),
|
315
|
+
# timeout="10s",
|
316
|
+
# type="KEYWORD",
|
317
|
+
# status="PASS",
|
318
|
+
# message="This is a test message",
|
319
|
+
# start_time=datetime.now(timezone.utc),
|
320
|
+
# end_time=datetime.now(timezone.utc),
|
321
|
+
# elapsed_time=timedelta(seconds=5),
|
322
|
+
# )
|
323
|
+
r = create_message_html("ts-1-2-3-4-5-6", "This is a test message", "INFO", timestamp="2021-10-10 12:00:00")
|
324
|
+
print(r)
|
@@ -0,0 +1,365 @@
|
|
1
|
+
from dataclasses import dataclass, field
|
2
|
+
from datetime import datetime
|
3
|
+
from pathlib import Path
|
4
|
+
from threading import Event
|
5
|
+
from typing import TYPE_CHECKING, Iterator, List, Optional, Protocol, Union, runtime_checkable
|
6
|
+
from uuid import uuid4
|
7
|
+
|
8
|
+
from robot.running import Keyword
|
9
|
+
|
10
|
+
from robotcode.core.utils.dataclasses import as_json
|
11
|
+
from robotcode.repl.base_interpreter import BaseInterpreter, is_true
|
12
|
+
|
13
|
+
from .html_writer import Element, create_keyword_html, create_message_html
|
14
|
+
|
15
|
+
if TYPE_CHECKING:
|
16
|
+
from robot import result, running
|
17
|
+
|
18
|
+
|
19
|
+
@dataclass
|
20
|
+
class ExecutionOutput:
|
21
|
+
mime: str
|
22
|
+
data: str
|
23
|
+
|
24
|
+
|
25
|
+
@dataclass
|
26
|
+
class ExecutionResult:
|
27
|
+
success: Optional[bool] = None
|
28
|
+
items: Optional[List[ExecutionOutput]] = None
|
29
|
+
|
30
|
+
|
31
|
+
class CellInputError(Exception):
|
32
|
+
pass
|
33
|
+
|
34
|
+
|
35
|
+
@dataclass
|
36
|
+
class ResultData:
|
37
|
+
pass
|
38
|
+
|
39
|
+
|
40
|
+
@dataclass
|
41
|
+
class MessageData(ResultData):
|
42
|
+
id: str
|
43
|
+
message: str
|
44
|
+
level: str
|
45
|
+
html: bool
|
46
|
+
timestamp: Optional[str] = None
|
47
|
+
|
48
|
+
node_type: str = "message"
|
49
|
+
|
50
|
+
|
51
|
+
@dataclass
|
52
|
+
class RootResultData(ResultData):
|
53
|
+
items: List[ResultData] = field(default_factory=list)
|
54
|
+
|
55
|
+
node_type: str = "root"
|
56
|
+
|
57
|
+
|
58
|
+
@runtime_checkable
|
59
|
+
class ResultDataWithChildren(Protocol):
|
60
|
+
items: List[ResultData]
|
61
|
+
|
62
|
+
|
63
|
+
@dataclass
|
64
|
+
class KeywordResultData(ResultData):
|
65
|
+
id: str
|
66
|
+
name: str
|
67
|
+
owner: str
|
68
|
+
source_name: str
|
69
|
+
doc: str
|
70
|
+
args: List[str]
|
71
|
+
assign: List[str]
|
72
|
+
tags: List[str]
|
73
|
+
timeout: Optional[str]
|
74
|
+
type: str
|
75
|
+
status: str
|
76
|
+
message: str
|
77
|
+
start_time: Optional[str]
|
78
|
+
end_time: Optional[str]
|
79
|
+
elapsed_time: Optional[float]
|
80
|
+
|
81
|
+
items: List[ResultData] = field(default_factory=list)
|
82
|
+
|
83
|
+
node_type: str = "keyword"
|
84
|
+
|
85
|
+
|
86
|
+
class Interpreter(BaseInterpreter):
|
87
|
+
def __init__(
|
88
|
+
self,
|
89
|
+
files: Optional[List[Path]] = None,
|
90
|
+
) -> None:
|
91
|
+
super().__init__()
|
92
|
+
self.files = files
|
93
|
+
self.has_input = Event()
|
94
|
+
self.executed = Event()
|
95
|
+
self._code: List[str] = []
|
96
|
+
self._html_result: Optional[Element] = None
|
97
|
+
self._result_stack: List[Element] = []
|
98
|
+
self._output_stack: List[Element] = []
|
99
|
+
self._shadow_marker: Optional[str] = None
|
100
|
+
self._success: Optional[bool] = None
|
101
|
+
self._result_data: Optional[ResultData] = None
|
102
|
+
self._result_data_stack: List[ResultData] = []
|
103
|
+
self.collect_messages: bool = False
|
104
|
+
self._has_shutdown = False
|
105
|
+
|
106
|
+
def shutdown(self) -> None:
|
107
|
+
self._code = []
|
108
|
+
self._has_shutdown = True
|
109
|
+
self.has_input.set()
|
110
|
+
# self.executed.set()
|
111
|
+
|
112
|
+
def execute(self, source: str) -> ExecutionResult:
|
113
|
+
self._result_stack = []
|
114
|
+
self._result_data_stack = []
|
115
|
+
|
116
|
+
self._success = None
|
117
|
+
try:
|
118
|
+
self._shadow_marker = str(uuid4())
|
119
|
+
|
120
|
+
html_result = Element("div", classes=["robot-results"])
|
121
|
+
|
122
|
+
with html_result.tag(
|
123
|
+
"div", attributes={"data-shadow-marker": self._shadow_marker}, styles={"display": "none"}
|
124
|
+
):
|
125
|
+
pass
|
126
|
+
|
127
|
+
outer_test: Optional[Element] = None
|
128
|
+
with html_result.tag("div", classes=["result_body"]) as body:
|
129
|
+
with body.tag("div", classes=["test"]) as test:
|
130
|
+
with test.tag("div", classes=["children"], styles={"display": "block"}):
|
131
|
+
pass
|
132
|
+
outer_test = test
|
133
|
+
|
134
|
+
self._html_result = outer_test
|
135
|
+
self._result_data = RootResultData()
|
136
|
+
|
137
|
+
self.executed.clear()
|
138
|
+
|
139
|
+
self._code.append(source)
|
140
|
+
self.has_input.set()
|
141
|
+
|
142
|
+
self.executed.wait()
|
143
|
+
|
144
|
+
return ExecutionResult(
|
145
|
+
self._success,
|
146
|
+
(
|
147
|
+
[
|
148
|
+
ExecutionOutput(
|
149
|
+
"x-application/robotframework-repl-log", as_json(self._result_data, compact=True)
|
150
|
+
),
|
151
|
+
ExecutionOutput(
|
152
|
+
"x-application/robotframework-repl-html", html_result.as_str(only_children=True)
|
153
|
+
),
|
154
|
+
]
|
155
|
+
if self._success is not None
|
156
|
+
else []
|
157
|
+
),
|
158
|
+
)
|
159
|
+
except BaseException as e:
|
160
|
+
return ExecutionResult(False, [ExecutionOutput("application/vnd.code.notebook.stderr", str(e))])
|
161
|
+
|
162
|
+
def get_input(self) -> Iterator[Optional[Keyword]]:
|
163
|
+
while self._code:
|
164
|
+
s = self._code.pop(0)
|
165
|
+
test, errors = self.get_test_body_from_string(s)
|
166
|
+
if errors:
|
167
|
+
raise CellInputError(errors)
|
168
|
+
|
169
|
+
for kw in test.body:
|
170
|
+
yield kw
|
171
|
+
|
172
|
+
def log_message(
|
173
|
+
self, message: str, level: str, html: Union[str, bool] = False, timestamp: Union[datetime, str, None] = None
|
174
|
+
) -> None:
|
175
|
+
if self._result_data is not None and isinstance(self._result_data, ResultDataWithChildren):
|
176
|
+
self._result_data.items.append(
|
177
|
+
MessageData(
|
178
|
+
id=f"message-{len(self._result_data.items)}",
|
179
|
+
message=message,
|
180
|
+
level=level,
|
181
|
+
html=is_true(html),
|
182
|
+
timestamp=timestamp.strftime("%H:%M:%S") if isinstance(timestamp, datetime) else str(timestamp),
|
183
|
+
)
|
184
|
+
)
|
185
|
+
|
186
|
+
if level in ("DEBUG", "TRACE"):
|
187
|
+
return
|
188
|
+
|
189
|
+
if self._html_result is None:
|
190
|
+
return
|
191
|
+
|
192
|
+
items = next(
|
193
|
+
(
|
194
|
+
i
|
195
|
+
for i in self._html_result.children
|
196
|
+
if isinstance(i, Element) and i.tag_name == "div" and i.classes is not None and "children" in i.classes
|
197
|
+
),
|
198
|
+
None,
|
199
|
+
)
|
200
|
+
if items is None:
|
201
|
+
items = Element("div", classes=["children"])
|
202
|
+
self._html_result.add_element(items)
|
203
|
+
|
204
|
+
id = f"message-{len(items.children)}"
|
205
|
+
|
206
|
+
message_data = create_message_html(id, message, level, html, timestamp, shadow_root_id=self._shadow_marker)
|
207
|
+
items.add_element(message_data)
|
208
|
+
|
209
|
+
def message(
|
210
|
+
self, message: str, level: str, html: Union[str, bool] = False, timestamp: Union[datetime, str, None] = None
|
211
|
+
) -> None:
|
212
|
+
if not self.collect_messages:
|
213
|
+
return
|
214
|
+
|
215
|
+
if self._result_data is not None and isinstance(self._result_data, ResultDataWithChildren):
|
216
|
+
self._result_data.items.append(
|
217
|
+
MessageData(
|
218
|
+
id=f"message-{len(self._result_data.items)}",
|
219
|
+
message=message,
|
220
|
+
level=level,
|
221
|
+
html=is_true(html),
|
222
|
+
timestamp=timestamp.strftime("%H:%M:%S") if isinstance(timestamp, datetime) else str(timestamp),
|
223
|
+
)
|
224
|
+
)
|
225
|
+
|
226
|
+
def start_keyword(self, data: "running.Keyword", result: "result.Keyword") -> None:
|
227
|
+
if data.type in ["IF/ELSE ROOT", "TRY/EXCEPT ROOT"]:
|
228
|
+
return
|
229
|
+
if self._result_data is not None:
|
230
|
+
kw_data = KeywordResultData(
|
231
|
+
id=result.id,
|
232
|
+
name=result.name if getattr(result, "name", None) else "",
|
233
|
+
owner=result.owner if getattr(result, "owner", None) else "",
|
234
|
+
source_name=result.source_name if getattr(result, "source_name", None) else "",
|
235
|
+
doc=result.doc if getattr(result, "doc", None) else "",
|
236
|
+
args=list(result.args) if getattr(result, "args", None) else [],
|
237
|
+
assign=list(result.assign) if getattr(result, "assign", None) else [],
|
238
|
+
tags=list(result.tags) if getattr(result, "tags", None) else [],
|
239
|
+
timeout=result.timeout if getattr(result, "timeout", None) else None,
|
240
|
+
type=result.type,
|
241
|
+
status=result.status,
|
242
|
+
message=result.message,
|
243
|
+
start_time=result.starttime,
|
244
|
+
end_time=result.endtime,
|
245
|
+
elapsed_time=result.elapsedtime,
|
246
|
+
)
|
247
|
+
if self._result_data is not None and isinstance(self._result_data, ResultDataWithChildren):
|
248
|
+
self._result_data.items.append(kw_data)
|
249
|
+
self._result_data_stack.append(self._result_data)
|
250
|
+
self._result_data = kw_data
|
251
|
+
|
252
|
+
if self._html_result is not None:
|
253
|
+
self._result_stack.append(self._html_result)
|
254
|
+
kw = self.create_keyword_html_element(result)
|
255
|
+
|
256
|
+
children = next(
|
257
|
+
(
|
258
|
+
i
|
259
|
+
for i in self._html_result.children
|
260
|
+
if isinstance(i, Element)
|
261
|
+
and i.tag_name == "div"
|
262
|
+
and i.classes is not None
|
263
|
+
and "children" in i.classes
|
264
|
+
),
|
265
|
+
None,
|
266
|
+
)
|
267
|
+
|
268
|
+
if children is None:
|
269
|
+
self._html_result.add_element(kw)
|
270
|
+
else:
|
271
|
+
children.add_element(kw)
|
272
|
+
|
273
|
+
self._html_result = kw
|
274
|
+
|
275
|
+
def end_keyword(self, data: "running.Keyword", result: "result.Keyword") -> None:
|
276
|
+
if data.type in ["IF/ELSE ROOT", "TRY/EXCEPT ROOT"]:
|
277
|
+
return
|
278
|
+
if self._result_data is not None:
|
279
|
+
if isinstance(self._result_data, KeywordResultData):
|
280
|
+
self._result_data.end_time = result.endtime
|
281
|
+
self._result_data.elapsed_time = result.elapsedtime
|
282
|
+
self._result_data.status = result.status
|
283
|
+
self._result_data.message = result.message
|
284
|
+
|
285
|
+
self._result_data = self._result_data_stack.pop()
|
286
|
+
|
287
|
+
if result.status == "FAIL":
|
288
|
+
self._success = False
|
289
|
+
elif result.status == "PASS" and self.last_result is not False:
|
290
|
+
self._success = True
|
291
|
+
|
292
|
+
if self._html_result is not None and isinstance(self._html_result, Element):
|
293
|
+
kw = self.create_keyword_html_element(result)
|
294
|
+
|
295
|
+
old_children = next(
|
296
|
+
(
|
297
|
+
i
|
298
|
+
for i in self._html_result.children
|
299
|
+
if isinstance(i, Element)
|
300
|
+
and i.tag_name == "div"
|
301
|
+
and i.classes is not None
|
302
|
+
and "children" in i.classes
|
303
|
+
),
|
304
|
+
None,
|
305
|
+
)
|
306
|
+
if old_children is not None:
|
307
|
+
new_children = next(
|
308
|
+
(
|
309
|
+
i
|
310
|
+
for i in kw.children
|
311
|
+
if isinstance(i, Element)
|
312
|
+
and i.tag_name == "div"
|
313
|
+
and i.classes is not None
|
314
|
+
and "children" in i.classes
|
315
|
+
),
|
316
|
+
None,
|
317
|
+
)
|
318
|
+
if new_children is None:
|
319
|
+
new_children = Element("div", classes=["children"])
|
320
|
+
self._html_result.add_element(new_children)
|
321
|
+
|
322
|
+
for old_child in old_children.children:
|
323
|
+
if not (
|
324
|
+
isinstance(old_child, Element)
|
325
|
+
and old_child.tag_name == "table"
|
326
|
+
and old_child.classes is not None
|
327
|
+
and "metadata" in old_child.classes
|
328
|
+
):
|
329
|
+
new_children.add_element(old_child)
|
330
|
+
|
331
|
+
self._html_result.children = kw.children
|
332
|
+
|
333
|
+
self._html_result = self._result_stack.pop()
|
334
|
+
|
335
|
+
def create_keyword_html_element(self, result: "result.Keyword") -> Element:
|
336
|
+
return create_keyword_html(
|
337
|
+
id=result.id,
|
338
|
+
name=result.name if getattr(result, "name", None) else None,
|
339
|
+
owner=result.owner if getattr(result, "owner", None) else None,
|
340
|
+
source_name=result.source_name if getattr(result, "source_name", None) else None,
|
341
|
+
doc=result.doc if getattr(result, "doc", None) else None,
|
342
|
+
args=result.args if getattr(result, "args", None) else (),
|
343
|
+
assign=result.assign if getattr(result, "assign", None) else (),
|
344
|
+
tags=result.tags if getattr(result, "tags", None) else (),
|
345
|
+
timeout=result.timeout if getattr(result, "timeout", None) else None,
|
346
|
+
type=result.type,
|
347
|
+
status=result.status,
|
348
|
+
message=result.message,
|
349
|
+
start_time=result.starttime,
|
350
|
+
end_time=result.endtime,
|
351
|
+
elapsed_time=result.elapsedtime,
|
352
|
+
shadow_root_id=self._shadow_marker,
|
353
|
+
)
|
354
|
+
|
355
|
+
def run_input(self) -> None:
|
356
|
+
self.has_input.wait()
|
357
|
+
if self._has_shutdown:
|
358
|
+
self.executed.set()
|
359
|
+
raise EOFError
|
360
|
+
|
361
|
+
try:
|
362
|
+
return super().run_input()
|
363
|
+
finally:
|
364
|
+
self.has_input.clear()
|
365
|
+
self.executed.set()
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import sys
|
2
|
+
from typing import Optional
|
3
|
+
|
4
|
+
from robotcode.jsonrpc2.protocol import JsonRPCProtocol, rpc_method
|
5
|
+
|
6
|
+
from .interpreter import ExecutionResult, Interpreter
|
7
|
+
|
8
|
+
|
9
|
+
class ReplServerProtocol(JsonRPCProtocol):
|
10
|
+
def __init__(self, interpreter: Interpreter):
|
11
|
+
super().__init__()
|
12
|
+
self.interpreter = interpreter
|
13
|
+
self._is_shutdown = False
|
14
|
+
|
15
|
+
@rpc_method(name="initialize", threaded=True)
|
16
|
+
def initialize(self, message: str) -> str:
|
17
|
+
return "yeah initialized " + message
|
18
|
+
|
19
|
+
@rpc_method(name="executeCell", threaded=True)
|
20
|
+
def execute_cell(self, source: str) -> Optional[ExecutionResult]:
|
21
|
+
return self.interpreter.execute(source)
|
22
|
+
|
23
|
+
@rpc_method(name="shutdown", threaded=True)
|
24
|
+
def shutdown(self) -> None:
|
25
|
+
try:
|
26
|
+
self.interpreter.shutdown()
|
27
|
+
finally:
|
28
|
+
self._is_shutdown = True
|
29
|
+
|
30
|
+
@rpc_method(name="exit", threaded=True)
|
31
|
+
def exit(self) -> None:
|
32
|
+
sys.exit(0 if self._is_shutdown else 1)
|
@@ -0,0 +1 @@
|
|
1
|
+
# Marker file for PEP 561.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
from robotcode.core.types import ServerMode, TcpParams
|
4
|
+
from robotcode.jsonrpc2.server import JsonRPCServer
|
5
|
+
|
6
|
+
from .interpreter import Interpreter
|
7
|
+
from .protocol import ReplServerProtocol
|
8
|
+
|
9
|
+
TCP_DEFAULT_PORT = 6601
|
10
|
+
|
11
|
+
|
12
|
+
class ReplServer(JsonRPCServer[ReplServerProtocol]):
|
13
|
+
def __init__(
|
14
|
+
self,
|
15
|
+
interpreter: Interpreter,
|
16
|
+
mode: ServerMode = ServerMode.STDIO,
|
17
|
+
tcp_params: TcpParams = TcpParams(None, TCP_DEFAULT_PORT),
|
18
|
+
pipe_name: Optional[str] = None,
|
19
|
+
):
|
20
|
+
super().__init__(mode=mode, tcp_params=tcp_params, pipe_name=pipe_name)
|
21
|
+
self.interpreter = interpreter
|
22
|
+
|
23
|
+
def create_protocol(self) -> ReplServerProtocol:
|
24
|
+
return ReplServerProtocol(self.interpreter)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: robotcode-repl-server
|
3
|
+
Version: 0.100.0
|
4
|
+
Summary: RobotCode REPL Server for Robot Framework
|
5
|
+
Project-URL: Homepage, https://robotcode.io
|
6
|
+
Project-URL: Donate, https://opencollective.com/robotcode
|
7
|
+
Project-URL: Documentation, https://github.com/robotcodedev/robotcode#readme
|
8
|
+
Project-URL: Changelog, https://github.com/robotcodedev/robotcode/blob/main/CHANGELOG.md
|
9
|
+
Project-URL: Issues, https://github.com/robotcodedev/robotcode/issues
|
10
|
+
Project-URL: Source, https://github.com/robotcodedev/robotcode
|
11
|
+
Author-email: Daniel Biehl <dbiehl@live.de>
|
12
|
+
License: Apache-2.0
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
14
|
+
Classifier: Framework :: Robot Framework
|
15
|
+
Classifier: Framework :: Robot Framework :: Tool
|
16
|
+
Classifier: Operating System :: OS Independent
|
17
|
+
Classifier: Programming Language :: Python
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
22
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
24
|
+
Classifier: Topic :: Utilities
|
25
|
+
Classifier: Typing :: Typed
|
26
|
+
Requires-Python: >=3.8
|
27
|
+
Requires-Dist: robotcode-jsonrpc2==0.100.0
|
28
|
+
Requires-Dist: robotcode-runner==0.100.0
|
29
|
+
Description-Content-Type: text/markdown
|
30
|
+
|
31
|
+
# robotcode-repl-server
|
32
|
+
|
33
|
+
[![PyPI - Version](https://img.shields.io/pypi/v/robotcode-repl.svg)](https://pypi.org/project/robotcode-repl-server)
|
34
|
+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/robotcode-repl.svg)](https://pypi.org/project/robotcode-repl-server)
|
35
|
+
[![License](https://img.shields.io/github/license/robotcodedev/robotcode?style=flat&logo=apache)](https://github.com/robotcodedev/robotcode/blob/master/LICENSE.txt)
|
36
|
+
|
37
|
+
-----
|
38
|
+
|
39
|
+
## Introduction
|
40
|
+
|
41
|
+
Some classes for [RobotCode](https://robotcode.io) plugin management
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
```console
|
46
|
+
pip install robotcode-repl-server
|
47
|
+
```
|
48
|
+
|
49
|
+
## License
|
50
|
+
|
51
|
+
`robotcode-repl-server` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
robotcode/repl_server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
robotcode/repl_server/__version__.py,sha256=hBw9-oaz7x5BBjFEByYUTbik88urWGwnI3lE91SfgJ8,24
|
3
|
+
robotcode/repl_server/cli.py,sha256=yxgD_4QFwRD-BSGxto3MeimKess5_KZWkUJldERBsSk,5970
|
4
|
+
robotcode/repl_server/hooks.py,sha256=4O9H8cefHc6T7erjPxzU941w3KWytTBB5gmvYb4bs_I,196
|
5
|
+
robotcode/repl_server/html_writer.py,sha256=fr-6kSobkhqfYPGlOgBuAs-CSln-lkAwYsxc8_nb79Y,11647
|
6
|
+
robotcode/repl_server/interpreter.py,sha256=5Xgr2bACjU2-hOvZYe2p4MP4c9K3XivsUpyFd6Vbrz4,12557
|
7
|
+
robotcode/repl_server/protocol.py,sha256=4Eeoz45DfkKuzMZ7NJed8x0m0SWJdKkeFbnuO3e6DgQ,980
|
8
|
+
robotcode/repl_server/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
|
9
|
+
robotcode/repl_server/server.py,sha256=zzFsD6ds56d4GQJKXoysVZP-oiS08AtMKeyLKXH9Fss,746
|
10
|
+
robotcode_repl_server-0.100.0.dist-info/METADATA,sha256=bmZLDzfC8G0bzbErMpkhrSXI6KGukLBHIdrtOfRjPg4,2112
|
11
|
+
robotcode_repl_server-0.100.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
12
|
+
robotcode_repl_server-0.100.0.dist-info/entry_points.txt,sha256=U_1iYu71VNyPq_epO0fXHki3B4BE4gR2mbZFAOWN1cg,54
|
13
|
+
robotcode_repl_server-0.100.0.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
|
14
|
+
robotcode_repl_server-0.100.0.dist-info/RECORD,,
|
@@ -0,0 +1,73 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
10
|
+
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
12
|
+
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
14
|
+
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
16
|
+
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
18
|
+
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
20
|
+
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
22
|
+
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
24
|
+
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
26
|
+
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
28
|
+
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
30
|
+
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
32
|
+
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
34
|
+
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
36
|
+
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
38
|
+
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
40
|
+
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
42
|
+
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
44
|
+
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
46
|
+
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
48
|
+
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
50
|
+
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
52
|
+
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
54
|
+
|
55
|
+
END OF TERMS AND CONDITIONS
|
56
|
+
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
58
|
+
|
59
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
60
|
+
|
61
|
+
Copyright [yyyy] [name of copyright owner]
|
62
|
+
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
64
|
+
you may not use this file except in compliance with the License.
|
65
|
+
You may obtain a copy of the License at
|
66
|
+
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
68
|
+
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
72
|
+
See the License for the specific language governing permissions and
|
73
|
+
limitations under the License.
|