klongpy 0.6.9__py3-none-any.whl → 0.7.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- klongpy/__init__.py +17 -1
- klongpy/adverbs.py +84 -82
- klongpy/autograd.py +299 -0
- klongpy/backend.py +38 -103
- klongpy/backends/__init__.py +26 -0
- klongpy/backends/base.py +469 -0
- klongpy/backends/numpy_backend.py +123 -0
- klongpy/backends/registry.py +76 -0
- klongpy/backends/torch_backend.py +1047 -0
- klongpy-0.6.9.data/scripts/kgpy → klongpy/cli.py +110 -90
- klongpy/core.py +113 -974
- klongpy/db/sys_fn_db.py +7 -6
- klongpy/db/sys_fn_kvs.py +2 -4
- klongpy/dyads.py +332 -160
- klongpy/interpreter.py +60 -15
- klongpy/monads.py +121 -75
- klongpy/parser.py +328 -0
- klongpy/repl.py +23 -5
- klongpy/sys_fn.py +170 -21
- klongpy/sys_fn_autograd.py +290 -0
- klongpy/sys_fn_ipc.py +22 -15
- klongpy/sys_fn_timer.py +13 -3
- klongpy/types.py +503 -0
- klongpy/web/sys_fn_web.py +14 -4
- klongpy/writer.py +122 -0
- klongpy/ws/sys_fn_ws.py +5 -8
- klongpy-0.7.1.dist-info/METADATA +544 -0
- klongpy-0.7.1.dist-info/RECORD +52 -0
- {klongpy-0.6.9.dist-info → klongpy-0.7.1.dist-info}/WHEEL +1 -1
- klongpy-0.7.1.dist-info/entry_points.txt +2 -0
- {klongpy-0.6.9.dist-info → klongpy-0.7.1.dist-info}/top_level.txt +0 -1
- klongpy-0.6.9.dist-info/METADATA +0 -448
- klongpy-0.6.9.dist-info/RECORD +0 -77
- tests/__init__.py +0 -6
- tests/gen_join_over.py +0 -119
- tests/gen_py_suite.py +0 -77
- tests/gen_test_fn.py +0 -259
- tests/perf_async.py +0 -25
- tests/perf_avg.py +0 -18
- tests/perf_duckdb.py +0 -32
- tests/perf_gen.py +0 -38
- tests/perf_ipc_overhead.py +0 -34
- tests/perf_join.py +0 -53
- tests/perf_load.py +0 -17
- tests/perf_prog.py +0 -18
- tests/perf_serdes.py +0 -52
- tests/perf_sys_fn_db.py +0 -263
- tests/perf_vector.py +0 -40
- tests/test_accel.py +0 -227
- tests/test_df_cache.py +0 -85
- tests/test_eval_monad_list.py +0 -34
- tests/test_examples.py +0 -64
- tests/test_extra_suite.py +0 -382
- tests/test_file_cache.py +0 -185
- tests/test_interop.py +0 -180
- tests/test_kg_asarray.py +0 -94
- tests/test_kgtests.py +0 -65
- tests/test_known_bugs.py +0 -206
- tests/test_prog.py +0 -107
- tests/test_reshape_strings.py +0 -33
- tests/test_suite.py +0 -1480
- tests/test_suite_file.py +0 -153
- tests/test_sys_fn.py +0 -420
- tests/test_sys_fn_db.py +0 -88
- tests/test_sys_fn_ipc.py +0 -587
- tests/test_sys_fn_timer.py +0 -133
- tests/test_sys_fn_web.py +0 -50
- tests/test_util.py +0 -233
- tests/utils.py +0 -126
- {klongpy-0.6.9.dist-info → klongpy-0.7.1.dist-info}/licenses/LICENSE +0 -0
klongpy/db/sys_fn_db.py
CHANGED
|
@@ -4,8 +4,9 @@ import duckdb
|
|
|
4
4
|
import numpy as np
|
|
5
5
|
import pandas as pd
|
|
6
6
|
|
|
7
|
-
from klongpy.core import (KGCall, KGLambda, KlongException,
|
|
8
|
-
reserved_fn_symbol_map)
|
|
7
|
+
from klongpy.core import (KGCall, KGLambda, KlongException, KLONG_UNDEFINED,
|
|
8
|
+
reserved_fn_args, reserved_fn_symbol_map)
|
|
9
|
+
from klongpy.backend import np as backend_np
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class KlongDbException(KlongException):
|
|
@@ -41,7 +42,7 @@ class Table(dict):
|
|
|
41
42
|
|
|
42
43
|
def get(self, x):
|
|
43
44
|
v = self._df.get(x)
|
|
44
|
-
return
|
|
45
|
+
return KLONG_UNDEFINED if v is None else v.values
|
|
45
46
|
|
|
46
47
|
def set(self, x, y):
|
|
47
48
|
self._df[x] = y
|
|
@@ -179,7 +180,7 @@ def eval_sys_fn_create_table(x):
|
|
|
179
180
|
t,"c",,c
|
|
180
181
|
|
|
181
182
|
"""
|
|
182
|
-
if
|
|
183
|
+
if backend_np.isarray(x):
|
|
183
184
|
return Table({k:v for k,v in x}, columns=[k for k,_ in x])
|
|
184
185
|
elif isinstance(x, pd.DataFrame):
|
|
185
186
|
return Table(x)
|
|
@@ -202,7 +203,7 @@ def eval_sys_fn_index(x, y):
|
|
|
202
203
|
raise KlongDbException(x, "An index may only be created on a table.")
|
|
203
204
|
if x.has_index():
|
|
204
205
|
raise KlongDbException(x, "Table already has an index.")
|
|
205
|
-
if not
|
|
206
|
+
if not backend_np.isarray(y):
|
|
206
207
|
raise KlongDbException(x, "An index must be a list of column names")
|
|
207
208
|
for q in y:
|
|
208
209
|
if q not in x.columns:
|
|
@@ -266,7 +267,7 @@ def eval_sys_fn_insert_table(x, y):
|
|
|
266
267
|
"""
|
|
267
268
|
if not isinstance(x,Table):
|
|
268
269
|
raise KlongDbException(x, "Inserts must be applied to a table")
|
|
269
|
-
if not
|
|
270
|
+
if not backend_np.isarray(y):
|
|
270
271
|
raise KlongDbException(x, "Values to insert must be a list")
|
|
271
272
|
batch = len(y.shape) > 1
|
|
272
273
|
y_cols = len(y[0]) if batch else len(y)
|
klongpy/db/sys_fn_kvs.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
from klongpy.core import KlongException
|
|
3
|
+
from klongpy.core import KlongException, KLONG_UNDEFINED
|
|
6
4
|
|
|
7
5
|
from .df_cache import PandasDataFrameCache
|
|
8
6
|
from .file_cache import FileCache
|
|
@@ -33,7 +31,7 @@ class TableStorage(dict):
|
|
|
33
31
|
if not isinstance(x,str):
|
|
34
32
|
raise KlongKvsException(x, "key must be a str")
|
|
35
33
|
df = self.cache.get_dataframe(key_to_file_path(x), default_empty=False)
|
|
36
|
-
return
|
|
34
|
+
return KLONG_UNDEFINED if df is None else Table(df)
|
|
37
35
|
|
|
38
36
|
def set(self, x, y):
|
|
39
37
|
if not isinstance(x,str):
|