-
-
Notifications
You must be signed in to change notification settings - Fork 371
Closed
Description
Chore
Refactoring
In Python 3.8 and later, TypedDict has been added to the typing module.
Lines 1 to 8 in e9feb48
from typing_extensions import NotRequired, TypedDict | |
class RealtimeClientOptions(TypedDict, total=False): | |
auto_reconnect: NotRequired[bool] | |
hb_interval: NotRequired[int] | |
max_retries: NotRequired[int] | |
initial_backoff: NotRequired[float] |
The README says Install the package (for Python > 3.7):
, but I think it actually supports Python >= 3.9.
Line 39 in e9feb48
Install the package (for Python > 3.7): |
supabase-py/.github/workflows/ci.yml
Line 21 in e9feb48
python-version: ["3.9", "3.10", "3.11", "3.12"] |
Proposal
It can be refactored as follows
from typing import TypedDict
class RealtimeClientOptions(TypedDict, total=False):
auto_reconnect: bool
hb_interval: int
max_retries: int
initial_backoff: float
Here, instead of specifying each field as NotRequired, all fields are treated as optional with total=False. This makes the code simpler and more readable. reference
If it's convenient for you, I would be happy to help you.
Metadata
Metadata
Assignees
Labels
No labels