xlwings-utils 0.0.1__tar.gz → 0.0.3__tar.gz
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-0.0.1 → xlwings_utils-0.0.3}/PKG-INFO +2 -2
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/README.md +1 -1
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/pyproject.toml +1 -1
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils/xlwings_utils.py +75 -3
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils.egg-info/PKG-INFO +2 -2
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/setup.cfg +0 -0
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils/__init__.py +0 -0
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils.egg-info/SOURCES.txt +0 -0
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils.egg-info/dependency_links.txt +0 -0
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils.egg-info/requires.txt +0 -0
- {xlwings_utils-0.0.1 → xlwings_utils-0.0.3}/xlwings_utils.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xlwings_utils
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
@@ -15,7 +15,7 @@ Requires-Dist: dropbox
|
|
|
15
15
|
|
|
16
16
|
## Introduction
|
|
17
17
|
|
|
18
|
-
This module provides some useful
|
|
18
|
+
This module provides some useful functions to be used in xlwings lite.
|
|
19
19
|
The xlwings lite system does not provide access to the local file system. With this
|
|
20
20
|
module, files can be copied between dropbox and the pyodide file systen. And
|
|
21
21
|
therefore, it is possible to indirectly use the local file system.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
This module provides some useful
|
|
5
|
+
This module provides some useful functions to be used in xlwings lite.
|
|
6
6
|
The xlwings lite system does not provide access to the local file system. With this
|
|
7
7
|
module, files can be copied between dropbox and the pyodide file systen. And
|
|
8
8
|
therefore, it is possible to indirectly use the local file system.
|
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
# /_/\_\|_| \_/\_/ |_||_| |_| \__, ||___/ _____ \__,_| \__||_||_||___/
|
|
6
6
|
# |___/ |_____|
|
|
7
7
|
|
|
8
|
-
__version__ = "0.0.
|
|
8
|
+
__version__ = "0.0.3"
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
import dropbox
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
import sys
|
|
14
|
+
import os
|
|
14
15
|
|
|
15
16
|
_captured_stdout = []
|
|
16
17
|
dbx = None
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
def dropbox_init(refresh_token, app_key, app_secret):
|
|
20
|
+
def dropbox_init(refresh_token=None, app_key=None, app_secret=None):
|
|
20
21
|
'''
|
|
21
22
|
dropbox initialize
|
|
22
23
|
|
|
@@ -26,18 +27,31 @@ def dropbox_init(refresh_token, app_key, app_secret):
|
|
|
26
27
|
----------
|
|
27
28
|
refresh_token : str
|
|
28
29
|
oauth2 refreshntoken
|
|
30
|
+
|
|
31
|
+
if omitted: use the environment variable REFRESH_TOKEN
|
|
29
32
|
|
|
30
33
|
app_key : str
|
|
31
34
|
app key
|
|
32
|
-
|
|
35
|
+
|
|
36
|
+
if omitted: use the environment variable APP_KEY
|
|
37
|
+
|
|
38
|
+
|
|
33
39
|
app_secret : str
|
|
34
40
|
app secret
|
|
35
41
|
|
|
42
|
+
if omitted: use the environment variable APP_SECRET
|
|
36
43
|
|
|
37
44
|
Returns
|
|
38
45
|
-------
|
|
39
46
|
-
|
|
40
47
|
'''
|
|
48
|
+
if refresh_token is None:
|
|
49
|
+
refresh_token =os.environ["REFRESH_TOKEN"]
|
|
50
|
+
if app_key is None:
|
|
51
|
+
app_key=os.environ["APP_KEY"]
|
|
52
|
+
if app_secret is None:
|
|
53
|
+
app_secret =os.environ["APP_SECRET"]
|
|
54
|
+
|
|
41
55
|
global dbx
|
|
42
56
|
dbx = dropbox.Dropbox(oauth2_refresh_token=refresh_token, app_key=app_key, app_secret=app_secret)
|
|
43
57
|
|
|
@@ -125,7 +139,65 @@ def read_pyodide(path):
|
|
|
125
139
|
path = Path(path)
|
|
126
140
|
with open(path, "rb") as f:
|
|
127
141
|
contents = f.read()
|
|
142
|
+
return contents
|
|
143
|
+
|
|
144
|
+
class block:
|
|
145
|
+
def __init__(self, number_of_rows,number_of_columns):
|
|
146
|
+
self.dict={}
|
|
147
|
+
self.number_of_columns=number_of_columns
|
|
148
|
+
self.number_of_rows=number_of_rows
|
|
149
|
+
|
|
150
|
+
@classmethod
|
|
151
|
+
def from_list_of_lists(cls, list_of_lists, column_like=False):
|
|
152
|
+
if not isinstance(list_of_lists[0],list):
|
|
153
|
+
if column_like:
|
|
154
|
+
list_of_lists=[[value] for value in list_of_lists]
|
|
155
|
+
else:
|
|
156
|
+
list_of_lists=[list_of_lists]
|
|
157
|
+
|
|
158
|
+
self=cls(0,0)
|
|
159
|
+
|
|
160
|
+
self.number_of_rows=len(list_of_lists)
|
|
161
|
+
self.number_of_columns=0
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
for row,row_contents in enumerate(list_of_lists,1):
|
|
165
|
+
for column,value in enumerate(row_contents,1):
|
|
166
|
+
if value is not None:
|
|
167
|
+
self.dict[row,column]=value
|
|
168
|
+
self.number_of_columns=max(self.number_of_columns, column)
|
|
169
|
+
return self
|
|
170
|
+
|
|
171
|
+
def __setitem__(self, row_column, value):
|
|
172
|
+
row,column=row_column
|
|
173
|
+
if row<1 or row>self.number_of_rows:
|
|
174
|
+
raise IndexError
|
|
175
|
+
if column<1 or column>self.number_of_columns:
|
|
176
|
+
raise IndexError
|
|
177
|
+
self.dict[row,column]=value
|
|
178
|
+
|
|
179
|
+
def __getitem__(self, row_column):
|
|
180
|
+
row,column=row_column
|
|
181
|
+
if row<1 or row>self.number_of_rows:
|
|
182
|
+
raise IndexError
|
|
183
|
+
if column<1 or column>self.number_of_columns:
|
|
184
|
+
raise IndexError
|
|
185
|
+
return self.dict.get((row,column))
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def as_list_of_lists(self):
|
|
189
|
+
return [[self.dict.get((row,column)) for column in range(1,self.number_of_columns+1)] for row in range(1,self.number_of_rows+1)]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
@property
|
|
193
|
+
def as_minimal_list_of_lists(self):
|
|
194
|
+
number_of_rows=max(row for row,column in self.dict)
|
|
195
|
+
number_of_columns=max(column for row,column in self.dict)
|
|
196
|
+
return [[self.dict.get((row,column)) for column in range(1,number_of_columns+1)] for row in range(1,number_of_rows+1)]
|
|
197
|
+
|
|
128
198
|
|
|
199
|
+
def __repr__(self):
|
|
200
|
+
return f"block.from_list_of_lists({self.as_list_of_lists})"
|
|
129
201
|
|
|
130
202
|
def clear_captured_stdout():
|
|
131
203
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xlwings_utils
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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
|
|
@@ -15,7 +15,7 @@ Requires-Dist: dropbox
|
|
|
15
15
|
|
|
16
16
|
## Introduction
|
|
17
17
|
|
|
18
|
-
This module provides some useful
|
|
18
|
+
This module provides some useful functions to be used in xlwings lite.
|
|
19
19
|
The xlwings lite system does not provide access to the local file system. With this
|
|
20
20
|
module, files can be copied between dropbox and the pyodide file systen. And
|
|
21
21
|
therefore, it is possible to indirectly use the local file system.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|