@v587d/capital-generation 2.28.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 (302) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +5 -4
  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/host-version.d.ts +9 -0
  12. package/lib/host-version.js +57 -0
  13. package/lib/python-runtime/errors.d.ts +1 -1
  14. package/lib/python-runtime/errors.js +2 -0
  15. package/lib/python-runtime/manager.d.ts +28 -1
  16. package/lib/python-runtime/manager.js +141 -5
  17. package/lib/python-runtime/probe.d.ts +24 -0
  18. package/lib/python-runtime/probe.js +66 -50
  19. package/lib/runtime-entry.js +8 -0
  20. package/lib/sources/csindex-http.d.ts +4 -0
  21. package/lib/sources/csindex-http.js +233 -0
  22. package/lib/sources/eastmoney-http.js +1504 -1
  23. package/lib/sources/fuyao-rest.js +168 -8
  24. package/lib/sources/official-http.d.ts +4 -0
  25. package/lib/sources/official-http.js +477 -0
  26. package/lib/sources/python-remote.d.ts +25 -0
  27. package/lib/sources/python-remote.js +461 -0
  28. package/lib/sources/sina-http.d.ts +2 -0
  29. package/lib/sources/sina-http.js +484 -0
  30. package/lib/sources/tencent-http.js +23 -8
  31. package/lib/sources/ths-http.d.ts +2 -0
  32. package/lib/sources/ths-http.js +514 -0
  33. package/lib/time/tools.js +19 -0
  34. package/lib/web-retriever/local-fetch.d.ts +1 -1
  35. package/lib/web-retriever/local-fetch.js +1 -1
  36. package/lib/web-retriever/sources.d.ts +7 -0
  37. package/lib/web-retriever/sources.js +46 -21
  38. package/lib/web-retriever/throttle.d.ts +8 -0
  39. package/lib/web-retriever/throttle.js +13 -0
  40. package/lib/web-retriever/tools.js +1 -1
  41. package/lib/web-retriever/wind-client.d.ts +1 -1
  42. package/lib/web-retriever/wind-client.js +1 -1
  43. package/package.json +6 -3
  44. package/preset/capital-generation/agent.patch.yml +7 -5
  45. package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +16 -16
  46. package/python/scripts/baostock_stock_basic.py +129 -0
  47. package/python/scripts/baostock_valuation_history.py +141 -0
  48. package/python/scripts/pbc_social_financing.py +291 -0
  49. package/python/vendor/baostock/LICENSE +19 -0
  50. package/python/vendor/baostock/__init__.py +42 -0
  51. package/python/vendor/baostock/common/__init__.py +0 -0
  52. package/python/vendor/baostock/common/contants.py +189 -0
  53. package/python/vendor/baostock/common/context.py +4 -0
  54. package/python/vendor/baostock/corpreport/__init__.py +0 -0
  55. package/python/vendor/baostock/corpreport/corp_performance.py +202 -0
  56. package/python/vendor/baostock/data/__init__.py +0 -0
  57. package/python/vendor/baostock/data/messageheader.py +17 -0
  58. package/python/vendor/baostock/data/msg.py +21 -0
  59. package/python/vendor/baostock/data/resultset.py +200 -0
  60. package/python/vendor/baostock/demo/__init__.py +0 -0
  61. package/python/vendor/baostock/demo/demo_A_stock_5mk-data.py +34 -0
  62. package/python/vendor/baostock/demo/demo_A_stock_k_data.py +36 -0
  63. package/python/vendor/baostock/demo/demo_AllStock.py +27 -0
  64. package/python/vendor/baostock/demo/demo_Balance_data.py +22 -0
  65. package/python/vendor/baostock/demo/demo_CashFlow_data.py +22 -0
  66. package/python/vendor/baostock/demo/demo_Dividend_data.py +35 -0
  67. package/python/vendor/baostock/demo/demo_Dupont_data.py +25 -0
  68. package/python/vendor/baostock/demo/demo_Forecast_report.py +24 -0
  69. package/python/vendor/baostock/demo/demo_Growth_data.py +22 -0
  70. package/python/vendor/baostock/demo/demo_Index_k_data.py +39 -0
  71. package/python/vendor/baostock/demo/demo_Operation_data.py +22 -0
  72. package/python/vendor/baostock/demo/demo_PerformanceExpress_report.py +25 -0
  73. package/python/vendor/baostock/demo/demo_Profit_data.py +22 -0
  74. package/python/vendor/baostock/demo/demo_TradeDates.py +27 -0
  75. package/python/vendor/baostock/demo/demo_adjust_factor_data.py +23 -0
  76. package/python/vendor/baostock/demo/demo_assignDayData.py +23 -0
  77. package/python/vendor/baostock/demo/demo_daily_adjust_factor_data.py +28 -0
  78. package/python/vendor/baostock/demo/demo_daily_k_4_AStock.py +28 -0
  79. package/python/vendor/baostock/demo/demo_daily_k_4_ETF.py +28 -0
  80. package/python/vendor/baostock/demo/demo_depositRate_data.py +26 -0
  81. package/python/vendor/baostock/demo/demo_hs300_stocks.py +26 -0
  82. package/python/vendor/baostock/demo/demo_loanRate_data.py +26 -0
  83. package/python/vendor/baostock/demo/demo_moneySupplyDataMonth_data.py +26 -0
  84. package/python/vendor/baostock/demo/demo_moneySupplyDataYear_data.py +26 -0
  85. package/python/vendor/baostock/demo/demo_requiredReserveRatio_data.py +26 -0
  86. package/python/vendor/baostock/demo/demo_set_API_key.py +37 -0
  87. package/python/vendor/baostock/demo/demo_stockBasic_data.py +27 -0
  88. package/python/vendor/baostock/demo/demo_stock_Valuation_indicator_data.py +34 -0
  89. package/python/vendor/baostock/demo/demo_stock_industry.py +26 -0
  90. package/python/vendor/baostock/demo/demo_sz50stocks.py +26 -0
  91. package/python/vendor/baostock/demo/demo_zz500_stock.py +26 -0
  92. package/python/vendor/baostock/evaluation/__init__.py +0 -0
  93. package/python/vendor/baostock/evaluation/season_index.py +758 -0
  94. package/python/vendor/baostock/login/__init__.py +0 -0
  95. package/python/vendor/baostock/login/loginout.py +230 -0
  96. package/python/vendor/baostock/macroscopic/__init__.py +0 -0
  97. package/python/vendor/baostock/macroscopic/economic_data.py +723 -0
  98. package/python/vendor/baostock/metadata/__init__.py +0 -0
  99. package/python/vendor/baostock/metadata/stock_metadata.py +207 -0
  100. package/python/vendor/baostock/security/__init__.py +0 -0
  101. package/python/vendor/baostock/security/history.py +265 -0
  102. package/python/vendor/baostock/security/sectorinfo.py +1024 -0
  103. package/python/vendor/baostock/util/__init__.py +0 -0
  104. package/python/vendor/baostock/util/socketutil.py +97 -0
  105. package/python/vendor/baostock/util/stringutil.py +83 -0
  106. package/python/vendor/et_xmlfile/LICENSE +23 -0
  107. package/python/vendor/et_xmlfile/LICENSE.python +298 -0
  108. package/python/vendor/et_xmlfile/__init__.py +8 -0
  109. package/python/vendor/et_xmlfile/incremental_tree.py +917 -0
  110. package/python/vendor/et_xmlfile/xmlfile.py +158 -0
  111. package/python/vendor/openpyxl/LICENSE +23 -0
  112. package/python/vendor/openpyxl/__init__.py +19 -0
  113. package/python/vendor/openpyxl/_constants.py +13 -0
  114. package/python/vendor/openpyxl/cell/__init__.py +4 -0
  115. package/python/vendor/openpyxl/cell/_writer.py +136 -0
  116. package/python/vendor/openpyxl/cell/cell.py +332 -0
  117. package/python/vendor/openpyxl/cell/read_only.py +136 -0
  118. package/python/vendor/openpyxl/cell/rich_text.py +202 -0
  119. package/python/vendor/openpyxl/cell/text.py +184 -0
  120. package/python/vendor/openpyxl/chart/_3d.py +105 -0
  121. package/python/vendor/openpyxl/chart/__init__.py +19 -0
  122. package/python/vendor/openpyxl/chart/_chart.py +199 -0
  123. package/python/vendor/openpyxl/chart/area_chart.py +106 -0
  124. package/python/vendor/openpyxl/chart/axis.py +401 -0
  125. package/python/vendor/openpyxl/chart/bar_chart.py +144 -0
  126. package/python/vendor/openpyxl/chart/bubble_chart.py +67 -0
  127. package/python/vendor/openpyxl/chart/chartspace.py +195 -0
  128. package/python/vendor/openpyxl/chart/data_source.py +246 -0
  129. package/python/vendor/openpyxl/chart/descriptors.py +43 -0
  130. package/python/vendor/openpyxl/chart/error_bar.py +62 -0
  131. package/python/vendor/openpyxl/chart/label.py +127 -0
  132. package/python/vendor/openpyxl/chart/layout.py +74 -0
  133. package/python/vendor/openpyxl/chart/legend.py +75 -0
  134. package/python/vendor/openpyxl/chart/line_chart.py +129 -0
  135. package/python/vendor/openpyxl/chart/marker.py +90 -0
  136. package/python/vendor/openpyxl/chart/picture.py +35 -0
  137. package/python/vendor/openpyxl/chart/pie_chart.py +177 -0
  138. package/python/vendor/openpyxl/chart/pivot.py +65 -0
  139. package/python/vendor/openpyxl/chart/plotarea.py +162 -0
  140. package/python/vendor/openpyxl/chart/print_settings.py +57 -0
  141. package/python/vendor/openpyxl/chart/radar_chart.py +55 -0
  142. package/python/vendor/openpyxl/chart/reader.py +32 -0
  143. package/python/vendor/openpyxl/chart/reference.py +124 -0
  144. package/python/vendor/openpyxl/chart/scatter_chart.py +53 -0
  145. package/python/vendor/openpyxl/chart/series.py +197 -0
  146. package/python/vendor/openpyxl/chart/series_factory.py +41 -0
  147. package/python/vendor/openpyxl/chart/shapes.py +89 -0
  148. package/python/vendor/openpyxl/chart/stock_chart.py +54 -0
  149. package/python/vendor/openpyxl/chart/surface_chart.py +119 -0
  150. package/python/vendor/openpyxl/chart/text.py +78 -0
  151. package/python/vendor/openpyxl/chart/title.py +76 -0
  152. package/python/vendor/openpyxl/chart/trendline.py +98 -0
  153. package/python/vendor/openpyxl/chart/updown_bars.py +31 -0
  154. package/python/vendor/openpyxl/chartsheet/__init__.py +3 -0
  155. package/python/vendor/openpyxl/chartsheet/chartsheet.py +107 -0
  156. package/python/vendor/openpyxl/chartsheet/custom.py +61 -0
  157. package/python/vendor/openpyxl/chartsheet/properties.py +28 -0
  158. package/python/vendor/openpyxl/chartsheet/protection.py +41 -0
  159. package/python/vendor/openpyxl/chartsheet/publish.py +58 -0
  160. package/python/vendor/openpyxl/chartsheet/relation.py +97 -0
  161. package/python/vendor/openpyxl/chartsheet/views.py +51 -0
  162. package/python/vendor/openpyxl/comments/__init__.py +4 -0
  163. package/python/vendor/openpyxl/comments/author.py +21 -0
  164. package/python/vendor/openpyxl/comments/comment_sheet.py +211 -0
  165. package/python/vendor/openpyxl/comments/comments.py +62 -0
  166. package/python/vendor/openpyxl/comments/shape_writer.py +112 -0
  167. package/python/vendor/openpyxl/compat/__init__.py +54 -0
  168. package/python/vendor/openpyxl/compat/abc.py +8 -0
  169. package/python/vendor/openpyxl/compat/numbers.py +43 -0
  170. package/python/vendor/openpyxl/compat/product.py +17 -0
  171. package/python/vendor/openpyxl/compat/singleton.py +40 -0
  172. package/python/vendor/openpyxl/compat/strings.py +25 -0
  173. package/python/vendor/openpyxl/descriptors/__init__.py +58 -0
  174. package/python/vendor/openpyxl/descriptors/base.py +272 -0
  175. package/python/vendor/openpyxl/descriptors/container.py +41 -0
  176. package/python/vendor/openpyxl/descriptors/excel.py +112 -0
  177. package/python/vendor/openpyxl/descriptors/namespace.py +12 -0
  178. package/python/vendor/openpyxl/descriptors/nested.py +129 -0
  179. package/python/vendor/openpyxl/descriptors/sequence.py +136 -0
  180. package/python/vendor/openpyxl/descriptors/serialisable.py +240 -0
  181. package/python/vendor/openpyxl/descriptors/slots.py +18 -0
  182. package/python/vendor/openpyxl/drawing/__init__.py +4 -0
  183. package/python/vendor/openpyxl/drawing/colors.py +435 -0
  184. package/python/vendor/openpyxl/drawing/connector.py +144 -0
  185. package/python/vendor/openpyxl/drawing/drawing.py +92 -0
  186. package/python/vendor/openpyxl/drawing/effect.py +407 -0
  187. package/python/vendor/openpyxl/drawing/fill.py +425 -0
  188. package/python/vendor/openpyxl/drawing/geometry.py +584 -0
  189. package/python/vendor/openpyxl/drawing/graphic.py +177 -0
  190. package/python/vendor/openpyxl/drawing/image.py +65 -0
  191. package/python/vendor/openpyxl/drawing/line.py +144 -0
  192. package/python/vendor/openpyxl/drawing/picture.py +144 -0
  193. package/python/vendor/openpyxl/drawing/properties.py +174 -0
  194. package/python/vendor/openpyxl/drawing/relation.py +17 -0
  195. package/python/vendor/openpyxl/drawing/spreadsheet_drawing.py +382 -0
  196. package/python/vendor/openpyxl/drawing/text.py +717 -0
  197. package/python/vendor/openpyxl/drawing/xdr.py +33 -0
  198. package/python/vendor/openpyxl/formatting/__init__.py +3 -0
  199. package/python/vendor/openpyxl/formatting/formatting.py +114 -0
  200. package/python/vendor/openpyxl/formatting/rule.py +291 -0
  201. package/python/vendor/openpyxl/formula/__init__.py +3 -0
  202. package/python/vendor/openpyxl/formula/tokenizer.py +446 -0
  203. package/python/vendor/openpyxl/formula/translate.py +166 -0
  204. package/python/vendor/openpyxl/packaging/__init__.py +3 -0
  205. package/python/vendor/openpyxl/packaging/core.py +115 -0
  206. package/python/vendor/openpyxl/packaging/custom.py +289 -0
  207. package/python/vendor/openpyxl/packaging/extended.py +137 -0
  208. package/python/vendor/openpyxl/packaging/interface.py +56 -0
  209. package/python/vendor/openpyxl/packaging/manifest.py +194 -0
  210. package/python/vendor/openpyxl/packaging/relationship.py +158 -0
  211. package/python/vendor/openpyxl/packaging/workbook.py +185 -0
  212. package/python/vendor/openpyxl/pivot/__init__.py +1 -0
  213. package/python/vendor/openpyxl/pivot/cache.py +965 -0
  214. package/python/vendor/openpyxl/pivot/fields.py +326 -0
  215. package/python/vendor/openpyxl/pivot/record.py +111 -0
  216. package/python/vendor/openpyxl/pivot/table.py +1261 -0
  217. package/python/vendor/openpyxl/reader/__init__.py +1 -0
  218. package/python/vendor/openpyxl/reader/drawings.py +71 -0
  219. package/python/vendor/openpyxl/reader/excel.py +349 -0
  220. package/python/vendor/openpyxl/reader/strings.py +44 -0
  221. package/python/vendor/openpyxl/reader/workbook.py +133 -0
  222. package/python/vendor/openpyxl/styles/__init__.py +11 -0
  223. package/python/vendor/openpyxl/styles/alignment.py +62 -0
  224. package/python/vendor/openpyxl/styles/borders.py +103 -0
  225. package/python/vendor/openpyxl/styles/builtins.py +1397 -0
  226. package/python/vendor/openpyxl/styles/cell_style.py +206 -0
  227. package/python/vendor/openpyxl/styles/colors.py +172 -0
  228. package/python/vendor/openpyxl/styles/differential.py +95 -0
  229. package/python/vendor/openpyxl/styles/fills.py +224 -0
  230. package/python/vendor/openpyxl/styles/fonts.py +113 -0
  231. package/python/vendor/openpyxl/styles/named_styles.py +282 -0
  232. package/python/vendor/openpyxl/styles/numbers.py +200 -0
  233. package/python/vendor/openpyxl/styles/protection.py +17 -0
  234. package/python/vendor/openpyxl/styles/proxy.py +62 -0
  235. package/python/vendor/openpyxl/styles/styleable.py +151 -0
  236. package/python/vendor/openpyxl/styles/stylesheet.py +274 -0
  237. package/python/vendor/openpyxl/styles/table.py +94 -0
  238. package/python/vendor/openpyxl/utils/__init__.py +17 -0
  239. package/python/vendor/openpyxl/utils/bound_dictionary.py +26 -0
  240. package/python/vendor/openpyxl/utils/cell.py +240 -0
  241. package/python/vendor/openpyxl/utils/dataframe.py +87 -0
  242. package/python/vendor/openpyxl/utils/datetime.py +140 -0
  243. package/python/vendor/openpyxl/utils/escape.py +43 -0
  244. package/python/vendor/openpyxl/utils/exceptions.py +34 -0
  245. package/python/vendor/openpyxl/utils/formulas.py +24 -0
  246. package/python/vendor/openpyxl/utils/indexed_list.py +49 -0
  247. package/python/vendor/openpyxl/utils/inference.py +60 -0
  248. package/python/vendor/openpyxl/utils/protection.py +22 -0
  249. package/python/vendor/openpyxl/utils/units.py +108 -0
  250. package/python/vendor/openpyxl/workbook/__init__.py +4 -0
  251. package/python/vendor/openpyxl/workbook/_writer.py +197 -0
  252. package/python/vendor/openpyxl/workbook/child.py +166 -0
  253. package/python/vendor/openpyxl/workbook/defined_name.py +189 -0
  254. package/python/vendor/openpyxl/workbook/external_link/__init__.py +3 -0
  255. package/python/vendor/openpyxl/workbook/external_link/external.py +190 -0
  256. package/python/vendor/openpyxl/workbook/external_reference.py +18 -0
  257. package/python/vendor/openpyxl/workbook/function_group.py +36 -0
  258. package/python/vendor/openpyxl/workbook/properties.py +151 -0
  259. package/python/vendor/openpyxl/workbook/protection.py +163 -0
  260. package/python/vendor/openpyxl/workbook/smart_tags.py +56 -0
  261. package/python/vendor/openpyxl/workbook/views.py +155 -0
  262. package/python/vendor/openpyxl/workbook/web.py +98 -0
  263. package/python/vendor/openpyxl/workbook/workbook.py +438 -0
  264. package/python/vendor/openpyxl/worksheet/__init__.py +1 -0
  265. package/python/vendor/openpyxl/worksheet/_read_only.py +190 -0
  266. package/python/vendor/openpyxl/worksheet/_reader.py +472 -0
  267. package/python/vendor/openpyxl/worksheet/_write_only.py +160 -0
  268. package/python/vendor/openpyxl/worksheet/_writer.py +390 -0
  269. package/python/vendor/openpyxl/worksheet/cell_range.py +512 -0
  270. package/python/vendor/openpyxl/worksheet/cell_watch.py +34 -0
  271. package/python/vendor/openpyxl/worksheet/controls.py +107 -0
  272. package/python/vendor/openpyxl/worksheet/copier.py +70 -0
  273. package/python/vendor/openpyxl/worksheet/custom.py +35 -0
  274. package/python/vendor/openpyxl/worksheet/datavalidation.py +202 -0
  275. package/python/vendor/openpyxl/worksheet/dimensions.py +306 -0
  276. package/python/vendor/openpyxl/worksheet/drawing.py +14 -0
  277. package/python/vendor/openpyxl/worksheet/errors.py +93 -0
  278. package/python/vendor/openpyxl/worksheet/filters.py +486 -0
  279. package/python/vendor/openpyxl/worksheet/formula.py +51 -0
  280. package/python/vendor/openpyxl/worksheet/header_footer.py +270 -0
  281. package/python/vendor/openpyxl/worksheet/hyperlink.py +46 -0
  282. package/python/vendor/openpyxl/worksheet/merge.py +141 -0
  283. package/python/vendor/openpyxl/worksheet/ole.py +133 -0
  284. package/python/vendor/openpyxl/worksheet/page.py +174 -0
  285. package/python/vendor/openpyxl/worksheet/pagebreak.py +94 -0
  286. package/python/vendor/openpyxl/worksheet/picture.py +8 -0
  287. package/python/vendor/openpyxl/worksheet/print_settings.py +184 -0
  288. package/python/vendor/openpyxl/worksheet/properties.py +97 -0
  289. package/python/vendor/openpyxl/worksheet/protection.py +120 -0
  290. package/python/vendor/openpyxl/worksheet/related.py +17 -0
  291. package/python/vendor/openpyxl/worksheet/scenario.py +105 -0
  292. package/python/vendor/openpyxl/worksheet/smart_tag.py +78 -0
  293. package/python/vendor/openpyxl/worksheet/table.py +385 -0
  294. package/python/vendor/openpyxl/worksheet/views.py +155 -0
  295. package/python/vendor/openpyxl/worksheet/worksheet.py +907 -0
  296. package/python/vendor/openpyxl/writer/__init__.py +1 -0
  297. package/python/vendor/openpyxl/writer/excel.py +295 -0
  298. package/python/vendor/openpyxl/writer/theme.py +291 -0
  299. package/python/vendor/openpyxl/xml/__init__.py +42 -0
  300. package/python/vendor/openpyxl/xml/constants.py +129 -0
  301. package/python/vendor/openpyxl/xml/functions.py +87 -0
  302. package/watchlist/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Typed,
6
+ Sequence,
7
+ String,
8
+ Float,
9
+ Integer,
10
+ Bool,
11
+ NoneSet,
12
+ Set,
13
+ )
14
+ from openpyxl.descriptors.excel import (
15
+ ExtensionList,
16
+ Guid,
17
+ )
18
+
19
+
20
+ class BookView(Serialisable):
21
+
22
+ tagname = "workbookView"
23
+
24
+ visibility = NoneSet(values=(['visible', 'hidden', 'veryHidden']))
25
+ minimized = Bool(allow_none=True)
26
+ showHorizontalScroll = Bool(allow_none=True)
27
+ showVerticalScroll = Bool(allow_none=True)
28
+ showSheetTabs = Bool(allow_none=True)
29
+ xWindow = Integer(allow_none=True)
30
+ yWindow = Integer(allow_none=True)
31
+ windowWidth = Integer(allow_none=True)
32
+ windowHeight = Integer(allow_none=True)
33
+ tabRatio = Integer(allow_none=True)
34
+ firstSheet = Integer(allow_none=True)
35
+ activeTab = Integer(allow_none=True)
36
+ autoFilterDateGrouping = Bool(allow_none=True)
37
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
38
+
39
+ __elements__ = ()
40
+
41
+ def __init__(self,
42
+ visibility="visible",
43
+ minimized=False,
44
+ showHorizontalScroll=True,
45
+ showVerticalScroll=True,
46
+ showSheetTabs=True,
47
+ xWindow=None,
48
+ yWindow=None,
49
+ windowWidth=None,
50
+ windowHeight=None,
51
+ tabRatio=600,
52
+ firstSheet=0,
53
+ activeTab=0,
54
+ autoFilterDateGrouping=True,
55
+ extLst=None,
56
+ ):
57
+ self.visibility = visibility
58
+ self.minimized = minimized
59
+ self.showHorizontalScroll = showHorizontalScroll
60
+ self.showVerticalScroll = showVerticalScroll
61
+ self.showSheetTabs = showSheetTabs
62
+ self.xWindow = xWindow
63
+ self.yWindow = yWindow
64
+ self.windowWidth = windowWidth
65
+ self.windowHeight = windowHeight
66
+ self.tabRatio = tabRatio
67
+ self.firstSheet = firstSheet
68
+ self.activeTab = activeTab
69
+ self.autoFilterDateGrouping = autoFilterDateGrouping
70
+
71
+
72
+ class CustomWorkbookView(Serialisable):
73
+
74
+ tagname = "customWorkbookView"
75
+
76
+ name = String()
77
+ guid = Guid()
78
+ autoUpdate = Bool(allow_none=True)
79
+ mergeInterval = Integer(allow_none=True)
80
+ changesSavedWin = Bool(allow_none=True)
81
+ onlySync = Bool(allow_none=True)
82
+ personalView = Bool(allow_none=True)
83
+ includePrintSettings = Bool(allow_none=True)
84
+ includeHiddenRowCol = Bool(allow_none=True)
85
+ maximized = Bool(allow_none=True)
86
+ minimized = Bool(allow_none=True)
87
+ showHorizontalScroll = Bool(allow_none=True)
88
+ showVerticalScroll = Bool(allow_none=True)
89
+ showSheetTabs = Bool(allow_none=True)
90
+ xWindow = Integer(allow_none=True)
91
+ yWindow = Integer(allow_none=True)
92
+ windowWidth = Integer()
93
+ windowHeight = Integer()
94
+ tabRatio = Integer(allow_none=True)
95
+ activeSheetId = Integer()
96
+ showFormulaBar = Bool(allow_none=True)
97
+ showStatusbar = Bool(allow_none=True)
98
+ showComments = NoneSet(values=(['commNone', 'commIndicator',
99
+ 'commIndAndComment']))
100
+ showObjects = NoneSet(values=(['all', 'placeholders']))
101
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
102
+
103
+ __elements__ = ()
104
+
105
+ def __init__(self,
106
+ name=None,
107
+ guid=None,
108
+ autoUpdate=None,
109
+ mergeInterval=None,
110
+ changesSavedWin=None,
111
+ onlySync=None,
112
+ personalView=None,
113
+ includePrintSettings=None,
114
+ includeHiddenRowCol=None,
115
+ maximized=None,
116
+ minimized=None,
117
+ showHorizontalScroll=None,
118
+ showVerticalScroll=None,
119
+ showSheetTabs=None,
120
+ xWindow=None,
121
+ yWindow=None,
122
+ windowWidth=None,
123
+ windowHeight=None,
124
+ tabRatio=None,
125
+ activeSheetId=None,
126
+ showFormulaBar=None,
127
+ showStatusbar=None,
128
+ showComments="commIndicator",
129
+ showObjects="all",
130
+ extLst=None,
131
+ ):
132
+ self.name = name
133
+ self.guid = guid
134
+ self.autoUpdate = autoUpdate
135
+ self.mergeInterval = mergeInterval
136
+ self.changesSavedWin = changesSavedWin
137
+ self.onlySync = onlySync
138
+ self.personalView = personalView
139
+ self.includePrintSettings = includePrintSettings
140
+ self.includeHiddenRowCol = includeHiddenRowCol
141
+ self.maximized = maximized
142
+ self.minimized = minimized
143
+ self.showHorizontalScroll = showHorizontalScroll
144
+ self.showVerticalScroll = showVerticalScroll
145
+ self.showSheetTabs = showSheetTabs
146
+ self.xWindow = xWindow
147
+ self.yWindow = yWindow
148
+ self.windowWidth = windowWidth
149
+ self.windowHeight = windowHeight
150
+ self.tabRatio = tabRatio
151
+ self.activeSheetId = activeSheetId
152
+ self.showFormulaBar = showFormulaBar
153
+ self.showStatusbar = showStatusbar
154
+ self.showComments = showComments
155
+ self.showObjects = showObjects
@@ -0,0 +1,98 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Typed,
6
+ Sequence,
7
+ String,
8
+ Float,
9
+ Integer,
10
+ Bool,
11
+ NoneSet,
12
+ )
13
+
14
+
15
+ class WebPublishObject(Serialisable):
16
+
17
+ tagname = "webPublishingObject"
18
+
19
+ id = Integer()
20
+ divId = String()
21
+ sourceObject = String(allow_none=True)
22
+ destinationFile = String()
23
+ title = String(allow_none=True)
24
+ autoRepublish = Bool(allow_none=True)
25
+
26
+ def __init__(self,
27
+ id=None,
28
+ divId=None,
29
+ sourceObject=None,
30
+ destinationFile=None,
31
+ title=None,
32
+ autoRepublish=None,
33
+ ):
34
+ self.id = id
35
+ self.divId = divId
36
+ self.sourceObject = sourceObject
37
+ self.destinationFile = destinationFile
38
+ self.title = title
39
+ self.autoRepublish = autoRepublish
40
+
41
+
42
+ class WebPublishObjectList(Serialisable):
43
+
44
+ tagname ="webPublishingObjects"
45
+
46
+ count = Integer(allow_none=True)
47
+ webPublishObject = Sequence(expected_type=WebPublishObject)
48
+
49
+ __elements__ = ('webPublishObject',)
50
+
51
+ def __init__(self,
52
+ count=None,
53
+ webPublishObject=(),
54
+ ):
55
+ self.webPublishObject = webPublishObject
56
+
57
+
58
+ @property
59
+ def count(self):
60
+ return len(self.webPublishObject)
61
+
62
+
63
+ class WebPublishing(Serialisable):
64
+
65
+ tagname = "webPublishing"
66
+
67
+ css = Bool(allow_none=True)
68
+ thicket = Bool(allow_none=True)
69
+ longFileNames = Bool(allow_none=True)
70
+ vml = Bool(allow_none=True)
71
+ allowPng = Bool(allow_none=True)
72
+ targetScreenSize = NoneSet(values=(['544x376', '640x480', '720x512', '800x600',
73
+ '1024x768', '1152x882', '1152x900', '1280x1024', '1600x1200',
74
+ '1800x1440', '1920x1200']))
75
+ dpi = Integer(allow_none=True)
76
+ codePage = Integer(allow_none=True)
77
+ characterSet = String(allow_none=True)
78
+
79
+ def __init__(self,
80
+ css=None,
81
+ thicket=None,
82
+ longFileNames=None,
83
+ vml=None,
84
+ allowPng=None,
85
+ targetScreenSize='800x600',
86
+ dpi=None,
87
+ codePage=None,
88
+ characterSet=None,
89
+ ):
90
+ self.css = css
91
+ self.thicket = thicket
92
+ self.longFileNames = longFileNames
93
+ self.vml = vml
94
+ self.allowPng = allowPng
95
+ self.targetScreenSize = targetScreenSize
96
+ self.dpi = dpi
97
+ self.codePage = codePage
98
+ self.characterSet = characterSet
@@ -0,0 +1,438 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ """Workbook is the top-level container for all document information."""
4
+ from copy import copy
5
+
6
+ from openpyxl.compat import deprecated
7
+ from openpyxl.worksheet.worksheet import Worksheet
8
+ from openpyxl.worksheet._read_only import ReadOnlyWorksheet
9
+ from openpyxl.worksheet._write_only import WriteOnlyWorksheet
10
+ from openpyxl.worksheet.copier import WorksheetCopy
11
+
12
+ from openpyxl.utils import quote_sheetname
13
+ from openpyxl.utils.indexed_list import IndexedList
14
+ from openpyxl.utils.datetime import WINDOWS_EPOCH, MAC_EPOCH
15
+ from openpyxl.utils.exceptions import ReadOnlyWorkbookException
16
+
17
+ from openpyxl.writer.excel import save_workbook
18
+
19
+ from openpyxl.styles.cell_style import StyleArray
20
+ from openpyxl.styles.named_styles import NamedStyle
21
+ from openpyxl.styles.differential import DifferentialStyleList
22
+ from openpyxl.styles.alignment import Alignment
23
+ from openpyxl.styles.borders import DEFAULT_BORDER
24
+ from openpyxl.styles.fills import DEFAULT_EMPTY_FILL, DEFAULT_GRAY_FILL
25
+ from openpyxl.styles.fonts import DEFAULT_FONT
26
+ from openpyxl.styles.protection import Protection
27
+ from openpyxl.styles.colors import COLOR_INDEX
28
+ from openpyxl.styles.named_styles import NamedStyleList
29
+ from openpyxl.styles.table import TableStyleList
30
+
31
+ from openpyxl.chartsheet import Chartsheet
32
+ from .defined_name import DefinedName, DefinedNameDict
33
+ from openpyxl.packaging.core import DocumentProperties
34
+ from openpyxl.packaging.custom import CustomPropertyList
35
+ from openpyxl.packaging.relationship import RelationshipList
36
+ from .child import _WorkbookChild
37
+ from .protection import DocumentSecurity
38
+ from .properties import CalcProperties
39
+ from .views import BookView
40
+
41
+
42
+ from openpyxl.xml.constants import (
43
+ XLSM,
44
+ XLSX,
45
+ XLTM,
46
+ XLTX
47
+ )
48
+
49
+ INTEGER_TYPES = (int,)
50
+
51
+ class Workbook:
52
+ """Workbook is the container for all other parts of the document."""
53
+
54
+ _read_only = False
55
+ _data_only = False
56
+ template = False
57
+ path = "/xl/workbook.xml"
58
+
59
+ def __init__(self,
60
+ write_only=False,
61
+ iso_dates=False,
62
+ ):
63
+ self._sheets = []
64
+ self._pivots = []
65
+ self._active_sheet_index = 0
66
+ self.defined_names = DefinedNameDict()
67
+ self._external_links = []
68
+ self.properties = DocumentProperties()
69
+ self.custom_doc_props = CustomPropertyList()
70
+ self.security = DocumentSecurity()
71
+ self.__write_only = write_only
72
+ self.shared_strings = IndexedList()
73
+
74
+ self._setup_styles()
75
+
76
+ self.loaded_theme = None
77
+ self.vba_archive = None
78
+ self.is_template = False
79
+ self.code_name = None
80
+ self.epoch = WINDOWS_EPOCH
81
+ self.encoding = "utf-8"
82
+ self.iso_dates = iso_dates
83
+
84
+ if not self.write_only:
85
+ self._sheets.append(Worksheet(self))
86
+
87
+ self.rels = RelationshipList()
88
+ self.calculation = CalcProperties()
89
+ self.views = [BookView()]
90
+
91
+
92
+ def _setup_styles(self):
93
+ """Bootstrap styles"""
94
+
95
+ self._fonts = IndexedList()
96
+ self._fonts.add(DEFAULT_FONT)
97
+
98
+ self._alignments = IndexedList([Alignment()])
99
+
100
+ self._borders = IndexedList()
101
+ self._borders.add(DEFAULT_BORDER)
102
+
103
+ self._fills = IndexedList()
104
+ self._fills.add(DEFAULT_EMPTY_FILL)
105
+ self._fills.add(DEFAULT_GRAY_FILL)
106
+
107
+ self._number_formats = IndexedList()
108
+ self._date_formats = {}
109
+ self._timedelta_formats = {}
110
+
111
+ self._protections = IndexedList([Protection()])
112
+
113
+ self._colors = COLOR_INDEX
114
+ self._cell_styles = IndexedList([StyleArray()])
115
+ self._named_styles = NamedStyleList()
116
+ self.add_named_style(NamedStyle(font=copy(DEFAULT_FONT), border=copy(DEFAULT_BORDER), builtinId=0))
117
+ self._table_styles = TableStyleList()
118
+ self._differential_styles = DifferentialStyleList()
119
+
120
+
121
+ @property
122
+ def epoch(self):
123
+ if self._epoch == WINDOWS_EPOCH:
124
+ return WINDOWS_EPOCH
125
+ return MAC_EPOCH
126
+
127
+
128
+ @epoch.setter
129
+ def epoch(self, value):
130
+ if value not in (WINDOWS_EPOCH, MAC_EPOCH):
131
+ raise ValueError("The epoch must be either 1900 or 1904")
132
+ self._epoch = value
133
+
134
+
135
+ @property
136
+ def read_only(self):
137
+ return self._read_only
138
+
139
+ @property
140
+ def data_only(self):
141
+ return self._data_only
142
+
143
+ @property
144
+ def write_only(self):
145
+ return self.__write_only
146
+
147
+
148
+ @property
149
+ def excel_base_date(self):
150
+ return self.epoch
151
+
152
+ @property
153
+ def active(self):
154
+ """Get the currently active sheet or None
155
+
156
+ :type: :class:`openpyxl.worksheet.worksheet.Worksheet`
157
+ """
158
+ try:
159
+ return self._sheets[self._active_sheet_index]
160
+ except IndexError:
161
+ pass
162
+
163
+ @active.setter
164
+ def active(self, value):
165
+ """Set the active sheet"""
166
+ if not isinstance(value, (_WorkbookChild, INTEGER_TYPES)):
167
+ raise TypeError("Value must be either a worksheet, chartsheet or numerical index")
168
+ if isinstance(value, INTEGER_TYPES):
169
+ self._active_sheet_index = value
170
+ return
171
+ #if self._sheets and 0 <= value < len(self._sheets):
172
+ #value = self._sheets[value]
173
+ #else:
174
+ #raise ValueError("Sheet index is outside the range of possible values", value)
175
+ if value not in self._sheets:
176
+ raise ValueError("Worksheet is not in the workbook")
177
+ if value.sheet_state != "visible":
178
+ raise ValueError("Only visible sheets can be made active")
179
+
180
+ idx = self._sheets.index(value)
181
+ self._active_sheet_index = idx
182
+
183
+
184
+ def create_sheet(self, title=None, index=None):
185
+ """Create a worksheet (at an optional index).
186
+
187
+ :param title: optional title of the sheet
188
+ :type title: str
189
+ :param index: optional position at which the sheet will be inserted
190
+ :type index: int
191
+
192
+ """
193
+ if self.read_only:
194
+ raise ReadOnlyWorkbookException('Cannot create new sheet in a read-only workbook')
195
+
196
+ if self.write_only :
197
+ new_ws = WriteOnlyWorksheet(parent=self, title=title)
198
+ else:
199
+ new_ws = Worksheet(parent=self, title=title)
200
+
201
+ self._add_sheet(sheet=new_ws, index=index)
202
+ return new_ws
203
+
204
+
205
+ def _add_sheet(self, sheet, index=None):
206
+ """Add an worksheet (at an optional index)."""
207
+
208
+ if not isinstance(sheet, (Worksheet, WriteOnlyWorksheet, Chartsheet)):
209
+ raise TypeError("Cannot be added to a workbook")
210
+
211
+ if sheet.parent != self:
212
+ raise ValueError("You cannot add worksheets from another workbook.")
213
+
214
+ if index is None:
215
+ self._sheets.append(sheet)
216
+ else:
217
+ self._sheets.insert(index, sheet)
218
+
219
+
220
+ def move_sheet(self, sheet, offset=0):
221
+ """
222
+ Move a sheet or sheetname
223
+ """
224
+ if not isinstance(sheet, Worksheet):
225
+ sheet = self[sheet]
226
+ idx = self._sheets.index(sheet)
227
+ del self._sheets[idx]
228
+ new_pos = idx + offset
229
+ self._sheets.insert(new_pos, sheet)
230
+
231
+
232
+ def remove(self, worksheet):
233
+ """Remove `worksheet` from this workbook."""
234
+ idx = self._sheets.index(worksheet)
235
+ self._sheets.remove(worksheet)
236
+
237
+
238
+ @deprecated("Use wb.remove(worksheet) or del wb[sheetname]")
239
+ def remove_sheet(self, worksheet):
240
+ """Remove `worksheet` from this workbook."""
241
+ self.remove(worksheet)
242
+
243
+
244
+ def create_chartsheet(self, title=None, index=None):
245
+ if self.read_only:
246
+ raise ReadOnlyWorkbookException("Cannot create new sheet in a read-only workbook")
247
+ cs = Chartsheet(parent=self, title=title)
248
+
249
+ self._add_sheet(cs, index)
250
+ return cs
251
+
252
+
253
+ @deprecated("Use wb[sheetname]")
254
+ def get_sheet_by_name(self, name):
255
+ """Returns a worksheet by its name.
256
+
257
+ :param name: the name of the worksheet to look for
258
+ :type name: string
259
+
260
+ """
261
+ return self[name]
262
+
263
+ def __contains__(self, key):
264
+ return key in self.sheetnames
265
+
266
+
267
+ def index(self, worksheet):
268
+ """Return the index of a worksheet."""
269
+ return self.worksheets.index(worksheet)
270
+
271
+
272
+ @deprecated("Use wb.index(worksheet)")
273
+ def get_index(self, worksheet):
274
+ """Return the index of the worksheet."""
275
+ return self.index(worksheet)
276
+
277
+ def __getitem__(self, key):
278
+ """Returns a worksheet by its name.
279
+
280
+ :param name: the name of the worksheet to look for
281
+ :type name: string
282
+
283
+ """
284
+ for sheet in self.worksheets + self.chartsheets:
285
+ if sheet.title == key:
286
+ return sheet
287
+ raise KeyError("Worksheet {0} does not exist.".format(key))
288
+
289
+ def __delitem__(self, key):
290
+ sheet = self[key]
291
+ self.remove(sheet)
292
+
293
+ def __iter__(self):
294
+ return iter(self.worksheets)
295
+
296
+
297
+ @deprecated("Use wb.sheetnames")
298
+ def get_sheet_names(self):
299
+ return self.sheetnames
300
+
301
+ @property
302
+ def worksheets(self):
303
+ """A list of sheets in this workbook
304
+
305
+ :type: list of :class:`openpyxl.worksheet.worksheet.Worksheet`
306
+ """
307
+ return [s for s in self._sheets if isinstance(s, (Worksheet, ReadOnlyWorksheet, WriteOnlyWorksheet))]
308
+
309
+ @property
310
+ def chartsheets(self):
311
+ """A list of Chartsheets in this workbook
312
+
313
+ :type: list of :class:`openpyxl.chartsheet.chartsheet.Chartsheet`
314
+ """
315
+ return [s for s in self._sheets if isinstance(s, Chartsheet)]
316
+
317
+ @property
318
+ def sheetnames(self):
319
+ """Returns the list of the names of worksheets in this workbook.
320
+
321
+ Names are returned in the worksheets order.
322
+
323
+ :type: list of strings
324
+
325
+ """
326
+ return [s.title for s in self._sheets]
327
+
328
+
329
+ @deprecated("Assign scoped named ranges directly to worksheets or global ones to the workbook. Deprecated in 3.1")
330
+ def create_named_range(self, name, worksheet=None, value=None, scope=None):
331
+ """Create a new named_range on a worksheet
332
+
333
+ """
334
+ defn = DefinedName(name=name)
335
+ if worksheet is not None:
336
+ defn.value = "{0}!{1}".format(quote_sheetname(worksheet.title), value)
337
+ else:
338
+ defn.value = value
339
+
340
+ self.defined_names[name] = defn
341
+
342
+
343
+ def add_named_style(self, style):
344
+ """
345
+ Add a named style
346
+ """
347
+ self._named_styles.append(style)
348
+ style.bind(self)
349
+
350
+
351
+ @property
352
+ def named_styles(self):
353
+ """
354
+ List available named styles
355
+ """
356
+ return self._named_styles.names
357
+
358
+
359
+ @property
360
+ def mime_type(self):
361
+ """
362
+ The mime type is determined by whether a workbook is a template or
363
+ not and whether it contains macros or not. Excel requires the file
364
+ extension to match but openpyxl does not enforce this.
365
+
366
+ """
367
+ ct = self.template and XLTX or XLSX
368
+ if self.vba_archive:
369
+ ct = self.template and XLTM or XLSM
370
+ return ct
371
+
372
+
373
+ def save(self, filename):
374
+ """Save the current workbook under the given `filename`.
375
+ Use this function instead of using an `ExcelWriter`.
376
+
377
+ .. warning::
378
+ When creating your workbook using `write_only` set to True,
379
+ you will only be able to call this function once. Subsequent attempts to
380
+ modify or save the file will raise an :class:`openpyxl.shared.exc.WorkbookAlreadySaved` exception.
381
+ """
382
+ if self.read_only:
383
+ raise TypeError("""Workbook is read-only""")
384
+ if self.write_only and not self.worksheets:
385
+ self.create_sheet()
386
+ save_workbook(self, filename)
387
+
388
+
389
+ @property
390
+ def style_names(self):
391
+ """
392
+ List of named styles
393
+ """
394
+ return [s.name for s in self._named_styles]
395
+
396
+
397
+ def copy_worksheet(self, from_worksheet):
398
+ """Copy an existing worksheet in the current workbook
399
+
400
+ .. warning::
401
+ This function cannot copy worksheets between workbooks.
402
+ worksheets can only be copied within the workbook that they belong
403
+
404
+ :param from_worksheet: the worksheet to be copied from
405
+ :return: copy of the initial worksheet
406
+ """
407
+ if self.__write_only or self._read_only:
408
+ raise ValueError("Cannot copy worksheets in read-only or write-only mode")
409
+
410
+ new_title = u"{0} Copy".format(from_worksheet.title)
411
+ to_worksheet = self.create_sheet(title=new_title)
412
+ cp = WorksheetCopy(source_worksheet=from_worksheet, target_worksheet=to_worksheet)
413
+ cp.copy_worksheet()
414
+ return to_worksheet
415
+
416
+
417
+ def close(self):
418
+ """
419
+ Close workbook file if open. Only affects read-only and write-only modes.
420
+ """
421
+ if hasattr(self, '_archive'):
422
+ self._archive.close()
423
+
424
+
425
+ def _duplicate_name(self, name):
426
+ """
427
+ Check for duplicate name in defined name list and table list of each worksheet.
428
+ Names are not case sensitive.
429
+ """
430
+ name = name.lower()
431
+ for sheet in self.worksheets:
432
+ for t in sheet.tables:
433
+ if name == t.lower():
434
+ return True
435
+
436
+ if name in self.defined_names:
437
+ return True
438
+
@@ -0,0 +1 @@
1
+ # Copyright (c) 2010-2024 openpyxl