示例#1
0
 def engine_count(self):
     """determine engine count from `engines` dict"""
     count = 0
     for n in itervalues(self.engines):
         if isinstance(n, (tuple, list)):
             n, args = n
         count += n
     return count
示例#2
0
文件: util.py 项目: JuDa-hku/ipython
def validate_url_container(container):
    """validate a potentially nested collection of urls."""
    if isinstance(container, string_types):
        url = container
        return validate_url(url)
    elif isinstance(container, dict):
        container = itervalues(container)

    for element in container:
        validate_url_container(element)
示例#3
0
def validate_url_container(container):
    """validate a potentially nested collection of urls."""
    if isinstance(container, string_types):
        url = container
        return validate_url(url)
    elif isinstance(container, dict):
        container = itervalues(container)
    
    for element in container:
        validate_url_container(element)
示例#4
0
    def _match(self, check):
        """Find all the matches for a check dict."""
        matches = []
        tests = {}
        for k,v in iteritems(check):
            if isinstance(v, dict):
                tests[k] = CompositeFilter(v)
            else:
                tests[k] = lambda o: o==v

        for rec in itervalues(self._records):
            if self._match_one(rec, tests):
                matches.append(copy(rec))
        return matches
示例#5
0
文件: dictdb.py 项目: hack1nt0/CM
    def _match(self, check):
        """Find all the matches for a check dict."""
        matches = []
        tests = {}
        for k, v in iteritems(check):
            if isinstance(v, dict):
                tests[k] = CompositeFilter(v)
            else:
                tests[k] = lambda o: o == v

        for rec in itervalues(self._records):
            if self._match_one(rec, tests):
                matches.append(copy(rec))
        return matches
示例#6
0
 def interrupt_then_kill(self, delay=1.0):
     dlist = []
     for el in itervalues(self.launchers):
         d = el.interrupt_then_kill(delay)
         dlist.append(d)
     return dlist
示例#7
0
 def signal(self, sig):
     dlist = []
     for el in itervalues(self.launchers):
         d = el.signal(sig)
         dlist.append(d)
     return dlist