xlwings-utils 25.1.2.post0__py3-none-any.whl → 25.1.3.post0__py3-none-any.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.
Potentially problematic release.
This version of xlwings-utils might be problematic. Click here for more details.
- xlwings_utils/xlwings_utils.py +28 -3
- {xlwings_utils-25.1.2.post0.dist-info → xlwings_utils-25.1.3.post0.dist-info}/METADATA +24 -1
- xlwings_utils-25.1.3.post0.dist-info/RECORD +6 -0
- xlwings_utils-25.1.2.post0.dist-info/RECORD +0 -6
- {xlwings_utils-25.1.2.post0.dist-info → xlwings_utils-25.1.3.post0.dist-info}/WHEEL +0 -0
- {xlwings_utils-25.1.2.post0.dist-info → xlwings_utils-25.1.3.post0.dist-info}/top_level.txt +0 -0
xlwings_utils/xlwings_utils.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# /_/\_\|_| \_/\_/ |_||_| |_| \__, ||___/ _____ \__,_| \__||_||_||___/
|
|
6
6
|
# |___/ |_____|
|
|
7
7
|
|
|
8
|
-
__version__ = "25.1.
|
|
8
|
+
__version__ = "25.1.3"
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
from pathlib import Path
|
|
@@ -15,6 +15,8 @@ import math
|
|
|
15
15
|
import base64
|
|
16
16
|
import requests
|
|
17
17
|
import json
|
|
18
|
+
import datetime
|
|
19
|
+
import functools
|
|
18
20
|
|
|
19
21
|
Pythonista = sys.platform == "ios"
|
|
20
22
|
|
|
@@ -214,7 +216,7 @@ def write_dropbox(dropbox_path, contents):
|
|
|
214
216
|
try:
|
|
215
217
|
response.raise_for_status()
|
|
216
218
|
except requests.exceptions.HTTPError as e:
|
|
217
|
-
raise FileNotFoundError(f"file {str(dropbox_path)} could not be written. Original message is {e}") from None
|
|
219
|
+
raise FileNotFoundError(f"file {str(dropbox_path)} could not be written. Original message is {e}") from None
|
|
218
220
|
|
|
219
221
|
|
|
220
222
|
def delete_from_dropbox(dropbox_path):
|
|
@@ -1041,6 +1043,29 @@ def trigger_macro(sheet):
|
|
|
1041
1043
|
sheet["A1"].value = "=NOW()"
|
|
1042
1044
|
|
|
1043
1045
|
|
|
1046
|
+
def timer(func):
|
|
1047
|
+
"""
|
|
1048
|
+
this decorator should be placed after the @xw.script decorator
|
|
1049
|
+
|
|
1050
|
+
it will show the name, entry time, exit time and the duration, like
|
|
1051
|
+
Done MyScript 11:51:13.24 - 11:51:20.28 (7.04s)
|
|
1052
|
+
|
|
1053
|
+
"""
|
|
1054
|
+
|
|
1055
|
+
@functools.wraps(func)
|
|
1056
|
+
def wrapper(*args, **kwargs):
|
|
1057
|
+
now0 = datetime.datetime.now()
|
|
1058
|
+
result = func(*args, **kwargs)
|
|
1059
|
+
now1 = datetime.datetime.now()
|
|
1060
|
+
t0 = now0.second + now0.microsecond / 1_000_000
|
|
1061
|
+
t1 = now1.second + now1.microsecond / 1_000_000
|
|
1062
|
+
print(
|
|
1063
|
+
f"Done {func.__name__} {now0:%H:%M:%S.}{int(now0.microsecond / 10000):02d} - {now1:%H:%M:%S.}{int(now1.microsecond / 10000):02d} ({t1 - t0:.2f}s)"
|
|
1064
|
+
)
|
|
1065
|
+
return result
|
|
1066
|
+
|
|
1067
|
+
return wrapper
|
|
1068
|
+
|
|
1069
|
+
|
|
1044
1070
|
if __name__ == "__main__":
|
|
1045
1071
|
...
|
|
1046
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xlwings_utils
|
|
3
|
-
Version: 25.1.
|
|
3
|
+
Version: 25.1.3.post0
|
|
4
4
|
Summary: xlwings_utils
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/xlwings_utils
|
|
@@ -322,10 +322,33 @@ Then, the file can be copied to the pyodide file system with
|
|
|
322
322
|
```
|
|
323
323
|
bl = block(xw.range((10,1),(50000,1)).decode_to_files())
|
|
324
324
|
```
|
|
325
|
+
## Miscellaneous
|
|
326
|
+
|
|
327
|
+
xlwings_utils provides a useful `timer` decorator that may be used to show the name, the entry time, the exit time and the duration of a xlwings script.
|
|
328
|
+
|
|
329
|
+
To use this, put the decorator immediately after the `xw.script` decorator, like:
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
@xw.script
|
|
333
|
+
@xwu.timer
|
|
334
|
+
def MyScript(book: xw.Book):
|
|
335
|
+
...
|
|
325
336
|
```
|
|
326
337
|
|
|
338
|
+
This will print something like:
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
Done MyScript 11:51:13.24 - 11:51:20.28 (7.04s)
|
|
327
342
|
```
|
|
328
343
|
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
329
352
|
## Contact info
|
|
330
353
|
|
|
331
354
|
You can contact Ruud van der Ham, the core developer, at ruud@salabim.org.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
|
|
2
|
+
xlwings_utils/xlwings_utils.py,sha256=ZzLhoFUGTwju91CRdZQdnHyAOc9TckKAZ1RX2veSaV0,31528
|
|
3
|
+
xlwings_utils-25.1.3.post0.dist-info/METADATA,sha256=dZJXzq9SC-Orx_fTsIP-TqXcMviXAejqZFiJ1kZ1mDw,12706
|
|
4
|
+
xlwings_utils-25.1.3.post0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
xlwings_utils-25.1.3.post0.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
|
|
6
|
+
xlwings_utils-25.1.3.post0.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
|
|
2
|
-
xlwings_utils/xlwings_utils.py,sha256=IipMDWYm6HHC0y2Y_Pdu3RV3ppxMtmehWc7uyR4u47s,30753
|
|
3
|
-
xlwings_utils-25.1.2.post0.dist-info/METADATA,sha256=gy_t8BGvlv6EKJ9_pUEa8XahoaHBmWqGrLcLiM2myJM,12271
|
|
4
|
-
xlwings_utils-25.1.2.post0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
xlwings_utils-25.1.2.post0.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
|
|
6
|
-
xlwings_utils-25.1.2.post0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|