GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add call extended to call with kwargs · mjdhasan/egglog-python@30fde13

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python/egglog
    • builtins.py
  • src
    • py_object_sort.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python/egglog/builtins.py‎

Copy file name to clipboardExpand all lines: python/egglog/builtins.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,12 @@ def __init__(self, value: object) -> None: ...
994994
@method(egg_fn="py-call")
995995
def __call__(self, *args: object) -> PyObject: ...
996996

997+
@method(egg_fn="py-call-extended")
998+
def call_extended(self, args: PyObject, kwargs: PyObject) -> PyObject:
999+
"""
1000+
Call the PyObject with the given args and kwargs PyObjects.
1001+
"""
1002+
9971003
@method(egg_fn="py-from-string")
9981004
@classmethod
9991005
def from_string(cls, s: StringLike) -> PyObject: ...
@@ -1052,7 +1058,7 @@ def py_exec(code: StringLike, globals: object = PyObject.dict(), locals: object
10521058
T3 = TypeVar("T3")
10531059

10541060

1055-
class UnstableFn(BuiltinExpr, Generic[T, Unpack[TS]], egg_sort="UnstableFn"):
1061+
class UnstableFn(BuiltinExpr, Generic[T, *TS], egg_sort="UnstableFn"):
10561062
@overload
10571063
def __init__(self, f: Callable[[Unpack[TS]], T]) -> None: ...
10581064

@@ -1090,7 +1096,7 @@ def value(self) -> Callable[[Unpack[TS]], T]:
10901096
__match_args__ = ("value",)
10911097

10921098
@method(egg_fn="unstable-app")
1093-
def __call__(self, *args: Unpack[TS]) -> T: ...
1099+
def __call__(self, *args: *TS) -> T: ...
10941100

10951101

10961102
# Method Type is for builtins like __getitem__
Collapse file

‎src/py_object_sort.rs‎

Copy file name to clipboardExpand all lines: src/py_object_sort.rs
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ impl BaseSort for PyObjectSort {
118118
})
119119
});
120120

121+
// (py-call-extended <fn-obj> <args-obj> <kwargs-obj>)
122+
add_primitive!(eg, "py-call-extended" = |fn_: PyPickledValue, args: PyPickledValue, kwargs: PyPickledValue| -?> PyPickledValue {
123+
attach("py-call-extended", |py| {
124+
let fn_ = load(py, &fn_)?;
125+
let args = load(py, &args)?;
126+
let kwargs = load(py, &kwargs)?;
127+
dump(fn_.call(args.cast::<PyTuple>().map_err(|e| {e})?, Some(kwargs.cast::<PyDict>()?))?)
121128
})
122129
});
123130

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.