iode 7.0.7__tar.gz → 7.0.8__tar.gz

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 (218) hide show
  1. {iode-7.0.7 → iode-7.0.8}/PKG-INFO +1 -1
  2. {iode-7.0.7 → iode-7.0.8}/cli.cpp +4 -4
  3. {iode-7.0.7 → iode-7.0.8}/compute/estimation.pxd +2 -2
  4. {iode-7.0.7 → iode-7.0.8}/compute/estimation.pyx +7 -2
  5. {iode-7.0.7 → iode-7.0.8}/computed_table/computed_table.pxd +2 -1
  6. {iode-7.0.7 → iode-7.0.8}/computed_table/computed_table.pyx +8 -2
  7. {iode-7.0.7 → iode-7.0.8}/condarecipe/iode/meta.yaml +2 -2
  8. iode-7.0.7/dist_testPyPI/iode-7.0.5-1-cp311-cp311-win_amd64.whl → iode-7.0.8/dist_testPyPI/iode-7.0.7-1-cp312-abi3-win_amd64.whl +0 -0
  9. iode-7.0.7/dist_testPyPI/iode-7.0.5-1-cp310-cp310-win_amd64.whl → iode-7.0.8/dist_testPyPI/iode-7.0.7-2-cp312-abi3-win_amd64.whl +0 -0
  10. iode-7.0.8/essais.txt +4 -0
  11. {iode-7.0.7 → iode-7.0.8}/iode/__init__.py +3 -3
  12. {iode-7.0.7 → iode-7.0.8}/iode/__init__.pyi +2 -2
  13. {iode-7.0.7 → iode-7.0.8}/iode/compute/estimation.py +4 -4
  14. {iode-7.0.7 → iode-7.0.8}/iode/compute/estimation.pyi +1 -1
  15. {iode-7.0.7 → iode-7.0.8}/iode/compute/simulation.py +9 -9
  16. {iode-7.0.7 → iode-7.0.8}/iode/compute/simulation.pyi +1 -1
  17. {iode-7.0.7 → iode-7.0.8}/iode/iode_cython.pyi +16 -11
  18. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/equations_database.py +4 -4
  19. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/extra_files.py +4 -4
  20. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/variables_database.py +57 -5
  21. {iode-7.0.7 → iode-7.0.8}/iode/lec.py +5 -0
  22. {iode-7.0.7 → iode-7.0.8}/iode/objects/equation.py +13 -11
  23. {iode-7.0.7 → iode-7.0.8}/iode/objects/equation.pyi +7 -7
  24. {iode-7.0.7 → iode-7.0.8}/iode/objects/table.py +8 -2
  25. {iode-7.0.7 → iode-7.0.8}/iode/objects/table.pyi +5 -1
  26. {iode-7.0.7 → iode-7.0.8}/iode/super.py +7 -7
  27. iode-7.0.8/iode/super.pyi +39 -0
  28. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.cmt +0 -0
  29. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/rep_fns.a2m +1 -1
  30. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/rep_proc.a2m +28 -28
  31. iode-7.0.8/iode/tests/data/reports/rep_data_exist.rep +25 -0
  32. iode-7.0.8/iode/tests/data/reports/rep_print_def_eqs.rep +96 -0
  33. iode-7.0.8/iode/tests/data/reports/rep_print_def_tbl.rep +34 -0
  34. iode-7.0.8/iode/tests/data/reports/rep_print_view_tbl_var.rep +111 -0
  35. iode-7.0.8/iode/tests/data/reports/report_tutorial.rep +448 -0
  36. {iode-7.0.7 → iode-7.0.8}/iode/tests/test_cython_iode.py +5 -3
  37. {iode-7.0.7 → iode-7.0.8}/iode/tests/test_iode.py +224 -7
  38. {iode-7.0.7 → iode-7.0.8}/iode/util.py +55 -7
  39. {iode-7.0.7 → iode-7.0.8}/iode/util.pyi +36 -1
  40. {iode-7.0.7 → iode-7.0.8}/iode_database/cpp_api_database.pxd +3 -6
  41. {iode-7.0.7 → iode-7.0.8}/iode_database/equations_database.pyx +1 -1
  42. {iode-7.0.7 → iode-7.0.8}/iode_database/variables_database.pyx +44 -53
  43. {iode-7.0.7 → iode-7.0.8}/objects/equation.pxd +12 -11
  44. {iode-7.0.7 → iode-7.0.8}/objects/equation.pyx +9 -6
  45. {iode-7.0.7 → iode-7.0.8}/objects/table.pxd +6 -3
  46. {iode-7.0.7 → iode-7.0.8}/objects/table.pyx +6 -4
  47. {iode-7.0.7 → iode-7.0.8}/pyproject.toml +1 -1
  48. iode-7.0.8/simul.dbg +1430 -0
  49. {iode-7.0.7 → iode-7.0.8}/super.cpp +7 -7
  50. {iode-7.0.7 → iode-7.0.8}/super.h +1 -1
  51. {iode-7.0.7 → iode-7.0.8}/super.pxd +0 -3
  52. {iode-7.0.7 → iode-7.0.8}/super.pyx +63 -58
  53. {iode-7.0.7 → iode-7.0.8}/tests/tests.pxd +1 -3
  54. {iode-7.0.7 → iode-7.0.8}/tests/tests.pyx +3 -3
  55. {iode-7.0.7 → iode-7.0.8}/time/sample.pyx +13 -13
  56. {iode-7.0.7 → iode-7.0.8}/util.pxd +3 -2
  57. {iode-7.0.7 → iode-7.0.8}/util.pyx +10 -7
  58. iode-7.0.7/dist_testPyPI/iode-7.0.5-1-cp312-abi3-win_amd64.whl +0 -0
  59. iode-7.0.7/dist_testPyPI/iode-7.0.5-2-cp312-abi3-win_amd64.whl +0 -0
  60. iode-7.0.7/iode/super.pyi +0 -3
  61. iode-7.0.7/simul.dbg +0 -90
  62. {iode-7.0.7 → iode-7.0.8}/CMakeLists.txt +0 -0
  63. {iode-7.0.7 → iode-7.0.8}/LICENSE.md +0 -0
  64. {iode-7.0.7 → iode-7.0.8}/README.md +0 -0
  65. {iode-7.0.7 → iode-7.0.8}/__init__.pxd +0 -0
  66. {iode-7.0.7 → iode-7.0.8}/a2m_print.cpp +0 -0
  67. {iode-7.0.7 → iode-7.0.8}/a2m_print.pxd +0 -0
  68. {iode-7.0.7 → iode-7.0.8}/a2m_print.pyx +0 -0
  69. {iode-7.0.7 → iode-7.0.8}/cli.pxd +0 -0
  70. {iode-7.0.7 → iode-7.0.8}/cli.pyx +0 -0
  71. {iode-7.0.7 → iode-7.0.8}/common.pxd +0 -0
  72. {iode-7.0.7 → iode-7.0.8}/common.pyx +0 -0
  73. {iode-7.0.7 → iode-7.0.8}/compute/__init__.pxd +0 -0
  74. {iode-7.0.7 → iode-7.0.8}/compute/simulation.pxd +0 -0
  75. {iode-7.0.7 → iode-7.0.8}/compute/simulation.pyx +0 -0
  76. {iode-7.0.7 → iode-7.0.8}/computed_table/__init__.pxd +0 -0
  77. {iode-7.0.7 → iode-7.0.8}/conftest.py +0 -0
  78. {iode-7.0.7 → iode-7.0.8}/iode/cli.py +0 -0
  79. {iode-7.0.7 → iode-7.0.8}/iode/cli.pyi +0 -0
  80. {iode-7.0.7 → iode-7.0.8}/iode/common.py +0 -0
  81. {iode-7.0.7 → iode-7.0.8}/iode/common.pyi +0 -0
  82. {iode-7.0.7 → iode-7.0.8}/iode/compute/__init__.py +0 -0
  83. {iode-7.0.7 → iode-7.0.8}/iode/compute/__init__.pyi +0 -0
  84. {iode-7.0.7 → iode-7.0.8}/iode/computed_table/__init__.py +0 -0
  85. {iode-7.0.7 → iode-7.0.8}/iode/computed_table/__init__.pyi +0 -0
  86. {iode-7.0.7 → iode-7.0.8}/iode/computed_table/computed_table.py +0 -0
  87. {iode-7.0.7 → iode-7.0.8}/iode/computed_table/computed_table.pyi +0 -0
  88. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/__init__.py +0 -0
  89. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/__init__.pyi +0 -0
  90. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/compat_larray.py +0 -0
  91. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/compat_larray.pyi +0 -0
  92. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/compat_pandas.py +0 -0
  93. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/compat_pandas.pyi +0 -0
  94. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/estimation.py +0 -0
  95. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/estimation.pyi +0 -0
  96. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/iode_objects.py +0 -0
  97. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/iode_objects.pyi +0 -0
  98. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/lec.py +0 -0
  99. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/lec.pyi +0 -0
  100. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/model.py +0 -0
  101. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/model.pyi +0 -0
  102. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/report.py +0 -0
  103. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/report.pyi +0 -0
  104. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/time.py +0 -0
  105. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/time.pyi +0 -0
  106. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/workspace.py +0 -0
  107. {iode-7.0.7 → iode-7.0.8}/iode/deprecated/workspace.pyi +0 -0
  108. {iode-7.0.7 → iode-7.0.8}/iode/doc/iode.chm +0 -0
  109. {iode-7.0.7 → iode-7.0.8}/iode/doc/iode.pdf +0 -0
  110. {iode-7.0.7 → iode-7.0.8}/iode/gui.py +0 -0
  111. {iode-7.0.7 → iode-7.0.8}/iode/gui.pyi +0 -0
  112. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/abstract_database.py +0 -0
  113. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/comments_database.py +0 -0
  114. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/identities_database.py +0 -0
  115. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/lists_database.py +0 -0
  116. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/scalars_database.py +0 -0
  117. {iode-7.0.7 → iode-7.0.8}/iode/iode_database/tables_database.py +0 -0
  118. {iode-7.0.7 → iode-7.0.8}/iode/lec.pyi +0 -0
  119. {iode-7.0.7 → iode-7.0.8}/iode/objects/__init__.py +0 -0
  120. {iode-7.0.7 → iode-7.0.8}/iode/objects/__init__.pyi +0 -0
  121. {iode-7.0.7 → iode-7.0.8}/iode/objects/identity.py +0 -0
  122. {iode-7.0.7 → iode-7.0.8}/iode/objects/identity.pyi +0 -0
  123. {iode-7.0.7 → iode-7.0.8}/iode/objects/scalar.py +0 -0
  124. {iode-7.0.7 → iode-7.0.8}/iode/objects/scalar.pyi +0 -0
  125. {iode-7.0.7 → iode-7.0.8}/iode/reports.py +0 -0
  126. {iode-7.0.7 → iode-7.0.8}/iode/reports.pyi +0 -0
  127. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/FUN_UPPERCASE.AV +0 -0
  128. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/FUN_UPPERCASE.VAR +0 -0
  129. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/a.var +0 -0
  130. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/automatic.at +0 -0
  131. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/db.var +0 -0
  132. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.ac +0 -0
  133. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.ae +0 -0
  134. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.ai +0 -0
  135. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.al +0 -0
  136. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.as +0 -0
  137. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.at +0 -0
  138. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.av +0 -0
  139. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.cmt +0 -0
  140. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.eqs +0 -0
  141. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.idt +0 -0
  142. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.lst +0 -0
  143. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.scl +0 -0
  144. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.tbl +0 -0
  145. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun.var +0 -0
  146. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.ac +0 -0
  147. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.ae +0 -0
  148. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.ai +0 -0
  149. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.al +0 -0
  150. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.as +0 -0
  151. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.at +0 -0
  152. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.av +0 -0
  153. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun2.cm$ +0 -0
  154. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_copy_copy.cmt +0 -0
  155. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_q.var +0 -0
  156. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_xode.ac.ref +0 -0
  157. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_xode.av.ref +0 -0
  158. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_xode.csv.ref +0 -0
  159. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_xode.rcsv.ref +0 -0
  160. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/fun_xode.tsp.ref +0 -0
  161. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.cmt +0 -0
  162. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.eqs +0 -0
  163. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.idt +0 -0
  164. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.lst +0 -0
  165. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.scl +0 -0
  166. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.tbl +0 -0
  167. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/linux_fun.var +0 -0
  168. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/ref.av +0 -0
  169. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/ref2.av +0 -0
  170. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/ref2.var +0 -0
  171. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/rep_expand.a2m +0 -0
  172. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/rep_expand2.a2m +0 -0
  173. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/reports/oem850.rep +0 -0
  174. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/reports/rep_expand.rep +0 -0
  175. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/reports/rep_fns.rep +0 -0
  176. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/reports/rep_fns2.rep +0 -0
  177. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/reports/rep_proc.rep +0 -0
  178. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/reports/test_gui_commands.rep +0 -0
  179. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/rules.txt +0 -0
  180. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/test.a2m +0 -0
  181. {iode-7.0.7 → iode-7.0.8}/iode/tests/data/ws.var +0 -0
  182. {iode-7.0.7 → iode-7.0.8}/iode/tests/test_gui.py +0 -0
  183. {iode-7.0.7 → iode-7.0.8}/iode/time/__init__.py +0 -0
  184. {iode-7.0.7 → iode-7.0.8}/iode/time/__init__.pyi +0 -0
  185. {iode-7.0.7 → iode-7.0.8}/iode/time/period.py +0 -0
  186. {iode-7.0.7 → iode-7.0.8}/iode/time/period.pyi +0 -0
  187. {iode-7.0.7 → iode-7.0.8}/iode/time/sample.py +0 -0
  188. {iode-7.0.7 → iode-7.0.8}/iode/time/sample.pyi +0 -0
  189. {iode-7.0.7 → iode-7.0.8}/iode/write.py +0 -0
  190. {iode-7.0.7 → iode-7.0.8}/iode/write.pyi +0 -0
  191. {iode-7.0.7 → iode-7.0.8}/iode_cython.pxd +0 -0
  192. {iode-7.0.7 → iode-7.0.8}/iode_cython.pyx +0 -0
  193. {iode-7.0.7 → iode-7.0.8}/iode_database/__init__.pxd +0 -0
  194. {iode-7.0.7 → iode-7.0.8}/iode_database/abstract_database.pyx +0 -0
  195. {iode-7.0.7 → iode-7.0.8}/iode_database/comments_database.pyx +0 -0
  196. {iode-7.0.7 → iode-7.0.8}/iode_database/extra_files.pyx +0 -0
  197. {iode-7.0.7 → iode-7.0.8}/iode_database/identities_database.pyx +0 -0
  198. {iode-7.0.7 → iode-7.0.8}/iode_database/iode_database.cpp +0 -0
  199. {iode-7.0.7 → iode-7.0.8}/iode_database/lists_database.pyx +0 -0
  200. {iode-7.0.7 → iode-7.0.8}/iode_database/scalars_database.pyx +0 -0
  201. {iode-7.0.7 → iode-7.0.8}/iode_database/tables_database.pyx +0 -0
  202. {iode-7.0.7 → iode-7.0.8}/iode_database/variables_database.cpp +0 -0
  203. {iode-7.0.7 → iode-7.0.8}/lec.pxd +0 -0
  204. {iode-7.0.7 → iode-7.0.8}/lec.pyx +0 -0
  205. {iode-7.0.7 → iode-7.0.8}/objects/__init__.pxd +0 -0
  206. {iode-7.0.7 → iode-7.0.8}/objects/identity.pxd +0 -0
  207. {iode-7.0.7 → iode-7.0.8}/objects/identity.pyx +0 -0
  208. {iode-7.0.7 → iode-7.0.8}/objects/scalar.pxd +0 -0
  209. {iode-7.0.7 → iode-7.0.8}/objects/scalar.pyx +0 -0
  210. {iode-7.0.7 → iode-7.0.8}/reports.pxd +0 -0
  211. {iode-7.0.7 → iode-7.0.8}/reports.pyx +0 -0
  212. {iode-7.0.7 → iode-7.0.8}/tests/__init__.pxd +0 -0
  213. {iode-7.0.7 → iode-7.0.8}/time/__init__.pxd +0 -0
  214. {iode-7.0.7 → iode-7.0.8}/time/period.pxd +0 -0
  215. {iode-7.0.7 → iode-7.0.8}/time/period.pyx +0 -0
  216. {iode-7.0.7 → iode-7.0.8}/time/sample.pxd +0 -0
  217. {iode-7.0.7 → iode-7.0.8}/wrt.pxd +0 -0
  218. {iode-7.0.7 → iode-7.0.8}/wrt.pyx +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iode
3
- Version: 7.0.7
3
+ Version: 7.0.8
4
4
  Summary: IODE is a package dedicated to econometric models and to the management of statistical series
5
5
  Author-Email: Alix Damman <ald@plan.be>, Yannick Van den Abbeel <yvda@plan.be>, Jean-Marc Paul <jmarc.paul@gmail.com>, Geert Bryon <gb@plan.be>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -92,13 +92,13 @@ void always_continue(bool value)
92
92
  {
93
93
  if(value)
94
94
  {
95
- kmsgbox_continue = 1;
96
- kpause_continue = 1;
95
+ KMSGBOX_CONTINUE = 1;
96
+ KPAUSE_CONTINUE = 1;
97
97
  }
98
98
  else
99
99
  {
100
- kmsgbox_continue = 0;
101
- kpause_continue = 0;
100
+ KMSGBOX_CONTINUE = 0;
101
+ KPAUSE_CONTINUE = 0;
102
102
  }
103
103
  }
104
104
 
@@ -39,9 +39,9 @@ cdef extern from "cpp_api/compute/estimation.h":
39
39
  CEditAndEstimateEquations(const string& from_period, const string& to_period) except +
40
40
 
41
41
  # getter and setter methods
42
- CSample* get_sample()
42
+ shared_ptr[CSample] get_sample()
43
43
  void set_sample() except +
44
- void set_sample(const CSample* sample) except +
44
+ void set_sample(const shared_ptr[CSample] sample) except +
45
45
  void set_sample(const string& from_period, const string& to_period) except +
46
46
 
47
47
  string get_block()
@@ -111,8 +111,13 @@ cdef class CythonEditAndEstimateEquations:
111
111
  self.c_estimation_ptr = NULL
112
112
 
113
113
  def get_sample(self) -> Sample:
114
- cdef CSample* c_sample = self.c_estimation_ptr.get_sample()
115
- return Sample._from_ptr(c_sample, <bint>False)
114
+ cdef shared_ptr[CSample] sample_ptr = self.c_estimation_ptr.get_sample()
115
+ cdef CSample* c_sample = sample_ptr.get()
116
+ if c_sample is NULL:
117
+ return None
118
+ if c_sample.start_period.year == 0 or c_sample.nb_periods == 0:
119
+ return None
120
+ return Sample._from_ptr(sample_ptr)
116
121
 
117
122
  def set_sample(self, from_period: str, to_period: str):
118
123
  self.c_estimation_ptr.set_sample(from_period.encode(), to_period.encode())
@@ -6,6 +6,7 @@ from typing import Union, Tuple, List, Dict, Optional
6
6
  # Import necessary C++ types/classes
7
7
  from libcpp.string cimport string
8
8
  from libcpp.vector cimport vector
9
+ from libcpp.memory cimport shared_ptr
9
10
 
10
11
  from pyiode.common cimport TableGraphAxis, TableGraphGrid, TableTextAlign
11
12
  from pyiode.time.period cimport CPeriod
@@ -54,7 +55,7 @@ cdef extern from "cpp_api/computed_table/computed_table.h":
54
55
  TableTextAlign get_alignement()
55
56
  double get_ymin()
56
57
  double get_ymax()
57
- CSample* get_sample()
58
+ shared_ptr[CSample] get_sample()
58
59
  vector[string] get_list_files()
59
60
  string get_title() except +
60
61
 
@@ -1,5 +1,6 @@
1
1
  from libcpp.string cimport string
2
2
  from libcpp.vector cimport vector
3
+ from libcpp.memory cimport shared_ptr
3
4
 
4
5
  from pyiode.util cimport IODE_IS_A_NUMBER
5
6
  from pyiode.time.period cimport CPeriod
@@ -67,8 +68,13 @@ cdef class ComputedTable:
67
68
  return self.c_computed_table.get_nb_periods()
68
69
 
69
70
  def get_sample(self) -> Sample:
70
- cdef CSample* c_sample = self.c_computed_table.get_sample()
71
- return Sample._from_ptr(c_sample, <bint>False)
71
+ cdef shared_ptr[CSample] sample_ptr = self.c_computed_table.get_sample()
72
+ cdef CSample* c_sample = sample_ptr.get()
73
+ if c_sample is NULL:
74
+ return None
75
+ if c_sample.start_period.year == 0 or c_sample.nb_periods == 0:
76
+ return None
77
+ return Sample._from_ptr(sample_ptr)
72
78
 
73
79
  def get_title(self) -> str:
74
80
  return self.c_computed_table.get_title().decode()
@@ -1,5 +1,5 @@
1
1
  {% set name = "iode" %}
2
- {% set version = "7.0.7" %}
2
+ {% set version = "7.0.8" %}
3
3
 
4
4
  package:
5
5
  name: {{ name|lower }}
@@ -12,7 +12,7 @@ source:
12
12
 
13
13
  # --- build from git repository ---
14
14
  # git_url: https://github.com/plan-be/iode.git
15
- # git_rev: 7.0.7 # (Defaults to "HEAD")
15
+ # git_rev: 7.0.8 # (Defaults to "HEAD")
16
16
 
17
17
  build:
18
18
  entry_points:
iode-7.0.8/essais.txt ADDED
@@ -0,0 +1,4 @@
1
+ line 1
2
+ line 2
3
+
4
+ line 4
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
- __version__ = "7.0.7"
3
+ __version__ = "7.0.8"
4
4
 
5
5
  SAMPLE_DATA_DIR = str((Path(__file__).parent / "tests" / "data").resolve())
6
6
  DOC_DIR = str((Path(__file__).parent / "doc").resolve())
@@ -60,7 +60,7 @@ from .lec import execute_lec
60
60
  from .gui import view_workspace
61
61
 
62
62
  # miscellaneous
63
- from .util import is_NA, define, macro, enable_msgs, suppress_msgs
63
+ from .util import is_NA, define, macro, skip_message, skip_pause, skip_msg_box
64
64
  from .common import FileType
65
65
  from .super import *
66
66
 
@@ -110,7 +110,7 @@ __all__ = [
110
110
  'view_workspace',
111
111
 
112
112
  # miscellaneous
113
- 'is_NA', 'define', 'macro', 'enable_msgs', 'suppress_msgs',
113
+ 'is_NA', 'define', 'macro', 'skip_message', 'skip_pause', 'skip_msg_box',
114
114
  ]
115
115
 
116
116
  # ==== DEPRECATED API ====
@@ -20,11 +20,11 @@ from .objects.table import Table as Table
20
20
  from .reports import execute_command as execute_command, execute_report as execute_report, increment_t as increment_t, set_t as set_t
21
21
  from .time.period import Period as Period
22
22
  from .time.sample import Sample as Sample
23
- from .util import define as define, enable_msgs as enable_msgs, is_NA as is_NA, macro as macro, split_list as split_list, suppress_msgs as suppress_msgs
23
+ from .util import define as define, is_NA as is_NA, macro as macro, skip_message as skip_message, skip_msg_box as skip_msg_box, skip_pause as skip_pause, split_list as split_list
24
24
  from .write import write as write, write_close as write_close, write_code_block as write_code_block, write_destination as write_destination, write_enum as write_enum, write_flush as write_flush, write_page_footer as write_page_footer, write_page_header as write_page_header, write_paragraph as write_paragraph, write_title as write_title
25
25
  from _typeshed import Incomplete
26
26
 
27
- __all__ = ['__version__', 'SAMPLE_DATA_DIR', 'DOC_DIR', 'NA', 'IodeType', 'IodeFileType', 'TableLang', 'ImportFormats', 'ExportFormats', 'EqMethod', 'EqTest', 'TableCellType', 'TableCellFont', 'TableCellAlign', 'TableLineType', 'TableGraphType', 'TableGraphGrid', 'TableTextAlign', 'TableGraphAxis', 'VarsMode', 'LowToHighType', 'LowToHighMethod', 'HighToLowType', 'SimulationInitialization', 'SimulationSort', 'ESTIMATION_MAXIT', 'ESTIMATION_EPS', 'AdjustmentMethod', 'WriteFileExt', 'WRITE_FILE_EXT', 'EQ_TEST_NAMES', 'IODE_DATABASE_TYPE_NAMES', 'IODE_FILE_TYPE_NAMES', 'IODE_LANGUAGES_LIST', 'EQUATION_METHODS_LIST', 'FileType', 'IODE_FILE_TYPES', 'SIMULATION_INITIALIZATION_METHODS', 'SIMULATION_SORT_ALGORITHMS', 'PRINT_FORMATS', 'IMPORT_FORMATS', 'EXPORT_FORMATS', 'GRAPHS_COLORS', 'IODE_FONTS', 'PrintTablesAs', 'PrintEquationsAs', 'PrintEquationsLecAs', 'Period', 'Sample', 'PeriodICITY_LIST', 'Equation', 'Identity', 'Scalar', 'Table', 'split_list', 'comments', 'equations', 'identities', 'lists', 'scalars', 'tables', 'variables', 'Comments', 'Equations', 'Identities', 'Lists', 'Scalars', 'Tables', 'Variables', 'load_extra_files', 'reset_extra_files', 'execute_report', 'execute_command', 'set_t', 'increment_t', 'write_close', 'write_destination', 'write_flush', 'write', 'write_code_block', 'write_enum', 'write_paragraph', 'write_title', 'write_page_footer', 'write_page_header', 'Simulation', 'dynamic_adjustment', 'dickey_fuller_test', 'execute_lec', 'view_workspace', 'is_NA', 'define', 'macro', 'enable_msgs', 'suppress_msgs']
27
+ __all__ = ['__version__', 'SAMPLE_DATA_DIR', 'DOC_DIR', 'NA', 'IodeType', 'IodeFileType', 'TableLang', 'ImportFormats', 'ExportFormats', 'EqMethod', 'EqTest', 'TableCellType', 'TableCellFont', 'TableCellAlign', 'TableLineType', 'TableGraphType', 'TableGraphGrid', 'TableTextAlign', 'TableGraphAxis', 'VarsMode', 'LowToHighType', 'LowToHighMethod', 'HighToLowType', 'SimulationInitialization', 'SimulationSort', 'ESTIMATION_MAXIT', 'ESTIMATION_EPS', 'AdjustmentMethod', 'WriteFileExt', 'WRITE_FILE_EXT', 'EQ_TEST_NAMES', 'IODE_DATABASE_TYPE_NAMES', 'IODE_FILE_TYPE_NAMES', 'IODE_LANGUAGES_LIST', 'EQUATION_METHODS_LIST', 'FileType', 'IODE_FILE_TYPES', 'SIMULATION_INITIALIZATION_METHODS', 'SIMULATION_SORT_ALGORITHMS', 'PRINT_FORMATS', 'IMPORT_FORMATS', 'EXPORT_FORMATS', 'GRAPHS_COLORS', 'IODE_FONTS', 'PrintTablesAs', 'PrintEquationsAs', 'PrintEquationsLecAs', 'Period', 'Sample', 'PeriodICITY_LIST', 'Equation', 'Identity', 'Scalar', 'Table', 'split_list', 'comments', 'equations', 'identities', 'lists', 'scalars', 'tables', 'variables', 'Comments', 'Equations', 'Identities', 'Lists', 'Scalars', 'Tables', 'Variables', 'load_extra_files', 'reset_extra_files', 'execute_report', 'execute_command', 'set_t', 'increment_t', 'write_close', 'write_destination', 'write_flush', 'write', 'write_code_block', 'write_enum', 'write_paragraph', 'write_title', 'write_page_footer', 'write_page_header', 'Simulation', 'dynamic_adjustment', 'dickey_fuller_test', 'execute_lec', 'view_workspace', 'is_NA', 'define', 'macro', 'skip_message', 'skip_pause', 'skip_msg_box']
28
28
 
29
29
  __version__: str
30
30
  SAMPLE_DATA_DIR: Incomplete
@@ -7,7 +7,7 @@ if sys.version_info.minor >= 11:
7
7
  else:
8
8
  Self = Any
9
9
 
10
- from iode.util import suppress_msgs, enable_msgs
10
+ from iode.util import skip_message
11
11
  from iode.time.period import Period
12
12
  from iode.time.sample import Sample
13
13
  from iode.objects.equation import Equation
@@ -241,7 +241,7 @@ class EditAndEstimateEquations:
241
241
  def __init__(self, from_period: Union[str, Period]=None, to_period: Union[str, Period]=None):
242
242
  if from_period is None or to_period is None:
243
243
  vars_sample = variables.sample
244
- if vars_sample.start is None or vars_sample.end is None:
244
+ if not vars_sample:
245
245
  warnings.warn("The sample of the Variables workspace is not defined. "
246
246
  "Set estimation sample as undefined.")
247
247
  from_period, to_period = '', ''
@@ -1280,7 +1280,7 @@ class EditAndEstimateEquations:
1280
1280
  Scalar(0.0109855, 1, 0.00481857)
1281
1281
  """
1282
1282
  if quiet:
1283
- suppress_msgs()
1283
+ skip_message(True)
1284
1284
 
1285
1285
  try:
1286
1286
  self._cy_estimation.estimate(maxit, epsilon)
@@ -1290,7 +1290,7 @@ class EditAndEstimateEquations:
1290
1290
  success = False
1291
1291
 
1292
1292
  if quiet:
1293
- enable_msgs()
1293
+ skip_message(False)
1294
1294
  return success
1295
1295
 
1296
1296
  @property
@@ -6,7 +6,7 @@ from iode.iode_database.variables_database import variables as variables
6
6
  from iode.objects.equation import Equation as Equation
7
7
  from iode.time.period import Period as Period
8
8
  from iode.time.sample import Sample as Sample
9
- from iode.util import enable_msgs as enable_msgs, suppress_msgs as suppress_msgs
9
+ from iode.util import skip_message as skip_message
10
10
  from typing import Any, Self
11
11
 
12
12
  Self = Any
@@ -3,7 +3,7 @@ from textwrap import fill
3
3
  from collections.abc import Iterable
4
4
  from typing import List, Union
5
5
 
6
- from iode.util import suppress_msgs, enable_msgs
6
+ from iode.util import skip_message
7
7
  from iode.time.period import Period
8
8
  from iode.iode_cython import SimulationSort, SimulationInitialization
9
9
  from iode.iode_cython import Simulation as CythonSimulation
@@ -1144,7 +1144,7 @@ class Simulation:
1144
1144
  f"Got value of type {type(list_eqs)} instead.")
1145
1145
 
1146
1146
  if quiet:
1147
- suppress_msgs()
1147
+ skip_message(True)
1148
1148
 
1149
1149
  try:
1150
1150
  success = self._cy_simulation.model_compile(list_eqs)
@@ -1153,7 +1153,7 @@ class Simulation:
1153
1153
  success = False
1154
1154
 
1155
1155
  if quiet:
1156
- enable_msgs()
1156
+ skip_message(False)
1157
1157
  return success
1158
1158
 
1159
1159
  def model_simulate(self, from_period: Union[str, Period], to_period: Union[str, Period],
@@ -1285,7 +1285,7 @@ class Simulation:
1285
1285
  f"Got value of type {type(list_eqs)} instead.")
1286
1286
 
1287
1287
  if quiet:
1288
- suppress_msgs()
1288
+ skip_message(True)
1289
1289
 
1290
1290
  try:
1291
1291
  success = self._cy_simulation.model_simulate(from_period, to_period, list_eqs)
@@ -1294,7 +1294,7 @@ class Simulation:
1294
1294
  success = False
1295
1295
 
1296
1296
  if quiet:
1297
- enable_msgs()
1297
+ skip_message(False)
1298
1298
  return success
1299
1299
 
1300
1300
  def model_calculate_SCC(self, nb_iterations: int, pre_name: str='_PRE', inter_name: str='_INTER',
@@ -1391,7 +1391,7 @@ class Simulation:
1391
1391
  f"Got value of type {type(list_eqs)} instead.")
1392
1392
 
1393
1393
  if quiet:
1394
- suppress_msgs()
1394
+ skip_message(True)
1395
1395
 
1396
1396
  try:
1397
1397
  success = self._cy_simulation.model_calculate_SCC(nb_iterations, pre_name, inter_name, post_name, list_eqs)
@@ -1400,7 +1400,7 @@ class Simulation:
1400
1400
  success = False
1401
1401
 
1402
1402
  if quiet:
1403
- enable_msgs()
1403
+ skip_message(False)
1404
1404
  return success
1405
1405
 
1406
1406
  def model_simulate_SCC(self, from_period: Union[str, Period], to_period: Union[str, Period], pre_name: str='_PRE',
@@ -1551,7 +1551,7 @@ class Simulation:
1551
1551
  to_period = str(to_period)
1552
1552
 
1553
1553
  if quiet:
1554
- suppress_msgs()
1554
+ skip_message(True)
1555
1555
 
1556
1556
  try:
1557
1557
  success = self._cy_simulation.model_simulate_SCC(from_period, to_period, pre_name, inter_name, post_name)
@@ -1560,7 +1560,7 @@ class Simulation:
1560
1560
  success = False
1561
1561
 
1562
1562
  if quiet:
1563
- enable_msgs()
1563
+ skip_message(False)
1564
1564
  return success
1565
1565
 
1566
1566
  def __str__(self) -> str:
@@ -1,6 +1,6 @@
1
1
  from iode.iode_cython import SimulationInitialization as SimulationInitialization, SimulationSort as SimulationSort
2
2
  from iode.time.period import Period as Period
3
- from iode.util import enable_msgs as enable_msgs, suppress_msgs as suppress_msgs
3
+ from iode.util import skip_message as skip_message
4
4
 
5
5
  class Simulation:
6
6
  '''
@@ -10,7 +10,6 @@ NA: float
10
10
  NAN_REP: str
11
11
  __test__: dict
12
12
  allowed_keys: set
13
- la: None
14
13
 
15
14
  class AdjustmentMethod(enum.IntEnum):
16
15
  __new__: ClassVar[Callable] = ...
@@ -1157,6 +1156,10 @@ def alloc_doc_loop() -> Any:
1157
1156
  """alloc_doc_loop()"""
1158
1157
  def always_continue(value: bool) -> Any:
1159
1158
  """always_continue(value: bool)"""
1159
+ def backup_super_functions(*args, **kwargs):
1160
+ """backup_super_functions() -> dict()
1161
+
1162
+ Backup the current state of the super-functions registry."""
1160
1163
  def cython_build_command_functions_list(group: int, gui: bool) -> list[str]:
1161
1164
  """cython_build_command_functions_list(group: int, gui: bool) -> List[str]"""
1162
1165
  def cython_build_lec_functions_list() -> list[str]:
@@ -1169,8 +1172,6 @@ def cython_dickey_fuller_test(lec: str, drift: bool, trend: bool, order: int) ->
1169
1172
  """cython_dickey_fuller_test(lec: str, drift: bool, trend: bool, order: int) -> Scalars"""
1170
1173
  def cython_dynamic_adjustment(method: int, eqs: str, c1: str, c2: str) -> str:
1171
1174
  """cython_dynamic_adjustment(method: int, eqs: str, c1: str, c2: str) -> str"""
1172
- def cython_enable_msgs() -> Any:
1173
- """cython_enable_msgs()"""
1174
1175
  def cython_execute_command(command: str) -> Any:
1175
1176
  """cython_execute_command(command: str)"""
1176
1177
  def cython_execute_lec(lec: str, period: str | int = ...) -> float | list[float]:
@@ -1191,8 +1192,12 @@ def cython_reset_extra_files() -> Any:
1191
1192
  """cython_reset_extra_files()"""
1192
1193
  def cython_set_time(period: str) -> Any:
1193
1194
  """cython_set_time(period: str)"""
1194
- def cython_suppress_msgs() -> Any:
1195
- """cython_suppress_msgs()"""
1195
+ def cython_skip_message(value: bool) -> Any:
1196
+ """cython_skip_message(value: bool)"""
1197
+ def cython_skip_msg_box(value: bool) -> Any:
1198
+ """cython_skip_msg_box(value: bool)"""
1199
+ def cython_skip_pause(value: bool) -> Any:
1200
+ """cython_skip_pause(value: bool)"""
1196
1201
  def cython_write(txt: str) -> bool:
1197
1202
  """cython_write(txt: str) -> bool"""
1198
1203
  def cython_write_close() -> Any:
@@ -1223,10 +1228,10 @@ def iode_confirm(message: str) -> Any:
1223
1228
  """iode_confirm(message: str)"""
1224
1229
  def iode_error(message: str) -> Any:
1225
1230
  """iode_error(message: str)"""
1231
+ def iode_information(message: str) -> Any:
1232
+ """iode_information(message: str)"""
1226
1233
  def iode_msg(message: str) -> Any:
1227
1234
  """iode_msg(message: str)"""
1228
- def iode_msgbox(title: str, message: str) -> int:
1229
- """iode_msgbox(title: str, message: str) -> int"""
1230
1235
  def iode_panic() -> Any:
1231
1236
  """iode_panic()"""
1232
1237
  def iode_pause() -> Any:
@@ -1235,6 +1240,10 @@ def iode_warning(message: str) -> Any:
1235
1240
  """iode_warning(message: str)"""
1236
1241
  def register_super_function(name) -> Any:
1237
1242
  """register_super_function(name)"""
1243
+ def restore_super_functions(registry_funcs_backup: dict) -> None:
1244
+ """restore_super_functions(registry_funcs_backup: dict) -> None
1245
+
1246
+ Restore the super-functions registry from a previously captured snapshot."""
1238
1247
  def set_A2M_preferences(escape_char: str = ..., cell_separator: str = ..., define_char: str = ..., command_char: str = ..., append: bool = ..., preserve_spaces: bool = ..., preserve_linefeed: bool = ..., default_paragraph: str = ..., graph_width: int = ..., graph_height: int = ..., graph_background_color: str = ..., graph_background_brush: int = ..., graph_box: int = ...) -> Any:
1239
1248
  """set_A2M_preferences(escape_char: str = '\\\\', cell_separator: str = '@', define_char: str = '&', command_char: str = '.', append: bool = False, preserve_spaces: bool = False, preserve_linefeed: bool = False, default_paragraph: str = '', graph_width: int = 160, graph_height: int = 100, graph_background_color: str = 'b', graph_background_brush: int = 0, graph_box: int = 0)"""
1240
1249
  def set_HTML_preferences(font_size: int = ..., font_family: str = ..., table_font_family: str = ..., font_incr: int = ..., table_font_size: int = ..., paragraph_numbers: bool = ..., table_border_width: bool = ..., table_use_color: bool = ..., generate_toc: bool = ..., body_tag: str = ..., title: str = ...) -> Any:
@@ -1247,7 +1256,3 @@ def set_log_file_cli(log_file: str) -> Any:
1247
1256
  """set_log_file_cli(log_file: str)"""
1248
1257
  def set_printer_preferences(font_size: int = ..., font_family: str = ..., table_font_family: str = ..., font_incr: int = ..., table_font_size: int = ..., paragraph_numbers: bool = ..., left_margin: int = ..., right_margin: int = ..., top_margin: int = ..., bottom_margin: int = ..., black_and_white: bool = ..., table_border_width: int = ..., table_break: bool = ..., table_new_page: bool = ..., graph_new_page: bool = ..., table_shading: bool = ..., page_header: str = ..., page_footer: str = ..., ask_prompt: bool = ...) -> Any:
1249
1258
  """set_printer_preferences(font_size: int = 10, font_family: str = 'H', table_font_family: str = 'H', font_incr: int = 2, table_font_size: int = 10, paragraph_numbers: bool = False, left_margin: int = 10, right_margin: int = 10, top_margin: int = 10, bottom_margin: int = 10, black_and_white: bool = True, table_border_width: int = 0, table_break: bool = False, table_new_page: bool = False, graph_new_page: bool = False, table_shading: bool = False, page_header: str = '', page_footer: str = '', ask_prompt: bool = True)"""
1250
- def skip_msg_box(value: bool) -> Any:
1251
- """skip_msg_box(value: bool)"""
1252
- def skip_pause(value: bool) -> Any:
1253
- """skip_pause(value: bool)"""
@@ -14,7 +14,7 @@ from iode.util import join_lines, table2str, JUSTIFY
14
14
  from iode.iode_database.abstract_database import IodeDatabase, PositionalIndexer
15
15
  from iode.objects.equation import Equation
16
16
 
17
- from iode.util import suppress_msgs, enable_msgs
17
+ from iode.util import skip_message
18
18
  from iode.iode_cython import Equation as CythonEquation
19
19
  from iode.iode_cython import Equations as CythonEquations
20
20
 
@@ -984,17 +984,17 @@ class Equations(IodeDatabase):
984
984
 
985
985
  try:
986
986
  if quiet:
987
- suppress_msgs()
987
+ skip_message(True)
988
988
  success = True
989
989
  for eq_name in list_eqs:
990
990
  eq = self[eq_name]
991
991
  success &= eq._estimate(from_period, to_period)
992
992
  if quiet:
993
- enable_msgs()
993
+ skip_message(False)
994
994
  return success
995
995
  except Exception as e:
996
996
  if quiet:
997
- enable_msgs()
997
+ skip_message(False)
998
998
  raise e
999
999
 
1000
1000
  def estimate_step_wise(self, eq_names: Union[str, List[str]], from_period: Union[str, Period]=None,
@@ -1,7 +1,7 @@
1
1
  from pathlib import Path
2
2
  from typing import Union, List
3
3
 
4
- from iode.util import enable_msgs, suppress_msgs
4
+ from iode.util import skip_message
5
5
  from iode.iode_cython import cython_load_extra_files, cython_reset_extra_files
6
6
 
7
7
 
@@ -59,16 +59,16 @@ def load_extra_files(extra_files: Union[str, Path, List[Union[str, Path]]], quie
59
59
  extra_files = [Path(extra_file) for extra_file in extra_files]
60
60
 
61
61
  if quiet:
62
- suppress_msgs()
62
+ skip_message(True)
63
63
 
64
64
  try:
65
65
  extra_files = cython_load_extra_files(extra_files)
66
66
  if quiet:
67
- enable_msgs()
67
+ skip_message(False)
68
68
  return extra_files
69
69
  except Exception as e:
70
70
  if quiet:
71
- enable_msgs()
71
+ skip_message(False)
72
72
  raise e
73
73
 
74
74
 
@@ -194,16 +194,22 @@ class Variables(IodeDatabase):
194
194
 
195
195
  # get the sample of the real database
196
196
  whole_db_sample: Sample = self._get_whole_sample()
197
+ if whole_db_sample is None:
198
+ raise RuntimeError("Cannot create subset because the sample of the Variables "
199
+ "database is not defined yet. ")
197
200
 
198
201
  # get the position of "self" first and last periods according to the real database sample
199
202
  self_t_first, self_t_last = self._get_periods_bounds()
200
203
 
201
204
  # if first_period and last_period arguments are None, they will be set to the first
202
205
  # and last periods of the parent database sample (if the parent db is a subset of the real db)
206
+ sample = self.sample
207
+ if not sample:
208
+ sample = whole_db_sample
203
209
  if first_period is None and self_t_first > 0:
204
- first_period = self.sample.start
210
+ first_period = sample.start
205
211
  if last_period is None and self_t_last < whole_db_sample.nb_periods - 1:
206
- last_period = self.sample.end
212
+ last_period = sample.end
207
213
 
208
214
  # check that first period subset < last period subset
209
215
  if first_period is not None and last_period is not None and first_period > last_period:
@@ -491,6 +497,9 @@ class Variables(IodeDatabase):
491
497
  # convert slice to a (start, end) tuple or a list of periods if step is not None
492
498
  elif isinstance(_periods, slice):
493
499
  sample = self.sample
500
+ if not sample:
501
+ raise ValueError(f"variables[names, {_periods}]: cannot use a slice to select "
502
+ "periods if the sample of the Variables database is not defined.")
494
503
  first_period = sample.start if _periods.start is None else _periods.start
495
504
  last_period = sample.end if _periods.stop is None else _periods.stop
496
505
  if _periods.step is not None:
@@ -988,6 +997,12 @@ class Variables(IodeDatabase):
988
997
  if not values.flags['C_CONTIGUOUS']:
989
998
  values = np.ascontiguousarray(values)
990
999
  elif isinstance(values, Variables):
1000
+ if not values.sample:
1001
+ raise ValueError(f"Cannot add the IODE variable '{name}': the sample of the "
1002
+ "right-hand side Variables object is not defined.")
1003
+ if not self.sample:
1004
+ raise ValueError(f"Cannot add the IODE variable '{name}': the sample of the "
1005
+ "left-hand side Variables database is not defined.")
991
1006
  if values.sample != self.sample:
992
1007
  raise ValueError(f"Cannot add the IODE variable '{name}': Incompatible periods.\n"
993
1008
  f"Expected right-hand side Variables object to have sample {self.sample}.\n"
@@ -1032,6 +1047,10 @@ class Variables(IodeDatabase):
1032
1047
  raise ValueError(f"Cannot add or update the IODE variable '{key_name}'.\n"
1033
1048
  f"Got None as value.")
1034
1049
 
1050
+ if not self.sample:
1051
+ raise RuntimeError(f"Cannot add or update the IODE variable '{key_name}'.\n"
1052
+ f"The sample of the current Variables database is not defined.")
1053
+
1035
1054
  if key_periods is not None:
1036
1055
  if isinstance(key_periods, str):
1037
1056
  key_periods = Period(key_periods)
@@ -2032,6 +2051,10 @@ class Variables(IodeDatabase):
2032
2051
  other = self._convert_values(other)
2033
2052
  _self: Variables = self.copy() if copy_self else self
2034
2053
 
2054
+ if not _self.sample:
2055
+ raise ValueError("Cannot perform arithmetic operation on an IODE Variables database "
2056
+ "with an undefined sample.")
2057
+
2035
2058
  if isinstance(other, (int, float)):
2036
2059
  _self._cy_database = _self._cy_database.binary_op_scalar(other, op, copy_self)
2037
2060
  return _self
@@ -5880,6 +5903,14 @@ class Variables(IodeDatabase):
5880
5903
  first_period, last_period = f"{labels[0]}Y1", f"{labels[-1]}Y1"
5881
5904
  elif labels.dtype.kind in 'SU':
5882
5905
  first_period, last_period = labels[0], labels[-1]
5906
+ elif labels.dtype.kind == 'O':
5907
+ # if the labels are of type object, we try to convert them to str
5908
+ try:
5909
+ labels = labels.astype(str)
5910
+ first_period, last_period = labels[0], labels[-1]
5911
+ except Exception:
5912
+ raise TypeError("The labels of the time axis in the passed Array must be either " \
5913
+ "strings or integers representing periods")
5883
5914
  else:
5884
5915
  raise TypeError("The labels of the time axis in the passed Array must be either " \
5885
5916
  "strings or integers representing periods")
@@ -6150,8 +6181,8 @@ class Variables(IodeDatabase):
6150
6181
  >>> from iode import SAMPLE_DATA_DIR
6151
6182
  >>> from iode import variables
6152
6183
  >>> variables.clear()
6153
- >>> variables.sample
6154
- None
6184
+ >>> variables.sample is None
6185
+ True
6155
6186
 
6156
6187
  >>> variables.load(f"{SAMPLE_DATA_DIR}/fun.var") # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
6157
6188
  Loading .../fun.var
@@ -6254,6 +6285,8 @@ class Variables(IodeDatabase):
6254
6285
  <BLANKLINE>
6255
6286
  """
6256
6287
  cy_sample = self._cy_database.get_sample()
6288
+ if cy_sample is None:
6289
+ return None
6257
6290
  sample = Sample.from_cython_obj(cy_sample)
6258
6291
  return sample
6259
6292
 
@@ -6301,6 +6334,8 @@ class Variables(IodeDatabase):
6301
6334
  56
6302
6335
  """
6303
6336
  # self.sample calls self._maybe_update_subset_sample()
6337
+ if self.sample is None:
6338
+ return 0
6304
6339
  return self.sample.nb_periods
6305
6340
 
6306
6341
  @property
@@ -6325,6 +6360,8 @@ class Variables(IodeDatabase):
6325
6360
  [Period("1960Y1"), Period("1961Y1"), ..., Period("2014Y1"), Period("2015Y1")]
6326
6361
  """
6327
6362
  # self.sample calls self._maybe_update_subset_sample()
6363
+ if self.sample is None:
6364
+ return []
6328
6365
  return self.sample.periods
6329
6366
 
6330
6367
  @property
@@ -6349,6 +6386,8 @@ class Variables(IodeDatabase):
6349
6386
  ['1960Y1', '1961Y1', ..., '2014Y1', '2015Y1']
6350
6387
  """
6351
6388
  # self.sample calls self._maybe_update_subset_sample()
6389
+ if self.sample is None:
6390
+ return []
6352
6391
  return self.sample.get_period_list(astype=str)
6353
6392
 
6354
6393
  @property
@@ -6373,6 +6412,8 @@ class Variables(IodeDatabase):
6373
6412
  [1960.0, 1961.0, ..., 2014.0, 2015.0]
6374
6413
  """
6375
6414
  # self.sample calls self._maybe_update_subset_sample()
6415
+ if self.sample is None:
6416
+ return []
6376
6417
  return self.sample.get_period_list(astype=float)
6377
6418
 
6378
6419
  @property
@@ -6585,6 +6626,9 @@ class Variables(IodeDatabase):
6585
6626
  [1990.0, 1991.0, ..., 1999.0, 2000.0]
6586
6627
  """
6587
6628
  # self.sample calls self._maybe_update_subset_sample()
6629
+ if self.sample is None:
6630
+ return []
6631
+
6588
6632
  sample = self.sample
6589
6633
  if from_period is None or to_period is None:
6590
6634
  if from_period is None:
@@ -6618,8 +6662,13 @@ class Variables(IodeDatabase):
6618
6662
  input_files, names = self._copy_from(input_files, names)
6619
6663
 
6620
6664
  # self.sample calls self._maybe_update_subset_sample()
6621
- sample = self.sample
6622
6665
  if from_period is None or to_period is None:
6666
+ sample = self.sample
6667
+ if sample is None:
6668
+ raise RuntimeError("Cannot copy variables from input file(s) because "
6669
+ "the current Variables sample is not defined yet. "
6670
+ "Please set the current Variables sample before copying "
6671
+ "variables from input file(s).")
6623
6672
  if from_period is None:
6624
6673
  from_period = sample.start
6625
6674
  if to_period is None:
@@ -7171,6 +7220,9 @@ class Variables(IodeDatabase):
7171
7220
  ACAF 3.00 4.00 5.00 6.00 7.00 8.00 9.00
7172
7221
  <BLANKLINE>
7173
7222
  """
7223
+ if not self.sample:
7224
+ raise ValueError("Sample must be first defined in the current Variables database.")
7225
+
7174
7226
  if isinstance(method, str):
7175
7227
  method = method.upper()
7176
7228
  method = SimulationInitialization[method]
@@ -1,3 +1,4 @@
1
+ import warnings
1
2
  import pandas as pd
2
3
  from typing import List, Union
3
4
  from iode.time.period import Period
@@ -83,6 +84,10 @@ def execute_lec(lec: str, period: Union[str, int, Period]=None) -> Union[float,
83
84
  # evaluate a LEC expression over the whole sample
84
85
  if period is None:
85
86
  from iode.iode_database.variables_database import variables
87
+ if not variables.sample:
88
+ warnings.warn("The sample of the Variables workspace is not defined. "
89
+ "Evaluate the LEC expression over an undefined sample.")
90
+ return None
86
91
  values = cython_execute_lec(lec)
87
92
  periods = [str(p) for p in variables.periods]
88
93
  series = pd.Series(values, index=periods)