Skip to content

Commit

Permalink
Add annotations, __repr__ and __slots__
Browse files Browse the repository at this point in the history
Co-authored-by: James Hilton-Balfe <[email protected]>
  • Loading branch information
AdrienVannson and Gobot1234 authored Sep 10, 2024
1 parent 162fcd8 commit 90fa2ed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/betterproto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,20 @@ class Casing(builtin_enum.Enum):


class Placeholder:
def __copy__(self):
__slots__ = ()

def __repr__(self) -> str:
return "<PLACEHOLDER>"

def __copy__(self) -> Self:
return self

def __deepcopy__(self, _):
def __deepcopy__(self, _) -> Self:
return self


# We can't simply use object() here because pydantic automatically performs deep-copy of mutable default values
# See https://github.com/danielgtaylor/python-betterproto/issues/606
# See #606
PLACEHOLDER: Any = Placeholder()


Expand Down

0 comments on commit 90fa2ed

Please sign in to comment.