ygg 0.1.57__py3-none-any.whl → 0.1.64__py3-none-any.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.
Files changed (46) hide show
  1. {ygg-0.1.57.dist-info → ygg-0.1.64.dist-info}/METADATA +2 -2
  2. ygg-0.1.64.dist-info/RECORD +74 -0
  3. yggdrasil/ai/__init__.py +2 -0
  4. yggdrasil/ai/session.py +87 -0
  5. yggdrasil/ai/sql_session.py +310 -0
  6. yggdrasil/databricks/__init__.py +0 -3
  7. yggdrasil/databricks/compute/cluster.py +68 -113
  8. yggdrasil/databricks/compute/command_execution.py +674 -0
  9. yggdrasil/databricks/compute/exceptions.py +19 -0
  10. yggdrasil/databricks/compute/execution_context.py +491 -282
  11. yggdrasil/databricks/compute/remote.py +4 -14
  12. yggdrasil/databricks/exceptions.py +10 -0
  13. yggdrasil/databricks/sql/__init__.py +0 -4
  14. yggdrasil/databricks/sql/engine.py +178 -178
  15. yggdrasil/databricks/sql/exceptions.py +9 -1
  16. yggdrasil/databricks/sql/statement_result.py +108 -120
  17. yggdrasil/databricks/sql/warehouse.py +339 -92
  18. yggdrasil/databricks/workspaces/io.py +185 -40
  19. yggdrasil/databricks/workspaces/path.py +114 -100
  20. yggdrasil/databricks/workspaces/workspace.py +210 -61
  21. yggdrasil/exceptions.py +7 -0
  22. yggdrasil/libs/databrickslib.py +22 -18
  23. yggdrasil/libs/extensions/spark_extensions.py +1 -1
  24. yggdrasil/libs/pandaslib.py +15 -6
  25. yggdrasil/libs/polarslib.py +49 -13
  26. yggdrasil/pyutils/__init__.py +1 -2
  27. yggdrasil/pyutils/callable_serde.py +12 -19
  28. yggdrasil/pyutils/exceptions.py +16 -0
  29. yggdrasil/pyutils/modules.py +6 -7
  30. yggdrasil/pyutils/python_env.py +16 -21
  31. yggdrasil/pyutils/waiting_config.py +171 -0
  32. yggdrasil/requests/msal.py +9 -96
  33. yggdrasil/types/cast/arrow_cast.py +3 -0
  34. yggdrasil/types/cast/pandas_cast.py +157 -169
  35. yggdrasil/types/cast/polars_cast.py +11 -43
  36. yggdrasil/types/dummy_class.py +81 -0
  37. yggdrasil/types/file_format.py +6 -2
  38. yggdrasil/types/python_defaults.py +92 -76
  39. yggdrasil/version.py +1 -1
  40. ygg-0.1.57.dist-info/RECORD +0 -66
  41. yggdrasil/databricks/ai/loki.py +0 -53
  42. {ygg-0.1.57.dist-info → ygg-0.1.64.dist-info}/WHEEL +0 -0
  43. {ygg-0.1.57.dist-info → ygg-0.1.64.dist-info}/entry_points.txt +0 -0
  44. {ygg-0.1.57.dist-info → ygg-0.1.64.dist-info}/licenses/LICENSE +0 -0
  45. {ygg-0.1.57.dist-info → ygg-0.1.64.dist-info}/top_level.txt +0 -0
  46. /yggdrasil/{databricks/ai/__init__.py → pyutils/mimetypes.py} +0 -0
@@ -11,9 +11,10 @@ from .arrow_cast import (
11
11
  )
12
12
  from .cast_options import CastOptions
13
13
  from .registry import register_converter
14
- from ...libs.pandaslib import pandas, require_pandas
14
+ from ...libs.pandaslib import pandas, PandasDataFrame, PandasSeries
15
15
 
16
16
  __all__ = [
17
+ "pandas_converter",
17
18
  "cast_pandas_series",
18
19
  "cast_pandas_dataframe",
19
20
  "arrow_array_to_pandas_series",
@@ -29,11 +30,6 @@ __all__ = [
29
30
  # ---------------------------------------------------------------------------
30
31
 
31
32
  if pandas is not None:
32
- require_pandas()
33
-
34
- PandasSeries = pandas.Series
35
- PandasDataFrame = pandas.DataFrame
36
-
37
33
  def pandas_converter(*args, **kwargs):
38
34
  """Return a register_converter wrapper when pandas is available.
39
35
 
@@ -47,14 +43,6 @@ if pandas is not None:
47
43
  return register_converter(*args, **kwargs)
48
44
 
49
45
  else:
50
- # Dummy types so annotations/decorators don't explode without pandas
51
- class _PandasDummy: # pragma: no cover - only used when pandas not installed
52
- """Placeholder type for pandas symbols when pandas is unavailable."""
53
- pass
54
-
55
- PandasSeries = _PandasDummy
56
- PandasDataFrame = _PandasDummy
57
-
58
46
  def pandas_converter(*_args, **_kwargs): # pragma: no cover - no-op decorator
59
47
  """Return a no-op decorator when pandas is unavailable.
60
48
 
@@ -83,188 +71,188 @@ else:
83
71
  # pandas <-> Arrow via ArrowCastOptions
84
72
  # ---------------------------------------------------------------------------
85
73
 
74
+ if pandas is not None:
75
+ @pandas_converter(PandasSeries, PandasSeries)
76
+ def cast_pandas_series(
77
+ series: PandasSeries,
78
+ options: Optional[CastOptions] = None,
79
+ ) -> PandasSeries:
80
+ """
81
+ Cast a pandas Series to a target Arrow type using Arrow casting rules.
86
82
 
87
- @pandas_converter(PandasSeries, PandasSeries)
88
- def cast_pandas_series(
89
- series: "pandas.Series",
90
- options: Optional[CastOptions] = None,
91
- ) -> "pandas.Series":
92
- """
93
- Cast a pandas Series to a target Arrow type using Arrow casting rules.
83
+ The target type/field should be provided via `options` (e.g. options.target_schema
84
+ or options.target_field, depending on how ArrowCastOptions is defined).
94
85
 
95
- The target type/field should be provided via `options` (e.g. options.target_schema
96
- or options.target_field, depending on how ArrowCastOptions is defined).
86
+ Arrow does:
87
+ - type cast
88
+ - nullability enforcement
89
+ - default handling (via cast_arrow_array)
90
+ We then convert back to pandas and restore index/name.
91
+ """
92
+ options = CastOptions.check_arg(options)
97
93
 
98
- Arrow does:
99
- - type cast
100
- - nullability enforcement
101
- - default handling (via cast_arrow_array)
102
- We then convert back to pandas and restore index/name.
103
- """
104
- options = CastOptions.check_arg(options)
94
+ arrow_array = pa.array(series, from_pandas=True)
95
+ casted = cast_arrow_array(arrow_array, options)
105
96
 
106
- arrow_array = pa.array(series, from_pandas=True)
107
- casted = cast_arrow_array(arrow_array, options)
97
+ result = casted.to_pandas()
98
+ result.index = series.index
99
+ result.name = series.name
100
+ return result
108
101
 
109
- result = casted.to_pandas()
110
- result.index = series.index
111
- result.name = series.name
112
- return result
113
102
 
103
+ @pandas_converter(PandasDataFrame, PandasDataFrame)
104
+ def cast_pandas_dataframe(
105
+ dataframe: PandasDataFrame,
106
+ options: Optional[CastOptions] = None,
107
+ ) -> PandasDataFrame:
108
+ """
109
+ Cast a pandas DataFrame to a target Arrow schema using Arrow casting rules.
114
110
 
115
- @pandas_converter(PandasDataFrame, PandasDataFrame)
116
- def cast_pandas_dataframe(
117
- dataframe: "pandas.DataFrame",
118
- options: Optional[CastOptions] = None,
119
- ) -> "pandas.DataFrame":
120
- """
121
- Cast a pandas DataFrame to a target Arrow schema using Arrow casting rules.
111
+ Behavior is analogous to the Polars version, but we delegate casting to
112
+ `cast_arrow_table` and then adjust columns on the pandas side:
122
113
 
123
- Behavior is analogous to the Polars version, but we delegate casting to
124
- `cast_arrow_table` and then adjust columns on the pandas side:
114
+ - options.target_schema: Arrow schema / field used by cast_arrow_table
115
+ - options.allow_add_columns:
116
+ * False: result only has columns from the cast Arrow table
117
+ * True: extra pandas columns (not in the target schema / cast result)
118
+ are appended unchanged
119
+ """
120
+ options = CastOptions.check_arg(options)
125
121
 
126
- - options.target_schema: Arrow schema / field used by cast_arrow_table
127
- - options.allow_add_columns:
128
- * False: result only has columns from the cast Arrow table
129
- * True: extra pandas columns (not in the target schema / cast result)
130
- are appended unchanged
131
- """
132
- options = CastOptions.check_arg(options)
122
+ original_index = dataframe.index
133
123
 
134
- original_index = dataframe.index
124
+ arrow_table = pa.Table.from_pandas(dataframe, preserve_index=False)
125
+ casted_table = cast_arrow_tabular(arrow_table, options)
135
126
 
136
- arrow_table = pa.Table.from_pandas(dataframe, preserve_index=False)
137
- casted_table = cast_arrow_tabular(arrow_table, options)
127
+ result = casted_table.to_pandas()
128
+ result.index = original_index
138
129
 
139
- result = casted_table.to_pandas()
140
- result.index = original_index
130
+ if getattr(options, "allow_add_columns", False):
131
+ casted_cols = set(result.columns)
132
+ extra_cols = [col for col in dataframe.columns if col not in casted_cols]
141
133
 
142
- if getattr(options, "allow_add_columns", False):
143
- casted_cols = set(result.columns)
144
- extra_cols = [col for col in dataframe.columns if col not in casted_cols]
134
+ if extra_cols:
135
+ extra_df = dataframe[extra_cols]
136
+ extra_df.index = result.index
137
+ result = pandas.concat([result, extra_df], axis=1)
145
138
 
146
- if extra_cols:
147
- extra_df = dataframe[extra_cols]
148
- extra_df.index = result.index
149
- result = pandas.concat([result, extra_df], axis=1)
139
+ return result
150
140
 
151
- return result
152
141
 
142
+ # ---------------------------------------------------------------------------
143
+ # Arrow -> pandas
144
+ # ---------------------------------------------------------------------------
153
145
 
154
- # ---------------------------------------------------------------------------
155
- # Arrow -> pandas
156
- # ---------------------------------------------------------------------------
157
146
 
147
+ @pandas_converter(pa.Array, PandasSeries)
148
+ @pandas_converter(pa.ChunkedArray, PandasSeries)
149
+ def arrow_array_to_pandas_series(
150
+ array: pa.Array,
151
+ cast_options: Optional[CastOptions] = None,
152
+ ) -> PandasSeries:
153
+ """
154
+ Convert a pyarrow.Array (or ChunkedArray) to a pandas Series,
155
+ optionally applying Arrow casting via ArrowCastOptions before conversion.
156
+ """
157
+ opts = CastOptions.check_arg(cast_options)
158
158
 
159
- @pandas_converter(pa.Array, PandasSeries)
160
- @pandas_converter(pa.ChunkedArray, PandasSeries)
161
- def arrow_array_to_pandas_series(
162
- array: pa.Array,
163
- cast_options: Optional[CastOptions] = None,
164
- ) -> "pandas.Series":
165
- """
166
- Convert a pyarrow.Array (or ChunkedArray) to a pandas Series,
167
- optionally applying Arrow casting via ArrowCastOptions before conversion.
168
- """
169
- opts = CastOptions.check_arg(cast_options)
170
-
171
- if isinstance(array, pa.ChunkedArray):
172
- array = array.combine_chunks()
173
-
174
- casted = cast_arrow_array(array, opts)
175
- return casted.to_pandas()
176
-
177
-
178
- @pandas_converter(pa.Table, PandasDataFrame)
179
- def arrow_table_to_pandas_dataframe(
180
- table: pa.Table,
181
- cast_options: Optional[CastOptions] = None,
182
- ) -> "pandas.DataFrame":
183
- """
184
- Convert a pyarrow.Table to a pandas DataFrame, optionally applying Arrow
185
- casting rules first.
186
- """
187
- opts = CastOptions.check_arg(cast_options)
188
-
189
- if opts.target_arrow_schema is not None:
190
- table = cast_arrow_tabular(table, opts)
159
+ if isinstance(array, pa.ChunkedArray):
160
+ array = array.combine_chunks()
191
161
 
192
- return table.to_pandas()
162
+ casted = cast_arrow_array(array, opts)
163
+ return casted.to_pandas()
193
164
 
194
165
 
195
- @pandas_converter(pa.RecordBatchReader, PandasDataFrame)
196
- def record_batch_reader_to_pandas_dataframe(
197
- reader: pa.RecordBatchReader,
198
- cast_options: Optional[CastOptions] = None,
199
- ) -> "pandas.DataFrame":
200
- """
201
- Convert a pyarrow.RecordBatchReader to a pandas DataFrame.
166
+ @pandas_converter(pa.Table, PandasDataFrame)
167
+ def arrow_table_to_pandas_dataframe(
168
+ table: pa.Table,
169
+ cast_options: Optional[CastOptions] = None,
170
+ ) -> PandasDataFrame:
171
+ """
172
+ Convert a pyarrow.Table to a pandas DataFrame, optionally applying Arrow
173
+ casting rules first.
174
+ """
175
+ opts = CastOptions.check_arg(cast_options)
202
176
 
203
- - If cast_options.target_schema is set, we first apply
204
- `cast_arrow_record_batch_reader` and then collect to a Table and pandas DF.
205
- """
206
- opts = CastOptions.check_arg(cast_options)
177
+ if opts.target_arrow_schema is not None:
178
+ table = cast_arrow_tabular(table, opts)
207
179
 
208
- if opts.target_arrow_schema is not None:
209
- reader = cast_arrow_record_batch_reader(reader, opts)
180
+ return table.to_pandas()
210
181
 
211
- batches = list(reader)
212
- if not batches:
213
- empty_table = pa.Table.from_arrays([], names=[])
214
- return empty_table.to_pandas()
215
182
 
216
- table = pa.Table.from_batches(batches)
217
- return arrow_table_to_pandas_dataframe(table, opts)
183
+ @pandas_converter(pa.RecordBatchReader, PandasDataFrame)
184
+ def record_batch_reader_to_pandas_dataframe(
185
+ reader: pa.RecordBatchReader,
186
+ cast_options: Optional[CastOptions] = None,
187
+ ) -> PandasDataFrame:
188
+ """
189
+ Convert a pyarrow.RecordBatchReader to a pandas DataFrame.
218
190
 
191
+ - If cast_options.target_schema is set, we first apply
192
+ `cast_arrow_record_batch_reader` and then collect to a Table and pandas DF.
193
+ """
194
+ opts = CastOptions.check_arg(cast_options)
219
195
 
220
- # ---------------------------------------------------------------------------
221
- # pandas -> Arrow
222
- # ---------------------------------------------------------------------------
196
+ if opts.target_arrow_schema is not None:
197
+ reader = cast_arrow_record_batch_reader(reader, opts)
223
198
 
199
+ batches = list(reader)
200
+ if not batches:
201
+ empty_table = pa.Table.from_arrays([], names=[])
202
+ return empty_table.to_pandas()
203
+
204
+ table = pa.Table.from_batches(batches)
205
+ return arrow_table_to_pandas_dataframe(table, opts)
206
+
207
+
208
+ # ---------------------------------------------------------------------------
209
+ # pandas -> Arrow
210
+ # ---------------------------------------------------------------------------
211
+
212
+
213
+ @pandas_converter(PandasSeries, pa.Array)
214
+ def pandas_series_to_arrow_array(
215
+ series: PandasSeries,
216
+ cast_options: Optional[CastOptions] = None,
217
+ ) -> pa.Array:
218
+ """
219
+ Convert a pandas Series to a pyarrow.Array, optionally applying Arrow
220
+ casting via ArrowCastOptions.
221
+ """
222
+ opts = CastOptions.check_arg(cast_options)
223
+
224
+ array = pa.array(series, from_pandas=True)
225
+ return cast_arrow_array(array, opts)
226
+
227
+
228
+ @pandas_converter(PandasDataFrame, pa.Table)
229
+ def pandas_dataframe_to_arrow_table(
230
+ dataframe: PandasDataFrame,
231
+ cast_options: Optional[CastOptions] = None,
232
+ ) -> pa.Table:
233
+ """
234
+ Convert a pandas DataFrame to a pyarrow.Table, optionally applying Arrow
235
+ casting rules via ArrowCastOptions.
236
+ """
237
+ opts = CastOptions.check_arg(cast_options)
238
+
239
+ table = pa.Table.from_pandas(dataframe, preserve_index=False)
240
+ return cast_arrow_tabular(table, opts)
241
+
242
+
243
+ @pandas_converter(PandasDataFrame, pa.RecordBatchReader)
244
+ def pandas_dataframe_to_record_batch_reader(
245
+ dataframe: PandasDataFrame,
246
+ cast_options: Optional[CastOptions] = None,
247
+ ) -> pa.RecordBatchReader:
248
+ """
249
+ Convert a pandas DataFrame to a pyarrow.RecordBatchReader, optionally
250
+ applying Arrow casting via ArrowCastOptions.
251
+ """
252
+ opts = CastOptions.check_arg(cast_options)
253
+
254
+ table = pa.Table.from_pandas(dataframe, preserve_index=False)
255
+ table = cast_arrow_tabular(table, opts)
224
256
 
225
- @pandas_converter(PandasSeries, pa.Array)
226
- def pandas_series_to_arrow_array(
227
- series: "pandas.Series",
228
- cast_options: Optional[CastOptions] = None,
229
- ) -> pa.Array:
230
- """
231
- Convert a pandas Series to a pyarrow.Array, optionally applying Arrow
232
- casting via ArrowCastOptions.
233
- """
234
- opts = CastOptions.check_arg(cast_options)
235
-
236
- array = pa.array(series, from_pandas=True)
237
- return cast_arrow_array(array, opts)
238
-
239
-
240
- @pandas_converter(PandasDataFrame, pa.Table)
241
- def pandas_dataframe_to_arrow_table(
242
- dataframe: "pandas.DataFrame",
243
- cast_options: Optional[CastOptions] = None,
244
- ) -> pa.Table:
245
- """
246
- Convert a pandas DataFrame to a pyarrow.Table, optionally applying Arrow
247
- casting rules via ArrowCastOptions.
248
- """
249
- opts = CastOptions.check_arg(cast_options)
250
-
251
- table = pa.Table.from_pandas(dataframe, preserve_index=False)
252
- return cast_arrow_tabular(table, opts)
253
-
254
-
255
- @pandas_converter(PandasDataFrame, pa.RecordBatchReader)
256
- def pandas_dataframe_to_record_batch_reader(
257
- dataframe: "pandas.DataFrame",
258
- cast_options: Optional[CastOptions] = None,
259
- ) -> pa.RecordBatchReader:
260
- """
261
- Convert a pandas DataFrame to a pyarrow.RecordBatchReader, optionally
262
- applying Arrow casting via ArrowCastOptions.
263
- """
264
- opts = CastOptions.check_arg(cast_options)
265
-
266
- table = pa.Table.from_pandas(dataframe, preserve_index=False)
267
- table = cast_arrow_tabular(table, opts)
268
-
269
- batches = table.to_batches()
270
- return pa.RecordBatchReader.from_batches(table.schema, batches)
257
+ batches = table.to_batches()
258
+ return pa.RecordBatchReader.from_batches(table.schema, batches)
@@ -1,18 +1,21 @@
1
1
  """Polars <-> Arrow casting helpers and converters."""
2
2
 
3
- from typing import Optional, Tuple, Union, Dict, Any
3
+ from typing import Optional, Tuple, Union, Dict
4
4
 
5
5
  import pyarrow as pa
6
6
 
7
7
  from .arrow_cast import (
8
8
  cast_arrow_array,
9
9
  cast_arrow_tabular,
10
- cast_arrow_record_batch_reader, is_arrow_type_binary_like, is_arrow_type_string_like, is_arrow_type_list_like,
10
+ cast_arrow_record_batch_reader,
11
+ is_arrow_type_binary_like,
12
+ is_arrow_type_string_like,
13
+ is_arrow_type_list_like,
11
14
  )
12
15
  from .cast_options import CastOptions
13
16
  from .registry import register_converter
14
17
  from ..python_defaults import default_arrow_scalar
15
- from ...libs.polarslib import polars
18
+ from ...libs.polarslib import *
16
19
 
17
20
  __all__ = [
18
21
  "polars_converter",
@@ -41,14 +44,8 @@ __all__ = [
41
44
  # Polars type aliases + decorator wrapper (safe when Polars is missing)
42
45
  # ---------------------------------------------------------------------------
43
46
 
44
- if polars is not None:
45
- PolarsSeries = polars.Series
46
- PolarsExpr = polars.Expr
47
- PolarsDataFrame = polars.DataFrame
48
- PolarsField = polars.Field
49
- PolarsSchema = polars.Schema
50
- PolarsDataType = polars.DataType
51
47
 
48
+ if polars is not None:
52
49
  # Primitive Arrow -> Polars dtype mapping (base, non-nested types).
53
50
  # These are Polars *dtype classes* (not instances), so they can be used
54
51
  # directly in schemas (e.g. pl.Struct({"a": pl.Int64})).
@@ -95,18 +92,6 @@ if polars is not None:
95
92
  else:
96
93
  ARROW_TO_POLARS = {}
97
94
 
98
- # Dummy types so annotations/decorators don't explode without Polars
99
- class _PolarsDummy: # pragma: no cover - only used when Polars not installed
100
- """Placeholder type for polars symbols when polars is unavailable."""
101
- pass
102
-
103
- PolarsSeries = _PolarsDummy
104
- PolarsExpr = _PolarsDummy
105
- PolarsDataFrame = _PolarsDummy
106
- PolarsField = _PolarsDummy
107
- PolarsSchema = _PolarsDummy
108
- PolarsDataType = _PolarsDummy
109
-
110
95
  def polars_converter(*_args, **_kwargs): # pragma: no cover - no-op decorator
111
96
  """Return a no-op decorator when polars is unavailable.
112
97
 
@@ -737,26 +722,6 @@ def arrow_field_to_polars_field(
737
722
  return built
738
723
 
739
724
 
740
- def _polars_base_type(pl_dtype: Any) -> Any:
741
- """
742
- Normalize a Polars dtype or dtype class to its base_type class,
743
- so we can key into POLARS_BASE_TO_ARROW.
744
- """
745
- # dtype is an instance
746
- base_method = getattr(pl_dtype, "base_type", None)
747
- if callable(base_method):
748
- return base_method()
749
- # dtype is a class (e.g. pl.Int64)
750
- try:
751
- instance = pl_dtype()
752
- except Exception:
753
- return pl_dtype
754
- base_method = getattr(instance, "base_type", None)
755
- if callable(base_method):
756
- return base_method()
757
- return pl_dtype
758
-
759
-
760
725
  @polars_converter(PolarsDataType, pa.DataType)
761
726
  def polars_type_to_arrow_type(
762
727
  pl_type: PolarsDataType,
@@ -767,7 +732,10 @@ def polars_type_to_arrow_type(
767
732
 
768
733
  Handles primitives via POLARS_BASE_TO_ARROW and common nested/temporal types.
769
734
  """
770
- base = _polars_base_type(pl_type)
735
+ try:
736
+ base = pl_type()
737
+ except Exception:
738
+ base = pl_type
771
739
 
772
740
  # Primitive base mapping
773
741
  existing = POLARS_BASE_TO_ARROW.get(base) or POLARS_BASE_TO_ARROW.get(type(pl_type))
@@ -0,0 +1,81 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+
4
+ __all__ = ["DummyModuleClass"]
5
+
6
+
7
+ class DummyModuleClass(ABC):
8
+ """
9
+ Hard-fail dummy proxy: any interaction raises, except a few safe internals.
10
+ """
11
+
12
+ @classmethod
13
+ @abstractmethod
14
+ def module_name(cls) -> str:
15
+ raise NotImplementedError
16
+
17
+ def _raise(self, action: str, name: str | None = None):
18
+ target = type(self).module_name()
19
+ extra = f" '{name}'" if name else ""
20
+ raise ModuleNotFoundError(
21
+ f"{type(self).__name__} is a dummy for missing optional dependency "
22
+ f"module '{target}'. Tried to {action}{extra}."
23
+ )
24
+
25
+ # --- attribute access / mutation ---
26
+ def __getattribute__(self, name: str):
27
+ # allow introspection / internals without blowing up
28
+ if name in {"module_name", "_raise", "__class__", "__dict__", "__repr__", "__str__", "__dir__"}:
29
+ return object.__getattribute__(self, name)
30
+ self._raise("access attribute", name)
31
+
32
+ def __getattr__(self, name: str):
33
+ self._raise("access attribute", name)
34
+
35
+ def __setattr__(self, name: str, value):
36
+ self._raise("set attribute", name)
37
+
38
+ def __delattr__(self, name: str):
39
+ self._raise("delete attribute", name)
40
+
41
+ def __dir__(self):
42
+ # show minimal surface
43
+ return ["module_name"]
44
+
45
+ def __repr__(self) -> str:
46
+ return f"<{type(self).__name__} dummy for '{type(self).module_name()}'>"
47
+
48
+ def __str__(self) -> str:
49
+ return self.__repr__()
50
+
51
+ # --- common "other" interactions ---
52
+ def __call__(self, *args, **kwargs):
53
+ self._raise("call module")
54
+
55
+ def __getitem__(self, key):
56
+ self._raise("index", str(key))
57
+
58
+ def __setitem__(self, key, value):
59
+ self._raise("set item", str(key))
60
+
61
+ def __delitem__(self, key):
62
+ self._raise("delete item", str(key))
63
+
64
+ def __iter__(self):
65
+ self._raise("iterate")
66
+
67
+ def __len__(self):
68
+ self._raise("get length")
69
+
70
+ def __contains__(self, item):
71
+ self._raise("check containment")
72
+
73
+ def __bool__(self):
74
+ self._raise("coerce to bool")
75
+
76
+
77
+ # Example:
78
+ # class PyArrowDummy(DummyModuleClass):
79
+ # @classmethod
80
+ # def module_name(cls) -> str:
81
+ # return "pyarrow"
@@ -1,8 +1,12 @@
1
- from pyarrow.dataset import FileFormat
1
+ from pyarrow.dataset import FileFormat, ParquetFileFormat, CsvFileFormat, JsonFileFormat
2
2
 
3
3
 
4
4
  __all__ = [
5
- "ExcelFileFormat"
5
+ "FileFormat",
6
+ "ExcelFileFormat",
7
+ "ParquetFileFormat",
8
+ "CsvFileFormat",
9
+ "JsonFileFormat"
6
10
  ]
7
11
 
8
12