FlowerPower 0.11.6.15__py3-none-any.whl → 0.11.6.16__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.
@@ -53,7 +53,12 @@ def _optimize_numeric_column(
53
53
  expr = pl.col(col_name)
54
54
  dtype = series.dtype
55
55
 
56
- if allow_unsigned and dtype.is_integer() and (series.min() is not None) and series.min() >= 0:
56
+ if (
57
+ allow_unsigned
58
+ and dtype.is_integer()
59
+ and (series.min() is not None)
60
+ and series.min() >= 0
61
+ ):
57
62
  # Convert to unsigned integer type, shrink if requested
58
63
  if shrink:
59
64
  return expr.cast(pl.UInt64).shrink_dtype()
@@ -128,7 +133,11 @@ def _optimize_string_column(
128
133
 
129
134
 
130
135
  def _get_column_expr(
131
- df: pl.DataFrame, col_name: str, shrink_numerics: bool, time_zone: str | None = None
136
+ df: pl.DataFrame,
137
+ col_name: str,
138
+ shrink_numerics: bool,
139
+ allow_unsigned: bool,
140
+ time_zone: str | None = None,
132
141
  ) -> pl.Expr:
133
142
  """Generate optimization expression for a single column."""
134
143
  series = df[col_name]
@@ -139,7 +148,9 @@ def _get_column_expr(
139
148
 
140
149
  # Process based on current type
141
150
  if series.dtype.is_numeric():
142
- return _optimize_numeric_column(series, col_name, shrink_numerics)
151
+ return _optimize_numeric_column(
152
+ series, col_name, shrink_numerics, allow_unsigned
153
+ )
143
154
  elif series.dtype == pl.Utf8:
144
155
  return _optimize_string_column(series, col_name, shrink_numerics, time_zone)
145
156
 
@@ -153,6 +164,7 @@ def opt_dtype(
153
164
  exclude: str | list[str] | None = None,
154
165
  time_zone: str | None = None,
155
166
  shrink_numerics: bool = True,
167
+ allow_unsigned: bool = True,
156
168
  strict: bool = False,
157
169
  ) -> pl.DataFrame:
158
170
  """
@@ -168,6 +180,7 @@ def opt_dtype(
168
180
  exclude: Column(s) to exclude from optimization
169
181
  time_zone: Optional time zone for datetime parsing
170
182
  shrink_numerics: Whether to downcast numeric types when possible
183
+ allow_unsigned: Whether to allow unsigned integer types
171
184
  strict: If True, will raise an error if any column cannot be optimized
172
185
 
173
186
  Returns:
@@ -191,7 +204,9 @@ def opt_dtype(
191
204
  for col_name in cols_to_process:
192
205
  try:
193
206
  expressions.append(
194
- _get_column_expr(df, col_name, shrink_numerics, time_zone)
207
+ _get_column_expr(
208
+ df, col_name, shrink_numerics, allow_unsigned, time_zone
209
+ )
195
210
  )
196
211
  except Exception as e:
197
212
  if strict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FlowerPower
3
- Version: 0.11.6.15
3
+ Version: 0.11.6.16
4
4
  Summary: A simple workflow framework. Hamilton + APScheduler = FlowerPower
5
5
  Author-email: "Volker L." <ligno.blades@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/legout/flowerpower
@@ -47,7 +47,7 @@ flowerpower/pipeline/visualizer.py,sha256=amjMrl5NetErE198HzZBPWVZBi_t5jj9ydxWpu
47
47
  flowerpower/plugins/io/base.py,sha256=oGxTKobs0M19hPV842EelAeJ01EBz6kDdGv_4GTyFzk,97098
48
48
  flowerpower/plugins/io/metadata.py,sha256=PCrepLilXRWKDsB5BKFF_-OFs712s1zBeitW-84lDLQ,7005
49
49
  flowerpower/plugins/io/helpers/datetime.py,sha256=1WBUg2ywcsodJQwoF6JiIGc9yhVobvE2IErWp4i95m4,10649
50
- flowerpower/plugins/io/helpers/polars.py,sha256=B4eg0GZUWh5Mbd1auC8SMmkCznR07q3sHDcgnwRmSNU,27856
50
+ flowerpower/plugins/io/helpers/polars.py,sha256=ESA2YHZmWCmyhjwNULQO9_7G_sFcgF9x3q-IGatbP-0,28124
51
51
  flowerpower/plugins/io/helpers/pyarrow.py,sha256=lYZHbPklzYvd7L5XqDjoTUV42cHi_c9Wh8xf1HYtS2M,18592
52
52
  flowerpower/plugins/io/helpers/sql.py,sha256=BPIxjarKF3p93EdtUu-md8KislE9q8IWNSeZ5toFU6U,7298
53
53
  flowerpower/plugins/io/loader/__init__.py,sha256=MKH42nvVokaWas0wFgX1yrpU5iLpvHjRqqF-KzwLHCg,780
@@ -94,9 +94,9 @@ flowerpower/utils/monkey.py,sha256=VPl3yimoWhwD9kI05BFsjNvtyQiDyLfY4Q85Bb6Ma0w,2
94
94
  flowerpower/utils/open_telemetry.py,sha256=fQWJWbIQFtKIxMBjAWeF12NGnqT0isO3A3j-DSOv_vE,949
95
95
  flowerpower/utils/scheduler.py,sha256=2zJ_xmLXpvXUQNF1XS2Gqm3Ogo907ctZ50GtvQB_rhE,9354
96
96
  flowerpower/utils/templates.py,sha256=ouyEeSDqa9PjW8c32fGpcINlpC0WToawRFZkMPtwsLE,1591
97
- flowerpower-0.11.6.15.dist-info/licenses/LICENSE,sha256=9AkLexxrmr0aBgSHiqxpJk9wgazpP1CTJyiDyr56J9k,1063
98
- flowerpower-0.11.6.15.dist-info/METADATA,sha256=QIkBDvwIdawIRdDJDxx0a9xSbBUzX4X-vjQwKjY8Fh8,21613
99
- flowerpower-0.11.6.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
- flowerpower-0.11.6.15.dist-info/entry_points.txt,sha256=61X11i5a2IwC9LBiP20XCDl5zMOigGCjMCx17B7bDbQ,52
101
- flowerpower-0.11.6.15.dist-info/top_level.txt,sha256=VraH4WtEUfSxs5L-rXwDQhzQb9eLHTUtgvmFZ2dAYnA,12
102
- flowerpower-0.11.6.15.dist-info/RECORD,,
97
+ flowerpower-0.11.6.16.dist-info/licenses/LICENSE,sha256=9AkLexxrmr0aBgSHiqxpJk9wgazpP1CTJyiDyr56J9k,1063
98
+ flowerpower-0.11.6.16.dist-info/METADATA,sha256=X1bvOqBHxJgYBRCceoHrE3huch9jf2VB3bwj-5LMLbE,21613
99
+ flowerpower-0.11.6.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
+ flowerpower-0.11.6.16.dist-info/entry_points.txt,sha256=61X11i5a2IwC9LBiP20XCDl5zMOigGCjMCx17B7bDbQ,52
101
+ flowerpower-0.11.6.16.dist-info/top_level.txt,sha256=VraH4WtEUfSxs5L-rXwDQhzQb9eLHTUtgvmFZ2dAYnA,12
102
+ flowerpower-0.11.6.16.dist-info/RECORD,,