Selects and returns one of the patterns in the list.
422103
def function(self,p):
        """"""
        int_index=int(len(p.generators)*wrap(0,1.0,p.index))
        pg=p.generators[int_index]

        image_array = pg(xdensity=p.xdensity,ydensity=p.ydensity,bounds=p.bounds,
                         x=p.x+p.size*(pg.x*np.cos(p.orientation)-pg.y*np.sin(p.orientation)),
                         y=p.y+p.size*(pg.x*np.sin(p.orientation)+pg.y*np.cos(p.orientation)),
                         orientation=pg.orientation+p.orientation,size=pg.size*p.size,
                         scale=pg.scale*p.scale,offset=pg.offset+p.offset)

        return image_array
894292
def get(self, select):
        
        if is_list(select):
            return [(d[s] for s in select) for d in self.data]
        else:
            return [d[select] for d in self.data]
479058
def pattern(head, *args, mode=1, wc_name=None, conditions=None, **kwargs) \
        -> Pattern:
    """'
    """
    if len(args) == 0:
        args = None
    if len(kwargs) == 0:
        kwargs = None
    return Pattern(head, args, kwargs, mode=mode, wc_name=wc_name,
                   conditions=conditions)
1086307
def _filter_by_pattern(self, pattern):
        """"""
        try:
            _len = len(pattern)
        except TypeError:
            raise TypeError("pattern is not a list of Booleans. Got {}".format(
                type(pattern)))
        _filt_values = [d for i, d in enumerate(self._values) if pattern[i % _len]]
        _filt_datetimes = [d for i, d in enumerate(self.datetimes) if pattern[i % _len]]
        return _filt_values, _filt_datetimes
493951
function PatternGroup(patterns) {

    this._pattern = l.map(patterns, function(expr) {
        return Pattern.toPattern(expr);
    });

}
1213609
function find(list, match) {
	  for (var i = 0; i < list.length; i++) {
	    if (match(list[i])) {
	      return list[i];
	    }
	  }
	  return undefined;
	}
881195
def select(self, html, stype, expression):
        """"""
        etree = html5lib.parse(html,
                               treebuilder='lxml',
                               namespaceHTMLElements=False)
        if stype == 'css':
            selector = lxml.cssselect.CSSSelector(expression)
            frag = list(selector(etree))
        else:
            frag = etree.xpath(expression)
        if not frag:
            raise RuntimeError("Nothing found for: %s" % expression)
        return "".join([lxml.etree.tostring(x) for x in frag])
1155785
def make_pattern_list(patterns):
    """"""
    pattstrs = []
    for desc, patts in patterns:
        # ";," not allowed in descriptions or patterns
        patts = [p.replace(";", "").replace(",", "") for p in patts]
        desc = desc.replace(";", "").replace(",", "")
        pattstrs.append("%s=%s" % (desc, ','.join(patts)))
    return ";".join(pattstrs)
506655
def choose_one(things):
    """"""
    choice = SystemRandom().randint(0, len(things) - 1)
    return things[choice].strip()
200055
function getPattern(type_, limit) {
      if (!type_) return;
      if (isUdf(limit)) limit = true;
      if (contains(['all', 'list'], type_)) return keys(patterns);
      if (!has(patterns, type_)) return UDF;
      var pattern = patterns[type_];
      return limit ? new RegExp('^(' + pattern.source.replace(/^(\^|\$)$/mg, '') + ')$') : pattern;
    }
890976
def select_one(self, tag):
        """"""

        tags = self.select(tag, limit=1)
        return tags[0] if tags else None
231074
private MatchManyWrapper findMatchManyWrapper(PatternWrapper pattern)
  {
    MatchManyWrapper wrapper = null;
    if (matchManyChildren != null)
    {
      // Iterate over the matchManyChildren
      Iterator iter = matchManyChildren.iterator();

      while(iter.hasNext())
      {
        MatchManyWrapper nextElement = (MatchManyWrapper) iter.next();
        PatternWrapper nextPattern = nextElement.pattern;
        if(nextPattern.equals(pattern))
        {
          // We're done, we've found the matching pattern
          wrapper = nextElement;
          break;
        }
      } // eof while more children in the list
    }
    return wrapper;
  }
397083
def search(self, string, default=None):
        """"""
        default = default if default else []
        result = [item[1] for item in self.container if item[0].search(string)]
        if self.ensure_mapping:
            assert len(result) < 2, "%s matches more than one pattern: %s" % (
                string,
                result,
            )
        return result if result else default
523177
List<Node> get(final Pattern... patterns)
   {
      return AbsoluteGetQuery.INSTANCE.execute(this, includeRootPatternFirst(patterns));
   }
1298370
def fnmatches(entry, *pattern_list):
    

    for pattern in pattern_list:
        if pattern and fnmatch(entry, pattern):
            return True
    return False
555904
def sort_pattern(self):
        """"""
        if not self._sort_pattern:

            # trigger evaluation of operation
            if self.operation in ['query', 'getmore']:
                self._sort_pattern = self._find_pattern('orderby: ')

        return self._sort_pattern
1299144
def select(self, cols, mode='list'):
        
        if isinstance(cols, stringtypes):
            cols = _split_cols(cols)
        if not cols:
            cols = [f.name for f in self.fields]
        return select_rows(cols, self, mode=mode)