robotframework 6.1rc1__zip → 7.0__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotframework-6.1rc1 → robotframework-7.0}/INSTALL.rst +25 -25
- {robotframework-6.1rc1 → robotframework-7.0}/PKG-INFO +6 -8
- {robotframework-6.1rc1 → robotframework-7.0}/README.rst +3 -2
- {robotframework-6.1rc1 → robotframework-7.0}/setup.py +3 -6
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/api/__init__.py +4 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/api/deco.py +60 -14
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/api/exceptions.py +6 -6
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/api/interfaces.py +403 -68
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/api/logger.py +27 -20
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/api/parsing.py +4 -2
- robotframework-7.0/src/robot/api/py.typed +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/conf/gatherfailed.py +2 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/conf/languages.py +61 -25
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/conf/settings.py +21 -14
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/common/storage.js +11 -6
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/htmlfilewriter.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/libdoc/libdoc.css +10 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/libdoc/libdoc.html +10 -0
- robotframework-7.0/src/robot/htmldata/rebot/common.css +362 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/doc_formatting.css +13 -7
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/log.css +51 -10
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/log.html +14 -23
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/model.js +2 -4
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/report.css +83 -19
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/report.html +22 -7
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/testdata.js +10 -3
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/view.js +84 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/template.py +3 -3
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/builder.py +0 -8
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/datatypes.py +9 -10
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/htmlutils.py +4 -7
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/jsonbuilder.py +38 -20
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/model.py +21 -28
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/robotbuilder.py +50 -31
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/standardtypes.py +9 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/xmlbuilder.py +35 -20
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/xmlwriter.py +18 -38
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/BuiltIn.py +255 -205
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Collections.py +384 -240
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/DateTime.py +73 -60
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/OperatingSystem.py +6 -5
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Process.py +26 -27
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Remote.py +40 -36
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/String.py +66 -76
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/XML.py +66 -59
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/__init__.py +2 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/dialogs_py.py +14 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/__init__.py +5 -5
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/body.py +44 -13
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/configurer.py +19 -15
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/control.py +230 -88
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/filter.py +31 -25
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/itemlist.py +9 -8
- robotframework-7.0/src/robot/model/keyword.py +77 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/message.py +19 -10
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/modelobject.py +27 -15
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/modifier.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/namepatterns.py +3 -25
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/stats.py +9 -15
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/tags.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/testcase.py +15 -27
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/testsuite.py +44 -28
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/visitor.py +35 -8
- robotframework-7.0/src/robot/output/console/dotted.py +90 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/console/quiet.py +3 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/console/verbose.py +61 -61
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/debugfile.py +39 -24
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/filelogger.py +18 -15
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/librarylogger.py +3 -2
- robotframework-7.0/src/robot/output/listeners.py +753 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/logger.py +216 -80
- robotframework-7.0/src/robot/output/loggerapi.py +215 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/loggerhelper.py +23 -56
- robotframework-7.0/src/robot/output/output.py +185 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/stdoutlogsplitter.py +8 -5
- robotframework-7.0/src/robot/output/xmllogger.py +459 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/blocklexers.py +17 -13
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/context.py +12 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/lexer.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/settings.py +6 -3
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/statementlexers.py +39 -10
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/tokens.py +27 -29
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/model/blocks.py +19 -6
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/model/statements.py +193 -94
- robotframework-7.0/src/robot/parsing/model/visitor.py +100 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/rebot.py +2 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/expandkeywordmatcher.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/jsbuildingcontext.py +8 -6
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/jsmodelbuilders.py +88 -61
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/logreportwriters.py +16 -10
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/outputwriter.py +18 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/resultwriter.py +4 -4
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/stringcache.py +3 -3
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/xunitwriter.py +15 -21
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/__init__.py +3 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/configurer.py +12 -9
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/executionresult.py +56 -8
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/flattenkeywordmatcher.py +48 -9
- robotframework-7.0/src/robot/result/keywordremover.py +207 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/merger.py +1 -1
- robotframework-7.0/src/robot/result/model.py +1185 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/modeldeprecation.py +9 -3
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/resultbuilder.py +46 -36
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/xmlelementhandlers.py +83 -43
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/run.py +3 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/__init__.py +14 -4
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/__init__.py +2 -1
- robotframework-7.0/src/robot/running/arguments/argumentconverter.py +100 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/argumentmapper.py +26 -24
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/argumentparser.py +85 -61
- robotframework-7.0/src/robot/running/arguments/argumentresolver.py +158 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/argumentspec.py +83 -116
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/argumentvalidator.py +33 -27
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/customconverters.py +15 -12
- robotframework-7.0/src/robot/running/arguments/embedded.py +145 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/arguments/typeconverters.py +268 -220
- robotframework-7.0/src/robot/running/arguments/typeinfo.py +317 -0
- robotframework-7.0/src/robot/running/arguments/typeinfoparser.py +219 -0
- robotframework-7.0/src/robot/running/arguments/typevalidator.py +60 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/bodyrunner.py +147 -129
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/builder/builders.py +17 -26
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/builder/parsers.py +17 -11
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/builder/settings.py +9 -17
- robotframework-7.0/src/robot/running/builder/transformers.py +535 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/context.py +113 -31
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/dynamicmethods.py +62 -34
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/importer.py +27 -49
- robotframework-7.0/src/robot/running/invalidkeyword.py +67 -0
- robotframework-7.0/src/robot/running/keywordfinder.py +91 -0
- robotframework-7.0/src/robot/running/keywordimplementation.py +164 -0
- robotframework-7.0/src/robot/running/librarykeyword.py +392 -0
- robotframework-7.0/src/robot/running/librarykeywordrunner.py +250 -0
- robotframework-7.0/src/robot/running/libraryscopes.py +115 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/model.py +198 -337
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/namespace.py +124 -137
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/outputcapture.py +20 -12
- robotframework-7.0/src/robot/running/resourcemodel.py +448 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/statusreporter.py +16 -13
- robotframework-7.0/src/robot/running/suiterunner.py +265 -0
- robotframework-7.0/src/robot/running/testlibraries.py +500 -0
- robotframework-7.0/src/robot/running/userkeywordrunner.py +260 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/testdoc.py +18 -13
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/__init__.py +53 -35
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/connectioncache.py +64 -59
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/dotdict.py +3 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/encodingsniffer.py +9 -4
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/escaping.py +19 -19
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/importer.py +2 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/markupwriters.py +23 -15
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/misc.py +1 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/normalizing.py +9 -24
- robotframework-7.0/src/robot/utils/notset.py +33 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/platform.py +15 -5
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/robotio.py +9 -9
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/robotpath.py +1 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/robottime.py +122 -90
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/robottypes.py +21 -31
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/setter.py +0 -5
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/text.py +7 -4
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/unic.py +2 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/__init__.py +2 -2
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/assigner.py +17 -19
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/evaluation.py +20 -17
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/filesetter.py +80 -80
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/replacer.py +33 -36
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/scopes.py +17 -12
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/search.py +66 -41
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/store.py +14 -16
- robotframework-7.0/src/robot/variables/tablesetter.py +164 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/variables.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/version.py +1 -1
- {robotframework-6.1rc1 → robotframework-7.0}/src/robotframework.egg-info/PKG-INFO +6 -8
- {robotframework-6.1rc1 → robotframework-7.0}/src/robotframework.egg-info/SOURCES.txt +10 -8
- {robotframework-6.1rc1 → robotframework-7.0}/tasks.py +6 -6
- robotframework-6.1rc1/src/robot/htmldata/rebot/common.css +0 -239
- robotframework-6.1rc1/src/robot/libraries/Reserved.py +0 -48
- robotframework-6.1rc1/src/robot/model/keyword.py +0 -173
- robotframework-6.1rc1/src/robot/output/console/dotted.py +0 -90
- robotframework-6.1rc1/src/robot/output/listenerarguments.py +0 -165
- robotframework-6.1rc1/src/robot/output/listenermethods.py +0 -113
- robotframework-6.1rc1/src/robot/output/listeners.py +0 -174
- robotframework-6.1rc1/src/robot/output/output.py +0 -95
- robotframework-6.1rc1/src/robot/output/xmllogger.py +0 -354
- robotframework-6.1rc1/src/robot/parsing/model/visitor.py +0 -67
- robotframework-6.1rc1/src/robot/result/keywordremover.py +0 -183
- robotframework-6.1rc1/src/robot/result/model.py +0 -957
- robotframework-6.1rc1/src/robot/running/arguments/argumentconverter.py +0 -79
- robotframework-6.1rc1/src/robot/running/arguments/argumentresolver.py +0 -131
- robotframework-6.1rc1/src/robot/running/arguments/embedded.py +0 -146
- robotframework-6.1rc1/src/robot/running/arguments/typevalidator.py +0 -56
- robotframework-6.1rc1/src/robot/running/builder/transformers.py +0 -642
- robotframework-6.1rc1/src/robot/running/handlers.py +0 -321
- robotframework-6.1rc1/src/robot/running/handlerstore.py +0 -66
- robotframework-6.1rc1/src/robot/running/librarykeywordrunner.py +0 -238
- robotframework-6.1rc1/src/robot/running/libraryscopes.py +0 -97
- robotframework-6.1rc1/src/robot/running/modelcombiner.py +0 -32
- robotframework-6.1rc1/src/robot/running/suiterunner.py +0 -249
- robotframework-6.1rc1/src/robot/running/testlibraries.py +0 -420
- robotframework-6.1rc1/src/robot/running/usererrorhandler.py +0 -75
- robotframework-6.1rc1/src/robot/running/userkeyword.py +0 -111
- robotframework-6.1rc1/src/robot/running/userkeywordrunner.py +0 -274
- robotframework-6.1rc1/src/robot/variables/tablesetter.py +0 -156
- {robotframework-6.1rc1 → robotframework-7.0}/AUTHORS.rst +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/BUILD.rst +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/CONTRIBUTING.rst +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/COPYRIGHT.txt +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/LICENSE.txt +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/MANIFEST.in +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/setup.cfg +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/__main__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/conf/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/errors.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/common/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/common/js_disabled.css +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/jsonwriter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/lib/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.highlight.min.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.min.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.tablesorter.min.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.tmpl.min.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/lib/jsxcompressor.min.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/libdoc/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/libdoc/doc_formatting.css +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/libdoc/print.css +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/libdoc/pygments.css +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/fileloading.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/log.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/print.css +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/rebot/util.js +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/testdoc/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/testdoc/testdoc.css +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/htmldata/testdoc/testdoc.html +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdoc.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/consoleviewer.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/htmlwriter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/jsonwriter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/output.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libdocpkg/writer.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Dialogs.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Easter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Screenshot.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/libraries/Telnet.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/fixture.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/metadata.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/statistics.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/suitestatistics.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/tagsetter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/tagstatistics.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/model/totalstatistics.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/console/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/console/highlighting.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/output/pyloggingconf.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/lexer/tokenizer.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/model/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/parser/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/parser/blockparsers.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/parser/fileparser.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/parser/parser.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/parsing/suitestructure.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/pythonpathsetter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/jsexecutionresult.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/reporting/jswriter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/executionerrors.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/messagefilter.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/suiteteardownfailed.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/result/visitor.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/builder/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/randomizer.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/runkwregister.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/signalhandler.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/status.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/timeouts/__init__.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/timeouts/posix.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/running/timeouts/windows.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/application.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/argumentparser.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/asserts.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/charwidth.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/compress.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/encoding.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/error.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/etreewrapper.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/filereader.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/frange.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/htmlformatters.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/markuputils.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/match.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/recommendations.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/restreader.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/robotenv.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/robotinspect.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/sortable.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/utils/typehints.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/finders.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/notfound.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robot/variables/resolvable.py +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robotframework.egg-info/dependency_links.txt +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robotframework.egg-info/entry_points.txt +0 -0
- {robotframework-6.1rc1 → robotframework-7.0}/src/robotframework.egg-info/top_level.txt +0 -0
|
@@ -13,59 +13,62 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
from typing import TYPE_CHECKING
|
|
17
|
+
|
|
16
18
|
from robot.errors import DataError
|
|
17
19
|
|
|
20
|
+
if TYPE_CHECKING:
|
|
21
|
+
from .argumentspec import ArgumentSpec
|
|
22
|
+
|
|
18
23
|
|
|
19
24
|
class ArgumentMapper:
|
|
20
25
|
|
|
21
|
-
def __init__(self,
|
|
22
|
-
|
|
23
|
-
self._argspec = argspec
|
|
26
|
+
def __init__(self, arg_spec: 'ArgumentSpec'):
|
|
27
|
+
self.arg_spec = arg_spec
|
|
24
28
|
|
|
25
29
|
def map(self, positional, named, replace_defaults=True):
|
|
26
|
-
template = KeywordCallTemplate(self.
|
|
30
|
+
template = KeywordCallTemplate(self.arg_spec)
|
|
27
31
|
template.fill_positional(positional)
|
|
28
32
|
template.fill_named(named)
|
|
29
33
|
if replace_defaults:
|
|
30
34
|
template.replace_defaults()
|
|
31
|
-
return template.
|
|
35
|
+
return template.positional, template.named
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
class KeywordCallTemplate:
|
|
35
39
|
|
|
36
|
-
def __init__(self,
|
|
37
|
-
|
|
38
|
-
self.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
self.kwargs = []
|
|
40
|
+
def __init__(self, spec: 'ArgumentSpec'):
|
|
41
|
+
self.spec = spec
|
|
42
|
+
self.positional = [DefaultValue(spec.defaults[arg])
|
|
43
|
+
if arg in spec.defaults else None
|
|
44
|
+
for arg in spec.positional]
|
|
45
|
+
self.named = []
|
|
43
46
|
|
|
44
47
|
def fill_positional(self, positional):
|
|
45
|
-
self.
|
|
48
|
+
self.positional[:len(positional)] = positional
|
|
46
49
|
|
|
47
50
|
def fill_named(self, named):
|
|
48
|
-
spec = self.
|
|
51
|
+
spec = self.spec
|
|
49
52
|
for name, value in named:
|
|
50
53
|
if name in spec.positional_or_named:
|
|
51
54
|
index = spec.positional_or_named.index(name)
|
|
52
|
-
self.
|
|
55
|
+
self.positional[index] = value
|
|
53
56
|
elif spec.var_named or name in spec.named_only:
|
|
54
|
-
self.
|
|
57
|
+
self.named.append((name, value))
|
|
55
58
|
else:
|
|
56
|
-
raise DataError("Non-existing named argument '
|
|
59
|
+
raise DataError(f"Non-existing named argument '{name}'.")
|
|
57
60
|
named_names = {name for name, _ in named}
|
|
58
61
|
for name in spec.named_only:
|
|
59
62
|
if name not in named_names:
|
|
60
63
|
value = DefaultValue(spec.defaults[name])
|
|
61
|
-
self.
|
|
64
|
+
self.named.append((name, value))
|
|
62
65
|
|
|
63
66
|
def replace_defaults(self):
|
|
64
67
|
is_default = lambda arg: isinstance(arg, DefaultValue)
|
|
65
|
-
while self.
|
|
66
|
-
self.
|
|
67
|
-
self.
|
|
68
|
-
self.
|
|
68
|
+
while self.positional and is_default(self.positional[-1]):
|
|
69
|
+
self.positional.pop()
|
|
70
|
+
self.positional = [a if not is_default(a) else a.value for a in self.positional]
|
|
71
|
+
self.named = [(n, v) for n, v in self.named if not is_default(v)]
|
|
69
72
|
|
|
70
73
|
|
|
71
74
|
class DefaultValue:
|
|
@@ -77,5 +80,4 @@ class DefaultValue:
|
|
|
77
80
|
try:
|
|
78
81
|
return variables.replace_scalar(self.value)
|
|
79
82
|
except DataError as err:
|
|
80
|
-
raise DataError('Resolving argument default values failed:
|
|
81
|
-
% err.message)
|
|
83
|
+
raise DataError(f'Resolving argument default values failed: {err}')
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
from abc import ABC, abstractmethod
|
|
17
17
|
from inspect import isclass, signature, Parameter
|
|
18
|
-
from typing import get_type_hints
|
|
18
|
+
from typing import Any, Callable, get_type_hints
|
|
19
19
|
|
|
20
20
|
from robot.errors import DataError
|
|
21
21
|
from robot.utils import is_string, split_from_equals
|
|
@@ -26,110 +26,134 @@ from .argumentspec import ArgumentSpec
|
|
|
26
26
|
|
|
27
27
|
class ArgumentParser(ABC):
|
|
28
28
|
|
|
29
|
-
def __init__(self, type='Keyword',
|
|
30
|
-
|
|
31
|
-
self.
|
|
29
|
+
def __init__(self, type: str = 'Keyword',
|
|
30
|
+
error_reporter: 'Callable[[str], None] | None' = None):
|
|
31
|
+
self.type = type
|
|
32
|
+
self.error_reporter = error_reporter
|
|
32
33
|
|
|
33
34
|
@abstractmethod
|
|
34
|
-
def parse(self, source, name=None):
|
|
35
|
+
def parse(self, source: Any, name: 'str|None' = None) -> ArgumentSpec:
|
|
35
36
|
raise NotImplementedError
|
|
36
37
|
|
|
37
|
-
def _report_error(self, error):
|
|
38
|
-
if self.
|
|
39
|
-
self.
|
|
38
|
+
def _report_error(self, error: str):
|
|
39
|
+
if self.error_reporter:
|
|
40
|
+
self.error_reporter(error)
|
|
40
41
|
else:
|
|
41
42
|
raise DataError(f'Invalid argument specification: {error}')
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
class PythonArgumentParser(ArgumentParser):
|
|
45
46
|
|
|
46
|
-
def parse(self,
|
|
47
|
-
spec = ArgumentSpec(name, self._type)
|
|
48
|
-
self._set_args(spec, handler)
|
|
49
|
-
self._set_types(spec, handler)
|
|
50
|
-
return spec
|
|
51
|
-
|
|
52
|
-
def _set_args(self, spec, handler):
|
|
47
|
+
def parse(self, method, name=None):
|
|
53
48
|
try:
|
|
54
|
-
sig = signature(
|
|
55
|
-
except ValueError:
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
sig = signature(method)
|
|
50
|
+
except ValueError: # Can occur with C functions (incl. many builtins).
|
|
51
|
+
return ArgumentSpec(name, self.type, var_positional='args')
|
|
52
|
+
except TypeError as err: # Occurs if handler isn't actually callable.
|
|
53
|
+
raise DataError(str(err))
|
|
58
54
|
parameters = list(sig.parameters.values())
|
|
59
55
|
# `inspect.signature` drops `self` with bound methods and that's the case when
|
|
60
56
|
# inspecting keywords. `__init__` is got directly from class (i.e. isn't bound)
|
|
61
57
|
# so we need to handle that case ourselves.
|
|
62
58
|
# Partial objects do not have __name__ at least in Python =< 3.10.
|
|
63
|
-
if getattr(
|
|
59
|
+
if getattr(method, '__name__', None) == '__init__':
|
|
64
60
|
parameters = parameters[1:]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
spec = self._create_spec(parameters, name)
|
|
62
|
+
self._set_types(spec, method)
|
|
63
|
+
return spec
|
|
64
|
+
|
|
65
|
+
def _create_spec(self, parameters, name):
|
|
66
|
+
positional_only = []
|
|
67
|
+
positional_or_named = []
|
|
68
|
+
var_positional = None
|
|
69
|
+
named_only = []
|
|
70
|
+
var_named = None
|
|
71
|
+
defaults = {}
|
|
72
72
|
for param in parameters:
|
|
73
|
-
|
|
73
|
+
kind = param.kind
|
|
74
|
+
if kind == Parameter.POSITIONAL_ONLY:
|
|
75
|
+
positional_only.append(param.name)
|
|
76
|
+
elif kind == Parameter.POSITIONAL_OR_KEYWORD:
|
|
77
|
+
positional_or_named.append(param.name)
|
|
78
|
+
elif kind == Parameter.VAR_POSITIONAL:
|
|
79
|
+
var_positional = param.name
|
|
80
|
+
elif kind == Parameter.KEYWORD_ONLY:
|
|
81
|
+
named_only.append(param.name)
|
|
82
|
+
elif kind == Parameter.VAR_KEYWORD:
|
|
83
|
+
var_named = param.name
|
|
74
84
|
if param.default is not param.empty:
|
|
75
|
-
|
|
85
|
+
defaults[param.name] = param.default
|
|
86
|
+
return ArgumentSpec(name, self.type, positional_only, positional_or_named,
|
|
87
|
+
var_positional, named_only, var_named, defaults)
|
|
88
|
+
|
|
89
|
+
def _set_types(self, spec, method):
|
|
90
|
+
types = self._get_types(method)
|
|
91
|
+
if isinstance(types, dict) and 'return' in types:
|
|
92
|
+
spec.return_type = types.pop('return')
|
|
93
|
+
spec.types = types
|
|
76
94
|
|
|
77
|
-
def
|
|
95
|
+
def _get_types(self, method):
|
|
78
96
|
# If types are set using the `@keyword` decorator, use them. Including when
|
|
79
|
-
# types are explicitly disabled with `@keyword(types=None)`. Otherwise
|
|
97
|
+
# types are explicitly disabled with `@keyword(types=None)`. Otherwise get
|
|
80
98
|
# type hints.
|
|
81
|
-
if isclass(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if
|
|
85
|
-
|
|
86
|
-
else:
|
|
87
|
-
spec.types = self._get_type_hints(handler)
|
|
88
|
-
|
|
89
|
-
def _get_type_hints(self, handler):
|
|
99
|
+
if isclass(method):
|
|
100
|
+
method = method.__init__
|
|
101
|
+
types = getattr(method, 'robot_types', ())
|
|
102
|
+
if types or types is None:
|
|
103
|
+
return types
|
|
90
104
|
try:
|
|
91
|
-
return get_type_hints(
|
|
105
|
+
return get_type_hints(method)
|
|
92
106
|
except Exception: # Can raise pretty much anything
|
|
93
107
|
# Not all functions have `__annotations__`.
|
|
94
108
|
# https://github.com/robotframework/robotframework/issues/4059
|
|
95
|
-
return getattr(
|
|
109
|
+
return getattr(method, '__annotations__', {})
|
|
96
110
|
|
|
97
111
|
|
|
98
112
|
class ArgumentSpecParser(ArgumentParser):
|
|
99
113
|
|
|
100
|
-
def parse(self,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
def parse(self, arguments, name=None):
|
|
115
|
+
positional_only = []
|
|
116
|
+
positional_or_named = []
|
|
117
|
+
var_positional = None
|
|
118
|
+
named_only = []
|
|
119
|
+
var_named = None
|
|
120
|
+
defaults = {}
|
|
121
|
+
named_only_separator_seen = positional_only_separator_seen = False
|
|
122
|
+
target = positional_or_named
|
|
123
|
+
for arg in arguments:
|
|
104
124
|
arg = self._validate_arg(arg)
|
|
105
|
-
if
|
|
125
|
+
if var_named:
|
|
106
126
|
self._report_error('Only last argument can be kwargs.')
|
|
107
127
|
elif self._is_positional_only_separator(arg):
|
|
108
|
-
if named_only:
|
|
109
|
-
self._report_error('Positional-only separator must be before '
|
|
110
|
-
'named-only arguments.')
|
|
111
128
|
if positional_only_separator_seen:
|
|
112
129
|
self._report_error('Too many positional-only separators.')
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
if named_only_separator_seen:
|
|
131
|
+
self._report_error('Positional-only separator must be before '
|
|
132
|
+
'named-only arguments.')
|
|
133
|
+
positional_only = positional_or_named
|
|
134
|
+
target = positional_or_named = []
|
|
115
135
|
positional_only_separator_seen = True
|
|
116
136
|
elif isinstance(arg, tuple):
|
|
117
137
|
arg, default = arg
|
|
118
|
-
arg = self.
|
|
119
|
-
|
|
138
|
+
arg = self._format_arg(arg)
|
|
139
|
+
target.append(arg)
|
|
140
|
+
defaults[arg] = default
|
|
120
141
|
elif self._is_var_named(arg):
|
|
121
|
-
|
|
142
|
+
var_named = self._format_var_named(arg)
|
|
122
143
|
elif self._is_var_positional(arg):
|
|
123
|
-
if
|
|
144
|
+
if named_only_separator_seen:
|
|
124
145
|
self._report_error('Cannot have multiple varargs.')
|
|
125
146
|
if not self._is_named_only_separator(arg):
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
147
|
+
var_positional = self._format_var_positional(arg)
|
|
148
|
+
named_only_separator_seen = True
|
|
149
|
+
target = named_only
|
|
150
|
+
elif defaults and not named_only_separator_seen:
|
|
129
151
|
self._report_error('Non-default argument after default arguments.')
|
|
130
152
|
else:
|
|
131
|
-
self.
|
|
132
|
-
|
|
153
|
+
arg = self._format_arg(arg)
|
|
154
|
+
target.append(arg)
|
|
155
|
+
return ArgumentSpec(name, self.type, positional_only, positional_or_named,
|
|
156
|
+
var_positional, named_only, var_named, defaults)
|
|
133
157
|
|
|
134
158
|
@abstractmethod
|
|
135
159
|
def _validate_arg(self, arg):
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Copyright 2008-2015 Nokia Networks
|
|
2
|
+
# Copyright 2016- Robot Framework Foundation
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
from typing import TYPE_CHECKING
|
|
17
|
+
|
|
18
|
+
from robot.errors import DataError
|
|
19
|
+
from robot.utils import is_dict_like, is_list_like, split_from_equals
|
|
20
|
+
from robot.variables import is_dict_variable
|
|
21
|
+
|
|
22
|
+
from .argumentvalidator import ArgumentValidator
|
|
23
|
+
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from .argumentspec import ArgumentSpec
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ArgumentResolver:
|
|
29
|
+
|
|
30
|
+
def __init__(self, spec: 'ArgumentSpec',
|
|
31
|
+
resolve_named: bool = True,
|
|
32
|
+
resolve_args_until: 'int|None' = None,
|
|
33
|
+
dict_to_kwargs: bool = False):
|
|
34
|
+
self.named_resolver = NamedArgumentResolver(spec) \
|
|
35
|
+
if resolve_named else NullNamedArgumentResolver()
|
|
36
|
+
self.variable_replacer = VariableReplacer(spec, resolve_args_until)
|
|
37
|
+
self.dict_to_kwargs = DictToKwargs(spec, dict_to_kwargs)
|
|
38
|
+
self.argument_validator = ArgumentValidator(spec)
|
|
39
|
+
|
|
40
|
+
def resolve(self, arguments, variables=None):
|
|
41
|
+
if len(arguments) == 2 and is_list_like(arguments[0]) and is_dict_like(arguments[1]):
|
|
42
|
+
positional = list(arguments[0])
|
|
43
|
+
named = list(arguments[1].items())
|
|
44
|
+
else:
|
|
45
|
+
positional, named = self.named_resolver.resolve(arguments, variables)
|
|
46
|
+
positional, named = self.variable_replacer.replace(positional, named, variables)
|
|
47
|
+
positional, named = self.dict_to_kwargs.handle(positional, named)
|
|
48
|
+
self.argument_validator.validate(positional, named, dryrun=variables is None)
|
|
49
|
+
return positional, named
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class NamedArgumentResolver:
|
|
53
|
+
|
|
54
|
+
def __init__(self, spec: 'ArgumentSpec'):
|
|
55
|
+
self.spec = spec
|
|
56
|
+
|
|
57
|
+
def resolve(self, arguments, variables=None):
|
|
58
|
+
spec = self.spec
|
|
59
|
+
positional = list(arguments[:len(spec.embedded)])
|
|
60
|
+
named = []
|
|
61
|
+
for arg in arguments[len(spec.embedded):]:
|
|
62
|
+
if is_dict_variable(arg):
|
|
63
|
+
named.append(arg)
|
|
64
|
+
else:
|
|
65
|
+
name, value = self._split_named(arg, named, variables, spec)
|
|
66
|
+
if name is not None:
|
|
67
|
+
named.append((name, value))
|
|
68
|
+
elif named:
|
|
69
|
+
self._raise_positional_after_named()
|
|
70
|
+
else:
|
|
71
|
+
positional.append(value)
|
|
72
|
+
return positional, named
|
|
73
|
+
|
|
74
|
+
def _split_named(self, arg, previous_named, variables, spec):
|
|
75
|
+
if isinstance(arg, tuple):
|
|
76
|
+
if len(arg) == 2 and isinstance(arg[0], str):
|
|
77
|
+
return arg
|
|
78
|
+
elif len(arg) == 1:
|
|
79
|
+
return None, arg[0]
|
|
80
|
+
else:
|
|
81
|
+
return None, arg
|
|
82
|
+
name, value = split_from_equals(arg)
|
|
83
|
+
if value is None or not self._is_named(name, previous_named, variables, spec):
|
|
84
|
+
return None, arg
|
|
85
|
+
return name, value
|
|
86
|
+
|
|
87
|
+
def _is_named(self, name, previous_named, variables, spec):
|
|
88
|
+
if previous_named or spec.var_named:
|
|
89
|
+
return True
|
|
90
|
+
if variables:
|
|
91
|
+
try:
|
|
92
|
+
name = variables.replace_scalar(name)
|
|
93
|
+
except DataError:
|
|
94
|
+
return False
|
|
95
|
+
return name in spec.named
|
|
96
|
+
|
|
97
|
+
def _raise_positional_after_named(self):
|
|
98
|
+
raise DataError(f"{self.spec.type.capitalize()} '{self.spec.name}' "
|
|
99
|
+
f"got positional argument after named arguments.")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class NullNamedArgumentResolver:
|
|
103
|
+
|
|
104
|
+
def resolve(self, arguments, variables=None):
|
|
105
|
+
return arguments, []
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class DictToKwargs:
|
|
109
|
+
|
|
110
|
+
def __init__(self, spec: 'ArgumentSpec', enabled: bool = False):
|
|
111
|
+
self.maxargs = spec.maxargs
|
|
112
|
+
self.enabled = enabled and bool(spec.var_named)
|
|
113
|
+
|
|
114
|
+
def handle(self, positional, named):
|
|
115
|
+
if self.enabled and self._extra_arg_has_kwargs(positional, named):
|
|
116
|
+
named = positional.pop().items()
|
|
117
|
+
return positional, named
|
|
118
|
+
|
|
119
|
+
def _extra_arg_has_kwargs(self, positional, named):
|
|
120
|
+
if named or len(positional) != self.maxargs + 1:
|
|
121
|
+
return False
|
|
122
|
+
return is_dict_like(positional[-1])
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class VariableReplacer:
|
|
126
|
+
|
|
127
|
+
def __init__(self, spec: 'ArgumentSpec', resolve_until: 'int|None' = None):
|
|
128
|
+
self.spec = spec
|
|
129
|
+
self.resolve_until = resolve_until
|
|
130
|
+
|
|
131
|
+
def replace(self, positional, named, variables=None):
|
|
132
|
+
# `variables` is None in dry-run mode and when using Libdoc.
|
|
133
|
+
if variables:
|
|
134
|
+
if self.spec.embedded:
|
|
135
|
+
embedded = len(self.spec.embedded)
|
|
136
|
+
positional = [
|
|
137
|
+
variables.replace_scalar(emb) for emb in positional[:embedded]
|
|
138
|
+
] + variables.replace_list(positional[embedded:])
|
|
139
|
+
else:
|
|
140
|
+
positional = variables.replace_list(positional, self.resolve_until)
|
|
141
|
+
named = list(self._replace_named(named, variables.replace_scalar))
|
|
142
|
+
else:
|
|
143
|
+
# If `var` isn't a tuple, it's a &{dict} variables.
|
|
144
|
+
named = [var if isinstance(var, tuple) else (var, var) for var in named]
|
|
145
|
+
return positional, named
|
|
146
|
+
|
|
147
|
+
def _replace_named(self, named, replace_scalar):
|
|
148
|
+
for item in named:
|
|
149
|
+
for name, value in self._get_replaced_named(item, replace_scalar):
|
|
150
|
+
if not isinstance(name, str):
|
|
151
|
+
raise DataError('Argument names must be strings.')
|
|
152
|
+
yield name, value
|
|
153
|
+
|
|
154
|
+
def _get_replaced_named(self, item, replace_scalar):
|
|
155
|
+
if not isinstance(item, tuple):
|
|
156
|
+
return replace_scalar(item).items()
|
|
157
|
+
name, value = item
|
|
158
|
+
return [(replace_scalar(name), replace_scalar(value))]
|