Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
rbw committed Nov 13, 2020
1 parent 4be1585 commit 9d8fbb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 5 additions & 7 deletions aiosnow/models/attachment/model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
from concurrent.futures import ThreadPoolExecutor
from mimetypes import guess_type
from typing import Union
from typing import Union, Any

from aiosnow.query import Condition, Selector
from aiosnow.request import Response, methods
Expand All @@ -11,22 +11,20 @@
from .schema import AttachmentModelSchema


class AttachmentModel(BaseTableModel):
class AttachmentModel(BaseTableModel, AttachmentModelSchema):
"""Attachment API Model"""

schema_cls = AttachmentModelSchema

def __init__(self, *args, **kwargs):
def __init__(self, *args: Any, **kwargs: Any):
self.io_pool_exc = ThreadPoolExecutor(max_workers=10)
self.loop = asyncio.get_running_loop()
super(AttachmentModel, self).__init__(*args, **kwargs)

async def create(self, *_) -> None:
async def create(self, payload: dict) -> Response:
raise AttributeError(
"Attachment doesn't support create(), use upload() instead"
)

async def update(self, *_) -> None:
async def update(self, selection: Union[Condition, str], payload: dict) -> Response:
raise AttributeError("Attachment doesn't support update()")

@property
Expand Down
3 changes: 2 additions & 1 deletion aiosnow/models/table/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from aiosnow.models.attachment.file import FileHandler
from aiosnow.query import Condition, Selector
from aiosnow.request import Response
from aiosnow.client import Client

from .._base.table import BaseTableModel


class TableModel(BaseTableModel):
def __init__(self, client, **kwargs):
def __init__(self, client: Client, **kwargs: Any):
self._attachment = AttachmentModel(client, table_name=kwargs.get("table_name"))
super(TableModel, self).__init__(client, **kwargs)

Expand Down

0 comments on commit 9d8fbb7

Please sign in to comment.