tdrpa.tdworker 1.2.13.2__py312-none-win_amd64.whl
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.
- tdrpa/_tdxlwings/__init__.py +193 -0
- tdrpa/_tdxlwings/__pycache__/__init__.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/__init__.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/_win32patch.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/_win32patch.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/_xlwindows.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/_xlwindows.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/apps.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/apps.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/base_classes.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/base_classes.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/com_server.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/com_server.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/constants.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/constants.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/expansion.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/expansion.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/main.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/main.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/udfs.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/udfs.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/utils.cpython-311.pyc +0 -0
- tdrpa/_tdxlwings/__pycache__/utils.cpython-38.pyc +0 -0
- tdrpa/_tdxlwings/_win32patch.py +90 -0
- tdrpa/_tdxlwings/_xlmac.py +2240 -0
- tdrpa/_tdxlwings/_xlwindows.py +2518 -0
- tdrpa/_tdxlwings/addin/Dictionary.cls +474 -0
- tdrpa/_tdxlwings/addin/IWebAuthenticator.cls +71 -0
- tdrpa/_tdxlwings/addin/WebClient.cls +772 -0
- tdrpa/_tdxlwings/addin/WebHelpers.bas +3203 -0
- tdrpa/_tdxlwings/addin/WebRequest.cls +875 -0
- tdrpa/_tdxlwings/addin/WebResponse.cls +453 -0
- tdrpa/_tdxlwings/addin/xlwings.xlam +0 -0
- tdrpa/_tdxlwings/apps.py +35 -0
- tdrpa/_tdxlwings/base_classes.py +1092 -0
- tdrpa/_tdxlwings/cli.py +1306 -0
- tdrpa/_tdxlwings/com_server.py +385 -0
- tdrpa/_tdxlwings/constants.py +3080 -0
- tdrpa/_tdxlwings/conversion/__init__.py +103 -0
- tdrpa/_tdxlwings/conversion/framework.py +147 -0
- tdrpa/_tdxlwings/conversion/numpy_conv.py +34 -0
- tdrpa/_tdxlwings/conversion/pandas_conv.py +184 -0
- tdrpa/_tdxlwings/conversion/standard.py +321 -0
- tdrpa/_tdxlwings/expansion.py +83 -0
- tdrpa/_tdxlwings/ext/__init__.py +3 -0
- tdrpa/_tdxlwings/ext/sql.py +73 -0
- tdrpa/_tdxlwings/html/xlwings-alert.html +71 -0
- tdrpa/_tdxlwings/js/xlwings.js +577 -0
- tdrpa/_tdxlwings/js/xlwings.ts +729 -0
- tdrpa/_tdxlwings/mac_dict.py +6399 -0
- tdrpa/_tdxlwings/main.py +5205 -0
- tdrpa/_tdxlwings/mistune/__init__.py +63 -0
- tdrpa/_tdxlwings/mistune/block_parser.py +366 -0
- tdrpa/_tdxlwings/mistune/inline_parser.py +216 -0
- tdrpa/_tdxlwings/mistune/markdown.py +84 -0
- tdrpa/_tdxlwings/mistune/renderers.py +220 -0
- tdrpa/_tdxlwings/mistune/scanner.py +121 -0
- tdrpa/_tdxlwings/mistune/util.py +41 -0
- tdrpa/_tdxlwings/pro/__init__.py +40 -0
- tdrpa/_tdxlwings/pro/_xlcalamine.py +536 -0
- tdrpa/_tdxlwings/pro/_xlofficejs.py +146 -0
- tdrpa/_tdxlwings/pro/_xlremote.py +1293 -0
- tdrpa/_tdxlwings/pro/custom_functions_code.js +150 -0
- tdrpa/_tdxlwings/pro/embedded_code.py +60 -0
- tdrpa/_tdxlwings/pro/udfs_officejs.py +549 -0
- tdrpa/_tdxlwings/pro/utils.py +199 -0
- tdrpa/_tdxlwings/quickstart.xlsm +0 -0
- tdrpa/_tdxlwings/quickstart_addin.xlam +0 -0
- tdrpa/_tdxlwings/quickstart_addin_ribbon.xlam +0 -0
- tdrpa/_tdxlwings/quickstart_fastapi/main.py +47 -0
- tdrpa/_tdxlwings/quickstart_fastapi/requirements.txt +3 -0
- tdrpa/_tdxlwings/quickstart_standalone.xlsm +0 -0
- tdrpa/_tdxlwings/reports.py +12 -0
- tdrpa/_tdxlwings/rest/__init__.py +1 -0
- tdrpa/_tdxlwings/rest/api.py +368 -0
- tdrpa/_tdxlwings/rest/serializers.py +103 -0
- tdrpa/_tdxlwings/server.py +14 -0
- tdrpa/_tdxlwings/udfs.py +775 -0
- tdrpa/_tdxlwings/utils.py +777 -0
- tdrpa/_tdxlwings/xlwings-0.31.6.applescript +30 -0
- tdrpa/_tdxlwings/xlwings.bas +2061 -0
- tdrpa/_tdxlwings/xlwings_custom_addin.bas +2042 -0
- tdrpa/_tdxlwings/xlwingslib.cp38-win_amd64.pyd +0 -0
- tdrpa/tdworker/__init__.pyi +12 -0
- tdrpa/tdworker/_clip.pyi +50 -0
- tdrpa/tdworker/_excel.pyi +743 -0
- tdrpa/tdworker/_file.pyi +77 -0
- tdrpa/tdworker/_img.pyi +226 -0
- tdrpa/tdworker/_network.pyi +94 -0
- tdrpa/tdworker/_os.pyi +47 -0
- tdrpa/tdworker/_sp.pyi +21 -0
- tdrpa/tdworker/_w.pyi +129 -0
- tdrpa/tdworker/_web.pyi +995 -0
- tdrpa/tdworker/_winE.pyi +228 -0
- tdrpa/tdworker/_winK.pyi +74 -0
- tdrpa/tdworker/_winM.pyi +117 -0
- tdrpa/tdworker.cp312-win_amd64.pyd +0 -0
- tdrpa_tdworker-1.2.13.2.dist-info/METADATA +38 -0
- tdrpa_tdworker-1.2.13.2.dist-info/RECORD +101 -0
- tdrpa_tdworker-1.2.13.2.dist-info/WHEEL +5 -0
- tdrpa_tdworker-1.2.13.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,150 @@
|
|
1
|
+
/**
|
2
|
+
* Required Notice: Copyright (C) Zoomer Analytics GmbH.
|
3
|
+
*
|
4
|
+
* xlwings PRO is dual-licensed under one of the following licenses:
|
5
|
+
*
|
6
|
+
* * PolyForm Noncommercial License 1.0.0 (for noncommercial use):
|
7
|
+
* https://polyformproject.org/licenses/noncommercial/1.0.0
|
8
|
+
* * xlwings PRO License (for commercial use):
|
9
|
+
* https://github.com/xlwings/xlwings/blob/main/LICENSE_PRO.txt
|
10
|
+
*
|
11
|
+
* Commercial licenses can be purchased at https://www.xlwings.org
|
12
|
+
*/
|
13
|
+
|
14
|
+
const debug = false;
|
15
|
+
let invocations = new Set();
|
16
|
+
let bodies = new Set();
|
17
|
+
let runtime;
|
18
|
+
let contentLanguage;
|
19
|
+
|
20
|
+
Office.onReady(function (info) {
|
21
|
+
// Socket.io
|
22
|
+
const socket = globalThis.socket ? globalThis.socket : null;
|
23
|
+
|
24
|
+
if (socket !== null) {
|
25
|
+
socket.on("disconnect", () => {
|
26
|
+
if (debug) {
|
27
|
+
console.log("disconnect");
|
28
|
+
}
|
29
|
+
for (let invocation of invocations) {
|
30
|
+
invocation.setResult([["Stream disconnected"]]);
|
31
|
+
}
|
32
|
+
invocations.clear();
|
33
|
+
});
|
34
|
+
|
35
|
+
socket.on("connect", () => {
|
36
|
+
// Without this, you'd have to hit Ctrl+Alt+F9, which isn't available on the web
|
37
|
+
if (debug) {
|
38
|
+
console.log("connect");
|
39
|
+
}
|
40
|
+
for (let body of bodies) {
|
41
|
+
socket.emit("xlwings:function-call", body);
|
42
|
+
}
|
43
|
+
});
|
44
|
+
}
|
45
|
+
|
46
|
+
// Runtime version
|
47
|
+
if (
|
48
|
+
Office.context.requirements.isSetSupported("CustomFunctionsRuntime", "1.4")
|
49
|
+
) {
|
50
|
+
runtime = "1.4";
|
51
|
+
} else if (
|
52
|
+
Office.context.requirements.isSetSupported("CustomFunctionsRuntime", "1.3")
|
53
|
+
) {
|
54
|
+
runtime = "1.3";
|
55
|
+
} else if (
|
56
|
+
Office.context.requirements.isSetSupported("CustomFunctionsRuntime", "1.2")
|
57
|
+
) {
|
58
|
+
runtime = "1.2";
|
59
|
+
} else {
|
60
|
+
runtime = "1.1";
|
61
|
+
}
|
62
|
+
|
63
|
+
// Content Language
|
64
|
+
contentLanguage = Office.context.contentLanguage;
|
65
|
+
});
|
66
|
+
|
67
|
+
async function base() {
|
68
|
+
// Arguments
|
69
|
+
let argsArr = Array.prototype.slice.call(arguments);
|
70
|
+
let funcName = argsArr[0];
|
71
|
+
let isStreaming = argsArr[1];
|
72
|
+
let args = argsArr.slice(2, -1);
|
73
|
+
let invocation = argsArr[argsArr.length - 1];
|
74
|
+
|
75
|
+
// Body
|
76
|
+
let body = {
|
77
|
+
func_name: funcName,
|
78
|
+
args: args,
|
79
|
+
caller_address: invocation.address, // not available for streaming functions
|
80
|
+
content_language: contentLanguage,
|
81
|
+
version: "placeholder_xlwings_version",
|
82
|
+
runtime: runtime,
|
83
|
+
};
|
84
|
+
|
85
|
+
// Streaming functions communicate via socket.io
|
86
|
+
if (isStreaming) {
|
87
|
+
if (socket === null) {
|
88
|
+
console.error(
|
89
|
+
"To enable streaming functions, you need to load the socket.io js client before xlwings.min.js and custom-functions-code"
|
90
|
+
);
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
let taskKey = `${funcName}_${args}`;
|
94
|
+
body.task_key = taskKey;
|
95
|
+
socket.emit("xlwings:function-call", body);
|
96
|
+
if (debug) {
|
97
|
+
console.log(`emit xlwings:function-call ${funcName}`);
|
98
|
+
}
|
99
|
+
invocation.setResult([["Waiting for stream..."]]);
|
100
|
+
|
101
|
+
socket.off(`xlwings:set-result-${taskKey}`);
|
102
|
+
socket.on(`xlwings:set-result-${taskKey}`, (data) => {
|
103
|
+
invocation.setResult(data.result);
|
104
|
+
if (debug) {
|
105
|
+
console.log(`Set Result`);
|
106
|
+
}
|
107
|
+
});
|
108
|
+
|
109
|
+
invocations.add(invocation);
|
110
|
+
bodies.add(body);
|
111
|
+
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
|
115
|
+
// Normal functions communicate via REST API
|
116
|
+
let headers = {};
|
117
|
+
headers["Content-Type"] = "application/json";
|
118
|
+
headers["Authorization"] =
|
119
|
+
typeof globalThis.getAuth === "function" ? await globalThis.getAuth() : "";
|
120
|
+
|
121
|
+
let response = await fetch(
|
122
|
+
window.location.origin + "placeholder_custom_functions_call_path",
|
123
|
+
{
|
124
|
+
method: "POST",
|
125
|
+
headers: headers,
|
126
|
+
body: JSON.stringify(body),
|
127
|
+
}
|
128
|
+
);
|
129
|
+
if (response.status !== 200) {
|
130
|
+
let errMsg = await response.text();
|
131
|
+
// Error message is only visible by hovering over the error flag!
|
132
|
+
if (
|
133
|
+
Office.context.requirements.isSetSupported(
|
134
|
+
"CustomFunctionsRuntime",
|
135
|
+
"1.2"
|
136
|
+
)
|
137
|
+
) {
|
138
|
+
let error = new CustomFunctions.Error(
|
139
|
+
CustomFunctions.ErrorCode.invalidValue,
|
140
|
+
errMsg
|
141
|
+
);
|
142
|
+
throw error;
|
143
|
+
} else {
|
144
|
+
return [[errMsg]];
|
145
|
+
}
|
146
|
+
} else {
|
147
|
+
let responseData = await response.json();
|
148
|
+
return responseData.result;
|
149
|
+
}
|
150
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"""
|
2
|
+
Required Notice: Copyright (C) Zoomer Analytics GmbH.
|
3
|
+
|
4
|
+
xlwings PRO is dual-licensed under one of the following licenses:
|
5
|
+
|
6
|
+
* PolyForm Noncommercial License 1.0.0 (for noncommercial use):
|
7
|
+
https://polyformproject.org/licenses/noncommercial/1.0.0
|
8
|
+
* xlwings PRO License (for commercial use):
|
9
|
+
https://github.com/xlwings/xlwings/blob/main/LICENSE_PRO.txt
|
10
|
+
|
11
|
+
Commercial licenses can be purchased at https://www.xlwings.org
|
12
|
+
"""
|
13
|
+
|
14
|
+
import json
|
15
|
+
import os
|
16
|
+
import sys
|
17
|
+
from functools import lru_cache
|
18
|
+
from pathlib import Path
|
19
|
+
|
20
|
+
from ..main import Book
|
21
|
+
from ..utils import read_config_sheet
|
22
|
+
from .utils import LicenseHandler, get_embedded_code_temp_dir
|
23
|
+
|
24
|
+
LicenseHandler.validate_license("pro")
|
25
|
+
|
26
|
+
|
27
|
+
@lru_cache()
|
28
|
+
def dump_embedded_code(book, target_dir):
|
29
|
+
code_map = read_config_sheet(book).get("RELEASE_EMBED_CODE_MAP", "{}")
|
30
|
+
sheetname_to_path = json.loads(code_map)
|
31
|
+
for sheet in book.sheets:
|
32
|
+
if sheet.name.endswith(".py"):
|
33
|
+
last_cell = sheet.used_range.last_cell
|
34
|
+
sheet_content = (
|
35
|
+
sheet.range((1, 1), (last_cell.row, 1)).options(ndim=1).value
|
36
|
+
)
|
37
|
+
if sheetname_to_path:
|
38
|
+
(Path(target_dir) / sheetname_to_path[sheet.name]).parent.mkdir(
|
39
|
+
exist_ok=True
|
40
|
+
)
|
41
|
+
with open(
|
42
|
+
os.path.join(
|
43
|
+
target_dir,
|
44
|
+
sheetname_to_path[sheet.name] if sheetname_to_path else sheet.name,
|
45
|
+
),
|
46
|
+
"w",
|
47
|
+
encoding="utf-8",
|
48
|
+
newline="\n",
|
49
|
+
) as f:
|
50
|
+
for row in sheet_content:
|
51
|
+
if row is None:
|
52
|
+
f.write("\n")
|
53
|
+
else:
|
54
|
+
f.write(row + "\n")
|
55
|
+
sys.path[0:0] = [target_dir]
|
56
|
+
|
57
|
+
|
58
|
+
def runpython_embedded_code(command):
|
59
|
+
dump_embedded_code(Book.caller(), get_embedded_code_temp_dir())
|
60
|
+
exec(command)
|