8000 Update src/betterproto/__init__.py · danielgtaylor/python-betterproto@9e8fbbc · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e8fbbc

Browse files
nat-nGobot1234
andauthored
Update src/betterproto/__init__.py
Co-authored-by: James <50501825+Gobot1234@users.noreply.github.com>
1 parent 3539fc8 commit 9e8fbbc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/betterproto/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -535,26 +535,25 @@ def __post_init__(self) -> None:
535535
def __raw_get(self, name: str) -> Any:
536536
return super().__getattribute__(name)
537537

538-
def __eq__(self, other):
538+
def __eq__(self, other: T) -> bool:
539539
if type(self) is not type(other):
540540
return False
541541

542-
equal = True
543542
for field_name in self._betterproto.meta_by_field_name:
544543
self_val = self.__raw_get(field_name)
545544
other_val = other.__raw_get(field_name)
546545
if self_val is PLACEHOLDER and other_val is PLACEHOLDER:
547546
continue
548-
elif self_val is PLACEHOLDER:
547+
548+
if self_val is PLACEHOLDER:
549549
self_val = self._get_field_default(field_name)
550550
elif other_val is PLACEHOLDER:
551551
other_val = other._get_field_default(field_name)
552552

553553
if self_val != other_val:
554-
equal = False
555-
break
554+
return False
556555

557-
return equal
556+
return True
558557

559558
def __repr__(self) -> str:
560559
parts = []

0 commit comments

Comments
 (0)
0