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)
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)
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)
def setUp(self): self.context_yes = Context() self.context_no = AppContext("never")
def __init__(self, name, enabled=False): Context.__init__(self) self._enabled = enabled self.name = name self._str = name