robotframework 6.1.1__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.
Files changed (307) hide show
  1. {robotframework-6.1.1 → robotframework-7.0}/INSTALL.rst +25 -25
  2. {robotframework-6.1.1 → robotframework-7.0}/PKG-INFO +6 -8
  3. {robotframework-6.1.1 → robotframework-7.0}/README.rst +3 -2
  4. {robotframework-6.1.1 → robotframework-7.0}/setup.py +3 -6
  5. {robotframework-6.1.1 → robotframework-7.0}/src/robot/api/__init__.py +4 -1
  6. {robotframework-6.1.1 → robotframework-7.0}/src/robot/api/deco.py +60 -14
  7. {robotframework-6.1.1 → robotframework-7.0}/src/robot/api/exceptions.py +6 -6
  8. {robotframework-6.1.1 → robotframework-7.0}/src/robot/api/interfaces.py +402 -67
  9. {robotframework-6.1.1 → robotframework-7.0}/src/robot/api/logger.py +27 -20
  10. {robotframework-6.1.1 → robotframework-7.0}/src/robot/api/parsing.py +4 -2
  11. robotframework-7.0/src/robot/api/py.typed +0 -0
  12. {robotframework-6.1.1 → robotframework-7.0}/src/robot/conf/gatherfailed.py +2 -2
  13. {robotframework-6.1.1 → robotframework-7.0}/src/robot/conf/languages.py +0 -9
  14. {robotframework-6.1.1 → robotframework-7.0}/src/robot/conf/settings.py +21 -14
  15. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/common/storage.js +11 -6
  16. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/htmlfilewriter.py +1 -1
  17. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/libdoc/libdoc.css +10 -2
  18. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/libdoc/libdoc.html +10 -0
  19. robotframework-7.0/src/robot/htmldata/rebot/common.css +362 -0
  20. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/doc_formatting.css +13 -7
  21. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/log.css +51 -10
  22. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/log.html +14 -23
  23. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/model.js +2 -4
  24. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/report.css +83 -19
  25. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/report.html +22 -7
  26. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/testdata.js +10 -3
  27. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/view.js +84 -0
  28. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/template.py +3 -3
  29. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/builder.py +0 -8
  30. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/datatypes.py +9 -10
  31. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/htmlutils.py +4 -7
  32. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/jsonbuilder.py +38 -20
  33. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/model.py +21 -28
  34. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/robotbuilder.py +50 -31
  35. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/standardtypes.py +9 -1
  36. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/xmlbuilder.py +35 -20
  37. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/xmlwriter.py +18 -38
  38. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/BuiltIn.py +255 -205
  39. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Collections.py +384 -240
  40. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/DateTime.py +73 -60
  41. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/OperatingSystem.py +6 -5
  42. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Process.py +26 -27
  43. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Remote.py +40 -36
  44. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/String.py +66 -76
  45. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/XML.py +66 -59
  46. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/__init__.py +2 -2
  47. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/__init__.py +5 -5
  48. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/body.py +44 -13
  49. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/configurer.py +15 -11
  50. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/control.py +226 -84
  51. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/filter.py +31 -25
  52. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/itemlist.py +9 -8
  53. robotframework-7.0/src/robot/model/keyword.py +77 -0
  54. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/message.py +19 -10
  55. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/modelobject.py +25 -7
  56. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/namepatterns.py +3 -25
  57. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/stats.py +9 -15
  58. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/tags.py +1 -1
  59. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/testcase.py +15 -27
  60. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/testsuite.py +17 -26
  61. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/visitor.py +35 -8
  62. robotframework-7.0/src/robot/output/console/dotted.py +90 -0
  63. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/console/quiet.py +3 -2
  64. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/console/verbose.py +61 -61
  65. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/debugfile.py +39 -24
  66. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/filelogger.py +18 -15
  67. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/librarylogger.py +3 -2
  68. robotframework-7.0/src/robot/output/listeners.py +753 -0
  69. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/logger.py +216 -80
  70. robotframework-7.0/src/robot/output/loggerapi.py +215 -0
  71. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/loggerhelper.py +23 -56
  72. robotframework-7.0/src/robot/output/output.py +185 -0
  73. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/stdoutlogsplitter.py +8 -5
  74. robotframework-7.0/src/robot/output/xmllogger.py +459 -0
  75. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/blocklexers.py +17 -13
  76. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/context.py +12 -2
  77. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/lexer.py +1 -1
  78. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/settings.py +6 -3
  79. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/statementlexers.py +39 -10
  80. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/tokens.py +27 -29
  81. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/model/blocks.py +19 -6
  82. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/model/statements.py +193 -94
  83. robotframework-7.0/src/robot/parsing/model/visitor.py +100 -0
  84. {robotframework-6.1.1 → robotframework-7.0}/src/robot/rebot.py +2 -0
  85. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/expandkeywordmatcher.py +1 -1
  86. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/jsbuildingcontext.py +8 -6
  87. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/jsmodelbuilders.py +88 -61
  88. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/logreportwriters.py +16 -10
  89. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/outputwriter.py +18 -2
  90. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/resultwriter.py +4 -4
  91. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/stringcache.py +3 -3
  92. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/xunitwriter.py +15 -21
  93. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/__init__.py +3 -2
  94. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/configurer.py +12 -9
  95. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/executionresult.py +56 -8
  96. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/flattenkeywordmatcher.py +48 -9
  97. robotframework-7.0/src/robot/result/keywordremover.py +207 -0
  98. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/merger.py +1 -1
  99. robotframework-7.0/src/robot/result/model.py +1185 -0
  100. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/modeldeprecation.py +9 -3
  101. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/resultbuilder.py +46 -36
  102. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/xmlelementhandlers.py +83 -43
  103. {robotframework-6.1.1 → robotframework-7.0}/src/robot/run.py +2 -0
  104. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/__init__.py +14 -4
  105. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/__init__.py +2 -1
  106. robotframework-7.0/src/robot/running/arguments/argumentconverter.py +100 -0
  107. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/argumentmapper.py +26 -24
  108. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/argumentparser.py +82 -60
  109. robotframework-7.0/src/robot/running/arguments/argumentresolver.py +158 -0
  110. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/argumentspec.py +83 -116
  111. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/argumentvalidator.py +33 -27
  112. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/customconverters.py +15 -12
  113. robotframework-7.0/src/robot/running/arguments/embedded.py +145 -0
  114. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/arguments/typeconverters.py +233 -213
  115. robotframework-7.0/src/robot/running/arguments/typeinfo.py +317 -0
  116. robotframework-7.0/src/robot/running/arguments/typeinfoparser.py +219 -0
  117. robotframework-7.0/src/robot/running/arguments/typevalidator.py +60 -0
  118. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/bodyrunner.py +147 -129
  119. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/builder/builders.py +2 -1
  120. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/builder/parsers.py +10 -11
  121. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/builder/settings.py +9 -17
  122. robotframework-7.0/src/robot/running/builder/transformers.py +535 -0
  123. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/context.py +113 -31
  124. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/dynamicmethods.py +62 -34
  125. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/importer.py +27 -49
  126. robotframework-7.0/src/robot/running/invalidkeyword.py +67 -0
  127. robotframework-7.0/src/robot/running/keywordfinder.py +91 -0
  128. robotframework-7.0/src/robot/running/keywordimplementation.py +164 -0
  129. robotframework-7.0/src/robot/running/librarykeyword.py +392 -0
  130. robotframework-7.0/src/robot/running/librarykeywordrunner.py +250 -0
  131. robotframework-7.0/src/robot/running/libraryscopes.py +115 -0
  132. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/model.py +195 -377
  133. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/namespace.py +124 -137
  134. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/outputcapture.py +20 -12
  135. robotframework-7.0/src/robot/running/resourcemodel.py +448 -0
  136. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/statusreporter.py +16 -13
  137. robotframework-7.0/src/robot/running/suiterunner.py +265 -0
  138. robotframework-7.0/src/robot/running/testlibraries.py +500 -0
  139. robotframework-7.0/src/robot/running/userkeywordrunner.py +260 -0
  140. {robotframework-6.1.1 → robotframework-7.0}/src/robot/testdoc.py +18 -13
  141. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/__init__.py +53 -35
  142. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/connectioncache.py +64 -59
  143. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/dotdict.py +3 -0
  144. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/encodingsniffer.py +1 -1
  145. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/escaping.py +19 -19
  146. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/importer.py +2 -2
  147. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/markupwriters.py +23 -15
  148. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/misc.py +1 -2
  149. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/normalizing.py +9 -24
  150. robotframework-7.0/src/robot/utils/notset.py +33 -0
  151. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/platform.py +15 -5
  152. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/robotio.py +9 -9
  153. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/robotpath.py +1 -0
  154. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/robottime.py +122 -90
  155. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/robottypes.py +21 -31
  156. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/setter.py +0 -5
  157. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/text.py +7 -4
  158. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/unic.py +2 -2
  159. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/__init__.py +2 -2
  160. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/assigner.py +17 -19
  161. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/evaluation.py +20 -17
  162. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/filesetter.py +80 -80
  163. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/replacer.py +33 -36
  164. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/scopes.py +17 -12
  165. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/search.py +66 -41
  166. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/store.py +14 -16
  167. robotframework-7.0/src/robot/variables/tablesetter.py +164 -0
  168. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/variables.py +1 -1
  169. {robotframework-6.1.1 → robotframework-7.0}/src/robot/version.py +1 -1
  170. {robotframework-6.1.1 → robotframework-7.0}/src/robotframework.egg-info/PKG-INFO +6 -8
  171. {robotframework-6.1.1 → robotframework-7.0}/src/robotframework.egg-info/SOURCES.txt +10 -8
  172. {robotframework-6.1.1 → robotframework-7.0}/tasks.py +6 -6
  173. robotframework-6.1.1/src/robot/htmldata/rebot/common.css +0 -239
  174. robotframework-6.1.1/src/robot/libraries/Reserved.py +0 -48
  175. robotframework-6.1.1/src/robot/model/keyword.py +0 -173
  176. robotframework-6.1.1/src/robot/output/console/dotted.py +0 -90
  177. robotframework-6.1.1/src/robot/output/listenerarguments.py +0 -165
  178. robotframework-6.1.1/src/robot/output/listenermethods.py +0 -113
  179. robotframework-6.1.1/src/robot/output/listeners.py +0 -174
  180. robotframework-6.1.1/src/robot/output/output.py +0 -95
  181. robotframework-6.1.1/src/robot/output/xmllogger.py +0 -354
  182. robotframework-6.1.1/src/robot/parsing/model/visitor.py +0 -67
  183. robotframework-6.1.1/src/robot/result/keywordremover.py +0 -183
  184. robotframework-6.1.1/src/robot/result/model.py +0 -957
  185. robotframework-6.1.1/src/robot/running/arguments/argumentconverter.py +0 -79
  186. robotframework-6.1.1/src/robot/running/arguments/argumentresolver.py +0 -131
  187. robotframework-6.1.1/src/robot/running/arguments/embedded.py +0 -146
  188. robotframework-6.1.1/src/robot/running/arguments/typevalidator.py +0 -56
  189. robotframework-6.1.1/src/robot/running/builder/transformers.py +0 -642
  190. robotframework-6.1.1/src/robot/running/handlers.py +0 -321
  191. robotframework-6.1.1/src/robot/running/handlerstore.py +0 -66
  192. robotframework-6.1.1/src/robot/running/librarykeywordrunner.py +0 -238
  193. robotframework-6.1.1/src/robot/running/libraryscopes.py +0 -97
  194. robotframework-6.1.1/src/robot/running/modelcombiner.py +0 -32
  195. robotframework-6.1.1/src/robot/running/suiterunner.py +0 -248
  196. robotframework-6.1.1/src/robot/running/testlibraries.py +0 -423
  197. robotframework-6.1.1/src/robot/running/usererrorhandler.py +0 -75
  198. robotframework-6.1.1/src/robot/running/userkeyword.py +0 -111
  199. robotframework-6.1.1/src/robot/running/userkeywordrunner.py +0 -274
  200. robotframework-6.1.1/src/robot/variables/tablesetter.py +0 -156
  201. {robotframework-6.1.1 → robotframework-7.0}/AUTHORS.rst +0 -0
  202. {robotframework-6.1.1 → robotframework-7.0}/BUILD.rst +0 -0
  203. {robotframework-6.1.1 → robotframework-7.0}/CONTRIBUTING.rst +0 -0
  204. {robotframework-6.1.1 → robotframework-7.0}/COPYRIGHT.txt +0 -0
  205. {robotframework-6.1.1 → robotframework-7.0}/LICENSE.txt +0 -0
  206. {robotframework-6.1.1 → robotframework-7.0}/MANIFEST.in +0 -0
  207. {robotframework-6.1.1 → robotframework-7.0}/setup.cfg +0 -0
  208. {robotframework-6.1.1 → robotframework-7.0}/src/robot/__init__.py +0 -0
  209. {robotframework-6.1.1 → robotframework-7.0}/src/robot/__main__.py +0 -0
  210. {robotframework-6.1.1 → robotframework-7.0}/src/robot/conf/__init__.py +0 -0
  211. {robotframework-6.1.1 → robotframework-7.0}/src/robot/errors.py +0 -0
  212. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/__init__.py +0 -0
  213. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/common/__init__.py +0 -0
  214. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/common/js_disabled.css +0 -0
  215. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/jsonwriter.py +0 -0
  216. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/lib/__init__.py +0 -0
  217. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.highlight.min.js +0 -0
  218. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.min.js +0 -0
  219. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.tablesorter.min.js +0 -0
  220. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/lib/jquery.tmpl.min.js +0 -0
  221. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/lib/jsxcompressor.min.js +0 -0
  222. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/libdoc/__init__.py +0 -0
  223. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/libdoc/doc_formatting.css +0 -0
  224. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/libdoc/print.css +0 -0
  225. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/libdoc/pygments.css +0 -0
  226. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/__init__.py +0 -0
  227. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/fileloading.js +0 -0
  228. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/log.js +0 -0
  229. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/print.css +0 -0
  230. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/rebot/util.js +0 -0
  231. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/testdoc/__init__.py +0 -0
  232. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/testdoc/testdoc.css +0 -0
  233. {robotframework-6.1.1 → robotframework-7.0}/src/robot/htmldata/testdoc/testdoc.html +0 -0
  234. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdoc.py +0 -0
  235. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/__init__.py +0 -0
  236. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/consoleviewer.py +0 -0
  237. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/htmlwriter.py +0 -0
  238. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/jsonwriter.py +0 -0
  239. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/output.py +0 -0
  240. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libdocpkg/writer.py +0 -0
  241. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Dialogs.py +0 -0
  242. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Easter.py +0 -0
  243. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Screenshot.py +0 -0
  244. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/Telnet.py +0 -0
  245. {robotframework-6.1.1 → robotframework-7.0}/src/robot/libraries/dialogs_py.py +0 -0
  246. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/fixture.py +0 -0
  247. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/metadata.py +0 -0
  248. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/modifier.py +0 -0
  249. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/statistics.py +0 -0
  250. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/suitestatistics.py +0 -0
  251. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/tagsetter.py +0 -0
  252. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/tagstatistics.py +0 -0
  253. {robotframework-6.1.1 → robotframework-7.0}/src/robot/model/totalstatistics.py +0 -0
  254. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/__init__.py +0 -0
  255. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/console/__init__.py +0 -0
  256. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/console/highlighting.py +0 -0
  257. {robotframework-6.1.1 → robotframework-7.0}/src/robot/output/pyloggingconf.py +0 -0
  258. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/__init__.py +0 -0
  259. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/__init__.py +0 -0
  260. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/lexer/tokenizer.py +0 -0
  261. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/model/__init__.py +0 -0
  262. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/parser/__init__.py +0 -0
  263. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/parser/blockparsers.py +0 -0
  264. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/parser/fileparser.py +0 -0
  265. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/parser/parser.py +0 -0
  266. {robotframework-6.1.1 → robotframework-7.0}/src/robot/parsing/suitestructure.py +0 -0
  267. {robotframework-6.1.1 → robotframework-7.0}/src/robot/pythonpathsetter.py +0 -0
  268. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/__init__.py +0 -0
  269. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/jsexecutionresult.py +0 -0
  270. {robotframework-6.1.1 → robotframework-7.0}/src/robot/reporting/jswriter.py +0 -0
  271. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/executionerrors.py +0 -0
  272. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/messagefilter.py +0 -0
  273. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/suiteteardownfailed.py +0 -0
  274. {robotframework-6.1.1 → robotframework-7.0}/src/robot/result/visitor.py +0 -0
  275. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/builder/__init__.py +0 -0
  276. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/randomizer.py +0 -0
  277. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/runkwregister.py +0 -0
  278. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/signalhandler.py +0 -0
  279. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/status.py +0 -0
  280. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/timeouts/__init__.py +0 -0
  281. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/timeouts/posix.py +0 -0
  282. {robotframework-6.1.1 → robotframework-7.0}/src/robot/running/timeouts/windows.py +0 -0
  283. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/application.py +0 -0
  284. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/argumentparser.py +0 -0
  285. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/asserts.py +0 -0
  286. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/charwidth.py +0 -0
  287. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/compress.py +0 -0
  288. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/encoding.py +0 -0
  289. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/error.py +0 -0
  290. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/etreewrapper.py +0 -0
  291. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/filereader.py +0 -0
  292. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/frange.py +0 -0
  293. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/htmlformatters.py +0 -0
  294. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/markuputils.py +0 -0
  295. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/match.py +0 -0
  296. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/recommendations.py +0 -0
  297. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/restreader.py +0 -0
  298. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/robotenv.py +0 -0
  299. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/robotinspect.py +0 -0
  300. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/sortable.py +0 -0
  301. {robotframework-6.1.1 → robotframework-7.0}/src/robot/utils/typehints.py +0 -0
  302. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/finders.py +0 -0
  303. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/notfound.py +0 -0
  304. {robotframework-6.1.1 → robotframework-7.0}/src/robot/variables/resolvable.py +0 -0
  305. {robotframework-6.1.1 → robotframework-7.0}/src/robotframework.egg-info/dependency_links.txt +0 -0
  306. {robotframework-6.1.1 → robotframework-7.0}/src/robotframework.egg-info/entry_points.txt +0 -0
  307. {robotframework-6.1.1 → robotframework-7.0}/src/robotframework.egg-info/top_level.txt +0 -0
@@ -16,7 +16,7 @@
16
16
  import re
17
17
  import time
18
18
  import warnings
19
- from datetime import timedelta
19
+ from datetime import datetime, timedelta
20
20
 
21
21
  from .normalizing import normalize
22
22
  from .misc import plural_or_not
@@ -40,7 +40,7 @@ def _float_secs_to_secs_and_millis(secs):
40
40
  return (isecs, millis) if millis < 1000 else (isecs+1, 0)
41
41
 
42
42
 
43
- def timestr_to_secs(timestr, round_to=3, accept_plain_values=True):
43
+ def timestr_to_secs(timestr, round_to=3):
44
44
  """Parses time strings like '1h 10s', '01:00:10' and '42' and returns seconds.
45
45
 
46
46
  Time can also be given as an integer or float or, starting from RF 6.0.1,
@@ -48,23 +48,16 @@ def timestr_to_secs(timestr, round_to=3, accept_plain_values=True):
48
48
 
49
49
  The result is rounded according to the `round_to` argument.
50
50
  Use `round_to=None` to disable rounding altogether.
51
-
52
- `accept_plain_values` is considered deprecated and should not be used.
53
51
  """
54
52
  if is_string(timestr) or is_number(timestr):
55
- if accept_plain_values:
56
- converters = [_number_to_secs, _timer_to_secs, _time_string_to_secs]
57
- else:
58
- # TODO: Remove 'accept_plain_values' in 7.0
59
- warnings.warn("'accept_plain_values' is deprecated and will be removed in RF 7.0.")
60
- converters = [_timer_to_secs, _time_string_to_secs]
53
+ converters = [_number_to_secs, _timer_to_secs, _time_string_to_secs]
61
54
  for converter in converters:
62
55
  secs = converter(timestr)
63
56
  if secs is not None:
64
57
  return secs if round_to is None else round(secs, round_to)
65
58
  if isinstance(timestr, timedelta):
66
59
  return timestr.total_seconds()
67
- raise ValueError("Invalid time string '%s'." % timestr)
60
+ raise ValueError(f"Invalid time string '{timestr}'.")
68
61
 
69
62
 
70
63
  def _number_to_secs(number):
@@ -104,7 +97,7 @@ def _time_string_to_secs(timestr):
104
97
  try:
105
98
  if c == 'n': nanos = float(''.join(temp)); temp = []
106
99
  elif c == 'u': micros = float(''.join(temp)); temp = []
107
- elif c == 'x': millis = float(''.join(temp)); temp = []
100
+ elif c == 'M': millis = float(''.join(temp)); temp = []
108
101
  elif c == 's': secs = float(''.join(temp)); temp = []
109
102
  elif c == 'm': mins = float(''.join(temp)); temp = []
110
103
  elif c == 'h': hours = float(''.join(temp)); temp = []
@@ -122,7 +115,7 @@ def _normalize_timestr(timestr):
122
115
  timestr = normalize(timestr)
123
116
  for specifier, aliases in [('n', ['nanosecond', 'ns']),
124
117
  ('u', ['microsecond', 'us', 'μs']),
125
- ('x', ['millisecond', 'millisec', 'millis',
118
+ ('M', ['millisecond', 'millisec', 'millis',
126
119
  'msec', 'ms']),
127
120
  ('s', ['second', 'sec']),
128
121
  ('m', ['minute', 'min']),
@@ -135,7 +128,7 @@ def _normalize_timestr(timestr):
135
128
  return timestr
136
129
 
137
130
 
138
- def secs_to_timestr(secs, compact=False):
131
+ def secs_to_timestr(secs: 'int|float|timedelta', compact=False) -> str:
139
132
  """Converts time in seconds to a string representation.
140
133
 
141
134
  Returned string is in format like
@@ -143,12 +136,14 @@ def secs_to_timestr(secs, compact=False):
143
136
 
144
137
  - Time parts having zero value are not included (e.g. '3 minutes 4 seconds'
145
138
  instead of '0 days 0 hours 3 minutes 4 seconds')
146
- - Hour part has a maximun of 23 and minutes and seconds both have 59
139
+ - Hour part has a maximum of 23 and minutes and seconds both have 59
147
140
  (e.g. '1 minute 40 seconds' instead of '100 seconds')
148
141
 
149
142
  If compact has value 'True', short suffixes are used.
150
143
  (e.g. 1d 2h 3min 4s 5ms)
151
144
  """
145
+ if isinstance(secs, timedelta):
146
+ secs = secs.total_seconds()
152
147
  return _SecsToTimestrHelper(secs, compact).get_value()
153
148
 
154
149
 
@@ -157,13 +152,12 @@ class _SecsToTimestrHelper:
157
152
  def __init__(self, float_secs, compact):
158
153
  self._compact = compact
159
154
  self._ret = []
160
- self._sign, millis, secs, mins, hours, days \
161
- = self._secs_to_components(float_secs)
162
- self._add_item(days, 'd', 'day')
163
- self._add_item(hours, 'h', 'hour')
164
- self._add_item(mins, 'min', 'minute')
165
- self._add_item(secs, 's', 'second')
166
- self._add_item(millis, 'ms', 'millisecond')
155
+ self._sign, ms, sec, min, hour, day = self._secs_to_components(float_secs)
156
+ self._add_item(day, 'd', 'day')
157
+ self._add_item(hour, 'h', 'hour')
158
+ self._add_item(min, 'min', 'minute')
159
+ self._add_item(sec, 's', 'second')
160
+ self._add_item(ms, 'ms', 'millisecond')
167
161
 
168
162
  def get_value(self):
169
163
  if len(self._ret) > 0:
@@ -195,17 +189,9 @@ class _SecsToTimestrHelper:
195
189
 
196
190
  def format_time(timetuple_or_epochsecs, daysep='', daytimesep=' ', timesep=':',
197
191
  millissep=None):
198
- """Returns a timestamp formatted from given time using separators.
199
-
200
- Time can be given either as a timetuple or seconds after epoch.
201
-
202
- Timetuple is (year, month, day, hour, min, sec[, millis]), where parts must
203
- be integers and millis is required only when millissep is not None.
204
- Notice that this is not 100% compatible with standard Python timetuples
205
- which do not have millis.
206
-
207
- Seconds after epoch can be either an integer or a float.
208
- """
192
+ """Deprecated in Robot Framework 7.0. Will be removed in Robot Framework 8.0."""
193
+ warnings.warn("'robot.utils.format_time' is deprecated and will be "
194
+ "removed in Robot Framework 8.0.")
209
195
  if is_number(timetuple_or_epochsecs):
210
196
  timetuple = _get_timetuple(timetuple_or_epochsecs)
211
197
  else:
@@ -239,14 +225,15 @@ def get_time(format='timestamp', time_=None):
239
225
  # 1) Return time in seconds since epoc
240
226
  if 'epoch' in format:
241
227
  return time_
242
- timetuple = time.localtime(time_)
228
+ dt = datetime.fromtimestamp(time_)
243
229
  parts = []
244
- for i, match in enumerate('year month day hour min sec'.split()):
245
- if match in format:
246
- parts.append('%.2d' % timetuple[i])
230
+ for part, name in [(dt.year, 'year'), (dt.month, 'month'), (dt.day, 'day'),
231
+ (dt.hour, 'hour'), (dt.minute, 'min'), (dt.second, 'sec')]:
232
+ if name in format:
233
+ parts.append(f'{part:02}')
247
234
  # 2) Return time as timestamp
248
235
  if not parts:
249
- return format_time(timetuple, daysep='-')
236
+ return dt.isoformat(' ', timespec='seconds')
250
237
  # Return requested parts of the time
251
238
  elif len(parts) == 1:
252
239
  return parts[0]
@@ -254,6 +241,50 @@ def get_time(format='timestamp', time_=None):
254
241
  return parts
255
242
 
256
243
 
244
+ def parse_timestamp(timestamp: 'str|datetime') -> datetime:
245
+ """Parse timestamp in ISO 8601-like formats into a ``datetime``.
246
+
247
+ Months, days, hours, minutes and seconds must use two digits and
248
+ year must use four. Microseconds can use up to six digits. All time
249
+ parts can be omitted.
250
+
251
+ Separators '-', '_', ' ', 'T', ':' and '.' between date and time components.
252
+ Separators can also be omitted altogether.
253
+
254
+ Examples::
255
+
256
+ 2023-09-08T14:34:42.123456
257
+ 2023-09-08 14:34:42.123
258
+ 20230908 143442
259
+ 2023_09_08
260
+
261
+ This is similar to ``datetime.fromisoformat``, but a little less strict.
262
+ The standard function is recommended if the input format is known to be
263
+ accepted.
264
+
265
+ If the input is a ``datetime``, it is returned as-is.
266
+
267
+ New in Robot Framework 7.0.
268
+ """
269
+ if isinstance(timestamp, datetime):
270
+ return timestamp
271
+ try:
272
+ return datetime.fromisoformat(timestamp)
273
+ except ValueError:
274
+ pass
275
+ orig = timestamp
276
+ for sep in ('-', '_', ' ', 'T', ':', '.'):
277
+ if sep in timestamp:
278
+ timestamp = timestamp.replace(sep, '')
279
+ timestamp = timestamp.ljust(20, '0')
280
+ try:
281
+ return datetime(int(timestamp[0:4]), int(timestamp[4:6]), int(timestamp[6:8]),
282
+ int(timestamp[8:10]), int(timestamp[10:12]), int(timestamp[12:14]),
283
+ int(timestamp[14:20]))
284
+ except ValueError:
285
+ raise ValueError(f"Invalid timestamp '{orig}'.")
286
+
287
+
257
288
  def parse_time(timestr):
258
289
  """Parses the time string and returns its value as seconds since epoch.
259
290
 
@@ -290,7 +321,7 @@ def _parse_time_epoch(timestr):
290
321
 
291
322
  def _parse_time_timestamp(timestr):
292
323
  try:
293
- return timestamp_to_secs(timestr, (' ', ':', '-', '.'))
324
+ return parse_timestamp(timestr).timestamp()
294
325
  except ValueError:
295
326
  return None
296
327
 
@@ -333,10 +364,23 @@ def _get_dst_difference(time1, time2):
333
364
 
334
365
 
335
366
  def get_timestamp(daysep='', daytimesep=' ', timesep=':', millissep='.'):
336
- return TIMESTAMP_CACHE.get_timestamp(daysep, daytimesep, timesep, millissep)
367
+ """Deprecated in Robot Framework 7.0. Will be removed in Robot Framework 8.0."""
368
+ warnings.warn("'robot.utils.get_timestamp' is deprecated and will be "
369
+ "removed in Robot Framework 8.0.")
370
+ dt = datetime.now()
371
+ parts = [str(dt.year), daysep, f'{dt.month:02}', daysep, f'{dt.day:02}', daytimesep,
372
+ f'{dt.hour:02}', timesep, f'{dt.minute:02}', timesep, f'{dt.second:02}']
373
+ if millissep:
374
+ # Make sure milliseconds is < 1000. Good enough for a deprecated function.
375
+ millis = min(round(dt.microsecond, -3) // 1000, 999)
376
+ parts.extend([millissep, f'{millis:03}'])
377
+ return ''.join(parts)
337
378
 
338
379
 
339
380
  def timestamp_to_secs(timestamp, seps=None):
381
+ """Deprecated in Robot Framework 7.0. Will be removed in Robot Framework 8.0."""
382
+ warnings.warn("'robot.utils.timestamp_to_secs' is deprecated and will be "
383
+ "removed in Robot Framework 8.0. User 'parse_timestamp' instead.")
340
384
  try:
341
385
  secs = _timestamp_to_millis(timestamp, seps) / 1000.0
342
386
  except (ValueError, OverflowError):
@@ -346,6 +390,9 @@ def timestamp_to_secs(timestamp, seps=None):
346
390
 
347
391
 
348
392
  def secs_to_timestamp(secs, seps=None, millis=False):
393
+ """Deprecated in Robot Framework 7.0. Will be removed in Robot Framework 8.0."""
394
+ warnings.warn("'robot.utils.secs_to_timestamp' is deprecated and will be "
395
+ "removed in Robot Framework 8.0.")
349
396
  if not seps:
350
397
  seps = ('', ' ', ':', '.' if millis else None)
351
398
  ttuple = time.localtime(secs)[:6]
@@ -356,43 +403,67 @@ def secs_to_timestamp(secs, seps=None, millis=False):
356
403
 
357
404
 
358
405
  def get_elapsed_time(start_time, end_time):
359
- """Returns the time between given timestamps in milliseconds."""
406
+ """Deprecated in Robot Framework 7.0. Will be removed in Robot Framework 8.0."""
407
+ warnings.warn("'robot.utils.get_elapsed_time' is deprecated and will be "
408
+ "removed in Robot Framework 8.0.")
360
409
  if start_time == end_time or not (start_time and end_time):
361
410
  return 0
362
411
  if start_time[:-4] == end_time[:-4]:
363
412
  return int(end_time[-3:]) - int(start_time[-3:])
364
413
  start_millis = _timestamp_to_millis(start_time)
365
414
  end_millis = _timestamp_to_millis(end_time)
366
- # start/end_millis can be long but we want to return int when possible
367
- return int(end_millis - start_millis)
415
+ return end_millis - start_millis
416
+
368
417
 
418
+ def elapsed_time_to_string(elapsed: 'int|float|timedelta',
419
+ include_millis: bool = True,
420
+ seconds: bool = False):
421
+ """Converts elapsed time to format 'hh:mm:ss.mil'.
369
422
 
370
- def elapsed_time_to_string(elapsed, include_millis=True):
371
- """Converts elapsed time in milliseconds to format 'hh:mm:ss.mil'.
423
+ Elapsed time as an integer or as a float is currently considered to be
424
+ milliseconds, but that will be changed to seconds in Robot Framework 8.0.
425
+ Use ``seconds=True`` to change the behavior already now and to avoid the
426
+ deprecation warning. An alternative is giving the elapsed time as
427
+ a ``timedelta``.
372
428
 
373
429
  If `include_millis` is True, '.mil' part is omitted.
430
+
431
+ Support for giving the elapsed time as a ``timedelta`` and the ``seconds``
432
+ argument are new in Robot Framework 7.0.
374
433
  """
434
+ # TODO: Change the default input to seconds in RF 8.0.
435
+ if isinstance(elapsed, timedelta):
436
+ elapsed = elapsed.total_seconds()
437
+ elif not seconds:
438
+ elapsed /= 1000
439
+ warnings.warn("'robot.utils.elapsed_time_to_string' currently accepts "
440
+ "input as milliseconds, but that will be changed to seconds "
441
+ "in Robot Framework 8.0. Use 'seconds=True' to change the "
442
+ "behavior already now and to avoid this warning. Alternatively "
443
+ "pass the elapsed time as a 'timedelta'.")
375
444
  prefix = ''
376
445
  if elapsed < 0:
377
446
  prefix = '-'
378
447
  elapsed = abs(elapsed)
379
448
  if include_millis:
380
- return prefix + _elapsed_time_to_string(elapsed)
449
+ return prefix + _elapsed_time_to_string_with_millis(elapsed)
381
450
  return prefix + _elapsed_time_to_string_without_millis(elapsed)
382
451
 
383
452
 
384
- def _elapsed_time_to_string(elapsed):
385
- secs, millis = divmod(round(elapsed), 1000)
453
+ def _elapsed_time_to_string_with_millis(elapsed):
454
+ elapsed = round(elapsed, 3)
455
+ secs = int(elapsed)
456
+ millis = round((elapsed - secs) * 1000)
386
457
  mins, secs = divmod(secs, 60)
387
458
  hours, mins = divmod(mins, 60)
388
- return '%02d:%02d:%02d.%03d' % (hours, mins, secs, millis)
459
+ return f'{hours:02}:{mins:02}:{secs:02}.{millis:03}'
389
460
 
390
461
 
391
462
  def _elapsed_time_to_string_without_millis(elapsed):
392
- secs = round(elapsed, ndigits=-3) // 1000
463
+ secs = round(elapsed)
393
464
  mins, secs = divmod(secs, 60)
394
465
  hours, mins = divmod(mins, 60)
395
- return '%02d:%02d:%02d' % (hours, mins, secs)
466
+ return f'{hours:02}:{mins:02}:{secs:02}'
396
467
 
397
468
 
398
469
  def _timestamp_to_millis(timestamp, seps=None):
@@ -420,42 +491,3 @@ def _split_timestamp(timestamp):
420
491
  secs = int(timestamp[15:17])
421
492
  millis = int(timestamp[18:21])
422
493
  return years, mons, days, hours, mins, secs, millis
423
-
424
-
425
- class TimestampCache:
426
-
427
- def __init__(self):
428
- self._previous_secs = None
429
- self._previous_separators = None
430
- self._previous_timestamp = None
431
-
432
- def get_timestamp(self, daysep='', daytimesep=' ', timesep=':', millissep='.'):
433
- epoch = self._get_epoch()
434
- secs, millis = _float_secs_to_secs_and_millis(epoch)
435
- if self._use_cache(secs, daysep, daytimesep, timesep):
436
- return self._cached_timestamp(millis, millissep)
437
- timestamp = format_time(epoch, daysep, daytimesep, timesep, millissep)
438
- self._cache_timestamp(secs, timestamp, daysep, daytimesep, timesep, millissep)
439
- return timestamp
440
-
441
- # Seam for mocking
442
- def _get_epoch(self):
443
- return time.time()
444
-
445
- def _use_cache(self, secs, *separators):
446
- return self._previous_timestamp \
447
- and self._previous_secs == secs \
448
- and self._previous_separators == separators
449
-
450
- def _cached_timestamp(self, millis, millissep):
451
- if millissep:
452
- return self._previous_timestamp + millissep + format(millis, '03d')
453
- return self._previous_timestamp
454
-
455
- def _cache_timestamp(self, secs, timestamp, daysep, daytimesep, timesep, millissep):
456
- self._previous_secs = secs
457
- self._previous_separators = (daysep, daytimesep, timesep)
458
- self._previous_timestamp = timestamp[:-4] if millissep else timestamp
459
-
460
-
461
- TIMESTAMP_CACHE = TimestampCache()
@@ -17,30 +17,23 @@ from collections.abc import Iterable, Mapping
17
17
  from collections import UserString
18
18
  from io import IOBase
19
19
  from os import PathLike
20
- from typing import Any, TypeVar
20
+ from typing import Literal, Union, TypedDict, TypeVar
21
21
  try:
22
22
  from types import UnionType
23
23
  except ImportError: # Python < 3.10
24
24
  UnionType = ()
25
- from typing import Union
26
- try:
27
- from typing import TypedDict
28
- except ImportError: # Python < 3.8
29
- typeddict_types = ()
30
- else:
31
- typeddict_types = (type(TypedDict('Dummy', {})),)
25
+
32
26
  try:
33
27
  from typing_extensions import TypedDict as ExtTypedDict
34
28
  except ImportError:
35
- pass
36
- else:
37
- typeddict_types += (type(ExtTypedDict('Dummy', {})),)
38
-
39
- from .platform import PY_VERSION
29
+ ExtTypedDict = None
40
30
 
41
31
 
42
32
  TRUE_STRINGS = {'TRUE', 'YES', 'ON', '1'}
43
33
  FALSE_STRINGS = {'FALSE', 'NO', 'OFF', '0', 'NONE', ''}
34
+ typeddict_types = (type(TypedDict('Dummy', {})),)
35
+ if ExtTypedDict:
36
+ typeddict_types += (type(ExtTypedDict('Dummy', {})),)
44
37
 
45
38
 
46
39
  def is_integer(item):
@@ -73,10 +66,9 @@ def is_dict_like(item):
73
66
  return isinstance(item, Mapping)
74
67
 
75
68
 
76
- def is_union(item, allow_tuple=False):
69
+ def is_union(item):
77
70
  return (isinstance(item, UnionType)
78
- or getattr(item, '__origin__', None) is Union
79
- or (allow_tuple and isinstance(item, tuple)))
71
+ or getattr(item, '__origin__', None) is Union)
80
72
 
81
73
 
82
74
  def type_name(item, capitalize=False):
@@ -87,8 +79,9 @@ def type_name(item, capitalize=False):
87
79
  if getattr(item, '__origin__', None):
88
80
  item = item.__origin__
89
81
  if hasattr(item, '_name') and item._name:
90
- # Union, Any, etc. from typing have real name in _name and __name__ is just
91
- # generic `SpecialForm`. Also, pandas.Series has _name but it's None.
82
+ # Prior to Python 3.10 Union, Any, etc. from typing didn't have `__name__`.
83
+ # but instead had `_name`. Python 3.10 has both and newer only `__name__`.
84
+ # Also, pandas.Series has `_name` but it's None.
92
85
  name = item._name
93
86
  elif is_union(item):
94
87
  name = 'Union'
@@ -99,12 +92,6 @@ def type_name(item, capitalize=False):
99
92
  named_types = {str: 'string', bool: 'boolean', int: 'integer',
100
93
  type(None): 'None', dict: 'dictionary'}
101
94
  name = named_types.get(typ, typ.__name__.strip('_'))
102
- # Generics from typing. With newer versions we get "real" type via __origin__.
103
- if PY_VERSION < (3, 7):
104
- if name in ('List', 'Set', 'Tuple'):
105
- name = name.lower()
106
- elif name == 'Dict':
107
- name = 'dictionary'
108
95
  return name.capitalize() if capitalize and name.islower() else name
109
96
 
110
97
 
@@ -118,10 +105,13 @@ def type_repr(typ, nested=True):
118
105
  return 'None'
119
106
  if typ is Ellipsis:
120
107
  return '...'
121
- if typ is Any: # Needed with Python 3.6, with newer `Any._name` exists.
122
- return 'Any'
123
108
  if is_union(typ):
124
109
  return ' | '.join(type_repr(a) for a in typ.__args__) if nested else 'Union'
110
+ if getattr(typ, '__origin__', None) is Literal:
111
+ if nested:
112
+ args = ', '.join(repr(a) for a in typ.__args__)
113
+ return f'Literal[{args}]'
114
+ return 'Literal'
125
115
  name = _get_type_name(typ)
126
116
  if nested and has_args(typ):
127
117
  args = ', '.join(type_repr(a) for a in typ.__args__)
@@ -130,6 +120,7 @@ def type_repr(typ, nested=True):
130
120
 
131
121
 
132
122
  def _get_type_name(typ):
123
+ # See comment in `type_name` for explanation about `_name`.
133
124
  for attr in '__name__', '_name':
134
125
  name = getattr(typ, attr, None)
135
126
  if name:
@@ -140,16 +131,15 @@ def _get_type_name(typ):
140
131
  def has_args(type):
141
132
  """Helper to check has type valid ``__args__``.
142
133
 
143
- ``__args__`` contains TypeVars when accessed directly from ``typing.List`` and
144
- other such types with Python 3.7-3.8. With Python 3.6 ``__args__`` is None
145
- in that case and with Python 3.9+ it doesn't exist at all. When using like
146
- ``List[int].__args__``, everything works the same way regardless the version.
134
+ ``__args__`` contains TypeVars when accessed directly from ``typing.List`` and
135
+ other such types with Python 3.8. Python 3.9+ don't have ``__args__`` at all.
136
+ Parameterize usages like ``List[int].__args__`` always work the same way.
147
137
 
148
138
  This helper can be removed in favor of using ``hasattr(type, '__args__')``
149
139
  when we support only Python 3.9 and newer.
150
140
  """
151
141
  args = getattr(type, '__args__', None)
152
- return args and not all(isinstance(a, TypeVar) for a in args)
142
+ return bool(args and not all(isinstance(a, TypeVar) for a in args))
153
143
 
154
144
 
155
145
  def is_truthy(item):
@@ -13,7 +13,6 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- import sys
17
16
  from typing import Callable, Generic, overload, TypeVar, Type, Union
18
17
 
19
18
 
@@ -93,7 +92,3 @@ class SetterAwareType(type):
93
92
  slots.append(item.attr_name)
94
93
  dct['__slots__'] = slots
95
94
  return type.__new__(cls, name, bases, dct)
96
-
97
- if sys.version_info < (3, 7):
98
- def __getitem__(self, item):
99
- return self
@@ -36,13 +36,14 @@ def cut_long_message(msg):
36
36
  if MAX_ERROR_LINES is None:
37
37
  return msg
38
38
  lines = msg.splitlines()
39
- lengths = _count_line_lengths(lines)
39
+ lengths = [_get_virtual_line_length(line) for line in lines]
40
40
  if sum(lengths) <= MAX_ERROR_LINES:
41
41
  return msg
42
42
  start = _prune_excess_lines(lines, lengths)
43
43
  end = _prune_excess_lines(lines, lengths, from_end=True)
44
44
  return '\n'.join(start + [_ERROR_CUT_EXPLN] + end)
45
45
 
46
+
46
47
  def _prune_excess_lines(lines, lengths, from_end=False):
47
48
  if from_end:
48
49
  lines.reverse()
@@ -60,6 +61,7 @@ def _prune_excess_lines(lines, lengths, from_end=False):
60
61
  ret.reverse()
61
62
  return ret
62
63
 
64
+
63
65
  def _cut_long_line(line, used, from_end):
64
66
  available_lines = MAX_ERROR_LINES // 2 - used
65
67
  available_chars = available_lines * _MAX_ERROR_LINE_LENGTH - 3
@@ -70,10 +72,8 @@ def _cut_long_line(line, used, from_end):
70
72
  line = '...' + line[-available_chars:]
71
73
  return line
72
74
 
73
- def _count_line_lengths(lines):
74
- return [ _count_virtual_line_length(line) for line in lines ]
75
75
 
76
- def _count_virtual_line_length(line):
76
+ def _get_virtual_line_length(line):
77
77
  if not line:
78
78
  return 1
79
79
  lines, remainder = divmod(len(line), _MAX_ERROR_LINE_LENGTH)
@@ -88,6 +88,7 @@ def format_assign_message(variable, value, items=None, cut_long=True):
88
88
  decorated_items = ''.join(f'[{item}]' for item in items) if items else ''
89
89
  return f'{variable}{decorated_items} = {value}'
90
90
 
91
+
91
92
  def _dict_to_str(d):
92
93
  if not d:
93
94
  return '{ }'
@@ -114,10 +115,12 @@ def pad_console_length(text, width):
114
115
  text = _lose_width(text, diff+3) + '...'
115
116
  return _pad_width(text, width)
116
117
 
118
+
117
119
  def _pad_width(text, width):
118
120
  more = width - get_console_length(text)
119
121
  return text + ' ' * more
120
122
 
123
+
121
124
  def _lose_width(text, diff):
122
125
  lost = 0
123
126
  while lost < diff:
@@ -36,8 +36,8 @@ def _safe_str(item):
36
36
  return _unrepresentable_object(item)
37
37
 
38
38
 
39
- def prepr(item, width=80):
40
- return safe_str(PrettyRepr(width=width).pformat(item))
39
+ def prepr(item, width=80, sort_dicts=False):
40
+ return safe_str(PrettyRepr(width=width, sort_dicts=sort_dicts).pformat(item))
41
41
 
42
42
 
43
43
  class PrettyRepr(PrettyPrinter):
@@ -28,6 +28,6 @@ from .search import (search_variable, contains_variable,
28
28
  is_scalar_variable, is_scalar_assign,
29
29
  is_dict_variable, is_dict_assign,
30
30
  is_list_variable, is_list_assign,
31
- VariableIterator)
32
- from .tablesetter import VariableTableValue, DictVariableTableValue
31
+ VariableMatches)
32
+ from .tablesetter import VariableResolver, DictVariableResolver
33
33
  from .variables import Variables