Skip to content

Commit

Permalink
Replace the new sentinel with no_default.
Browse files Browse the repository at this point in the history
Signed-off-by: mvashishtha <mahesh@ponder.io>
  • Loading branch information
mvashishtha committed Feb 8, 2022
1 parent 337350c commit b7bf0bd
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 24 deletions.
1 change: 0 additions & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ dependencies:
- cloudpickle
- boto3
- scikit-learn
- sentinels
- pip:
- xgboost>=1.3
- modin-spreadsheet>=0.1.1
Expand Down
7 changes: 0 additions & 7 deletions modin/core/dataframe/base/dataframe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""

from enum import Enum
import sentinels


class Axis(Enum): # noqa: PR01
Expand Down Expand Up @@ -49,9 +48,3 @@ class JoinType(Enum): # noqa: PR01
LEFT = "left"
RIGHT = "right"
OUTER = "outer"


# This value signals that when using a Modin frame method that takes an item to
# distribute, we don't want to provide an item to distribute. We need a sentinel
# because sometimes we do want to distribute the scalar None.
no_item_to_distribute = sentinels.Sentinel("NoItemToDistribute")
8 changes: 4 additions & 4 deletions modin/core/dataframe/pandas/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import datetime
from pandas.core.indexes.api import ensure_index, Index, RangeIndex
from pandas.core.dtypes.common import is_numeric_dtype, is_list_like
from pandas._libs.lib import no_default
from typing import List, Hashable, Optional, Callable, Union, Dict

from modin.core.storage_formats.pandas.query_compiler import PandasQueryCompiler
Expand All @@ -34,7 +35,6 @@
from modin.core.dataframe.base.dataframe.utils import (
Axis,
JoinType,
no_item_to_distribute,
)
from modin.pandas.indexing import is_range_like
from modin.pandas.utils import is_full_grab_slice, check_both_not_none
Expand Down Expand Up @@ -1908,7 +1908,7 @@ def apply_select_indices(
new_index=None,
new_columns=None,
keep_remaining=False,
item_to_distribute=no_item_to_distribute,
item_to_distribute=no_default,
):
"""
Apply a function for a subset of the data.
Expand All @@ -1935,7 +1935,7 @@ def apply_select_indices(
advance, and if not provided it must be computed.
keep_remaining : boolean, default: False
Whether or not to drop the data that is not computed over.
item_to_distribute : np.ndarray, Sentinel, or scalar, default: no_item_to_distribute
item_to_distribute : np.ndarray, Sentinel, or scalar, default: no_default
The item to split up so it can be applied over both axes.
Returns
Expand Down Expand Up @@ -1982,7 +1982,7 @@ def apply_select_indices(
# variables set.
assert row_labels is not None and col_labels is not None
assert keep_remaining
assert item_to_distribute is not no_item_to_distribute
assert item_to_distribute is not no_default
row_partitions_list = self._get_dict_of_block_index(0, row_labels).items()
col_partitions_list = self._get_dict_of_block_index(1, col_labels).items()
new_partitions = self._partition_mgr_cls.apply_func_to_indices_both_axis(
Expand Down
8 changes: 4 additions & 4 deletions modin/core/dataframe/pandas/partitioning/partition_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
from functools import wraps
import numpy as np
import pandas
from pandas._libs.lib import no_default
import warnings

from modin.error_message import ErrorMessage
from modin.core.storage_formats.pandas.utils import compute_chunksize
from modin.core.dataframe.base.dataframe.utils import no_item_to_distribute
from modin.core.dataframe.pandas.utils import concatenate
from modin.config import NPartitions, ProgressBar, BenchmarkMode

Expand Down Expand Up @@ -1115,7 +1115,7 @@ def apply_func_to_indices_both_axis(
func,
row_partitions_list,
col_partitions_list,
item_to_distribute=no_item_to_distribute,
item_to_distribute=no_default,
row_lengths=None,
col_widths=None,
):
Expand All @@ -1136,7 +1136,7 @@ def apply_func_to_indices_both_axis(
Iterable of tuples, containing 2 values:
1. Integer column partition index.
2. Internal column indexer of this partition.
item_to_distribute : np.ndarray, Sentinel, or scalar, default: no_item_to_distribute
item_to_distribute : np.ndarray, Sentinel, or scalar, default: no_default
The item to split up so it can be applied over both axes.
row_lengths : list of ints, optional
Lengths of partitions for every row. If not specified this information
Expand Down Expand Up @@ -1191,7 +1191,7 @@ def compute_part_size(indexer, remote_part, part_idx, axis):
col_internal_idx, remote_part, col_idx, axis=1
)

if item_to_distribute is not no_item_to_distribute:
if item_to_distribute is not no_default:
if isinstance(item_to_distribute, np.ndarray):
item = item_to_distribute[
row_position_counter : row_position_counter + row_offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import threading

from modin.config import ProgressBar, NPartitions
from modin.core.dataframe.base.dataframe.utils import no_item_to_distribute
from modin.core.execution.ray.generic.partitioning.partition_manager import (
GenericRayDataframePartitionManager,
)
Expand All @@ -31,6 +30,7 @@
from modin.core.storage_formats.pandas.utils import compute_chunksize
from modin.error_message import ErrorMessage
import pandas
from pandas._libs.lib import no_default

import ray

Expand Down Expand Up @@ -551,7 +551,7 @@ def apply_func_to_indices_both_axis(
func,
row_partitions_list,
col_partitions_list,
item_to_distribute=no_item_to_distribute,
item_to_distribute=no_default,
row_lengths=None,
col_widths=None,
):
Expand All @@ -568,7 +568,7 @@ def apply_func_to_indices_both_axis(
List of row partitions.
col_partitions_list : list
List of column partitions.
item_to_distribute : np.ndarray, Sentinel, or scalar, default: no_item_to_distribute
item_to_distribute : np.ndarray, Sentinel, or scalar, default: no_default
The item to split up so it can be applied over both axes.
row_lengths : list of ints, optional
Lengths of partitions for every row. If not specified this information
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ git+https://github.com/airspeed-velocity/asv.git@ef016e233cb9a0b19d517135104f49e
xgboost>=1.3
tqdm
modin-spreadsheet>=0.1.1
sentinels
3 changes: 1 addition & 2 deletions requirements/env_omnisci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ dependencies:
- openpyxl
- xlrd
- sqlalchemy
- scipy
- sentinels
- scipy
1 change: 0 additions & 1 deletion requirements/requirements-no-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies:
- rpyc==4.1.5
- cloudpickle
- boto3
- sentinels
- pip:
- xgboost>=1.3
- modin-spreadsheet>=0.1.1
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"packaging",
"numpy>=1.18.5",
"fsspec",
"sentinels",
],
extras_require={
# can be installed by pip install modin[dask]
Expand Down

0 comments on commit b7bf0bd

Please sign in to comment.