make iterators python3-compatible

pull/5653/head
Leifur Halldor Asgeirsson 9 years ago
parent 7978747198
commit efdefce3a7
  1. 5
      src/python/grpcio/grpc/_adapter/_types.py
  2. 5
      src/python/grpcio/grpc/framework/alpha/interfaces.py
  3. 5
      src/python/grpcio/grpc/framework/crust/_control.py
  4. 5
      src/python/grpcio/grpc/framework/face/_control.py
  5. 5
      src/python/grpcio/grpc/framework/face/interfaces.py
  6. 5
      src/python/grpcio/grpc/framework/foundation/stream_util.py
  7. 5
      src/python/grpcio/tests/interop/methods.py
  8. 5
      src/python/grpcio/tests/unit/beta/_beta_features_test.py
  9. 5
      src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py
  10. 3
      src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -262,6 +262,9 @@ class CompletionQueue:
"""
return self
def __next__(self):
return self.next()
@abc.abstractmethod
def next(self, deadline=float('+inf')):
"""Get the next event on this completion queue.

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -68,6 +68,9 @@ class CancellableIterator(object):
"""Returns the self object in accordance with the Iterator protocol."""
raise NotImplementedError()
def __next__(self):
return self.next()
@abc.abstractmethod
def next(self):
"""Returns a value or raises StopIteration per the Iterator protocol."""

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -405,6 +405,9 @@ class Rendezvous(base.Operator, future.Future, stream.Consumer, face.Call):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while True:

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -120,6 +120,9 @@ class Rendezvous(stream.Consumer):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while ((self._abortion is None) and

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -61,6 +61,9 @@ class CancellableIterator(object):
"""Returns the self object in accordance with the Iterator protocol."""
raise NotImplementedError()
def __next__(self):
return self.next()
@abc.abstractmethod
def next(self):
"""Returns a value or raises StopIteration per the Iterator protocol."""

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -83,6 +83,9 @@ class IterableConsumer(stream.Consumer):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while self._active and not self._values:

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -173,6 +173,9 @@ class _Pipe(object):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while not self._values and self._open:

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -125,6 +125,9 @@ class _BlockingIterator(object):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while True:

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -66,6 +66,9 @@ class _PauseableIterator(object):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while self._paused:

@ -67,6 +67,9 @@ class _PauseableIterator(object):
def __iter__(self):
return self
def __next__(self):
return self.next()
def next(self):
with self._condition:
while self._paused:

Loading…
Cancel
Save