xlwings-utils 0.0.7.post1__tar.gz → 0.0.7.post3__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.7.post1 → xlwings_utils-0.0.7.post3}/PKG-INFO +1 -1
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/pyproject.toml +1 -1
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils/xlwings_utils.py +31 -47
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/PKG-INFO +1 -1
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/README.md +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/setup.cfg +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/tests/test_xlwings_utils.py +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils/__init__.py +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/SOURCES.txt +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/dependency_links.txt +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/requires.txt +0 -0
- {xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/top_level.txt +0 -0
|
@@ -13,7 +13,7 @@ from pathlib import Path
|
|
|
13
13
|
import os
|
|
14
14
|
import sys
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
_buffer=[]
|
|
17
17
|
|
|
18
18
|
dbx = None
|
|
19
19
|
Pythonista = sys.platform == "ios"
|
|
@@ -420,64 +420,48 @@ def captured_stdout_as_value(clear=True):
|
|
|
420
420
|
return [[line] for line in captured_stdout_as_str(clear).splitlines()]
|
|
421
421
|
|
|
422
422
|
|
|
423
|
-
class handle_capture_stdout:
|
|
424
|
-
def __init__(self):
|
|
425
|
-
pass
|
|
426
423
|
|
|
427
|
-
def isatty(self):
|
|
428
|
-
return False
|
|
429
424
|
|
|
430
|
-
|
|
431
|
-
if _do_capture:
|
|
432
|
-
_buffer.append(data)
|
|
433
|
-
if _do_print:
|
|
434
|
-
_org_stdout.write(data)
|
|
435
|
-
|
|
436
|
-
def flush(self):
|
|
437
|
-
if _do_print:
|
|
438
|
-
_org_stdout.flush()
|
|
439
|
-
if _do_capture:
|
|
440
|
-
_buffer.append("\n")
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
def reset():
|
|
444
|
-
global _buffer
|
|
445
|
-
global _do_print
|
|
446
|
-
global _do_capture
|
|
447
|
-
_buffer = []
|
|
448
|
-
_do_print = True
|
|
449
|
-
_do_capture = False
|
|
450
|
-
|
|
451
|
-
sys.stdout = handle_capture_stdout()
|
|
452
|
-
reset()
|
|
453
|
-
|
|
454
|
-
def capture_stdout(do_print=True, do_capture=True, clear=True):
|
|
455
|
-
global _do_print
|
|
456
|
-
global _do_capture
|
|
425
|
+
class capture_stdout:
|
|
457
426
|
"""
|
|
458
|
-
|
|
427
|
+
specifies how to capture stdout
|
|
459
428
|
|
|
460
429
|
Parameters
|
|
461
430
|
----------
|
|
462
|
-
|
|
463
|
-
if True (default), the output is
|
|
431
|
+
include_print : bool
|
|
432
|
+
if True (default), the output is also printed out as normal
|
|
464
433
|
|
|
465
434
|
if False, no output is printed
|
|
466
435
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if False, no output is captured
|
|
436
|
+
Note
|
|
437
|
+
----
|
|
438
|
+
Use this function as a context manager, like ::
|
|
471
439
|
|
|
472
|
-
|
|
473
|
-
|
|
440
|
+
with capture_stdout():
|
|
441
|
+
...
|
|
474
442
|
"""
|
|
475
|
-
if not (do_print or do_capture):
|
|
476
|
-
raise ValueError("at least one of do_print and do_capture should be True")
|
|
477
|
-
clear_captured_stdout(clear)
|
|
478
|
-
_do_print = do_print
|
|
479
|
-
_do_capture = do_capture
|
|
480
443
|
|
|
444
|
+
def __init__(self, include_print: bool = True, clear=True):
|
|
445
|
+
self.stdout = sys.stdout
|
|
446
|
+
self.include_print = include_print
|
|
447
|
+
if clear:
|
|
448
|
+
_buffer.clear()
|
|
449
|
+
|
|
450
|
+
def __enter__(self):
|
|
451
|
+
sys.stdout = self
|
|
452
|
+
|
|
453
|
+
def __exit__(self, exc_type, exc_value, tb):
|
|
454
|
+
sys.stdout = self.stdout
|
|
455
|
+
|
|
456
|
+
def write(self, data):
|
|
457
|
+
_buffer.append(data)
|
|
458
|
+
if self.include_print:
|
|
459
|
+
self.stdout.write(data)
|
|
460
|
+
|
|
461
|
+
def flush(self):
|
|
462
|
+
if self.include_print:
|
|
463
|
+
self.stdout.flush()
|
|
464
|
+
_buffer.append("\n")
|
|
481
465
|
|
|
482
466
|
if __name__ == "__main__":
|
|
483
467
|
...
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{xlwings_utils-0.0.7.post1 → xlwings_utils-0.0.7.post3}/xlwings_utils.egg-info/top_level.txt
RENAMED
|
File without changes
|