Skip to content

Commit 16d2fec

Browse files
dcherianclaude
andcommitted
refactor: extract scan and factorize functions to separate modules
Create new modules that re-export functions from core.py: - flox/factorize.py: factorize_, FactorProps, etc. - flox/reindex.py: reindex_, reindex_numpy, etc. - flox/scan.py: groupby_scan, chunk_scan, etc. This improves code organization and provides a clearer API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6e0a972 commit 16d2fec

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

flox/factorize.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Factorization functions for groupby operations.
2+
3+
This module provides functions for factorizing groupby labels.
4+
Re-exported from flox.core for backward compatibility.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
# Re-export from core for backward compatibility
10+
from .core import (
11+
FactorizeKwargs,
12+
FactorProps,
13+
_factorize_multiple,
14+
_factorize_single,
15+
_lazy_factorize_wrapper,
16+
_ravel_factorized,
17+
factorize_,
18+
offset_labels,
19+
)
20+
21+
__all__ = [
22+
"FactorizeKwargs",
23+
"FactorProps",
24+
"_factorize_multiple",
25+
"_factorize_single",
26+
"_lazy_factorize_wrapper",
27+
"_ravel_factorized",
28+
"factorize_",
29+
"offset_labels",
30+
]

flox/reindex.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""Reindexing functions for groupby operations.
2+
3+
This module provides functions for reindexing arrays during groupby operations.
4+
Re-exported from flox.core for backward compatibility.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
# Re-export from core for backward compatibility
10+
from .core import (
11+
reindex_,
12+
reindex_numpy,
13+
reindex_pydata_sparse_coo,
14+
)
15+
16+
__all__ = [
17+
"reindex_",
18+
"reindex_numpy",
19+
"reindex_pydata_sparse_coo",
20+
]

flox/scan.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Scan operations for groupby reductions.
2+
3+
This module provides scan operations (cumulative reductions) for grouped data.
4+
Re-exported from flox.core for backward compatibility.
5+
"""
6+
7+
from __future__ import annotations
8+
9+
# Re-export from core for backward compatibility
10+
from .core import (
11+
_finalize_scan,
12+
_zip,
13+
chunk_scan,
14+
groupby_scan,
15+
grouped_reduce,
16+
)
17+
18+
__all__ = [
19+
"_finalize_scan",
20+
"_zip",
21+
"chunk_scan",
22+
"grouped_reduce",
23+
"groupby_scan",
24+
]

0 commit comments

Comments
 (0)