mypy: Fix StateHandler annotations.

`get` and `put` deal with arbitrary JSON-serializable types,
so `Text` was an innacurate annotation.
This commit is contained in:
Steve Howell 2017-12-11 10:35:03 -06:00
parent 7bc79a8911
commit b4ff5230a9

View file

@ -71,14 +71,14 @@ class StateHandler(object):
raise StateHandlerError("Error initializing state: {}".format(str(response))) raise StateHandlerError("Error initializing state: {}".format(str(response)))
def put(self, key, value): def put(self, key, value):
# type: (Text, Text) -> None # type: (Text, Any) -> None
self.state_[key] = self.marshal(value) self.state_[key] = self.marshal(value)
response = self._client.update_storage({'storage': {key: self.state_[key]}}) response = self._client.update_storage({'storage': {key: self.state_[key]}})
if response['result'] != 'success': if response['result'] != 'success':
raise StateHandlerError("Error updating state: {}".format(str(response))) raise StateHandlerError("Error updating state: {}".format(str(response)))
def get(self, key): def get(self, key):
# type: (Text) -> Text # type: (Text) -> Any
return self.demarshal(self.state_[key]) return self.demarshal(self.state_[key])
def contains(self, key): def contains(self, key):