robotframework-pythonlibcore
Advanced tools
+109
-50
| Metadata-Version: 2.4 | ||
| Name: robotframework-pythonlibcore | ||
| Version: 4.5.1 | ||
| Version: 4.6.0 | ||
| Summary: Tools to ease creating larger test libraries for Robot Framework using Python. | ||
| Home-page: https://github.com/robotframework/PythonLibCore | ||
| Author: Tatu Aalto | ||
| Author-email: aalto.tatu@gmail.com | ||
| License: Apache License 2.0 | ||
| Keywords: robotframework testing testautomation library development | ||
| Platform: any | ||
| Author-email: Tatu Aalto <aalto.tatu@gmail.com> | ||
| License-Expression: Apache-2.0 | ||
| Project-URL: Homepage, https://github.com/robotframework/PythonLibCore | ||
| Keywords: robotframework,testing,testautomation,library,development | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
| Classifier: License :: OSI Approved :: Apache Software License | ||
| Classifier: Operating System :: OS Independent | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.11 | ||
| Classifier: Programming Language :: Python :: 3 :: Only | ||
@@ -24,17 +16,6 @@ Classifier: Programming Language :: Python :: Implementation :: CPython | ||
| Classifier: Framework :: Robot Framework | ||
| Requires-Python: >=3.8, <4 | ||
| Requires-Python: <4,>=3.10 | ||
| Description-Content-Type: text/markdown | ||
| License-File: LICENSE.txt | ||
| Dynamic: author | ||
| Dynamic: author-email | ||
| Dynamic: classifier | ||
| Dynamic: description | ||
| Dynamic: description-content-type | ||
| Dynamic: home-page | ||
| Dynamic: keywords | ||
| Dynamic: license | ||
| Dynamic: license-file | ||
| Dynamic: platform | ||
| Dynamic: requires-python | ||
| Dynamic: summary | ||
@@ -201,19 +182,21 @@ # Python Library Core | ||
| PLC supports translation of keywords names and documentation, but arguments names, tags and types | ||
| can not be currently translated. Translation is provided as a file containing | ||
| [Json](https://www.json.org/json-en.html) and as a | ||
| [Path](https://docs.python.org/3/library/pathlib.html) object. Translation is provided in | ||
| `translation` argument in the `HybridCore` or `DynamicCore` `__init__`. Providing translation | ||
| file is optional, also it is not mandatory to provide translation to all keyword. | ||
| PLC supports translation of keywords names and documentation. Translations must be provided in | ||
| the `translation` argument in the `HybridCore` or `DynamicCore` `__init__`, either as a | ||
| dictionary or through a [Path](https://docs.python.org/3/library/pathlib.html) to a | ||
| [JSON](https://www.json.org/json-en.html) file. Providing translation data is optional, also it | ||
| is not mandatory to provide translation to all keyword. | ||
| The keys of json are the methods names, not the keyword names, which implements keyword. Value | ||
| of key is json object which contains two keys: `name` and `doc`. `name` key contains the keyword | ||
| The keys of the dictionary are the methods names, not the keyword names, which implements keyword. | ||
| Values are objects which contains two keys: `name` and `doc`. `name` key contains the keyword | ||
| translated name and `doc` contains keyword translated documentation. Providing | ||
| `doc` and `name` is optional, example translation json file can only provide translations only | ||
| to keyword names or only to documentatin. But it is always recomended to provide translation to | ||
| `doc` and `name` is optional, i.e. translations data can also provide translations only | ||
| to keyword names or only to documentation. But it is always recommended to provide translation to | ||
| both `name` and `doc`. | ||
| Library class documentation and instance documetation has special keys, `__init__` key will | ||
| replace instance documentation and `__intro__` will replace libary class documentation. | ||
| Library class documentation and instance documentation has special keys, `__init__` key will | ||
| replace instance documentation and `__intro__` will replace library class documentation. | ||
| > [!NOTE] | ||
| > Arguments names, tags and types can not be currently translated. | ||
| ## Example | ||
@@ -223,4 +206,2 @@ | ||
| ```python | ||
| from pathlib import Path | ||
| from robotlibcore import DynamicCore, keyword | ||
@@ -231,5 +212,5 @@ | ||
| def __init__(self, translation: Path): | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| DynamicCore.__init__(self, [], translation.absolute()) | ||
| DynamicCore.__init__(self, []) | ||
@@ -258,4 +239,18 @@ @keyword(tags=["tag1", "tag2"]) | ||
| And when there is translation file like: | ||
| ```json | ||
| And we want to translate it as follows: | ||
| - keyword `normal_keyword` to `other_name` | ||
| - its documentation to `This is new doc` | ||
| - keyword `name_changed` to `name_changed_again` | ||
| - its documentation to `This is also replaced.\n\nnew line.`. | ||
| - the library constructor documentation to `Replaces init docs with this one.` | ||
| - the library documentation to `New __intro__ documentation is here.` | ||
| ### Provide Translation As File | ||
| To provide the translation as a file, simply pass the path to a JSON file containing the translations: | ||
| ```jsonc | ||
| // my_translation.json | ||
| { | ||
@@ -277,10 +272,74 @@ "normal_keyword": { | ||
| "doc": "New __intro__ documentation is here." | ||
| }, | ||
| } | ||
| } | ||
| ``` | ||
| Then `normal_keyword` is translated to `other_name`. Also this keyword documentions is | ||
| translted to `This is new doc`. The keyword is `name_changed` is translted to | ||
| `name_changed_again` keyword and keyword documentation is translted to | ||
| `This is also replaced.\n\nnew line.`. The library class documentation is translated | ||
| to `Replaces init docs with this one.` and class documentation is translted to | ||
| `New __intro__ documentation is here.` | ||
| ```python | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| DynamicCore.__init__(self, [], translation=Path("/path/to/my_translation.json")) | ||
| # ... | ||
| ``` | ||
| > [!IMPORTANT] | ||
| > Translation files passed as paths must always be in JSON format. | ||
| ### Provide Translation As Dictionary | ||
| You can also pass the translation data as a dictionary: | ||
| ```python | ||
| import json | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| translation_data = json.loads(Path("/path/to/my_translation.json").read_text(encoding="utf-8")) | ||
| DynamicCore.__init__(self, [], translation=translation_data) | ||
| # ... | ||
| ``` | ||
| This also allows you to use other data formats such as YAML: | ||
| ```yaml | ||
| normal_keyword: | ||
| name: other_name | ||
| doc: This is new doc | ||
| name_changed: | ||
| name: name_changed_again | ||
| doc: | | ||
| This is also replaced. | ||
| new line. | ||
| __init__: | ||
| name: __init__ | ||
| doc: Replaces init docs with this one. | ||
| __intro__: | ||
| name: __intro__ | ||
| doc: New __intro__ documentation is here. | ||
| ``` | ||
| ```python | ||
| import yaml | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self, translation_file: Path): | ||
| """__init__ documentation.""" | ||
| translation_data = yaml.safe_load(translation_file.read_text(encoding="utf-8")) | ||
| DynamicCore.__init__(self, [], translation=translation_data) | ||
| # ... | ||
| ``` |
+36
-14
@@ -1,9 +0,39 @@ | ||
| [tool.black] | ||
| target-version = ['py38'] | ||
| line-length = 120 | ||
| [build-system] | ||
| requires = ["setuptools>=61"] | ||
| build-backend = "setuptools.build_meta" | ||
| [project] | ||
| name = "robotframework-pythonlibcore" | ||
| dynamic = ["version"] | ||
| authors = [ | ||
| {name = "Tatu Aalto", email = "aalto.tatu@gmail.com"}, | ||
| ] | ||
| description = "Tools to ease creating larger test libraries for Robot Framework using Python." | ||
| readme = "README.md" | ||
| license = "Apache-2.0" | ||
| keywords = ["robotframework", "testing", "testautomation", "library", "development"] | ||
| classifiers = [ | ||
| "Development Status :: 5 - Production/Stable", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3 :: Only", | ||
| "Programming Language :: Python :: Implementation :: CPython", | ||
| "Programming Language :: Python :: Implementation :: PyPy", | ||
| "Topic :: Software Development :: Testing", | ||
| "Framework :: Robot Framework", | ||
| ] | ||
| requires-python = ">=3.10, <4" | ||
| [project.urls] | ||
| Homepage = "https://github.com/robotframework/PythonLibCore" | ||
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
| [tool.setuptools.dynamic] | ||
| version = {attr = "robotlibcore.__version__"} | ||
| [tool.ruff] | ||
| line-length = 120 | ||
| target-version = "py310" | ||
| lint.fixable = ["ALL"] | ||
| target-version = "py38" | ||
| lint.select = [ | ||
@@ -22,4 +52,2 @@ "F", | ||
| "A", | ||
| "COM", | ||
| "CPY", | ||
| "C4", | ||
@@ -29,3 +57,2 @@ "T10", | ||
| "EXE", | ||
| # "FA", | ||
| "ISC", | ||
@@ -51,9 +78,4 @@ "ICN", | ||
| [tool.ruff.lint.extend-per-file-ignores] | ||
| "utest/*" = [ | ||
| "S", | ||
| "SLF", | ||
| "PLR", | ||
| "B018" | ||
| ] | ||
| [tool.ruff.lint.per-file-ignores] | ||
| "utest/*" = ["S", "SLF", "B018", "PLR"] | ||
@@ -60,0 +82,0 @@ [tool.ruff.lint.mccabe] |
+103
-25
@@ -161,19 +161,21 @@ # Python Library Core | ||
| PLC supports translation of keywords names and documentation, but arguments names, tags and types | ||
| can not be currently translated. Translation is provided as a file containing | ||
| [Json](https://www.json.org/json-en.html) and as a | ||
| [Path](https://docs.python.org/3/library/pathlib.html) object. Translation is provided in | ||
| `translation` argument in the `HybridCore` or `DynamicCore` `__init__`. Providing translation | ||
| file is optional, also it is not mandatory to provide translation to all keyword. | ||
| PLC supports translation of keywords names and documentation. Translations must be provided in | ||
| the `translation` argument in the `HybridCore` or `DynamicCore` `__init__`, either as a | ||
| dictionary or through a [Path](https://docs.python.org/3/library/pathlib.html) to a | ||
| [JSON](https://www.json.org/json-en.html) file. Providing translation data is optional, also it | ||
| is not mandatory to provide translation to all keyword. | ||
| The keys of json are the methods names, not the keyword names, which implements keyword. Value | ||
| of key is json object which contains two keys: `name` and `doc`. `name` key contains the keyword | ||
| The keys of the dictionary are the methods names, not the keyword names, which implements keyword. | ||
| Values are objects which contains two keys: `name` and `doc`. `name` key contains the keyword | ||
| translated name and `doc` contains keyword translated documentation. Providing | ||
| `doc` and `name` is optional, example translation json file can only provide translations only | ||
| to keyword names or only to documentatin. But it is always recomended to provide translation to | ||
| `doc` and `name` is optional, i.e. translations data can also provide translations only | ||
| to keyword names or only to documentation. But it is always recommended to provide translation to | ||
| both `name` and `doc`. | ||
| Library class documentation and instance documetation has special keys, `__init__` key will | ||
| replace instance documentation and `__intro__` will replace libary class documentation. | ||
| Library class documentation and instance documentation has special keys, `__init__` key will | ||
| replace instance documentation and `__intro__` will replace library class documentation. | ||
| > [!NOTE] | ||
| > Arguments names, tags and types can not be currently translated. | ||
| ## Example | ||
@@ -183,4 +185,2 @@ | ||
| ```python | ||
| from pathlib import Path | ||
| from robotlibcore import DynamicCore, keyword | ||
@@ -191,5 +191,5 @@ | ||
| def __init__(self, translation: Path): | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| DynamicCore.__init__(self, [], translation.absolute()) | ||
| DynamicCore.__init__(self, []) | ||
@@ -218,4 +218,18 @@ @keyword(tags=["tag1", "tag2"]) | ||
| And when there is translation file like: | ||
| ```json | ||
| And we want to translate it as follows: | ||
| - keyword `normal_keyword` to `other_name` | ||
| - its documentation to `This is new doc` | ||
| - keyword `name_changed` to `name_changed_again` | ||
| - its documentation to `This is also replaced.\n\nnew line.`. | ||
| - the library constructor documentation to `Replaces init docs with this one.` | ||
| - the library documentation to `New __intro__ documentation is here.` | ||
| ### Provide Translation As File | ||
| To provide the translation as a file, simply pass the path to a JSON file containing the translations: | ||
| ```jsonc | ||
| // my_translation.json | ||
| { | ||
@@ -237,10 +251,74 @@ "normal_keyword": { | ||
| "doc": "New __intro__ documentation is here." | ||
| }, | ||
| } | ||
| } | ||
| ``` | ||
| Then `normal_keyword` is translated to `other_name`. Also this keyword documentions is | ||
| translted to `This is new doc`. The keyword is `name_changed` is translted to | ||
| `name_changed_again` keyword and keyword documentation is translted to | ||
| `This is also replaced.\n\nnew line.`. The library class documentation is translated | ||
| to `Replaces init docs with this one.` and class documentation is translted to | ||
| `New __intro__ documentation is here.` | ||
| ```python | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| DynamicCore.__init__(self, [], translation=Path("/path/to/my_translation.json")) | ||
| # ... | ||
| ``` | ||
| > [!IMPORTANT] | ||
| > Translation files passed as paths must always be in JSON format. | ||
| ### Provide Translation As Dictionary | ||
| You can also pass the translation data as a dictionary: | ||
| ```python | ||
| import json | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| translation_data = json.loads(Path("/path/to/my_translation.json").read_text(encoding="utf-8")) | ||
| DynamicCore.__init__(self, [], translation=translation_data) | ||
| # ... | ||
| ``` | ||
| This also allows you to use other data formats such as YAML: | ||
| ```yaml | ||
| normal_keyword: | ||
| name: other_name | ||
| doc: This is new doc | ||
| name_changed: | ||
| name: name_changed_again | ||
| doc: | | ||
| This is also replaced. | ||
| new line. | ||
| __init__: | ||
| name: __init__ | ||
| doc: Replaces init docs with this one. | ||
| __intro__: | ||
| name: __intro__ | ||
| doc: New __intro__ documentation is here. | ||
| ``` | ||
| ```python | ||
| import yaml | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self, translation_file: Path): | ||
| """__init__ documentation.""" | ||
| translation_data = yaml.safe_load(translation_file.read_text(encoding="utf-8")) | ||
| DynamicCore.__init__(self, [], translation=translation_data) | ||
| # ... | ||
| ``` |
| Metadata-Version: 2.4 | ||
| Name: robotframework-pythonlibcore | ||
| Version: 4.5.1 | ||
| Version: 4.6.0 | ||
| Summary: Tools to ease creating larger test libraries for Robot Framework using Python. | ||
| Home-page: https://github.com/robotframework/PythonLibCore | ||
| Author: Tatu Aalto | ||
| Author-email: aalto.tatu@gmail.com | ||
| License: Apache License 2.0 | ||
| Keywords: robotframework testing testautomation library development | ||
| Platform: any | ||
| Author-email: Tatu Aalto <aalto.tatu@gmail.com> | ||
| License-Expression: Apache-2.0 | ||
| Project-URL: Homepage, https://github.com/robotframework/PythonLibCore | ||
| Keywords: robotframework,testing,testautomation,library,development | ||
| Classifier: Development Status :: 5 - Production/Stable | ||
| Classifier: License :: OSI Approved :: Apache Software License | ||
| Classifier: Operating System :: OS Independent | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.11 | ||
| Classifier: Programming Language :: Python :: 3 :: Only | ||
@@ -24,17 +16,6 @@ Classifier: Programming Language :: Python :: Implementation :: CPython | ||
| Classifier: Framework :: Robot Framework | ||
| Requires-Python: >=3.8, <4 | ||
| Requires-Python: <4,>=3.10 | ||
| Description-Content-Type: text/markdown | ||
| License-File: LICENSE.txt | ||
| Dynamic: author | ||
| Dynamic: author-email | ||
| Dynamic: classifier | ||
| Dynamic: description | ||
| Dynamic: description-content-type | ||
| Dynamic: home-page | ||
| Dynamic: keywords | ||
| Dynamic: license | ||
| Dynamic: license-file | ||
| Dynamic: platform | ||
| Dynamic: requires-python | ||
| Dynamic: summary | ||
@@ -201,19 +182,21 @@ # Python Library Core | ||
| PLC supports translation of keywords names and documentation, but arguments names, tags and types | ||
| can not be currently translated. Translation is provided as a file containing | ||
| [Json](https://www.json.org/json-en.html) and as a | ||
| [Path](https://docs.python.org/3/library/pathlib.html) object. Translation is provided in | ||
| `translation` argument in the `HybridCore` or `DynamicCore` `__init__`. Providing translation | ||
| file is optional, also it is not mandatory to provide translation to all keyword. | ||
| PLC supports translation of keywords names and documentation. Translations must be provided in | ||
| the `translation` argument in the `HybridCore` or `DynamicCore` `__init__`, either as a | ||
| dictionary or through a [Path](https://docs.python.org/3/library/pathlib.html) to a | ||
| [JSON](https://www.json.org/json-en.html) file. Providing translation data is optional, also it | ||
| is not mandatory to provide translation to all keyword. | ||
| The keys of json are the methods names, not the keyword names, which implements keyword. Value | ||
| of key is json object which contains two keys: `name` and `doc`. `name` key contains the keyword | ||
| The keys of the dictionary are the methods names, not the keyword names, which implements keyword. | ||
| Values are objects which contains two keys: `name` and `doc`. `name` key contains the keyword | ||
| translated name and `doc` contains keyword translated documentation. Providing | ||
| `doc` and `name` is optional, example translation json file can only provide translations only | ||
| to keyword names or only to documentatin. But it is always recomended to provide translation to | ||
| `doc` and `name` is optional, i.e. translations data can also provide translations only | ||
| to keyword names or only to documentation. But it is always recommended to provide translation to | ||
| both `name` and `doc`. | ||
| Library class documentation and instance documetation has special keys, `__init__` key will | ||
| replace instance documentation and `__intro__` will replace libary class documentation. | ||
| Library class documentation and instance documentation has special keys, `__init__` key will | ||
| replace instance documentation and `__intro__` will replace library class documentation. | ||
| > [!NOTE] | ||
| > Arguments names, tags and types can not be currently translated. | ||
| ## Example | ||
@@ -223,4 +206,2 @@ | ||
| ```python | ||
| from pathlib import Path | ||
| from robotlibcore import DynamicCore, keyword | ||
@@ -231,5 +212,5 @@ | ||
| def __init__(self, translation: Path): | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| DynamicCore.__init__(self, [], translation.absolute()) | ||
| DynamicCore.__init__(self, []) | ||
@@ -258,4 +239,18 @@ @keyword(tags=["tag1", "tag2"]) | ||
| And when there is translation file like: | ||
| ```json | ||
| And we want to translate it as follows: | ||
| - keyword `normal_keyword` to `other_name` | ||
| - its documentation to `This is new doc` | ||
| - keyword `name_changed` to `name_changed_again` | ||
| - its documentation to `This is also replaced.\n\nnew line.`. | ||
| - the library constructor documentation to `Replaces init docs with this one.` | ||
| - the library documentation to `New __intro__ documentation is here.` | ||
| ### Provide Translation As File | ||
| To provide the translation as a file, simply pass the path to a JSON file containing the translations: | ||
| ```jsonc | ||
| // my_translation.json | ||
| { | ||
@@ -277,10 +272,74 @@ "normal_keyword": { | ||
| "doc": "New __intro__ documentation is here." | ||
| }, | ||
| } | ||
| } | ||
| ``` | ||
| Then `normal_keyword` is translated to `other_name`. Also this keyword documentions is | ||
| translted to `This is new doc`. The keyword is `name_changed` is translted to | ||
| `name_changed_again` keyword and keyword documentation is translted to | ||
| `This is also replaced.\n\nnew line.`. The library class documentation is translated | ||
| to `Replaces init docs with this one.` and class documentation is translted to | ||
| `New __intro__ documentation is here.` | ||
| ```python | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| DynamicCore.__init__(self, [], translation=Path("/path/to/my_translation.json")) | ||
| # ... | ||
| ``` | ||
| > [!IMPORTANT] | ||
| > Translation files passed as paths must always be in JSON format. | ||
| ### Provide Translation As Dictionary | ||
| You can also pass the translation data as a dictionary: | ||
| ```python | ||
| import json | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self): | ||
| """__init__ documentation.""" | ||
| translation_data = json.loads(Path("/path/to/my_translation.json").read_text(encoding="utf-8")) | ||
| DynamicCore.__init__(self, [], translation=translation_data) | ||
| # ... | ||
| ``` | ||
| This also allows you to use other data formats such as YAML: | ||
| ```yaml | ||
| normal_keyword: | ||
| name: other_name | ||
| doc: This is new doc | ||
| name_changed: | ||
| name: name_changed_again | ||
| doc: | | ||
| This is also replaced. | ||
| new line. | ||
| __init__: | ||
| name: __init__ | ||
| doc: Replaces init docs with this one. | ||
| __intro__: | ||
| name: __intro__ | ||
| doc: New __intro__ documentation is here. | ||
| ``` | ||
| ```python | ||
| import yaml | ||
| from pathlib import Path | ||
| class SmallLibrary(DynamicCore): | ||
| """Library documentation.""" | ||
| def __init__(self, translation_file: Path): | ||
| """__init__ documentation.""" | ||
| translation_data = yaml.safe_load(translation_file.read_text(encoding="utf-8")) | ||
| DynamicCore.__init__(self, [], translation=translation_data) | ||
| # ... | ||
| ``` |
@@ -6,3 +6,2 @@ COPYRIGHT.txt | ||
| pyproject.toml | ||
| setup.py | ||
| src/robotframework_pythonlibcore.egg-info/PKG-INFO | ||
@@ -9,0 +8,0 @@ src/robotframework_pythonlibcore.egg-info/SOURCES.txt |
@@ -29,3 +29,3 @@ # Copyright 2017- Robot Framework Foundation | ||
| __version__ = "4.5.1" | ||
| __version__ = "4.6.0" | ||
@@ -32,0 +32,0 @@ __all__ = [ |
@@ -18,3 +18,3 @@ # Copyright 2017- Robot Framework Foundation | ||
| from pathlib import Path | ||
| from typing import Callable, List, Optional | ||
| from typing import Callable | ||
@@ -26,6 +26,6 @@ from robotlibcore.keywords import KeywordBuilder | ||
| class HybridCore: | ||
| def __init__(self, library_components: List, translation: Optional[Path] = None) -> None: | ||
| self.keywords = {} | ||
| self.keywords_spec = {} | ||
| self.attributes = {} | ||
| def __init__(self, library_components: list, translation: Path | dict | None = None) -> None: | ||
| self.keywords: dict = {} | ||
| self.keywords_spec: dict = {} | ||
| self.attributes: dict = {} | ||
| translation_data = _translation(translation) | ||
@@ -39,5 +39,5 @@ translated_kw_names = _translated_keywords(translation_data) | ||
| self, | ||
| library_components: List, | ||
| translation: Optional[dict] = None, | ||
| translated_kw_names: Optional[list] = None, | ||
| library_components: list, | ||
| translation: dict | None = None, | ||
| translated_kw_names: list | None = None, | ||
| ): | ||
@@ -64,3 +64,3 @@ translation = translation if translation else {} | ||
| return translation[name].get("name") | ||
| return func.robot_name or name | ||
| return getattr(func, "robot_name", None) or name | ||
@@ -67,0 +67,0 @@ def __replace_intro_doc(self, translation: dict): |
@@ -14,6 +14,6 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
| import inspect | ||
| from typing import Callable, Optional, get_type_hints | ||
| from typing import Callable, get_type_hints | ||
@@ -25,3 +25,3 @@ from .specification import KeywordSpecification | ||
| @classmethod | ||
| def build(cls, function, translation: Optional[dict] = None): | ||
| def build(cls, function, translation: dict | None = None): | ||
| translation = translation if translation else {} | ||
@@ -151,2 +151,2 @@ return KeywordSpecification( | ||
| names = arg_spec.args[-len(arg_spec.defaults) :] | ||
| return zip(names, arg_spec.defaults) | ||
| return zip(names, arg_spec.defaults, strict=False) |
@@ -14,2 +14,3 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
@@ -16,0 +17,0 @@ |
@@ -14,2 +14,3 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
@@ -16,0 +17,0 @@ from .parser import PluginParser |
@@ -14,8 +14,9 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
| import inspect | ||
| from typing import Any, List, Optional, Union | ||
| from typing import Any | ||
| from robot.errors import DataError | ||
| from robot.utils import Importer | ||
| from robot.errors import DataError # type: ignore | ||
| from robot.utils import Importer # type: ignore | ||
@@ -27,7 +28,7 @@ from robotlibcore.core import DynamicCore | ||
| class PluginParser: | ||
| def __init__(self, base_class: Optional[Any] = None, python_object=None) -> None: | ||
| def __init__(self, base_class: Any | None = None, python_object=None) -> None: | ||
| self._base_class = base_class | ||
| self._python_object = python_object if python_object else [] | ||
| def parse_plugins(self, plugins: Union[str, List[str]]) -> List: | ||
| def parse_plugins(self, plugins: str | list[str]) -> list: | ||
| imported_plugins = [] | ||
@@ -48,6 +49,6 @@ importer = Importer("test library") | ||
| def get_plugin_keywords(self, plugins: List): | ||
| def get_plugin_keywords(self, plugins: list): | ||
| return DynamicCore(plugins).get_keyword_names() | ||
| def _string_to_modules(self, modules: Union[str, List[str]]): | ||
| def _string_to_modules(self, modules: str | list[str]): | ||
| parsed_modules: list = [] | ||
@@ -70,3 +71,3 @@ if not modules: | ||
| def _modules_splitter(self, modules: Union[str, List[str]]): | ||
| def _modules_splitter(self, modules: str | list[str]): | ||
| if isinstance(modules, str): | ||
@@ -73,0 +74,0 @@ for module in modules.split(","): |
@@ -14,2 +14,3 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
@@ -16,0 +17,0 @@ from dataclasses import dataclass |
@@ -14,2 +14,3 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
@@ -16,0 +17,0 @@ |
@@ -14,7 +14,6 @@ # Copyright 2017- Robot Framework Foundation | ||
| # limitations under the License. | ||
| from __future__ import annotations | ||
| import json | ||
| from pathlib import Path | ||
| from typing import Optional | ||
@@ -24,4 +23,4 @@ from robot.api import logger | ||
| def _translation(translation: Optional[Path] = None): | ||
| if translation and isinstance(translation, Path) and translation.is_file(): | ||
| def _translation(translation: Path | dict | None = None): | ||
| if isinstance(translation, Path) and translation.is_file(): | ||
| with translation.open("r", encoding="utf-8") as file: | ||
@@ -33,2 +32,4 @@ try: | ||
| return {} | ||
| elif isinstance(translation, dict): | ||
| return translation | ||
| else: | ||
@@ -35,0 +36,0 @@ return {} |
-49
| #!/usr/bin/env python | ||
| import re | ||
| from pathlib import Path | ||
| from os.path import join | ||
| from setuptools import find_packages, setup | ||
| CURDIR = Path(__file__).parent | ||
| CLASSIFIERS = """ | ||
| Development Status :: 5 - Production/Stable | ||
| License :: OSI Approved :: Apache Software License | ||
| Operating System :: OS Independent | ||
| Programming Language :: Python :: 3 | ||
| Programming Language :: Python :: 3.8 | ||
| Programming Language :: Python :: 3.9 | ||
| Programming Language :: Python :: 3.10 | ||
| Programming Language :: Python :: 3.11 | ||
| Programming Language :: Python :: 3 :: Only | ||
| Programming Language :: Python :: Implementation :: CPython | ||
| Programming Language :: Python :: Implementation :: PyPy | ||
| Topic :: Software Development :: Testing | ||
| Framework :: Robot Framework | ||
| """.strip().splitlines() | ||
| version_file = Path(CURDIR / 'src' / 'robotlibcore' / '__init__.py') | ||
| VERSION = re.search('\n__version__ = "(.*)"', version_file.read_text()).group(1) | ||
| LONG_DESCRIPTION = Path(CURDIR / 'README.md').read_text() | ||
| DESCRIPTION = ('Tools to ease creating larger test libraries for ' | ||
| 'Robot Framework using Python.') | ||
| setup( | ||
| name = 'robotframework-pythonlibcore', | ||
| version = VERSION, | ||
| author = 'Tatu Aalto', | ||
| author_email = 'aalto.tatu@gmail.com', | ||
| url = 'https://github.com/robotframework/PythonLibCore', | ||
| license = 'Apache License 2.0', | ||
| description = DESCRIPTION, | ||
| long_description = LONG_DESCRIPTION, | ||
| long_description_content_type = "text/markdown", | ||
| keywords = 'robotframework testing testautomation library development', | ||
| platforms = 'any', | ||
| classifiers = CLASSIFIERS, | ||
| python_requires = '>=3.8, <4', | ||
| package_dir = {'': 'src'}, | ||
| packages = ["robotlibcore","robotlibcore.core", "robotlibcore.keywords", "robotlibcore.plugin", "robotlibcore.utils"] | ||
| ) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
69338
4.45%23
-4.17%559
-5.89%