/usr/lib/python2.7/dist-packages/pyvows/async_topic.py is in python-pyvows 2.0.6-2.
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 | # -*- coding: utf-8 -*-
'''Implementation for `Vows.async_topic` decorator. (See `core`
module).
'''
# pyVows testing engine
# https://github.com/heynemann/pyvows
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com
import sys
#-------------------------------------------------------------------------------------------------
class VowsAsyncTopic(object):
# FIXME: Add Docstring
def __init__(self, func, args, kw):
self.func = func
self.args = args
self.kw = kw
def __call__(self, callback):
args = (self.args[0], callback,) + self.args[1:]
try:
self.func(*args, **self.kw)
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
callback(exc_type, exc_value, exc_traceback)
class VowsAsyncTopicValue(object):
# FIXME: Add Docstring
def __init__(self, args, kw):
self.args = args
self.kw = kw
self.error = None
if len(self.args) >= 1 and isinstance(self.args[0], Exception):
self.error = self.args
def __getitem__(self, attr):
if type(attr) is int:
return self.args[attr]
if attr in self.kw:
return self.kw[attr]
raise AttributeError
def __getattr__(self, attr):
if attr in self.kw:
return self.kw[attr]
if hasattr(self, attr):
return self.attr
raise AttributeError
|