Skip to content

Commit

Permalink
>=3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jacgoldsm committed Sep 25, 2023
1 parent d547fae commit cf4a121
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6.15", "3.7.17", "3.8.18", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions osos/_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from pandas.core.groupby.generic import SeriesGroupBy
from pandas.core.window.rolling import Rolling as RollingWindow
from typing import Union, Callable, Iterable, Any, overload, Optional
from typing import Union, Callable, Iterable, Any, overload, Optional,List,Tuple
from warnings import warn

from .window import EmptyWindow, ConcreteWindowSpec
Expand Down Expand Up @@ -568,7 +568,7 @@ def nanvl_func(col1: pd.Series, col2: pd.Series):

def percentile_approx_func(
col: pd.Series,
percentage: Union[pd.Series, float, list[float], tuple[float]],
percentage: Union[pd.Series, float, List[float], tuple[float]],
accuracy: Union[pd.Series, float] = 10000,
):

Expand Down Expand Up @@ -677,7 +677,7 @@ def struct_func(*cols: pd.Series):

@overload
def struct_func(
__cols: Union[list[pd.Series], tuple[pd.Series, ...]]
__cols: Union[List[pd.Series], Tuple[pd.Series, ...]]
):
...

Expand All @@ -686,7 +686,7 @@ def struct_func(
def struct_func(
*cols: Union[
pd.Series,
Union[list[pd.Series], tuple[pd.Series, ...]],
Union[List[pd.Series], tuple[pd.Series, ...]],
]
):

Expand Down
4 changes: 2 additions & 2 deletions osos/column.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from numbers import Number
from typing import Union, Iterable, TYPE_CHECKING
from typing import Union, Iterable, TYPE_CHECKING,List
import operator
from copy import deepcopy
import numpy as np
Expand Down Expand Up @@ -95,7 +95,7 @@ def alias(self, newname):


class ColumnList(Node):
def __init__(self, args: list["AbstractColOrLit"]):
def __init__(self, args: List["AbstractColOrLit"]):
def extract_columns(*args):
return list(args)

Expand Down
6 changes: 3 additions & 3 deletions osos/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from copy import deepcopy, copy
import numpy as np
from typing import Iterable, Union, Optional,cast
from typing import Iterable, Union, Optional,cast,List
import pandas as pd


Expand Down Expand Up @@ -200,7 +200,7 @@ def union(self, other: "DataFrame") -> "DataFrame":
def unionAll(self, other: "DataFrame") -> "DataFrame":
return self.union(other).dropDuplicates()

def dropDuplicates(self, subset: Optional[list[str]] = None) -> "DataFrame":
def dropDuplicates(self, subset: Optional[List[str]] = None) -> "DataFrame":
return DataFrame(
self._data.drop_duplicates(subset, ignore_index=True).reindex()
)
Expand All @@ -211,7 +211,7 @@ def unionByName(self, other: "DataFrame") -> "DataFrame":
othersort = other._data.sort_index(axis=1)
return DataFrame(pd.concat([selfsort, othersort]))

def join(self, other: "DataFrame", by: Union[str, list], how: str):
def join(self, other: "DataFrame", by: Union[str, List], how: str):
by = [by] if isinstance(by, str) else by

assert how in (
Expand Down
2 changes: 1 addition & 1 deletion osos/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .dataframe import DataFrame


from typing import Any, Optional, Union, List, Tuple, overload, Callable
from typing import Any, Optional, Union, List, Tuple, overload, Callable,Tuple
from warnings import warn

# all the public names in _implementations end in "_func"
Expand Down
4 changes: 2 additions & 2 deletions osos/indexer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pandas.api.indexers import BaseIndexer
import pandas as pd
import numpy as np
from typing import Union
from typing import Union,Tuple


from .window import currentRow, unboundedFollowing, unboundedPreceding
Expand Down Expand Up @@ -29,7 +29,7 @@ def get_window_bounds(
min_periods: Union[int, None] = None,
center: Union[bool, None] = None,
closed: Union[str, None] = None,
) -> tuple[np.ndarray, np.ndarray]:
) -> Tuple[np.ndarray, np.ndarray]:

# case 1: partitioned by column(s), no range/row spec
# the partitioning is already done by the groupby,
Expand Down
6 changes: 4 additions & 2 deletions osos/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import pandas as pd
from decimal import Decimal

from typing import List,Tuple

# integral
IntegerType = lambda: np.int32
FloatType = lambda: np.float32
Expand Down Expand Up @@ -32,10 +34,10 @@
DayTimeIntervalType = lambda *args: pd.Timedelta

# complex
ArrayType = lambda elementType, containsNull=False: list
ArrayType = lambda elementType, containsNull=False: List
MapType = lambda keyType, elementType, valueContainsNull=False: dict
StructType = lambda fields: np.array
StructField = lambda name,dataType,nullable=False: tuple
StructField = lambda name,dataType,nullable=False: Tuple



Expand Down
4 changes: 2 additions & 2 deletions osos/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import itertools
from typing import Iterable, Union,cast
from typing import Iterable, Union,cast,List
import pandas as pd
from pandas.core.groupby.generic import SeriesGroupBy

Expand Down Expand Up @@ -39,7 +39,7 @@ def flatten_and_process(cols: Iterable[Union[str,Node]]) -> Iterable[Node]:
if isinstance(col, str):
flat_cols[i] = AbstractCol(col)

return cast(list[Node],flat_cols)
return cast(List[Node],flat_cols)


def rename_series(series: pd.Series, newname: str, _over=None) -> pd.Series:
Expand Down
6 changes: 3 additions & 3 deletions osos/window.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .exceptions import AnalysisException
from .utils import flatten_cols
from typing import Union
from typing import Union,List

from .column import Node, AbstractCol, SimpleContainer, ColumnList, ForwardRef

Expand Down Expand Up @@ -160,8 +160,8 @@ def __init__(
rows_between=None,
range_between=None,
) -> None:
self.partition_by: list["ColumnType"] = partition_by
self.order_by: list["ColumnType"] = order_by
self.partition_by: List["ColumnType"] = partition_by
self.order_by: List["ColumnType"] = order_by
self.rows_between: "SimpleContainer" = rows_between
self.range_between: "SimpleContainer" = range_between

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy>=1.2
pandas>=1.5.0
sqlglot>=10.0.0
pandas>=1.0.0
sqlglot
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from setuptools import setup, find_packages

setup(packages=find_packages())
setup(
packages=find_packages(),
python_requires=">=3.7"
)

0 comments on commit cf4a121

Please sign in to comment.