forked from robotframework/PythonLibCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmallLibrary.py
More file actions
62 lines (50 loc) · 1.72 KB
/
Copy pathSmallLibrary.py
File metadata and controls
62 lines (50 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from pathlib import Path
from robot.api import logger
from robotlibcore import DynamicCore, keyword
class KeywordClass:
@keyword(name="Execute SomeThing")
def execute_something(self):
"""This is old"""
print("Name is here")
class SmallLibrary(DynamicCore):
"""Library documentation."""
def __init__(self, translation: Path | dict | None = None):
"""__init__ documentation."""
if isinstance(translation, (dict, Path)):
DynamicCore.__init__(self, [KeywordClass()], translation)
else:
logger.warn("Convert to Path")
translation = Path(translation)
DynamicCore.__init__(self, [KeywordClass()], translation.absolute())
@keyword(tags=["tag1", "tag2"])
def normal_keyword(self, arg: int, other: str) -> str:
"""I have doc
Multiple lines.
Other line.
"""
data = f"{arg} {other}"
print(data)
return data
def not_keyword(self, data: str) -> str:
print(data)
return data
@keyword(name="Name ChanGed", tags=["tag1", "tag2"])
def name_changed(self, some: int, other: int) -> int:
"""This one too"""
print(f"{some} {type(some)}, {other} {type(other)}")
return some + other
@keyword
def not_translated(seld, a: int) -> int:
"""This is not replaced."""
print(f"{a} {type(a)}")
return a + 1
@keyword
def doc_not_translated(seld, a: int) -> int:
"""This is not replaced also."""
print(f"{a} {type(a)}")
return a + 1
@keyword
def kw_not_translated(seld, a: int) -> int:
"""This is replaced too but name is not."""
print(f"{a} {type(a)}")
return a + 1