Lines Matching refs:PythonObject
66 class PythonObject; variable
222 T, typename std::enable_if<std::is_base_of<PythonObject, T>::value>::type> {
227 class PythonObject {
229 PythonObject() = default;
231 PythonObject(PyRefType type, PyObject *py_obj) {
241 PythonObject(const PythonObject &rhs)
242 : PythonObject(PyRefType::Borrowed, rhs.m_py_obj) {}
244 PythonObject(PythonObject &&rhs) {
249 ~PythonObject() { Reset(); }
270 PythonObject &operator=(PythonObject other) {
282 static PythonObject ResolveNameWithDictionary(llvm::StringRef name,
291 PythonObject ResolveName(llvm::StringRef name) const;
299 PythonObject GetAttributeValue(llvm::StringRef attribute) const;
318 llvm::Expected<PythonObject> CallMethod(const char *name,
326 return python::Take<PythonObject>(obj);
330 llvm::Expected<PythonObject> Call(const T &... t) const {
336 return python::Take<PythonObject>(obj);
339 llvm::Expected<PythonObject> GetAttribute(const llvm::Twine &name) const {
345 return python::Take<PythonObject>(obj);
348 llvm::Expected<PythonObject> GetType() const {
354 return python::Take<PythonObject>(obj);
373 llvm::Expected<bool> IsInstance(const PythonObject &cls) {
388 template <typename T> llvm::Expected<T> As(llvm::Expected<PythonObject> &&obj) {
397 template <> llvm::Expected<bool> As<bool>(llvm::Expected<PythonObject> &&obj);
400 llvm::Expected<long long> As<long long>(llvm::Expected<PythonObject> &&obj);
404 As<unsigned long long>(llvm::Expected<PythonObject> &&obj);
407 llvm::Expected<std::string> As<std::string>(llvm::Expected<PythonObject> &&obj);
410 template <class T> class TypedPythonObject : public PythonObject {
416 PythonObject::operator=(PythonObject(type, py_obj));
528 PythonObject GetItemAtIndex(uint32_t index) const;
530 void SetItemAtIndex(uint32_t index, const PythonObject &object);
532 void AppendItem(const PythonObject &object);
543 PythonTuple(std::initializer_list<PythonObject> objects);
550 PythonObject GetItemAtIndex(uint32_t index) const;
552 void SetItemAtIndex(uint32_t index, const PythonObject &object);
573 PythonObject GetItemForKey(const PythonObject &key) const; // DEPRECATED
574 void SetItemForKey(const PythonObject &key,
575 const PythonObject &value); // DEPRECATED
577 llvm::Expected<PythonObject> GetItem(const PythonObject &key) const;
578 llvm::Expected<PythonObject> GetItem(const llvm::Twine &key) const;
579 llvm::Error SetItem(const PythonObject &key, const PythonObject &value) const;
580 llvm::Error SetItem(const llvm::Twine &key, const PythonObject &value) const;
610 llvm::Expected<PythonObject> Get(const llvm::Twine &name);
631 PythonObject operator()();
633 PythonObject operator()(std::initializer_list<PyObject *> args);
635 PythonObject operator()(std::initializer_list<PythonObject> args);
638 PythonObject operator()(const Arg &arg, Args... args) {
717 llvm::Expected<PythonObject> runStringOneLine(const llvm::Twine &string,
721 llvm::Expected<PythonObject> runStringMultiLine(const llvm::Twine &string,
752 llvm::Expected<PythonObject> operator()(Args &&... args) {
764 StructuredPythonObject(PythonObject obj)
770 PythonObject(PyRefType::Owned, static_cast<PyObject *>(GetValue()));