File size: 3,461 Bytes
be7c937
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
"""Type stubs for wayy_db._core C++ extension module."""

from typing import Optional, Sequence
import numpy as np
import numpy.typing as npt

__version__: str

class DType:
    Int64: DType
    Float64: DType
    Timestamp: DType
    Symbol: DType
    Bool: DType

class WayyException(Exception): ...
class ColumnNotFound(WayyException): ...
class TypeMismatch(WayyException): ...
class InvalidOperation(WayyException): ...

class Column:
    @property
    def name(self) -> str: ...
    @property
    def dtype(self) -> DType: ...
    @property
    def size(self) -> int: ...
    def __len__(self) -> int: ...
    def to_numpy(self) -> npt.NDArray: ...

class Table:
    def __init__(self, name: str = "") -> None: ...
    @property
    def name(self) -> str: ...
    @property
    def num_rows(self) -> int: ...
    @property
    def num_columns(self) -> int: ...
    @property
    def sorted_by(self) -> Optional[str]: ...
    def __len__(self) -> int: ...
    def has_column(self, name: str) -> bool: ...
    def column(self, name: str) -> Column: ...
    def __getitem__(self, name: str) -> Column: ...
    def column_names(self) -> list[str]: ...
    def set_sorted_by(self, col: str) -> None: ...
    def save(self, path: str) -> None: ...
    @staticmethod
    def load(path: str) -> Table: ...
    @staticmethod
    def mmap(path: str) -> Table: ...
    def add_column_from_numpy(
        self, name: str, array: npt.NDArray, dtype: DType
    ) -> None: ...
    def to_dict(self) -> dict[str, npt.NDArray]: ...

class Database:
    def __init__(self, path: str = "") -> None: ...
    @property
    def path(self) -> str: ...
    @property
    def is_persistent(self) -> bool: ...
    def tables(self) -> list[str]: ...
    def has_table(self, name: str) -> bool: ...
    def table(self, name: str) -> Table: ...
    def __getitem__(self, name: str) -> Table: ...
    def create_table(self, name: str) -> Table: ...
    def drop_table(self, name: str) -> None: ...
    def save(self) -> None: ...
    def refresh(self) -> None: ...

class ops:
    @staticmethod
    def sum(col: Column) -> float: ...
    @staticmethod
    def avg(col: Column) -> float: ...
    @staticmethod
    def min(col: Column) -> float: ...
    @staticmethod
    def max(col: Column) -> float: ...
    @staticmethod
    def std(col: Column) -> float: ...
    @staticmethod
    def aj(
        left: Table, right: Table, on: Sequence[str], as_of: str
    ) -> Table: ...
    @staticmethod
    def wj(
        left: Table,
        right: Table,
        on: Sequence[str],
        as_of: str,
        window_before: int,
        window_after: int,
    ) -> Table: ...
    @staticmethod
    def mavg(col: Column, window: int) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def msum(col: Column, window: int) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def mstd(col: Column, window: int) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def mmin(col: Column, window: int) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def mmax(col: Column, window: int) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def ema(col: Column, alpha: float) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def diff(col: Column, periods: int = 1) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def pct_change(col: Column, periods: int = 1) -> npt.NDArray[np.float64]: ...
    @staticmethod
    def shift(col: Column, n: int) -> npt.NDArray[np.float64]: ...