@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,240 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from copy import copy
4
+ from keyword import kwlist
5
+ KEYWORDS = frozenset(kwlist)
6
+
7
+ from . import Descriptor
8
+ from . import MetaSerialisable
9
+ from .sequence import (
10
+ Sequence,
11
+ NestedSequence,
12
+ MultiSequencePart,
13
+ )
14
+ from .namespace import namespaced
15
+
16
+ from openpyxl.compat import safe_string
17
+ from openpyxl.xml.functions import (
18
+ Element,
19
+ localname,
20
+ )
21
+
22
+ seq_types = (list, tuple)
23
+
24
+ class Serialisable(metaclass=MetaSerialisable):
25
+ """
26
+ Objects can serialise to XML their attributes and child objects.
27
+ The following class attributes are created by the metaclass at runtime:
28
+ __attrs__ = attributes
29
+ __nested__ = single-valued child treated as an attribute
30
+ __elements__ = child elements
31
+ """
32
+
33
+ __attrs__ = None
34
+ __nested__ = None
35
+ __elements__ = None
36
+ __namespaced__ = None
37
+
38
+ idx_base = 0
39
+
40
+ @property
41
+ def tagname(self):
42
+ raise(NotImplementedError)
43
+
44
+ namespace = None
45
+
46
+ @classmethod
47
+ def from_tree(cls, node):
48
+ """
49
+ Create object from XML
50
+ """
51
+ # strip known namespaces from attributes
52
+ attrib = dict(node.attrib)
53
+ for key, ns in cls.__namespaced__:
54
+ if ns in attrib:
55
+ attrib[key] = attrib[ns]
56
+ del attrib[ns]
57
+
58
+ # strip attributes with unknown namespaces
59
+ for key in list(attrib):
60
+ if key.startswith('{'):
61
+ del attrib[key]
62
+ elif key in KEYWORDS:
63
+ attrib["_" + key] = attrib[key]
64
+ del attrib[key]
65
+ elif "-" in key:
66
+ n = key.replace("-", "_")
67
+ attrib[n] = attrib[key]
68
+ del attrib[key]
69
+
70
+ if node.text and "attr_text" in cls.__attrs__:
71
+ attrib["attr_text"] = node.text
72
+
73
+ for el in node:
74
+ tag = localname(el)
75
+ if tag in KEYWORDS:
76
+ tag = "_" + tag
77
+ desc = getattr(cls, tag, None)
78
+ if desc is None or isinstance(desc, property):
79
+ continue
80
+
81
+ if hasattr(desc, 'from_tree'):
82
+ #descriptor manages conversion
83
+ obj = desc.from_tree(el)
84
+ else:
85
+ if hasattr(desc.expected_type, "from_tree"):
86
+ #complex type
87
+ obj = desc.expected_type.from_tree(el)
88
+ else:
89
+ #primitive
90
+ obj = el.text
91
+
92
+ if isinstance(desc, NestedSequence):
93
+ attrib[tag] = obj
94
+ elif isinstance(desc, Sequence):
95
+ attrib.setdefault(tag, [])
96
+ attrib[tag].append(obj)
97
+ elif isinstance(desc, MultiSequencePart):
98
+ attrib.setdefault(desc.store, [])
99
+ attrib[desc.store].append(obj)
100
+ else:
101
+ attrib[tag] = obj
102
+
103
+ return cls(**attrib)
104
+
105
+
106
+ def to_tree(self, tagname=None, idx=None, namespace=None):
107
+
108
+ if tagname is None:
109
+ tagname = self.tagname
110
+
111
+ # keywords have to be masked
112
+ if tagname.startswith("_"):
113
+ tagname = tagname[1:]
114
+
115
+ tagname = namespaced(self, tagname, namespace)
116
+ namespace = getattr(self, "namespace", namespace)
117
+
118
+ attrs = dict(self)
119
+ for key, ns in self.__namespaced__:
120
+ if key in attrs:
121
+ attrs[ns] = attrs[key]
122
+ del attrs[key]
123
+
124
+ el = Element(tagname, attrs)
125
+ if "attr_text" in self.__attrs__:
126
+ el.text = safe_string(getattr(self, "attr_text"))
127
+
128
+ for child_tag in self.__elements__:
129
+ desc = getattr(self.__class__, child_tag, None)
130
+ obj = getattr(self, child_tag)
131
+ if hasattr(desc, "namespace") and hasattr(obj, 'namespace'):
132
+ obj.namespace = desc.namespace
133
+
134
+ if isinstance(obj, seq_types):
135
+ if isinstance(desc, NestedSequence):
136
+ # wrap sequence in container
137
+ if not obj:
138
+ continue
139
+ nodes = [desc.to_tree(child_tag, obj, namespace)]
140
+ elif isinstance(desc, Sequence):
141
+ # sequence
142
+ desc.idx_base = self.idx_base
143
+ nodes = (desc.to_tree(child_tag, obj, namespace))
144
+ else: # property
145
+ nodes = (v.to_tree(child_tag, namespace) for v in obj)
146
+ for node in nodes:
147
+ el.append(node)
148
+ else:
149
+ if child_tag in self.__nested__:
150
+ node = desc.to_tree(child_tag, obj, namespace)
151
+ elif obj is None:
152
+ continue
153
+ else:
154
+ node = obj.to_tree(child_tag)
155
+ if node is not None:
156
+ el.append(node)
157
+ return el
158
+
159
+
160
+ def __iter__(self):
161
+ for attr in self.__attrs__:
162
+ value = getattr(self, attr)
163
+ if attr.startswith("_"):
164
+ attr = attr[1:]
165
+ elif attr != "attr_text" and "_" in attr:
166
+ desc = getattr(self.__class__, attr)
167
+ if getattr(desc, "hyphenated", False):
168
+ attr = attr.replace("_", "-")
169
+ if attr != "attr_text" and value is not None:
170
+ yield attr, safe_string(value)
171
+
172
+
173
+ def __eq__(self, other):
174
+ if not self.__class__ == other.__class__:
175
+ return False
176
+ elif not dict(self) == dict(other):
177
+ return False
178
+ for el in self.__elements__:
179
+ if getattr(self, el) != getattr(other, el):
180
+ return False
181
+ return True
182
+
183
+
184
+ def __ne__(self, other):
185
+ return not self == other
186
+
187
+
188
+ def __repr__(self):
189
+ s = u"<{0}.{1} object>\nParameters:".format(
190
+ self.__module__,
191
+ self.__class__.__name__
192
+ )
193
+ args = []
194
+ for k in self.__attrs__ + self.__elements__:
195
+ v = getattr(self, k)
196
+ if isinstance(v, Descriptor):
197
+ v = None
198
+ args.append(u"{0}={1}".format(k, repr(v)))
199
+ args = u", ".join(args)
200
+
201
+ return u"\n".join([s, args])
202
+
203
+
204
+ def __hash__(self):
205
+ fields = []
206
+ for attr in self.__attrs__ + self.__elements__:
207
+ val = getattr(self, attr)
208
+ if isinstance(val, list):
209
+ val = tuple(val)
210
+ fields.append(val)
211
+
212
+ return hash(tuple(fields))
213
+
214
+
215
+ def __add__(self, other):
216
+ if type(self) != type(other):
217
+ raise TypeError("Cannot combine instances of different types")
218
+ vals = {}
219
+ for attr in self.__attrs__:
220
+ vals[attr] = getattr(self, attr) or getattr(other, attr)
221
+ for el in self.__elements__:
222
+ a = getattr(self, el)
223
+ b = getattr(other, el)
224
+ if a and b:
225
+ vals[el] = a + b
226
+ else:
227
+ vals[el] = a or b
228
+ return self.__class__(**vals)
229
+
230
+
231
+ def __copy__(self):
232
+ # serialise to xml and back to avoid shallow copies
233
+ xml = self.to_tree(tagname="dummy")
234
+ cp = self.__class__.from_tree(xml)
235
+ # copy any non-persisted attributed
236
+ for k in self.__dict__:
237
+ if k not in self.__attrs__ + self.__elements__:
238
+ v = copy(getattr(self, k))
239
+ setattr(cp, k, v)
240
+ return cp
@@ -0,0 +1,18 @@
1
+ # Metaclass for mixing slots and descriptors
2
+ # From "Programming in Python 3" by Mark Summerfield Ch.8 p. 383
3
+
4
+ class AutoSlotProperties(type):
5
+
6
+ def __new__(mcl, classname, bases, dictionary):
7
+ slots = list(dictionary.get("__slots__", []))
8
+ for getter_name in [key for key in dictionary if key.startswith("get_")]:
9
+ name = getter_name
10
+ slots.append("__" + name)
11
+ getter = dictionary.pop(getter_name)
12
+ setter = dictionary.get(setter_name, None)
13
+ if (setter is not None
14
+ and isinstance(setter, collections.Callable)):
15
+ del dictionary[setter_name]
16
+ dictionary[name] = property(getter. setter)
17
+ dictionary["__slots__"] = tuple(slots)
18
+ return super().__new__(mcl, classname, bases, dictionary)
@@ -0,0 +1,4 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+
4
+ from .drawing import Drawing
@@ -0,0 +1,435 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Alias,
6
+ Typed,
7
+ Integer,
8
+ Set,
9
+ MinMax,
10
+ )
11
+ from openpyxl.descriptors.excel import Percentage
12
+ from openpyxl.descriptors.nested import (
13
+ NestedNoneSet,
14
+ NestedValue,
15
+ NestedInteger,
16
+ EmptyTag,
17
+ )
18
+
19
+ from openpyxl.styles.colors import RGB
20
+ from openpyxl.xml.constants import DRAWING_NS
21
+
22
+ from openpyxl.descriptors.excel import ExtensionList as OfficeArtExtensionList
23
+
24
+ PRESET_COLORS = [
25
+ 'aliceBlue', 'antiqueWhite', 'aqua', 'aquamarine',
26
+ 'azure', 'beige', 'bisque', 'black', 'blanchedAlmond', 'blue',
27
+ 'blueViolet', 'brown', 'burlyWood', 'cadetBlue', 'chartreuse',
28
+ 'chocolate', 'coral', 'cornflowerBlue', 'cornsilk', 'crimson', 'cyan',
29
+ 'darkBlue', 'darkCyan', 'darkGoldenrod', 'darkGray', 'darkGrey',
30
+ 'darkGreen', 'darkKhaki', 'darkMagenta', 'darkOliveGreen', 'darkOrange',
31
+ 'darkOrchid', 'darkRed', 'darkSalmon', 'darkSeaGreen', 'darkSlateBlue',
32
+ 'darkSlateGray', 'darkSlateGrey', 'darkTurquoise', 'darkViolet',
33
+ 'dkBlue', 'dkCyan', 'dkGoldenrod', 'dkGray', 'dkGrey', 'dkGreen',
34
+ 'dkKhaki', 'dkMagenta', 'dkOliveGreen', 'dkOrange', 'dkOrchid', 'dkRed',
35
+ 'dkSalmon', 'dkSeaGreen', 'dkSlateBlue', 'dkSlateGray', 'dkSlateGrey',
36
+ 'dkTurquoise', 'dkViolet', 'deepPink', 'deepSkyBlue', 'dimGray',
37
+ 'dimGrey', 'dodgerBlue', 'firebrick', 'floralWhite', 'forestGreen',
38
+ 'fuchsia', 'gainsboro', 'ghostWhite', 'gold', 'goldenrod', 'gray',
39
+ 'grey', 'green', 'greenYellow', 'honeydew', 'hotPink', 'indianRed',
40
+ 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderBlush', 'lawnGreen',
41
+ 'lemonChiffon', 'lightBlue', 'lightCoral', 'lightCyan',
42
+ 'lightGoldenrodYellow', 'lightGray', 'lightGrey', 'lightGreen',
43
+ 'lightPink', 'lightSalmon', 'lightSeaGreen', 'lightSkyBlue',
44
+ 'lightSlateGray', 'lightSlateGrey', 'lightSteelBlue', 'lightYellow',
45
+ 'ltBlue', 'ltCoral', 'ltCyan', 'ltGoldenrodYellow', 'ltGray', 'ltGrey',
46
+ 'ltGreen', 'ltPink', 'ltSalmon', 'ltSeaGreen', 'ltSkyBlue',
47
+ 'ltSlateGray', 'ltSlateGrey', 'ltSteelBlue', 'ltYellow', 'lime',
48
+ 'limeGreen', 'linen', 'magenta', 'maroon', 'medAquamarine', 'medBlue',
49
+ 'medOrchid', 'medPurple', 'medSeaGreen', 'medSlateBlue',
50
+ 'medSpringGreen', 'medTurquoise', 'medVioletRed', 'mediumAquamarine',
51
+ 'mediumBlue', 'mediumOrchid', 'mediumPurple', 'mediumSeaGreen',
52
+ 'mediumSlateBlue', 'mediumSpringGreen', 'mediumTurquoise',
53
+ 'mediumVioletRed', 'midnightBlue', 'mintCream', 'mistyRose', 'moccasin',
54
+ 'navajoWhite', 'navy', 'oldLace', 'olive', 'oliveDrab', 'orange',
55
+ 'orangeRed', 'orchid', 'paleGoldenrod', 'paleGreen', 'paleTurquoise',
56
+ 'paleVioletRed', 'papayaWhip', 'peachPuff', 'peru', 'pink', 'plum',
57
+ 'powderBlue', 'purple', 'red', 'rosyBrown', 'royalBlue', 'saddleBrown',
58
+ 'salmon', 'sandyBrown', 'seaGreen', 'seaShell', 'sienna', 'silver',
59
+ 'skyBlue', 'slateBlue', 'slateGray', 'slateGrey', 'snow', 'springGreen',
60
+ 'steelBlue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet',
61
+ 'wheat', 'white', 'whiteSmoke', 'yellow', 'yellowGreen'
62
+ ]
63
+
64
+
65
+ SCHEME_COLORS= ['bg1', 'tx1', 'bg2', 'tx2', 'accent1', 'accent2', 'accent3',
66
+ 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink', 'phClr', 'dk1', 'lt1',
67
+ 'dk2', 'lt2'
68
+ ]
69
+
70
+
71
+ class Transform(Serialisable):
72
+
73
+ pass
74
+
75
+
76
+ class SystemColor(Serialisable):
77
+
78
+ tagname = "sysClr"
79
+ namespace = DRAWING_NS
80
+
81
+ # color transform options
82
+ tint = NestedInteger(allow_none=True)
83
+ shade = NestedInteger(allow_none=True)
84
+ comp = Typed(expected_type=Transform, allow_none=True)
85
+ inv = Typed(expected_type=Transform, allow_none=True)
86
+ gray = Typed(expected_type=Transform, allow_none=True)
87
+ alpha = NestedInteger(allow_none=True)
88
+ alphaOff = NestedInteger(allow_none=True)
89
+ alphaMod = NestedInteger(allow_none=True)
90
+ hue = NestedInteger(allow_none=True)
91
+ hueOff = NestedInteger(allow_none=True)
92
+ hueMod = NestedInteger(allow_none=True)
93
+ sat = NestedInteger(allow_none=True)
94
+ satOff = NestedInteger(allow_none=True)
95
+ satMod = NestedInteger(allow_none=True)
96
+ lum = NestedInteger(allow_none=True)
97
+ lumOff = NestedInteger(allow_none=True)
98
+ lumMod = NestedInteger(allow_none=True)
99
+ red = NestedInteger(allow_none=True)
100
+ redOff = NestedInteger(allow_none=True)
101
+ redMod = NestedInteger(allow_none=True)
102
+ green = NestedInteger(allow_none=True)
103
+ greenOff = NestedInteger(allow_none=True)
104
+ greenMod = NestedInteger(allow_none=True)
105
+ blue = NestedInteger(allow_none=True)
106
+ blueOff = NestedInteger(allow_none=True)
107
+ blueMod = NestedInteger(allow_none=True)
108
+ gamma = Typed(expected_type=Transform, allow_none=True)
109
+ invGamma = Typed(expected_type=Transform, allow_none=True)
110
+
111
+ val = Set(values=( ['scrollBar', 'background', 'activeCaption',
112
+ 'inactiveCaption', 'menu', 'window', 'windowFrame', 'menuText',
113
+ 'windowText', 'captionText', 'activeBorder', 'inactiveBorder',
114
+ 'appWorkspace', 'highlight', 'highlightText', 'btnFace', 'btnShadow',
115
+ 'grayText', 'btnText', 'inactiveCaptionText', 'btnHighlight',
116
+ '3dDkShadow', '3dLight', 'infoText', 'infoBk', 'hotLight',
117
+ 'gradientActiveCaption', 'gradientInactiveCaption', 'menuHighlight',
118
+ 'menuBar'] )
119
+ )
120
+ lastClr = RGB(allow_none=True)
121
+
122
+ __elements__ = ('tint', 'shade', 'comp', 'inv', 'gray', "alpha",
123
+ "alphaOff", "alphaMod", "hue", "hueOff", "hueMod", "hueOff", "sat",
124
+ "satOff", "satMod", "lum", "lumOff", "lumMod", "red", "redOff", "redMod",
125
+ "green", "greenOff", "greenMod", "blue", "blueOff", "blueMod", "gamma",
126
+ "invGamma")
127
+
128
+ def __init__(self,
129
+ val="windowText",
130
+ lastClr=None,
131
+ tint=None,
132
+ shade=None,
133
+ comp=None,
134
+ inv=None,
135
+ gray=None,
136
+ alpha=None,
137
+ alphaOff=None,
138
+ alphaMod=None,
139
+ hue=None,
140
+ hueOff=None,
141
+ hueMod=None,
142
+ sat=None,
143
+ satOff=None,
144
+ satMod=None,
145
+ lum=None,
146
+ lumOff=None,
147
+ lumMod=None,
148
+ red=None,
149
+ redOff=None,
150
+ redMod=None,
151
+ green=None,
152
+ greenOff=None,
153
+ greenMod=None,
154
+ blue=None,
155
+ blueOff=None,
156
+ blueMod=None,
157
+ gamma=None,
158
+ invGamma=None
159
+ ):
160
+ self.val = val
161
+ self.lastClr = lastClr
162
+ self.tint = tint
163
+ self.shade = shade
164
+ self.comp = comp
165
+ self.inv = inv
166
+ self.gray = gray
167
+ self.alpha = alpha
168
+ self.alphaOff = alphaOff
169
+ self.alphaMod = alphaMod
170
+ self.hue = hue
171
+ self.hueOff = hueOff
172
+ self.hueMod = hueMod
173
+ self.sat = sat
174
+ self.satOff = satOff
175
+ self.satMod = satMod
176
+ self.lum = lum
177
+ self.lumOff = lumOff
178
+ self.lumMod = lumMod
179
+ self.red = red
180
+ self.redOff = redOff
181
+ self.redMod = redMod
182
+ self.green = green
183
+ self.greenOff = greenOff
184
+ self.greenMod = greenMod
185
+ self.blue = blue
186
+ self.blueOff = blueOff
187
+ self.blueMod = blueMod
188
+ self.gamma = gamma
189
+ self.invGamma = invGamma
190
+
191
+
192
+ class HSLColor(Serialisable):
193
+
194
+ tagname = "hslClr"
195
+
196
+ hue = Integer()
197
+ sat = MinMax(min=0, max=100)
198
+ lum = MinMax(min=0, max=100)
199
+
200
+ #TODO add color transform options
201
+
202
+ def __init__(self,
203
+ hue=None,
204
+ sat=None,
205
+ lum=None,
206
+ ):
207
+ self.hue = hue
208
+ self.sat = sat
209
+ self.lum = lum
210
+
211
+
212
+
213
+ class RGBPercent(Serialisable):
214
+
215
+ tagname = "rgbClr"
216
+
217
+ r = MinMax(min=0, max=100)
218
+ g = MinMax(min=0, max=100)
219
+ b = MinMax(min=0, max=100)
220
+
221
+ #TODO add color transform options
222
+
223
+ def __init__(self,
224
+ r=None,
225
+ g=None,
226
+ b=None,
227
+ ):
228
+ self.r = r
229
+ self.g = g
230
+ self.b = b
231
+
232
+
233
+ class SchemeColor(Serialisable):
234
+
235
+ tagname = "schemeClr"
236
+ namespace = DRAWING_NS
237
+
238
+ tint = NestedInteger(allow_none=True)
239
+ shade = NestedInteger(allow_none=True)
240
+ comp = EmptyTag(allow_none=True)
241
+ inv = NestedInteger(allow_none=True)
242
+ gray = NestedInteger(allow_none=True)
243
+ alpha = NestedInteger(allow_none=True)
244
+ alphaOff = NestedInteger(allow_none=True)
245
+ alphaMod = NestedInteger(allow_none=True)
246
+ hue = NestedInteger(allow_none=True)
247
+ hueOff = NestedInteger(allow_none=True)
248
+ hueMod = NestedInteger(allow_none=True)
249
+ sat = NestedInteger(allow_none=True)
250
+ satOff = NestedInteger(allow_none=True)
251
+ satMod = NestedInteger(allow_none=True)
252
+ lum = NestedInteger(allow_none=True)
253
+ lumOff = NestedInteger(allow_none=True)
254
+ lumMod = NestedInteger(allow_none=True)
255
+ red = NestedInteger(allow_none=True)
256
+ redOff = NestedInteger(allow_none=True)
257
+ redMod = NestedInteger(allow_none=True)
258
+ green = NestedInteger(allow_none=True)
259
+ greenOff = NestedInteger(allow_none=True)
260
+ greenMod = NestedInteger(allow_none=True)
261
+ blue = NestedInteger(allow_none=True)
262
+ blueOff = NestedInteger(allow_none=True)
263
+ blueMod = NestedInteger(allow_none=True)
264
+ gamma = EmptyTag(allow_none=True)
265
+ invGamma = EmptyTag(allow_none=True)
266
+ val = Set(values=(['bg1', 'tx1', 'bg2', 'tx2', 'accent1', 'accent2',
267
+ 'accent3', 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink', 'phClr',
268
+ 'dk1', 'lt1', 'dk2', 'lt2']))
269
+
270
+ __elements__ = ('tint', 'shade', 'comp', 'inv', 'gray', 'alpha',
271
+ 'alphaOff', 'alphaMod', 'hue', 'hueOff', 'hueMod', 'sat', 'satOff',
272
+ 'satMod', 'lum', 'lumMod', 'lumOff', 'red', 'redOff', 'redMod', 'green',
273
+ 'greenOff', 'greenMod', 'blue', 'blueOff', 'blueMod', 'gamma',
274
+ 'invGamma')
275
+
276
+ def __init__(self,
277
+ tint=None,
278
+ shade=None,
279
+ comp=None,
280
+ inv=None,
281
+ gray=None,
282
+ alpha=None,
283
+ alphaOff=None,
284
+ alphaMod=None,
285
+ hue=None,
286
+ hueOff=None,
287
+ hueMod=None,
288
+ sat=None,
289
+ satOff=None,
290
+ satMod=None,
291
+ lum=None,
292
+ lumOff=None,
293
+ lumMod=None,
294
+ red=None,
295
+ redOff=None,
296
+ redMod=None,
297
+ green=None,
298
+ greenOff=None,
299
+ greenMod=None,
300
+ blue=None,
301
+ blueOff=None,
302
+ blueMod=None,
303
+ gamma=None,
304
+ invGamma=None,
305
+ val=None,
306
+ ):
307
+ self.tint = tint
308
+ self.shade = shade
309
+ self.comp = comp
310
+ self.inv = inv
311
+ self.gray = gray
312
+ self.alpha = alpha
313
+ self.alphaOff = alphaOff
314
+ self.alphaMod = alphaMod
315
+ self.hue = hue
316
+ self.hueOff = hueOff
317
+ self.hueMod = hueMod
318
+ self.sat = sat
319
+ self.satOff = satOff
320
+ self.satMod = satMod
321
+ self.lum = lum
322
+ self.lumOff = lumOff
323
+ self.lumMod = lumMod
324
+ self.red = red
325
+ self.redOff = redOff
326
+ self.redMod = redMod
327
+ self.green = green
328
+ self.greenOff = greenOff
329
+ self.greenMod = greenMod
330
+ self.blue = blue
331
+ self.blueOff = blueOff
332
+ self.blueMod = blueMod
333
+ self.gamma = gamma
334
+ self.invGamma = invGamma
335
+ self.val = val
336
+
337
+ class ColorChoice(Serialisable):
338
+
339
+ tagname = "colorChoice"
340
+ namespace = DRAWING_NS
341
+
342
+ scrgbClr = Typed(expected_type=RGBPercent, allow_none=True)
343
+ RGBPercent = Alias('scrgbClr')
344
+ srgbClr = NestedValue(expected_type=str, allow_none=True) # needs pattern and can have transform
345
+ RGB = Alias('srgbClr')
346
+ hslClr = Typed(expected_type=HSLColor, allow_none=True)
347
+ sysClr = Typed(expected_type=SystemColor, allow_none=True)
348
+ schemeClr = Typed(expected_type=SchemeColor, allow_none=True)
349
+ prstClr = NestedNoneSet(values=PRESET_COLORS)
350
+
351
+ __elements__ = ('scrgbClr', 'srgbClr', 'hslClr', 'sysClr', 'schemeClr', 'prstClr')
352
+
353
+ def __init__(self,
354
+ scrgbClr=None,
355
+ srgbClr=None,
356
+ hslClr=None,
357
+ sysClr=None,
358
+ schemeClr=None,
359
+ prstClr=None,
360
+ ):
361
+ self.scrgbClr = scrgbClr
362
+ self.srgbClr = srgbClr
363
+ self.hslClr = hslClr
364
+ self.sysClr = sysClr
365
+ self.schemeClr = schemeClr
366
+ self.prstClr = prstClr
367
+
368
+ _COLOR_SET = ('dk1', 'lt1', 'dk2', 'lt2', 'accent1', 'accent2', 'accent3',
369
+ 'accent4', 'accent5', 'accent6', 'hlink', 'folHlink')
370
+
371
+
372
+ class ColorMapping(Serialisable):
373
+
374
+ tagname = "clrMapOvr"
375
+
376
+ bg1 = Set(values=_COLOR_SET)
377
+ tx1 = Set(values=_COLOR_SET)
378
+ bg2 = Set(values=_COLOR_SET)
379
+ tx2 = Set(values=_COLOR_SET)
380
+ accent1 = Set(values=_COLOR_SET)
381
+ accent2 = Set(values=_COLOR_SET)
382
+ accent3 = Set(values=_COLOR_SET)
383
+ accent4 = Set(values=_COLOR_SET)
384
+ accent5 = Set(values=_COLOR_SET)
385
+ accent6 = Set(values=_COLOR_SET)
386
+ hlink = Set(values=_COLOR_SET)
387
+ folHlink = Set(values=_COLOR_SET)
388
+ extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True)
389
+
390
+ def __init__(self,
391
+ bg1="lt1",
392
+ tx1="dk1",
393
+ bg2="lt2",
394
+ tx2="dk2",
395
+ accent1="accent1",
396
+ accent2="accent2",
397
+ accent3="accent3",
398
+ accent4="accent4",
399
+ accent5="accent5",
400
+ accent6="accent6",
401
+ hlink="hlink",
402
+ folHlink="folHlink",
403
+ extLst=None,
404
+ ):
405
+ self.bg1 = bg1
406
+ self.tx1 = tx1
407
+ self.bg2 = bg2
408
+ self.tx2 = tx2
409
+ self.accent1 = accent1
410
+ self.accent2 = accent2
411
+ self.accent3 = accent3
412
+ self.accent4 = accent4
413
+ self.accent5 = accent5
414
+ self.accent6 = accent6
415
+ self.hlink = hlink
416
+ self.folHlink = folHlink
417
+ self.extLst = extLst
418
+
419
+
420
+ class ColorChoiceDescriptor(Typed):
421
+ """
422
+ Objects can choose from 7 different kinds of color system.
423
+ Assume RGBHex if a string is passed in.
424
+ """
425
+
426
+ expected_type = ColorChoice
427
+ allow_none = True
428
+
429
+ def __set__(self, instance, value):
430
+ if isinstance(value, str):
431
+ value = ColorChoice(srgbClr=value)
432
+ else:
433
+ if hasattr(self, "namespace") and value is not None:
434
+ value.namespace = self.namespace
435
+ super().__set__(instance, value)