xlwings-utils 0.0.7.post1__tar.gz → 0.0.7.post2__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlwings_utils
3
- Version: 0.0.7.post1
3
+ Version: 0.0.7.post2
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
@@ -10,7 +10,7 @@ authors = [
10
10
  { name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
11
11
  ]
12
12
  description = "xlwings_utils"
13
- version = "0.0.7.post1"
13
+ version = "0.0.7.post2"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.9"
16
16
  dependencies = [
@@ -428,32 +428,25 @@ class handle_capture_stdout:
428
428
  return False
429
429
 
430
430
  def write(self, data):
431
- if _do_capture:
432
- _buffer.append(data)
431
+ _buffer.append(data)
433
432
  if _do_print:
434
433
  _org_stdout.write(data)
435
434
 
436
435
  def flush(self):
437
436
  if _do_print:
438
437
  _org_stdout.flush()
439
- if _do_capture:
440
- _buffer.append("\n")
438
+ _buffer.append("\n")
441
439
 
442
440
 
443
441
  def reset():
444
442
  global _buffer
445
- global _do_print
446
- global _do_capture
447
- _buffer = []
448
- _do_print = True
449
- _do_capture = False
443
+ sys.stdout=_org_stdout
444
+ _buffer=[]
450
445
 
451
- sys.stdout = handle_capture_stdout()
452
446
  reset()
453
447
 
454
448
  def capture_stdout(do_print=True, do_capture=True, clear=True):
455
449
  global _do_print
456
- global _do_capture
457
450
  """
458
451
  start capture stdout
459
452
 
@@ -474,10 +467,13 @@ def capture_stdout(do_print=True, do_capture=True, clear=True):
474
467
  """
475
468
  if not (do_print or do_capture):
476
469
  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
470
 
471
+ if do_capture:
472
+ if sys.stdout is _org_stdout:
473
+ sys.stdout = handle_capture_stdout()
474
+ _do_print=do_print
475
+ else:
476
+ sys.stdout=_org_stdout
481
477
 
482
478
  if __name__ == "__main__":
483
479
  ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlwings_utils
3
- Version: 0.0.7.post1
3
+ Version: 0.0.7.post2
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