Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3f9e40

Browse files
committed
AddKeywordName andKeywordArguments
These types are used with keywords executing other keywords to typenames and arguments of the executed keywords, respectively. Externaltools can recognize arguments using these types and handle themaccordingly.Fixes#4857.
1 parentd2df55a commitb3f9e40

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

‎src/robot/api/types.py‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
"""Typesfor libraries and other extensions.
16+
"""Typesthat libraries and other extensions can utilize.
1717
18-
Currently only exposes the :class:`~robot.utils.secret.Secret` type.
18+
- The :class:`~robot.utils.secret.Secret` class is used for encapsulating
19+
passwords, tokens and other such secret information.
20+
21+
- :class:`KeywordName` and :class:`KeywordArguments` is used in type hints
22+
with keywords executing other keywords. External tools can recognize
23+
arguments using these types and handle them adequately.
1924
2025
New in Robot Framework 7.4.
2126
"""
2227

2328
fromrobot.utils.secretimportSecretasSecret
29+
30+
31+
classKeywordName(str):
32+
"""Name of a keyword executed by another keyword."""
33+
34+
35+
classKeywordArgument:
36+
"""Argument of a keyword executed by another keyword."""

‎src/robot/libraries/BuiltIn.py‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
fromtypingimportAny,Callable,Iterator,Literal,NoReturn
2222

2323
fromrobot.apiimportlogger,SkipExecution
24+
fromrobot.api.decoimportlibrary
25+
fromrobot.api.typesimportKeywordArgument,KeywordName
2426
fromrobot.errorsimport (
2527
BreakLoop,ContinueLoop,DataError,ExecutionFailed,ExecutionFailures,
2628
ExecutionPassed,PassExecution,ReturnFromKeyword,VariableError
@@ -43,13 +45,8 @@
4345

4446
from .normalizerimportNormalizer,StripSpaces
4547

46-
# Type aliases representing names and arguments of keywords executed dynamically
47-
# by `Run Keyword` and other similar keywords. We may want to replace these with
48-
# concrete types in the future.
49-
KeywordName=str
50-
KeywordArgument=object
5148
# Type alias for expressions that are evaluated in Python. We may want to replace
52-
# this with a concrete type with custom type documentation later.
49+
# this with a concrete type withacustom type documentation.
5350
Expression=object
5451

5552

@@ -4249,6 +4246,13 @@ def get_library_instance(
42494246
raiseRuntimeError(str(err))
42504247

42514248

4249+
@library(
4250+
converters={
4251+
KeywordName:lambdavalue:str(value),
4252+
KeywordArgument:lambdavalue:value,
4253+
},
4254+
auto_keywords=True,
4255+
)
42524256
classBuiltIn(_Verify,_Converter,_Variables,_RunKeyword,_Control,_Misc):
42534257
r"""An always available standard library with often needed keywords.
42544258

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp