From b4aa69cfa6392badcbca765ff58817c0e03af57c Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 15 Jun 2023 16:15:29 +0200 Subject: [PATCH] Python: Add return type for eq/ne --- .../src/bindings/python/templates/ObjectTemplate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uniffi_bindgen/src/bindings/python/templates/ObjectTemplate.py b/uniffi_bindgen/src/bindings/python/templates/ObjectTemplate.py index d312d92b5d..4ae15971e1 100644 --- a/uniffi_bindgen/src/bindings/python/templates/ObjectTemplate.py +++ b/uniffi_bindgen/src/bindings/python/templates/ObjectTemplate.py @@ -47,13 +47,13 @@ def {{ cons.name()|fn_name }}(cls, {% call py::arg_list_decl(cons) %}): {%- when UniffiTrait::Display { fmt } %} {%- call py::method_decl("__str__", fmt) %} {%- when UniffiTrait::Eq { eq, ne } %} - def __eq__(self, other: object): + def __eq__(self, other: object) -> {{ eq.return_type().unwrap()|type_name }}: if not isinstance(other, {{ type_name }}): return NotImplemented return {{ eq.return_type().unwrap()|lift_fn }}({% call py::to_ffi_call_with_prefix("self._pointer", eq) %}) - def __ne__(self, other: object): + def __ne__(self, other: object) -> {{ ne.return_type().unwrap()|type_name }}: if not isinstance(other, {{ type_name }}): return NotImplemented