fix: use == instead of is when comparing with a certain types of literals (#26519)

pull/27438/head
小么小儿郎EL 3 years ago committed by GitHub
parent c21ca4dd30
commit 435d5207ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      examples/python/async_streaming/client.py

@ -66,9 +66,9 @@ class CallMaker:
logging.info("Call toward [%s] enters [%s] state", self._phone_number,
phone_pb2.CallState.State.Name(call_state))
self._call_state = call_state
if call_state is phone_pb2.CallState.State.ACTIVE:
if call_state == phone_pb2.CallState.State.ACTIVE:
self._peer_responded.set()
if call_state is phone_pb2.CallState.State.ENDED:
if call_state == phone_pb2.CallState.State.ENDED:
self._peer_responded.set()
self._call_finished.set()
@ -80,13 +80,13 @@ class CallMaker:
self._consumer_future = self._executor.submit(self._response_watcher,
response_iterator)
def wait_peer(self) -> None:
def wait_peer(self) -> bool:
logging.info("Waiting for peer to connect [%s]...", self._phone_number)
self._peer_responded.wait(timeout=None)
if self._consumer_future.done():
# If the future raises, forwards the exception here
self._consumer_future.result()
return self._call_state is phone_pb2.CallState.State.ACTIVE
return self._call_state == phone_pb2.CallState.State.ACTIVE
def audio_session(self) -> None:
assert self._audio_session_link is not None

Loading…
Cancel
Save