Exemple #1
0
 def e():
     yield
     results.append(local('_x_'))
     yield
     results.append(local('_y_'))
     yield
     results.append(local('_z_'))
Exemple #2
0
    def testVariousTypes(self):
        strArgument = 'string'
        self.assertEquals('string', local('strArgument'))
        intArgument = 1
        self.assertEquals(1, local('intArgument'))

        class MyObject(object):
            pass
        objArgument = MyObject()
        self.assertEquals(objArgument, local('objArgument'))
Exemple #3
0
 def testOne(self):
     a=1
     b=2
     c=3
     def f1():
         d=4
         a=10
         b=6
         self.assertEquals(4, local('d'))
         self.assertEquals(10, local('a'))
     f1()
     self.assertEquals(2, local('b'))
     self.assertEquals(1, local('a'))
Exemple #4
0
    def testOne(self):
        a = 1
        b = 2
        c = 3

        def f1():
            d = 4
            a = 10
            b = 6
            self.assertEquals(4, local('d'))
            self.assertEquals(10, local('a'))

        f1()
        self.assertEquals(2, local('b'))
        self.assertEquals(1, local('a'))
 def do_unknown(self, message, *args, **kwargs):
     myLogCollector = local("__callstack_var_logCollector__")
     try:
         __callstack_var_logCollector__ = LogCollector._logCollector()
         self.do.unknown(message, *args, **kwargs)
     finally:
         myLogCollector[self._scopeName] = __callstack_var_logCollector__
Exemple #6
0
 def testNotFound(self):
     try:
         v = local('no_such_thing')
         print "V", v
         self.fail()
     except AttributeError:
         pass
 def do_unknown(self, message, *args, **kwargs):
     myLogCollector = local('__callstack_var_logCollector__')
     try:
         __callstack_var_logCollector__ = LogCollector._logCollector()
         self.do.unknown(message, *args, **kwargs)
     finally:
         myLogCollector[self._scopeName] = __callstack_var_logCollector__
 def timeAfterFinished():
     assert local('__reactor__') is reactor()  # Code explaining code :-)
     currentReactor = reactor()
     currentReactor.addTimer(1.0, lambda: neverCalled.append(True))
     yield 'async work...'
     currentReactor.addProcess(lambda: neverCalled.append(True))
     raise StopIteration(42)
Exemple #9
0
 def testNotFound(self):
     try:
         v = local('no_such_thing')
         print "V", v
         self.fail()
     except AttributeError:
         pass
 def timeAfterFinished():
     assert local(
         '__reactor__') is reactor()  # Code explaining code :-)
     currentReactor = reactor()
     currentReactor.addTimer(1.0, lambda: neverCalled.append(True))
     yield 'async work...'
     currentReactor.addProcess(lambda: neverCalled.append(True))
     raise StopIteration(42)
 def all_unknown(self, message, *args, **kwargs):
     try:
         __callstack_dict__ = local('__callstack_dict__')
     except AttributeError:
         __callstack_dict__ = {}
     for key, valueFunction in self._keyValueFunctions.items():
         __callstack_dict__[key] = valueFunction(**kwargs)
     yield self.all.unknown(message, *args, **kwargs)
 def call_unknown(self, message, *args, **kwargs):
     myLogCollector = local("__callstack_var_logCollector__")
     try:
         __callstack_var_logCollector__ = LogCollector._logCollector()
         try:
             return self.call.unknown(message, *args, **kwargs)
         except NoneOfTheObserversRespond:
             raise DeclineMessage
     finally:
         myLogCollector[self._scopeName] = __callstack_var_logCollector__
def callStackDictGet(key, *args, **kwargs):
    try:
        d = local('__callstack_dict__')
        return d[key]
    except (AttributeError, KeyError):
        if args or 'default' in kwargs:
            default = args[0] if args else kwargs['default']
            return default
        else:
            raise
 def call_unknown(self, message, *args, **kwargs):
     myLogCollector = local('__callstack_var_logCollector__')
     try:
         __callstack_var_logCollector__ = LogCollector._logCollector()
         try:
             return self.call.unknown(message, *args, **kwargs)
         except NoneOfTheObserversRespond:
             raise DeclineMessage
     finally:
         myLogCollector[self._scopeName] = __callstack_var_logCollector__
 def any_unknown(self, message, *args, **kwargs):
     myLogCollector = local('__callstack_var_logCollector__')
     try:
         __callstack_var_logCollector__ = LogCollector._logCollector()
         try:
             response = yield self.any.unknown(message, *args, **kwargs)
         except NoneOfTheObserversRespond:
             raise DeclineMessage
         raise StopIteration(response)
     finally:
         myLogCollector[self._scopeName] = __callstack_var_logCollector__
 def any_unknown(self, message, *args, **kwargs):
     myLogCollector = local("__callstack_var_logCollector__")
     try:
         __callstack_var_logCollector__ = LogCollector._logCollector()
         try:
             response = yield self.any.unknown(message, *args, **kwargs)
         except NoneOfTheObserversRespond:
             raise DeclineMessage
         raise StopIteration(response)
     finally:
         myLogCollector[self._scopeName] = __callstack_var_logCollector__
Exemple #17
0
 def testLookupSelfWhileBeingInitialized(self):
     try:
         tx = local('tx')
         self.fail()
     except AttributeError:
         pass
Exemple #18
0
 def addMethod(**kwargs):
     listRequests.append(local('__callstack_var_oaiListRequest__'))
     return
     yield
def collectLog(*logDicts):
    collector=local('__callstack_var_logCollector__')
    for aLogDict in logDicts:
        for key, value in aLogDict.items():
            collector.setdefault(key, []).append(value)
 def f(self):
     v = local("aLocal")
     yield v
Exemple #21
0
 def addMethod(**kwargs):
     listRequests.append(local('__callstack_var_oaiListRequest__'))
     return
     yield
Exemple #22
0
 def f1():
     d=4
     a=10
     b=6
     self.assertEquals(4, local('d'))
     self.assertEquals(10, local('a'))
Exemple #23
0
 def function():
     toplevel=MyObject()
     refs.append(local('toplevel'))
Exemple #24
0
 def __init__(self, timeout):
     self.gio = local('__gio__')
     self._timeout = timeout
     self._timer = None
Exemple #25
0
 def __enter__(self):
     self.gio = local('__gio__')
     self.gio.pushContext(self)
     return self
Exemple #26
0
 def __getattr__(self, name):
     try:
         return local('__callstack_var_%s__' % name)
     except AttributeError:
         raise AttributeError("'%s' has no attribute '%s'" % (self, name))
Exemple #27
0
 def testNone(self):
     var = None
     self.assertEquals(None, local('var'))
 def c():
     yield local('no_such_thing')
Exemple #29
0
 def __init__(self, timeout):
     self.gio = local('__gio__')
     self._timeout = timeout
     self._timer = None
Exemple #30
0
 def log(self, **kwargs):
     try:
         _log(local('__callstack_var_statisticsLog__'), **kwargs)
     except AttributeError:
         pass
Exemple #31
0
 def testLookupSelfWhileBeingInitialized(self):
     try:
         tx = local('tx')
         self.fail()
     except AttributeError:
         pass
Exemple #32
0
 def __getattr__(self, name):
     try:
         return local('__callstack_var_%s__' % name)
     except AttributeError:
         raise AttributeError("'%s' has no attribute '%s'" % (self, name))
Exemple #33
0
 def testScope(self):
     _some_var_on_the_callstack_ = 'aap'
     v = local('_some_var_on_the_callstack_')
     self.assertEquals('aap', v)
Exemple #34
0
 def log(self, **kwargs):
     try:
         _log(local('__callstack_var_statisticsLog__'), **kwargs)
     except AttributeError:
         pass
Exemple #35
0
 def f1():
     d = 4
     a = 10
     b = 6
     self.assertEquals(4, local('d'))
     self.assertEquals(10, local('a'))
Exemple #36
0
 def f(self):
     v = local("aLocal")
     yield v
Exemple #37
0
 def function():
     toplevel = MyObject()
     refs.append(local('toplevel'))
def collectLogForScope(**scopes):
    for scope, aLogDict in scopes.items():
        collector=local('__callstack_var_logCollector__').setdefault(scope, dict())
        for key, value in aLogDict.items():
            collector.setdefault(key, []).append(value)
def collectLog(*logDicts):
    collector = local("__callstack_var_logCollector__")
    for aLogDict in logDicts:
        for key, value in aLogDict.items():
            collector.setdefault(key, []).append(value)
def collectLogForScope(**scopes):
    for scope, aLogDict in scopes.items():
        collector = local("__callstack_var_logCollector__").setdefault(scope, dict())
        for key, value in aLogDict.items():
            collector.setdefault(key, []).append(value)
Exemple #41
0
 def __enter__(self):
     self.gio = local('__gio__')
     self.gio.pushContext(self)
     return self
Exemple #42
0
 def testScope(self):
     _some_var_on_the_callstack_ = 'aap'
     v = local('_some_var_on_the_callstack_')
     self.assertEquals('aap', v)
Exemple #43
0
def reactor():
    return local('__reactor__')
Exemple #44
0
 def b():
     local('no_such_thing')
 def b():
     local('no_such_thing')
Exemple #46
0
 def testNone(self):
     var = None
     self.assertEquals(None, local('var'))
Exemple #47
0
 def c():
     yield local('no_such_thing')
Exemple #48
0
def reactor():
    return local('__reactor__')
Exemple #49
0
 def h():
     tx_id = local("tx_id")  #2
     print tx_id