66import httpx
77from httpx import AsyncClient , Response
88
9- from netschoolapi import data , errors , schemas
9+ from netschoolapi import errors , schemas
1010
1111__all__ = ['NetSchoolAPI' ]
1212
@@ -142,7 +142,7 @@ async def _request_with_optional_relogin(
142142 return response
143143
144144 async def download_attachment (
145- self , attachment : data .Attachment ,
145+ self , attachment : schemas .Attachment ,
146146 path_or_file : Union [BytesIO , str ] = None ,
147147 requests_timeout : int = None ):
148148 """
@@ -167,7 +167,7 @@ async def download_attachment(
167167 file .close ()
168168
169169 async def download_attachment_as_bytes (
170- self , attachment : data .Attachment , requests_timeout : int = None ,
170+ self , attachment : schemas .Attachment , requests_timeout : int = None ,
171171 ) -> BytesIO :
172172 attachment_contents_buffer = BytesIO ()
173173 await self .download_attachment (
@@ -181,7 +181,7 @@ async def diary(
181181 start : Optional [date ] = None ,
182182 end : Optional [date ] = None ,
183183 requests_timeout : int = None ,
184- ) -> data .Diary :
184+ ) -> schemas .Diary :
185185 if not start :
186186 monday = date .today () - timedelta (days = date .today ().weekday ())
187187 start = monday
@@ -200,14 +200,14 @@ async def diary(
200200 )
201201 diary_schema = schemas .Diary ()
202202 diary_schema .context ['assignment_types' ] = self ._assignment_types
203- return data . diary ( diary_schema .load (response .json () ))
203+ return diary_schema .load (response .json ())
204204
205205 async def overdue (
206206 self ,
207207 start : Optional [date ] = None ,
208208 end : Optional [date ] = None ,
209209 requests_timeout : int = None ,
210- ) -> List [data .Assignment ]:
210+ ) -> List [schemas .Assignment ]:
211211 if not start :
212212 monday = date .today () - timedelta (days = date .today ().weekday ())
213213 start = monday
@@ -227,25 +227,22 @@ async def overdue(
227227 assignments_schema = schemas .Assignment ()
228228 assignments_schema .context ['assignment_types' ] = self ._assignment_types
229229 assignments = assignments_schema .load (response .json (), many = True )
230- return [ data . Assignment ( ** assignment ) for assignment in assignments ]
230+ return assignments
231231
232232 async def announcements (
233233 self , take : Optional [int ] = - 1 ,
234- requests_timeout : int = None ) -> List [data .Announcement ]:
234+ requests_timeout : int = None ) -> List [schemas .Announcement ]:
235235 response = await self ._request_with_optional_relogin (
236236 requests_timeout ,
237237 'announcements' ,
238238 params = {'take' : take },
239239 )
240240 announcements = schemas .Announcement ().load (response .json (), many = True )
241- return [
242- data .announcement (announcement )
243- for announcement in announcements
244- ]
241+ return announcements
245242
246243 async def attachments (
247- self , assignment : data .Assignment ,
248- requests_timeout : int = None ) -> List [data .Attachment ]:
244+ self , assignment : schemas .Assignment ,
245+ requests_timeout : int = None ) -> List [schemas .Attachment ]:
249246 response = await self ._request_with_optional_relogin (
250247 requests_timeout ,
251248 method = "POST" ,
@@ -258,15 +255,15 @@ async def attachments(
258255 return []
259256 attachments_json = response [0 ]['attachments' ]
260257 attachments = schemas .Attachment ().load (attachments_json , many = True )
261- return [ data . Attachment ( ** attachment ) for attachment in attachments ]
258+ return attachments
262259
263- async def school (self , requests_timeout : int = None ):
260+ async def school (self , requests_timeout : int = None ) -> schemas . School :
264261 response = await self ._request_with_optional_relogin (
265262 requests_timeout ,
266263 'schools/{0}/card' .format (self ._school_id ),
267264 )
268265 school = schemas .School ().load (response .json ())
269- return data . School ( ** school )
266+ return school
270267
271268 async def logout (self , requests_timeout : int = None ):
272269 try :
0 commit comments