return a list of `n` random emoji
322008
def emoji_list(server, n=1):
    """"""
    global EMOJI
    if EMOJI is None:
        EMOJI = EmojiCache(server)
    return EMOJI.get(n)
180501
def _n(v):
        
        if v is None:
            return ""

        if isinstance(v, (dict, list)):
            try:
                v = json.dumps(v)
            except Exception:
                pass
        elif six.PY2 and isinstance(v, six.text_type):
            v = v.encode('utf8', "ignore")
        elif six.PY3 and isinstance(v, six.binary_type):
            v = v.decode('utf8', "ignore")

        return str(v)
610658
def stream_n_messages(n):
    
    response = get_dict("url", "args", "headers", "origin")
    n = min(n, 100)

    def generate_stream():
        for i in range(n):
            response["id"] = i
            yield json.dumps(response) + "\n"

    return Response(generate_stream(), headers={"Content-Type": "application/json"})
47932
def _get_random_id():
    
    symbols = string.ascii_uppercase + string.ascii_lowercase + string.digits
    return ''.join(random.choice(symbols) for _ in range(15))
323352
def sample_labels(self, n):
        
        if n >= len(self):
            return self.labels
        sample = random.sample(self.labels, n)
        return set(sample)
1293799
def numList2blocks(l, n):
    """"""
    # Note that ASCII printable characters range is 0x20 - 0x7E
    returnList = []
    toProcess = copy.copy(l)
    ''' copy message ascii list'''
    if len(toProcess) % n != 0:
        for i in range(0, n - len(toProcess) % n):
            ''' append rand str to list'''
            toProcess.append(random.randint(32, 126))
    toProcess[len(l)] = 0  # 0 after origin message list

    ''' generate int from ascii number list'''
    for i in range(0, len(toProcess), n):
        block = 0
        for j in range(0, n):
            block += toProcess[i + j] << (8 * (n - j - 1))
        returnList.append(block)
    return returnList
1113394
def unrank(n, sequence=string.ascii_lowercase):
    
    return list(map(sequence.__getitem__, indexes(n)))
1292452
def floats(self, n: int = 2) -> List[float]:
        
        nums = [self.random.random()
                for _ in range(10 ** int(n))]
        return nums
731031
def random_string(random_length=None):
    
    choices = string.letters + ' '
    text = []
    if not random_length:
        random_length = random.randint(1, 30)
    for x in range(random_length):
        text.append(random.choice(choices))
    return "".join(text)
316764
def random_data(line_count=1, chars_per_line=80):
    
    divide_lines = chars_per_line * line_count
    return '\n'.join(random_line_data(chars_per_line) for x in range(int(divide_lines / chars_per_line)))
1338370
def get_random_label():
    
    return ''.join(random.choice(string.ascii_uppercase + string.digits) \
                   for _ in range(15))
1361795
function _list (str, isOrdered) {
  if (!str) return str;

  var $ = cheerio.load(str);
  var listEl = isOrdered ? 'ol' : 'ul';

  $(listEl).each(function (i, el) {
    var $out = cheerio.load('<p></p>');
    var $el = $(el);

    $el.find('li').each(function (j, li) {
      var tick = isOrdered ? String(j + 1) + '.' : '-';

      $out('p').append(tick + ' ' + _escapeHtml($(li).text()) + '<br />');
    });

    // avoid excess spacing coming off last element
    // (we are wrapping with a <p> anyway)
    $out('br').last().remove();

    $el.replaceWith($out.html());
  });

  return $.html();
}
200209
def emojies_in(text)
      (sad_emojies + happy_emojies).map do |emoji|
        text.scan(emoji)
      end.flatten
    end
1150842
function randomAlpha (n) {
  var alpha = "abcdefghijklmnopqrstuvwxyz";
  var res = "";
  for (var i = 0; i < n; i++) {
    res += alpha.charAt(Math.floor(Math.random() * alpha.length));
  }
  return res;
}
1372929
def cast_to_list(emoticons_list):
    
    emoticons_tuple = []
    for emoticons, image in emoticons_list:
        if isinstance(emoticons, basestring):
            emoticons = [emoticons]
        else:
            emoticons = list(emoticons)
        emoticons_tuple.append((emoticons, image))
    return emoticons_tuple
764062
def query_random(**kwargs):
        '''
        
        '''

        if 'limit' in kwargs:
            limit = kwargs['limit']
        elif 'num' in kwargs:
            limit = kwargs['num']
        else:
            limit = 10

        kind = kwargs.get('kind', None)

        if kind:
            rand_recs = TabPost.select().where(
                (TabPost.kind == kind) &
                (TabPost.valid == 1)
            ).order_by(
                peewee.fn.Random()
            ).limit(limit)
        else:
            rand_recs = TabPost.select().where(
                TabPost.valid == 1
            ).order_by(
                peewee.fn.Random()
            ).limit(limit)
        return rand_recs
769124
def _get_ngrams(n, text):
  
  ngram_set = set()
  text_length = len(text)
  max_index_ngram_start = text_length - n
  for i in range(max_index_ngram_start + 1):
    ngram_set.add(tuple(text[i:i + n]))
  return ngram_set