Skip to content

Commit

Permalink
Python: Add return type for eq/ne
Browse files Browse the repository at this point in the history
  • Loading branch information
badboy committed Jun 16, 2023
1 parent 3db8ec7 commit 9daeb38
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9daeb38

Please sign in to comment.