Skip to content

Commit

Permalink
clean up mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpotts committed Nov 4, 2024
1 parent 2db3f5f commit e7bd8d9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 52 deletions.
64 changes: 19 additions & 45 deletions arkouda/pdarrayclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,66 +31,40 @@

if TYPE_CHECKING:

def sum(
def numeric_reduce(
pda,
axis: Optional[Union[int, Tuple[int, ...]]] = None,
keepdims: bool = False,
) -> Union[numpy_scalars, pdarray]:
pass

def prod(
pda,
axis: Optional[Union[int, Tuple[int, ...]]] = None,
keepdims: bool = False,
) -> Union[numpy_scalars, pdarray]:
pass

def max(
pda,
axis: Optional[Union[int, Tuple[int, ...]]] = None,
keepdims: bool = False,
) -> Union[numpy_scalars, pdarray]:
pass

def min(
pda,
axis: Optional[Union[int, Tuple[int, ...]]] = None,
keepdims: bool = False,
) -> Union[numpy_scalars, pdarray]:
pass
sum = numeric_reduce
prod = numeric_reduce
max = numeric_reduce
min = numeric_reduce

def is_sorted(
pda, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False
) -> Union[bool_scalars, pdarray]:
pass

def is_locally_sorted(
pda, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False
) -> Union[bool_scalars, pdarray]:
pass

def any(
def boolean_reduce(
pda, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False
) -> Union[bool_scalars, pdarray]:
pass

def all(
pda, axis: Optional[Union[int, Tuple[int, ...]]] = None, keepdims: bool = False
) -> Union[bool_scalars, pdarray]:
pass
is_sorted = boolean_reduce
is_locally_sorted = boolean_reduce
all = boolean_reduce
any = boolean_reduce


__all__ = [ # noqa: F822
__all__ = [
"pdarray",
"clear",
"any", # noqa: F822
"all", # noqa: F822
"is_sorted", # noqa: F822
"sum", # noqa: F822
"any",
"all",
"is_sorted",
"sum",
"dot",
"prod", # noqa: F822
"min", # noqa: F822
"max", # noqa: F822
"prod",
"min",
"max",
"argmin",
"argmax",
"mean",
Expand Down Expand Up @@ -118,7 +92,7 @@ def all(
"RegistrationError",
"broadcast_to_shape",
"_to_pdarray",
] # noqa: F822
]
logger = getArkoudaLogger(name="pdarrayclass")

SUPPORTED_REDUCTION_OPS = ["any", "all", "isSorted", "isSortedLocally", "max", "min", "sum", "prod"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
]


def generate_function():
def generate_reduction_functions():

ret = """module ReductionMsgFunctions
{
Expand Down Expand Up @@ -60,15 +60,10 @@ def generate_function():

def main():

infile = "src/ReductionMsg.chpl"

x = generate_function()
print(x)

outfile = "src/ReductionMsgFunctions.chpl"

with open(outfile, "w") as text_file:
text_file.write(x)
text_file.write(generate_reduction_functions())


if __name__ == "__main__":
Expand Down

0 comments on commit e7bd8d9

Please sign in to comment.