Lines Matching refs:PythonObject
66 class PythonObject; variable
207 T, typename std::enable_if<std::is_base_of<PythonObject, T>::value>::type> {
212 class PythonObject {
214 PythonObject() = default;
216 PythonObject(PyRefType type, PyObject *py_obj) {
226 PythonObject(const PythonObject &rhs)
227 : PythonObject(PyRefType::Borrowed, rhs.m_py_obj) {}
229 PythonObject(PythonObject &&rhs) {
234 ~PythonObject() { Reset(); }
255 PythonObject &operator=(PythonObject other) {
267 static PythonObject ResolveNameWithDictionary(llvm::StringRef name,
276 PythonObject ResolveName(llvm::StringRef name) const;
284 PythonObject GetAttributeValue(llvm::StringRef attribute) const;
303 llvm::Expected<PythonObject> CallMethod(const char *name,
311 return python::Take<PythonObject>(obj);
315 llvm::Expected<PythonObject> Call(const T &... t) const {
321 return python::Take<PythonObject>(obj);
324 llvm::Expected<PythonObject> GetAttribute(const llvm::Twine &name) const {
330 return python::Take<PythonObject>(obj);
349 llvm::Expected<bool> IsInstance(const PythonObject &cls) {
364 template <typename T> llvm::Expected<T> As(llvm::Expected<PythonObject> &&obj) {
373 template <> llvm::Expected<bool> As<bool>(llvm::Expected<PythonObject> &&obj);
376 llvm::Expected<long long> As<long long>(llvm::Expected<PythonObject> &&obj);
380 As<unsigned long long>(llvm::Expected<PythonObject> &&obj);
383 llvm::Expected<std::string> As<std::string>(llvm::Expected<PythonObject> &&obj);
386 template <class T> class TypedPythonObject : public PythonObject {
392 PythonObject::operator=(PythonObject(type, py_obj));
500 PythonObject GetItemAtIndex(uint32_t index) const;
502 void SetItemAtIndex(uint32_t index, const PythonObject &object);
504 void AppendItem(const PythonObject &object);
515 PythonTuple(std::initializer_list<PythonObject> objects);
522 PythonObject GetItemAtIndex(uint32_t index) const;
524 void SetItemAtIndex(uint32_t index, const PythonObject &object);
543 PythonObject GetItemForKey(const PythonObject &key) const; // DEPRECATED
544 void SetItemForKey(const PythonObject &key,
545 const PythonObject &value); // DEPRECATED
547 llvm::Expected<PythonObject> GetItem(const PythonObject &key) const;
548 llvm::Expected<PythonObject> GetItem(const llvm::Twine &key) const;
549 llvm::Error SetItem(const PythonObject &key, const PythonObject &value) const;
550 llvm::Error SetItem(const llvm::Twine &key, const PythonObject &value) const;
580 llvm::Expected<PythonObject> Get(const llvm::Twine &name);
601 PythonObject operator()();
603 PythonObject operator()(std::initializer_list<PyObject *> args);
605 PythonObject operator()(std::initializer_list<PythonObject> args);
608 PythonObject operator()(const Arg &arg, Args... args) {
687 llvm::Expected<PythonObject> runStringOneLine(const llvm::Twine &string,
691 llvm::Expected<PythonObject> runStringMultiLine(const llvm::Twine &string,
722 llvm::Expected<PythonObject> operator()(Args &&... args) {
734 StructuredPythonObject(PythonObject obj)
740 PythonObject(PyRefType::Owned, static_cast<PyObject *>(GetValue()));