@v587d/capital-generation 2.29.0 → 2.30.0

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 (299) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +3 -3
  3. package/THIRD_PARTY_NOTICES.md +16 -0
  4. package/automation/package.json +1 -1
  5. package/chart-ui/package.json +1 -1
  6. package/config/package.json +1 -1
  7. package/lib/collector-runtime.js +56 -1
  8. package/lib/data-collector/catalog-taxonomy.d.ts +1 -1
  9. package/lib/data-collector/catalog-taxonomy.js +33 -0
  10. package/lib/data-collector/tools.js +7 -7
  11. package/lib/python-runtime/errors.d.ts +1 -1
  12. package/lib/python-runtime/errors.js +2 -0
  13. package/lib/python-runtime/manager.d.ts +28 -1
  14. package/lib/python-runtime/manager.js +141 -5
  15. package/lib/python-runtime/probe.d.ts +24 -0
  16. package/lib/python-runtime/probe.js +66 -50
  17. package/lib/sources/csindex-http.d.ts +4 -0
  18. package/lib/sources/csindex-http.js +233 -0
  19. package/lib/sources/eastmoney-http.js +1504 -1
  20. package/lib/sources/fuyao-rest.js +168 -8
  21. package/lib/sources/official-http.d.ts +4 -0
  22. package/lib/sources/official-http.js +477 -0
  23. package/lib/sources/python-remote.d.ts +25 -0
  24. package/lib/sources/python-remote.js +461 -0
  25. package/lib/sources/sina-http.d.ts +2 -0
  26. package/lib/sources/sina-http.js +484 -0
  27. package/lib/sources/tencent-http.js +23 -8
  28. package/lib/sources/ths-http.d.ts +2 -0
  29. package/lib/sources/ths-http.js +514 -0
  30. package/lib/time/tools.js +19 -0
  31. package/lib/web-retriever/local-fetch.d.ts +1 -1
  32. package/lib/web-retriever/local-fetch.js +1 -1
  33. package/lib/web-retriever/sources.d.ts +7 -0
  34. package/lib/web-retriever/sources.js +46 -21
  35. package/lib/web-retriever/throttle.d.ts +8 -0
  36. package/lib/web-retriever/throttle.js +13 -0
  37. package/lib/web-retriever/tools.js +1 -1
  38. package/lib/web-retriever/wind-client.d.ts +1 -1
  39. package/lib/web-retriever/wind-client.js +1 -1
  40. package/package.json +1 -1
  41. package/preset/capital-generation/agent.patch.yml +7 -5
  42. package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +16 -16
  43. package/python/scripts/baostock_stock_basic.py +129 -0
  44. package/python/scripts/baostock_valuation_history.py +141 -0
  45. package/python/scripts/pbc_social_financing.py +291 -0
  46. package/python/vendor/baostock/LICENSE +19 -0
  47. package/python/vendor/baostock/__init__.py +42 -0
  48. package/python/vendor/baostock/common/__init__.py +0 -0
  49. package/python/vendor/baostock/common/contants.py +189 -0
  50. package/python/vendor/baostock/common/context.py +4 -0
  51. package/python/vendor/baostock/corpreport/__init__.py +0 -0
  52. package/python/vendor/baostock/corpreport/corp_performance.py +202 -0
  53. package/python/vendor/baostock/data/__init__.py +0 -0
  54. package/python/vendor/baostock/data/messageheader.py +17 -0
  55. package/python/vendor/baostock/data/msg.py +21 -0
  56. package/python/vendor/baostock/data/resultset.py +200 -0
  57. package/python/vendor/baostock/demo/__init__.py +0 -0
  58. package/python/vendor/baostock/demo/demo_A_stock_5mk-data.py +34 -0
  59. package/python/vendor/baostock/demo/demo_A_stock_k_data.py +36 -0
  60. package/python/vendor/baostock/demo/demo_AllStock.py +27 -0
  61. package/python/vendor/baostock/demo/demo_Balance_data.py +22 -0
  62. package/python/vendor/baostock/demo/demo_CashFlow_data.py +22 -0
  63. package/python/vendor/baostock/demo/demo_Dividend_data.py +35 -0
  64. package/python/vendor/baostock/demo/demo_Dupont_data.py +25 -0
  65. package/python/vendor/baostock/demo/demo_Forecast_report.py +24 -0
  66. package/python/vendor/baostock/demo/demo_Growth_data.py +22 -0
  67. package/python/vendor/baostock/demo/demo_Index_k_data.py +39 -0
  68. package/python/vendor/baostock/demo/demo_Operation_data.py +22 -0
  69. package/python/vendor/baostock/demo/demo_PerformanceExpress_report.py +25 -0
  70. package/python/vendor/baostock/demo/demo_Profit_data.py +22 -0
  71. package/python/vendor/baostock/demo/demo_TradeDates.py +27 -0
  72. package/python/vendor/baostock/demo/demo_adjust_factor_data.py +23 -0
  73. package/python/vendor/baostock/demo/demo_assignDayData.py +23 -0
  74. package/python/vendor/baostock/demo/demo_daily_adjust_factor_data.py +28 -0
  75. package/python/vendor/baostock/demo/demo_daily_k_4_AStock.py +28 -0
  76. package/python/vendor/baostock/demo/demo_daily_k_4_ETF.py +28 -0
  77. package/python/vendor/baostock/demo/demo_depositRate_data.py +26 -0
  78. package/python/vendor/baostock/demo/demo_hs300_stocks.py +26 -0
  79. package/python/vendor/baostock/demo/demo_loanRate_data.py +26 -0
  80. package/python/vendor/baostock/demo/demo_moneySupplyDataMonth_data.py +26 -0
  81. package/python/vendor/baostock/demo/demo_moneySupplyDataYear_data.py +26 -0
  82. package/python/vendor/baostock/demo/demo_requiredReserveRatio_data.py +26 -0
  83. package/python/vendor/baostock/demo/demo_set_API_key.py +37 -0
  84. package/python/vendor/baostock/demo/demo_stockBasic_data.py +27 -0
  85. package/python/vendor/baostock/demo/demo_stock_Valuation_indicator_data.py +34 -0
  86. package/python/vendor/baostock/demo/demo_stock_industry.py +26 -0
  87. package/python/vendor/baostock/demo/demo_sz50stocks.py +26 -0
  88. package/python/vendor/baostock/demo/demo_zz500_stock.py +26 -0
  89. package/python/vendor/baostock/evaluation/__init__.py +0 -0
  90. package/python/vendor/baostock/evaluation/season_index.py +758 -0
  91. package/python/vendor/baostock/login/__init__.py +0 -0
  92. package/python/vendor/baostock/login/loginout.py +230 -0
  93. package/python/vendor/baostock/macroscopic/__init__.py +0 -0
  94. package/python/vendor/baostock/macroscopic/economic_data.py +723 -0
  95. package/python/vendor/baostock/metadata/__init__.py +0 -0
  96. package/python/vendor/baostock/metadata/stock_metadata.py +207 -0
  97. package/python/vendor/baostock/security/__init__.py +0 -0
  98. package/python/vendor/baostock/security/history.py +265 -0
  99. package/python/vendor/baostock/security/sectorinfo.py +1024 -0
  100. package/python/vendor/baostock/util/__init__.py +0 -0
  101. package/python/vendor/baostock/util/socketutil.py +97 -0
  102. package/python/vendor/baostock/util/stringutil.py +83 -0
  103. package/python/vendor/et_xmlfile/LICENSE +23 -0
  104. package/python/vendor/et_xmlfile/LICENSE.python +298 -0
  105. package/python/vendor/et_xmlfile/__init__.py +8 -0
  106. package/python/vendor/et_xmlfile/incremental_tree.py +917 -0
  107. package/python/vendor/et_xmlfile/xmlfile.py +158 -0
  108. package/python/vendor/openpyxl/LICENSE +23 -0
  109. package/python/vendor/openpyxl/__init__.py +19 -0
  110. package/python/vendor/openpyxl/_constants.py +13 -0
  111. package/python/vendor/openpyxl/cell/__init__.py +4 -0
  112. package/python/vendor/openpyxl/cell/_writer.py +136 -0
  113. package/python/vendor/openpyxl/cell/cell.py +332 -0
  114. package/python/vendor/openpyxl/cell/read_only.py +136 -0
  115. package/python/vendor/openpyxl/cell/rich_text.py +202 -0
  116. package/python/vendor/openpyxl/cell/text.py +184 -0
  117. package/python/vendor/openpyxl/chart/_3d.py +105 -0
  118. package/python/vendor/openpyxl/chart/__init__.py +19 -0
  119. package/python/vendor/openpyxl/chart/_chart.py +199 -0
  120. package/python/vendor/openpyxl/chart/area_chart.py +106 -0
  121. package/python/vendor/openpyxl/chart/axis.py +401 -0
  122. package/python/vendor/openpyxl/chart/bar_chart.py +144 -0
  123. package/python/vendor/openpyxl/chart/bubble_chart.py +67 -0
  124. package/python/vendor/openpyxl/chart/chartspace.py +195 -0
  125. package/python/vendor/openpyxl/chart/data_source.py +246 -0
  126. package/python/vendor/openpyxl/chart/descriptors.py +43 -0
  127. package/python/vendor/openpyxl/chart/error_bar.py +62 -0
  128. package/python/vendor/openpyxl/chart/label.py +127 -0
  129. package/python/vendor/openpyxl/chart/layout.py +74 -0
  130. package/python/vendor/openpyxl/chart/legend.py +75 -0
  131. package/python/vendor/openpyxl/chart/line_chart.py +129 -0
  132. package/python/vendor/openpyxl/chart/marker.py +90 -0
  133. package/python/vendor/openpyxl/chart/picture.py +35 -0
  134. package/python/vendor/openpyxl/chart/pie_chart.py +177 -0
  135. package/python/vendor/openpyxl/chart/pivot.py +65 -0
  136. package/python/vendor/openpyxl/chart/plotarea.py +162 -0
  137. package/python/vendor/openpyxl/chart/print_settings.py +57 -0
  138. package/python/vendor/openpyxl/chart/radar_chart.py +55 -0
  139. package/python/vendor/openpyxl/chart/reader.py +32 -0
  140. package/python/vendor/openpyxl/chart/reference.py +124 -0
  141. package/python/vendor/openpyxl/chart/scatter_chart.py +53 -0
  142. package/python/vendor/openpyxl/chart/series.py +197 -0
  143. package/python/vendor/openpyxl/chart/series_factory.py +41 -0
  144. package/python/vendor/openpyxl/chart/shapes.py +89 -0
  145. package/python/vendor/openpyxl/chart/stock_chart.py +54 -0
  146. package/python/vendor/openpyxl/chart/surface_chart.py +119 -0
  147. package/python/vendor/openpyxl/chart/text.py +78 -0
  148. package/python/vendor/openpyxl/chart/title.py +76 -0
  149. package/python/vendor/openpyxl/chart/trendline.py +98 -0
  150. package/python/vendor/openpyxl/chart/updown_bars.py +31 -0
  151. package/python/vendor/openpyxl/chartsheet/__init__.py +3 -0
  152. package/python/vendor/openpyxl/chartsheet/chartsheet.py +107 -0
  153. package/python/vendor/openpyxl/chartsheet/custom.py +61 -0
  154. package/python/vendor/openpyxl/chartsheet/properties.py +28 -0
  155. package/python/vendor/openpyxl/chartsheet/protection.py +41 -0
  156. package/python/vendor/openpyxl/chartsheet/publish.py +58 -0
  157. package/python/vendor/openpyxl/chartsheet/relation.py +97 -0
  158. package/python/vendor/openpyxl/chartsheet/views.py +51 -0
  159. package/python/vendor/openpyxl/comments/__init__.py +4 -0
  160. package/python/vendor/openpyxl/comments/author.py +21 -0
  161. package/python/vendor/openpyxl/comments/comment_sheet.py +211 -0
  162. package/python/vendor/openpyxl/comments/comments.py +62 -0
  163. package/python/vendor/openpyxl/comments/shape_writer.py +112 -0
  164. package/python/vendor/openpyxl/compat/__init__.py +54 -0
  165. package/python/vendor/openpyxl/compat/abc.py +8 -0
  166. package/python/vendor/openpyxl/compat/numbers.py +43 -0
  167. package/python/vendor/openpyxl/compat/product.py +17 -0
  168. package/python/vendor/openpyxl/compat/singleton.py +40 -0
  169. package/python/vendor/openpyxl/compat/strings.py +25 -0
  170. package/python/vendor/openpyxl/descriptors/__init__.py +58 -0
  171. package/python/vendor/openpyxl/descriptors/base.py +272 -0
  172. package/python/vendor/openpyxl/descriptors/container.py +41 -0
  173. package/python/vendor/openpyxl/descriptors/excel.py +112 -0
  174. package/python/vendor/openpyxl/descriptors/namespace.py +12 -0
  175. package/python/vendor/openpyxl/descriptors/nested.py +129 -0
  176. package/python/vendor/openpyxl/descriptors/sequence.py +136 -0
  177. package/python/vendor/openpyxl/descriptors/serialisable.py +240 -0
  178. package/python/vendor/openpyxl/descriptors/slots.py +18 -0
  179. package/python/vendor/openpyxl/drawing/__init__.py +4 -0
  180. package/python/vendor/openpyxl/drawing/colors.py +435 -0
  181. package/python/vendor/openpyxl/drawing/connector.py +144 -0
  182. package/python/vendor/openpyxl/drawing/drawing.py +92 -0
  183. package/python/vendor/openpyxl/drawing/effect.py +407 -0
  184. package/python/vendor/openpyxl/drawing/fill.py +425 -0
  185. package/python/vendor/openpyxl/drawing/geometry.py +584 -0
  186. package/python/vendor/openpyxl/drawing/graphic.py +177 -0
  187. package/python/vendor/openpyxl/drawing/image.py +65 -0
  188. package/python/vendor/openpyxl/drawing/line.py +144 -0
  189. package/python/vendor/openpyxl/drawing/picture.py +144 -0
  190. package/python/vendor/openpyxl/drawing/properties.py +174 -0
  191. package/python/vendor/openpyxl/drawing/relation.py +17 -0
  192. package/python/vendor/openpyxl/drawing/spreadsheet_drawing.py +382 -0
  193. package/python/vendor/openpyxl/drawing/text.py +717 -0
  194. package/python/vendor/openpyxl/drawing/xdr.py +33 -0
  195. package/python/vendor/openpyxl/formatting/__init__.py +3 -0
  196. package/python/vendor/openpyxl/formatting/formatting.py +114 -0
  197. package/python/vendor/openpyxl/formatting/rule.py +291 -0
  198. package/python/vendor/openpyxl/formula/__init__.py +3 -0
  199. package/python/vendor/openpyxl/formula/tokenizer.py +446 -0
  200. package/python/vendor/openpyxl/formula/translate.py +166 -0
  201. package/python/vendor/openpyxl/packaging/__init__.py +3 -0
  202. package/python/vendor/openpyxl/packaging/core.py +115 -0
  203. package/python/vendor/openpyxl/packaging/custom.py +289 -0
  204. package/python/vendor/openpyxl/packaging/extended.py +137 -0
  205. package/python/vendor/openpyxl/packaging/interface.py +56 -0
  206. package/python/vendor/openpyxl/packaging/manifest.py +194 -0
  207. package/python/vendor/openpyxl/packaging/relationship.py +158 -0
  208. package/python/vendor/openpyxl/packaging/workbook.py +185 -0
  209. package/python/vendor/openpyxl/pivot/__init__.py +1 -0
  210. package/python/vendor/openpyxl/pivot/cache.py +965 -0
  211. package/python/vendor/openpyxl/pivot/fields.py +326 -0
  212. package/python/vendor/openpyxl/pivot/record.py +111 -0
  213. package/python/vendor/openpyxl/pivot/table.py +1261 -0
  214. package/python/vendor/openpyxl/reader/__init__.py +1 -0
  215. package/python/vendor/openpyxl/reader/drawings.py +71 -0
  216. package/python/vendor/openpyxl/reader/excel.py +349 -0
  217. package/python/vendor/openpyxl/reader/strings.py +44 -0
  218. package/python/vendor/openpyxl/reader/workbook.py +133 -0
  219. package/python/vendor/openpyxl/styles/__init__.py +11 -0
  220. package/python/vendor/openpyxl/styles/alignment.py +62 -0
  221. package/python/vendor/openpyxl/styles/borders.py +103 -0
  222. package/python/vendor/openpyxl/styles/builtins.py +1397 -0
  223. package/python/vendor/openpyxl/styles/cell_style.py +206 -0
  224. package/python/vendor/openpyxl/styles/colors.py +172 -0
  225. package/python/vendor/openpyxl/styles/differential.py +95 -0
  226. package/python/vendor/openpyxl/styles/fills.py +224 -0
  227. package/python/vendor/openpyxl/styles/fonts.py +113 -0
  228. package/python/vendor/openpyxl/styles/named_styles.py +282 -0
  229. package/python/vendor/openpyxl/styles/numbers.py +200 -0
  230. package/python/vendor/openpyxl/styles/protection.py +17 -0
  231. package/python/vendor/openpyxl/styles/proxy.py +62 -0
  232. package/python/vendor/openpyxl/styles/styleable.py +151 -0
  233. package/python/vendor/openpyxl/styles/stylesheet.py +274 -0
  234. package/python/vendor/openpyxl/styles/table.py +94 -0
  235. package/python/vendor/openpyxl/utils/__init__.py +17 -0
  236. package/python/vendor/openpyxl/utils/bound_dictionary.py +26 -0
  237. package/python/vendor/openpyxl/utils/cell.py +240 -0
  238. package/python/vendor/openpyxl/utils/dataframe.py +87 -0
  239. package/python/vendor/openpyxl/utils/datetime.py +140 -0
  240. package/python/vendor/openpyxl/utils/escape.py +43 -0
  241. package/python/vendor/openpyxl/utils/exceptions.py +34 -0
  242. package/python/vendor/openpyxl/utils/formulas.py +24 -0
  243. package/python/vendor/openpyxl/utils/indexed_list.py +49 -0
  244. package/python/vendor/openpyxl/utils/inference.py +60 -0
  245. package/python/vendor/openpyxl/utils/protection.py +22 -0
  246. package/python/vendor/openpyxl/utils/units.py +108 -0
  247. package/python/vendor/openpyxl/workbook/__init__.py +4 -0
  248. package/python/vendor/openpyxl/workbook/_writer.py +197 -0
  249. package/python/vendor/openpyxl/workbook/child.py +166 -0
  250. package/python/vendor/openpyxl/workbook/defined_name.py +189 -0
  251. package/python/vendor/openpyxl/workbook/external_link/__init__.py +3 -0
  252. package/python/vendor/openpyxl/workbook/external_link/external.py +190 -0
  253. package/python/vendor/openpyxl/workbook/external_reference.py +18 -0
  254. package/python/vendor/openpyxl/workbook/function_group.py +36 -0
  255. package/python/vendor/openpyxl/workbook/properties.py +151 -0
  256. package/python/vendor/openpyxl/workbook/protection.py +163 -0
  257. package/python/vendor/openpyxl/workbook/smart_tags.py +56 -0
  258. package/python/vendor/openpyxl/workbook/views.py +155 -0
  259. package/python/vendor/openpyxl/workbook/web.py +98 -0
  260. package/python/vendor/openpyxl/workbook/workbook.py +438 -0
  261. package/python/vendor/openpyxl/worksheet/__init__.py +1 -0
  262. package/python/vendor/openpyxl/worksheet/_read_only.py +190 -0
  263. package/python/vendor/openpyxl/worksheet/_reader.py +472 -0
  264. package/python/vendor/openpyxl/worksheet/_write_only.py +160 -0
  265. package/python/vendor/openpyxl/worksheet/_writer.py +390 -0
  266. package/python/vendor/openpyxl/worksheet/cell_range.py +512 -0
  267. package/python/vendor/openpyxl/worksheet/cell_watch.py +34 -0
  268. package/python/vendor/openpyxl/worksheet/controls.py +107 -0
  269. package/python/vendor/openpyxl/worksheet/copier.py +70 -0
  270. package/python/vendor/openpyxl/worksheet/custom.py +35 -0
  271. package/python/vendor/openpyxl/worksheet/datavalidation.py +202 -0
  272. package/python/vendor/openpyxl/worksheet/dimensions.py +306 -0
  273. package/python/vendor/openpyxl/worksheet/drawing.py +14 -0
  274. package/python/vendor/openpyxl/worksheet/errors.py +93 -0
  275. package/python/vendor/openpyxl/worksheet/filters.py +486 -0
  276. package/python/vendor/openpyxl/worksheet/formula.py +51 -0
  277. package/python/vendor/openpyxl/worksheet/header_footer.py +270 -0
  278. package/python/vendor/openpyxl/worksheet/hyperlink.py +46 -0
  279. package/python/vendor/openpyxl/worksheet/merge.py +141 -0
  280. package/python/vendor/openpyxl/worksheet/ole.py +133 -0
  281. package/python/vendor/openpyxl/worksheet/page.py +174 -0
  282. package/python/vendor/openpyxl/worksheet/pagebreak.py +94 -0
  283. package/python/vendor/openpyxl/worksheet/picture.py +8 -0
  284. package/python/vendor/openpyxl/worksheet/print_settings.py +184 -0
  285. package/python/vendor/openpyxl/worksheet/properties.py +97 -0
  286. package/python/vendor/openpyxl/worksheet/protection.py +120 -0
  287. package/python/vendor/openpyxl/worksheet/related.py +17 -0
  288. package/python/vendor/openpyxl/worksheet/scenario.py +105 -0
  289. package/python/vendor/openpyxl/worksheet/smart_tag.py +78 -0
  290. package/python/vendor/openpyxl/worksheet/table.py +385 -0
  291. package/python/vendor/openpyxl/worksheet/views.py +155 -0
  292. package/python/vendor/openpyxl/worksheet/worksheet.py +907 -0
  293. package/python/vendor/openpyxl/writer/__init__.py +1 -0
  294. package/python/vendor/openpyxl/writer/excel.py +295 -0
  295. package/python/vendor/openpyxl/writer/theme.py +291 -0
  296. package/python/vendor/openpyxl/xml/__init__.py +42 -0
  297. package/python/vendor/openpyxl/xml/constants.py +129 -0
  298. package/python/vendor/openpyxl/xml/functions.py +87 -0
  299. package/watchlist/package.json +1 -1
@@ -0,0 +1,174 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Float,
6
+ Bool,
7
+ Integer,
8
+ NoneSet,
9
+ )
10
+ from openpyxl.descriptors.excel import UniversalMeasure, Relation
11
+
12
+
13
+ class PrintPageSetup(Serialisable):
14
+ """ Worksheet print page setup """
15
+
16
+ tagname = "pageSetup"
17
+
18
+ orientation = NoneSet(values=("default", "portrait", "landscape"))
19
+ paperSize = Integer(allow_none=True)
20
+ scale = Integer(allow_none=True)
21
+ fitToHeight = Integer(allow_none=True)
22
+ fitToWidth = Integer(allow_none=True)
23
+ firstPageNumber = Integer(allow_none=True)
24
+ useFirstPageNumber = Bool(allow_none=True)
25
+ paperHeight = UniversalMeasure(allow_none=True)
26
+ paperWidth = UniversalMeasure(allow_none=True)
27
+ pageOrder = NoneSet(values=("downThenOver", "overThenDown"))
28
+ usePrinterDefaults = Bool(allow_none=True)
29
+ blackAndWhite = Bool(allow_none=True)
30
+ draft = Bool(allow_none=True)
31
+ cellComments = NoneSet(values=("asDisplayed", "atEnd"))
32
+ errors = NoneSet(values=("displayed", "blank", "dash", "NA"))
33
+ horizontalDpi = Integer(allow_none=True)
34
+ verticalDpi = Integer(allow_none=True)
35
+ copies = Integer(allow_none=True)
36
+ id = Relation()
37
+
38
+
39
+ def __init__(self,
40
+ worksheet=None,
41
+ orientation=None,
42
+ paperSize=None,
43
+ scale=None,
44
+ fitToHeight=None,
45
+ fitToWidth=None,
46
+ firstPageNumber=None,
47
+ useFirstPageNumber=None,
48
+ paperHeight=None,
49
+ paperWidth=None,
50
+ pageOrder=None,
51
+ usePrinterDefaults=None,
52
+ blackAndWhite=None,
53
+ draft=None,
54
+ cellComments=None,
55
+ errors=None,
56
+ horizontalDpi=None,
57
+ verticalDpi=None,
58
+ copies=None,
59
+ id=None):
60
+ self._parent = worksheet
61
+ self.orientation = orientation
62
+ self.paperSize = paperSize
63
+ self.scale = scale
64
+ self.fitToHeight = fitToHeight
65
+ self.fitToWidth = fitToWidth
66
+ self.firstPageNumber = firstPageNumber
67
+ self.useFirstPageNumber = useFirstPageNumber
68
+ self.paperHeight = paperHeight
69
+ self.paperWidth = paperWidth
70
+ self.pageOrder = pageOrder
71
+ self.usePrinterDefaults = usePrinterDefaults
72
+ self.blackAndWhite = blackAndWhite
73
+ self.draft = draft
74
+ self.cellComments = cellComments
75
+ self.errors = errors
76
+ self.horizontalDpi = horizontalDpi
77
+ self.verticalDpi = verticalDpi
78
+ self.copies = copies
79
+ self.id = id
80
+
81
+
82
+ def __bool__(self):
83
+ return bool(dict(self))
84
+
85
+
86
+
87
+
88
+ @property
89
+ def sheet_properties(self):
90
+ """
91
+ Proxy property
92
+ """
93
+ return self._parent.sheet_properties.pageSetUpPr
94
+
95
+
96
+ @property
97
+ def fitToPage(self):
98
+ return self.sheet_properties.fitToPage
99
+
100
+
101
+ @fitToPage.setter
102
+ def fitToPage(self, value):
103
+ self.sheet_properties.fitToPage = value
104
+
105
+
106
+ @property
107
+ def autoPageBreaks(self):
108
+ return self.sheet_properties.autoPageBreaks
109
+
110
+
111
+ @autoPageBreaks.setter
112
+ def autoPageBreaks(self, value):
113
+ self.sheet_properties.autoPageBreaks = value
114
+
115
+
116
+ @classmethod
117
+ def from_tree(cls, node):
118
+ self = super().from_tree(node)
119
+ self.id = None # strip link to binary settings
120
+ return self
121
+
122
+
123
+ class PrintOptions(Serialisable):
124
+ """ Worksheet print options """
125
+
126
+ tagname = "printOptions"
127
+ horizontalCentered = Bool(allow_none=True)
128
+ verticalCentered = Bool(allow_none=True)
129
+ headings = Bool(allow_none=True)
130
+ gridLines = Bool(allow_none=True)
131
+ gridLinesSet = Bool(allow_none=True)
132
+
133
+ def __init__(self, horizontalCentered=None,
134
+ verticalCentered=None,
135
+ headings=None,
136
+ gridLines=None,
137
+ gridLinesSet=None,
138
+ ):
139
+ self.horizontalCentered = horizontalCentered
140
+ self.verticalCentered = verticalCentered
141
+ self.headings = headings
142
+ self.gridLines = gridLines
143
+ self.gridLinesSet = gridLinesSet
144
+
145
+
146
+ def __bool__(self):
147
+ return bool(dict(self))
148
+
149
+
150
+ class PageMargins(Serialisable):
151
+ """
152
+ Information about page margins for view/print layouts.
153
+ Standard values (in inches)
154
+ left, right = 0.75
155
+ top, bottom = 1
156
+ header, footer = 0.5
157
+ """
158
+ tagname = "pageMargins"
159
+
160
+ left = Float()
161
+ right = Float()
162
+ top = Float()
163
+ bottom = Float()
164
+ header = Float()
165
+ footer = Float()
166
+
167
+ def __init__(self, left=0.75, right=0.75, top=1, bottom=1, header=0.5,
168
+ footer=0.5):
169
+ self.left = left
170
+ self.right = right
171
+ self.top = top
172
+ self.bottom = bottom
173
+ self.header = header
174
+ self.footer = footer
@@ -0,0 +1,94 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Integer,
6
+ Bool,
7
+ Sequence,
8
+ )
9
+
10
+
11
+ class Break(Serialisable):
12
+
13
+ tagname = "brk"
14
+
15
+ id = Integer(allow_none=True)
16
+ min = Integer(allow_none=True)
17
+ max = Integer(allow_none=True)
18
+ man = Bool(allow_none=True)
19
+ pt = Bool(allow_none=True)
20
+
21
+ def __init__(self,
22
+ id=0,
23
+ min=0,
24
+ max=16383,
25
+ man=True,
26
+ pt=None,
27
+ ):
28
+ self.id = id
29
+ self.min = min
30
+ self.max = max
31
+ self.man = man
32
+ self.pt = pt
33
+
34
+
35
+ class RowBreak(Serialisable):
36
+
37
+ tagname = "rowBreaks"
38
+
39
+ count = Integer(allow_none=True)
40
+ manualBreakCount = Integer(allow_none=True)
41
+ brk = Sequence(expected_type=Break, allow_none=True)
42
+
43
+ __elements__ = ('brk',)
44
+ __attrs__ = ("count", "manualBreakCount",)
45
+
46
+ def __init__(self,
47
+ count=None,
48
+ manualBreakCount=None,
49
+ brk=(),
50
+ ):
51
+ self.brk = brk
52
+
53
+
54
+ def __bool__(self):
55
+ return len(self.brk) > 0
56
+
57
+
58
+ def __len__(self):
59
+ return len(self.brk)
60
+
61
+
62
+ @property
63
+ def count(self):
64
+ return len(self)
65
+
66
+
67
+ @property
68
+ def manualBreakCount(self):
69
+ return len(self)
70
+
71
+
72
+ def append(self, brk=None):
73
+ """
74
+ Add a page break
75
+ """
76
+ vals = list(self.brk)
77
+ if not isinstance(brk, Break):
78
+ brk = Break(id=self.count+1)
79
+ vals.append(brk)
80
+ self.brk = vals
81
+
82
+
83
+ PageBreak = RowBreak
84
+
85
+
86
+ class ColBreak(RowBreak):
87
+
88
+ tagname = "colBreaks"
89
+
90
+ count = RowBreak.count
91
+ manualBreakCount = RowBreak.manualBreakCount
92
+ brk = RowBreak.brk
93
+
94
+ __attrs__ = RowBreak.__attrs__
@@ -0,0 +1,8 @@
1
+ #Autogenerated schema
2
+ from openpyxl.descriptors.serialisable import Serialisable
3
+
4
+ # same as related
5
+
6
+ class SheetBackgroundPicture(Serialisable):
7
+
8
+ tagname = "sheetBackgroundPicture"
@@ -0,0 +1,184 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ import re
4
+ from openpyxl.descriptors import (
5
+ Strict,
6
+ Integer,
7
+ String,
8
+ Typed,
9
+ )
10
+ from openpyxl.utils import quote_sheetname, absolute_coordinate
11
+ from openpyxl.utils.cell import SHEET_TITLE, SHEETRANGE_RE, RANGE_EXPR
12
+
13
+ from .cell_range import MultiCellRange
14
+
15
+ COL_RANGE = r"""(?P<cols>[$]?(?P<min_col>[a-zA-Z]{1,3}):[$]?(?P<max_col>[a-zA-Z]{1,3}))"""
16
+ COL_RANGE_RE = re.compile(COL_RANGE)
17
+ ROW_RANGE = r"""(?P<rows>[$]?(?P<min_row>\d+):[$]?(?P<max_row>\d+))"""
18
+ ROW_RANGE_RE = re.compile(ROW_RANGE)
19
+ TITLES_REGEX = re.compile("""{0}{1}?,?{2}?,?""".format(SHEET_TITLE, ROW_RANGE, COL_RANGE),
20
+ re.VERBOSE)
21
+ PRINT_AREA_RE = re.compile(f"({SHEET_TITLE})?(?P<cells>{RANGE_EXPR})", re.VERBOSE)
22
+
23
+ class ColRange(Strict):
24
+ """
25
+ Represent a range of at least one column
26
+ """
27
+
28
+ min_col = String()
29
+ max_col = String()
30
+
31
+
32
+ def __init__(self, range_string=None, min_col=None, max_col=None):
33
+ if range_string is not None:
34
+ match = COL_RANGE_RE.match(range_string)
35
+ if not match:
36
+ raise ValueError(f"{range_string} is not a valid column range")
37
+ min_col, max_col = match.groups()[1:]
38
+ self.min_col = min_col
39
+ self.max_col = max_col
40
+
41
+
42
+ def __eq__(self, other):
43
+ if isinstance(other, self.__class__):
44
+ return (self.min_col == other.min_col
45
+ and
46
+ self.max_col == other.max_col)
47
+ elif isinstance(other, str):
48
+ return (str(self) == other
49
+ or
50
+ f"{self.min_col}:{self.max_col}")
51
+ return False
52
+
53
+
54
+ def __repr__(self):
55
+ return f"Range of columns from '{self.min_col}' to '{self.max_col}'"
56
+
57
+
58
+ def __str__(self):
59
+ return f"${self.min_col}:${self.max_col}"
60
+
61
+
62
+ class RowRange(Strict):
63
+ """
64
+ Represent a range of at least one row
65
+ """
66
+
67
+ min_row = Integer()
68
+ max_row = Integer()
69
+
70
+ def __init__(self, range_string=None, min_row=None, max_row=None):
71
+ if range_string is not None:
72
+ match = ROW_RANGE_RE.match(range_string)
73
+ if not match:
74
+ raise ValueError(f"{range_string} is not a valid row range")
75
+ min_row, max_row = match.groups()[1:]
76
+ self.min_row = min_row
77
+ self.max_row = max_row
78
+
79
+
80
+ def __eq__(self, other):
81
+ if isinstance(other, self.__class__):
82
+ return (self.min_row == other.min_row
83
+ and
84
+ self.max_row == other.max_row)
85
+ elif isinstance(other, str):
86
+ return (str(self) == other
87
+ or
88
+ f"{self.min_row}:{self.max_row}")
89
+ return False
90
+
91
+ def __repr__(self):
92
+ return f"Range of rows from '{self.min_row}' to '{self.max_row}'"
93
+
94
+
95
+ def __str__(self):
96
+ return f"${self.min_row}:${self.max_row}"
97
+
98
+
99
+ class PrintTitles(Strict):
100
+ """
101
+ Contains at least either a range of rows or columns
102
+ """
103
+
104
+ cols = Typed(expected_type=ColRange, allow_none=True)
105
+ rows = Typed(expected_type=RowRange, allow_none=True)
106
+ title = String()
107
+
108
+
109
+ def __init__(self, cols=None, rows=None, title=""):
110
+ self.cols = cols
111
+ self.rows = rows
112
+ self.title = title
113
+
114
+
115
+ @classmethod
116
+ def from_string(cls, value):
117
+ kw = dict((k, v) for match in TITLES_REGEX.finditer(value)
118
+ for k, v in match.groupdict().items() if v)
119
+
120
+ if not kw:
121
+ raise ValueError(f"{value} is not a valid print titles definition")
122
+
123
+ cols = rows = None
124
+
125
+ if "cols" in kw:
126
+ cols = ColRange(kw["cols"])
127
+ if "rows" in kw:
128
+ rows = RowRange(kw["rows"])
129
+
130
+ title = kw.get("quoted") or kw.get("notquoted")
131
+
132
+ return cls(cols=cols, rows=rows, title=title)
133
+
134
+
135
+ def __eq__(self, other):
136
+ if isinstance(other, self.__class__):
137
+ return (self.cols == other.cols
138
+ and
139
+ self.rows == other.rows
140
+ and
141
+ self.title == other.title)
142
+ elif isinstance(other, str):
143
+ return str(self) == other
144
+ return False
145
+
146
+ def __repr__(self):
147
+ return f"Print titles for sheet {self.title} cols {self.rows}, rows {self.cols}"
148
+
149
+
150
+ def __str__(self):
151
+ title = quote_sheetname(self.title)
152
+ titles = ",".join([f"{title}!{value}" for value in (self.rows, self.cols) if value])
153
+ return titles or ""
154
+
155
+
156
+ class PrintArea(MultiCellRange):
157
+
158
+
159
+ @classmethod
160
+ def from_string(cls, value):
161
+ new = []
162
+ for m in PRINT_AREA_RE.finditer(value): # can be multiple
163
+ coord = m.group("cells")
164
+ if coord:
165
+ new.append(coord)
166
+ return cls(new)
167
+
168
+
169
+ def __init__(self, ranges=(), title=""):
170
+ self.title = ""
171
+ super().__init__(ranges)
172
+
173
+
174
+ def __str__(self):
175
+ if self.ranges:
176
+ return ",".join([f"{quote_sheetname(self.title)}!{absolute_coordinate(str(range))}"
177
+ for range in self.sorted()])
178
+ return ""
179
+
180
+
181
+ def __eq__(self, other):
182
+ super().__eq__(other)
183
+ if isinstance(other, str):
184
+ return str(self) == other
@@ -0,0 +1,97 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ """Worksheet Properties"""
4
+
5
+ from openpyxl.descriptors.serialisable import Serialisable
6
+ from openpyxl.descriptors import String, Bool, Typed
7
+ from openpyxl.styles.colors import ColorDescriptor
8
+
9
+
10
+ class Outline(Serialisable):
11
+
12
+ tagname = "outlinePr"
13
+
14
+ applyStyles = Bool(allow_none=True)
15
+ summaryBelow = Bool(allow_none=True)
16
+ summaryRight = Bool(allow_none=True)
17
+ showOutlineSymbols = Bool(allow_none=True)
18
+
19
+
20
+ def __init__(self,
21
+ applyStyles=None,
22
+ summaryBelow=None,
23
+ summaryRight=None,
24
+ showOutlineSymbols=None
25
+ ):
26
+ self.applyStyles = applyStyles
27
+ self.summaryBelow = summaryBelow
28
+ self.summaryRight = summaryRight
29
+ self.showOutlineSymbols = showOutlineSymbols
30
+
31
+
32
+ class PageSetupProperties(Serialisable):
33
+
34
+ tagname = "pageSetUpPr"
35
+
36
+ autoPageBreaks = Bool(allow_none=True)
37
+ fitToPage = Bool(allow_none=True)
38
+
39
+ def __init__(self, autoPageBreaks=None, fitToPage=None):
40
+ self.autoPageBreaks = autoPageBreaks
41
+ self.fitToPage = fitToPage
42
+
43
+
44
+ class WorksheetProperties(Serialisable):
45
+
46
+ tagname = "sheetPr"
47
+
48
+ codeName = String(allow_none=True)
49
+ enableFormatConditionsCalculation = Bool(allow_none=True)
50
+ filterMode = Bool(allow_none=True)
51
+ published = Bool(allow_none=True)
52
+ syncHorizontal = Bool(allow_none=True)
53
+ syncRef = String(allow_none=True)
54
+ syncVertical = Bool(allow_none=True)
55
+ transitionEvaluation = Bool(allow_none=True)
56
+ transitionEntry = Bool(allow_none=True)
57
+ tabColor = ColorDescriptor(allow_none=True)
58
+ outlinePr = Typed(expected_type=Outline, allow_none=True)
59
+ pageSetUpPr = Typed(expected_type=PageSetupProperties, allow_none=True)
60
+
61
+ __elements__ = ('tabColor', 'outlinePr', 'pageSetUpPr')
62
+
63
+
64
+ def __init__(self,
65
+ codeName=None,
66
+ enableFormatConditionsCalculation=None,
67
+ filterMode=None,
68
+ published=None,
69
+ syncHorizontal=None,
70
+ syncRef=None,
71
+ syncVertical=None,
72
+ transitionEvaluation=None,
73
+ transitionEntry=None,
74
+ tabColor=None,
75
+ outlinePr=None,
76
+ pageSetUpPr=None
77
+ ):
78
+ """ Attributes """
79
+ self.codeName = codeName
80
+ self.enableFormatConditionsCalculation = enableFormatConditionsCalculation
81
+ self.filterMode = filterMode
82
+ self.published = published
83
+ self.syncHorizontal = syncHorizontal
84
+ self.syncRef = syncRef
85
+ self.syncVertical = syncVertical
86
+ self.transitionEvaluation = transitionEvaluation
87
+ self.transitionEntry = transitionEntry
88
+ """ Elements """
89
+ self.tabColor = tabColor
90
+ if outlinePr is None:
91
+ self.outlinePr = Outline(summaryBelow=True, summaryRight=True)
92
+ else:
93
+ self.outlinePr = outlinePr
94
+
95
+ if pageSetUpPr is None:
96
+ pageSetUpPr = PageSetupProperties()
97
+ self.pageSetUpPr = pageSetUpPr
@@ -0,0 +1,120 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors import (
4
+ Bool,
5
+ String,
6
+ Alias,
7
+ Integer,
8
+ )
9
+ from openpyxl.descriptors.serialisable import Serialisable
10
+ from openpyxl.descriptors.excel import (
11
+ Base64Binary,
12
+ )
13
+ from openpyxl.utils.protection import hash_password
14
+
15
+
16
+ class _Protected:
17
+ _password = None
18
+
19
+ def set_password(self, value='', already_hashed=False):
20
+ """Set a password on this sheet."""
21
+ if not already_hashed:
22
+ value = hash_password(value)
23
+ self._password = value
24
+
25
+ @property
26
+ def password(self):
27
+ """Return the password value, regardless of hash."""
28
+ return self._password
29
+
30
+ @password.setter
31
+ def password(self, value):
32
+ """Set a password directly, forcing a hash step."""
33
+ self.set_password(value)
34
+
35
+
36
+ class SheetProtection(Serialisable, _Protected):
37
+ """
38
+ Information about protection of various aspects of a sheet. True values
39
+ mean that protection for the object or action is active This is the
40
+ **default** when protection is active, ie. users cannot do something
41
+ """
42
+
43
+ tagname = "sheetProtection"
44
+
45
+ sheet = Bool()
46
+ enabled = Alias('sheet')
47
+ objects = Bool()
48
+ scenarios = Bool()
49
+ formatCells = Bool()
50
+ formatColumns = Bool()
51
+ formatRows = Bool()
52
+ insertColumns = Bool()
53
+ insertRows = Bool()
54
+ insertHyperlinks = Bool()
55
+ deleteColumns = Bool()
56
+ deleteRows = Bool()
57
+ selectLockedCells = Bool()
58
+ selectUnlockedCells = Bool()
59
+ sort = Bool()
60
+ autoFilter = Bool()
61
+ pivotTables = Bool()
62
+ saltValue = Base64Binary(allow_none=True)
63
+ spinCount = Integer(allow_none=True)
64
+ algorithmName = String(allow_none=True)
65
+ hashValue = Base64Binary(allow_none=True)
66
+
67
+
68
+ __attrs__ = ('selectLockedCells', 'selectUnlockedCells', 'algorithmName',
69
+ 'sheet', 'objects', 'insertRows', 'insertHyperlinks', 'autoFilter',
70
+ 'scenarios', 'formatColumns', 'deleteColumns', 'insertColumns',
71
+ 'pivotTables', 'deleteRows', 'formatCells', 'saltValue', 'formatRows',
72
+ 'sort', 'spinCount', 'password', 'hashValue')
73
+
74
+
75
+ def __init__(self, sheet=False, objects=False, scenarios=False,
76
+ formatCells=True, formatRows=True, formatColumns=True,
77
+ insertColumns=True, insertRows=True, insertHyperlinks=True,
78
+ deleteColumns=True, deleteRows=True, selectLockedCells=False,
79
+ selectUnlockedCells=False, sort=True, autoFilter=True, pivotTables=True,
80
+ password=None, algorithmName=None, saltValue=None, spinCount=None, hashValue=None):
81
+ self.sheet = sheet
82
+ self.objects = objects
83
+ self.scenarios = scenarios
84
+ self.formatCells = formatCells
85
+ self.formatColumns = formatColumns
86
+ self.formatRows = formatRows
87
+ self.insertColumns = insertColumns
88
+ self.insertRows = insertRows
89
+ self.insertHyperlinks = insertHyperlinks
90
+ self.deleteColumns = deleteColumns
91
+ self.deleteRows = deleteRows
92
+ self.selectLockedCells = selectLockedCells
93
+ self.selectUnlockedCells = selectUnlockedCells
94
+ self.sort = sort
95
+ self.autoFilter = autoFilter
96
+ self.pivotTables = pivotTables
97
+ if password is not None:
98
+ self.password = password
99
+ self.algorithmName = algorithmName
100
+ self.saltValue = saltValue
101
+ self.spinCount = spinCount
102
+ self.hashValue = hashValue
103
+
104
+
105
+ def set_password(self, value='', already_hashed=False):
106
+ super().set_password(value, already_hashed)
107
+ self.enable()
108
+
109
+
110
+ def enable(self):
111
+ self.sheet = True
112
+
113
+
114
+ def disable(self):
115
+ self.sheet = False
116
+
117
+
118
+ def __bool__(self):
119
+ return self.sheet
120
+
@@ -0,0 +1,17 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors.excel import Relation
5
+
6
+
7
+ class Related(Serialisable):
8
+
9
+ id = Relation()
10
+
11
+
12
+ def __init__(self, id=None):
13
+ self.id = id
14
+
15
+
16
+ def to_tree(self, tagname, idx=None):
17
+ return super().to_tree(tagname)