Skip to content

Commit 3651864

Browse files
Add @staticmethod to dbutil stubs for better indexing (#310)
1 parent d5c8050 commit 3651864

File tree

1 file changed

+32
-0
lines changed
  • packages/databricks-vscode/resources/python/stubs/databricks/sdk

1 file changed

+32
-0
lines changed

packages/databricks-vscode/resources/python/stubs/databricks/sdk/runtime.pyi

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,19 @@ class dbutils:
5959
Utilities for interacting with credentials within notebooks
6060
"""
6161

62+
@staticmethod
6263
def assumeRole(role: str) -> bool:
6364
"""
6465
Sets the role ARN to assume when looking for credentials to authenticate with S3
6566
"""
6667
...
68+
@staticmethod
6769
def showCurrentRole() -> typing.List[str]:
6870
"""
6971
Shows the currently set role
7072
"""
7173
...
74+
@staticmethod
7275
def showRoles() -> typing.List[str]:
7376
"""
7477
Shows the set of possibly assumed roles
@@ -80,6 +83,7 @@ class dbutils:
8083
Utilities for understanding and interacting with datasets (EXPERIMENTAL)
8184
"""
8285

86+
@staticmethod
8387
def summarize(df: any, precise: bool) -> None:
8488
"""
8589
Summarize a Spark DataFrame and visualize the statistics to get quick insights
@@ -91,41 +95,49 @@ class dbutils:
9195
Manipulates the Databricks filesystem (DBFS) from the console
9296
"""
9397

98+
@staticmethod
9499
def cp(from_: str, to: str, recurse: bool = False) -> bool:
95100
"""
96101
Copies a file or directory, possibly across FileSystems
97102
"""
98103
...
104+
@staticmethod
99105
def head(file: str, maxBytes: int = 65536) -> str:
100106
"""
101107
Returns up to the first 'maxBytes' bytes of the given file as a String encoded in UTF-8
102108
"""
103109
...
110+
@staticmethod
104111
def ls(dir: str) -> typing.List[str]:
105112
"""
106113
Lists the contents of a directory
107114
"""
108115
...
116+
@staticmethod
109117
def mkdirs(dir: str) -> bool:
110118
"""
111119
Creates the given directory if it does not exist, also creating any necessary parent directories
112120
"""
113121
...
122+
@staticmethod
114123
def mv(from_: str, to: str, recurse: bool = False) -> bool:
115124
"""
116125
Moves a file or directory, possibly across FileSystems
117126
"""
118127
...
128+
@staticmethod
119129
def put(file: str, contents: str, overwrite: bool = False) -> bool:
120130
"""
121131
Writes the given String out to a file, encoded in UTF-8
122132
"""
123133
...
134+
@staticmethod
124135
def rm(dir: str, recurse: bool = False) -> bool:
125136
"""
126137
Removes a file or directory
127138
"""
128139
...
140+
@staticmethod
129141
def mount(
130142
source: str,
131143
mountPoint: str,
@@ -137,11 +149,13 @@ class dbutils:
137149
Mounts the given source directory into DBFS at the given mount point
138150
"""
139151
...
152+
@staticmethod
140153
def unmount(mountPoint: str) -> bool:
141154
"""
142155
Deletes a DBFS mount point
143156
"""
144157
...
158+
@staticmethod
145159
def updateMount(
146160
source: str,
147161
mountPoint: str,
@@ -153,11 +167,13 @@ class dbutils:
153167
Similar to mount(), but updates an existing mount point (if present) instead of creating a new one
154168
"""
155169
...
170+
@staticmethod
156171
def mounts() -> typing.List[str]:
157172
"""
158173
Displays information about what is mounted within DBFS
159174
"""
160175
...
176+
@staticmethod
161177
def refreshMounts() -> bool:
162178
"""
163179
Forces all machines in this cluster to refresh their mount cache, ensuring they receive the most recent information
@@ -174,13 +190,15 @@ class dbutils:
174190
Provides utilities for leveraging job task values
175191
"""
176192

193+
@staticmethod
177194
def get(
178195
taskKey: str, key: str, default: any = None, debugValue: any = None
179196
) -> None:
180197
"""
181198
Returns the latest task value that belongs to the current job run
182199
"""
183200
...
201+
@staticmethod
184202
def set(key: str, value: any) -> None:
185203
"""
186204
Sets a task value on the current task run
@@ -192,6 +210,7 @@ class dbutils:
192210
Utilities for session isolated libraries
193211
"""
194212

213+
@staticmethod
195214
def restartPython() -> None:
196215
"""
197216
Restart python process for the current notebook session
@@ -203,11 +222,13 @@ class dbutils:
203222
Utilities for the control flow of a notebook (EXPERIMENTAL)
204223
"""
205224

225+
@staticmethod
206226
def exit(value: str) -> None:
207227
"""
208228
This method lets you exit a notebook with a value
209229
"""
210230
...
231+
@staticmethod
211232
def run(path: str, timeoutSeconds: int, arguments: typing.Map[str, str]) -> str:
212233
"""
213234
This method runs a notebook and returns its exit value
@@ -219,16 +240,19 @@ class dbutils:
219240
Provides utilities for leveraging secrets within notebooks
220241
"""
221242

243+
@staticmethod
222244
def get(scope: str, key: str) -> str:
223245
"""
224246
Gets the string representation of a secret value with scope and key
225247
"""
226248
...
249+
@staticmethod
227250
def list(scope: str) -> typing.List[str]:
228251
"""
229252
Lists secret metadata for secrets within a scope
230253
"""
231254
...
255+
@staticmethod
232256
def listScopes() -> typing.List[str]:
233257
"""
234258
Lists secret scopes
@@ -240,13 +264,15 @@ class dbutils:
240264
provides utilities for working with notebook widgets. You can create different types of widgets and get their bound value
241265
"""
242266

267+
@staticmethod
243268
def get(name: str) -> str:
244269
"""Returns the current value of a widget with give name.
245270
246271
:param name: Name of the argument to be accessed
247272
:return: Current value of the widget or default value
248273
"""
249274
...
275+
@staticmethod
250276
def getArgument(name: str, defaultValue: typing.Optional[str] = None) -> str:
251277
"""Returns the current value of a widget with give name.
252278
@@ -255,6 +281,7 @@ class dbutils:
255281
:return: Current value of the widget or default value
256282
"""
257283
...
284+
@staticmethod
258285
def text(name: str, defaultValue: str, label: str = None):
259286
"""Creates a text input widget with given name, default value and optional label for
260287
display
@@ -263,6 +290,7 @@ class dbutils:
263290
:param label: Optional label string for display in notebook and dashboard
264291
"""
265292
...
293+
@staticmethod
266294
def dropdown(
267295
name: str, defaultValue: str, choices: typing.List[str], label: str = None
268296
):
@@ -273,6 +301,7 @@ class dbutils:
273301
:param label: Optional label string for display in notebook and dashboard
274302
"""
275303
...
304+
@staticmethod
276305
def combobox(
277306
name: str,
278307
defaultValue: str,
@@ -286,6 +315,7 @@ class dbutils:
286315
:param label: Optional label string for display in notebook and dashboard
287316
"""
288317
...
318+
@staticmethod
289319
def multiselect(
290320
name: str,
291321
defaultValue: str,
@@ -299,11 +329,13 @@ class dbutils:
299329
:param label: Optional label string for display in notebook and dashboard
300330
"""
301331
...
332+
@staticmethod
302333
def remove(name: str):
303334
"""Removes given input widget. If widget does not exist it will throw an error.
304335
:param name: Name of argument associated with input widget to be removed
305336
"""
306337
...
338+
@staticmethod
307339
def removeAll():
308340
"""Removes all input widgets in the notebook."""
309341
...

0 commit comments

Comments
 (0)