xlwings-utils 25.0.7.post1__tar.gz → 25.0.9__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.7.post1
3
+ Version: 25.0.9
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
@@ -51,7 +51,9 @@ The xlwings lite system does not provide access to the local file system. With t
51
51
 
52
52
  Currently, it is only possible to use full-access Dropbox apps.
53
53
 
54
- The easiest way to use the Dropbox functionality is to add the credentials to the environment variables. Add REFRESH_TOKEN, APP_KEY and APP_SECRET with their corresponding values to the environment variables. Instructions on how to get these variables can be found here.
54
+ The easiest way to use the Dropbox functionality is to add the credentials to the environment variables. Add DROPBOX.REFRESH_TOKEN,
55
+ DROPBOX.APP_KEY and DROPBOX.APP_SECRET with their corresponding values to the environment variables.
56
+ Instructions on how to get these variables can be found here.
55
57
 
56
58
  In order to make a Dropbox app, and get the required environment variables, just execute this line from the command line (shell).
57
59
 
@@ -59,8 +61,10 @@ In order to make a Dropbox app, and get the required environment variables, just
59
61
  python -c "exec(__import__('requests').get('https://salabim.org/dropbox setup.py').text)"
60
62
  ```
61
63
 
64
+ The file `dropbox setup.py` can also be found in the repo of xlwings_lite .
65
+
62
66
  Then, it is possible to list all files in a specified folder using the list_dropbox function.
63
- It is also possible to get the folders and to access all underlying folders.
67
+ It is also possible to get at all folders and to access all underlying folders.
64
68
 
65
69
  The `read_dropbox` function can be used to read the contents (bytes) of a Dropbox file. As reading from Dropbox under pyodide is rather unreliable, xlwings_utils automatically retries several times (by default 100 times). The actual number of retries can be found with `read_dropbox.retries`.
66
70
 
@@ -38,7 +38,9 @@ The xlwings lite system does not provide access to the local file system. With t
38
38
 
39
39
  Currently, it is only possible to use full-access Dropbox apps.
40
40
 
41
- The easiest way to use the Dropbox functionality is to add the credentials to the environment variables. Add REFRESH_TOKEN, APP_KEY and APP_SECRET with their corresponding values to the environment variables. Instructions on how to get these variables can be found here.
41
+ The easiest way to use the Dropbox functionality is to add the credentials to the environment variables. Add DROPBOX.REFRESH_TOKEN,
42
+ DROPBOX.APP_KEY and DROPBOX.APP_SECRET with their corresponding values to the environment variables.
43
+ Instructions on how to get these variables can be found here.
42
44
 
43
45
  In order to make a Dropbox app, and get the required environment variables, just execute this line from the command line (shell).
44
46
 
@@ -46,8 +48,10 @@ In order to make a Dropbox app, and get the required environment variables, just
46
48
  python -c "exec(__import__('requests').get('https://salabim.org/dropbox setup.py').text)"
47
49
  ```
48
50
 
51
+ The file `dropbox setup.py` can also be found in the repo of xlwings_lite .
52
+
49
53
  Then, it is possible to list all files in a specified folder using the list_dropbox function.
50
- It is also possible to get the folders and to access all underlying folders.
54
+ It is also possible to get at all folders and to access all underlying folders.
51
55
 
52
56
  The `read_dropbox` function can be used to read the contents (bytes) of a Dropbox file. As reading from Dropbox under pyodide is rather unreliable, xlwings_utils automatically retries several times (by default 100 times). The actual number of retries can be found with `read_dropbox.retries`.
53
57
 
@@ -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.7.post1"
13
+ version = "25.0.9"
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.7"
8
+ __version__ = "25.0.9"
9
9
 
10
10
 
11
11
  import dropbox
@@ -20,6 +20,8 @@ Pythonista = sys.platform == "ios"
20
20
  try:
21
21
  import xlwings
22
22
 
23
+ xlwings = True
24
+
23
25
  except ImportError:
24
26
  xlwings = False
25
27
 
@@ -32,8 +34,8 @@ def dropbox_init(refresh_token=missing, app_key=missing, app_secret=missing, **k
32
34
 
33
35
  This function may to be called prior to using any dropbox function
34
36
  to specify the request token, app key and app secret.
35
- If these are specified as REFRESH_TOKEN, APP_KEY and APP_SECRET
36
- environment variables, it is no necessary to call dropbox_init().
37
+ If these are specified as DROPBOX.REFRESH_TOKEN, DROPBOX.APP_KEY and DROPBOX.APP_SECRET
38
+ environment variables, it is not necessary to call dropbox_init().
37
39
 
38
40
  Parameters
39
41
  ----------
@@ -55,47 +57,38 @@ def dropbox_init(refresh_token=missing, app_key=missing, app_secret=missing, **k
55
57
 
56
58
  Returns
57
59
  -------
58
- -
60
+ dropbox object
59
61
  """
60
62
  global dbx
61
63
 
62
- if Pythonista:
63
- # under Pythonista, the environ is updated from the .environ.toml file, if present
64
- environ_file = Path(os.environ["HOME"]) / "Documents" / ".environ.toml"
65
-
66
- if environ_file.is_file():
67
- with open(environ_file, "r") as f:
68
- import toml
69
-
70
- d = toml.load(f)
71
- os.environ.update(d)
72
-
73
64
  if refresh_token is missing:
74
- if "REFRESH_TOKEN" in os.environ:
75
- refresh_token = os.environ["REFRESH_TOKEN"]
65
+ if "DROPBOX.REFRESH_TOKEN" in os.environ:
66
+ refresh_token = os.environ["DROPBOX.REFRESH_TOKEN"]
76
67
  else:
77
- raise ValueError("no REFRESH_TOKEN found in environment.")
68
+ raise ValueError("no DROPBOX.REFRESH_TOKEN found in environment.")
78
69
  if app_key is missing:
79
- if "APP_KEY" in os.environ:
80
- app_key = os.environ["APP_KEY"]
70
+ if "DROPBOX.APP_KEY" in os.environ:
71
+ app_key = os.environ["DROPBOX.APP_KEY"]
81
72
  else:
82
- raise ValueError("no APP_KEY found in environment.")
73
+ raise ValueError("no DROPBOX.APP_KEY found in environment.")
83
74
  if app_secret is missing:
84
- if "APP_SECRET" in os.environ:
85
- app_secret = os.environ["APP_SECRET"]
75
+ if "DROPBOX.APP_SECRET" in os.environ:
76
+ app_secret = os.environ["DROPBOX.APP_SECRET"]
86
77
  else:
87
- raise ValueError("no APP_SECRET found in environment.")
78
+ raise ValueError("no DROPBOX.APP_SECRET found in environment.")
88
79
 
89
- dbx = dropbox.Dropbox(oauth2_refresh_token=refresh_token, app_key=app_key, app_secret=app_secret, **kwargs)
80
+ _dbx = dropbox.Dropbox(oauth2_refresh_token=refresh_token, app_key=app_key, app_secret=app_secret, **kwargs)
90
81
  try:
91
- dbx.files_list_folder(path="") # just to test proper credentials
82
+ _dbx.files_list_folder(path="") # just to test proper credentials
92
83
  except dropbox.exceptions.AuthError:
93
84
  raise ValueError("invalid dropbox credentials")
85
+ return _dbx
94
86
 
95
87
 
96
88
  def _login_dbx():
89
+ global dbx
97
90
  if dbx is None:
98
- dropbox_init() # use environment
91
+ dbx = dropbox_init() # use environment
99
92
 
100
93
 
101
94
  def list_dropbox(path="", recursive=False, show_files=True, show_folders=False):
@@ -110,7 +103,7 @@ def list_dropbox(path="", recursive=False, show_files=True, show_folders=False):
110
103
  path from which to list all files (default: '')
111
104
 
112
105
  recursive : bool
113
- if True, recursively list files. if False (default) no recursion
106
+ if True, recursively list files and folders. if False (default) no recursion
114
107
 
115
108
  show_files : bool
116
109
  if True (default), show file entries
@@ -124,10 +117,6 @@ def list_dropbox(path="", recursive=False, show_files=True, show_folders=False):
124
117
  -------
125
118
  files : list
126
119
 
127
- Note
128
- ----
129
- Directory entries are never returned
130
-
131
120
  Note
132
121
  ----
133
122
  If REFRESH_TOKEN, APP_KEY and APP_SECRET environment variables are specified,
@@ -290,7 +279,7 @@ class block:
290
279
  self.number_of_rows = number_of_rows
291
280
  self.number_of_columns = number_of_columns
292
281
 
293
- def __eq__(self,other):
282
+ def __eq__(self, other):
294
283
  if isinstance(other, block):
295
284
  return self.value == other.value
296
285
  return False
@@ -469,8 +458,8 @@ class block:
469
458
  if column < 1 or column > self.number_of_columns:
470
459
  raise IndexError(f"column must be between 1 and {self.number_of_columns} not {column}")
471
460
  if value is None:
472
- if (row,column) in self.dict:
473
- del self.dict[row,column]
461
+ if (row, column) in self.dict:
462
+ del self.dict[row, column]
474
463
  else:
475
464
  self.dict[row, column] = value
476
465
 
@@ -812,12 +801,12 @@ class block:
812
801
  def decode_to_files(self):
813
802
  """
814
803
  decode the block with encoded file(s) to individual pyoidide file(s)
815
-
804
+
816
805
  Returns
817
806
  -------
818
807
  count : int
819
808
  number of files decoded
820
-
809
+
821
810
  Note
822
811
  ----
823
812
  if the block does not contain an encode file, the method just returns 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xlwings_utils
3
- Version: 25.0.7.post1
3
+ Version: 25.0.9
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
@@ -51,7 +51,9 @@ The xlwings lite system does not provide access to the local file system. With t
51
51
 
52
52
  Currently, it is only possible to use full-access Dropbox apps.
53
53
 
54
- The easiest way to use the Dropbox functionality is to add the credentials to the environment variables. Add REFRESH_TOKEN, APP_KEY and APP_SECRET with their corresponding values to the environment variables. Instructions on how to get these variables can be found here.
54
+ The easiest way to use the Dropbox functionality is to add the credentials to the environment variables. Add DROPBOX.REFRESH_TOKEN,
55
+ DROPBOX.APP_KEY and DROPBOX.APP_SECRET with their corresponding values to the environment variables.
56
+ Instructions on how to get these variables can be found here.
55
57
 
56
58
  In order to make a Dropbox app, and get the required environment variables, just execute this line from the command line (shell).
57
59
 
@@ -59,8 +61,10 @@ In order to make a Dropbox app, and get the required environment variables, just
59
61
  python -c "exec(__import__('requests').get('https://salabim.org/dropbox setup.py').text)"
60
62
  ```
61
63
 
64
+ The file `dropbox setup.py` can also be found in the repo of xlwings_lite .
65
+
62
66
  Then, it is possible to list all files in a specified folder using the list_dropbox function.
63
- It is also possible to get the folders and to access all underlying folders.
67
+ It is also possible to get at all folders and to access all underlying folders.
64
68
 
65
69
  The `read_dropbox` function can be used to read the contents (bytes) of a Dropbox file. As reading from Dropbox under pyodide is rather unreliable, xlwings_utils automatically retries several times (by default 100 times). The actual number of retries can be found with `read_dropbox.retries`.
66
70