xlwings-utils 25.0.0.post3__py3-none-any.whl → 25.0.0.post5__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.

@@ -636,7 +636,7 @@ class block:
636
636
  return self.vlookup(s, row_from=row_from, row_to=row_to, column1=column1, column2=column2)
637
637
 
638
638
 
639
- class _capture:
639
+ class Capture:
640
640
  """
641
641
  specifies how to capture stdout
642
642
 
@@ -655,9 +655,10 @@ class _capture:
655
655
  ...
656
656
  """
657
657
 
658
- def __init__(self):
658
+ def __init__(self, enabled=True, include_print=False):
659
659
  self.stdout = sys.stdout
660
- self._include_print = False
660
+ self._include_print = include_print
661
+ self.enabled=enabled
661
662
  self._buffer = []
662
663
 
663
664
  def __enter__(self):
@@ -721,15 +722,6 @@ class _capture:
721
722
  self._include_print = value
722
723
 
723
724
 
724
- def reset():
725
- capture.enabled = False
726
- capture.include_print = False
727
- capture.clear()
728
- print('reset',sys.stdout)
729
-
730
- capture = _capture()
731
-
732
-
733
725
  if __name__ == "__main__":
734
726
  ...
735
727
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlwings_utils
3
- Version: 25.0.0.post3
3
+ Version: 25.0.0.post5
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
@@ -30,6 +30,16 @@ In the script, add
30
30
  >
31
31
  > The GitHub repository can be found on https://github.com/salabim/xlwings_utils .
32
32
 
33
+ General
34
+
35
+ It is recommended to put
36
+
37
+ ```
38
+ import xlwings_utils as xwu
39
+ ```
40
+
41
+ at the top of a xlwings lite script.
42
+
33
43
  ## Dropbox support
34
44
 
35
45
  The xlwings lite system does not provide access to the local file system. With this module, files can be copied between Dropbox and the local pyodide file system, making it possible to indirectly use the local file system.
@@ -50,15 +60,15 @@ The functions `list_local`, `read_local` and `write_local` offer similar functio
50
60
  So, a way to access a file on the system's drive (mapped to Dropbox) as a local file is:
51
61
 
52
62
  ```
53
- contents = xlwings_utils.read_dropbox('/downloads/file1.xls')
54
- xlwings_utils.write_local('file1.xlsx')
63
+ contents = xwu.read_dropbox('/downloads/file1.xls')
64
+ xwu.write_local('file1.xlsx')
55
65
  df = pandas.read_excel"file1.xlsx")
56
66
  ...
57
67
  ```
58
68
  And the other direction:
59
69
  ```
60
- contents = xlwings_utils.read_local('file1.gif')
61
- xlwings_utils.write_dropbox('/downloads/file1.gif')
70
+ contents = xwu.read_local('file1.gif')
71
+ xwu.write_dropbox('/downloads/file1.gif')
62
72
  ```
63
73
 
64
74
  ## Block support
@@ -89,7 +99,7 @@ It is not allowed t,o read or write outside the block dimensions.
89
99
 
90
100
  It is also possible to define an empty block, like
91
101
  ```
92
- block = xlwings_utils.block(number_of_rows, number_columns)
102
+ block = xwu.block(number_of_rows, number_columns)
93
103
  ```
94
104
  The dimensions can be queried or redefined with `block.number_of_rows` and
95
105
  `block.number_of_columns`.
@@ -191,12 +201,35 @@ The module has support for capturing stdout and -later- using showing the captur
191
201
 
192
202
  This is rather important as printing in xlwings lite to the UI pane is rather slow.
193
203
 
194
- In order to capture stdout output, use `xwu.capture.enabled = True`. And to stop capturing, use `xwu.capture.enabled = False`.
204
+ In order to capture stdout output, it is required to first issue
205
+
206
+ ```caoture
207
+ capture = xwu.Capture()
208
+ ```
209
+
210
+ By this, capture is automatically enabled and print is disabled. Alternatively, it is possible to use
211
+
212
+ ```
213
+ capture = xwu.Capture(enabled=False)
214
+ ```
215
+
216
+ to disable the capture. And with
217
+
218
+ ```
219
+ capture = xwu.Capture(include_print=True)
220
+ ```
221
+
222
+ the stdout output is captured and printed.
223
+
224
+ Capturing van be enabled and disabled at any time with `capture.enbaled = True` and `capture.enabled = False`.
225
+
226
+ And including print likewise with `capture.include_print`.
227
+
195
228
  Alternatively, a context manager is provided:
196
229
 
197
230
 
198
231
  ```
199
- with xwu.capture:
232
+ with capture:
200
233
  """
201
234
  code with print statements
202
235
  """
@@ -206,17 +239,15 @@ Note that stopping the capture, leaves the captured output in place, so it can b
206
239
  In either case, the captured output can be then copied to a sheet, like
207
240
 
208
241
  ```
209
- sheet.range(4,5).value = xwu.capture.value
242
+ sheet.range(4,5).value = capture.value
210
243
  ```
211
244
  Upon reading the value, the capture buffer will be emptied.
212
245
 
213
- If you don't want the buffer to be emptied after accessing the value, use `xwu.capture.value_keep`.
214
-
215
- The capture buffer can also be retrieved as a string with `xwu.capture.str` and `xwu.capture.str_keep`.
246
+ If you don't want the buffer to be emptied after accessing the value, use `capture.value_keep`.
216
247
 
217
- Clearing the captured stdout buffer can be done at any time with `xwu.capture.clear()`.
248
+ The capture buffer can also be retrieved as a string with `capture.str` and `capture.str_keep`.
218
249
 
219
- Normally, stdout will not be sent to the xlwings lite UI panel when captured with the `xwu.capture` context manager. However, if you specify `xwu.capture.include_print = True`, the output will be sent to the UI panel as well. Note that this setting remains active until a `xwu.capture.include_print = False` is issued.
250
+ Clearing the captured stdout buffer can be done at any time with `capture.clear()`.
220
251
 
221
252
 
222
253
  ## Contact info
@@ -0,0 +1,6 @@
1
+ xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
2
+ xlwings_utils/xlwings_utils.py,sha256=X_EAhFGojjiAUIia11YhMu8B7H6NXKRUtINN20cI2x4,20961
3
+ xlwings_utils-25.0.0.post5.dist-info/METADATA,sha256=7uEqHmrhgVwHhfB3ZoDNbMR-7UEk9jCHBIg1_xmxf_k,9713
4
+ xlwings_utils-25.0.0.post5.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
5
+ xlwings_utils-25.0.0.post5.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
6
+ xlwings_utils-25.0.0.post5.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
2
- xlwings_utils/xlwings_utils.py,sha256=o1iCbb5BmXDeVelksKNTJrSkGZ7e0y-iwnYlITKr3dQ,21039
3
- xlwings_utils-25.0.0.post3.dist-info/METADATA,sha256=Mwx61halKRiHZAvXI5eoSrLiV5lqUCwKVkZu-tZ3P5E,9537
4
- xlwings_utils-25.0.0.post3.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
5
- xlwings_utils-25.0.0.post3.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
6
- xlwings_utils-25.0.0.post3.dist-info/RECORD,,