You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2023/04/10 16:17:41 UTC
[qpid-python] branch main updated: QPID-8632: use absolute, full imports when dealing with circular imports (#7)
This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git
The following commit(s) were added to refs/heads/main by this push:
new f28a657 QPID-8632: use absolute, full imports when dealing with circular imports (#7)
f28a657 is described below
commit f28a657a1a9201cd628b5225a131751beffb2cd7
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Mon Apr 10 18:17:35 2023 +0200
QPID-8632: use absolute, full imports when dealing with circular imports (#7)
This patch leaves the circular import in place, but changes the importing code to make it overall safer.
---
mllib/dom.py | 4 ++--
mllib/transforms.py | 6 +++---
qpid/connection.py | 6 +++---
qpid/delegates.py | 11 ++++++-----
4 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/mllib/dom.py b/mllib/dom.py
index 486f708..1d2cb5e 100644
--- a/mllib/dom.py
+++ b/mllib/dom.py
@@ -25,7 +25,7 @@ from __future__ import division
from __future__ import generators
from __future__ import nested_scopes
-import transforms
+import mllib.transforms
class Container:
@@ -109,7 +109,7 @@ class Node(Container, Component, Dispatcher):
return nd
def text(self):
- return self.dispatch(transforms.Text())
+ return self.dispatch(mllib.transforms.Text())
def tag(self, name, *attrs, **kwargs):
t = Tag(name, *attrs, **kwargs)
diff --git a/mllib/transforms.py b/mllib/transforms.py
index 69d9912..dc258cc 100644
--- a/mllib/transforms.py
+++ b/mllib/transforms.py
@@ -21,7 +21,7 @@
Useful transforms for dom objects.
"""
-import dom
+import mllib.dom
from cStringIO import StringIO
class Visitor:
@@ -45,12 +45,12 @@ class Identity:
return result
def default(self, tag):
- result = dom.Tag(tag.name, *tag.attrs)
+ result = mllib.dom.Tag(tag.name, *tag.attrs)
result.extend(self.descend(tag))
return result
def tree(self, tree):
- result = dom.Tree()
+ result = mllib.dom.Tree()
result.extend(self.descend(tree))
return result
diff --git a/qpid/connection.py b/qpid/connection.py
index 2453f38..2ab870b 100644
--- a/qpid/connection.py
+++ b/qpid/connection.py
@@ -26,7 +26,7 @@ from session import Session
from generator import control_invoker
from exceptions import *
from logging import getLogger
-import delegates, socket
+import qpid.delegates, socket
import sys
class ChannelBusy(Exception): pass
@@ -38,10 +38,10 @@ class SessionBusy(Exception): pass
class ConnectionFailed(Exception): pass
def client(*args, **kwargs):
- return delegates.Client(*args, **kwargs)
+ return qpid.delegates.Client(*args, **kwargs)
def server(*args, **kwargs):
- return delegates.Server(*args, **kwargs)
+ return qpid.delegates.Server(*args, **kwargs)
from framer import Framer
diff --git a/qpid/delegates.py b/qpid/delegates.py
index ae7ed7f..9018351 100644
--- a/qpid/delegates.py
+++ b/qpid/delegates.py
@@ -17,7 +17,8 @@
# under the License.
#
-import os, connection, session
+import os, session
+import qpid.connection
from util import notify, get_client_properties_with_defaults
from datatypes import RangedSet
from exceptions import VersionError, Closed
@@ -37,7 +38,7 @@ class Delegate:
def received(self, op):
ssn = self.connection.attached.get(op.channel)
if ssn is None:
- ch = connection.Channel(self.connection, op.channel)
+ ch = qpid.connection.Channel(self.connection, op.channel)
else:
ch = ssn.channel
@@ -66,9 +67,9 @@ class Delegate:
try:
self.connection.attach(a.name, ch, self.delegate, a.force)
ch.session_attached(a.name)
- except connection.ChannelBusy:
+ except qpid.connection.ChannelBusy:
ch.session_detached(a.name)
- except connection.SessionBusy:
+ except qpid.connection.SessionBusy:
ch.session_detached(a.name)
def session_attached(self, ch, a):
@@ -122,7 +123,7 @@ class Server(Delegate):
self.connection.read_header()
# XXX
self.connection.write_header(0, 10)
- connection.Channel(self.connection, 0).connection_start(mechanisms=["ANONYMOUS"])
+ qpid.connection.Channel(self.connection, 0).connection_start(mechanisms=["ANONYMOUS"])
def connection_start_ok(self, ch, start_ok):
ch.connection_tune(channel_max=65535)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org