/usr/share/pyshared/cqpid.py is in python-cqpid 0.16-7ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_cqpid', [dirname(__file__)])
except ImportError:
import _cqpid
return _cqpid
if fp is not None:
try:
_mod = imp.load_module('_cqpid', fp, pathname, description)
finally:
fp.close()
return _mod
_cqpid = swig_import_helper()
del swig_import_helper
else:
import _cqpid
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name):
if (name == "thisown"): return self.this.own()
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
raise AttributeError(name)
def _swig_repr(self):
try: strthis = "proxy of " + self.this.__repr__()
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object : pass
_newclass = 0
Empty = _cqpid.NoMessageAvailable
TargetCapacityExceeded = _cqpid.TargetCapacityExceeded
NotFound = _cqpid.NotFound
ConnectError = _cqpid.TransportFailure
class Address(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Address, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Address, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Address(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_Address
__del__ = lambda self : None;
def getName(self): return _cqpid.Address_getName(self)
def setName(self, *args): return _cqpid.Address_setName(self, *args)
def getSubject(self): return _cqpid.Address_getSubject(self)
def setSubject(self, *args): return _cqpid.Address_setSubject(self, *args)
def getOptions(self, *args): return _cqpid.Address_getOptions(self, *args)
def setOptions(self, *args): return _cqpid.Address_setOptions(self, *args)
def getType(self): return _cqpid.Address_getType(self)
def setType(self, *args): return _cqpid.Address_setType(self, *args)
def str(self): return _cqpid.Address_str(self)
def __nonzero__(self):
return _cqpid.Address___nonzero__(self)
__bool__ = __nonzero__
Address_swigregister = _cqpid.Address_swigregister
Address_swigregister(Address)
class Duration(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Duration, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Duration, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Duration(*args)
try: self.this.append(this)
except: self.this = this
def getMilliseconds(self): return _cqpid.Duration_getMilliseconds(self)
__swig_destroy__ = _cqpid.delete_Duration
__del__ = lambda self : None;
Duration_swigregister = _cqpid.Duration_swigregister
Duration_swigregister(Duration)
cvar = _cqpid.cvar
Duration.FOREVER = _cqpid.cvar.Duration_FOREVER
Duration.IMMEDIATE = _cqpid.cvar.Duration_IMMEDIATE
Duration.SECOND = _cqpid.cvar.Duration_SECOND
Duration.MINUTE = _cqpid.cvar.Duration_MINUTE
def __mul__(*args):
return _cqpid.__mul__(*args)
__mul__ = _cqpid.__mul__
def __eq__(*args):
return _cqpid.__eq__(*args)
__eq__ = _cqpid.__eq__
def __ne__(*args):
return _cqpid.__ne__(*args)
__ne__ = _cqpid.__ne__
class Message(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Message, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Message, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Message(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_Message
__del__ = lambda self : None;
def _setReplyTo(self, *args): return _cqpid.Message__setReplyTo(self, *args)
def _getReplyTo(self): return _cqpid.Message__getReplyTo(self)
def setSubject(self, *args): return _cqpid.Message_setSubject(self, *args)
def getSubject(self): return _cqpid.Message_getSubject(self)
def setContentType(self, *args): return _cqpid.Message_setContentType(self, *args)
def getContentType(self): return _cqpid.Message_getContentType(self)
def setMessageId(self, *args): return _cqpid.Message_setMessageId(self, *args)
def getMessageId(self): return _cqpid.Message_getMessageId(self)
def setUserId(self, *args): return _cqpid.Message_setUserId(self, *args)
def getUserId(self): return _cqpid.Message_getUserId(self)
def setCorrelationId(self, *args): return _cqpid.Message_setCorrelationId(self, *args)
def getCorrelationId(self): return _cqpid.Message_getCorrelationId(self)
def setPriority(self, *args): return _cqpid.Message_setPriority(self, *args)
def getPriority(self): return _cqpid.Message_getPriority(self)
def _setTtl(self, *args): return _cqpid.Message__setTtl(self, *args)
def _getTtl(self): return _cqpid.Message__getTtl(self)
def setDurable(self, *args): return _cqpid.Message_setDurable(self, *args)
def getDurable(self): return _cqpid.Message_getDurable(self)
def getRedelivered(self): return _cqpid.Message_getRedelivered(self)
def setRedelivered(self, *args): return _cqpid.Message_setRedelivered(self, *args)
def getProperties(self, *args): return _cqpid.Message_getProperties(self, *args)
def setContent(self, *args): return _cqpid.Message_setContent(self, *args)
def getContent(self): return _cqpid.Message_getContent(self)
def getContentPtr(self): return _cqpid.Message_getContentPtr(self)
def getContentSize(self): return _cqpid.Message_getContentSize(self)
def setProperty(self, *args): return _cqpid.Message_setProperty(self, *args)
# UNSPECIFIED was module level before, but I do not
# know how to insert python code at the top of the module.
# (A bare "%pythoncode" inserts at the end.
UNSPECIFIED=object()
def __init__(self, content=None, content_type=UNSPECIFIED, id=None,
subject=None, user_id=None, reply_to=None,
correlation_id=None, durable=None, priority=None,
ttl=None, properties=None):
this = _cqpid.new_Message('')
try: self.this.append(this)
except: self.this = this
if content :
self.content = content
if content_type != UNSPECIFIED :
self.content_type = content_type
if id is not None :
self.id = id
if subject is not None :
self.subject = subject
if user_id is not None :
self.user_id = user_id
if reply_to is not None :
self.reply_to = reply_to
if correlation_id is not None :
self.correlation_id = correlation_id
if durable is not None :
self.durable = durable
if priority is not None :
self.priority = priority
if ttl is not None :
self.ttl = ttl
if properties is not None :
# Can't set properties via (inst).getProperties, because
# the typemaps make a copy of the underlying properties.
# Instead, set via setProperty for the time-being
for k, v in properties.iteritems() :
self.setProperty(k, v)
def _get_content(self) :
if self.content_type == "amqp/list" :
return decodeList(self)
if self.content_type == "amqp/map" :
return decodeMap(self)
return self.getContent()
def _set_content(self, content) :
if isinstance(content, basestring) :
self.setContent(content)
elif isinstance(content, list) or isinstance(content, dict) :
encode(content, self)
else :
# Not a type we can handle. Try setting it anyway,
# although this will probably lead to a swig error
self.setContent(content)
__swig_getmethods__["content"] = _get_content
__swig_setmethods__["content"] = _set_content
if _newclass: content = property(_get_content, _set_content)
__swig_getmethods__["content_type"] = getContentType
__swig_setmethods__["content_type"] = setContentType
if _newclass: content_type = property(getContentType, setContentType)
__swig_getmethods__["id"] = getMessageId
__swig_setmethods__["id"] = setMessageId
if _newclass: id = property(getMessageId, setMessageId)
__swig_getmethods__["subject"] = getSubject
__swig_setmethods__["subject"] = setSubject
if _newclass: subject = property(getSubject, setSubject)
__swig_getmethods__["priority"] = getPriority
__swig_setmethods__["priority"] = setPriority
if _newclass: priority = property(getPriority, setPriority)
def getTtl(self) :
return self._getTtl().getMilliseconds()/1000.0
def setTtl(self, duration) :
self._setTtl(Duration(int(1000*duration)))
__swig_getmethods__["ttl"] = getTtl
__swig_setmethods__["ttl"] = setTtl
if _newclass: ttl = property(getTtl, setTtl)
__swig_getmethods__["user_id"] = getUserId
__swig_setmethods__["user_id"] = setUserId
if _newclass: user_id = property(getUserId, setUserId)
__swig_getmethods__["correlation_id"] = getCorrelationId
__swig_setmethods__["correlation_id"] = setCorrelationId
if _newclass: correlation_id = property(getCorrelationId, setCorrelationId)
__swig_getmethods__["redelivered"] = getRedelivered
__swig_setmethods__["redelivered"] = setRedelivered
if _newclass: redelivered = property(getRedelivered, setRedelivered)
__swig_getmethods__["durable"] = getDurable
__swig_setmethods__["durable"] = setDurable
if _newclass: durable = property(getDurable, setDurable)
__swig_getmethods__["properties"] = getProperties
if _newclass: properties = property(getProperties)
def getReplyTo(self) :
return self._getReplyTo().str()
def setReplyTo(self, address_str) :
self._setReplyTo(Address(address_str))
__swig_getmethods__["reply_to"] = getReplyTo
__swig_setmethods__["reply_to"] = setReplyTo
if _newclass: reply_to = property(getReplyTo, setReplyTo)
def __repr__(self):
args = []
for name in ["id", "subject", "user_id", "reply_to",
"correlation_id", "priority", "ttl",
"durable", "redelivered", "properties",
"content_type"] :
value = getattr(self, name)
if value : args.append("%s=%r" % (name, value))
if self.content is not None:
if args:
args.append("content=%r" % self.content)
else:
args.append(repr(self.content))
return "Message(%s)" % ", ".join(args)
Message_swigregister = _cqpid.Message_swigregister
Message_swigregister(Message)
class EncodingException(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, EncodingException, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, EncodingException, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_EncodingException(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_EncodingException
__del__ = lambda self : None;
EncodingException_swigregister = _cqpid.EncodingException_swigregister
EncodingException_swigregister(EncodingException)
def decode(*args):
return _cqpid.decode(*args)
decode = _cqpid.decode
def encode(*args):
return _cqpid.encode(*args)
encode = _cqpid.encode
class Receiver(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Receiver, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Receiver, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Receiver(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_Receiver
__del__ = lambda self : None;
def get(self, *args): return _cqpid.Receiver_get(self, *args)
def _fetch(self, *args): return _cqpid.Receiver__fetch(self, *args)
def setCapacity(self, *args): return _cqpid.Receiver_setCapacity(self, *args)
def getCapacity(self): return _cqpid.Receiver_getCapacity(self)
def available(self): return _cqpid.Receiver_available(self)
def unsettled(self): return _cqpid.Receiver_unsettled(self)
def close(self): return _cqpid.Receiver_close(self)
def isClosed(self): return _cqpid.Receiver_isClosed(self)
def getName(self): return _cqpid.Receiver_getName(self)
def getSession(self): return _cqpid.Receiver_getSession(self)
__swig_getmethods__["capacity"] = getCapacity
__swig_setmethods__["capacity"] = setCapacity
if _newclass: capacity = property(getCapacity, setCapacity)
__swig_getmethods__["session"] = getSession
if _newclass: session = property(getSession)
def fetch(self, timeout=None) :
if timeout is None :
return self._fetch()
else :
# Python API uses timeouts in seconds,
# but C++ API uses milliseconds
return self._fetch(Duration(int(1000*timeout)))
Receiver_swigregister = _cqpid.Receiver_swigregister
Receiver_swigregister(Receiver)
class Sender(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Sender, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Sender, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Sender(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_Sender
__del__ = lambda self : None;
def _send(self, *args): return _cqpid.Sender__send(self, *args)
def close(self): return _cqpid.Sender_close(self)
def setCapacity(self, *args): return _cqpid.Sender_setCapacity(self, *args)
def getCapacity(self): return _cqpid.Sender_getCapacity(self)
def unsettled(self): return _cqpid.Sender_unsettled(self)
def available(self): return _cqpid.Sender_available(self)
def getName(self): return _cqpid.Sender_getName(self)
def getSession(self): return _cqpid.Sender_getSession(self)
def send(self, object, sync=True) :
if isinstance(object, Message):
message = object
else:
message = Message(object)
return self._send(message, sync)
__swig_getmethods__["capacity"] = getCapacity
__swig_setmethods__["capacity"] = setCapacity
if _newclass: capacity = property(getCapacity, setCapacity)
__swig_getmethods__["session"] = getSession
if _newclass: session = property(getSession)
Sender_swigregister = _cqpid.Sender_swigregister
Sender_swigregister(Sender)
class Session(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Session, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Session, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Session(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_Session
__del__ = lambda self : None;
def close(self): return _cqpid.Session_close(self)
def commit(self): return _cqpid.Session_commit(self)
def rollback(self): return _cqpid.Session_rollback(self)
def _acknowledge_all(self, sync=False): return _cqpid.Session__acknowledge_all(self, sync)
def _acknowledge_msg(self, *args): return _cqpid.Session__acknowledge_msg(self, *args)
def acknowledge(self, *args): return _cqpid.Session_acknowledge(self, *args)
def acknowledgeUpTo(self, *args): return _cqpid.Session_acknowledgeUpTo(self, *args)
def reject(self, *args): return _cqpid.Session_reject(self, *args)
def release(self, *args): return _cqpid.Session_release(self, *args)
def sync(self, block=True): return _cqpid.Session_sync(self, block)
def getReceivable(self): return _cqpid.Session_getReceivable(self)
def getUnsettledAcks(self): return _cqpid.Session_getUnsettledAcks(self)
def nextReceiver(self, *args): return _cqpid.Session_nextReceiver(self, *args)
def sender(self, *args): return _cqpid.Session_sender(self, *args)
def receiver(self, *args): return _cqpid.Session_receiver(self, *args)
def getSender(self, *args): return _cqpid.Session_getSender(self, *args)
def getReceiver(self, *args): return _cqpid.Session_getReceiver(self, *args)
def getConnection(self): return _cqpid.Session_getConnection(self)
def hasError(self): return _cqpid.Session_hasError(self)
def checkError(self): return _cqpid.Session_checkError(self)
def acknowledge(self, message=None, disposition=None, sync=True) :
if disposition :
raise Exception("SWIG does not support dispositions yet. Use "
"Session.reject and Session.release instead")
if message :
self._acknowledge_msg(message, sync)
else :
self._acknowledge_all(sync)
__swig_getmethods__["connection"] = getConnection
if _newclass: connection = property(getConnection)
Session_swigregister = _cqpid.Session_swigregister
Session_swigregister(Session)
class Connection(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Connection, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Connection, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_Connection(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_Connection
__del__ = lambda self : None;
def setOption(self, *args): return _cqpid.Connection_setOption(self, *args)
def open(self): return _cqpid.Connection_open(self)
def opened(self): return _cqpid.Connection_opened(self)
def isOpen(self): return _cqpid.Connection_isOpen(self)
def close(self): return _cqpid.Connection_close(self)
def createTransactionalSession(self, *args): return _cqpid.Connection_createTransactionalSession(self, *args)
def createSession(self, *args): return _cqpid.Connection_createSession(self, *args)
def getSession(self, *args): return _cqpid.Connection_getSession(self, *args)
def getAuthenticatedUsername(self): return _cqpid.Connection_getAuthenticatedUsername(self)
# Handle the different options by converting underscores to hyphens.
# Also, the sasl_mechanisms option in Python has no direct
# equivalent in C++, so we will translate them to sasl_mechanism
# when possible.
def __init__(self, url=None, **options):
if url:
args = [url]
else:
args = []
if options :
if "sasl_mechanisms" in options :
if ' ' in options.get("sasl_mechanisms",'') :
raise Exception(
"C++ Connection objects are unable to handle "
"multiple sasl-mechanisms")
options["sasl_mechanism"] = options.pop("sasl_mechanisms")
args.append(options)
this = _cqpid.new_Connection(*args)
try: self.this.append(this)
except: self.this = this
def _session(self, *args): return _cqpid.Connection__session(self, *args)
def session(self, name=None, transactional=False) :
if name is None :
name = ''
return self._session(name, transactional)
@staticmethod
def establish(url=None, **options) :
conn = Connection(url, **options)
conn.open()
return conn
Connection_swigregister = _cqpid.Connection_swigregister
Connection_swigregister(Connection)
class FailoverUpdates(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, FailoverUpdates, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, FailoverUpdates, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _cqpid.new_FailoverUpdates(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _cqpid.delete_FailoverUpdates
__del__ = lambda self : None;
FailoverUpdates_swigregister = _cqpid.FailoverUpdates_swigregister
FailoverUpdates_swigregister(FailoverUpdates)
def decodeMap(*args):
return _cqpid.decodeMap(*args)
decodeMap = _cqpid.decodeMap
def decodeList(*args):
return _cqpid.decodeList(*args)
decodeList = _cqpid.decodeList
# Bring into module scope
UNSPECIFIED = Message.UNSPECIFIED
# This file is compatible with both classic and new-style classes.
|