Skip to content

Commit

Permalink
feat(MyPy): WiP
Browse files Browse the repository at this point in the history
  • Loading branch information
650elx committed Oct 18, 2023
1 parent 242ed3e commit e29c69a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions sinch/core/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def __init__(self, project_id, request_data):
pass

def build_url(self, sinch) -> str:
pass
return ''

def build_query_params(self) -> dict:
pass
return {}

def request_body(self) -> dict:
pass
return {}

@abstractmethod
def handle_response(self, response: HTTPResponse):
Expand Down
5 changes: 4 additions & 1 deletion sinch/core/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from sinch.core.models.http_response import HTTPResponse


class SinchException(Exception):
def __init__(self, message: str, response, is_from_server: bool):
def __init__(self, message: str, response: HTTPResponse, is_from_server: bool):
self.is_from_server = is_from_server
self.response_status_code = response.status_code if response else None
self.http_response = response
Expand Down
6 changes: 3 additions & 3 deletions sinch/core/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

@dataclass
class SinchBaseModel:
def as_dict(self):
def as_dict(self) -> dict:
return asdict(self)

def as_json(self):
def as_json(self) -> str:
return json.dumps(self.as_dict())


@dataclass
class SinchRequestBaseModel(SinchBaseModel):
def as_dict(self):
def as_dict(self) -> dict:
return {k: v for k, v in asdict(self).items() if v is not None}

0 comments on commit e29c69a

Please sign in to comment.