Skip to content

Commit

Permalink
fix: avoid using type statement for backward compatibility (< 3.12)
Browse files Browse the repository at this point in the history
  • Loading branch information
bskim45 committed Sep 8, 2024
1 parent 40a7ea7 commit 96ceacc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ridiwise/api/readwise.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from typing import Literal, Optional, TypedDict
from typing import Literal, Optional, TypeAlias, TypedDict

import httpx

Expand All @@ -9,8 +9,8 @@
API_BASE_URL = 'https://readwise.io/api/v2'


type BookCategory = Literal['books', 'articles', 'tweets', 'podcasts']
type HightlightLocationType = Literal['page', 'order', 'time_offset']
BookCategory: TypeAlias = Literal['books', 'articles', 'tweets', 'podcasts']
HighlightLocationType: TypeAlias = Literal['page', 'order', 'time_offset']


class CreateHighlightRequestItem(TypedDict, total=False):
Expand All @@ -19,7 +19,7 @@ class CreateHighlightRequestItem(TypedDict, total=False):
author: Optional[str]
category: Optional[BookCategory]
location: Optional[int]
location_type: Optional[HightlightLocationType]
location_type: Optional[HighlightLocationType]
highlighted_at: Optional[str]
source_url: Optional[str]
source_type: Optional[str]
Expand Down Expand Up @@ -47,7 +47,7 @@ class CreateHighlightResponseItem(TypedDict):
modified_highlights: list[int]


type CreateHighlightsResponse = list[CreateHighlightResponseItem]
CreateHighlightsResponse: TypeAlias = list[CreateHighlightResponseItem]


class CreateHighlightTagRequest(TypedDict):
Expand Down

0 comments on commit 96ceacc

Please sign in to comment.