Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Adapt existing code for mypy
Browse files Browse the repository at this point in the history
* Current typing leaves a lot to be desired
  • Loading branch information
tdemin committed Apr 27, 2020
1 parent e036972 commit 4135c4c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project_amber/controllers/auth.py
Expand Up @@ -37,7 +37,7 @@ def gen_token() -> str:


class UserController:
user: LoginUser = None
user: LoginUser

def __init__(self, user: LoginUser):
self.user = user
Expand Down
4 changes: 2 additions & 2 deletions project_amber/controllers/task.py
@@ -1,4 +1,4 @@
from typing import List
from typing import List, Optional, cast

from project_amber.const import MSG_TASK_NOT_FOUND, MSG_TASK_DANGEROUS, \
MSG_TEXT_NOT_SPECIFIED
Expand All @@ -10,7 +10,7 @@


class TaskController:
user: LoginUser = None
user: LoginUser

def __init__(self, user: LoginUser):
self.user = user
Expand Down
2 changes: 2 additions & 0 deletions project_amber/models/task.py
Expand Up @@ -53,6 +53,8 @@ def merge(self, task: "Task"):

def __init__(self, owner: int, data: dict = None):
# TODO: should't throw HTTP errors from model code
# TODO: ideally this dictionary should be a TypedDict; we've bumped our
# Python requirements to 3.8 already
if not isinstance(data, dict): raise BadRequest
self.text = data.get(API_TEXT)
self.status = data.get(API_STATUS)
Expand Down

0 comments on commit 4135c4c

Please sign in to comment.