Repository: qpid-proton Updated Branches: refs/heads/kgiusti-python3 8c3902e69 -> 903c72469
PROTON-490: Revert "PROTON-490: futurize proton-c/bindings" This reverts commit 81085e348ce15c088a82a117e4892c760a57b9fe. Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a977f933 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a977f933 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a977f933 Branch: refs/heads/kgiusti-python3 Commit: a977f933d91e08bbc321a4d7f9fd3bdb8dade63e Parents: 8c3902e Author: Ken Giusti <[email protected]> Authored: Wed Apr 22 09:27:46 2015 -0400 Committer: Ken Giusti <[email protected]> Committed: Wed Apr 22 09:27:46 2015 -0400 ---------------------------------------------------------------------- proton-c/bindings/python/proton/__init__.py | 33 ++++++++++++------------ proton-c/bindings/python/proton/reactor.py | 11 ++++---- proton-c/bindings/python/proton/utils.py | 2 +- 3 files changed, 22 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a977f933/proton-c/bindings/python/proton/__init__.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index cf73a53..8a9d857 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -29,10 +29,9 @@ The proton APIs consist of the following classes: data. """ -from __future__ import absolute_import from cproton import * -from .wrapper import Wrapper +from wrapper import Wrapper import weakref, socket, sys, threading try: @@ -832,19 +831,19 @@ class Message(object): props = Data(pn_message_properties(self._msg)) body = Data(pn_message_body(self._msg)) - if next(inst): + if inst.next(): self.instructions = inst.get_object() else: self.instructions = None - if next(ann): + if ann.next(): self.annotations = ann.get_object() else: self.annotations = None - if next(props): + if props.next(): self.properties = props.get_object() else: self.properties = None - if next(body): + if body.next(): self.body = body.get_object() else: self.body = None @@ -2050,9 +2049,9 @@ class Data: if self.enter(): try: result = {} - while next(self): + while self.next(): k = self.get_object() - if next(self): + if self.next(): v = self.get_object() else: v = None @@ -2074,7 +2073,7 @@ class Data: if self.enter(): try: result = [] - while next(self): + while self.next(): result.append(self.get_object()) finally: self.exit() @@ -2083,9 +2082,9 @@ class Data: def get_py_described(self): if self.enter(): try: - next(self) + self.next() descriptor = self.get_object() - next(self) + self.next() value = self.get_object() finally: self.exit() @@ -2112,12 +2111,12 @@ class Data: if self.enter(): try: if described: - next(self) + self.next() descriptor = self.get_object() else: descriptor = UNDESCRIBED elements = [] - while next(self): + while self.next(): elements.append(self.get_object()) finally: self.exit() @@ -2226,7 +2225,7 @@ class Endpoint(object): assert False, "Subclass must override this!" def _get_handler(self): - from . import reactor + import reactor ractor = reactor.Reactor.wrap(pn_object_reactor(self._impl)) if ractor: on_error = ractor.on_error @@ -2236,7 +2235,7 @@ class Endpoint(object): return WrappedHandler.wrap(pn_record_get_handler(record), on_error) def _set_handler(self, handler): - from . import reactor + import reactor ractor = reactor.Reactor.wrap(pn_object_reactor(self._impl)) if ractor: on_error = ractor.on_error @@ -2292,7 +2291,7 @@ def dat2obj(dimpl): if dimpl: d = Data(dimpl) d.rewind() - next(d) + d.next() obj = d.get_object() d.rewind() return obj @@ -2884,7 +2883,7 @@ class Sender(Link): yield str(count) count += 1 self.tag_generator = simple_tags() - return next(self.tag_generator) + return self.tag_generator.next() class Receiver(Link): """ http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a977f933/proton-c/bindings/python/proton/reactor.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/reactor.py b/proton-c/bindings/python/proton/reactor.py index 03d8af3..467bb76 100644 --- a/proton-c/bindings/python/proton/reactor.py +++ b/proton-c/bindings/python/proton/reactor.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -29,7 +28,7 @@ from proton import unicode2utf8, utf82unicode import traceback from proton import WrappedHandler, _chandler, secs2millis, millis2secs, timeout2millis, millis2timeout, Selectable -from .wrapper import Wrapper, PYCTX +from wrapper import Wrapper, PYCTX from cproton import * class Task(Wrapper): @@ -480,7 +479,7 @@ class Connector(Handler): self.ssl_domain = None def _connect(self, connection): - url = next(self.address) + url = self.address.next() # IoHandler uses the hostname to determine where to try to connect to connection.hostname = "%s:%i" % (url.host, url.port) logging.info("connecting to %s..." % connection.hostname) @@ -515,7 +514,7 @@ class Connector(Handler): if self.connection and self.connection.state & Endpoint.LOCAL_ACTIVE: if self.reconnect: event.transport.unbind() - delay = next(self.reconnect) + delay = self.reconnect.next() if delay == 0: logging.info("Disconnected, reconnecting...") self._connect(self.connection) @@ -561,10 +560,10 @@ class Urls(object): def next(self): try: - return next(self.i) + return self.i.next() except StopIteration: self.i = iter(self.values) - return next(self.i) + return self.i.next() class SSLConfig(object): def __init__(self): http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a977f933/proton-c/bindings/python/proton/utils.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/utils.py b/proton-c/bindings/python/proton/utils.py index cb65fda..b5ecdf7 100644 --- a/proton-c/bindings/python/proton/utils.py +++ b/proton-c/bindings/python/proton/utils.py @@ -312,7 +312,7 @@ class SyncRequestResponse(IncomingMessageHandler): if not self.address and not request.address: raise ValueError("Request message has no address: %s" % request) request.reply_to = self.reply_to - request.correlation_id = correlation_id = next(self.correlation_id) + request.correlation_id = correlation_id = self.correlation_id.next() self.sender.send(request) def wakeup(): return self.response and (self.response.correlation_id == correlation_id) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
