xlwings-utils 25.0.0.post5__tar.gz → 25.0.1__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: 25.0.0.post5
3
+ Version: 25.0.1
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
@@ -40,6 +40,8 @@ import xlwings_utils as xwu
40
40
 
41
41
  at the top of a xlwings lite script.
42
42
 
43
+ If an application runs under xlwings, `xwu.xlwings` will be True. False, if not.
44
+
43
45
  ## Dropbox support
44
46
 
45
47
  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.
@@ -26,6 +26,8 @@ import xlwings_utils as xwu
26
26
 
27
27
  at the top of a xlwings lite script.
28
28
 
29
+ If an application runs under xlwings, `xwu.xlwings` will be True. False, if not.
30
+
29
31
  ## Dropbox support
30
32
 
31
33
  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.
@@ -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 = "25.0.0.post5"
13
+ version = "25.0.1"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.9"
16
16
  dependencies = [
@@ -5,7 +5,7 @@
5
5
  # /_/\_\|_| \_/\_/ |_||_| |_| \__, ||___/ _____ \__,_| \__||_||_||___/
6
6
  # |___/ |_____|
7
7
 
8
- __version__ = "25.0.0"
8
+ __version__ = "25.0.1"
9
9
 
10
10
 
11
11
  import dropbox
@@ -16,7 +16,11 @@ import math
16
16
 
17
17
  dbx = None
18
18
  Pythonista = sys.platform == "ios"
19
-
19
+ try:
20
+ import xlwings
21
+ xlwings = True
22
+ except ImportError:
23
+ xlwings=False
20
24
 
21
25
  def dropbox_init(refresh_token=None, app_key=None, app_secret=None):
22
26
  """
@@ -642,25 +646,47 @@ class Capture:
642
646
 
643
647
  Parameters
644
648
  ----------
649
+ enabled : bool
650
+ if True (default), all stdout output is captured
651
+
652
+ if False, stdout output is printed
653
+
645
654
  include_print : bool
646
- if True (default), the output is also printed out as normal
655
+ if False (default), nothing will be printed if enabled is True
647
656
 
648
- if False, no output is printed
657
+ if True, output will be printed (and captured if enabled is True)
649
658
 
650
659
  Note
651
660
  ----
652
- Use this function as a context manager, like ::
661
+ Use this function, like ::
653
662
 
654
- with capture_stdout():
663
+ capture = xwu.Capture():
655
664
  ...
656
665
  """
657
666
 
658
- def __init__(self, enabled=True, include_print=False):
667
+ _instance = None
668
+
669
+ def __new__(cls, *args, **kwargs):
670
+ # singleton
671
+ if cls._instance is None:
672
+ cls._instance = super(Capture, cls).__new__(cls)
673
+ return cls._instance
674
+
675
+ def __init__(self, enabled=None, include_print=None):
676
+ if hasattr(self, "stdout"):
677
+ if enabled is not None:
678
+ self.enabled = enabled
679
+ if include_print is not None:
680
+ self.include_print = include_print
681
+ return
659
682
  self.stdout = sys.stdout
660
- self._include_print = include_print
661
- self.enabled=enabled
662
683
  self._buffer = []
684
+ self.enabled = True if enabled is None else enabled
685
+ self.include_print = False if include_print is None else include_print
663
686
 
687
+ def __call__(self, enabled=None, include_print=None):
688
+ return self.__class__(enabled, include_print)
689
+
664
690
  def __enter__(self):
665
691
  self.enabled = True
666
692
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlwings_utils
3
- Version: 25.0.0.post5
3
+ Version: 25.0.1
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
@@ -40,6 +40,8 @@ import xlwings_utils as xwu
40
40
 
41
41
  at the top of a xlwings lite script.
42
42
 
43
+ If an application runs under xlwings, `xwu.xlwings` will be True. False, if not.
44
+
43
45
  ## Dropbox support
44
46
 
45
47
  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.