예제 #1
0
 def __init__(self, proxy_context, local_context):
     '''proxy_context and remote_context may be dragonfly.Context
        subclasses or callables.'''
     assert (hasattr(proxy_context, 'matches')
             or hasattr(proxy_context, '__call__'))
     assert (hasattr(local_context, 'matches')
             or hasattr(local_context, '__call__'))
     self._proxy_context = proxy_context
     self._local_context = local_context
     Context.__init__(self)
예제 #2
0
 def __init__(self, proxy_context, local_context):
     '''proxy_context and remote_context may be dragonfly.Context
        subclasses or callables.'''
     assert(hasattr(proxy_context, 'matches') or
            hasattr(proxy_context, '__call__'))
     assert(hasattr(local_context, 'matches') or
            hasattr(local_context, '__call__'))
     self._proxy_context = proxy_context
     self._local_context = local_context
     Context.__init__(self)
예제 #3
0
파일: context.py 프로젝트: mrob95/MR-caster
 def __init__(self, match=None):
     Context.__init__(self)
     self.chrome_context = AppContext("chrome")
     if isinstance(match, string_types):
         self._matches = [match.lower()]
     elif isinstance(match, (list, tuple)):
         self._matches = [m.lower() for m in match]
     elif match is None:
         self._matches = None
     else:
         raise TypeError("match argument must be a string or None;"
                         " received %r" % match)
예제 #4
0
 def setUp(self):
     self.context_yes = Context()
     self.context_no = AppContext("never")
예제 #5
0
 def __init__(self, name, enabled=False):
     Context.__init__(self)
     self._enabled = enabled
     self.name = name
     self._str = name