robotframework 6.1.1__zip → 7.0a1__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.1.1/src/robotframework.egg-info → robotframework-7.0a1}/PKG-INFO +3 -6
- {robotframework-6.1.1 → robotframework-7.0a1}/setup.py +2 -5
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/api/interfaces.py +35 -48
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/api/parsing.py +4 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/conf/gatherfailed.py +2 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/conf/languages.py +0 -9
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/conf/settings.py +8 -5
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/log.css +4 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/log.html +9 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/model.js +2 -4
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/testdata.js +10 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/template.py +3 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/builder.py +0 -8
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/datatypes.py +9 -10
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/htmlutils.py +4 -7
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/jsonbuilder.py +14 -10
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/model.py +13 -25
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/robotbuilder.py +13 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/xmlbuilder.py +8 -8
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/xmlwriter.py +12 -38
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/BuiltIn.py +215 -189
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Collections.py +2 -9
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/DateTime.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/OperatingSystem.py +4 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Process.py +26 -27
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Remote.py +40 -36
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/String.py +4 -4
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/XML.py +7 -8
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/__init__.py +2 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/__init__.py +4 -4
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/body.py +14 -6
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/configurer.py +15 -11
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/control.py +151 -81
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/filter.py +31 -25
- robotframework-7.0a1/src/robot/model/keyword.py +70 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/message.py +19 -10
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/namepatterns.py +3 -25
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/stats.py +9 -15
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/tags.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/testcase.py +12 -21
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/testsuite.py +16 -22
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/visitor.py +35 -8
- robotframework-7.0a1/src/robot/output/console/dotted.py +90 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/console/quiet.py +3 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/console/verbose.py +60 -60
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/debugfile.py +36 -23
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/filelogger.py +16 -13
- robotframework-7.0a1/src/robot/output/listeners.py +586 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/logger.py +164 -77
- robotframework-7.0a1/src/robot/output/loggerapi.py +152 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/loggerhelper.py +23 -56
- robotframework-7.0a1/src/robot/output/output.py +158 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/stdoutlogsplitter.py +8 -5
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/xmllogger.py +163 -109
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/blocklexers.py +17 -13
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/context.py +12 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/lexer.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/settings.py +6 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/statementlexers.py +39 -10
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/tokens.py +27 -29
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/model/blocks.py +19 -6
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/model/statements.py +184 -84
- robotframework-7.0a1/src/robot/parsing/model/visitor.py +102 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/expandkeywordmatcher.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/jsbuildingcontext.py +8 -6
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/jsmodelbuilders.py +88 -61
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/stringcache.py +4 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/xunitwriter.py +15 -21
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/__init__.py +3 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/configurer.py +12 -9
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/flattenkeywordmatcher.py +8 -8
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/keywordremover.py +71 -54
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/merger.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/model.py +400 -316
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/modeldeprecation.py +9 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/resultbuilder.py +21 -23
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/xmlelementhandlers.py +76 -40
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/__init__.py +1 -1
- robotframework-7.0a1/src/robot/running/arguments/argumentconverter.py +101 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/argumentmapper.py +16 -14
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/argumentresolver.py +41 -33
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/argumentspec.py +24 -90
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/argumentvalidator.py +34 -27
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/customconverters.py +14 -11
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/embedded.py +23 -26
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/typeconverters.py +175 -213
- robotframework-7.0a1/src/robot/running/arguments/typeinfo.py +367 -0
- robotframework-7.0a1/src/robot/running/arguments/typevalidator.py +62 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/bodyrunner.py +83 -68
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/builder/parsers.py +8 -10
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/builder/settings.py +9 -17
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/builder/transformers.py +166 -308
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/context.py +80 -25
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/handlers.py +11 -16
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/handlerstore.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/librarykeywordrunner.py +9 -17
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/model.py +109 -32
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/namespace.py +18 -19
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/statusreporter.py +13 -12
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/suiterunner.py +15 -17
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/testlibraries.py +33 -40
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/usererrorhandler.py +8 -8
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/userkeyword.py +13 -8
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/userkeywordrunner.py +18 -21
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/testdoc.py +18 -13
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/__init__.py +50 -35
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/connectioncache.py +64 -59
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/encodingsniffer.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/escaping.py +11 -9
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/markupwriters.py +20 -13
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/normalizing.py +9 -24
- robotframework-7.0a1/src/robot/utils/notset.py +33 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/platform.py +15 -5
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/robotpath.py +1 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/robottime.py +120 -88
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/robottypes.py +16 -31
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/setter.py +0 -5
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/text.py +7 -4
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/unic.py +2 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/__init__.py +2 -2
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/assigner.py +17 -19
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/evaluation.py +20 -17
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/filesetter.py +80 -80
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/replacer.py +33 -36
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/scopes.py +3 -3
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/search.py +66 -41
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/store.py +14 -16
- robotframework-7.0a1/src/robot/variables/tablesetter.py +164 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/variables.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/version.py +1 -1
- {robotframework-6.1.1 → robotframework-7.0a1/src/robotframework.egg-info}/PKG-INFO +3 -6
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robotframework.egg-info/SOURCES.txt +3 -4
- {robotframework-6.1.1 → robotframework-7.0a1}/tasks.py +6 -6
- robotframework-6.1.1/src/robot/libraries/Reserved.py +0 -48
- robotframework-6.1.1/src/robot/model/keyword.py +0 -173
- robotframework-6.1.1/src/robot/output/console/dotted.py +0 -90
- robotframework-6.1.1/src/robot/output/listenerarguments.py +0 -165
- robotframework-6.1.1/src/robot/output/listenermethods.py +0 -113
- robotframework-6.1.1/src/robot/output/listeners.py +0 -174
- robotframework-6.1.1/src/robot/output/output.py +0 -95
- robotframework-6.1.1/src/robot/parsing/model/visitor.py +0 -67
- robotframework-6.1.1/src/robot/running/arguments/argumentconverter.py +0 -79
- robotframework-6.1.1/src/robot/running/arguments/typevalidator.py +0 -56
- robotframework-6.1.1/src/robot/running/modelcombiner.py +0 -32
- robotframework-6.1.1/src/robot/variables/tablesetter.py +0 -156
- {robotframework-6.1.1 → robotframework-7.0a1}/AUTHORS.rst +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/BUILD.rst +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/CONTRIBUTING.rst +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/COPYRIGHT.txt +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/INSTALL.rst +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/LICENSE.txt +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/MANIFEST.in +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/README.rst +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/setup.cfg +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/__main__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/api/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/api/deco.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/api/exceptions.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/api/logger.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/conf/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/errors.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/common/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/common/js_disabled.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/common/storage.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/htmlfilewriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/jsonwriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/lib/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/lib/jquery.highlight.min.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/lib/jquery.min.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/lib/jquery.tablesorter.min.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/lib/jquery.tmpl.min.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/lib/jsxcompressor.min.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/libdoc/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/libdoc/doc_formatting.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/libdoc/libdoc.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/libdoc/libdoc.html +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/libdoc/print.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/libdoc/pygments.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/common.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/doc_formatting.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/fileloading.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/log.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/print.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/report.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/report.html +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/util.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/rebot/view.js +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/testdoc/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/testdoc/testdoc.css +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/htmldata/testdoc/testdoc.html +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdoc.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/consoleviewer.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/htmlwriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/jsonwriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/output.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/standardtypes.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libdocpkg/writer.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Dialogs.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Easter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Screenshot.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/Telnet.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/libraries/dialogs_py.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/fixture.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/itemlist.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/metadata.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/modelobject.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/modifier.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/statistics.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/suitestatistics.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/tagsetter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/tagstatistics.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/model/totalstatistics.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/console/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/console/highlighting.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/librarylogger.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/output/pyloggingconf.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/lexer/tokenizer.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/model/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/parser/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/parser/blockparsers.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/parser/fileparser.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/parser/parser.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/parsing/suitestructure.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/pythonpathsetter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/rebot.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/jsexecutionresult.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/jswriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/logreportwriters.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/outputwriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/reporting/resultwriter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/executionerrors.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/executionresult.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/messagefilter.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/suiteteardownfailed.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/result/visitor.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/run.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/arguments/argumentparser.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/builder/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/builder/builders.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/dynamicmethods.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/importer.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/libraryscopes.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/outputcapture.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/randomizer.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/runkwregister.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/signalhandler.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/status.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/timeouts/__init__.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/timeouts/posix.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/running/timeouts/windows.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/application.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/argumentparser.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/asserts.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/charwidth.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/compress.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/dotdict.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/encoding.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/error.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/etreewrapper.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/filereader.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/frange.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/htmlformatters.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/importer.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/markuputils.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/match.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/misc.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/recommendations.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/restreader.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/robotenv.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/robotinspect.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/robotio.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/sortable.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/utils/typehints.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/finders.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/notfound.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robot/variables/resolvable.py +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robotframework.egg-info/dependency_links.txt +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robotframework.egg-info/entry_points.txt +0 -0
- {robotframework-6.1.1 → robotframework-7.0a1}/src/robotframework.egg-info/top_level.txt +0 -0
|
@@ -22,13 +22,17 @@ from enum import Enum
|
|
|
22
22
|
from numbers import Integral, Real
|
|
23
23
|
from os import PathLike
|
|
24
24
|
from pathlib import Path, PurePath
|
|
25
|
-
from typing import Any,
|
|
25
|
+
from typing import Any, TYPE_CHECKING, Union
|
|
26
26
|
|
|
27
|
-
from robot.conf import Languages
|
|
27
|
+
from robot.conf import Languages, LanguagesLike
|
|
28
28
|
from robot.libraries.DateTime import convert_date, convert_time
|
|
29
|
-
from robot.utils import (eq, get_error_message,
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
from robot.utils import (eq, get_error_message, is_string, plural_or_not as s,
|
|
30
|
+
safe_str, seq2str, type_name)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if TYPE_CHECKING:
|
|
34
|
+
from .customconverters import ConverterInfo, CustomArgumentConverters
|
|
35
|
+
from .typeinfo import TypeInfo, TypedDictInfo
|
|
32
36
|
|
|
33
37
|
|
|
34
38
|
NoneType = type(None)
|
|
@@ -38,99 +42,87 @@ class TypeConverter:
|
|
|
38
42
|
type = None
|
|
39
43
|
type_name = None
|
|
40
44
|
abc = None
|
|
41
|
-
aliases = ()
|
|
42
45
|
value_types = (str,)
|
|
43
46
|
doc = None
|
|
44
47
|
_converters = OrderedDict()
|
|
45
|
-
_type_aliases = {}
|
|
46
48
|
|
|
47
|
-
def __init__(self,
|
|
48
|
-
|
|
49
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
50
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
51
|
+
languages: LanguagesLike = None):
|
|
52
|
+
self.type_info = type_info
|
|
49
53
|
self.custom_converters = custom_converters
|
|
50
54
|
self.languages = languages or Languages()
|
|
51
55
|
|
|
52
56
|
@classmethod
|
|
53
|
-
def register(cls, converter):
|
|
57
|
+
def register(cls, converter: 'type[TypeConverter]') -> 'type[TypeConverter]':
|
|
54
58
|
cls._converters[converter.type] = converter
|
|
55
|
-
for name in (converter.type_name,) + converter.aliases:
|
|
56
|
-
if name is not None and not isinstance(name, property):
|
|
57
|
-
cls._type_aliases[name.lower()] = converter.type
|
|
58
59
|
return converter
|
|
59
60
|
|
|
60
61
|
@classmethod
|
|
61
|
-
def converter_for(cls,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
def converter_for(cls, type_info: 'TypeInfo',
|
|
63
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
64
|
+
languages: LanguagesLike = None) -> 'TypeConverter|None':
|
|
65
|
+
if type_info.type is None:
|
|
65
66
|
return None
|
|
66
|
-
if isinstance(type_, str):
|
|
67
|
-
try:
|
|
68
|
-
type_ = cls._type_aliases[type_.lower()]
|
|
69
|
-
except KeyError:
|
|
70
|
-
return None
|
|
71
|
-
used_type = type_
|
|
72
|
-
if getattr(type_, '__origin__', None) and type_.__origin__ is not Union:
|
|
73
|
-
type_ = type_.__origin__
|
|
74
67
|
if custom_converters:
|
|
75
|
-
info = custom_converters.get_converter_info(
|
|
68
|
+
info = custom_converters.get_converter_info(type_info.type)
|
|
76
69
|
if info:
|
|
77
|
-
return CustomConverter(
|
|
78
|
-
if
|
|
79
|
-
return cls._converters[
|
|
70
|
+
return CustomConverter(type_info, info)
|
|
71
|
+
if type_info.type in cls._converters:
|
|
72
|
+
return cls._converters[type_info.type](type_info, custom_converters, languages)
|
|
80
73
|
for converter in cls._converters.values():
|
|
81
|
-
if converter.handles(
|
|
82
|
-
return converter(
|
|
74
|
+
if converter.handles(type_info):
|
|
75
|
+
return converter(type_info, custom_converters, languages)
|
|
83
76
|
return None
|
|
84
77
|
|
|
85
78
|
@classmethod
|
|
86
|
-
def handles(cls,
|
|
79
|
+
def handles(cls, type_info: 'TypeInfo') -> bool:
|
|
87
80
|
handled = (cls.type, cls.abc) if cls.abc else cls.type
|
|
88
|
-
return isinstance(
|
|
81
|
+
return isinstance(type_info.type, type) and issubclass(type_info.type, handled)
|
|
89
82
|
|
|
90
|
-
def convert(self,
|
|
83
|
+
def convert(self, value: Any,
|
|
84
|
+
name: 'str|None' = None,
|
|
85
|
+
kind: str = 'Argument') -> Any:
|
|
91
86
|
if self.no_conversion_needed(value):
|
|
92
87
|
return value
|
|
93
88
|
if not self._handles_value(value):
|
|
94
|
-
return self._handle_error(
|
|
89
|
+
return self._handle_error(value, name, kind)
|
|
95
90
|
try:
|
|
96
91
|
if not isinstance(value, str):
|
|
97
|
-
return self._non_string_convert(value
|
|
98
|
-
return self._convert(value
|
|
92
|
+
return self._non_string_convert(value)
|
|
93
|
+
return self._convert(value)
|
|
99
94
|
except ValueError as error:
|
|
100
|
-
return self._handle_error(
|
|
95
|
+
return self._handle_error(value, name, kind, error)
|
|
101
96
|
|
|
102
|
-
def no_conversion_needed(self, value):
|
|
103
|
-
used_type = getattr(self.used_type, '__origin__', self.used_type)
|
|
97
|
+
def no_conversion_needed(self, value: Any) -> bool:
|
|
104
98
|
try:
|
|
105
|
-
return isinstance(value,
|
|
99
|
+
return isinstance(value, self.type_info.type)
|
|
106
100
|
except TypeError:
|
|
107
101
|
# Used type wasn't a class. Compare to generic type instead.
|
|
108
|
-
if self.type and self.type is not self.
|
|
102
|
+
if self.type and self.type is not self.type_info.type:
|
|
109
103
|
return isinstance(value, self.type)
|
|
110
104
|
raise
|
|
111
105
|
|
|
112
106
|
def _handles_value(self, value):
|
|
113
107
|
return isinstance(value, self.value_types)
|
|
114
108
|
|
|
115
|
-
def _non_string_convert(self, value
|
|
116
|
-
return self._convert(value
|
|
109
|
+
def _non_string_convert(self, value):
|
|
110
|
+
return self._convert(value)
|
|
117
111
|
|
|
118
|
-
def _convert(self, value
|
|
112
|
+
def _convert(self, value):
|
|
119
113
|
raise NotImplementedError
|
|
120
114
|
|
|
121
|
-
def _handle_error(self,
|
|
122
|
-
if not strict:
|
|
123
|
-
return value
|
|
115
|
+
def _handle_error(self, value, name, kind, error=None):
|
|
124
116
|
value_type = '' if isinstance(value, str) else f' ({type_name(value)})'
|
|
125
117
|
value = safe_str(value)
|
|
126
118
|
ending = f': {error}' if (error and error.args) else '.'
|
|
127
119
|
if name is None:
|
|
128
120
|
raise ValueError(
|
|
129
|
-
f"{kind} '{value}'{value_type} "
|
|
121
|
+
f"{kind.capitalize()} '{value}'{value_type} "
|
|
130
122
|
f"cannot be converted to {self.type_name}{ending}"
|
|
131
123
|
)
|
|
132
124
|
raise ValueError(
|
|
133
|
-
f"{kind} '{name}' got value '{value}'{value_type} that "
|
|
125
|
+
f"{kind.capitalize()} '{name}' got value '{value}'{value_type} that "
|
|
134
126
|
f"cannot be converted to {self.type_name}{ending}"
|
|
135
127
|
)
|
|
136
128
|
|
|
@@ -149,19 +141,6 @@ class TypeConverter:
|
|
|
149
141
|
raise ValueError(f'Value is {type_name(value)}, not {expected.__name__}.')
|
|
150
142
|
return value
|
|
151
143
|
|
|
152
|
-
def _get_nested_types(self, type_hint, expected_count=None):
|
|
153
|
-
types = getattr(type_hint, '__args__', ())
|
|
154
|
-
# With generics from typing like Dict, __args__ is None with Python 3.6 and
|
|
155
|
-
# contains TypeVars with 3.7-3.8. Newer versions don't have __args__ at all.
|
|
156
|
-
# Subscripted usages like Dict[x, y].__args__ work fine with all.
|
|
157
|
-
if not types or all(isinstance(a, TypeVar) for a in types):
|
|
158
|
-
return ()
|
|
159
|
-
if expected_count and len(types) != expected_count:
|
|
160
|
-
raise TypeError(f'{type_hint.__name__}[] construct used as a type hint '
|
|
161
|
-
f'requires exactly {expected_count} nested '
|
|
162
|
-
f'type{s(expected_count)}, got {len(types)}.')
|
|
163
|
-
return types
|
|
164
|
-
|
|
165
144
|
def _remove_number_separators(self, value):
|
|
166
145
|
if is_string(value):
|
|
167
146
|
for sep in ' ', '_':
|
|
@@ -176,14 +155,14 @@ class EnumConverter(TypeConverter):
|
|
|
176
155
|
|
|
177
156
|
@property
|
|
178
157
|
def type_name(self):
|
|
179
|
-
return self.
|
|
158
|
+
return self.type_info.name
|
|
180
159
|
|
|
181
160
|
@property
|
|
182
161
|
def value_types(self):
|
|
183
|
-
return (str, int) if issubclass(self.
|
|
162
|
+
return (str, int) if issubclass(self.type_info.type, int) else (str,)
|
|
184
163
|
|
|
185
|
-
def _convert(self, value
|
|
186
|
-
enum = self.
|
|
164
|
+
def _convert(self, value):
|
|
165
|
+
enum = self.type_info.type
|
|
187
166
|
if isinstance(value, int):
|
|
188
167
|
return self._find_by_int_value(enum, value)
|
|
189
168
|
try:
|
|
@@ -193,14 +172,14 @@ class EnumConverter(TypeConverter):
|
|
|
193
172
|
|
|
194
173
|
def _find_by_normalized_name_or_int_value(self, enum, value):
|
|
195
174
|
members = sorted(enum.__members__)
|
|
196
|
-
matches = [m for m in members if eq(m, value, ignore='_')]
|
|
175
|
+
matches = [m for m in members if eq(m, value, ignore='_-')]
|
|
197
176
|
if len(matches) == 1:
|
|
198
177
|
return getattr(enum, matches[0])
|
|
199
178
|
if len(matches) > 1:
|
|
200
179
|
raise ValueError(f"{self.type_name} has multiple members matching "
|
|
201
180
|
f"'{value}'. Available: {seq2str(matches)}")
|
|
202
181
|
try:
|
|
203
|
-
if issubclass(self.
|
|
182
|
+
if issubclass(self.type_info.type, int):
|
|
204
183
|
return self._find_by_int_value(enum, value)
|
|
205
184
|
except ValueError:
|
|
206
185
|
members = [f'{m} ({getattr(enum, m)})' for m in members]
|
|
@@ -221,17 +200,16 @@ class EnumConverter(TypeConverter):
|
|
|
221
200
|
class AnyConverter(TypeConverter):
|
|
222
201
|
type = Any
|
|
223
202
|
type_name = 'Any'
|
|
224
|
-
aliases = ('any',)
|
|
225
203
|
value_types = (Any,)
|
|
226
204
|
|
|
227
205
|
@classmethod
|
|
228
|
-
def handles(cls,
|
|
229
|
-
return
|
|
206
|
+
def handles(cls, type_info: 'TypeInfo'):
|
|
207
|
+
return type_info.type is Any
|
|
230
208
|
|
|
231
209
|
def no_conversion_needed(self, value):
|
|
232
210
|
return True
|
|
233
211
|
|
|
234
|
-
def _convert(self, value
|
|
212
|
+
def _convert(self, value):
|
|
235
213
|
return value
|
|
236
214
|
|
|
237
215
|
def _handles_value(self, value):
|
|
@@ -242,15 +220,12 @@ class AnyConverter(TypeConverter):
|
|
|
242
220
|
class StringConverter(TypeConverter):
|
|
243
221
|
type = str
|
|
244
222
|
type_name = 'string'
|
|
245
|
-
aliases = ('string', 'str', 'unicode')
|
|
246
223
|
value_types = (Any,)
|
|
247
224
|
|
|
248
225
|
def _handles_value(self, value):
|
|
249
226
|
return True
|
|
250
227
|
|
|
251
|
-
def _convert(self, value
|
|
252
|
-
if not explicit_type:
|
|
253
|
-
return value
|
|
228
|
+
def _convert(self, value):
|
|
254
229
|
try:
|
|
255
230
|
return str(value)
|
|
256
231
|
except Exception:
|
|
@@ -261,13 +236,12 @@ class StringConverter(TypeConverter):
|
|
|
261
236
|
class BooleanConverter(TypeConverter):
|
|
262
237
|
type = bool
|
|
263
238
|
type_name = 'boolean'
|
|
264
|
-
aliases = ('bool',)
|
|
265
239
|
value_types = (str, int, float, NoneType)
|
|
266
240
|
|
|
267
|
-
def _non_string_convert(self, value
|
|
241
|
+
def _non_string_convert(self, value):
|
|
268
242
|
return value
|
|
269
243
|
|
|
270
|
-
def _convert(self, value
|
|
244
|
+
def _convert(self, value):
|
|
271
245
|
normalized = value.title()
|
|
272
246
|
if normalized == 'None':
|
|
273
247
|
return None
|
|
@@ -283,26 +257,20 @@ class IntegerConverter(TypeConverter):
|
|
|
283
257
|
type = int
|
|
284
258
|
abc = Integral
|
|
285
259
|
type_name = 'integer'
|
|
286
|
-
aliases = ('int', 'long')
|
|
287
260
|
value_types = (str, float)
|
|
288
261
|
|
|
289
|
-
def _non_string_convert(self, value
|
|
262
|
+
def _non_string_convert(self, value):
|
|
290
263
|
if value.is_integer():
|
|
291
264
|
return int(value)
|
|
292
265
|
raise ValueError('Conversion would lose precision.')
|
|
293
266
|
|
|
294
|
-
def _convert(self, value
|
|
267
|
+
def _convert(self, value):
|
|
295
268
|
value = self._remove_number_separators(value)
|
|
296
269
|
value, base = self._get_base(value)
|
|
297
270
|
try:
|
|
298
271
|
return int(value, base)
|
|
299
272
|
except ValueError:
|
|
300
|
-
|
|
301
|
-
try:
|
|
302
|
-
return float(value)
|
|
303
|
-
except ValueError:
|
|
304
|
-
pass
|
|
305
|
-
raise ValueError
|
|
273
|
+
raise ValueError
|
|
306
274
|
|
|
307
275
|
def _get_base(self, value):
|
|
308
276
|
value = value.lower()
|
|
@@ -319,10 +287,9 @@ class FloatConverter(TypeConverter):
|
|
|
319
287
|
type = float
|
|
320
288
|
abc = Real
|
|
321
289
|
type_name = 'float'
|
|
322
|
-
aliases = ('double',)
|
|
323
290
|
value_types = (str, Real)
|
|
324
291
|
|
|
325
|
-
def _convert(self, value
|
|
292
|
+
def _convert(self, value):
|
|
326
293
|
try:
|
|
327
294
|
return float(self._remove_number_separators(value))
|
|
328
295
|
except ValueError:
|
|
@@ -335,7 +302,7 @@ class DecimalConverter(TypeConverter):
|
|
|
335
302
|
type_name = 'decimal'
|
|
336
303
|
value_types = (str, int, float)
|
|
337
304
|
|
|
338
|
-
def _convert(self, value
|
|
305
|
+
def _convert(self, value):
|
|
339
306
|
try:
|
|
340
307
|
return Decimal(self._remove_number_separators(value))
|
|
341
308
|
except InvalidOperation:
|
|
@@ -352,10 +319,10 @@ class BytesConverter(TypeConverter):
|
|
|
352
319
|
type_name = 'bytes'
|
|
353
320
|
value_types = (str, bytearray)
|
|
354
321
|
|
|
355
|
-
def _non_string_convert(self, value
|
|
322
|
+
def _non_string_convert(self, value):
|
|
356
323
|
return bytes(value)
|
|
357
324
|
|
|
358
|
-
def _convert(self, value
|
|
325
|
+
def _convert(self, value):
|
|
359
326
|
try:
|
|
360
327
|
return value.encode('latin-1')
|
|
361
328
|
except UnicodeEncodeError as err:
|
|
@@ -369,10 +336,10 @@ class ByteArrayConverter(TypeConverter):
|
|
|
369
336
|
type_name = 'bytearray'
|
|
370
337
|
value_types = (str, bytes)
|
|
371
338
|
|
|
372
|
-
def _non_string_convert(self, value
|
|
339
|
+
def _non_string_convert(self, value):
|
|
373
340
|
return bytearray(value)
|
|
374
341
|
|
|
375
|
-
def _convert(self, value
|
|
342
|
+
def _convert(self, value):
|
|
376
343
|
try:
|
|
377
344
|
return bytearray(value, 'latin-1')
|
|
378
345
|
except UnicodeEncodeError as err:
|
|
@@ -386,7 +353,7 @@ class DateTimeConverter(TypeConverter):
|
|
|
386
353
|
type_name = 'datetime'
|
|
387
354
|
value_types = (str, int, float)
|
|
388
355
|
|
|
389
|
-
def _convert(self, value
|
|
356
|
+
def _convert(self, value):
|
|
390
357
|
return convert_date(value, result_format='datetime')
|
|
391
358
|
|
|
392
359
|
|
|
@@ -395,7 +362,7 @@ class DateConverter(TypeConverter):
|
|
|
395
362
|
type = date
|
|
396
363
|
type_name = 'date'
|
|
397
364
|
|
|
398
|
-
def _convert(self, value
|
|
365
|
+
def _convert(self, value):
|
|
399
366
|
dt = convert_date(value, result_format='datetime')
|
|
400
367
|
if dt.hour or dt.minute or dt.second or dt.microsecond:
|
|
401
368
|
raise ValueError("Value is datetime, not date.")
|
|
@@ -408,7 +375,7 @@ class TimeDeltaConverter(TypeConverter):
|
|
|
408
375
|
type_name = 'timedelta'
|
|
409
376
|
value_types = (str, int, float)
|
|
410
377
|
|
|
411
|
-
def _convert(self, value
|
|
378
|
+
def _convert(self, value):
|
|
412
379
|
return convert_time(value, result_format='timedelta')
|
|
413
380
|
|
|
414
381
|
|
|
@@ -419,7 +386,7 @@ class PathConverter(TypeConverter):
|
|
|
419
386
|
type_name = 'Path'
|
|
420
387
|
value_types = (str, PurePath)
|
|
421
388
|
|
|
422
|
-
def _convert(self, value
|
|
389
|
+
def _convert(self, value):
|
|
423
390
|
return Path(value)
|
|
424
391
|
|
|
425
392
|
|
|
@@ -429,10 +396,10 @@ class NoneConverter(TypeConverter):
|
|
|
429
396
|
type_name = 'None'
|
|
430
397
|
|
|
431
398
|
@classmethod
|
|
432
|
-
def handles(cls,
|
|
433
|
-
return
|
|
399
|
+
def handles(cls, type_info: 'TypeInfo') -> bool:
|
|
400
|
+
return type_info.type in (NoneType, None)
|
|
434
401
|
|
|
435
|
-
def _convert(self, value
|
|
402
|
+
def _convert(self, value):
|
|
436
403
|
if value.upper() == 'NONE':
|
|
437
404
|
return None
|
|
438
405
|
raise ValueError
|
|
@@ -445,19 +412,16 @@ class ListConverter(TypeConverter):
|
|
|
445
412
|
abc = Sequence
|
|
446
413
|
value_types = (str, Sequence)
|
|
447
414
|
|
|
448
|
-
def __init__(self,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
415
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
416
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
417
|
+
languages: LanguagesLike = None):
|
|
418
|
+
super().__init__(type_info, custom_converters, languages)
|
|
419
|
+
nested = type_info.nested
|
|
420
|
+
if not nested:
|
|
452
421
|
self.converter = None
|
|
453
422
|
else:
|
|
454
|
-
self.type_name =
|
|
455
|
-
self.converter = self.converter_for(
|
|
456
|
-
|
|
457
|
-
@classmethod
|
|
458
|
-
def handles(cls, type_):
|
|
459
|
-
# `type_ is not Tuple` is needed with Python 3.6.
|
|
460
|
-
return super().handles(type_) and type_ is not Tuple
|
|
423
|
+
self.type_name = str(type_info)
|
|
424
|
+
self.converter = self.converter_for(nested[0], custom_converters, languages)
|
|
461
425
|
|
|
462
426
|
def no_conversion_needed(self, value):
|
|
463
427
|
if isinstance(value, str) or not super().no_conversion_needed(value):
|
|
@@ -466,16 +430,16 @@ class ListConverter(TypeConverter):
|
|
|
466
430
|
return True
|
|
467
431
|
return all(self.converter.no_conversion_needed(v) for v in value)
|
|
468
432
|
|
|
469
|
-
def _non_string_convert(self, value
|
|
470
|
-
return self._convert_items(list(value)
|
|
433
|
+
def _non_string_convert(self, value):
|
|
434
|
+
return self._convert_items(list(value))
|
|
471
435
|
|
|
472
|
-
def _convert(self, value
|
|
473
|
-
return self._convert_items(self._literal_eval(value, list)
|
|
436
|
+
def _convert(self, value):
|
|
437
|
+
return self._convert_items(self._literal_eval(value, list))
|
|
474
438
|
|
|
475
|
-
def _convert_items(self, value
|
|
439
|
+
def _convert_items(self, value):
|
|
476
440
|
if not self.converter:
|
|
477
441
|
return value
|
|
478
|
-
return [self.converter.convert(
|
|
442
|
+
return [self.converter.convert(v, name=i, kind='Item')
|
|
479
443
|
for i, v in enumerate(value)]
|
|
480
444
|
|
|
481
445
|
|
|
@@ -485,22 +449,24 @@ class TupleConverter(TypeConverter):
|
|
|
485
449
|
type_name = 'tuple'
|
|
486
450
|
value_types = (str, Sequence)
|
|
487
451
|
|
|
488
|
-
def __init__(self,
|
|
489
|
-
|
|
452
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
453
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
454
|
+
languages: LanguagesLike = None):
|
|
455
|
+
super().__init__(type_info, custom_converters, languages)
|
|
490
456
|
self.converters = ()
|
|
491
457
|
self.homogenous = False
|
|
492
|
-
|
|
493
|
-
if not
|
|
458
|
+
nested = type_info.nested
|
|
459
|
+
if not nested:
|
|
494
460
|
return
|
|
495
|
-
if
|
|
496
|
-
|
|
497
|
-
if len(
|
|
461
|
+
if nested[-1].type is Ellipsis:
|
|
462
|
+
nested = nested[:-1]
|
|
463
|
+
if len(nested) != 1:
|
|
498
464
|
raise TypeError(f'Homogenous tuple used as a type hint requires '
|
|
499
|
-
f'exactly one nested type, got {len(
|
|
465
|
+
f'exactly one nested type, got {len(nested)}.')
|
|
500
466
|
self.homogenous = True
|
|
501
|
-
self.type_name =
|
|
467
|
+
self.type_name = str(type_info)
|
|
502
468
|
self.converters = tuple(self.converter_for(t, custom_converters, languages)
|
|
503
|
-
or NullConverter() for t in
|
|
469
|
+
or NullConverter() for t in nested)
|
|
504
470
|
|
|
505
471
|
def no_conversion_needed(self, value):
|
|
506
472
|
if isinstance(value, str) or not super().no_conversion_needed(value):
|
|
@@ -513,23 +479,23 @@ class TupleConverter(TypeConverter):
|
|
|
513
479
|
return False
|
|
514
480
|
return all(c.no_conversion_needed(v) for c, v in zip(self.converters, value))
|
|
515
481
|
|
|
516
|
-
def _non_string_convert(self, value
|
|
517
|
-
return self._convert_items(tuple(value)
|
|
482
|
+
def _non_string_convert(self, value):
|
|
483
|
+
return self._convert_items(tuple(value))
|
|
518
484
|
|
|
519
|
-
def _convert(self, value
|
|
520
|
-
return self._convert_items(self._literal_eval(value, tuple)
|
|
485
|
+
def _convert(self, value):
|
|
486
|
+
return self._convert_items(self._literal_eval(value, tuple))
|
|
521
487
|
|
|
522
|
-
def _convert_items(self, value
|
|
488
|
+
def _convert_items(self, value):
|
|
523
489
|
if not self.converters:
|
|
524
490
|
return value
|
|
525
491
|
if self.homogenous:
|
|
526
492
|
conv = self.converters[0]
|
|
527
|
-
return tuple(conv.convert(str(i),
|
|
493
|
+
return tuple(conv.convert(v, name=str(i), kind='Item')
|
|
528
494
|
for i, v in enumerate(value))
|
|
529
495
|
if len(self.converters) != len(value):
|
|
530
496
|
raise ValueError(f'Expected {len(self.converters)} '
|
|
531
497
|
f'item{s(self.converters)}, got {len(value)}.')
|
|
532
|
-
return tuple(conv.convert(
|
|
498
|
+
return tuple(conv.convert(v, name=str(i), kind='Item')
|
|
533
499
|
for i, (conv, v) in enumerate(zip(self.converters, value)))
|
|
534
500
|
|
|
535
501
|
|
|
@@ -537,26 +503,27 @@ class TupleConverter(TypeConverter):
|
|
|
537
503
|
class TypedDictConverter(TypeConverter):
|
|
538
504
|
type = 'TypedDict'
|
|
539
505
|
value_types = (str, Mapping)
|
|
506
|
+
type_info: 'TypedDictInfo'
|
|
540
507
|
|
|
541
|
-
def __init__(self,
|
|
542
|
-
|
|
508
|
+
def __init__(self, type_info: 'TypedDictInfo',
|
|
509
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
510
|
+
languages: LanguagesLike = None):
|
|
511
|
+
super().__init__(type_info, custom_converters, languages)
|
|
543
512
|
self.converters = {n: self.converter_for(t, custom_converters, languages)
|
|
544
|
-
for n, t in
|
|
545
|
-
self.type_name =
|
|
546
|
-
# __required_keys__ is new in Python 3.9.
|
|
547
|
-
self.required_keys = getattr(used_type, '__required_keys__', frozenset())
|
|
513
|
+
for n, t in type_info.annotations.items()}
|
|
514
|
+
self.type_name = type_info.name
|
|
548
515
|
|
|
549
516
|
@classmethod
|
|
550
|
-
def handles(cls,
|
|
551
|
-
return
|
|
517
|
+
def handles(cls, type_info: 'TypeInfo') -> bool:
|
|
518
|
+
return type_info.is_typed_dict
|
|
552
519
|
|
|
553
520
|
def no_conversion_needed(self, value):
|
|
554
521
|
return False
|
|
555
522
|
|
|
556
|
-
def _non_string_convert(self, value
|
|
523
|
+
def _non_string_convert(self, value):
|
|
557
524
|
return self._convert_items(value)
|
|
558
525
|
|
|
559
|
-
def _convert(self, value
|
|
526
|
+
def _convert(self, value):
|
|
560
527
|
return self._convert_items(self._literal_eval(value, dict))
|
|
561
528
|
|
|
562
529
|
def _convert_items(self, value):
|
|
@@ -568,14 +535,14 @@ class TypedDictConverter(TypeConverter):
|
|
|
568
535
|
not_allowed.append(key)
|
|
569
536
|
else:
|
|
570
537
|
if converter:
|
|
571
|
-
value[key] = converter.convert(
|
|
538
|
+
value[key] = converter.convert(value[key], name=key, kind='Item')
|
|
572
539
|
if not_allowed:
|
|
573
540
|
error = f'Item{s(not_allowed)} {seq2str(sorted(not_allowed))} not allowed.'
|
|
574
541
|
available = [key for key in self.converters if key not in value]
|
|
575
542
|
if available:
|
|
576
543
|
error += f' Available item{s(available)}: {seq2str(sorted(available))}'
|
|
577
544
|
raise ValueError(error)
|
|
578
|
-
missing = [key for key in self.
|
|
545
|
+
missing = [key for key in self.type_info.required if key not in value]
|
|
579
546
|
if missing:
|
|
580
547
|
raise ValueError(f"Required item{s(missing)} "
|
|
581
548
|
f"{seq2str(sorted(missing))} missing.")
|
|
@@ -587,18 +554,19 @@ class DictionaryConverter(TypeConverter):
|
|
|
587
554
|
type = dict
|
|
588
555
|
abc = Mapping
|
|
589
556
|
type_name = 'dictionary'
|
|
590
|
-
aliases = ('dict', 'map')
|
|
591
557
|
value_types = (str, Mapping)
|
|
592
558
|
|
|
593
|
-
def __init__(self,
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
559
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
560
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
561
|
+
languages: LanguagesLike = None):
|
|
562
|
+
super().__init__(type_info, custom_converters, languages)
|
|
563
|
+
nested = type_info.nested
|
|
564
|
+
if not nested:
|
|
597
565
|
self.converters = ()
|
|
598
566
|
else:
|
|
599
|
-
self.type_name =
|
|
567
|
+
self.type_name = str(type_info)
|
|
600
568
|
self.converters = tuple(self.converter_for(t, custom_converters, languages)
|
|
601
|
-
or NullConverter() for t in
|
|
569
|
+
or NullConverter() for t in nested)
|
|
602
570
|
|
|
603
571
|
def no_conversion_needed(self, value):
|
|
604
572
|
if isinstance(value, str) or not super().no_conversion_needed(value):
|
|
@@ -610,28 +578,26 @@ class DictionaryConverter(TypeConverter):
|
|
|
610
578
|
return all(no_key_conversion_needed(k) and no_value_conversion_needed(v)
|
|
611
579
|
for k, v in value.items())
|
|
612
580
|
|
|
613
|
-
def _non_string_convert(self, value
|
|
581
|
+
def _non_string_convert(self, value):
|
|
614
582
|
if self._used_type_is_dict() and not isinstance(value, dict):
|
|
615
583
|
value = dict(value)
|
|
616
|
-
return self._convert_items(value
|
|
584
|
+
return self._convert_items(value)
|
|
617
585
|
|
|
618
586
|
def _used_type_is_dict(self):
|
|
619
|
-
|
|
620
|
-
return issubclass(used_type, dict)
|
|
587
|
+
return issubclass(self.type_info.type, dict)
|
|
621
588
|
|
|
622
|
-
def _convert(self, value
|
|
623
|
-
return self._convert_items(self._literal_eval(value, dict)
|
|
589
|
+
def _convert(self, value):
|
|
590
|
+
return self._convert_items(self._literal_eval(value, dict))
|
|
624
591
|
|
|
625
|
-
def _convert_items(self, value
|
|
592
|
+
def _convert_items(self, value):
|
|
626
593
|
if not self.converters:
|
|
627
594
|
return value
|
|
628
|
-
convert_key = self._get_converter(self.converters[0],
|
|
629
|
-
convert_value = self._get_converter(self.converters[1],
|
|
595
|
+
convert_key = self._get_converter(self.converters[0], 'Key')
|
|
596
|
+
convert_value = self._get_converter(self.converters[1], 'Item')
|
|
630
597
|
return {convert_key(None, k): convert_value(k, v) for k, v in value.items()}
|
|
631
598
|
|
|
632
|
-
def _get_converter(self, converter,
|
|
633
|
-
return lambda name, value: converter.convert(
|
|
634
|
-
kind=kind)
|
|
599
|
+
def _get_converter(self, converter, kind):
|
|
600
|
+
return lambda name, value: converter.convert(value, name, kind=kind)
|
|
635
601
|
|
|
636
602
|
|
|
637
603
|
@TypeConverter.register
|
|
@@ -641,14 +607,16 @@ class SetConverter(TypeConverter):
|
|
|
641
607
|
type_name = 'set'
|
|
642
608
|
value_types = (str, Container)
|
|
643
609
|
|
|
644
|
-
def __init__(self,
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
610
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
611
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
612
|
+
languages: LanguagesLike = None):
|
|
613
|
+
super().__init__(type_info, custom_converters, languages)
|
|
614
|
+
nested = type_info.nested
|
|
615
|
+
if not nested:
|
|
648
616
|
self.converter = None
|
|
649
617
|
else:
|
|
650
|
-
self.type_name =
|
|
651
|
-
self.converter = self.converter_for(
|
|
618
|
+
self.type_name = str(type_info)
|
|
619
|
+
self.converter = self.converter_for(nested[0], custom_converters, languages)
|
|
652
620
|
|
|
653
621
|
def no_conversion_needed(self, value):
|
|
654
622
|
if isinstance(value, str) or not super().no_conversion_needed(value):
|
|
@@ -657,17 +625,16 @@ class SetConverter(TypeConverter):
|
|
|
657
625
|
return True
|
|
658
626
|
return all(self.converter.no_conversion_needed(v) for v in value)
|
|
659
627
|
|
|
660
|
-
def _non_string_convert(self, value
|
|
661
|
-
return self._convert_items(set(value)
|
|
628
|
+
def _non_string_convert(self, value):
|
|
629
|
+
return self._convert_items(set(value))
|
|
662
630
|
|
|
663
|
-
def _convert(self, value
|
|
664
|
-
return self._convert_items(self._literal_eval(value, set)
|
|
631
|
+
def _convert(self, value):
|
|
632
|
+
return self._convert_items(self._literal_eval(value, set))
|
|
665
633
|
|
|
666
|
-
def _convert_items(self, value
|
|
634
|
+
def _convert_items(self, value):
|
|
667
635
|
if not self.converter:
|
|
668
636
|
return value
|
|
669
|
-
return {self.converter.convert(
|
|
670
|
-
for v in value}
|
|
637
|
+
return {self.converter.convert(v, kind='Item') for v in value}
|
|
671
638
|
|
|
672
639
|
|
|
673
640
|
@TypeConverter.register
|
|
@@ -675,68 +642,61 @@ class FrozenSetConverter(SetConverter):
|
|
|
675
642
|
type = frozenset
|
|
676
643
|
type_name = 'frozenset'
|
|
677
644
|
|
|
678
|
-
def _non_string_convert(self, value
|
|
679
|
-
return frozenset(super()._non_string_convert(value
|
|
645
|
+
def _non_string_convert(self, value):
|
|
646
|
+
return frozenset(super()._non_string_convert(value))
|
|
680
647
|
|
|
681
|
-
def _convert(self, value
|
|
648
|
+
def _convert(self, value):
|
|
682
649
|
# There are issues w/ literal_eval. See self._literal_eval for details.
|
|
683
650
|
if value == 'frozenset()':
|
|
684
651
|
return frozenset()
|
|
685
|
-
return frozenset(super()._convert(value
|
|
652
|
+
return frozenset(super()._convert(value))
|
|
686
653
|
|
|
687
654
|
|
|
688
655
|
@TypeConverter.register
|
|
689
|
-
class
|
|
656
|
+
class UnionConverter(TypeConverter):
|
|
690
657
|
type = Union
|
|
691
658
|
|
|
692
|
-
def __init__(self,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
if not
|
|
699
|
-
|
|
700
|
-
if isinstance(union, tuple):
|
|
701
|
-
return union
|
|
702
|
-
if has_args(union):
|
|
703
|
-
return union.__args__
|
|
704
|
-
return ()
|
|
659
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
660
|
+
custom_converters: 'CustomArgumentConverters|None' = None,
|
|
661
|
+
languages: LanguagesLike = None):
|
|
662
|
+
super().__init__(type_info, custom_converters, languages)
|
|
663
|
+
self.converters = tuple(self.converter_for(info, custom_converters, languages)
|
|
664
|
+
for info in self.type_info.nested)
|
|
665
|
+
if not self.converters:
|
|
666
|
+
raise TypeError('Union used as a type hint cannot be empty.')
|
|
705
667
|
|
|
706
668
|
@property
|
|
707
669
|
def type_name(self):
|
|
708
|
-
if not self.
|
|
670
|
+
if not self.converters:
|
|
709
671
|
return 'union'
|
|
710
|
-
return ' or '.join(type_name
|
|
672
|
+
return ' or '.join(c.type_name for c in self.converters)
|
|
711
673
|
|
|
712
674
|
@classmethod
|
|
713
|
-
def handles(cls,
|
|
714
|
-
return is_union
|
|
675
|
+
def handles(cls, type_info: 'TypeInfo') -> bool:
|
|
676
|
+
return type_info.is_union
|
|
715
677
|
|
|
716
678
|
def _handles_value(self, value):
|
|
717
679
|
return True
|
|
718
680
|
|
|
719
681
|
def no_conversion_needed(self, value):
|
|
720
|
-
for converter,
|
|
682
|
+
for converter, info in zip(self.converters, self.type_info.nested):
|
|
721
683
|
if converter:
|
|
722
684
|
if converter.no_conversion_needed(value):
|
|
723
685
|
return True
|
|
724
686
|
else:
|
|
725
687
|
try:
|
|
726
|
-
if isinstance(value,
|
|
688
|
+
if isinstance(value, info.type):
|
|
727
689
|
return True
|
|
728
690
|
except TypeError:
|
|
729
691
|
pass
|
|
730
692
|
return False
|
|
731
693
|
|
|
732
|
-
def _convert(self, value
|
|
733
|
-
if not self.used_type:
|
|
734
|
-
raise ValueError('Cannot have union without types.')
|
|
694
|
+
def _convert(self, value):
|
|
735
695
|
unrecognized_types = False
|
|
736
696
|
for converter in self.converters:
|
|
737
697
|
if converter:
|
|
738
698
|
try:
|
|
739
|
-
return converter.convert(
|
|
699
|
+
return converter.convert(value)
|
|
740
700
|
except ValueError:
|
|
741
701
|
pass
|
|
742
702
|
else:
|
|
@@ -748,8 +708,10 @@ class CombinedConverter(TypeConverter):
|
|
|
748
708
|
|
|
749
709
|
class CustomConverter(TypeConverter):
|
|
750
710
|
|
|
751
|
-
def __init__(self,
|
|
752
|
-
|
|
711
|
+
def __init__(self, type_info: 'TypeInfo',
|
|
712
|
+
converter_info: 'ConverterInfo',
|
|
713
|
+
languages: LanguagesLike = None):
|
|
714
|
+
super().__init__(type_info, languages=languages)
|
|
753
715
|
self.converter_info = converter_info
|
|
754
716
|
|
|
755
717
|
@property
|
|
@@ -767,7 +729,7 @@ class CustomConverter(TypeConverter):
|
|
|
767
729
|
def _handles_value(self, value):
|
|
768
730
|
return not self.value_types or isinstance(value, self.value_types)
|
|
769
731
|
|
|
770
|
-
def _convert(self, value
|
|
732
|
+
def _convert(self, value):
|
|
771
733
|
try:
|
|
772
734
|
return self.converter_info.convert(value)
|
|
773
735
|
except ValueError:
|
|
@@ -778,7 +740,7 @@ class CustomConverter(TypeConverter):
|
|
|
778
740
|
|
|
779
741
|
class NullConverter:
|
|
780
742
|
|
|
781
|
-
def convert(self,
|
|
743
|
+
def convert(self, value, name, kind='Argument'):
|
|
782
744
|
return value
|
|
783
745
|
|
|
784
746
|
def no_conversion_needed(self, value):
|