@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,136 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.cell import Cell
4
+ from openpyxl.utils import get_column_letter
5
+ from openpyxl.utils.datetime import from_excel
6
+ from openpyxl.styles import is_date_format
7
+ from openpyxl.styles.numbers import BUILTIN_FORMATS, BUILTIN_FORMATS_MAX_SIZE
8
+
9
+
10
+ class ReadOnlyCell:
11
+
12
+ __slots__ = ('parent', 'row', 'column', '_value', 'data_type', '_style_id')
13
+
14
+ def __init__(self, sheet, row, column, value, data_type='n', style_id=0):
15
+ self.parent = sheet
16
+ self._value = None
17
+ self.row = row
18
+ self.column = column
19
+ self.data_type = data_type
20
+ self.value = value
21
+ self._style_id = style_id
22
+
23
+
24
+ def __eq__(self, other):
25
+ for a in self.__slots__:
26
+ if getattr(self, a) != getattr(other, a):
27
+ return
28
+ return True
29
+
30
+ def __ne__(self, other):
31
+ return not self.__eq__(other)
32
+
33
+
34
+ def __repr__(self):
35
+ return "<ReadOnlyCell {0!r}.{1}>".format(self.parent.title, self.coordinate)
36
+
37
+
38
+ @property
39
+ def coordinate(self):
40
+ column = get_column_letter(self.column)
41
+ return "{1}{0}".format(self.row, column)
42
+
43
+
44
+ @property
45
+ def coordinate(self):
46
+ return Cell.coordinate.__get__(self)
47
+
48
+
49
+ @property
50
+ def column_letter(self):
51
+ return Cell.column_letter.__get__(self)
52
+
53
+
54
+ @property
55
+ def style_array(self):
56
+ return self.parent.parent._cell_styles[self._style_id]
57
+
58
+
59
+ @property
60
+ def has_style(self):
61
+ return self._style_id != 0
62
+
63
+
64
+ @property
65
+ def number_format(self):
66
+ _id = self.style_array.numFmtId
67
+ if _id < BUILTIN_FORMATS_MAX_SIZE:
68
+ return BUILTIN_FORMATS.get(_id, "General")
69
+ else:
70
+ return self.parent.parent._number_formats[
71
+ _id - BUILTIN_FORMATS_MAX_SIZE]
72
+
73
+ @property
74
+ def font(self):
75
+ _id = self.style_array.fontId
76
+ return self.parent.parent._fonts[_id]
77
+
78
+ @property
79
+ def fill(self):
80
+ _id = self.style_array.fillId
81
+ return self.parent.parent._fills[_id]
82
+
83
+ @property
84
+ def border(self):
85
+ _id = self.style_array.borderId
86
+ return self.parent.parent._borders[_id]
87
+
88
+ @property
89
+ def alignment(self):
90
+ _id = self.style_array.alignmentId
91
+ return self.parent.parent._alignments[_id]
92
+
93
+ @property
94
+ def protection(self):
95
+ _id = self.style_array.protectionId
96
+ return self.parent.parent._protections[_id]
97
+
98
+
99
+ @property
100
+ def is_date(self):
101
+ return Cell.is_date.__get__(self)
102
+
103
+
104
+ @property
105
+ def internal_value(self):
106
+ return self._value
107
+
108
+ @property
109
+ def value(self):
110
+ return self._value
111
+
112
+ @value.setter
113
+ def value(self, value):
114
+ if self._value is not None:
115
+ raise AttributeError("Cell is read only")
116
+ self._value = value
117
+
118
+
119
+ class EmptyCell:
120
+
121
+ __slots__ = ()
122
+
123
+ value = None
124
+ is_date = False
125
+ font = None
126
+ border = None
127
+ fill = None
128
+ number_format = None
129
+ alignment = None
130
+ data_type = 'n'
131
+
132
+
133
+ def __repr__(self):
134
+ return "<EmptyCell>"
135
+
136
+ EMPTY_CELL = EmptyCell()
@@ -0,0 +1,202 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ """
4
+ RichText definition
5
+ """
6
+ from copy import copy
7
+ from openpyxl.compat import NUMERIC_TYPES
8
+ from openpyxl.cell.text import InlineFont, Text
9
+ from openpyxl.descriptors import (
10
+ Strict,
11
+ String,
12
+ Typed
13
+ )
14
+
15
+ from openpyxl.xml.functions import Element, whitespace
16
+
17
+ class TextBlock(Strict):
18
+ """ Represents text string in a specific format
19
+
20
+ This class is used as part of constructing a rich text strings.
21
+ """
22
+ font = Typed(expected_type=InlineFont)
23
+ text = String()
24
+
25
+ def __init__(self, font, text):
26
+ self.font = font
27
+ self.text = text
28
+
29
+
30
+ def __eq__(self, other):
31
+ return self.text == other.text and self.font == other.font
32
+
33
+
34
+ def __str__(self):
35
+ """Just retun the text"""
36
+ return self.text
37
+
38
+
39
+ def __repr__(self):
40
+ font = self.font != InlineFont() and self.font or "default"
41
+ return f"{self.__class__.__name__} text={self.text}, font={font}"
42
+
43
+
44
+ def to_tree(self):
45
+ el = Element("r")
46
+ el.append(self.font.to_tree(tagname="rPr"))
47
+ t = Element("t")
48
+ t.text = self.text
49
+ whitespace(t)
50
+ el.append(t)
51
+ return el
52
+
53
+ #
54
+ # Rich Text class.
55
+ # This class behaves just like a list whose members are either simple strings, or TextBlock() instances.
56
+ # In addition, it can be initialized in several ways:
57
+ # t = CellRFichText([...]) # initialize with a list.
58
+ # t = CellRFichText((...)) # initialize with a tuple.
59
+ # t = CellRichText(node) # where node is an Element() from either lxml or xml.etree (has a 'tag' element)
60
+ class CellRichText(list):
61
+ """Represents a rich text string.
62
+
63
+ Initialize with a list made of pure strings or :class:`TextBlock` elements
64
+ Can index object to access or modify individual rich text elements
65
+ it also supports the + and += operators between rich text strings
66
+ There are no user methods for this class
67
+
68
+ operations which modify the string will generally call an optimization pass afterwards,
69
+ that merges text blocks with identical formats, consecutive pure text strings,
70
+ and remove empty strings and empty text blocks
71
+ """
72
+
73
+ def __init__(self, *args):
74
+ if len(args) == 1:
75
+ args = args[0]
76
+ if isinstance(args, (list, tuple)):
77
+ CellRichText._check_rich_text(args)
78
+ else:
79
+ CellRichText._check_element(args)
80
+ args = [args]
81
+ else:
82
+ CellRichText._check_rich_text(args)
83
+ super().__init__(args)
84
+
85
+
86
+ @classmethod
87
+ def _check_element(cls, value):
88
+ if not isinstance(value, (str, TextBlock, NUMERIC_TYPES)):
89
+ raise TypeError(f"Illegal CellRichText element {value}")
90
+
91
+
92
+ @classmethod
93
+ def _check_rich_text(cls, rich_text):
94
+ for t in rich_text:
95
+ CellRichText._check_element(t)
96
+
97
+ @classmethod
98
+ def from_tree(cls, node):
99
+ text = Text.from_tree(node)
100
+ if text.t:
101
+ return (text.t.replace('x005F_', ''),)
102
+ s = []
103
+ for r in text.r:
104
+ t = ""
105
+ if r.t:
106
+ t = r.t.replace('x005F_', '')
107
+ if r.rPr:
108
+ s.append(TextBlock(r.rPr, t))
109
+ else:
110
+ s.append(t)
111
+ return cls(s)
112
+
113
+ # Merge TextBlocks with identical formatting
114
+ # remove empty elements
115
+ def _opt(self):
116
+ last_t = None
117
+ l = CellRichText(tuple())
118
+ for t in self:
119
+ if isinstance(t, str):
120
+ if not t:
121
+ continue
122
+ elif not t.text:
123
+ continue
124
+ if type(last_t) == type(t):
125
+ if isinstance(t, str):
126
+ last_t += t
127
+ continue
128
+ elif last_t.font == t.font:
129
+ last_t.text += t.text
130
+ continue
131
+ if last_t:
132
+ l.append(last_t)
133
+ last_t = t
134
+ if last_t:
135
+ # Add remaining TextBlock at end of rich text
136
+ l.append(last_t)
137
+ super().__setitem__(slice(None), l)
138
+ return self
139
+
140
+
141
+ def __iadd__(self, arg):
142
+ # copy used here to create new TextBlock() so we don't modify the right hand side in _opt()
143
+ CellRichText._check_rich_text(arg)
144
+ super().__iadd__([copy(e) for e in list(arg)])
145
+ return self._opt()
146
+
147
+
148
+ def __add__(self, arg):
149
+ return CellRichText([copy(e) for e in list(self) + list(arg)])._opt()
150
+
151
+
152
+ def __setitem__(self, indx, val):
153
+ CellRichText._check_element(val)
154
+ super().__setitem__(indx, val)
155
+ self._opt()
156
+
157
+
158
+ def append(self, arg):
159
+ CellRichText._check_element(arg)
160
+ super().append(arg)
161
+
162
+
163
+ def extend(self, arg):
164
+ CellRichText._check_rich_text(arg)
165
+ super().extend(arg)
166
+
167
+
168
+ def __repr__(self):
169
+ return "CellRichText([{}])".format(', '.join((repr(s) for s in self)))
170
+
171
+
172
+ def __str__(self):
173
+ return ''.join([str(s) for s in self])
174
+
175
+
176
+ def as_list(self):
177
+ """
178
+ Returns a list of the strings contained.
179
+ The main reason for this is to make editing easier.
180
+ """
181
+ return [str(s) for s in self]
182
+
183
+
184
+ def to_tree(self):
185
+ """
186
+ Return the full XML representation
187
+ """
188
+ container = Element("is")
189
+ for obj in self:
190
+ if isinstance(obj, TextBlock):
191
+ container.append(obj.to_tree())
192
+
193
+ else:
194
+ el = Element("r")
195
+ t = Element("t")
196
+ t.text = obj
197
+ whitespace(t)
198
+ el.append(t)
199
+ container.append(el)
200
+
201
+ return container
202
+
@@ -0,0 +1,184 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ """
4
+ Richtext definition
5
+ """
6
+
7
+ from openpyxl.descriptors.serialisable import Serialisable
8
+ from openpyxl.descriptors import (
9
+ Alias,
10
+ Typed,
11
+ Integer,
12
+ Set,
13
+ NoneSet,
14
+ Bool,
15
+ String,
16
+ Sequence,
17
+ )
18
+ from openpyxl.descriptors.nested import (
19
+ NestedBool,
20
+ NestedInteger,
21
+ NestedString,
22
+ NestedText,
23
+ )
24
+ from openpyxl.styles.fonts import Font
25
+
26
+
27
+ class PhoneticProperties(Serialisable):
28
+
29
+ tagname = "phoneticPr"
30
+
31
+ fontId = Integer()
32
+ type = NoneSet(values=(['halfwidthKatakana', 'fullwidthKatakana',
33
+ 'Hiragana', 'noConversion']))
34
+ alignment = NoneSet(values=(['noControl', 'left', 'center', 'distributed']))
35
+
36
+ def __init__(self,
37
+ fontId=None,
38
+ type=None,
39
+ alignment=None,
40
+ ):
41
+ self.fontId = fontId
42
+ self.type = type
43
+ self.alignment = alignment
44
+
45
+
46
+ class PhoneticText(Serialisable):
47
+
48
+ tagname = "rPh"
49
+
50
+ sb = Integer()
51
+ eb = Integer()
52
+ t = NestedText(expected_type=str)
53
+ text = Alias('t')
54
+
55
+ def __init__(self,
56
+ sb=None,
57
+ eb=None,
58
+ t=None,
59
+ ):
60
+ self.sb = sb
61
+ self.eb = eb
62
+ self.t = t
63
+
64
+
65
+ class InlineFont(Font):
66
+
67
+ """
68
+ Font for inline text because, yes what you need are different objects with the same elements but different constraints.
69
+ """
70
+
71
+ tagname = "RPrElt"
72
+
73
+ rFont = NestedString(allow_none=True)
74
+ charset = Font.charset
75
+ family = Font.family
76
+ b =Font.b
77
+ i = Font.i
78
+ strike = Font.strike
79
+ outline = Font.outline
80
+ shadow = Font.shadow
81
+ condense = Font.condense
82
+ extend = Font.extend
83
+ color = Font.color
84
+ sz = Font.sz
85
+ u = Font.u
86
+ vertAlign = Font.vertAlign
87
+ scheme = Font.scheme
88
+
89
+ __elements__ = ('rFont', 'charset', 'family', 'b', 'i', 'strike',
90
+ 'outline', 'shadow', 'condense', 'extend', 'color', 'sz', 'u',
91
+ 'vertAlign', 'scheme')
92
+
93
+ def __init__(self,
94
+ rFont=None,
95
+ charset=None,
96
+ family=None,
97
+ b=None,
98
+ i=None,
99
+ strike=None,
100
+ outline=None,
101
+ shadow=None,
102
+ condense=None,
103
+ extend=None,
104
+ color=None,
105
+ sz=None,
106
+ u=None,
107
+ vertAlign=None,
108
+ scheme=None,
109
+ ):
110
+ self.rFont = rFont
111
+ self.charset = charset
112
+ self.family = family
113
+ self.b = b
114
+ self.i = i
115
+ self.strike = strike
116
+ self.outline = outline
117
+ self.shadow = shadow
118
+ self.condense = condense
119
+ self.extend = extend
120
+ self.color = color
121
+ self.sz = sz
122
+ self.u = u
123
+ self.vertAlign = vertAlign
124
+ self.scheme = scheme
125
+
126
+
127
+ class RichText(Serialisable):
128
+
129
+ tagname = "RElt"
130
+
131
+ rPr = Typed(expected_type=InlineFont, allow_none=True)
132
+ font = Alias("rPr")
133
+ t = NestedText(expected_type=str, allow_none=True)
134
+ text = Alias("t")
135
+
136
+ __elements__ = ('rPr', 't')
137
+
138
+ def __init__(self,
139
+ rPr=None,
140
+ t=None,
141
+ ):
142
+ self.rPr = rPr
143
+ self.t = t
144
+
145
+
146
+ class Text(Serialisable):
147
+
148
+ tagname = "text"
149
+
150
+ t = NestedText(allow_none=True, expected_type=str)
151
+ plain = Alias("t")
152
+ r = Sequence(expected_type=RichText, allow_none=True)
153
+ formatted = Alias("r")
154
+ rPh = Sequence(expected_type=PhoneticText, allow_none=True)
155
+ phonetic = Alias("rPh")
156
+ phoneticPr = Typed(expected_type=PhoneticProperties, allow_none=True)
157
+ PhoneticProperties = Alias("phoneticPr")
158
+
159
+ __elements__ = ('t', 'r', 'rPh', 'phoneticPr')
160
+
161
+ def __init__(self,
162
+ t=None,
163
+ r=(),
164
+ rPh=(),
165
+ phoneticPr=None,
166
+ ):
167
+ self.t = t
168
+ self.r = r
169
+ self.rPh = rPh
170
+ self.phoneticPr = phoneticPr
171
+
172
+
173
+ @property
174
+ def content(self):
175
+ """
176
+ Text stripped of all formatting
177
+ """
178
+ snippets = []
179
+ if self.plain is not None:
180
+ snippets.append(self.plain)
181
+ for block in self.formatted:
182
+ if block.t is not None:
183
+ snippets.append(block.t)
184
+ return u"".join(snippets)
@@ -0,0 +1,105 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors import Typed, Alias
4
+ from openpyxl.descriptors.serialisable import Serialisable
5
+ from openpyxl.descriptors.nested import (
6
+ NestedBool,
7
+ NestedInteger,
8
+ NestedMinMax,
9
+ )
10
+ from openpyxl.descriptors.excel import ExtensionList
11
+ from .marker import PictureOptions
12
+ from .shapes import GraphicalProperties
13
+
14
+
15
+ class View3D(Serialisable):
16
+
17
+ tagname = "view3D"
18
+
19
+ rotX = NestedMinMax(min=-90, max=90, allow_none=True)
20
+ x_rotation = Alias('rotX')
21
+ hPercent = NestedMinMax(min=5, max=500, allow_none=True)
22
+ height_percent = Alias('hPercent')
23
+ rotY = NestedInteger(min=-90, max=90, allow_none=True)
24
+ y_rotation = Alias('rotY')
25
+ depthPercent = NestedInteger(allow_none=True)
26
+ rAngAx = NestedBool(allow_none=True)
27
+ right_angle_axes = Alias('rAngAx')
28
+ perspective = NestedInteger(allow_none=True)
29
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
30
+
31
+ __elements__ = ('rotX', 'hPercent', 'rotY', 'depthPercent', 'rAngAx',
32
+ 'perspective',)
33
+
34
+ def __init__(self,
35
+ rotX=15,
36
+ hPercent=None,
37
+ rotY=20,
38
+ depthPercent=None,
39
+ rAngAx=True,
40
+ perspective=None,
41
+ extLst=None,
42
+ ):
43
+ self.rotX = rotX
44
+ self.hPercent = hPercent
45
+ self.rotY = rotY
46
+ self.depthPercent = depthPercent
47
+ self.rAngAx = rAngAx
48
+ self.perspective = perspective
49
+
50
+
51
+ class Surface(Serialisable):
52
+
53
+ tagname = "surface"
54
+
55
+ thickness = NestedInteger(allow_none=True)
56
+ spPr = Typed(expected_type=GraphicalProperties, allow_none=True)
57
+ graphicalProperties = Alias('spPr')
58
+ pictureOptions = Typed(expected_type=PictureOptions, allow_none=True)
59
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
60
+
61
+ __elements__ = ('thickness', 'spPr', 'pictureOptions',)
62
+
63
+ def __init__(self,
64
+ thickness=None,
65
+ spPr=None,
66
+ pictureOptions=None,
67
+ extLst=None,
68
+ ):
69
+ self.thickness = thickness
70
+ self.spPr = spPr
71
+ self.pictureOptions = pictureOptions
72
+
73
+
74
+ class _3DBase(Serialisable):
75
+
76
+ """
77
+ Base class for 3D charts
78
+ """
79
+
80
+ tagname = "ChartBase"
81
+
82
+ view3D = Typed(expected_type=View3D, allow_none=True)
83
+ floor = Typed(expected_type=Surface, allow_none=True)
84
+ sideWall = Typed(expected_type=Surface, allow_none=True)
85
+ backWall = Typed(expected_type=Surface, allow_none=True)
86
+
87
+ def __init__(self,
88
+ view3D=None,
89
+ floor=None,
90
+ sideWall=None,
91
+ backWall=None,
92
+ ):
93
+ if view3D is None:
94
+ view3D = View3D()
95
+ self.view3D = view3D
96
+ if floor is None:
97
+ floor = Surface()
98
+ self.floor = floor
99
+ if sideWall is None:
100
+ sideWall = Surface()
101
+ self.sideWall = sideWall
102
+ if backWall is None:
103
+ backWall = Surface()
104
+ self.backWall = backWall
105
+ super(_3DBase, self).__init__()
@@ -0,0 +1,19 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from .area_chart import AreaChart, AreaChart3D
4
+ from .bar_chart import BarChart, BarChart3D
5
+ from .bubble_chart import BubbleChart
6
+ from .line_chart import LineChart, LineChart3D
7
+ from .pie_chart import (
8
+ PieChart,
9
+ PieChart3D,
10
+ DoughnutChart,
11
+ ProjectedPieChart
12
+ )
13
+ from .radar_chart import RadarChart
14
+ from .scatter_chart import ScatterChart
15
+ from .stock_chart import StockChart
16
+ from .surface_chart import SurfaceChart, SurfaceChart3D
17
+
18
+ from .series_factory import SeriesFactory as Series
19
+ from .reference import Reference