-
Notifications
You must be signed in to change notification settings - Fork 647
/
utils.py
60 lines (46 loc) · 2.16 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.
"""
Module contains useful enums for Modin.
Axis is an enum that represents the `axis` argument for dataframe operations.
JoinType is an enum that represents the `join_type` or `how` argument for the join algebra operator.
"""
from enum import Enum
import sys
if sys.version_info.minor < 8:
from typing_extensions import Literal
else:
from typing import Literal # type: ignore
class Axis(Enum): # noqa: PR01
"""
An enum that represents the `axis` argument provided to the algebra operators.
The enum has 3 values - ROW_WISE to represent the row axis, COL_WISE to represent the
column axis, and CELL_WISE to represent no axis. ROW_WISE operations iterate over the rows
COL_WISE operations over the columns, and CELL_WISE operations over any of the partitioning
schemes that are supported in Modin (row-wise, column-wise, or block-wise).
"""
ROW_WISE = 0
COL_WISE = 1
CELL_WISE = None
AxisInt = Literal[0, 1]
"""Type for the two possible integer values of an axis argument (0 or 1)."""
class JoinType(Enum): # noqa: PR01
"""
An enum that represents the `join_type` argument provided to the algebra operators.
The enum has 4 values - INNER to represent inner joins, LEFT to represent left joins, RIGHT to
represent right joins, and OUTER to represent outer joins.
"""
INNER = "inner"
LEFT = "left"
RIGHT = "right"
OUTER = "outer"