dbx-tools-databricks 0.6.171__py3-none-win_amd64.whl

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.
@@ -0,0 +1,11 @@
1
+ # GENERATED by UniFFI binding generation - DO NOT EDIT.
2
+ # Regenerated from the dbx-tools-databricks Rust exports.
3
+ # Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ from .bindings import *
6
+
7
+ __all__ = [
8
+ "InternalError",
9
+ "databricks_cli_available",
10
+ "is_databricks_app",
11
+ ]
@@ -0,0 +1,863 @@
1
+ # GENERATED by UniFFI binding generation - DO NOT EDIT.
2
+ # Regenerated from the dbx-tools-databricks Rust exports.
3
+ # Hand edits are overwritten on the next watch; this file is read-only.
4
+
5
+ # This file was autogenerated by some hot garbage in the `uniffi` crate.
6
+ # Trust me, you don't want to mess with it!
7
+
8
+ # Common helper code.
9
+ #
10
+ # Ideally this would live in a separate .py file where it can be unittested etc
11
+ # in isolation, and perhaps even published as a re-useable package.
12
+ #
13
+ # However, it's important that the details of how this helper code works (e.g. the
14
+ # way that different builtin types are passed across the FFI) exactly match what's
15
+ # expected by the rust code on the other side of the interface. In practice right
16
+ # now that means coming from the exact some version of `uniffi` that was used to
17
+ # compile the rust component. The easiest way to ensure this is to bundle the Python
18
+ # helpers directly inline like we're doing here.
19
+
20
+ from __future__ import annotations
21
+ import os
22
+ import sys
23
+ import ctypes
24
+ from dataclasses import dataclass
25
+ import enum
26
+ import struct
27
+ import contextlib
28
+ import datetime
29
+ import threading
30
+ import itertools
31
+ import traceback
32
+ import typing
33
+ import platform
34
+
35
+
36
+ # Used for default argument values
37
+ _DEFAULT = object() # type: typing.Any
38
+
39
+
40
+ class _UniffiRustBuffer(ctypes.Structure):
41
+ _fields_ = [
42
+ ("capacity", ctypes.c_uint64),
43
+ ("len", ctypes.c_uint64),
44
+ ("data", ctypes.POINTER(ctypes.c_char)),
45
+ ]
46
+
47
+ @staticmethod
48
+ def default():
49
+ return _UniffiRustBuffer(0, 0, None)
50
+
51
+ @staticmethod
52
+ def alloc(size):
53
+ return _uniffi_rust_call(_UniffiLib.ffi_dbx_tools_databricks_rustbuffer_alloc, size)
54
+
55
+ @staticmethod
56
+ def reserve(rbuf, additional):
57
+ return _uniffi_rust_call(_UniffiLib.ffi_dbx_tools_databricks_rustbuffer_reserve, rbuf, additional)
58
+
59
+ def free(self):
60
+ return _uniffi_rust_call(_UniffiLib.ffi_dbx_tools_databricks_rustbuffer_free, self)
61
+
62
+ def __str__(self):
63
+ return "_UniffiRustBuffer(capacity={}, len={}, data={})".format(
64
+ self.capacity,
65
+ self.len,
66
+ self.data[0:self.len]
67
+ )
68
+
69
+ @contextlib.contextmanager
70
+ def alloc_with_builder(*args):
71
+ """Context-manger to allocate a buffer using a _UniffiRustBufferBuilder.
72
+
73
+ The allocated buffer will be automatically freed if an error occurs, ensuring that
74
+ we don't accidentally leak it.
75
+ """
76
+ builder = _UniffiRustBufferBuilder()
77
+ try:
78
+ yield builder
79
+ except:
80
+ builder.discard()
81
+ raise
82
+
83
+ @contextlib.contextmanager
84
+ def consume_with_stream(self):
85
+ """Context-manager to consume a buffer using a _UniffiRustBufferStream.
86
+
87
+ The _UniffiRustBuffer will be freed once the context-manager exits, ensuring that we don't
88
+ leak it even if an error occurs.
89
+ """
90
+ try:
91
+ s = _UniffiRustBufferStream.from_rust_buffer(self)
92
+ yield s
93
+ if s.remaining() != 0:
94
+ raise RuntimeError(f"junk data left in buffer at end of consume_with_stream {s.remaining()}")
95
+ finally:
96
+ self.free()
97
+
98
+ @contextlib.contextmanager
99
+ def read_with_stream(self):
100
+ """Context-manager to read a buffer using a _UniffiRustBufferStream.
101
+
102
+ This is like consume_with_stream, but doesn't free the buffer afterwards.
103
+ It should only be used with borrowed `_UniffiRustBuffer` data.
104
+ """
105
+ s = _UniffiRustBufferStream.from_rust_buffer(self)
106
+ yield s
107
+ if s.remaining() != 0:
108
+ raise RuntimeError(f"junk data left in buffer at end of read_with_stream {s.remaining()}")
109
+
110
+ class _UniffiForeignBytes(ctypes.Structure):
111
+ _fields_ = [
112
+ ("len", ctypes.c_int32),
113
+ ("data", ctypes.POINTER(ctypes.c_char)),
114
+ ]
115
+
116
+ def __str__(self):
117
+ return "_UniffiForeignBytes(len={}, data={})".format(self.len, self.data[0:self.len])
118
+
119
+
120
+ class _UniffiRustBufferStream:
121
+ """
122
+ Helper for structured reading of bytes from a _UniffiRustBuffer
123
+ """
124
+
125
+ def __init__(self, data, len):
126
+ self.data = data
127
+ self.len = len
128
+ self.offset = 0
129
+
130
+ @classmethod
131
+ def from_rust_buffer(cls, buf):
132
+ return cls(buf.data, buf.len)
133
+
134
+ def remaining(self):
135
+ return self.len - self.offset
136
+
137
+ def _unpack_from(self, size, format):
138
+ if self.offset + size > self.len:
139
+ raise InternalError("read past end of rust buffer")
140
+ value = struct.unpack(format, self.data[self.offset:self.offset+size])[0]
141
+ self.offset += size
142
+ return value
143
+
144
+ def read(self, size):
145
+ if self.offset + size > self.len:
146
+ raise InternalError("read past end of rust buffer")
147
+ data = self.data[self.offset:self.offset+size]
148
+ self.offset += size
149
+ return data
150
+
151
+ def read_i8(self):
152
+ return self._unpack_from(1, ">b")
153
+
154
+ def read_u8(self):
155
+ return self._unpack_from(1, ">B")
156
+
157
+ def read_i16(self):
158
+ return self._unpack_from(2, ">h")
159
+
160
+ def read_u16(self):
161
+ return self._unpack_from(2, ">H")
162
+
163
+ def read_i32(self):
164
+ return self._unpack_from(4, ">i")
165
+
166
+ def read_u32(self):
167
+ return self._unpack_from(4, ">I")
168
+
169
+ def read_i64(self):
170
+ return self._unpack_from(8, ">q")
171
+
172
+ def read_u64(self):
173
+ return self._unpack_from(8, ">Q")
174
+
175
+ def read_float(self):
176
+ v = self._unpack_from(4, ">f")
177
+ return v
178
+
179
+ def read_double(self):
180
+ return self._unpack_from(8, ">d")
181
+
182
+ class _UniffiRustBufferBuilder:
183
+ """
184
+ Helper for structured writing of bytes into a _UniffiRustBuffer.
185
+ """
186
+
187
+ def __init__(self):
188
+ self.rbuf = _UniffiRustBuffer.alloc(16)
189
+ self.rbuf.len = 0
190
+
191
+ def finalize(self):
192
+ rbuf = self.rbuf
193
+ self.rbuf = None
194
+ return rbuf
195
+
196
+ def discard(self):
197
+ if self.rbuf is not None:
198
+ rbuf = self.finalize()
199
+ rbuf.free()
200
+
201
+ @contextlib.contextmanager
202
+ def _reserve(self, num_bytes):
203
+ if self.rbuf.len + num_bytes > self.rbuf.capacity:
204
+ self.rbuf = _UniffiRustBuffer.reserve(self.rbuf, num_bytes)
205
+ yield None
206
+ self.rbuf.len += num_bytes
207
+
208
+ def _pack_into(self, size, format, value):
209
+ with self._reserve(size):
210
+ # XXX TODO: I feel like I should be able to use `struct.pack_into` here but can't figure it out.
211
+ for i, byte in enumerate(struct.pack(format, value)):
212
+ self.rbuf.data[self.rbuf.len + i] = byte
213
+
214
+ def write(self, value):
215
+ with self._reserve(len(value)):
216
+ for i, byte in enumerate(value):
217
+ self.rbuf.data[self.rbuf.len + i] = byte
218
+
219
+ def write_i8(self, v):
220
+ self._pack_into(1, ">b", v)
221
+
222
+ def write_u8(self, v):
223
+ self._pack_into(1, ">B", v)
224
+
225
+ def write_i16(self, v):
226
+ self._pack_into(2, ">h", v)
227
+
228
+ def write_u16(self, v):
229
+ self._pack_into(2, ">H", v)
230
+
231
+ def write_i32(self, v):
232
+ self._pack_into(4, ">i", v)
233
+
234
+ def write_u32(self, v):
235
+ self._pack_into(4, ">I", v)
236
+
237
+ def write_i64(self, v):
238
+ self._pack_into(8, ">q", v)
239
+
240
+ def write_u64(self, v):
241
+ self._pack_into(8, ">Q", v)
242
+
243
+ def write_float(self, v):
244
+ self._pack_into(4, ">f", v)
245
+
246
+ def write_double(self, v):
247
+ self._pack_into(8, ">d", v)
248
+
249
+ def write_c_size_t(self, v):
250
+ self._pack_into(ctypes.sizeof(ctypes.c_size_t) , "@N", v)
251
+ # A handful of classes and functions to support the generated data structures.
252
+ # This would be a good candidate for isolating in its own ffi-support lib.
253
+
254
+ class InternalError(Exception):
255
+ pass
256
+
257
+ class _UniffiRustCallStatus(ctypes.Structure):
258
+ """
259
+ Error runtime.
260
+ """
261
+ _fields_ = [
262
+ ("code", ctypes.c_int8),
263
+ ("error_buf", _UniffiRustBuffer),
264
+ ]
265
+
266
+ # These match the values from the uniffi::rustcalls module
267
+ CALL_SUCCESS = 0
268
+ CALL_ERROR = 1
269
+ CALL_UNEXPECTED_ERROR = 2
270
+
271
+ @staticmethod
272
+ def default():
273
+ return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default())
274
+
275
+ def __str__(self):
276
+ if self.code == _UniffiRustCallStatus.CALL_SUCCESS:
277
+ return "_UniffiRustCallStatus(CALL_SUCCESS)"
278
+ elif self.code == _UniffiRustCallStatus.CALL_ERROR:
279
+ return "_UniffiRustCallStatus(CALL_ERROR)"
280
+ elif self.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
281
+ return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)"
282
+ else:
283
+ return "_UniffiRustCallStatus(<invalid code>)"
284
+
285
+ def _uniffi_rust_call(fn, *args):
286
+ # Call a rust function
287
+ return _uniffi_rust_call_with_error(None, fn, *args)
288
+
289
+ def _uniffi_rust_call_with_error(error_ffi_converter, fn, *args):
290
+ # Call a rust function and handle any errors
291
+ #
292
+ # This function is used for rust calls that return Result<> and therefore can set the CALL_ERROR status code.
293
+ # error_ffi_converter must be set to the _UniffiConverter for the error class that corresponds to the result.
294
+ call_status = _UniffiRustCallStatus.default()
295
+
296
+ args_with_error = args + (ctypes.byref(call_status),)
297
+ result = fn(*args_with_error)
298
+ _uniffi_check_call_status(error_ffi_converter, call_status)
299
+ return result
300
+
301
+ def _uniffi_check_call_status(error_ffi_converter, call_status):
302
+ if call_status.code == _UniffiRustCallStatus.CALL_SUCCESS:
303
+ pass
304
+ elif call_status.code == _UniffiRustCallStatus.CALL_ERROR:
305
+ if error_ffi_converter is None:
306
+ call_status.error_buf.free()
307
+ raise InternalError("_uniffi_rust_call_with_error: CALL_ERROR, but error_ffi_converter is None")
308
+ else:
309
+ raise error_ffi_converter.lift(call_status.error_buf)
310
+ elif call_status.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
311
+ # When the rust code sees a panic, it tries to construct a _UniffiRustBuffer
312
+ # with the message. But if that code panics, then it just sends back
313
+ # an empty buffer.
314
+ if call_status.error_buf.len > 0:
315
+ msg = _UniffiFfiConverterString.lift(call_status.error_buf)
316
+ else:
317
+ msg = "Unknown rust panic"
318
+ raise InternalError(msg)
319
+ else:
320
+ raise InternalError("Invalid _UniffiRustCallStatus code: {}".format(
321
+ call_status.code))
322
+
323
+ def _uniffi_trait_interface_call(call_status, make_call, write_return_value):
324
+ try:
325
+ return write_return_value(make_call())
326
+ except Exception as e:
327
+ call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
328
+ call_status.error_buf = _UniffiFfiConverterString.lower(repr(e))
329
+
330
+ def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error):
331
+ try:
332
+ try:
333
+ return write_return_value(make_call())
334
+ except error_type as e:
335
+ call_status.code = _UniffiRustCallStatus.CALL_ERROR
336
+ call_status.error_buf = lower_error(e)
337
+ except Exception as e:
338
+ call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
339
+ call_status.error_buf = _UniffiFfiConverterString.lower(repr(e))
340
+ # Initial value and increment amount for handles.
341
+ # These ensure that Python-generated handles always have the lowest bit set
342
+ _UNIFFI_HANDLEMAP_INITIAL = 1
343
+ _UNIFFI_HANDLEMAP_DELTA = 2
344
+
345
+ class _UniffiHandleMap:
346
+ """
347
+ A map where inserting, getting and removing data is synchronized with a lock.
348
+ """
349
+
350
+ def __init__(self):
351
+ # type Handle = int
352
+ self._map = {} # type: Dict[Handle, Any]
353
+ self._lock = threading.Lock()
354
+ self._counter = _UNIFFI_HANDLEMAP_INITIAL
355
+
356
+ def insert(self, obj):
357
+ with self._lock:
358
+ return self._insert(obj)
359
+
360
+ """Low-level insert, this assumes `self._lock` is held."""
361
+ def _insert(self, obj):
362
+ handle = self._counter
363
+ self._counter += _UNIFFI_HANDLEMAP_DELTA
364
+ self._map[handle] = obj
365
+ return handle
366
+
367
+ def get(self, handle):
368
+ try:
369
+ with self._lock:
370
+ return self._map[handle]
371
+ except KeyError:
372
+ raise InternalError(f"_UniffiHandleMap.get: Invalid handle {handle}")
373
+
374
+ def clone(self, handle):
375
+ try:
376
+ with self._lock:
377
+ obj = self._map[handle]
378
+ return self._insert(obj)
379
+ except KeyError:
380
+ raise InternalError(f"_UniffiHandleMap.clone: Invalid handle {handle}")
381
+
382
+ def remove(self, handle):
383
+ try:
384
+ with self._lock:
385
+ return self._map.pop(handle)
386
+ except KeyError:
387
+ raise InternalError(f"_UniffiHandleMap.remove: Invalid handle: {handle}")
388
+
389
+ def __len__(self):
390
+ return len(self._map)
391
+ # Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI.
392
+ class _UniffiConverterPrimitive:
393
+ @classmethod
394
+ def lift(cls, value):
395
+ return value
396
+
397
+ @classmethod
398
+ def lower(cls, value):
399
+ return value
400
+
401
+ class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive):
402
+ @classmethod
403
+ def check_lower(cls, value):
404
+ try:
405
+ value = value.__index__()
406
+ except Exception:
407
+ raise TypeError("'{}' object cannot be interpreted as an integer".format(type(value).__name__))
408
+ if not isinstance(value, int):
409
+ raise TypeError("__index__ returned non-int (type {})".format(type(value).__name__))
410
+ if not cls.VALUE_MIN <= value < cls.VALUE_MAX:
411
+ raise ValueError("{} requires {} <= value < {}".format(cls.CLASS_NAME, cls.VALUE_MIN, cls.VALUE_MAX))
412
+
413
+ class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive):
414
+ @classmethod
415
+ def check_lower(cls, value):
416
+ try:
417
+ value = value.__float__()
418
+ except Exception:
419
+ raise TypeError("must be real number, not {}".format(type(value).__name__))
420
+ if not isinstance(value, float):
421
+ raise TypeError("__float__ returned non-float (type {})".format(type(value).__name__))
422
+
423
+ # Helper class for wrapper types that will always go through a _UniffiRustBuffer.
424
+ # Classes should inherit from this and implement the `read` and `write` static methods.
425
+ class _UniffiConverterRustBuffer:
426
+ @classmethod
427
+ def lift(cls, rbuf):
428
+ with rbuf.consume_with_stream() as stream:
429
+ return cls.read(stream)
430
+
431
+ @classmethod
432
+ def lower(cls, value):
433
+ with _UniffiRustBuffer.alloc_with_builder() as builder:
434
+ cls.write(value, builder)
435
+ return builder.finalize()
436
+
437
+ # Contains loading, initialization code, and the FFI Function declarations.
438
+ # Define some ctypes FFI types that we use in the library
439
+
440
+ """
441
+ Function pointer for a Rust task, which a callback function that takes a opaque pointer
442
+ """
443
+ _UNIFFI_RUST_TASK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int8)
444
+
445
+ def _uniffi_future_callback_t(return_type):
446
+ """
447
+ Factory function to create callback function types for async functions
448
+ """
449
+ return ctypes.CFUNCTYPE(None, ctypes.c_uint64, return_type, _UniffiRustCallStatus)
450
+
451
+ def _uniffi_load_indirect():
452
+ """
453
+ This is how we find and load the dynamic library provided by the component.
454
+ For now we just look it up by name.
455
+ """
456
+ if sys.platform == "darwin":
457
+ libname = "lib{}.dylib"
458
+ elif sys.platform.startswith("win"):
459
+ # As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
460
+ # We could use `os.add_dll_directory` to configure the search path, but
461
+ # it doesn't feel right to mess with application-wide settings. Let's
462
+ # assume that the `.dll` is next to the `.py` file and load by full path.
463
+ libname = os.path.join(
464
+ os.path.dirname(__file__),
465
+ "{}.dll",
466
+ )
467
+ else:
468
+ # Anything else must be an ELF platform - Linux, *BSD, Solaris/illumos
469
+ libname = "lib{}.so"
470
+
471
+ libname = libname.format("dbx_tools_databricks")
472
+ path = os.path.join(os.path.dirname(__file__), libname)
473
+ lib = ctypes.cdll.LoadLibrary(path)
474
+ return lib
475
+
476
+ def _uniffi_check_contract_api_version(lib):
477
+ # Get the bindings contract version from our ComponentInterface
478
+ bindings_contract_version = 30
479
+ # Get the scaffolding contract version by calling the into the dylib
480
+ scaffolding_contract_version = lib.ffi_dbx_tools_databricks_uniffi_contract_version()
481
+ if bindings_contract_version != scaffolding_contract_version:
482
+ raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
483
+
484
+ def _uniffi_check_api_checksums(lib):
485
+ if lib.uniffi_dbx_tools_databricks_checksum_func_databricks_cli_available() != 19375:
486
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
487
+ if lib.uniffi_dbx_tools_databricks_checksum_func_is_databricks_app() != 27360:
488
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
489
+
490
+ # A ctypes library to expose the extern-C FFI definitions.
491
+ # This is an implementation detail which will be called internally by the public API.
492
+
493
+ _UniffiLib = _uniffi_load_indirect()
494
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_alloc.argtypes = (
495
+ ctypes.c_uint64,
496
+ ctypes.POINTER(_UniffiRustCallStatus),
497
+ )
498
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_alloc.restype = _UniffiRustBuffer
499
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_from_bytes.argtypes = (
500
+ _UniffiForeignBytes,
501
+ ctypes.POINTER(_UniffiRustCallStatus),
502
+ )
503
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_from_bytes.restype = _UniffiRustBuffer
504
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_free.argtypes = (
505
+ _UniffiRustBuffer,
506
+ ctypes.POINTER(_UniffiRustCallStatus),
507
+ )
508
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_free.restype = None
509
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_reserve.argtypes = (
510
+ _UniffiRustBuffer,
511
+ ctypes.c_uint64,
512
+ ctypes.POINTER(_UniffiRustCallStatus),
513
+ )
514
+ _UniffiLib.ffi_dbx_tools_databricks_rustbuffer_reserve.restype = _UniffiRustBuffer
515
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8,
516
+ )
517
+ _UNIFFI_FOREIGN_FUTURE_DROPPED_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,
518
+ )
519
+ class _UniffiForeignFutureDroppedCallbackStruct(ctypes.Structure):
520
+ _fields_ = [
521
+ ("handle", ctypes.c_uint64),
522
+ ("free", _UNIFFI_FOREIGN_FUTURE_DROPPED_CALLBACK),
523
+ ]
524
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u8.argtypes = (
525
+ ctypes.c_uint64,
526
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
527
+ ctypes.c_uint64,
528
+ )
529
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u8.restype = None
530
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u8.argtypes = (
531
+ ctypes.c_uint64,
532
+ )
533
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u8.restype = None
534
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u8.argtypes = (
535
+ ctypes.c_uint64,
536
+ ctypes.POINTER(_UniffiRustCallStatus),
537
+ )
538
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u8.restype = ctypes.c_uint8
539
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u8.argtypes = (
540
+ ctypes.c_uint64,
541
+ )
542
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u8.restype = None
543
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i8.argtypes = (
544
+ ctypes.c_uint64,
545
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
546
+ ctypes.c_uint64,
547
+ )
548
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i8.restype = None
549
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i8.argtypes = (
550
+ ctypes.c_uint64,
551
+ )
552
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i8.restype = None
553
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i8.argtypes = (
554
+ ctypes.c_uint64,
555
+ ctypes.POINTER(_UniffiRustCallStatus),
556
+ )
557
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i8.restype = ctypes.c_int8
558
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i8.argtypes = (
559
+ ctypes.c_uint64,
560
+ )
561
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i8.restype = None
562
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u16.argtypes = (
563
+ ctypes.c_uint64,
564
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
565
+ ctypes.c_uint64,
566
+ )
567
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u16.restype = None
568
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u16.argtypes = (
569
+ ctypes.c_uint64,
570
+ )
571
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u16.restype = None
572
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u16.argtypes = (
573
+ ctypes.c_uint64,
574
+ ctypes.POINTER(_UniffiRustCallStatus),
575
+ )
576
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u16.restype = ctypes.c_uint16
577
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u16.argtypes = (
578
+ ctypes.c_uint64,
579
+ )
580
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u16.restype = None
581
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i16.argtypes = (
582
+ ctypes.c_uint64,
583
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
584
+ ctypes.c_uint64,
585
+ )
586
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i16.restype = None
587
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i16.argtypes = (
588
+ ctypes.c_uint64,
589
+ )
590
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i16.restype = None
591
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i16.argtypes = (
592
+ ctypes.c_uint64,
593
+ ctypes.POINTER(_UniffiRustCallStatus),
594
+ )
595
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i16.restype = ctypes.c_int16
596
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i16.argtypes = (
597
+ ctypes.c_uint64,
598
+ )
599
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i16.restype = None
600
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u32.argtypes = (
601
+ ctypes.c_uint64,
602
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
603
+ ctypes.c_uint64,
604
+ )
605
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u32.restype = None
606
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u32.argtypes = (
607
+ ctypes.c_uint64,
608
+ )
609
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u32.restype = None
610
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u32.argtypes = (
611
+ ctypes.c_uint64,
612
+ ctypes.POINTER(_UniffiRustCallStatus),
613
+ )
614
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u32.restype = ctypes.c_uint32
615
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u32.argtypes = (
616
+ ctypes.c_uint64,
617
+ )
618
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u32.restype = None
619
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i32.argtypes = (
620
+ ctypes.c_uint64,
621
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
622
+ ctypes.c_uint64,
623
+ )
624
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i32.restype = None
625
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i32.argtypes = (
626
+ ctypes.c_uint64,
627
+ )
628
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i32.restype = None
629
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i32.argtypes = (
630
+ ctypes.c_uint64,
631
+ ctypes.POINTER(_UniffiRustCallStatus),
632
+ )
633
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i32.restype = ctypes.c_int32
634
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i32.argtypes = (
635
+ ctypes.c_uint64,
636
+ )
637
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i32.restype = None
638
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u64.argtypes = (
639
+ ctypes.c_uint64,
640
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
641
+ ctypes.c_uint64,
642
+ )
643
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_u64.restype = None
644
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u64.argtypes = (
645
+ ctypes.c_uint64,
646
+ )
647
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_u64.restype = None
648
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u64.argtypes = (
649
+ ctypes.c_uint64,
650
+ ctypes.POINTER(_UniffiRustCallStatus),
651
+ )
652
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_u64.restype = ctypes.c_uint64
653
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u64.argtypes = (
654
+ ctypes.c_uint64,
655
+ )
656
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_u64.restype = None
657
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i64.argtypes = (
658
+ ctypes.c_uint64,
659
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
660
+ ctypes.c_uint64,
661
+ )
662
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_i64.restype = None
663
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i64.argtypes = (
664
+ ctypes.c_uint64,
665
+ )
666
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_i64.restype = None
667
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i64.argtypes = (
668
+ ctypes.c_uint64,
669
+ ctypes.POINTER(_UniffiRustCallStatus),
670
+ )
671
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_i64.restype = ctypes.c_int64
672
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i64.argtypes = (
673
+ ctypes.c_uint64,
674
+ )
675
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_i64.restype = None
676
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_f32.argtypes = (
677
+ ctypes.c_uint64,
678
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
679
+ ctypes.c_uint64,
680
+ )
681
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_f32.restype = None
682
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_f32.argtypes = (
683
+ ctypes.c_uint64,
684
+ )
685
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_f32.restype = None
686
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_f32.argtypes = (
687
+ ctypes.c_uint64,
688
+ ctypes.POINTER(_UniffiRustCallStatus),
689
+ )
690
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_f32.restype = ctypes.c_float
691
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_f32.argtypes = (
692
+ ctypes.c_uint64,
693
+ )
694
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_f32.restype = None
695
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_f64.argtypes = (
696
+ ctypes.c_uint64,
697
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
698
+ ctypes.c_uint64,
699
+ )
700
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_f64.restype = None
701
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_f64.argtypes = (
702
+ ctypes.c_uint64,
703
+ )
704
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_f64.restype = None
705
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_f64.argtypes = (
706
+ ctypes.c_uint64,
707
+ ctypes.POINTER(_UniffiRustCallStatus),
708
+ )
709
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_f64.restype = ctypes.c_double
710
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_f64.argtypes = (
711
+ ctypes.c_uint64,
712
+ )
713
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_f64.restype = None
714
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_rust_buffer.argtypes = (
715
+ ctypes.c_uint64,
716
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
717
+ ctypes.c_uint64,
718
+ )
719
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_rust_buffer.restype = None
720
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_rust_buffer.argtypes = (
721
+ ctypes.c_uint64,
722
+ )
723
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_rust_buffer.restype = None
724
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_rust_buffer.argtypes = (
725
+ ctypes.c_uint64,
726
+ ctypes.POINTER(_UniffiRustCallStatus),
727
+ )
728
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer
729
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_rust_buffer.argtypes = (
730
+ ctypes.c_uint64,
731
+ )
732
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_rust_buffer.restype = None
733
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_void.argtypes = (
734
+ ctypes.c_uint64,
735
+ _UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
736
+ ctypes.c_uint64,
737
+ )
738
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_poll_void.restype = None
739
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_void.argtypes = (
740
+ ctypes.c_uint64,
741
+ )
742
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_cancel_void.restype = None
743
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_void.argtypes = (
744
+ ctypes.c_uint64,
745
+ ctypes.POINTER(_UniffiRustCallStatus),
746
+ )
747
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_complete_void.restype = None
748
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_void.argtypes = (
749
+ ctypes.c_uint64,
750
+ )
751
+ _UniffiLib.ffi_dbx_tools_databricks_rust_future_free_void.restype = None
752
+ _UniffiLib.uniffi_dbx_tools_databricks_fn_func_databricks_cli_available.argtypes = (
753
+ ctypes.POINTER(_UniffiRustCallStatus),
754
+ )
755
+ _UniffiLib.uniffi_dbx_tools_databricks_fn_func_databricks_cli_available.restype = ctypes.c_int8
756
+ _UniffiLib.uniffi_dbx_tools_databricks_fn_func_is_databricks_app.argtypes = (
757
+ ctypes.POINTER(_UniffiRustCallStatus),
758
+ )
759
+ _UniffiLib.uniffi_dbx_tools_databricks_fn_func_is_databricks_app.restype = ctypes.c_int8
760
+ _UniffiLib.ffi_dbx_tools_databricks_uniffi_contract_version.argtypes = (
761
+ )
762
+ _UniffiLib.ffi_dbx_tools_databricks_uniffi_contract_version.restype = ctypes.c_uint32
763
+ _UniffiLib.uniffi_dbx_tools_databricks_checksum_func_databricks_cli_available.argtypes = (
764
+ )
765
+ _UniffiLib.uniffi_dbx_tools_databricks_checksum_func_databricks_cli_available.restype = ctypes.c_uint16
766
+ _UniffiLib.uniffi_dbx_tools_databricks_checksum_func_is_databricks_app.argtypes = (
767
+ )
768
+ _UniffiLib.uniffi_dbx_tools_databricks_checksum_func_is_databricks_app.restype = ctypes.c_uint16
769
+
770
+ _uniffi_check_contract_api_version(_UniffiLib)
771
+ # _uniffi_check_api_checksums(_UniffiLib)
772
+
773
+
774
+
775
+ # Public interface members begin here.
776
+
777
+
778
+ class _UniffiFfiConverterBoolean:
779
+ @classmethod
780
+ def check_lower(cls, value):
781
+ return not not value
782
+
783
+ @classmethod
784
+ def lower(cls, value):
785
+ return 1 if value else 0
786
+
787
+ @staticmethod
788
+ def lift(value):
789
+ return value != 0
790
+
791
+ @classmethod
792
+ def read(cls, buf):
793
+ return cls.lift(buf.read_u8())
794
+
795
+ @classmethod
796
+ def write(cls, value, buf):
797
+ buf.write_u8(value)
798
+
799
+ class _UniffiFfiConverterString:
800
+ @staticmethod
801
+ def check_lower(value):
802
+ if not isinstance(value, str):
803
+ raise TypeError("argument must be str, not {}".format(type(value).__name__))
804
+ return value
805
+
806
+ @staticmethod
807
+ def read(buf):
808
+ size = buf.read_i32()
809
+ if size < 0:
810
+ raise InternalError("Unexpected negative string length")
811
+ utf8_bytes = buf.read(size)
812
+ return utf8_bytes.decode("utf-8")
813
+
814
+ @staticmethod
815
+ def write(value, buf):
816
+ utf8_bytes = value.encode("utf-8")
817
+ buf.write_i32(len(utf8_bytes))
818
+ buf.write(utf8_bytes)
819
+
820
+ @staticmethod
821
+ def lift(buf):
822
+ with buf.consume_with_stream() as stream:
823
+ return stream.read(stream.remaining()).decode("utf-8")
824
+
825
+ @staticmethod
826
+ def lower(value):
827
+ with _UniffiRustBuffer.alloc_with_builder() as builder:
828
+ builder.write(value.encode("utf-8"))
829
+ return builder.finalize()
830
+ def databricks_cli_available() -> bool:
831
+ """
832
+ Whether `databricks auth --help` succeeds in this process environment.
833
+ """
834
+ _uniffi_lowered_args = (
835
+ )
836
+ _uniffi_lift_return = _UniffiFfiConverterBoolean.lift
837
+ _uniffi_error_converter = None
838
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
839
+ _uniffi_error_converter,
840
+ _UniffiLib.uniffi_dbx_tools_databricks_fn_func_databricks_cli_available,
841
+ *_uniffi_lowered_args,
842
+ )
843
+ return _uniffi_lift_return(_uniffi_ffi_result)
844
+ def is_databricks_app() -> bool:
845
+ """
846
+ Detect whether the current process is running as a Databricks App.
847
+ """
848
+ _uniffi_lowered_args = (
849
+ )
850
+ _uniffi_lift_return = _UniffiFfiConverterBoolean.lift
851
+ _uniffi_error_converter = None
852
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
853
+ _uniffi_error_converter,
854
+ _UniffiLib.uniffi_dbx_tools_databricks_fn_func_is_databricks_app,
855
+ *_uniffi_lowered_args,
856
+ )
857
+ return _uniffi_lift_return(_uniffi_ffi_result)
858
+
859
+ __all__ = [
860
+ "InternalError",
861
+ "databricks_cli_available",
862
+ "is_databricks_app",
863
+ ]
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.3
2
+ Name: dbx-tools-databricks
3
+ Version: 0.6.171
4
+ Summary: Python bindings for dbx-tools-databricks
5
+ Requires-Python: >=3.10, <3.14
6
+ Project-URL: Source, https://github.com/reggie-db/dbx-tools/tree/main/packages/py/databricks
7
+ Description-Content-Type: text/markdown
8
+
9
+ # dbx-tools-databricks
10
+
11
+ Rust-generated Python bindings for shared Databricks runtime utilities.
12
+
13
+ ```python
14
+ from dbx_tools.databricks import (
15
+ databricks_cli_available,
16
+ is_databricks_app,
17
+ )
18
+
19
+ if is_databricks_app():
20
+ ...
21
+ ```
22
+
23
+ `is_databricks_app()` honors `DBX_TOOLS_DATABRICKS_APP_ENV`, then validates
24
+ `DATABRICKS_APP_NAME`, `DATABRICKS_HOST`, and `DATABRICKS_APP_PORT`.
25
+ `databricks_cli_available()` caches whether `databricks auth --help` succeeds
26
+ for the process.
27
+
28
+ The implementation and complete behavior live in the
29
+ [Rust package](../../rs/databricks/README.md). Node workspace, filesystem,
30
+ cloud, network, and generated binding APIs are documented by
31
+ [`@dbx-tools/databricks`](../../js/node/databricks).
@@ -0,0 +1,6 @@
1
+ dbx_tools/databricks/__init__.py,sha256=9vOEMBBETo1eHzBTO-7EPSduRBsMiUR54NkrUWA8FE4,304
2
+ dbx_tools/databricks/bindings.py,sha256=gjoniAQe6ISTvoFUprPiFEW3Qn0w91Cg0jFw8Idvfqk,31524
3
+ dbx_tools/databricks/dbx_tools_databricks.dll,sha256=QgXfsR4tIwwRx5T7kG-iIaLP0dNAu73eSshZNBwa19w,549376
4
+ dbx_tools_databricks-0.6.171.dist-info/WHEEL,sha256=TYO5DDMJo_so-q2DFoOSVJRjUjHAkM_5H5SNzBQ4ggA,88
5
+ dbx_tools_databricks-0.6.171.dist-info/METADATA,sha256=sH0gwrYwMqByYfkhuEEXUdQq9nKLPOZFjP-tt56QEHw,999
6
+ dbx_tools_databricks-0.6.171.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.12.10
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-win_amd64
5
+