Fix minor pep8 errors
This commit is contained in:
parent
c5bfa24e29
commit
bc8ef1b0eb
@ -65,7 +65,7 @@ class SocketConnection(pyngus.ConnectionEventHandler):
|
||||
|
||||
@property
|
||||
def closed(self):
|
||||
return self.connection == None or self.connection.closed
|
||||
return self.connection is None or self.connection.closed
|
||||
|
||||
def fileno(self):
|
||||
"""Allows use of a SocketConnection in a select() call."""
|
||||
|
@ -29,6 +29,7 @@ import pyngus
|
||||
|
||||
LOG = logging.getLogger()
|
||||
|
||||
|
||||
def get_host_port(server_address):
|
||||
"""Parse the hostname and port out of the server_address."""
|
||||
regex = re.compile(r"^amqp://([a-zA-Z0-9.]+)(:([\d]+))?$")
|
||||
|
@ -23,7 +23,6 @@ __all__ = [
|
||||
import heapq
|
||||
import logging
|
||||
import proton
|
||||
import time
|
||||
import warnings
|
||||
|
||||
from pyngus.endpoint import Endpoint
|
||||
@ -35,6 +34,7 @@ LOG = logging.getLogger(__name__)
|
||||
_PROTON_VERSION = (int(getattr(proton, "VERSION_MAJOR", 0)),
|
||||
int(getattr(proton, "VERSION_MINOR", 0)))
|
||||
|
||||
|
||||
class _CallbackLock(object):
|
||||
"""A utility class for detecting when a callback invokes a non-reentrant
|
||||
Pyngus method.
|
||||
@ -54,6 +54,7 @@ class _CallbackLock(object):
|
||||
# propagate the exception to the caller
|
||||
return False
|
||||
|
||||
|
||||
class ConnectionEventHandler(object):
|
||||
"""An implementation of an AMQP 1.0 Connection."""
|
||||
def connection_active(self, connection):
|
||||
|
@ -42,7 +42,8 @@ _snd_settle_modes = {"settled": proton.Link.SND_SETTLED,
|
||||
_rcv_settle_modes = {"first": proton.Link.RCV_FIRST,
|
||||
"second": proton.Link.RCV_SECOND}
|
||||
|
||||
#TODO(kgiusti): this is duplicated in connection.py, put in common file
|
||||
|
||||
# TODO(kgiusti): this is duplicated in connection.py, put in common file
|
||||
class _CallbackLock(object):
|
||||
"""A utility class for detecting when a callback invokes a non-reentrant
|
||||
Pyngus method.
|
||||
@ -66,6 +67,7 @@ class _CallbackLock(object):
|
||||
# propagate the exception to the caller
|
||||
return False
|
||||
|
||||
|
||||
def _not_reentrant(func):
|
||||
"""Decorator that prevents callbacks from calling into link methods that
|
||||
are not reentrant """
|
||||
@ -77,6 +79,7 @@ def _not_reentrant(func):
|
||||
return func(*args, **kws)
|
||||
return wrap
|
||||
|
||||
|
||||
class _Link(Endpoint):
|
||||
"""A generic Link base class."""
|
||||
|
||||
|
@ -107,6 +107,7 @@ def _validate_conn_callback(connection):
|
||||
assert connection._callback_lock.in_callback, \
|
||||
connection._callback_lock.in_callback
|
||||
|
||||
|
||||
def _validate_link_callback(link):
|
||||
"""Callbacks must only occur when holding the Link callback lock."""
|
||||
assert link._callback_lock.in_callback, link._callback_lock.in_callback
|
||||
|
@ -763,4 +763,3 @@ class APITest(common.Test):
|
||||
assert False, "RuntimeError expected!"
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user