klongpy 0.6.7__tar.gz → 0.6.8__tar.gz

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.
Files changed (79) hide show
  1. {klongpy-0.6.7/klongpy.egg-info → klongpy-0.6.8}/PKG-INFO +1 -3
  2. {klongpy-0.6.7 → klongpy-0.6.8}/README.md +0 -2
  3. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/core.py +11 -4
  4. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/interpreter.py +8 -4
  5. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/sys_fn.py +2 -2
  6. {klongpy-0.6.7 → klongpy-0.6.8/klongpy.egg-info}/PKG-INFO +1 -3
  7. {klongpy-0.6.7 → klongpy-0.6.8}/setup.py +1 -1
  8. {klongpy-0.6.7 → klongpy-0.6.8}/LICENSE +0 -0
  9. {klongpy-0.6.7 → klongpy-0.6.8}/MANIFEST.in +0 -0
  10. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/__init__.py +0 -0
  11. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/adverbs.py +0 -0
  12. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/backend.py +0 -0
  13. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/db/__init__.py +0 -0
  14. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/db/df_cache.py +0 -0
  15. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/db/file_cache.py +0 -0
  16. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/db/helpers.py +0 -0
  17. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/db/sys_fn_db.py +0 -0
  18. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/db/sys_fn_kvs.py +0 -0
  19. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/dyads.py +0 -0
  20. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/csv.kg +0 -0
  21. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/edt.kg +0 -0
  22. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/eigenv.kg +0 -0
  23. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/help.kg +0 -0
  24. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/huffman.kg +0 -0
  25. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/math.kg +0 -0
  26. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/nstat.kg +0 -0
  27. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/print.kg +0 -0
  28. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/set.kg +0 -0
  29. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/spline.kg +0 -0
  30. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/time.kg +0 -0
  31. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/lib/util.kg +0 -0
  32. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/monads.py +0 -0
  33. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/sys_fn_ipc.py +0 -0
  34. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/sys_fn_timer.py +0 -0
  35. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/sys_var.py +0 -0
  36. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/utils.py +0 -0
  37. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/web/__init__.py +0 -0
  38. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/web/sys_fn_web.py +0 -0
  39. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/ws/__init__.py +0 -0
  40. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy/ws/sys_fn_ws.py +0 -0
  41. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy.egg-info/SOURCES.txt +0 -0
  42. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy.egg-info/dependency_links.txt +0 -0
  43. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy.egg-info/not-zip-safe +0 -0
  44. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy.egg-info/requires.txt +0 -0
  45. {klongpy-0.6.7 → klongpy-0.6.8}/klongpy.egg-info/top_level.txt +0 -0
  46. {klongpy-0.6.7 → klongpy-0.6.8}/scripts/kgpy +0 -0
  47. {klongpy-0.6.7 → klongpy-0.6.8}/setup.cfg +0 -0
  48. {klongpy-0.6.7 → klongpy-0.6.8}/tests/__init__.py +0 -0
  49. {klongpy-0.6.7 → klongpy-0.6.8}/tests/gen_join_over.py +0 -0
  50. {klongpy-0.6.7 → klongpy-0.6.8}/tests/gen_py_suite.py +0 -0
  51. {klongpy-0.6.7 → klongpy-0.6.8}/tests/gen_test_fn.py +0 -0
  52. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_async.py +0 -0
  53. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_avg.py +0 -0
  54. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_duckdb.py +0 -0
  55. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_gen.py +0 -0
  56. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_ipc_overhead.py +0 -0
  57. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_join.py +0 -0
  58. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_load.py +0 -0
  59. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_prog.py +0 -0
  60. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_serdes.py +0 -0
  61. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_sys_fn_db.py +0 -0
  62. {klongpy-0.6.7 → klongpy-0.6.8}/tests/perf_vector.py +0 -0
  63. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_accel.py +0 -0
  64. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_df_cache.py +0 -0
  65. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_examples.py +0 -0
  66. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_extra_suite.py +0 -0
  67. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_file_cache.py +0 -0
  68. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_interop.py +0 -0
  69. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_kgtests.py +0 -0
  70. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_known_bugs.py +0 -0
  71. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_prog.py +0 -0
  72. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_suite.py +0 -0
  73. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_suite_file.py +0 -0
  74. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_sys_fn.py +0 -0
  75. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_sys_fn_db.py +0 -0
  76. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_sys_fn_ipc.py +0 -0
  77. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_sys_fn_timer.py +0 -0
  78. {klongpy-0.6.7 → klongpy-0.6.8}/tests/test_util.py +0 -0
  79. {klongpy-0.6.7 → klongpy-0.6.8}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: klongpy
3
- Version: 0.6.7
3
+ Version: 0.6.8
4
4
  Summary: High-Performance Klong array language with rich Python integration.
5
5
  Author: Brian Guarraci
6
6
  License: MIT
@@ -54,8 +54,6 @@ Requires-Dist: websockets==12.0; extra == "full"
54
54
  [![Downloads](https://static.pepy.tech/badge/klongpy/month)](https://pepy.tech/project/klongpy)
55
55
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
56
56
 
57
- [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/klongpy.svg?style=social&label=Follow%20%40KlongPy)](https://twitter.com/klongpy)
58
-
59
57
  # KlongPy: High-Performance Array Programming in Python
60
58
 
61
59
  KlongPy is a Python adaptation of the [Klong](https://t3x.org/klong) [array language](https://en.wikipedia.org/wiki/Array_programming), known for its high-performance vectorized operations that leverage the power of NumPy. Embracing a "batteries included" philosophy, KlongPy combines built-in modules with Python's expansive ecosystem, facilitating rapid application development with Klong's succinct syntax.
@@ -10,8 +10,6 @@
10
10
  [![Downloads](https://static.pepy.tech/badge/klongpy/month)](https://pepy.tech/project/klongpy)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
12
 
13
- [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/klongpy.svg?style=social&label=Follow%20%40KlongPy)](https://twitter.com/klongpy)
14
-
15
13
  # KlongPy: High-Performance Array Programming in Python
16
14
 
17
15
  KlongPy is a Python adaptation of the [Klong](https://t3x.org/klong) [array language](https://en.wikipedia.org/wiki/Array_programming), known for its high-performance vectorized operations that leverage the power of NumPy. Embracing a "batteries included" philosophy, KlongPy combines built-in modules with Python's expansive ecosystem, facilitating rapid application development with Klong's succinct syntax.
@@ -87,6 +87,12 @@ class KGCond(list):
87
87
  pass
88
88
 
89
89
 
90
+ def safe_inspect(fn, follow_wrapped=True):
91
+ try:
92
+ return inspect.signature(fn, follow_wrapped=follow_wrapped).parameters
93
+ except ValueError:
94
+ return {"args":[]}
95
+
90
96
  class KGLambda:
91
97
  """
92
98
  KGLambda wraps a lambda and make it available to Klong, allowing for direct
@@ -109,7 +115,7 @@ class KGLambda:
109
115
  """
110
116
  def __init__(self, fn, args=None, provide_klong=False, wildcard=False):
111
117
  self.fn = fn
112
- params = args or inspect.signature(self.fn, follow_wrapped=True).parameters
118
+ params = args or safe_inspect(fn)
113
119
  self.args = [reserved_fn_symbol_map[x] for x in reserved_fn_args if x in params]
114
120
  self._provide_klong = provide_klong or 'klong' in params
115
121
  self._wildcard = wildcard
@@ -636,6 +642,7 @@ def read_cond(klong, t, i=0):
636
642
  i = cexpect(t, i, ';')
637
643
  i,n = klong._expr(t, i, ignore_newline=True)
638
644
  r.append(n)
645
+ i = skip(t,i,ignore_newline=True)
639
646
  i = cexpect(t, i, ']')
640
647
  return i, KGCond(r)
641
648
 
@@ -694,9 +701,9 @@ def kg_read(t, i=0, read_neg=False, ignore_newline=False, module=None, list_leve
694
701
  if i >= len(t):
695
702
  return i, None
696
703
  a = t[i]
697
- if a in ['\n', ';']:
698
- return i+1,';'
699
- elif a in ['(',')','{','}',']']:
704
+ if a == '\n':
705
+ a = ';' # convert newlines to semicolons
706
+ if a in [';','(',')','{','}',']']:
700
707
  return i+1,a
701
708
  elif cmatch2(t, i, '0', 'c'):
702
709
  return read_char(t, i)
@@ -119,7 +119,7 @@ class KlongContext():
119
119
  if dk.startswith(tk):
120
120
  return True
121
121
  return False
122
-
122
+
123
123
  def __iter__(self):
124
124
  seen = set()
125
125
  for d in self._context:
@@ -358,6 +358,7 @@ class KlongInterpreter():
358
358
  if safe_eq(a, '{'): # read fn
359
359
  i,a = self.prog(t, i, ignore_newline=True)
360
360
  a = a[0] if len(a) == 1 else a
361
+ i = skip(t, i, ignore_newline=True)
361
362
  i = cexpect(t, i, '}')
362
363
  arity = get_fn_arity(a)
363
364
  if cmatch(t, i, '(') or cmatch2(t,i,':','('):
@@ -416,6 +417,7 @@ class KlongInterpreter():
416
417
  if safe_eq(aa, '{'): # read fn
417
418
  i,aa = self.prog(t, i, ignore_newline=True)
418
419
  aa = aa[0] if len(aa) == 1 else aa
420
+ i = skip(t, i, ignore_newline=True)
419
421
  i = cexpect(t, i, '}')
420
422
  arity = get_fn_arity(aa)
421
423
  if cmatch(t, i, '(') or cmatch2(t,i,':','('):
@@ -433,6 +435,8 @@ class KlongInterpreter():
433
435
  i, aaa = self._expr(t, i, ignore_newline=ignore_newline)
434
436
  a = KGFn(aa, [a, aaa], arity=2)
435
437
  ii, aa = kg_read(t, i, ignore_newline=ignore_newline, module=self.current_module())
438
+ if ignore_newline and safe_eq(a, '\n'):
439
+ i = skip(t, i, ignore_newline=True)
436
440
  return i, a
437
441
 
438
442
  def prog(self, t, i=0, ignore_newline=False):
@@ -481,12 +485,12 @@ class KlongInterpreter():
481
485
  - f_args is the list of arguments provided to the function during the current invocation.
482
486
  - f.args (if f is an instance of KGFn) represents predefined arguments associated with the function.
483
487
  These are arguments that are already set by virtue of the function being a projection of another function.
484
- - During the resolution process, if the function f is a KGFn with predefined arguments (projections),
488
+ - During the resolution process, if the function f is a KGFn with predefined arguments (projections),
485
489
  these arguments are appended to the f_args list.
486
- - The resolution process ensures that if there are placeholders in the predefined arguments, they are
490
+ - The resolution process ensures that if there are placeholders in the predefined arguments, they are
487
491
  filled in with values from the provided arguments. However, if the function itself is being projected,
488
492
  f_args can still contain a None indicating an empty projection slot.
489
- - By the end of the resolution, f_args contains the arguments that will be passed to the function for
493
+ - By the end of the resolution, f_args contains the arguments that will be passed to the function for
490
494
  evaluation. It is possible for f_args to finally contain None if the function is itself being projected.
491
495
  - If `f.a` (the main function or symbol) resolves to another function `_f`, it might indicate a higher-order function scenario.
492
496
  - In such a case, `f_args` supplies a function as an argument to `f.a`.
@@ -13,7 +13,7 @@ import numpy
13
13
 
14
14
  from .core import (KGChannel, KGChannelDir, KGLambda, KGSym, KlongException,
15
15
  is_dict, is_empty, is_list, kg_asarray, kg_read, kg_write, np,
16
- reserved_fn_args, reserved_fn_symbol_map, safe_eq)
16
+ reserved_fn_args, reserved_fn_symbol_map, safe_eq, safe_inspect)
17
17
 
18
18
 
19
19
  def eval_sys_append_channel(x):
@@ -341,7 +341,7 @@ def _handle_import(item):
341
341
  if n_args <= len(reserved_fn_args):
342
342
  item = KGLambda(item, args=reserved_fn_args[:n_args])
343
343
  else:
344
- args = inspect.signature(item, follow_wrapped=True).parameters
344
+ args = safe_inspect(item, follow_wrapped=True)
345
345
  if 'args' in args:
346
346
  item = KGLambda(item, args=None, wildcard=True)
347
347
  n_args = 3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: klongpy
3
- Version: 0.6.7
3
+ Version: 0.6.8
4
4
  Summary: High-Performance Klong array language with rich Python integration.
5
5
  Author: Brian Guarraci
6
6
  License: MIT
@@ -54,8 +54,6 @@ Requires-Dist: websockets==12.0; extra == "full"
54
54
  [![Downloads](https://static.pepy.tech/badge/klongpy/month)](https://pepy.tech/project/klongpy)
55
55
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
56
56
 
57
- [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/klongpy.svg?style=social&label=Follow%20%40KlongPy)](https://twitter.com/klongpy)
58
-
59
57
  # KlongPy: High-Performance Array Programming in Python
60
58
 
61
59
  KlongPy is a Python adaptation of the [Klong](https://t3x.org/klong) [array language](https://en.wikipedia.org/wiki/Array_programming), known for its high-performance vectorized operations that leverage the power of NumPy. Embracing a "batteries included" philosophy, KlongPy combines built-in modules with Python's expansive ecosystem, facilitating rapid application development with Klong's succinct syntax.
@@ -27,7 +27,7 @@ extra_requires['full'] = extra_requires['repl'] + extra_requires['web'] + extra_
27
27
  setup(
28
28
  name='klongpy',
29
29
  packages=find_packages(),
30
- version='0.6.7',
30
+ version='0.6.8',
31
31
  description='High-Performance Klong array language with rich Python integration.',
32
32
  author='Brian Guarraci',
33
33
  license='MIT',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes