-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender_mixin.py
More file actions
30 lines (22 loc) · 858 Bytes
/
render_mixin.py
File metadata and controls
30 lines (22 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class RenderMixin[Model]:
"""Render resource mixin."""
def render(self, resource_id: str) -> str:
"""Render resource.
Args:
resource_id: Resource ID
Returns:
Rendered resource.
"""
response = self._resource_do_request(resource_id, action="render") # type: ignore[attr-defined]
return response.text # type: ignore[no-any-return]
class AsyncRenderMixin[Model]:
"""Asynchronous render resource mixin."""
async def render(self, resource_id: str) -> str:
"""Render resource.
Args:
resource_id: Resource ID
Returns:
Rendered resource.
"""
response = await self._resource_do_request(resource_id, action="render") # type: ignore[attr-defined]
return response.text # type: ignore[no-any-return]