Skip to content

Commit

Permalink
Add assertion to aid type checking.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 567950912
  • Loading branch information
DeepMind authored and copybara-github committed Sep 25, 2023
1 parent d2a31e8 commit 2286ab0
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def __init__(
self._grpc_port = _pick_emulator_grpc_port()

self._channel = None
self._emulator_stub = None
self._emulator_stub: emulator_controller_pb2_grpc.EmulatorControllerStub | None = (
None
)
self._snapshot_stub = None
# Set the image format to RGBA. The width and height of the returned
# screenshots will use the device's width and height.
Expand Down Expand Up @@ -272,6 +274,7 @@ def load_state(
* If an error occurred during the snapshot loading process, the status
will be `ERROR` and the `error_message` field will be filled.
"""
assert self._snapshot_stub is not None
snapshot_name = request.args.get('snapshot_name', _DEFAULT_SNAPSHOT_NAME)
snapshot_list = self._snapshot_stub.ListSnapshots(
snapshot_service_pb2.SnapshotFilter(
Expand Down Expand Up @@ -317,6 +320,7 @@ def save_state(
* If an error occurred during the snapshot saving process, the status
will be `ERROR` and the `error_message` field will be filled.
"""
assert self._snapshot_stub is not None
snapshot_name = request.args.get('snapshot_name', _DEFAULT_SNAPSHOT_NAME)
snapshot_result = self._snapshot_stub.SaveSnapshot(
snapshot_service_pb2.SnapshotPackage(snapshot_id=snapshot_name)
Expand Down

0 comments on commit 2286ab0

Please sign in to comment.