xlwings-utils 0.0.1__py3-none-any.whl → 0.0.2__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.

@@ -5,7 +5,7 @@
5
5
  # /_/\_\|_| \_/\_/ |_||_| |_| \__, ||___/ _____ \__,_| \__||_||_||___/
6
6
  # |___/ |_____|
7
7
 
8
- __version__ = "0.0.1"
8
+ __version__ = "0.0.2"
9
9
 
10
10
 
11
11
  import dropbox
@@ -125,7 +125,61 @@ def read_pyodide(path):
125
125
  path = Path(path)
126
126
  with open(path, "rb") as f:
127
127
  contents = f.read()
128
+ return contents
129
+
130
+ class block:
131
+ def __init__(self, number_of_rows,number_of_columns):
132
+ self.dict={}
133
+ self.number_of_columns=number_of_columns
134
+ self.number_of_rows=number_of_rows
135
+
136
+ @classmethod
137
+ def from_list_of_lists(cls, list_of_lists, column_like=False):
138
+ if not isinstance(list_of_lists[0],list):
139
+ if column_like:
140
+ list_of_lists=[[value] for value in list_of_lists]
141
+ else:
142
+ list_of_lists=[list_of_lists]
143
+
144
+ self=cls(0,0)
145
+
146
+ self.number_of_rows=len(list_of_lists)
147
+ self.number_of_columns=0
148
+
149
+
150
+ for row,row_contents in enumerate(list_of_lists,1):
151
+ for column,value in enumerate(row_contents,1):
152
+ if value is not None:
153
+ self.dict[row,column]=value
154
+ self.number_of_columns=max(self.number_of_columns, column)
155
+ return self
156
+
157
+ def __setitem__(self, row_column, value):
158
+ row,column=row_column
159
+ if row<1 or row>self.number_of_rows:
160
+ raise IndexError
161
+ if column<1 or column>self.number_of_columns:
162
+ raise IndexError
163
+ if value is None:
164
+ del self.dict[row,column]
165
+ else:
166
+ self.dict[row,column]=value
167
+
168
+ def __getitem__(self, row_column):
169
+ row,column=row_column
170
+ if row<1 or row>self.number_of_rows:
171
+ raise IndexError
172
+ if column<1 or column>self.number_of_columns:
173
+ raise IndexError
174
+ return self.dict.get((row,column))
175
+
176
+ @property
177
+ def as_list_of_lists(self):
178
+ 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)]
179
+
128
180
 
181
+ def __repr__(self):
182
+ return f"block.from_list_of_lists({self.as_list_of_lists})"
129
183
 
130
184
  def clear_captured_stdout():
131
185
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlwings_utils
3
- Version: 0.0.1
3
+ Version: 0.0.2
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 functiona to be used in xlwings lite.
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.
@@ -0,0 +1,6 @@
1
+ xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
2
+ xlwings_utils/xlwings_utils.py,sha256=M6CkB1x9LjXIthWTlCAtN6T7c9bIPXx4HWv6s36kW9w,7060
3
+ xlwings_utils-0.0.2.dist-info/METADATA,sha256=iX4B9PHh-RmwWFG9-EeQPQ8pkycj_I5VOxCLRGukG7I,1662
4
+ xlwings_utils-0.0.2.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
5
+ xlwings_utils-0.0.2.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
6
+ xlwings_utils-0.0.2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (80.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
2
- xlwings_utils/xlwings_utils.py,sha256=vc_w_NdyfQLX4vrq0PARMtxYoFYAn39UuUzi8FqlGCc,5234
3
- xlwings_utils-0.0.1.dist-info/METADATA,sha256=3PoU8ESYGmgGQPCLj3ilC3TeeMxi8azkccGq_YEH3yU,1662
4
- xlwings_utils-0.0.1.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
5
- xlwings_utils-0.0.1.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
6
- xlwings_utils-0.0.1.dist-info/RECORD,,