Skip to content

Commit 6664f42

Browse files
authored
fix: remove return type from postgrest methods (#1110)
1 parent c0ca175 commit 6664f42

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ build_sync:
2020
sed -i 's/asyncio.create_task(self.realtime.set_auth(access_token))//g' supabase/_sync/client.py
2121
sed -i 's/asynch/synch/g' supabase/_sync/auth_client.py
2222
sed -i 's/Async/Sync/g' supabase/_sync/auth_client.py
23+
sed -i 's/Async/Sync/g' supabase/_sync/client.py

supabase/_async/client.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import asyncio
22
import re
3-
from typing import Any, Dict, List, Optional, Union
3+
from typing import Any, Dict, Optional, Union
44

55
from gotrue import AsyncMemoryStorage
66
from gotrue.types import AuthChangeEvent, Session
77
from httpx import Timeout
88
from postgrest import (
99
AsyncPostgrestClient,
10-
AsyncRequestBuilder,
11-
AsyncRPCFilterRequestBuilder,
1210
)
1311
from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT
1412
from postgrest.types import CountMethod
@@ -116,7 +114,7 @@ async def create(
116114

117115
return client
118116

119-
def table(self, table_name: str) -> AsyncRequestBuilder:
117+
def table(self, table_name: str):
120118
"""Perform a table operation.
121119

122120
Note that the supabase client uses the `from` method, but in Python,
@@ -125,14 +123,14 @@ def table(self, table_name: str) -> AsyncRequestBuilder:
125123
"""
126124
return self.from_(table_name)
127125

128-
def schema(self, schema: str) -> AsyncPostgrestClient:
126+
def schema(self, schema: str):
129127
"""Select a schema to query or perform an function (rpc) call.
130128

131129
The schema needs to be on the list of exposed schemas inside Supabase.
132130
"""
133131
return self.postgrest.schema(schema)
134132

135-
def from_(self, table_name: str) -> AsyncRequestBuilder:
133+
def from_(self, table_name: str):
136134
"""Perform a table operation.
137135

138136
See the `table` method.
@@ -146,7 +144,7 @@ def rpc(
146144
count: Optional[CountMethod] = None,
147145
head: bool = False,
148146
get: bool = False,
149-
) -> AsyncRPCFilterRequestBuilder:
147+
):
150148
"""Performs a stored procedure call.
151149

152150
Parameters
@@ -161,7 +159,7 @@ def rpc(
161159

162160
Returns
163161
-------
164-
SyncFilterRequestBuilder
162+
AsyncFilterRequestBuilder
165163
Returns a filter builder. This lets you apply filters on the response
166164
of an RPC.
167165
"""
@@ -207,15 +205,15 @@ def channel(
207205
"""Creates a Realtime channel with Broadcast, Presence, and Postgres Changes."""
208206
return self.realtime.channel(topic, params)
209207

210-
def get_channels(self) -> List[AsyncRealtimeChannel]:
208+
def get_channels(self):
211209
"""Returns all realtime channels."""
212210
return self.realtime.get_channels()
213211

214-
async def remove_channel(self, channel: AsyncRealtimeChannel) -> None:
212+
async def remove_channel(self, channel: AsyncRealtimeChannel):
215213
"""Unsubscribes and removes Realtime channel from Realtime client."""
216214
await self.realtime.remove_channel(channel)
217215

218-
async def remove_all_channels(self) -> None:
216+
async def remove_all_channels(self):
219217
"""Unsubscribes and removes all Realtime channels from Realtime client."""
220218
await self.realtime.remove_all_channels()
221219

supabase/_sync/client.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import re
2-
from typing import Any, Dict, List, Optional, Union
2+
from typing import Any, Dict, Optional, Union
33

44
from gotrue import SyncMemoryStorage
55
from gotrue.types import AuthChangeEvent, Session
66
from httpx import Timeout
77
from postgrest import (
88
SyncPostgrestClient,
9-
SyncRequestBuilder,
10-
SyncRPCFilterRequestBuilder,
119
)
1210
from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT
1311
from postgrest.types import CountMethod
@@ -115,7 +113,7 @@ def create(
115113

116114
return client
117115

118-
def table(self, table_name: str) -> SyncRequestBuilder:
116+
def table(self, table_name: str):
119117
"""Perform a table operation.
120118

121119
Note that the supabase client uses the `from` method, but in Python,
@@ -124,14 +122,14 @@ def table(self, table_name: str) -> SyncRequestBuilder:
124122
"""
125123
return self.from_(table_name)
126124

127-
def schema(self, schema: str) -> SyncPostgrestClient:
125+
def schema(self, schema: str):
128126
"""Select a schema to query or perform an function (rpc) call.
129127

130128
The schema needs to be on the list of exposed schemas inside Supabase.
131129
"""
132130
return self.postgrest.schema(schema)
133131

134-
def from_(self, table_name: str) -> SyncRequestBuilder:
132+
def from_(self, table_name: str):
135133
"""Perform a table operation.
136134

137135
See the `table` method.
@@ -145,7 +143,7 @@ def rpc(
145143
count: Optional[CountMethod] = None,
146144
head: bool = False,
147145
get: bool = False,
148-
) -> SyncRPCFilterRequestBuilder:
146+
):
149147
"""Performs a stored procedure call.
150148

151149
Parameters
@@ -206,15 +204,15 @@ def channel(
206204
"""Creates a Realtime channel with Broadcast, Presence, and Postgres Changes."""
207205
return self.realtime.channel(topic, params)
208206

209-
def get_channels(self) -> List[SyncRealtimeChannel]:
207+
def get_channels(self):
210208
"""Returns all realtime channels."""
211209
return self.realtime.get_channels()
212210

213-
def remove_channel(self, channel: SyncRealtimeChannel) -> None:
211+
def remove_channel(self, channel: SyncRealtimeChannel):
214212
"""Unsubscribes and removes Realtime channel from Realtime client."""
215213
self.realtime.remove_channel(channel)
216214

217-
def remove_all_channels(self) -> None:
215+
def remove_all_channels(self):
218216
"""Unsubscribes and removes all Realtime channels from Realtime client."""
219217
self.realtime.remove_all_channels()
220218

0 commit comments

Comments
 (0)