diff --git a/.gitignore b/.gitignore index 41c277a2..18a368ba 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ llgo_autogen.ll stories*.bin .DS_Store err.log +numpy.txt _go/ _runtime/ diff --git a/_pydemo/matrix/matrix.go b/_pydemo/matrix/matrix.go new file mode 100644 index 00000000..659f8251 --- /dev/null +++ b/_pydemo/matrix/matrix.go @@ -0,0 +1,31 @@ +package main + +import ( + "github.com/goplus/llgo/c" + "github.com/goplus/llgo/py" + "github.com/goplus/llgo/py/numpy" +) + +func matrix(row, col int, vals ...float64) *py.Object { + if len(vals) != row*col { + panic("invalid matrix size") + } + rows := py.NewList(uintptr(row)) + for i := 0; i < row; i++ { + cols := py.NewList(uintptr(col)) + for j := 0; j < col; j++ { + cols.ListSetItem(uintptr(j), py.Float(vals[i*col+j])) + } + rows.ListSetItem(uintptr(i), cols) + } + return numpy.Array(rows, nil) +} + +func main() { + a := matrix(3, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9) + b := matrix(3, 3, 9, 8, 7, 6, 5, 4, 3, 2, 1) + x := numpy.Add(a, b) + c.Printf(c.Str("a = %s\n"), a.Str().CStr()) + c.Printf(c.Str("a = %s\n"), b.Str().CStr()) + c.Printf(c.Str("a+b = %s\n"), x.Str().CStr()) +} diff --git a/chore/llpyg/llpyg.go b/chore/llpyg/llpyg.go index a95ee7a2..251b2961 100644 --- a/chore/llpyg/llpyg.go +++ b/chore/llpyg/llpyg.go @@ -82,9 +82,9 @@ func main() { ctx := &context{pkg, obj, objPtr, ret, py} for _, sym := range mod.Items { switch sym.Type { - case "builtin_function_or_method", "function", "ufunc": + case "builtin_function_or_method", "function", "ufunc", "method-wrapper": ctx.genFunc(pkg, sym) - case "str", "float", "bool", "type", "dict", "tuple", "list", + case "str", "float", "bool", "type", "dict", "tuple", "list", "object", "module", "int", "set", "frozenset", "flags", "bool_": // skip default: t := sym.Type diff --git a/py/inspect/doc.txt b/py/inspect/doc.txt new file mode 100644 index 00000000..1f24518d --- /dev/null +++ b/py/inspect/doc.txt @@ -0,0 +1,14 @@ +// https://docs.python.org/3/library/inspect.html + +// Return a signature object for the given callable. +// +//go:linkname Signature py.signature +func Signature(callable *py.Object) *py.Object + +// Get the names and default values of a Python function’s parameters. A named +// tuple is returned: +// +// FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations) +// +//go:linkname Getfullargspec py.getfullargspec +func Getfullargspec(f *py.Object) *py.Object diff --git a/py/inspect/gen.go b/py/inspect/gen.go new file mode 100644 index 00000000..bc33a183 --- /dev/null +++ b/py/inspect/gen.go @@ -0,0 +1,617 @@ +package inspect + +import ( + _ "unsafe" + + "github.com/goplus/llgo/py" +) + +const LLGoPackage = "py.inspect" + +// Compute the annotations dict for an object. +// +// obj may be a callable, class, or module. +// Passing in an object of any other type raises TypeError. +// +// Returns a dict. get_annotations() returns a new dict every time +// it's called; calling it twice on the same object will return two +// different but equivalent dicts. +// +// This function handles several details for you: +// +// * If eval_str is true, values of type str will +// be un-stringized using eval(). This is intended +// for use with stringized annotations +// ("from __future__ import annotations"). +// * If obj doesn't have an annotations dict, returns an +// empty dict. (Functions and methods always have an +// annotations dict; classes, modules, and other types of +// callables may not.) +// * Ignores inherited annotations on classes. If a class +// doesn't have its own annotations dict, returns an empty dict. +// * All accesses to object members and dict values are done +// using getattr() and dict.get() for safety. +// * Always, always, always returns a freshly-created dict. +// +// eval_str controls whether or not values of type str are replaced +// with the result of calling eval() on those values: +// +// * If eval_str is true, eval() is called on values of type str. +// * If eval_str is false (the default), values of type str are unchanged. +// +// globals and locals are passed in to eval(); see the documentation +// for eval() for more information. If either globals or locals is +// None, this function may replace that value with a context-specific +// default, contingent on type(obj): +// +// * If obj is a module, globals defaults to obj.__dict__. +// * If obj is a class, globals defaults to +// sys.modules[obj.__module__].__dict__ and locals +// defaults to the obj class namespace. +// * If obj is a callable, globals defaults to obj.__globals__, +// although if obj is a wrapped function (using +// functools.update_wrapper()) it is first unwrapped. +// +//go:linkname GetAnnotations py.get_annotations +func GetAnnotations(obj *py.Object) *py.Object + +// Return true if the object is a module. +// +//go:linkname Ismodule py.ismodule +func Ismodule(object *py.Object) *py.Object + +// Return true if the object is a class. +// +//go:linkname Isclass py.isclass +func Isclass(object *py.Object) *py.Object + +// Return true if the object is an instance method. +// +//go:linkname Ismethod py.ismethod +func Ismethod(object *py.Object) *py.Object + +// Return true if the object is a method descriptor. +// +// But not if ismethod() or isclass() or isfunction() are true. +// +// This is new in Python 2.2, and, for example, is true of int.__add__. +// An object passing this test has a __get__ attribute but not a __set__ +// attribute, but beyond that the set of attributes varies. __name__ is +// usually sensible, and __doc__ often is. +// +// Methods implemented via descriptors that also pass one of the other +// tests return false from the ismethoddescriptor() test, simply because +// the other tests promise more -- you can, e.g., count on having the +// __func__ attribute (etc) when an object passes ismethod(). +// +//go:linkname Ismethoddescriptor py.ismethoddescriptor +func Ismethoddescriptor(object *py.Object) *py.Object + +// Return true if the object is a data descriptor. +// +// Data descriptors have a __set__ or a __delete__ attribute. Examples are +// properties (defined in Python) and getsets and members (defined in C). +// Typically, data descriptors will also have __name__ and __doc__ attributes +// (properties, getsets, and members have both of these attributes), but this +// is not guaranteed. +// +//go:linkname Isdatadescriptor py.isdatadescriptor +func Isdatadescriptor(object *py.Object) *py.Object + +// Return true if the object is a member descriptor. +// +// Member descriptors are specialized descriptors defined in extension +// modules. +// +//go:linkname Ismemberdescriptor py.ismemberdescriptor +func Ismemberdescriptor(object *py.Object) *py.Object + +// Return true if the object is a getset descriptor. +// +// getset descriptors are specialized descriptors defined in extension +// modules. +// +//go:linkname Isgetsetdescriptor py.isgetsetdescriptor +func Isgetsetdescriptor(object *py.Object) *py.Object + +// Return true if the object is a user-defined function. +// +// Function objects provide these attributes: +// __doc__ documentation string +// __name__ name with which this function was defined +// __code__ code object containing compiled function bytecode +// __defaults__ tuple of any default values for arguments +// __globals__ global namespace in which this function was defined +// __annotations__ dict of parameter annotations +// __kwdefaults__ dict of keyword only parameters with defaults +// +//go:linkname Isfunction py.isfunction +func Isfunction(object *py.Object) *py.Object + +// Return true if the object is a user-defined generator function. +// +// Generator function objects provide the same attributes as functions. +// See help(isfunction) for a list of attributes. +// +//go:linkname Isgeneratorfunction py.isgeneratorfunction +func Isgeneratorfunction(obj *py.Object) *py.Object + +// Decorator to ensure callable is recognised as a coroutine function. +// +//go:linkname Markcoroutinefunction py.markcoroutinefunction +func Markcoroutinefunction(func_ *py.Object) *py.Object + +// Return true if the object is a coroutine function. +// +// Coroutine functions are normally defined with "async def" syntax, but may +// be marked via markcoroutinefunction. +// +//go:linkname Iscoroutinefunction py.iscoroutinefunction +func Iscoroutinefunction(obj *py.Object) *py.Object + +// Return true if the object is an asynchronous generator function. +// +// Asynchronous generator functions are defined with "async def" +// syntax and have "yield" expressions in their body. +// +//go:linkname Isasyncgenfunction py.isasyncgenfunction +func Isasyncgenfunction(obj *py.Object) *py.Object + +// Return true if the object is an asynchronous generator. +// +//go:linkname Isasyncgen py.isasyncgen +func Isasyncgen(object *py.Object) *py.Object + +// Return true if the object is a generator. +// +// Generator objects provide these attributes: +// __iter__ defined to support iteration over container +// close raises a new GeneratorExit exception inside the +// generator to terminate the iteration +// gi_code code object +// gi_frame frame object or possibly None once the generator has +// been exhausted +// gi_running set to 1 when generator is executing, 0 otherwise +// next return the next item from the container +// send resumes the generator and "sends" a value that becomes +// the result of the current yield-expression +// throw used to raise an exception inside the generator +// +//go:linkname Isgenerator py.isgenerator +func Isgenerator(object *py.Object) *py.Object + +// Return true if the object is a coroutine. +// +//go:linkname Iscoroutine py.iscoroutine +func Iscoroutine(object *py.Object) *py.Object + +// Return true if object can be passed to an “await“ expression. +// +//go:linkname Isawaitable py.isawaitable +func Isawaitable(object *py.Object) *py.Object + +// Return true if the object is a traceback. +// +// Traceback objects provide these attributes: +// tb_frame frame object at this level +// tb_lasti index of last attempted instruction in bytecode +// tb_lineno current line number in Python source code +// tb_next next inner traceback object (called by this level) +// +//go:linkname Istraceback py.istraceback +func Istraceback(object *py.Object) *py.Object + +// Return true if the object is a frame object. +// +// Frame objects provide these attributes: +// f_back next outer frame object (this frame's caller) +// f_builtins built-in namespace seen by this frame +// f_code code object being executed in this frame +// f_globals global namespace seen by this frame +// f_lasti index of last attempted instruction in bytecode +// f_lineno current line number in Python source code +// f_locals local namespace seen by this frame +// f_trace tracing function for this frame, or None +// +//go:linkname Isframe py.isframe +func Isframe(object *py.Object) *py.Object + +// Return true if the object is a code object. +// +// Code objects provide these attributes: +// co_argcount number of arguments (not including *, ** args +// or keyword only arguments) +// co_code string of raw compiled bytecode +// co_cellvars tuple of names of cell variables +// co_consts tuple of constants used in the bytecode +// co_filename name of file in which this code object was created +// co_firstlineno number of first line in Python source code +// co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg +// | 16=nested | 32=generator | 64=nofree | 128=coroutine +// | 256=iterable_coroutine | 512=async_generator +// co_freevars tuple of names of free variables +// co_posonlyargcount number of positional only arguments +// co_kwonlyargcount number of keyword only arguments (not including ** arg) +// co_lnotab encoded mapping of line numbers to bytecode indices +// co_name name with which this code object was defined +// co_names tuple of names other than arguments and function locals +// co_nlocals number of local variables +// co_stacksize virtual machine stack space required +// co_varnames tuple of names of arguments and local variables +// +//go:linkname Iscode py.iscode +func Iscode(object *py.Object) *py.Object + +// Return true if the object is a built-in function or method. +// +// Built-in functions and methods provide these attributes: +// __doc__ documentation string +// __name__ original name of this function or method +// __self__ instance to which a method is bound, or None +// +//go:linkname Isbuiltin py.isbuiltin +func Isbuiltin(object *py.Object) *py.Object + +// Return true if the object is a method wrapper. +// +//go:linkname Ismethodwrapper py.ismethodwrapper +func Ismethodwrapper(object *py.Object) *py.Object + +// Return true if the object is any kind of function or method. +// +//go:linkname Isroutine py.isroutine +func Isroutine(object *py.Object) *py.Object + +// Return true if the object is an abstract base class (ABC). +// +//go:linkname Isabstract py.isabstract +func Isabstract(object *py.Object) *py.Object + +// Return all members of an object as (name, value) pairs sorted by name. +// +// Optionally, only return members that satisfy a given predicate. +// +//go:linkname Getmembers py.getmembers +func Getmembers(object *py.Object, predicate *py.Object) *py.Object + +// Return all members of an object as (name, value) pairs sorted by name +// +// without triggering dynamic lookup via the descriptor protocol, +// __getattr__ or __getattribute__. Optionally, only return members that +// satisfy a given predicate. +// +// Note: this function may not be able to retrieve all members +// that getmembers can fetch (like dynamically created attributes) +// and may find members that getmembers can't (like descriptors +// that raise AttributeError). It can also return descriptor objects +// instead of instance members in some cases. +// +//go:linkname GetmembersStatic py.getmembers_static +func GetmembersStatic(object *py.Object, predicate *py.Object) *py.Object + +// Return list of attribute-descriptor tuples. +// +// For each name in dir(cls), the return list contains a 4-tuple +// with these elements: +// +// 0. The name (a string). +// +// 1. The kind of attribute this is, one of these strings: +// 'class method' created via classmethod() +// 'static method' created via staticmethod() +// 'property' created via property() +// 'method' any other flavor of method or descriptor +// 'data' not a method +// +// 2. The class which defined this attribute (a class). +// +// 3. The object as obtained by calling getattr; if this fails, or if the +// resulting object does not live anywhere in the class' mro (including +// metaclasses) then the object is looked up in the defining class's +// dict (found by walking the mro). +// +// If one of the items in dir(cls) is stored in the metaclass it will now +// be discovered and not have None be listed as the class in which it was +// defined. Any items whose home class cannot be discovered are skipped. +// +//go:linkname ClassifyClassAttrs py.classify_class_attrs +func ClassifyClassAttrs(cls *py.Object) *py.Object + +// Return tuple of base classes (including cls) in method resolution order. +// +//go:linkname Getmro py.getmro +func Getmro(cls *py.Object) *py.Object + +// Get the object wrapped by *func*. +// +// Follows the chain of :attr:`__wrapped__` attributes returning the last +// object in the chain. +// +// *stop* is an optional callback accepting an object in the wrapper chain +// as its sole argument that allows the unwrapping to be terminated early if +// the callback returns a true value. If the callback never returns a true +// value, the last object in the chain is returned as usual. For example, +// :func:`signature` uses this to stop unwrapping if any object in the +// chain has a ``__signature__`` attribute defined. +// +// :exc:`ValueError` is raised if a cycle is encountered. +// +//go:linkname Unwrap py.unwrap +func Unwrap(func_ *py.Object) *py.Object + +// Return the indent size, in spaces, at the start of a line of text. +// +//go:linkname Indentsize py.indentsize +func Indentsize(line *py.Object) *py.Object + +// Get the documentation string for an object. +// +// All tabs are expanded to spaces. To clean up docstrings that are +// indented to line up with blocks of code, any whitespace than can be +// uniformly removed from the second line onwards is removed. +// +//go:linkname Getdoc py.getdoc +func Getdoc(object *py.Object) *py.Object + +// Clean up indentation from docstrings. +// +// Any whitespace that can be uniformly removed from the second line +// onwards is removed. +// +//go:linkname Cleandoc py.cleandoc +func Cleandoc(doc *py.Object) *py.Object + +// Work out which source or compiled file an object was defined in. +// +//go:linkname Getfile py.getfile +func Getfile(object *py.Object) *py.Object + +// Return the module name for a given file, or None. +// +//go:linkname Getmodulename py.getmodulename +func Getmodulename(path *py.Object) *py.Object + +// Return the filename that can be used to locate an object's source. +// +// Return None if no way can be identified to get the source. +// +//go:linkname Getsourcefile py.getsourcefile +func Getsourcefile(object *py.Object) *py.Object + +// Return an absolute path to the source or compiled file for an object. +// +// The idea is for each object to have a unique origin, so this routine +// normalizes the result as much as possible. +// +//go:linkname Getabsfile py.getabsfile +func Getabsfile(object *py.Object, Filename *py.Object) *py.Object + +// Return the module an object was defined in, or None if not found. +// +//go:linkname Getmodule py.getmodule +func Getmodule(object *py.Object, Filename *py.Object) *py.Object + +// Return the entire source file and starting line number for an object. +// +// The argument may be a module, class, method, function, traceback, frame, +// or code object. The source code is returned as a list of all the lines +// in the file and the line number indexes a line in that list. An OSError +// is raised if the source code cannot be retrieved. +// +//go:linkname Findsource py.findsource +func Findsource(object *py.Object) *py.Object + +// Get lines of comments immediately preceding an object's source code. +// +// Returns None when source can't be found. +// +//go:linkname Getcomments py.getcomments +func Getcomments(object *py.Object) *py.Object + +// Extract the block of code at the top of the given list of lines. +// +//go:linkname Getblock py.getblock +func Getblock(lines *py.Object) *py.Object + +// Return a list of source lines and starting line number for an object. +// +// The argument may be a module, class, method, function, traceback, frame, +// or code object. The source code is returned as a list of the lines +// corresponding to the object and the line number indicates where in the +// original source file the first line of code was found. An OSError is +// raised if the source code cannot be retrieved. +// +//go:linkname Getsourcelines py.getsourcelines +func Getsourcelines(object *py.Object) *py.Object + +// Return the text of the source code for an object. +// +// The argument may be a module, class, method, function, traceback, frame, +// or code object. The source code is returned as a single string. An +// OSError is raised if the source code cannot be retrieved. +// +//go:linkname Getsource py.getsource +func Getsource(object *py.Object) *py.Object + +// Recursive helper function for getclasstree(). +// +//go:linkname Walktree py.walktree +func Walktree(classes *py.Object, children *py.Object, parent *py.Object) *py.Object + +// Arrange the given list of classes into a hierarchy of nested lists. +// +// Where a nested list appears, it contains classes derived from the class +// whose entry immediately precedes the list. Each entry is a 2-tuple +// containing a class and a tuple of its base classes. If the 'unique' +// argument is true, exactly one entry appears in the returned structure +// for each class in the given list. Otherwise, classes using multiple +// inheritance and their descendants will appear multiple times. +// +//go:linkname Getclasstree py.getclasstree +func Getclasstree(classes *py.Object, unique *py.Object) *py.Object + +// Get information about the arguments accepted by a code object. +// +// Three things are returned: (args, varargs, varkw), where +// 'args' is the list of argument names. Keyword-only arguments are +// appended. 'varargs' and 'varkw' are the names of the * and ** +// arguments or None. +// +//go:linkname Getargs py.getargs +func Getargs(co *py.Object) *py.Object + +// Get the names and default values of a callable object's parameters. +// +// A tuple of seven things is returned: +// (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations). +// 'args' is a list of the parameter names. +// 'varargs' and 'varkw' are the names of the * and ** parameters or None. +// 'defaults' is an n-tuple of the default values of the last n parameters. +// 'kwonlyargs' is a list of keyword-only parameter names. +// 'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults. +// 'annotations' is a dictionary mapping parameter names to annotations. +// +// Notable differences from inspect.signature(): +// - the "self" parameter is always reported, even for bound methods +// - wrapper chains defined by __wrapped__ *not* unwrapped automatically +// +//go:linkname Getfullargspec py.getfullargspec +func Getfullargspec(func_ *py.Object) *py.Object + +// Get information about arguments passed into a particular frame. +// +// A tuple of four things is returned: (args, varargs, varkw, locals). +// 'args' is a list of the argument names. +// 'varargs' and 'varkw' are the names of the * and ** arguments or None. +// 'locals' is the locals dictionary of the given frame. +// +//go:linkname Getargvalues py.getargvalues +func Getargvalues(frame *py.Object) *py.Object + +// Get the mapping of arguments to values. +// +// A dict is returned, with keys the function argument names (including the +// names of the * and ** arguments, if any), and values the respective bound +// values from 'positional' and 'named'. +// +//go:linkname Getcallargs py.getcallargs +func Getcallargs(func_ *py.Object, __llgo_va_list ...interface{}) *py.Object + +// Get the mapping of free variables to their current values. +// +// Returns a named tuple of dicts mapping the current nonlocal, global +// and builtin references as seen by the body of the function. A final +// set of unbound names that could not be resolved is also provided. +// +//go:linkname Getclosurevars py.getclosurevars +func Getclosurevars(func_ *py.Object) *py.Object + +// Get information about a frame or traceback object. +// +// A tuple of five things is returned: the filename, the line number of +// the current line, the function name, a list of lines of context from +// the source code, and the index of the current line within that list. +// The optional second argument specifies the number of lines of context +// to return, which are centered around the current line. +// +//go:linkname Getframeinfo py.getframeinfo +func Getframeinfo(frame *py.Object, context *py.Object) *py.Object + +// Get the line number from a frame object, allowing for optimization. +// +//go:linkname Getlineno py.getlineno +func Getlineno(frame *py.Object) *py.Object + +// Get a list of records for a frame and all higher (calling) frames. +// +// Each record contains a frame object, filename, line number, function +// name, a list of lines of context, and index within the context. +// +//go:linkname Getouterframes py.getouterframes +func Getouterframes(frame *py.Object, context *py.Object) *py.Object + +// Get a list of records for a traceback's frame and all lower frames. +// +// Each record contains a frame object, filename, line number, function +// name, a list of lines of context, and index within the context. +// +//go:linkname Getinnerframes py.getinnerframes +func Getinnerframes(tb *py.Object, context *py.Object) *py.Object + +// Return the frame of the caller or None if this is not possible. +// +//go:linkname Currentframe py.currentframe +func Currentframe() *py.Object + +// Return a list of records for the stack above the caller's frame. +// +//go:linkname Stack py.stack +func Stack(context *py.Object) *py.Object + +// Return a list of records for the stack below the current exception. +// +//go:linkname Trace py.trace +func Trace(context *py.Object) *py.Object + +// Get current state of a generator-iterator. +// +// Possible states are: +// GEN_CREATED: Waiting to start execution. +// GEN_RUNNING: Currently being executed by the interpreter. +// GEN_SUSPENDED: Currently suspended at a yield expression. +// GEN_CLOSED: Execution has completed. +// +//go:linkname Getgeneratorstate py.getgeneratorstate +func Getgeneratorstate(generator *py.Object) *py.Object + +// Get the mapping of generator local variables to their current values. +// +// A dict is returned, with the keys the local variable names and values the +// bound values. +// +//go:linkname Getgeneratorlocals py.getgeneratorlocals +func Getgeneratorlocals(generator *py.Object) *py.Object + +// Get current state of a coroutine object. +// +// Possible states are: +// CORO_CREATED: Waiting to start execution. +// CORO_RUNNING: Currently being executed by the interpreter. +// CORO_SUSPENDED: Currently suspended at an await expression. +// CORO_CLOSED: Execution has completed. +// +//go:linkname Getcoroutinestate py.getcoroutinestate +func Getcoroutinestate(coroutine *py.Object) *py.Object + +// Get the mapping of coroutine local variables to their current values. +// +// A dict is returned, with the keys the local variable names and values the +// bound values. +// +//go:linkname Getcoroutinelocals py.getcoroutinelocals +func Getcoroutinelocals(coroutine *py.Object) *py.Object + +// Get current state of an asynchronous generator object. +// +// Possible states are: +// AGEN_CREATED: Waiting to start execution. +// AGEN_RUNNING: Currently being executed by the interpreter. +// AGEN_SUSPENDED: Currently suspended at a yield expression. +// AGEN_CLOSED: Execution has completed. +// +//go:linkname Getasyncgenstate py.getasyncgenstate +func Getasyncgenstate(agen *py.Object) *py.Object + +// Get the mapping of asynchronous generator local variables to their current +// values. +// +// A dict is returned, with the keys the local variable names and values the +// bound values. +// +//go:linkname Getasyncgenlocals py.getasyncgenlocals +func Getasyncgenlocals(agen *py.Object) *py.Object + +// Get a signature object for the passed callable. +// +//go:linkname Signature py.signature +func Signature(obj *py.Object) *py.Object diff --git a/py/inspect/inspect.go b/py/inspect/inspect.go deleted file mode 100644 index b9cb3324..00000000 --- a/py/inspect/inspect.go +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package inspect - -import ( - _ "unsafe" - - "github.com/goplus/llgo/py" -) - -const ( - LLGoPackage = "py.inspect" -) - -// https://docs.python.org/3/library/inspect.html - -// Return a signature object for the given callable. -// -//go:linkname Signature py.signature -func Signature(callable *py.Object) *py.Object - -// Get the names and default values of a Python function’s parameters. A named -// tuple is returned: -// -// FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations) -// -//go:linkname Getfullargspec py.getfullargspec -func Getfullargspec(f *py.Object) *py.Object diff --git a/py/numpy/gen.go b/py/numpy/gen.go index 5046f46f..85d6a435 100644 --- a/py/numpy/gen.go +++ b/py/numpy/gen.go @@ -606,7 +606,7 @@ func Identity(n *py.Object, dtype *py.Object) *py.Object // array([False, True]) // //go:linkname BitwiseNot py.bitwise_not -func BitwiseNot(args ...*py.Object) *py.Object +func BitwiseNot(__llgo_va_list ...interface{}) *py.Object // Return a new array of given shape and type, filled with `fill_value`. // @@ -814,7 +814,7 @@ func Full(shape *py.Object, fillValue *py.Object, dtype *py.Object, order *py.Ob // .. versionadded:: 1.10.0 // //go:linkname Matmul py.matmul -func Matmul(args ...*py.Object) *py.Object +func Matmul(__llgo_va_list ...interface{}) *py.Object // absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -888,7 +888,7 @@ func Matmul(args ...*py.Object) *py.Object // array([1.2, 1.2]) // //go:linkname Absolute py.absolute -func Absolute(args ...*py.Object) *py.Object +func Absolute(__llgo_va_list ...interface{}) *py.Object // add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -957,7 +957,7 @@ func Absolute(args ...*py.Object) *py.Object // [ 6., 8., 10.]]) // //go:linkname Add py.add -func Add(args ...*py.Object) *py.Object +func Add(__llgo_va_list ...interface{}) *py.Object // arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1043,7 +1043,7 @@ func Add(args ...*py.Object) *py.Object // >>> plt.show() // //go:linkname Arccos py.arccos -func Arccos(args ...*py.Object) *py.Object +func Arccos(__llgo_va_list ...interface{}) *py.Object // arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1121,7 +1121,7 @@ func Arccos(args ...*py.Object) *py.Object // 0.0 // //go:linkname Arccosh py.arccosh -func Arccosh(args ...*py.Object) *py.Object +func Arccosh(__llgo_va_list ...interface{}) *py.Object // arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1198,7 +1198,7 @@ func Arccosh(args ...*py.Object) *py.Object // 0.0 // //go:linkname Arcsin py.arcsin -func Arcsin(args ...*py.Object) *py.Object +func Arcsin(__llgo_va_list ...interface{}) *py.Object // arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1271,7 +1271,7 @@ func Arcsin(args ...*py.Object) *py.Object // array([ 1.72538256, 2.99822295]) // //go:linkname Arcsinh py.arcsinh -func Arcsinh(args ...*py.Object) *py.Object +func Arcsinh(__llgo_va_list ...interface{}) *py.Object // arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1360,7 +1360,7 @@ func Arcsinh(args ...*py.Object) *py.Object // >>> plt.show() // //go:linkname Arctan py.arctan -func Arctan(args ...*py.Object) *py.Object +func Arctan(__llgo_va_list ...interface{}) *py.Object // arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1467,7 +1467,7 @@ func Arctan(args ...*py.Object) *py.Object // array([0. , 3.14159265, 0.78539816]) // //go:linkname Arctan2 py.arctan2 -func Arctan2(args ...*py.Object) *py.Object +func Arctan2(__llgo_va_list ...interface{}) *py.Object // arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1544,7 +1544,7 @@ func Arctan2(args ...*py.Object) *py.Object // array([ 0. , -0.54930614]) // //go:linkname Arctanh py.arctanh -func Arctanh(args ...*py.Object) *py.Object +func Arctanh(__llgo_va_list ...interface{}) *py.Object // bitwise_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1631,7 +1631,7 @@ func Arctanh(args ...*py.Object) *py.Object // array([ 2, 4, 16]) // //go:linkname BitwiseAnd py.bitwise_and -func BitwiseAnd(args ...*py.Object) *py.Object +func BitwiseAnd(__llgo_va_list ...interface{}) *py.Object // bitwise_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1723,7 +1723,7 @@ func BitwiseAnd(args ...*py.Object) *py.Object // array([ 6, 5, 255]) // //go:linkname BitwiseOr py.bitwise_or -func BitwiseOr(args ...*py.Object) *py.Object +func BitwiseOr(__llgo_va_list ...interface{}) *py.Object // bitwise_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1808,7 +1808,7 @@ func BitwiseOr(args ...*py.Object) *py.Object // array([ True, False]) // //go:linkname BitwiseXor py.bitwise_xor -func BitwiseXor(args ...*py.Object) *py.Object +func BitwiseXor(__llgo_va_list ...interface{}) *py.Object // cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1858,7 +1858,7 @@ func BitwiseXor(args ...*py.Object) *py.Object // array([ 1., 2., 3.]) // //go:linkname Cbrt py.cbrt -func Cbrt(args ...*py.Object) *py.Object +func Cbrt(__llgo_va_list ...interface{}) *py.Object // ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1912,7 +1912,7 @@ func Cbrt(args ...*py.Object) *py.Object // array([-1., -1., -0., 1., 2., 2., 2.]) // //go:linkname Ceil py.ceil -func Ceil(args ...*py.Object) *py.Object +func Ceil(__llgo_va_list ...interface{}) *py.Object // conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -1974,7 +1974,7 @@ func Ceil(args ...*py.Object) *py.Object // [ 0.-0.j, 1.-1.j]]) // //go:linkname Conj py.conj -func Conj(args ...*py.Object) *py.Object +func Conj(__llgo_va_list ...interface{}) *py.Object // conjugate(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2036,7 +2036,7 @@ func Conj(args ...*py.Object) *py.Object // [ 0.-0.j, 1.-1.j]]) // //go:linkname Conjugate py.conjugate -func Conjugate(args ...*py.Object) *py.Object +func Conjugate(__llgo_va_list ...interface{}) *py.Object // copysign(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2099,7 +2099,7 @@ func Conjugate(args ...*py.Object) *py.Object // array([-1., 0., 1.]) // //go:linkname Copysign py.copysign -func Copysign(args ...*py.Object) *py.Object +func Copysign(__llgo_va_list ...interface{}) *py.Object // cos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2169,7 +2169,7 @@ func Copysign(args ...*py.Object) *py.Object // ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // //go:linkname Cos py.cos -func Cos(args ...*py.Object) *py.Object +func Cos(__llgo_va_list ...interface{}) *py.Object // cosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2224,7 +2224,7 @@ func Cos(args ...*py.Object) *py.Object // >>> plt.show() // //go:linkname Cosh py.cosh -func Cosh(args ...*py.Object) *py.Object +func Cosh(__llgo_va_list ...interface{}) *py.Object // deg2rad(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2281,7 +2281,7 @@ func Cosh(args ...*py.Object) *py.Object // 3.1415926535897931 // //go:linkname Deg2rad py.deg2rad -func Deg2rad(args ...*py.Object) *py.Object +func Deg2rad(__llgo_va_list ...interface{}) *py.Object // degrees(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2342,7 +2342,7 @@ func Deg2rad(args ...*py.Object) *py.Object // True // //go:linkname Degrees py.degrees -func Degrees(args ...*py.Object) *py.Object +func Degrees(__llgo_va_list ...interface{}) *py.Object // divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2425,7 +2425,7 @@ func Degrees(args ...*py.Object) *py.Object // [3. , 3.5, 4. ]]) // //go:linkname Divide py.divide -func Divide(args ...*py.Object) *py.Object +func Divide(__llgo_va_list ...interface{}) *py.Object // divmod(x1, x2[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2503,7 +2503,7 @@ func Divide(args ...*py.Object) *py.Object // (array([0, 0, 0, 1, 1]), array([0, 1, 2, 0, 1])) // //go:linkname Divmod py.divmod -func Divmod(args ...*py.Object) *py.Object +func Divmod(__llgo_va_list ...interface{}) *py.Object // equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2570,7 +2570,7 @@ func Divmod(args ...*py.Object) *py.Object // array([ True, True, False]) // //go:linkname Equal py.equal -func Equal(args ...*py.Object) *py.Object +func Equal(__llgo_va_list ...interface{}) *py.Object // exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2661,7 +2661,7 @@ func Equal(args ...*py.Object) *py.Object // >>> plt.show() // //go:linkname Exp py.exp -func Exp(args ...*py.Object) *py.Object +func Exp(__llgo_va_list ...interface{}) *py.Object // exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2715,7 +2715,7 @@ func Exp(args ...*py.Object) *py.Object // array([ 4., 8.]) // //go:linkname Exp2 py.exp2 -func Exp2(args ...*py.Object) *py.Object +func Exp2(__llgo_va_list ...interface{}) *py.Object // expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2776,7 +2776,7 @@ func Exp2(args ...*py.Object) *py.Object // 1.000000082740371e-10 // //go:linkname Expm1 py.expm1 -func Expm1(args ...*py.Object) *py.Object +func Expm1(__llgo_va_list ...interface{}) *py.Object // fabs(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2833,7 +2833,7 @@ func Expm1(args ...*py.Object) *py.Object // array([ 1.2, 1.2]) // //go:linkname Fabs py.fabs -func Fabs(args ...*py.Object) *py.Object +func Fabs(__llgo_va_list ...interface{}) *py.Object // floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2894,7 +2894,7 @@ func Fabs(args ...*py.Object) *py.Object // array([-2., -2., -1., 0., 1., 1., 2.]) // //go:linkname Floor py.floor -func Floor(args ...*py.Object) *py.Object +func Floor(__llgo_va_list ...interface{}) *py.Object // floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -2966,7 +2966,7 @@ func Floor(args ...*py.Object) *py.Object // array([0., 0., 1., 1.]) // //go:linkname FloorDivide py.floor_divide -func FloorDivide(args ...*py.Object) *py.Object +func FloorDivide(__llgo_va_list ...interface{}) *py.Object // float_power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3074,7 +3074,7 @@ func FloorDivide(args ...*py.Object) *py.Object // array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) // //go:linkname FloatPower py.float_power -func FloatPower(args ...*py.Object) *py.Object +func FloatPower(__llgo_va_list ...interface{}) *py.Object // fmax(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3164,7 +3164,7 @@ func FloatPower(args ...*py.Object) *py.Object // array([ 0., 0., nan]) // //go:linkname Fmax py.fmax -func Fmax(args ...*py.Object) *py.Object +func Fmax(__llgo_va_list ...interface{}) *py.Object // fmin(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3254,7 +3254,7 @@ func Fmax(args ...*py.Object) *py.Object // array([ 0., 0., nan]) // //go:linkname Fmin py.fmin -func Fmin(args ...*py.Object) *py.Object +func Fmin(__llgo_va_list ...interface{}) *py.Object // fmod(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3341,7 +3341,7 @@ func Fmin(args ...*py.Object) *py.Object // [ 1, 0]]) // //go:linkname Fmod py.fmod -func Fmod(args ...*py.Object) *py.Object +func Fmod(__llgo_va_list ...interface{}) *py.Object // frexp(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3421,7 +3421,7 @@ func Fmod(args ...*py.Object) *py.Object // array([ 0., 1., 2., 3., 4., 5., 6., 7., 8.]) // //go:linkname Frexp py.frexp -func Frexp(args ...*py.Object) *py.Object +func Frexp(__llgo_va_list ...interface{}) *py.Object // gcd(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3456,7 +3456,7 @@ func Frexp(args ...*py.Object) *py.Object // array([20, 1, 2, 1, 4, 5]) // //go:linkname Gcd py.gcd -func Gcd(args ...*py.Object) *py.Object +func Gcd(__llgo_va_list ...interface{}) *py.Object // greater_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3517,7 +3517,7 @@ func Gcd(args ...*py.Object) *py.Object // array([ True, True, False]) // //go:linkname GreaterEqual py.greater_equal -func GreaterEqual(args ...*py.Object) *py.Object +func GreaterEqual(__llgo_va_list ...interface{}) *py.Object // heaviside(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3589,7 +3589,7 @@ func GreaterEqual(args ...*py.Object) *py.Object // array([ 0., 1., 1.]) // //go:linkname Heaviside py.heaviside -func Heaviside(args ...*py.Object) *py.Object +func Heaviside(__llgo_va_list ...interface{}) *py.Object // hypot(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3653,7 +3653,7 @@ func Heaviside(args ...*py.Object) *py.Object // [ 5., 5., 5.]]) // //go:linkname Hypot py.hypot -func Hypot(args ...*py.Object) *py.Object +func Hypot(__llgo_va_list ...interface{}) *py.Object // invert(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3765,7 +3765,7 @@ func Hypot(args ...*py.Object) *py.Object // array([False, True]) // //go:linkname Invert py.invert -func Invert(args ...*py.Object) *py.Object +func Invert(__llgo_va_list ...interface{}) *py.Object // isfinite(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3847,7 +3847,7 @@ func Invert(args ...*py.Object) *py.Object // array([0, 1, 0]) // //go:linkname Isfinite py.isfinite -func Isfinite(args ...*py.Object) *py.Object +func Isfinite(__llgo_va_list ...interface{}) *py.Object // isinf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3922,7 +3922,7 @@ func Isfinite(args ...*py.Object) *py.Object // array([1, 0, 1]) // //go:linkname Isinf py.isinf -func Isinf(args ...*py.Object) *py.Object +func Isinf(__llgo_va_list ...interface{}) *py.Object // isnan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -3981,7 +3981,7 @@ func Isinf(args ...*py.Object) *py.Object // array([ True, False, False]) // //go:linkname Isnan py.isnan -func Isnan(args ...*py.Object) *py.Object +func Isnan(__llgo_va_list ...interface{}) *py.Object // isnat(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4037,7 +4037,7 @@ func Isnan(args ...*py.Object) *py.Object // array([ True, False]) // //go:linkname Isnat py.isnat -func Isnat(args ...*py.Object) *py.Object +func Isnat(__llgo_va_list ...interface{}) *py.Object // lcm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4074,7 +4074,7 @@ func Isnat(args ...*py.Object) *py.Object // array([ 0, 20, 20, 60, 20, 20]) // //go:linkname Lcm py.lcm -func Lcm(args ...*py.Object) *py.Object +func Lcm(__llgo_va_list ...interface{}) *py.Object // ldexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4144,7 +4144,7 @@ func Lcm(args ...*py.Object) *py.Object // array([ 0., 1., 2., 3., 4., 5.]) // //go:linkname Ldexp py.ldexp -func Ldexp(args ...*py.Object) *py.Object +func Ldexp(__llgo_va_list ...interface{}) *py.Object // left_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4233,7 +4233,7 @@ func Ldexp(args ...*py.Object) *py.Object // array([10, 20, 40]) // //go:linkname LeftShift py.left_shift -func LeftShift(args ...*py.Object) *py.Object +func LeftShift(__llgo_va_list ...interface{}) *py.Object // less(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4293,7 +4293,7 @@ func LeftShift(args ...*py.Object) *py.Object // array([ True, False]) // //go:linkname Less py.less -func Less(args ...*py.Object) *py.Object +func Less(__llgo_va_list ...interface{}) *py.Object // less_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4354,7 +4354,7 @@ func Less(args ...*py.Object) *py.Object // array([False, True, True]) // //go:linkname LessEqual py.less_equal -func LessEqual(args ...*py.Object) *py.Object +func LessEqual(__llgo_va_list ...interface{}) *py.Object // log(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4436,7 +4436,7 @@ func LessEqual(args ...*py.Object) *py.Object // array([ 0., 1., 2., -Inf]) // //go:linkname Log py.log -func Log(args ...*py.Object) *py.Object +func Log(__llgo_va_list ...interface{}) *py.Object // log10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4515,7 +4515,7 @@ func Log(args ...*py.Object) *py.Object // array([-15., nan]) // //go:linkname Log10 py.log10 -func Log10(args ...*py.Object) *py.Object +func Log10(__llgo_va_list ...interface{}) *py.Object // log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4596,7 +4596,7 @@ func Log10(args ...*py.Object) *py.Object // 0.0 // //go:linkname Log1p py.log1p -func Log1p(args ...*py.Object) *py.Object +func Log1p(__llgo_va_list ...interface{}) *py.Object // log2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4672,7 +4672,7 @@ func Log1p(args ...*py.Object) *py.Object // array([ 0.+2.26618007j, 0.+0.j , 1.+0.j , 2.+2.26618007j]) // //go:linkname Log2 py.log2 -func Log2(args ...*py.Object) *py.Object +func Log2(__llgo_va_list ...interface{}) *py.Object // logaddexp(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4739,7 +4739,7 @@ func Log2(args ...*py.Object) *py.Object // 3.5000000000000057e-50 // //go:linkname Logaddexp py.logaddexp -func Logaddexp(args ...*py.Object) *py.Object +func Logaddexp(__llgo_va_list ...interface{}) *py.Object // logaddexp2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4806,7 +4806,7 @@ func Logaddexp(args ...*py.Object) *py.Object // 3.4999999999999914e-50 // //go:linkname Logaddexp2 py.logaddexp2 -func Logaddexp2(args ...*py.Object) *py.Object +func Logaddexp2(__llgo_va_list ...interface{}) *py.Object // logical_and(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4874,7 +4874,7 @@ func Logaddexp2(args ...*py.Object) *py.Object // array([False, False]) // //go:linkname LogicalAnd py.logical_and -func LogicalAnd(args ...*py.Object) *py.Object +func LogicalAnd(__llgo_va_list ...interface{}) *py.Object // logical_not(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4931,7 +4931,7 @@ func LogicalAnd(args ...*py.Object) *py.Object // array([False, False, False, True, True]) // //go:linkname LogicalNot py.logical_not -func LogicalNot(args ...*py.Object) *py.Object +func LogicalNot(__llgo_va_list ...interface{}) *py.Object // logical_or(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -4999,7 +4999,7 @@ func LogicalNot(args ...*py.Object) *py.Object // array([ True, False]) // //go:linkname LogicalOr py.logical_or -func LogicalOr(args ...*py.Object) *py.Object +func LogicalOr(__llgo_va_list ...interface{}) *py.Object // logical_xor(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5065,7 +5065,7 @@ func LogicalOr(args ...*py.Object) *py.Object // [False, True]]) // //go:linkname LogicalXor py.logical_xor -func LogicalXor(args ...*py.Object) *py.Object +func LogicalXor(__llgo_va_list ...interface{}) *py.Object // maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5156,7 +5156,7 @@ func LogicalXor(args ...*py.Object) *py.Object // inf // //go:linkname Maximum py.maximum -func Maximum(args ...*py.Object) *py.Object +func Maximum(__llgo_va_list ...interface{}) *py.Object // minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5247,7 +5247,7 @@ func Maximum(args ...*py.Object) *py.Object // -inf // //go:linkname Minimum py.minimum -func Minimum(args ...*py.Object) *py.Object +func Minimum(__llgo_va_list ...interface{}) *py.Object // remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5336,7 +5336,7 @@ func Minimum(args ...*py.Object) *py.Object // array([0, 1, 2, 3, 4, 0, 1]) // //go:linkname Mod py.mod -func Mod(args ...*py.Object) *py.Object +func Mod(__llgo_va_list ...interface{}) *py.Object // modf(x[, out1, out2], / [, out=(None, None)], *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5402,7 +5402,7 @@ func Mod(args ...*py.Object) *py.Object // (-0.5, -0) // //go:linkname Modf py.modf -func Modf(args ...*py.Object) *py.Object +func Modf(__llgo_va_list ...interface{}) *py.Object // multiply(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5473,7 +5473,7 @@ func Modf(args ...*py.Object) *py.Object // [ 0., 7., 16.]]) // //go:linkname Multiply py.multiply -func Multiply(args ...*py.Object) *py.Object +func Multiply(__llgo_va_list ...interface{}) *py.Object // negative(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5526,7 +5526,7 @@ func Multiply(args ...*py.Object) *py.Object // array([-1., 1.]) // //go:linkname Negative py.negative -func Negative(args ...*py.Object) *py.Object +func Negative(__llgo_va_list ...interface{}) *py.Object // nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5581,7 +5581,7 @@ func Negative(args ...*py.Object) *py.Object // array([ True, True]) // //go:linkname Nextafter py.nextafter -func Nextafter(args ...*py.Object) *py.Object +func Nextafter(__llgo_va_list ...interface{}) *py.Object // not_equal(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5646,7 +5646,7 @@ func Nextafter(args ...*py.Object) *py.Object // array([False, True]) // //go:linkname NotEqual py.not_equal -func NotEqual(args ...*py.Object) *py.Object +func NotEqual(__llgo_va_list ...interface{}) *py.Object // positive(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5687,7 +5687,7 @@ func NotEqual(args ...*py.Object) *py.Object // array([ 1., -1.]) // //go:linkname Positive py.positive -func Positive(args ...*py.Object) *py.Object +func Positive(__llgo_va_list ...interface{}) *py.Object // power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5800,7 +5800,7 @@ func Positive(args ...*py.Object) *py.Object // array([-1.83697020e-16-1.j, -1.46957616e-15-8.j]) // //go:linkname Power py.power -func Power(args ...*py.Object) *py.Object +func Power(__llgo_va_list ...interface{}) *py.Object // rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5857,7 +5857,7 @@ func Power(args ...*py.Object) *py.Object // 90.0 // //go:linkname Rad2deg py.rad2deg -func Rad2deg(args ...*py.Object) *py.Object +func Rad2deg(__llgo_va_list ...interface{}) *py.Object // radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5918,7 +5918,7 @@ func Rad2deg(args ...*py.Object) *py.Object // True // //go:linkname Radians py.radians -func Radians(args ...*py.Object) *py.Object +func Radians(__llgo_va_list ...interface{}) *py.Object // reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -5978,7 +5978,7 @@ func Radians(args ...*py.Object) *py.Object // array([ 1. , 0.5 , 0.3003003]) // //go:linkname Reciprocal py.reciprocal -func Reciprocal(args ...*py.Object) *py.Object +func Reciprocal(__llgo_va_list ...interface{}) *py.Object // remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6067,7 +6067,7 @@ func Reciprocal(args ...*py.Object) *py.Object // array([0, 1, 2, 3, 4, 0, 1]) // //go:linkname Remainder py.remainder -func Remainder(args ...*py.Object) *py.Object +func Remainder(__llgo_va_list ...interface{}) *py.Object // right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6145,7 +6145,7 @@ func Remainder(args ...*py.Object) *py.Object // array([5, 2, 1]) // //go:linkname RightShift py.right_shift -func RightShift(args ...*py.Object) *py.Object +func RightShift(__llgo_va_list ...interface{}) *py.Object // rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6202,7 +6202,7 @@ func RightShift(args ...*py.Object) *py.Object // array([-2., -2., -0., 0., 2., 2., 2.]) // //go:linkname Rint py.rint -func Rint(args ...*py.Object) *py.Object +func Rint(__llgo_va_list ...interface{}) *py.Object // signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6250,7 +6250,7 @@ func Rint(args ...*py.Object) *py.Object // array([False, True, False]) // //go:linkname Signbit py.signbit -func Signbit(args ...*py.Object) *py.Object +func Signbit(__llgo_va_list ...interface{}) *py.Object // sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6331,7 +6331,7 @@ func Signbit(args ...*py.Object) *py.Object // >>> plt.show() // //go:linkname Sin py.sin -func Sin(args ...*py.Object) *py.Object +func Sin(__llgo_va_list ...interface{}) *py.Object // sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6409,7 +6409,7 @@ func Sin(args ...*py.Object) *py.Object // ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // //go:linkname Sinh py.sinh -func Sinh(args ...*py.Object) *py.Object +func Sinh(__llgo_va_list ...interface{}) *py.Object // spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6464,7 +6464,7 @@ func Sinh(args ...*py.Object) *py.Object // True // //go:linkname Spacing py.spacing -func Spacing(args ...*py.Object) *py.Object +func Spacing(__llgo_va_list ...interface{}) *py.Object // sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6535,7 +6535,7 @@ func Spacing(args ...*py.Object) *py.Object // array([ 2., nan, inf]) // //go:linkname Sqrt py.sqrt -func Sqrt(args ...*py.Object) *py.Object +func Sqrt(__llgo_va_list ...interface{}) *py.Object // square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6587,7 +6587,7 @@ func Sqrt(args ...*py.Object) *py.Object // array([-1.-0.j, 1.+0.j]) // //go:linkname Square py.square -func Square(args ...*py.Object) *py.Object +func Square(__llgo_va_list ...interface{}) *py.Object // subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6658,7 +6658,7 @@ func Square(args ...*py.Object) *py.Object // [6., 6., 6.]]) // //go:linkname Subtract py.subtract -func Subtract(args ...*py.Object) *py.Object +func Subtract(__llgo_va_list ...interface{}) *py.Object // tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6732,7 +6732,7 @@ func Subtract(args ...*py.Object) *py.Object // ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // //go:linkname Tan py.tan -func Tan(args ...*py.Object) *py.Object +func Tan(__llgo_va_list ...interface{}) *py.Object // tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6811,7 +6811,7 @@ func Tan(args ...*py.Object) *py.Object // ValueError: operands could not be broadcast together with shapes (3,3) (2,2) // //go:linkname Tanh py.tanh -func Tanh(args ...*py.Object) *py.Object +func Tanh(__llgo_va_list ...interface{}) *py.Object // divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6894,7 +6894,7 @@ func Tanh(args ...*py.Object) *py.Object // [3. , 3.5, 4. ]]) // //go:linkname TrueDivide py.true_divide -func TrueDivide(args ...*py.Object) *py.Object +func TrueDivide(__llgo_va_list ...interface{}) *py.Object // trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) // @@ -6953,7 +6953,7 @@ func TrueDivide(args ...*py.Object) *py.Object // array([-1., -1., -0., 0., 1., 1., 2.]) // //go:linkname Trunc py.trunc -func Trunc(args ...*py.Object) *py.Object +func Trunc(__llgo_va_list ...interface{}) *py.Object // Return the scalar dtype or NumPy equivalent of Python type of an object. // @@ -7526,7 +7526,7 @@ func GetPrintoptions() *py.Object // set_printoptions, get_printoptions // //go:linkname Printoptions py.printoptions -func Printoptions(args ...*py.Object) *py.Object +func Printoptions(__llgo_va_list ...interface{}) *py.Object // Format a floating-point scalar as a decimal string in positional notation. // @@ -8973,7 +8973,7 @@ func AddNewdoc(place *py.Object, obj *py.Object, doc *py.Object, warnOnPython *p // In case of ties, leftmost wins. If no wrapper is found, return None // //go:linkname GetArrayWrap py.get_array_wrap -func GetArrayWrap(args ...*py.Object) *py.Object +func GetArrayWrap(__llgo_va_list ...interface{}) *py.Object // Broadcast the input shapes into a single shape. // @@ -9015,7 +9015,7 @@ func GetArrayWrap(args ...*py.Object) *py.Object // (5, 6, 7) // //go:linkname BroadcastShapes py.broadcast_shapes -func BroadcastShapes(args ...*py.Object) *py.Object +func BroadcastShapes(__llgo_va_list ...interface{}) *py.Object // Return the indices to access (n, n) arrays, given a masking function. // @@ -9377,7 +9377,7 @@ func Issubsctype(arg1 *py.Object, arg2 *py.Object) *py.Object // 6 // //go:linkname Deprecate py.deprecate -func Deprecate(args ...*py.Object) *py.Object +func Deprecate(__llgo_va_list ...interface{}) *py.Object // Deprecates a function and includes the deprecation in its docstring. // @@ -10192,4 +10192,4 @@ func Asmatrix(data *py.Object, dtype *py.Object) *py.Object // array([1.2, 1.2]) // //go:linkname Abs py.abs -func Abs(args ...*py.Object) *py.Object +func Abs(__llgo_va_list ...interface{}) *py.Object diff --git a/py/os/gen.go b/py/os/gen.go index ba847ce2..8e3f3b68 100644 --- a/py/os/gen.go +++ b/py/os/gen.go @@ -310,20 +310,6 @@ func Getpriority(which *py.Object, who *py.Object) *py.Object //go:linkname Setpriority py.setpriority func Setpriority(which *py.Object, who *py.Object, priority *py.Object) *py.Object -// Rename a file or directory, overwriting the destination. -// -// If either src_dir_fd or dst_dir_fd is not None, it should be a file -// -// descriptor open to a directory, and the respective path string (src or dst) -// should be relative; the path will then be relative to that directory. -// -// src_dir_fd and dst_dir_fd, may not be implemented on your platform. -// -// If they are unavailable, using them will raise a NotImplementedError. -// -//go:linkname Replace py.replace -func Replace(src *py.Object, dst *py.Object) *py.Object - // Remove a directory. // // If dir_fd is not None, it should be a file descriptor open to a directory, @@ -441,11 +427,6 @@ func Execve(path *py.Object, argv *py.Object, env *py.Object) *py.Object //go:linkname Fork py.fork func Fork() *py.Object -// Get the maximum scheduling priority for policy. -// -//go:linkname SchedGetPriorityMax py.sched_get_priority_max -func SchedGetPriorityMax(policy *py.Object) *py.Object - // Get the minimum scheduling priority for policy. // //go:linkname SchedGetPriorityMin py.sched_get_priority_min @@ -1271,7 +1252,7 @@ func Fwalk(top *py.Object, topdown *py.Object, onerror *py.Object) *py.Object // current process. // //go:linkname Execl py.execl -func Execl(file *py.Object, args ...*py.Object) *py.Object +func Execl(file *py.Object, __llgo_va_list ...interface{}) *py.Object // execle(file, *args, env) // @@ -1279,7 +1260,7 @@ func Execl(file *py.Object, args ...*py.Object) *py.Object // environment env, replacing the current process. // //go:linkname Execle py.execle -func Execle(file *py.Object, args ...*py.Object) *py.Object +func Execle(file *py.Object, __llgo_va_list ...interface{}) *py.Object // execlp(file, *args) // @@ -1287,7 +1268,7 @@ func Execle(file *py.Object, args ...*py.Object) *py.Object // with argument list args, replacing the current process. // //go:linkname Execlp py.execlp -func Execlp(file *py.Object, args ...*py.Object) *py.Object +func Execlp(file *py.Object, __llgo_va_list ...interface{}) *py.Object // execlpe(file, *args, env) // @@ -1296,7 +1277,7 @@ func Execlp(file *py.Object, args ...*py.Object) *py.Object // process. // //go:linkname Execlpe py.execlpe -func Execlpe(file *py.Object, args ...*py.Object) *py.Object +func Execlpe(file *py.Object, __llgo_va_list ...interface{}) *py.Object // execvp(file, args) // @@ -1412,7 +1393,7 @@ func Spawnvpe(mode *py.Object, file *py.Object, args *py.Object, env *py.Object) // otherwise return -SIG, where SIG is the signal that killed it. // //go:linkname Spawnl py.spawnl -func Spawnl(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object +func Spawnl(mode *py.Object, file *py.Object, __llgo_va_list ...interface{}) *py.Object // spawnle(mode, file, *args, env) -> integer // @@ -1423,7 +1404,7 @@ func Spawnl(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object // otherwise return -SIG, where SIG is the signal that killed it. // //go:linkname Spawnle py.spawnle -func Spawnle(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object +func Spawnle(mode *py.Object, file *py.Object, __llgo_va_list ...interface{}) *py.Object // spawnlp(mode, file, *args) -> integer // @@ -1434,7 +1415,7 @@ func Spawnle(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object // otherwise return -SIG, where SIG is the signal that killed it. // //go:linkname Spawnlp py.spawnlp -func Spawnlp(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object +func Spawnlp(mode *py.Object, file *py.Object, __llgo_va_list ...interface{}) *py.Object // spawnlpe(mode, file, *args, env) -> integer // @@ -1445,4 +1426,4 @@ func Spawnlp(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object // otherwise return -SIG, where SIG is the signal that killed it. // //go:linkname Spawnlpe py.spawnlpe -func Spawnlpe(mode *py.Object, file *py.Object, args ...*py.Object) *py.Object +func Spawnlpe(mode *py.Object, file *py.Object, __llgo_va_list ...interface{}) *py.Object