@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.
- package/CHANGELOG.md +59 -0
- package/README.md +5 -4
- package/THIRD_PARTY_NOTICES.md +16 -0
- package/automation/package.json +1 -1
- package/chart-ui/package.json +1 -1
- package/config/package.json +1 -1
- package/lib/collector-runtime.js +56 -1
- package/lib/data-collector/catalog-taxonomy.d.ts +1 -1
- package/lib/data-collector/catalog-taxonomy.js +33 -0
- package/lib/data-collector/tools.js +7 -7
- package/lib/host-version.d.ts +9 -0
- package/lib/host-version.js +57 -0
- package/lib/python-runtime/errors.d.ts +1 -1
- package/lib/python-runtime/errors.js +2 -0
- package/lib/python-runtime/manager.d.ts +28 -1
- package/lib/python-runtime/manager.js +141 -5
- package/lib/python-runtime/probe.d.ts +24 -0
- package/lib/python-runtime/probe.js +66 -50
- package/lib/runtime-entry.js +8 -0
- package/lib/sources/csindex-http.d.ts +4 -0
- package/lib/sources/csindex-http.js +233 -0
- package/lib/sources/eastmoney-http.js +1504 -1
- package/lib/sources/fuyao-rest.js +168 -8
- package/lib/sources/official-http.d.ts +4 -0
- package/lib/sources/official-http.js +477 -0
- package/lib/sources/python-remote.d.ts +25 -0
- package/lib/sources/python-remote.js +461 -0
- package/lib/sources/sina-http.d.ts +2 -0
- package/lib/sources/sina-http.js +484 -0
- package/lib/sources/tencent-http.js +23 -8
- package/lib/sources/ths-http.d.ts +2 -0
- package/lib/sources/ths-http.js +514 -0
- package/lib/time/tools.js +19 -0
- package/lib/web-retriever/local-fetch.d.ts +1 -1
- package/lib/web-retriever/local-fetch.js +1 -1
- package/lib/web-retriever/sources.d.ts +7 -0
- package/lib/web-retriever/sources.js +46 -21
- package/lib/web-retriever/throttle.d.ts +8 -0
- package/lib/web-retriever/throttle.js +13 -0
- package/lib/web-retriever/tools.js +1 -1
- package/lib/web-retriever/wind-client.d.ts +1 -1
- package/lib/web-retriever/wind-client.js +1 -1
- package/package.json +6 -3
- package/preset/capital-generation/agent.patch.yml +7 -5
- package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +16 -16
- package/python/scripts/baostock_stock_basic.py +129 -0
- package/python/scripts/baostock_valuation_history.py +141 -0
- package/python/scripts/pbc_social_financing.py +291 -0
- package/python/vendor/baostock/LICENSE +19 -0
- package/python/vendor/baostock/__init__.py +42 -0
- package/python/vendor/baostock/common/__init__.py +0 -0
- package/python/vendor/baostock/common/contants.py +189 -0
- package/python/vendor/baostock/common/context.py +4 -0
- package/python/vendor/baostock/corpreport/__init__.py +0 -0
- package/python/vendor/baostock/corpreport/corp_performance.py +202 -0
- package/python/vendor/baostock/data/__init__.py +0 -0
- package/python/vendor/baostock/data/messageheader.py +17 -0
- package/python/vendor/baostock/data/msg.py +21 -0
- package/python/vendor/baostock/data/resultset.py +200 -0
- package/python/vendor/baostock/demo/__init__.py +0 -0
- package/python/vendor/baostock/demo/demo_A_stock_5mk-data.py +34 -0
- package/python/vendor/baostock/demo/demo_A_stock_k_data.py +36 -0
- package/python/vendor/baostock/demo/demo_AllStock.py +27 -0
- package/python/vendor/baostock/demo/demo_Balance_data.py +22 -0
- package/python/vendor/baostock/demo/demo_CashFlow_data.py +22 -0
- package/python/vendor/baostock/demo/demo_Dividend_data.py +35 -0
- package/python/vendor/baostock/demo/demo_Dupont_data.py +25 -0
- package/python/vendor/baostock/demo/demo_Forecast_report.py +24 -0
- package/python/vendor/baostock/demo/demo_Growth_data.py +22 -0
- package/python/vendor/baostock/demo/demo_Index_k_data.py +39 -0
- package/python/vendor/baostock/demo/demo_Operation_data.py +22 -0
- package/python/vendor/baostock/demo/demo_PerformanceExpress_report.py +25 -0
- package/python/vendor/baostock/demo/demo_Profit_data.py +22 -0
- package/python/vendor/baostock/demo/demo_TradeDates.py +27 -0
- package/python/vendor/baostock/demo/demo_adjust_factor_data.py +23 -0
- package/python/vendor/baostock/demo/demo_assignDayData.py +23 -0
- package/python/vendor/baostock/demo/demo_daily_adjust_factor_data.py +28 -0
- package/python/vendor/baostock/demo/demo_daily_k_4_AStock.py +28 -0
- package/python/vendor/baostock/demo/demo_daily_k_4_ETF.py +28 -0
- package/python/vendor/baostock/demo/demo_depositRate_data.py +26 -0
- package/python/vendor/baostock/demo/demo_hs300_stocks.py +26 -0
- package/python/vendor/baostock/demo/demo_loanRate_data.py +26 -0
- package/python/vendor/baostock/demo/demo_moneySupplyDataMonth_data.py +26 -0
- package/python/vendor/baostock/demo/demo_moneySupplyDataYear_data.py +26 -0
- package/python/vendor/baostock/demo/demo_requiredReserveRatio_data.py +26 -0
- package/python/vendor/baostock/demo/demo_set_API_key.py +37 -0
- package/python/vendor/baostock/demo/demo_stockBasic_data.py +27 -0
- package/python/vendor/baostock/demo/demo_stock_Valuation_indicator_data.py +34 -0
- package/python/vendor/baostock/demo/demo_stock_industry.py +26 -0
- package/python/vendor/baostock/demo/demo_sz50stocks.py +26 -0
- package/python/vendor/baostock/demo/demo_zz500_stock.py +26 -0
- package/python/vendor/baostock/evaluation/__init__.py +0 -0
- package/python/vendor/baostock/evaluation/season_index.py +758 -0
- package/python/vendor/baostock/login/__init__.py +0 -0
- package/python/vendor/baostock/login/loginout.py +230 -0
- package/python/vendor/baostock/macroscopic/__init__.py +0 -0
- package/python/vendor/baostock/macroscopic/economic_data.py +723 -0
- package/python/vendor/baostock/metadata/__init__.py +0 -0
- package/python/vendor/baostock/metadata/stock_metadata.py +207 -0
- package/python/vendor/baostock/security/__init__.py +0 -0
- package/python/vendor/baostock/security/history.py +265 -0
- package/python/vendor/baostock/security/sectorinfo.py +1024 -0
- package/python/vendor/baostock/util/__init__.py +0 -0
- package/python/vendor/baostock/util/socketutil.py +97 -0
- package/python/vendor/baostock/util/stringutil.py +83 -0
- package/python/vendor/et_xmlfile/LICENSE +23 -0
- package/python/vendor/et_xmlfile/LICENSE.python +298 -0
- package/python/vendor/et_xmlfile/__init__.py +8 -0
- package/python/vendor/et_xmlfile/incremental_tree.py +917 -0
- package/python/vendor/et_xmlfile/xmlfile.py +158 -0
- package/python/vendor/openpyxl/LICENSE +23 -0
- package/python/vendor/openpyxl/__init__.py +19 -0
- package/python/vendor/openpyxl/_constants.py +13 -0
- package/python/vendor/openpyxl/cell/__init__.py +4 -0
- package/python/vendor/openpyxl/cell/_writer.py +136 -0
- package/python/vendor/openpyxl/cell/cell.py +332 -0
- package/python/vendor/openpyxl/cell/read_only.py +136 -0
- package/python/vendor/openpyxl/cell/rich_text.py +202 -0
- package/python/vendor/openpyxl/cell/text.py +184 -0
- package/python/vendor/openpyxl/chart/_3d.py +105 -0
- package/python/vendor/openpyxl/chart/__init__.py +19 -0
- package/python/vendor/openpyxl/chart/_chart.py +199 -0
- package/python/vendor/openpyxl/chart/area_chart.py +106 -0
- package/python/vendor/openpyxl/chart/axis.py +401 -0
- package/python/vendor/openpyxl/chart/bar_chart.py +144 -0
- package/python/vendor/openpyxl/chart/bubble_chart.py +67 -0
- package/python/vendor/openpyxl/chart/chartspace.py +195 -0
- package/python/vendor/openpyxl/chart/data_source.py +246 -0
- package/python/vendor/openpyxl/chart/descriptors.py +43 -0
- package/python/vendor/openpyxl/chart/error_bar.py +62 -0
- package/python/vendor/openpyxl/chart/label.py +127 -0
- package/python/vendor/openpyxl/chart/layout.py +74 -0
- package/python/vendor/openpyxl/chart/legend.py +75 -0
- package/python/vendor/openpyxl/chart/line_chart.py +129 -0
- package/python/vendor/openpyxl/chart/marker.py +90 -0
- package/python/vendor/openpyxl/chart/picture.py +35 -0
- package/python/vendor/openpyxl/chart/pie_chart.py +177 -0
- package/python/vendor/openpyxl/chart/pivot.py +65 -0
- package/python/vendor/openpyxl/chart/plotarea.py +162 -0
- package/python/vendor/openpyxl/chart/print_settings.py +57 -0
- package/python/vendor/openpyxl/chart/radar_chart.py +55 -0
- package/python/vendor/openpyxl/chart/reader.py +32 -0
- package/python/vendor/openpyxl/chart/reference.py +124 -0
- package/python/vendor/openpyxl/chart/scatter_chart.py +53 -0
- package/python/vendor/openpyxl/chart/series.py +197 -0
- package/python/vendor/openpyxl/chart/series_factory.py +41 -0
- package/python/vendor/openpyxl/chart/shapes.py +89 -0
- package/python/vendor/openpyxl/chart/stock_chart.py +54 -0
- package/python/vendor/openpyxl/chart/surface_chart.py +119 -0
- package/python/vendor/openpyxl/chart/text.py +78 -0
- package/python/vendor/openpyxl/chart/title.py +76 -0
- package/python/vendor/openpyxl/chart/trendline.py +98 -0
- package/python/vendor/openpyxl/chart/updown_bars.py +31 -0
- package/python/vendor/openpyxl/chartsheet/__init__.py +3 -0
- package/python/vendor/openpyxl/chartsheet/chartsheet.py +107 -0
- package/python/vendor/openpyxl/chartsheet/custom.py +61 -0
- package/python/vendor/openpyxl/chartsheet/properties.py +28 -0
- package/python/vendor/openpyxl/chartsheet/protection.py +41 -0
- package/python/vendor/openpyxl/chartsheet/publish.py +58 -0
- package/python/vendor/openpyxl/chartsheet/relation.py +97 -0
- package/python/vendor/openpyxl/chartsheet/views.py +51 -0
- package/python/vendor/openpyxl/comments/__init__.py +4 -0
- package/python/vendor/openpyxl/comments/author.py +21 -0
- package/python/vendor/openpyxl/comments/comment_sheet.py +211 -0
- package/python/vendor/openpyxl/comments/comments.py +62 -0
- package/python/vendor/openpyxl/comments/shape_writer.py +112 -0
- package/python/vendor/openpyxl/compat/__init__.py +54 -0
- package/python/vendor/openpyxl/compat/abc.py +8 -0
- package/python/vendor/openpyxl/compat/numbers.py +43 -0
- package/python/vendor/openpyxl/compat/product.py +17 -0
- package/python/vendor/openpyxl/compat/singleton.py +40 -0
- package/python/vendor/openpyxl/compat/strings.py +25 -0
- package/python/vendor/openpyxl/descriptors/__init__.py +58 -0
- package/python/vendor/openpyxl/descriptors/base.py +272 -0
- package/python/vendor/openpyxl/descriptors/container.py +41 -0
- package/python/vendor/openpyxl/descriptors/excel.py +112 -0
- package/python/vendor/openpyxl/descriptors/namespace.py +12 -0
- package/python/vendor/openpyxl/descriptors/nested.py +129 -0
- package/python/vendor/openpyxl/descriptors/sequence.py +136 -0
- package/python/vendor/openpyxl/descriptors/serialisable.py +240 -0
- package/python/vendor/openpyxl/descriptors/slots.py +18 -0
- package/python/vendor/openpyxl/drawing/__init__.py +4 -0
- package/python/vendor/openpyxl/drawing/colors.py +435 -0
- package/python/vendor/openpyxl/drawing/connector.py +144 -0
- package/python/vendor/openpyxl/drawing/drawing.py +92 -0
- package/python/vendor/openpyxl/drawing/effect.py +407 -0
- package/python/vendor/openpyxl/drawing/fill.py +425 -0
- package/python/vendor/openpyxl/drawing/geometry.py +584 -0
- package/python/vendor/openpyxl/drawing/graphic.py +177 -0
- package/python/vendor/openpyxl/drawing/image.py +65 -0
- package/python/vendor/openpyxl/drawing/line.py +144 -0
- package/python/vendor/openpyxl/drawing/picture.py +144 -0
- package/python/vendor/openpyxl/drawing/properties.py +174 -0
- package/python/vendor/openpyxl/drawing/relation.py +17 -0
- package/python/vendor/openpyxl/drawing/spreadsheet_drawing.py +382 -0
- package/python/vendor/openpyxl/drawing/text.py +717 -0
- package/python/vendor/openpyxl/drawing/xdr.py +33 -0
- package/python/vendor/openpyxl/formatting/__init__.py +3 -0
- package/python/vendor/openpyxl/formatting/formatting.py +114 -0
- package/python/vendor/openpyxl/formatting/rule.py +291 -0
- package/python/vendor/openpyxl/formula/__init__.py +3 -0
- package/python/vendor/openpyxl/formula/tokenizer.py +446 -0
- package/python/vendor/openpyxl/formula/translate.py +166 -0
- package/python/vendor/openpyxl/packaging/__init__.py +3 -0
- package/python/vendor/openpyxl/packaging/core.py +115 -0
- package/python/vendor/openpyxl/packaging/custom.py +289 -0
- package/python/vendor/openpyxl/packaging/extended.py +137 -0
- package/python/vendor/openpyxl/packaging/interface.py +56 -0
- package/python/vendor/openpyxl/packaging/manifest.py +194 -0
- package/python/vendor/openpyxl/packaging/relationship.py +158 -0
- package/python/vendor/openpyxl/packaging/workbook.py +185 -0
- package/python/vendor/openpyxl/pivot/__init__.py +1 -0
- package/python/vendor/openpyxl/pivot/cache.py +965 -0
- package/python/vendor/openpyxl/pivot/fields.py +326 -0
- package/python/vendor/openpyxl/pivot/record.py +111 -0
- package/python/vendor/openpyxl/pivot/table.py +1261 -0
- package/python/vendor/openpyxl/reader/__init__.py +1 -0
- package/python/vendor/openpyxl/reader/drawings.py +71 -0
- package/python/vendor/openpyxl/reader/excel.py +349 -0
- package/python/vendor/openpyxl/reader/strings.py +44 -0
- package/python/vendor/openpyxl/reader/workbook.py +133 -0
- package/python/vendor/openpyxl/styles/__init__.py +11 -0
- package/python/vendor/openpyxl/styles/alignment.py +62 -0
- package/python/vendor/openpyxl/styles/borders.py +103 -0
- package/python/vendor/openpyxl/styles/builtins.py +1397 -0
- package/python/vendor/openpyxl/styles/cell_style.py +206 -0
- package/python/vendor/openpyxl/styles/colors.py +172 -0
- package/python/vendor/openpyxl/styles/differential.py +95 -0
- package/python/vendor/openpyxl/styles/fills.py +224 -0
- package/python/vendor/openpyxl/styles/fonts.py +113 -0
- package/python/vendor/openpyxl/styles/named_styles.py +282 -0
- package/python/vendor/openpyxl/styles/numbers.py +200 -0
- package/python/vendor/openpyxl/styles/protection.py +17 -0
- package/python/vendor/openpyxl/styles/proxy.py +62 -0
- package/python/vendor/openpyxl/styles/styleable.py +151 -0
- package/python/vendor/openpyxl/styles/stylesheet.py +274 -0
- package/python/vendor/openpyxl/styles/table.py +94 -0
- package/python/vendor/openpyxl/utils/__init__.py +17 -0
- package/python/vendor/openpyxl/utils/bound_dictionary.py +26 -0
- package/python/vendor/openpyxl/utils/cell.py +240 -0
- package/python/vendor/openpyxl/utils/dataframe.py +87 -0
- package/python/vendor/openpyxl/utils/datetime.py +140 -0
- package/python/vendor/openpyxl/utils/escape.py +43 -0
- package/python/vendor/openpyxl/utils/exceptions.py +34 -0
- package/python/vendor/openpyxl/utils/formulas.py +24 -0
- package/python/vendor/openpyxl/utils/indexed_list.py +49 -0
- package/python/vendor/openpyxl/utils/inference.py +60 -0
- package/python/vendor/openpyxl/utils/protection.py +22 -0
- package/python/vendor/openpyxl/utils/units.py +108 -0
- package/python/vendor/openpyxl/workbook/__init__.py +4 -0
- package/python/vendor/openpyxl/workbook/_writer.py +197 -0
- package/python/vendor/openpyxl/workbook/child.py +166 -0
- package/python/vendor/openpyxl/workbook/defined_name.py +189 -0
- package/python/vendor/openpyxl/workbook/external_link/__init__.py +3 -0
- package/python/vendor/openpyxl/workbook/external_link/external.py +190 -0
- package/python/vendor/openpyxl/workbook/external_reference.py +18 -0
- package/python/vendor/openpyxl/workbook/function_group.py +36 -0
- package/python/vendor/openpyxl/workbook/properties.py +151 -0
- package/python/vendor/openpyxl/workbook/protection.py +163 -0
- package/python/vendor/openpyxl/workbook/smart_tags.py +56 -0
- package/python/vendor/openpyxl/workbook/views.py +155 -0
- package/python/vendor/openpyxl/workbook/web.py +98 -0
- package/python/vendor/openpyxl/workbook/workbook.py +438 -0
- package/python/vendor/openpyxl/worksheet/__init__.py +1 -0
- package/python/vendor/openpyxl/worksheet/_read_only.py +190 -0
- package/python/vendor/openpyxl/worksheet/_reader.py +472 -0
- package/python/vendor/openpyxl/worksheet/_write_only.py +160 -0
- package/python/vendor/openpyxl/worksheet/_writer.py +390 -0
- package/python/vendor/openpyxl/worksheet/cell_range.py +512 -0
- package/python/vendor/openpyxl/worksheet/cell_watch.py +34 -0
- package/python/vendor/openpyxl/worksheet/controls.py +107 -0
- package/python/vendor/openpyxl/worksheet/copier.py +70 -0
- package/python/vendor/openpyxl/worksheet/custom.py +35 -0
- package/python/vendor/openpyxl/worksheet/datavalidation.py +202 -0
- package/python/vendor/openpyxl/worksheet/dimensions.py +306 -0
- package/python/vendor/openpyxl/worksheet/drawing.py +14 -0
- package/python/vendor/openpyxl/worksheet/errors.py +93 -0
- package/python/vendor/openpyxl/worksheet/filters.py +486 -0
- package/python/vendor/openpyxl/worksheet/formula.py +51 -0
- package/python/vendor/openpyxl/worksheet/header_footer.py +270 -0
- package/python/vendor/openpyxl/worksheet/hyperlink.py +46 -0
- package/python/vendor/openpyxl/worksheet/merge.py +141 -0
- package/python/vendor/openpyxl/worksheet/ole.py +133 -0
- package/python/vendor/openpyxl/worksheet/page.py +174 -0
- package/python/vendor/openpyxl/worksheet/pagebreak.py +94 -0
- package/python/vendor/openpyxl/worksheet/picture.py +8 -0
- package/python/vendor/openpyxl/worksheet/print_settings.py +184 -0
- package/python/vendor/openpyxl/worksheet/properties.py +97 -0
- package/python/vendor/openpyxl/worksheet/protection.py +120 -0
- package/python/vendor/openpyxl/worksheet/related.py +17 -0
- package/python/vendor/openpyxl/worksheet/scenario.py +105 -0
- package/python/vendor/openpyxl/worksheet/smart_tag.py +78 -0
- package/python/vendor/openpyxl/worksheet/table.py +385 -0
- package/python/vendor/openpyxl/worksheet/views.py +155 -0
- package/python/vendor/openpyxl/worksheet/worksheet.py +907 -0
- package/python/vendor/openpyxl/writer/__init__.py +1 -0
- package/python/vendor/openpyxl/writer/excel.py +295 -0
- package/python/vendor/openpyxl/writer/theme.py +291 -0
- package/python/vendor/openpyxl/xml/__init__.py +42 -0
- package/python/vendor/openpyxl/xml/constants.py +129 -0
- package/python/vendor/openpyxl/xml/functions.py +87 -0
- package/watchlist/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Copyright (c) 2010-2024 openpyxl
|
|
2
|
+
|
|
3
|
+
from openpyxl.descriptors.serialisable import Serialisable
|
|
4
|
+
from openpyxl.descriptors import (
|
|
5
|
+
String,
|
|
6
|
+
Integer,
|
|
7
|
+
Bool,
|
|
8
|
+
Sequence,
|
|
9
|
+
Convertible,
|
|
10
|
+
)
|
|
11
|
+
from .cell_range import MultiCellRange
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class InputCells(Serialisable):
|
|
15
|
+
|
|
16
|
+
tagname = "inputCells"
|
|
17
|
+
|
|
18
|
+
r = String()
|
|
19
|
+
deleted = Bool(allow_none=True)
|
|
20
|
+
undone = Bool(allow_none=True)
|
|
21
|
+
val = String()
|
|
22
|
+
numFmtId = Integer(allow_none=True)
|
|
23
|
+
|
|
24
|
+
def __init__(self,
|
|
25
|
+
r=None,
|
|
26
|
+
deleted=False,
|
|
27
|
+
undone=False,
|
|
28
|
+
val=None,
|
|
29
|
+
numFmtId=None,
|
|
30
|
+
):
|
|
31
|
+
self.r = r
|
|
32
|
+
self.deleted = deleted
|
|
33
|
+
self.undone = undone
|
|
34
|
+
self.val = val
|
|
35
|
+
self.numFmtId = numFmtId
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Scenario(Serialisable):
|
|
39
|
+
|
|
40
|
+
tagname = "scenario"
|
|
41
|
+
|
|
42
|
+
inputCells = Sequence(expected_type=InputCells)
|
|
43
|
+
name = String()
|
|
44
|
+
locked = Bool(allow_none=True)
|
|
45
|
+
hidden = Bool(allow_none=True)
|
|
46
|
+
user = String(allow_none=True)
|
|
47
|
+
comment = String(allow_none=True)
|
|
48
|
+
|
|
49
|
+
__elements__ = ('inputCells',)
|
|
50
|
+
__attrs__ = ('name', 'locked', 'hidden', 'user', 'comment', 'count')
|
|
51
|
+
|
|
52
|
+
def __init__(self,
|
|
53
|
+
inputCells=(),
|
|
54
|
+
name=None,
|
|
55
|
+
locked=False,
|
|
56
|
+
hidden=False,
|
|
57
|
+
count=None,
|
|
58
|
+
user=None,
|
|
59
|
+
comment=None,
|
|
60
|
+
):
|
|
61
|
+
self.inputCells = inputCells
|
|
62
|
+
self.name = name
|
|
63
|
+
self.locked = locked
|
|
64
|
+
self.hidden = hidden
|
|
65
|
+
self.user = user
|
|
66
|
+
self.comment = comment
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def count(self):
|
|
71
|
+
return len(self.inputCells)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class ScenarioList(Serialisable):
|
|
75
|
+
|
|
76
|
+
tagname = "scenarios"
|
|
77
|
+
|
|
78
|
+
scenario = Sequence(expected_type=Scenario)
|
|
79
|
+
current = Integer(allow_none=True)
|
|
80
|
+
show = Integer(allow_none=True)
|
|
81
|
+
sqref = Convertible(expected_type=MultiCellRange, allow_none=True)
|
|
82
|
+
|
|
83
|
+
__elements__ = ('scenario',)
|
|
84
|
+
|
|
85
|
+
def __init__(self,
|
|
86
|
+
scenario=(),
|
|
87
|
+
current=None,
|
|
88
|
+
show=None,
|
|
89
|
+
sqref=None,
|
|
90
|
+
):
|
|
91
|
+
self.scenario = scenario
|
|
92
|
+
self.current = current
|
|
93
|
+
self.show = show
|
|
94
|
+
self.sqref = sqref
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def append(self, scenario):
|
|
98
|
+
s = self.scenario
|
|
99
|
+
s.append(scenario)
|
|
100
|
+
self.scenario = s
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def __bool__(self):
|
|
104
|
+
return bool(self.scenario)
|
|
105
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#Autogenerated schema
|
|
2
|
+
from openpyxl.descriptors.serialisable import Serialisable
|
|
3
|
+
from openpyxl.descriptors import (
|
|
4
|
+
Bool,
|
|
5
|
+
Integer,
|
|
6
|
+
String,
|
|
7
|
+
Sequence,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CellSmartTagPr(Serialisable):
|
|
12
|
+
|
|
13
|
+
tagname = "cellSmartTagPr"
|
|
14
|
+
|
|
15
|
+
key = String()
|
|
16
|
+
val = String()
|
|
17
|
+
|
|
18
|
+
def __init__(self,
|
|
19
|
+
key=None,
|
|
20
|
+
val=None,
|
|
21
|
+
):
|
|
22
|
+
self.key = key
|
|
23
|
+
self.val = val
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CellSmartTag(Serialisable):
|
|
27
|
+
|
|
28
|
+
tagname = "cellSmartTag"
|
|
29
|
+
|
|
30
|
+
cellSmartTagPr = Sequence(expected_type=CellSmartTagPr)
|
|
31
|
+
type = Integer()
|
|
32
|
+
deleted = Bool(allow_none=True)
|
|
33
|
+
xmlBased = Bool(allow_none=True)
|
|
34
|
+
|
|
35
|
+
__elements__ = ('cellSmartTagPr',)
|
|
36
|
+
|
|
37
|
+
def __init__(self,
|
|
38
|
+
cellSmartTagPr=(),
|
|
39
|
+
type=None,
|
|
40
|
+
deleted=False,
|
|
41
|
+
xmlBased=False,
|
|
42
|
+
):
|
|
43
|
+
self.cellSmartTagPr = cellSmartTagPr
|
|
44
|
+
self.type = type
|
|
45
|
+
self.deleted = deleted
|
|
46
|
+
self.xmlBased = xmlBased
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CellSmartTags(Serialisable):
|
|
50
|
+
|
|
51
|
+
tagname = "cellSmartTags"
|
|
52
|
+
|
|
53
|
+
cellSmartTag = Sequence(expected_type=CellSmartTag)
|
|
54
|
+
r = String()
|
|
55
|
+
|
|
56
|
+
__elements__ = ('cellSmartTag',)
|
|
57
|
+
|
|
58
|
+
def __init__(self,
|
|
59
|
+
cellSmartTag=(),
|
|
60
|
+
r=None,
|
|
61
|
+
):
|
|
62
|
+
self.cellSmartTag = cellSmartTag
|
|
63
|
+
self.r = r
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class SmartTags(Serialisable):
|
|
67
|
+
|
|
68
|
+
tagname = "smartTags"
|
|
69
|
+
|
|
70
|
+
cellSmartTags = Sequence(expected_type=CellSmartTags)
|
|
71
|
+
|
|
72
|
+
__elements__ = ('cellSmartTags',)
|
|
73
|
+
|
|
74
|
+
def __init__(self,
|
|
75
|
+
cellSmartTags=(),
|
|
76
|
+
):
|
|
77
|
+
self.cellSmartTags = cellSmartTags
|
|
78
|
+
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# Copyright (c) 2010-2024 openpyxl
|
|
2
|
+
|
|
3
|
+
from openpyxl.descriptors.serialisable import Serialisable
|
|
4
|
+
from openpyxl.descriptors import (
|
|
5
|
+
Descriptor,
|
|
6
|
+
Alias,
|
|
7
|
+
Typed,
|
|
8
|
+
Bool,
|
|
9
|
+
Integer,
|
|
10
|
+
NoneSet,
|
|
11
|
+
String,
|
|
12
|
+
Sequence,
|
|
13
|
+
)
|
|
14
|
+
from openpyxl.descriptors.excel import ExtensionList, CellRange
|
|
15
|
+
from openpyxl.descriptors.sequence import NestedSequence
|
|
16
|
+
from openpyxl.xml.constants import SHEET_MAIN_NS, REL_NS
|
|
17
|
+
from openpyxl.xml.functions import tostring
|
|
18
|
+
from openpyxl.utils import range_boundaries
|
|
19
|
+
from openpyxl.utils.escape import escape, unescape
|
|
20
|
+
|
|
21
|
+
from .related import Related
|
|
22
|
+
|
|
23
|
+
from .filters import (
|
|
24
|
+
AutoFilter,
|
|
25
|
+
SortState,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
TABLESTYLES = tuple(
|
|
29
|
+
["TableStyleMedium{0}".format(i) for i in range(1, 29)]
|
|
30
|
+
+ ["TableStyleLight{0}".format(i) for i in range(1, 22)]
|
|
31
|
+
+ ["TableStyleDark{0}".format(i) for i in range(1, 12)]
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
PIVOTSTYLES = tuple(
|
|
35
|
+
["PivotStyleMedium{0}".format(i) for i in range(1, 29)]
|
|
36
|
+
+ ["PivotStyleLight{0}".format(i) for i in range(1, 29)]
|
|
37
|
+
+ ["PivotStyleDark{0}".format(i) for i in range(1, 29)]
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class TableStyleInfo(Serialisable):
|
|
42
|
+
|
|
43
|
+
tagname = "tableStyleInfo"
|
|
44
|
+
|
|
45
|
+
name = String(allow_none=True)
|
|
46
|
+
showFirstColumn = Bool(allow_none=True)
|
|
47
|
+
showLastColumn = Bool(allow_none=True)
|
|
48
|
+
showRowStripes = Bool(allow_none=True)
|
|
49
|
+
showColumnStripes = Bool(allow_none=True)
|
|
50
|
+
|
|
51
|
+
def __init__(self,
|
|
52
|
+
name=None,
|
|
53
|
+
showFirstColumn=None,
|
|
54
|
+
showLastColumn=None,
|
|
55
|
+
showRowStripes=None,
|
|
56
|
+
showColumnStripes=None,
|
|
57
|
+
):
|
|
58
|
+
self.name = name
|
|
59
|
+
self.showFirstColumn = showFirstColumn
|
|
60
|
+
self.showLastColumn = showLastColumn
|
|
61
|
+
self.showRowStripes = showRowStripes
|
|
62
|
+
self.showColumnStripes = showColumnStripes
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class XMLColumnProps(Serialisable):
|
|
66
|
+
|
|
67
|
+
tagname = "xmlColumnPr"
|
|
68
|
+
|
|
69
|
+
mapId = Integer()
|
|
70
|
+
xpath = String()
|
|
71
|
+
denormalized = Bool(allow_none=True)
|
|
72
|
+
xmlDataType = String()
|
|
73
|
+
extLst = Typed(expected_type=ExtensionList, allow_none=True)
|
|
74
|
+
|
|
75
|
+
__elements__ = ()
|
|
76
|
+
|
|
77
|
+
def __init__(self,
|
|
78
|
+
mapId=None,
|
|
79
|
+
xpath=None,
|
|
80
|
+
denormalized=None,
|
|
81
|
+
xmlDataType=None,
|
|
82
|
+
extLst=None,
|
|
83
|
+
):
|
|
84
|
+
self.mapId = mapId
|
|
85
|
+
self.xpath = xpath
|
|
86
|
+
self.denormalized = denormalized
|
|
87
|
+
self.xmlDataType = xmlDataType
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class TableFormula(Serialisable):
|
|
91
|
+
|
|
92
|
+
tagname = "tableFormula"
|
|
93
|
+
|
|
94
|
+
## Note formula is stored as the text value
|
|
95
|
+
|
|
96
|
+
array = Bool(allow_none=True)
|
|
97
|
+
attr_text = Descriptor()
|
|
98
|
+
text = Alias('attr_text')
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def __init__(self,
|
|
102
|
+
array=None,
|
|
103
|
+
attr_text=None,
|
|
104
|
+
):
|
|
105
|
+
self.array = array
|
|
106
|
+
self.attr_text = attr_text
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class TableColumn(Serialisable):
|
|
110
|
+
|
|
111
|
+
tagname = "tableColumn"
|
|
112
|
+
|
|
113
|
+
id = Integer()
|
|
114
|
+
uniqueName = String(allow_none=True)
|
|
115
|
+
name = String()
|
|
116
|
+
totalsRowFunction = NoneSet(values=(['sum', 'min', 'max', 'average',
|
|
117
|
+
'count', 'countNums', 'stdDev', 'var', 'custom']))
|
|
118
|
+
totalsRowLabel = String(allow_none=True)
|
|
119
|
+
queryTableFieldId = Integer(allow_none=True)
|
|
120
|
+
headerRowDxfId = Integer(allow_none=True)
|
|
121
|
+
dataDxfId = Integer(allow_none=True)
|
|
122
|
+
totalsRowDxfId = Integer(allow_none=True)
|
|
123
|
+
headerRowCellStyle = String(allow_none=True)
|
|
124
|
+
dataCellStyle = String(allow_none=True)
|
|
125
|
+
totalsRowCellStyle = String(allow_none=True)
|
|
126
|
+
calculatedColumnFormula = Typed(expected_type=TableFormula, allow_none=True)
|
|
127
|
+
totalsRowFormula = Typed(expected_type=TableFormula, allow_none=True)
|
|
128
|
+
xmlColumnPr = Typed(expected_type=XMLColumnProps, allow_none=True)
|
|
129
|
+
extLst = Typed(expected_type=ExtensionList, allow_none=True)
|
|
130
|
+
|
|
131
|
+
__elements__ = ('calculatedColumnFormula', 'totalsRowFormula',
|
|
132
|
+
'xmlColumnPr', 'extLst')
|
|
133
|
+
|
|
134
|
+
def __init__(self,
|
|
135
|
+
id=None,
|
|
136
|
+
uniqueName=None,
|
|
137
|
+
name=None,
|
|
138
|
+
totalsRowFunction=None,
|
|
139
|
+
totalsRowLabel=None,
|
|
140
|
+
queryTableFieldId=None,
|
|
141
|
+
headerRowDxfId=None,
|
|
142
|
+
dataDxfId=None,
|
|
143
|
+
totalsRowDxfId=None,
|
|
144
|
+
headerRowCellStyle=None,
|
|
145
|
+
dataCellStyle=None,
|
|
146
|
+
totalsRowCellStyle=None,
|
|
147
|
+
calculatedColumnFormula=None,
|
|
148
|
+
totalsRowFormula=None,
|
|
149
|
+
xmlColumnPr=None,
|
|
150
|
+
extLst=None,
|
|
151
|
+
):
|
|
152
|
+
self.id = id
|
|
153
|
+
self.uniqueName = uniqueName
|
|
154
|
+
self.name = name
|
|
155
|
+
self.totalsRowFunction = totalsRowFunction
|
|
156
|
+
self.totalsRowLabel = totalsRowLabel
|
|
157
|
+
self.queryTableFieldId = queryTableFieldId
|
|
158
|
+
self.headerRowDxfId = headerRowDxfId
|
|
159
|
+
self.dataDxfId = dataDxfId
|
|
160
|
+
self.totalsRowDxfId = totalsRowDxfId
|
|
161
|
+
self.headerRowCellStyle = headerRowCellStyle
|
|
162
|
+
self.dataCellStyle = dataCellStyle
|
|
163
|
+
self.totalsRowCellStyle = totalsRowCellStyle
|
|
164
|
+
self.calculatedColumnFormula = calculatedColumnFormula
|
|
165
|
+
self.totalsRowFormula = totalsRowFormula
|
|
166
|
+
self.xmlColumnPr = xmlColumnPr
|
|
167
|
+
self.extLst = extLst
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def __iter__(self):
|
|
171
|
+
for k, v in super().__iter__():
|
|
172
|
+
if k == 'name':
|
|
173
|
+
v = escape(v)
|
|
174
|
+
yield k, v
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@classmethod
|
|
178
|
+
def from_tree(cls, node):
|
|
179
|
+
self = super().from_tree(node)
|
|
180
|
+
self.name = unescape(self.name)
|
|
181
|
+
return self
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
class TableNameDescriptor(String):
|
|
185
|
+
|
|
186
|
+
"""
|
|
187
|
+
Table names cannot have spaces in them
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
def __set__(self, instance, value):
|
|
191
|
+
if value is not None and " " in value:
|
|
192
|
+
raise ValueError("Table names cannot have spaces")
|
|
193
|
+
super().__set__(instance, value)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class Table(Serialisable):
|
|
197
|
+
|
|
198
|
+
_path = "/tables/table{0}.xml"
|
|
199
|
+
mime_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"
|
|
200
|
+
_rel_type = REL_NS + "/table"
|
|
201
|
+
_rel_id = None
|
|
202
|
+
|
|
203
|
+
tagname = "table"
|
|
204
|
+
|
|
205
|
+
id = Integer()
|
|
206
|
+
name = String(allow_none=True)
|
|
207
|
+
displayName = TableNameDescriptor()
|
|
208
|
+
comment = String(allow_none=True)
|
|
209
|
+
ref = CellRange()
|
|
210
|
+
tableType = NoneSet(values=(['worksheet', 'xml', 'queryTable']))
|
|
211
|
+
headerRowCount = Integer(allow_none=True)
|
|
212
|
+
insertRow = Bool(allow_none=True)
|
|
213
|
+
insertRowShift = Bool(allow_none=True)
|
|
214
|
+
totalsRowCount = Integer(allow_none=True)
|
|
215
|
+
totalsRowShown = Bool(allow_none=True)
|
|
216
|
+
published = Bool(allow_none=True)
|
|
217
|
+
headerRowDxfId = Integer(allow_none=True)
|
|
218
|
+
dataDxfId = Integer(allow_none=True)
|
|
219
|
+
totalsRowDxfId = Integer(allow_none=True)
|
|
220
|
+
headerRowBorderDxfId = Integer(allow_none=True)
|
|
221
|
+
tableBorderDxfId = Integer(allow_none=True)
|
|
222
|
+
totalsRowBorderDxfId = Integer(allow_none=True)
|
|
223
|
+
headerRowCellStyle = String(allow_none=True)
|
|
224
|
+
dataCellStyle = String(allow_none=True)
|
|
225
|
+
totalsRowCellStyle = String(allow_none=True)
|
|
226
|
+
connectionId = Integer(allow_none=True)
|
|
227
|
+
autoFilter = Typed(expected_type=AutoFilter, allow_none=True)
|
|
228
|
+
sortState = Typed(expected_type=SortState, allow_none=True)
|
|
229
|
+
tableColumns = NestedSequence(expected_type=TableColumn, count=True)
|
|
230
|
+
tableStyleInfo = Typed(expected_type=TableStyleInfo, allow_none=True)
|
|
231
|
+
extLst = Typed(expected_type=ExtensionList, allow_none=True)
|
|
232
|
+
|
|
233
|
+
__elements__ = ('autoFilter', 'sortState', 'tableColumns',
|
|
234
|
+
'tableStyleInfo')
|
|
235
|
+
|
|
236
|
+
def __init__(self,
|
|
237
|
+
id=1,
|
|
238
|
+
displayName=None,
|
|
239
|
+
ref=None,
|
|
240
|
+
name=None,
|
|
241
|
+
comment=None,
|
|
242
|
+
tableType=None,
|
|
243
|
+
headerRowCount=1,
|
|
244
|
+
insertRow=None,
|
|
245
|
+
insertRowShift=None,
|
|
246
|
+
totalsRowCount=None,
|
|
247
|
+
totalsRowShown=None,
|
|
248
|
+
published=None,
|
|
249
|
+
headerRowDxfId=None,
|
|
250
|
+
dataDxfId=None,
|
|
251
|
+
totalsRowDxfId=None,
|
|
252
|
+
headerRowBorderDxfId=None,
|
|
253
|
+
tableBorderDxfId=None,
|
|
254
|
+
totalsRowBorderDxfId=None,
|
|
255
|
+
headerRowCellStyle=None,
|
|
256
|
+
dataCellStyle=None,
|
|
257
|
+
totalsRowCellStyle=None,
|
|
258
|
+
connectionId=None,
|
|
259
|
+
autoFilter=None,
|
|
260
|
+
sortState=None,
|
|
261
|
+
tableColumns=(),
|
|
262
|
+
tableStyleInfo=None,
|
|
263
|
+
extLst=None,
|
|
264
|
+
):
|
|
265
|
+
self.id = id
|
|
266
|
+
self.displayName = displayName
|
|
267
|
+
if name is None:
|
|
268
|
+
name = displayName
|
|
269
|
+
self.name = name
|
|
270
|
+
self.comment = comment
|
|
271
|
+
self.ref = ref
|
|
272
|
+
self.tableType = tableType
|
|
273
|
+
self.headerRowCount = headerRowCount
|
|
274
|
+
self.insertRow = insertRow
|
|
275
|
+
self.insertRowShift = insertRowShift
|
|
276
|
+
self.totalsRowCount = totalsRowCount
|
|
277
|
+
self.totalsRowShown = totalsRowShown
|
|
278
|
+
self.published = published
|
|
279
|
+
self.headerRowDxfId = headerRowDxfId
|
|
280
|
+
self.dataDxfId = dataDxfId
|
|
281
|
+
self.totalsRowDxfId = totalsRowDxfId
|
|
282
|
+
self.headerRowBorderDxfId = headerRowBorderDxfId
|
|
283
|
+
self.tableBorderDxfId = tableBorderDxfId
|
|
284
|
+
self.totalsRowBorderDxfId = totalsRowBorderDxfId
|
|
285
|
+
self.headerRowCellStyle = headerRowCellStyle
|
|
286
|
+
self.dataCellStyle = dataCellStyle
|
|
287
|
+
self.totalsRowCellStyle = totalsRowCellStyle
|
|
288
|
+
self.connectionId = connectionId
|
|
289
|
+
self.autoFilter = autoFilter
|
|
290
|
+
self.sortState = sortState
|
|
291
|
+
self.tableColumns = tableColumns
|
|
292
|
+
self.tableStyleInfo = tableStyleInfo
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def to_tree(self):
|
|
296
|
+
tree = super().to_tree()
|
|
297
|
+
tree.set("xmlns", SHEET_MAIN_NS)
|
|
298
|
+
return tree
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
@property
|
|
302
|
+
def path(self):
|
|
303
|
+
"""
|
|
304
|
+
Return path within the archive
|
|
305
|
+
"""
|
|
306
|
+
return "/xl" + self._path.format(self.id)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def _write(self, archive):
|
|
310
|
+
"""
|
|
311
|
+
Serialise to XML and write to archive
|
|
312
|
+
"""
|
|
313
|
+
xml = self.to_tree()
|
|
314
|
+
archive.writestr(self.path[1:], tostring(xml))
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def _initialise_columns(self):
|
|
318
|
+
"""
|
|
319
|
+
Create a list of table columns from a cell range
|
|
320
|
+
Always set a ref if we have headers (the default)
|
|
321
|
+
Column headings must be strings and must match cells in the worksheet.
|
|
322
|
+
"""
|
|
323
|
+
|
|
324
|
+
min_col, min_row, max_col, max_row = range_boundaries(self.ref)
|
|
325
|
+
for idx in range(min_col, max_col+1):
|
|
326
|
+
col = TableColumn(id=idx, name="Column{0}".format(idx))
|
|
327
|
+
self.tableColumns.append(col)
|
|
328
|
+
if self.headerRowCount and not self.autoFilter:
|
|
329
|
+
self.autoFilter = AutoFilter(ref=self.ref)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@property
|
|
333
|
+
def column_names(self):
|
|
334
|
+
return [column.name for column in self.tableColumns]
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class TablePartList(Serialisable):
|
|
338
|
+
|
|
339
|
+
tagname = "tableParts"
|
|
340
|
+
|
|
341
|
+
count = Integer(allow_none=True)
|
|
342
|
+
tablePart = Sequence(expected_type=Related)
|
|
343
|
+
|
|
344
|
+
__elements__ = ('tablePart',)
|
|
345
|
+
__attrs__ = ('count',)
|
|
346
|
+
|
|
347
|
+
def __init__(self,
|
|
348
|
+
count=None,
|
|
349
|
+
tablePart=(),
|
|
350
|
+
):
|
|
351
|
+
self.tablePart = tablePart
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
def append(self, part):
|
|
355
|
+
self.tablePart.append(part)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
@property
|
|
359
|
+
def count(self):
|
|
360
|
+
return len(self.tablePart)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def __bool__(self):
|
|
364
|
+
return bool(self.tablePart)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class TableList(dict):
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def add(self, table):
|
|
371
|
+
if not isinstance(table, Table):
|
|
372
|
+
raise TypeError("You can only add tables")
|
|
373
|
+
self[table.name] = table
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def get(self, name=None, table_range=None):
|
|
377
|
+
if name is not None:
|
|
378
|
+
return super().get(name)
|
|
379
|
+
for table in self.values():
|
|
380
|
+
if table_range == table.ref:
|
|
381
|
+
return table
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def items(self):
|
|
385
|
+
return [(name, table.ref) for name, table in super().items()]
|