Skip to content

Commit

Permalink
#323: fix TophProblem.get_url() to pass the type-checker
Browse files Browse the repository at this point in the history
There was:

$ mypy oj onlinejudge setup.py tests
onlinejudge/service/toph.py:151: error: Invalid index type "Optional[str]" for "Dict[str, str]"; expected type "str"
  • Loading branch information
kmyk committed Feb 25, 2019
1 parent adb59e2 commit fd54382
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions onlinejudge/service/toph.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ def submit_code(self, code: bytes, language: str, session: Optional['requests.Se
raise SubmissionError

def get_url(self) -> str:
table = {}
table['problem'] = 'https://toph.co/p/{}'
return table[self.kind].format(self.problem_id)
assert self.kind == 'problem'
return 'https://toph.co/p/{}'.format(self.problem_id)

def get_service(self) -> TophService:
return TophService()
Expand Down

0 comments on commit fd54382

Please sign in to comment.