Skip to content

Commit 20a7e94

Browse files
author
David Robertson
committed
Use a property to define Jsonlibrary
This is suggested/recommended at python/mypy#6002 Discovered as part of matrix-org/synapse#15052
1 parent 93eb113 commit 20a7e94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/canonicaljson/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> "Encoder":
5252

5353

5454
class JsonLibrary(Protocol):
55-
JSONEncoder: Encoder
55+
@property
56+
def JSONEncoder(self) -> Encoder:
57+
pass
5658

5759

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

0 commit comments

Comments
 (0)