xlwings-utils 25.0.8__py3-none-any.whl → 25.0.10__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 +24 -38
- {xlwings_utils-25.0.8.dist-info → xlwings_utils-25.0.10.dist-info}/METADATA +3 -1
- xlwings_utils-25.0.10.dist-info/RECORD +6 -0
- xlwings_utils-25.0.8.dist-info/RECORD +0 -6
- {xlwings_utils-25.0.8.dist-info → xlwings_utils-25.0.10.dist-info}/WHEEL +0 -0
- {xlwings_utils-25.0.8.dist-info → xlwings_utils-25.0.10.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.0.
|
|
8
|
+
__version__ = "25.0.10"
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
import dropbox
|
|
@@ -28,32 +28,6 @@ except ImportError:
|
|
|
28
28
|
missing = object()
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
def pythonista_environ():
|
|
32
|
-
"""
|
|
33
|
-
tries to update environment variables from the file environ.toml at top level.
|
|
34
|
-
should only be used under Pythonista
|
|
35
|
-
"""
|
|
36
|
-
try:
|
|
37
|
-
import tomlib
|
|
38
|
-
except ModuleNotFoundError:
|
|
39
|
-
import tomli as tomlib
|
|
40
|
-
from pathlib import Path
|
|
41
|
-
import os
|
|
42
|
-
|
|
43
|
-
environ_file = Path("~/Documents").expanduser() / "environ.toml"
|
|
44
|
-
with open(environ_file, "rb") as f:
|
|
45
|
-
d0 = tomlib.load(f)
|
|
46
|
-
d1 = {}
|
|
47
|
-
for k0, v0 in d0.items():
|
|
48
|
-
if isinstance(v0, dict):
|
|
49
|
-
for k1, v1 in v0.items():
|
|
50
|
-
d1[f"{k0}.{k1}".upper()] = v1
|
|
51
|
-
else:
|
|
52
|
-
d1[k0.upper()] = v0
|
|
53
|
-
|
|
54
|
-
os.environ.update(d1)
|
|
55
|
-
|
|
56
|
-
|
|
57
31
|
def dropbox_init(refresh_token=missing, app_key=missing, app_secret=missing, **kwargs):
|
|
58
32
|
"""
|
|
59
33
|
dropbox initialize
|
|
@@ -87,9 +61,6 @@ def dropbox_init(refresh_token=missing, app_key=missing, app_secret=missing, **k
|
|
|
87
61
|
"""
|
|
88
62
|
global dbx
|
|
89
63
|
|
|
90
|
-
if Pythonista:
|
|
91
|
-
pythonista_environ()
|
|
92
|
-
|
|
93
64
|
if refresh_token is missing:
|
|
94
65
|
if "DROPBOX.REFRESH_TOKEN" in os.environ:
|
|
95
66
|
refresh_token = os.environ["DROPBOX.REFRESH_TOKEN"]
|
|
@@ -307,6 +278,8 @@ class block:
|
|
|
307
278
|
self.dict = {}
|
|
308
279
|
self.number_of_rows = number_of_rows
|
|
309
280
|
self.number_of_columns = number_of_columns
|
|
281
|
+
self._highest_used_row_number = None
|
|
282
|
+
self._highest_used_column_number = None
|
|
310
283
|
|
|
311
284
|
def __eq__(self, other):
|
|
312
285
|
if isinstance(other, block):
|
|
@@ -489,8 +462,14 @@ class block:
|
|
|
489
462
|
if value is None:
|
|
490
463
|
if (row, column) in self.dict:
|
|
491
464
|
del self.dict[row, column]
|
|
465
|
+
self._highest_used_row_number = None # invalidate cached value
|
|
466
|
+
self._highest_used_column_number = None # invalidate cached value
|
|
492
467
|
else:
|
|
493
468
|
self.dict[row, column] = value
|
|
469
|
+
if self._highest_used_row_number:
|
|
470
|
+
self._highest_used_row_number = max(self._highest_used_row_number, row)
|
|
471
|
+
if self._highest_used_column_number:
|
|
472
|
+
self._highest_used_column_number = max(self._highest_used_column_number, column)
|
|
494
473
|
|
|
495
474
|
def __getitem__(self, row_column):
|
|
496
475
|
row, column = row_column
|
|
@@ -517,6 +496,7 @@ class block:
|
|
|
517
496
|
def number_of_rows(self, value):
|
|
518
497
|
if value < 1:
|
|
519
498
|
raise ValueError(f"number_of_rows should be >=1, not {value}")
|
|
499
|
+
self._highest_used_row_number = None
|
|
520
500
|
self._number_of_rows = value
|
|
521
501
|
for row, column in list(self.dict):
|
|
522
502
|
if row > self._number_of_rows:
|
|
@@ -530,6 +510,7 @@ class block:
|
|
|
530
510
|
def number_of_columns(self, value):
|
|
531
511
|
if value < 1:
|
|
532
512
|
raise ValueError(f"number_of_columns should be >=1, not {value}")
|
|
513
|
+
self._highest_used_column_number = None
|
|
533
514
|
self._number_of_columns = value
|
|
534
515
|
for row, column in list(self.dict):
|
|
535
516
|
if column > self._number_of_columns:
|
|
@@ -537,17 +518,22 @@ class block:
|
|
|
537
518
|
|
|
538
519
|
@property
|
|
539
520
|
def highest_used_row_number(self):
|
|
540
|
-
if self.
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
521
|
+
if not self._highest_used_row_number:
|
|
522
|
+
if self.dict:
|
|
523
|
+
self._highest_used_row_number = max(row for (row, column) in self.dict)
|
|
524
|
+
else:
|
|
525
|
+
self._highest_used_row_number = 1
|
|
526
|
+
return self._highest_used_row_number
|
|
544
527
|
|
|
545
528
|
@property
|
|
546
529
|
def highest_used_column_number(self):
|
|
547
|
-
if self.
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
530
|
+
if not self._highest_used_column_number:
|
|
531
|
+
if self.dict:
|
|
532
|
+
self._highest_used_column_number = max(column for (row, column) in self.dict)
|
|
533
|
+
else:
|
|
534
|
+
self._highest_used_column_number = 1
|
|
535
|
+
|
|
536
|
+
return self._highest_used_column_number
|
|
551
537
|
|
|
552
538
|
def __repr__(self):
|
|
553
539
|
return f"block({self.value})"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xlwings_utils
|
|
3
|
-
Version: 25.0.
|
|
3
|
+
Version: 25.0.10
|
|
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
|
|
@@ -61,6 +61,8 @@ In order to make a Dropbox app, and get the required environment variables, just
|
|
|
61
61
|
python -c "exec(__import__('requests').get('https://salabim.org/dropbox setup.py').text)"
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
The file `dropbox setup.py` can also be found in the repo of xlwings_lite .
|
|
65
|
+
|
|
64
66
|
Then, it is possible to list all files in a specified folder using the list_dropbox function.
|
|
65
67
|
It is also possible to get at all folders and to access all underlying folders.
|
|
66
68
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
|
|
2
|
+
xlwings_utils/xlwings_utils.py,sha256=d4qgsb-65sSLifCallOuAtSHsYhBZx5rCfC5hsvCAgw,28891
|
|
3
|
+
xlwings_utils-25.0.10.dist-info/METADATA,sha256=8n4lu4bgA1E-6sI0sWCY3Z8aaoq-UH-IarF7nQXdgkg,12527
|
|
4
|
+
xlwings_utils-25.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
xlwings_utils-25.0.10.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
|
|
6
|
+
xlwings_utils-25.0.10.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
|
|
2
|
-
xlwings_utils/xlwings_utils.py,sha256=HNip6tVo2sxhlysNm2zWVRY2bciWUujpzN-NmISUOiM,28690
|
|
3
|
-
xlwings_utils-25.0.8.dist-info/METADATA,sha256=KwS8dQNtM4n95zj2EXYaQfZFXMGga8MkQKVchmCQO9w,12447
|
|
4
|
-
xlwings_utils-25.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
xlwings_utils-25.0.8.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
|
|
6
|
-
xlwings_utils-25.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|