Skip to content

Commit

Permalink
Use a property to define Jsonlibrary
Browse files Browse the repository at this point in the history
This is suggested/recommended at
python/mypy#6002

Discovered as part of matrix-org/synapse#15052
  • Loading branch information
David Robertson committed Feb 15, 2023
1 parent 93eb113 commit 20a7e94
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/canonicaljson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> "Encoder":


class JsonLibrary(Protocol):
JSONEncoder: Encoder
@property
def JSONEncoder(self) -> Encoder:
pass


# Declare these in the module scope, but they get configured in
Expand Down

0 comments on commit 20a7e94

Please sign in to comment.