Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

robotframework-pythonlibcore

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robotframework-pythonlibcore - pypi Package Compare versions

Comparing version
4.1.0
to
4.1.1
+47
-1
PKG-INFO
Metadata-Version: 2.1
Name: robotframework-pythonlibcore
Version: 4.1.0
Version: 4.1.1
Summary: Tools to ease creating larger test libraries for Robot Framework using Python.

@@ -123,2 +123,48 @@ Home-page: https://github.com/robotframework/PythonLibCore

Plugin API
----------
It is possible to create plugin API to a library by using PythonLibCore. This allows extending library
with external Python classes. Plugins can be imported during library import time, example by defining argumet
in library `__init__` which allows defining the plugins. It is possible to define multiple plugins, by seperating
plugins with with comma. Also it is possible to provide arguments to plugin by seperating arguments with
semicolon.
.. sourcecode:: python
from robot.api.deco import keyword # noqa F401
from robotlibcore import DynamicCore, PluginParser
from mystuff import Library1, Library2
class PluginLib(DynamicCore):
def __init__(self, plugins):
plugin_parser = PluginParser()
libraries = [Library1(), Library2()]
parsed_plugins = plugin_parser.parse_plugins(plugins)
libraries.extend(parsed_plugins)
DynamicCore.__init__(self, libraries)
When plugin class can look like this:
.. sourcecode:: python
class MyPlugi:
@keyword
def plugin_keyword(self):
return 123
Then Library can be imported in Robot Framework side like this:
.. sourcecode:: bash
Library ${CURDIR}/PluginLib.py plugins=${CURDIR}/MyPlugin.py
.. _Robot Framework: http://robotframework.org

@@ -125,0 +171,0 @@ .. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary/

@@ -97,2 +97,48 @@ Python Library Core

Plugin API
----------
It is possible to create plugin API to a library by using PythonLibCore. This allows extending library
with external Python classes. Plugins can be imported during library import time, example by defining argumet
in library `__init__` which allows defining the plugins. It is possible to define multiple plugins, by seperating
plugins with with comma. Also it is possible to provide arguments to plugin by seperating arguments with
semicolon.
.. sourcecode:: python
from robot.api.deco import keyword # noqa F401
from robotlibcore import DynamicCore, PluginParser
from mystuff import Library1, Library2
class PluginLib(DynamicCore):
def __init__(self, plugins):
plugin_parser = PluginParser()
libraries = [Library1(), Library2()]
parsed_plugins = plugin_parser.parse_plugins(plugins)
libraries.extend(parsed_plugins)
DynamicCore.__init__(self, libraries)
When plugin class can look like this:
.. sourcecode:: python
class MyPlugi:
@keyword
def plugin_keyword(self):
return 123
Then Library can be imported in Robot Framework side like this:
.. sourcecode:: bash
Library ${CURDIR}/PluginLib.py plugins=${CURDIR}/MyPlugin.py
.. _Robot Framework: http://robotframework.org

@@ -99,0 +145,0 @@ .. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary/

Metadata-Version: 2.1
Name: robotframework-pythonlibcore
Version: 4.1.0
Version: 4.1.1
Summary: Tools to ease creating larger test libraries for Robot Framework using Python.

@@ -123,2 +123,48 @@ Home-page: https://github.com/robotframework/PythonLibCore

Plugin API
----------
It is possible to create plugin API to a library by using PythonLibCore. This allows extending library
with external Python classes. Plugins can be imported during library import time, example by defining argumet
in library `__init__` which allows defining the plugins. It is possible to define multiple plugins, by seperating
plugins with with comma. Also it is possible to provide arguments to plugin by seperating arguments with
semicolon.
.. sourcecode:: python
from robot.api.deco import keyword # noqa F401
from robotlibcore import DynamicCore, PluginParser
from mystuff import Library1, Library2
class PluginLib(DynamicCore):
def __init__(self, plugins):
plugin_parser = PluginParser()
libraries = [Library1(), Library2()]
parsed_plugins = plugin_parser.parse_plugins(plugins)
libraries.extend(parsed_plugins)
DynamicCore.__init__(self, libraries)
When plugin class can look like this:
.. sourcecode:: python
class MyPlugi:
@keyword
def plugin_keyword(self):
return 123
Then Library can be imported in Robot Framework side like this:
.. sourcecode:: bash
Library ${CURDIR}/PluginLib.py plugins=${CURDIR}/MyPlugin.py
.. _Robot Framework: http://robotframework.org

@@ -125,0 +171,0 @@ .. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary/

+8
-4

@@ -30,3 +30,3 @@ # Copyright 2017- Robot Framework Foundation

__version__ = "4.1.0"
__version__ = "4.1.1"

@@ -233,3 +233,3 @@

if arg_spec.varargs:
return ["*%s" % arg_spec.varargs]
return [f"*{arg_spec.varargs}"]
return []

@@ -239,3 +239,3 @@

def _get_kwargs(cls, arg_spec):
return ["**%s" % arg_spec.varkw] if arg_spec.varkw else []
return [f"**{arg_spec.varkw}"] if arg_spec.varkw else []

@@ -245,5 +245,9 @@ @classmethod

kw_only_args = []
kw_only_defaults = arg_spec.kwonlydefaults if arg_spec.kwonlydefaults else []
for arg in arg_spec.kwonlyargs:
if not arg_spec.kwonlydefaults or arg not in arg_spec.kwonlydefaults:
if not arg_spec.varargs and arg not in kw_only_defaults and not kw_only_args:
kw_only_args.append("*")
kw_only_args.append(arg)
elif arg not in kw_only_defaults:
kw_only_args.append(arg)
else:

@@ -250,0 +254,0 @@ value = arg_spec.kwonlydefaults.get(arg, "")