Input:  either a list, or a string of comma-separated tags.

    Output: If i is a list, it's returned.
            If i is a string, the list of tags it represents is returned 
            (each tag is stripped of leading and trailing whitespace).
16595
def convert_str_tags_to_list(i):
    

    r=[]

    if type(i)==list:
       r=i
    else:
       ii=i.split(',')
       for q in ii:
           q=q.strip()
           if q!='':
              r.append(q)

    return r
837137
def string(s):
    ''''''
    @Parser
    def string_parser(text, index=0):
        slen, tlen = len(s), len(text)
        if text[index:index + slen] == s:
            return Value.success(index + slen, s)
        else:
            matched = 0
            while matched < slen and index + matched < tlen and text[index + matched] == s[matched]:
                matched = matched + 1
            return Value.failure(index + matched, s)
    return string_parser
469089
def ok_tags(tags: dict) -> bool:
        

        if not tags:
            return True
        depth = 0
        queue = [(i, depth+1) for i in tags.values() if isinstance(i, dict)]
        max_depth = 0
        while queue and max_depth < 2:
            sub, depth = queue.pop()
            max_depth = max(max_depth, depth)
            queue = queue + [(i, depth+1) for i in sub.values() if isinstance(i, dict)]

        return max_depth < 2 and all(isinstance(k, str) and isinstance(tags[k], str) for k in tags)
1360573
@Override
    public String[] tag(List<String> wordList)
    {
        String[] termArray = new String[wordList.size()];
        wordList.toArray(termArray);
        return tag(termArray);
    }
174410
def make_html_list(items, tag="ul"):
    # type: (Iterable[Any], str) -> str
    
    html_list = "\n".join(
        '<li><a href="{0}">{0}</a></li>'.format(item) for item in items
    )
    return "<{0}>\n{1}\n</{0}>".format(tag, html_list)
1090033
def _get_tokens_and_tags(parse_str):
  """"""
  tokens = []
  parse_split = parse_str.split(' ')
  for p in parse_split:
    assert p.startswith('(') or p.endswith(')')
    if p.endswith(')'):
      token = p.replace(')', '')
      tokens.append(token)

  return tokens
1298006
def _parse_common(tag):
    
    if "modifiers" in tag.attrib:
        modifiers = re.split(",\s*", tag.attrib["modifiers"].strip())
        if "" in modifiers:
            modifiers.remove("")
    else:
        modifiers = None

    if "name" in tag.attrib:
        name = tag.attrib["name"]
    if "type" in tag.attrib:
        dtype = tag.attrib["type"]
    else:
        dtype = None
    if "kind" in tag.attrib:
        kind = tag.attrib["kind"]
    else:
        kind = None

    return (name, modifiers, dtype, kind)
576216
function() {
      var data = this.parsed;
      var piece = data[data.length - 1],
        len = piece.length;
      return piece[len - 1] || (piece[len - 1] = {
        tag: "*"
      });
    }
421376
def comma_list(cls, string):
        ''''''
        items = string.split(',')
        items = list([item.strip() for item in items])
        return items
373602
def aslist(obj, sep=None, strip=True):
    
    if isinstance(obj, (basestring)):
        lst = obj.split(sep)
        if strip:
            lst = [v.strip() for v in lst]
        return lst
    elif isinstance(obj, (list, tuple)):
        return obj
    elif obj is None:
        return []
    else:
        return [obj]
251568
def quoted_or_list(items):
    # type: (List[str]) -> str
    """"""
    selected = items[:MAX_LENGTH]
    quoted_items = ('"{}"'.format(t) for t in selected)

    def quoted_or_text(text, quoted_and_index):
        index = quoted_and_index[0]
        quoted_item = quoted_and_index[1]
        text += (
            (", " if len(selected) > 2 and not index == len(selected) - 1 else " ")
            + ("or " if index == len(selected) - 1 else "")
            + quoted_item
        )
        return text

    enumerated_items = enumerate(quoted_items)
    first_item = next(enumerated_items)[1]
    return functools.reduce(quoted_or_text, enumerated_items, first_item)
431793
def tag_list=(names)
      self.tags = names.split(",").map do |n|
        SimpleTags::Tag.where(name: n.strip).first_or_create!
      end
    end
828630
def SplitTag(self, tag):
      
      idx = tag.find(NS_SEP)
      if idx >= 0:
         return tag[:idx], tag[idx + 1:]
      else:
         return "", tag
1357556
def parse_list(text, off=0, trim=True):
    '''
    
    '''

    if not nextchar(text, off, '('):
        raise s_exc.BadSyntax(at=off, mesg='expected open paren for list')

    off += 1

    valus = []
    while off < len(text):

        _, off = nom(text, off, whites)

        valu, off = parse_valu(text, off)

        _, off = nom(text, off, whites)

        # check for foo=bar kw tuple syntax
        if nextchar(text, off, '='):

            _, off = nom(text, off + 1, whites)

            vval, off = parse_valu(text, off)

            _, off = nom(text, off, whites)

            valu = (valu, vval)

        valus.append(valu)

        _, off = nom_whitespace(text, off)

        if nextchar(text, off, ')'):
            return valus, off + 1

        if not nextchar(text, off, ','):
            raise s_exc.BadSyntax(at=off, text=text, mesg='expected comma in list')

        off += 1

    raise s_exc.BadSyntax(at=off, mesg='unexpected and of text during list')
1215593
function (tagName, tokens, i) {
            // if a tagName is provided, use that
            if (tagName) {
                return tagName;
            } else {
                // otherwise go searching for the next two tokens like "<",TAG
                while (i < tokens.length) {
                    if (tokens[i] == "<" && reverseTagMap[tokens[i + 1]]) {
                        return reverseTagMap[tokens[i + 1]];
                    }
                    i++;
                }
            }
            return '';
        }
988719
def _find_any_text(self, tag):
        
        text = ''
        if tag is not None:
            text = six.text_type(tag)
            text = re.sub(r'(<[^>]+>)', '', text)
            text = re.sub(r'\s', ' ', text)
            text = text.strip()
        return text
913312
def comma_choice_list(cls, string):
        ''''''
        items = string.split(',')
        items = CommaChoiceListArgs([item.strip() for item in items])
        return items