Skip to content

Commit d202e5e

Browse files
authored
refactor: clean up bigframes/core/__init__.py (#1380)
* refactor: move ArrayValue out of init.py * fix mypy * Remove unused import * make identifier import consistent
1 parent b598aa8 commit d202e5e

File tree

8 files changed

+668
-657
lines changed

8 files changed

+668
-657
lines changed

bigframes/core/__init__.py

Lines changed: 2 additions & 538 deletions
Large diffs are not rendered by default.

bigframes/core/array_value.py

Lines changed: 553 additions & 0 deletions
Large diffs are not rendered by default.

bigframes/core/blocks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import pandas as pd
4949
import pyarrow as pa
5050

51+
from bigframes import session
5152
import bigframes._config.sampling_options as sampling_options
5253
import bigframes.constants
5354
import bigframes.core as core
@@ -257,7 +258,7 @@ def dtypes(
257258
return [self.expr.get_column_type(col) for col in self.value_columns]
258259

259260
@property
260-
def session(self) -> core.Session:
261+
def session(self) -> session.Session:
261262
return self._expr.session
262263

263264
@functools.cached_property
@@ -2653,7 +2654,7 @@ def dtypes(
26532654
]
26542655

26552656
@property
2656-
def session(self) -> core.Session:
2657+
def session(self) -> session.Session:
26572658
return self._expr.session
26582659

26592660
@property
@@ -3171,7 +3172,7 @@ def unpivot(
31713172

31723173

31733174
def _pd_index_to_array_value(
3174-
session: core.Session,
3175+
session: session.Session,
31753176
index: pd.Index,
31763177
) -> core.ArrayValue:
31773178
"""

bigframes/core/groupby/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import jellyfish
2323
import pandas as pd
2424

25+
from bigframes import session
2526
from bigframes.core import log_adapter
26-
import bigframes.core as core
2727
import bigframes.core.block_transforms as block_ops
2828
import bigframes.core.blocks as blocks
2929
import bigframes.core.expression
@@ -76,7 +76,7 @@ def __init__(
7676
]
7777

7878
@property
79-
def _session(self) -> core.Session:
79+
def _session(self) -> session.Session:
8080
return self._block.session
8181

8282
def __getitem__(
@@ -492,7 +492,7 @@ def _aggregate_all(
492492
def _apply_window_op(
493493
self,
494494
op: agg_ops.WindowOp,
495-
window: typing.Optional[core.WindowSpec] = None,
495+
window: typing.Optional[window_specs.WindowSpec] = None,
496496
numeric_only: bool = False,
497497
):
498498
"""Apply window op to groupby. Defaults to grouped cumulative window."""
@@ -536,7 +536,7 @@ def __init__(
536536
self._dropna = dropna # Applies to aggregations but not windowing
537537

538538
@property
539-
def _session(self) -> core.Session:
539+
def _session(self) -> session.Session:
540540
return self._block.session
541541

542542
@validations.requires_ordering()
@@ -759,7 +759,7 @@ def _apply_window_op(
759759
self,
760760
op: agg_ops.WindowOp,
761761
discard_name=False,
762-
window: typing.Optional[core.WindowSpec] = None,
762+
window: typing.Optional[window_specs.WindowSpec] = None,
763763
never_skip_nulls: bool = False,
764764
):
765765
"""Apply window op to groupby. Defaults to grouped cumulative window."""

0 commit comments

Comments
 (0)