term_list : term_list COMMA term
                     | term
                     | empty
197286
def p_term_list(self, p):
        ''''''
        if p[1] is None:
            p[0] = []
        elif len(p) == 4:
            p[1].append(p[3])
            p[0] = p[1]
        elif len(p) == 2:
            p[0] = [p[1]]
646714
def clean(self: 'TSelf', *, atol: float=1e-9) -> 'TSelf':
        """"""
        negligible = [v for v, c in self._terms.items() if abs(c) <= atol]
        for v in negligible:
            del self._terms[v]
        return self
375720
def parseSearchTerm(term):
    
    terms = []
    keywords = {}
    for word in term.split():
        if word.count(':') == 1:
            k, v = word.split(u':')
            if k and v:
                keywords[k] = v
            elif k or v:
                terms.append(k or v)
        else:
            terms.append(word)
    term = u' '.join(terms)
    if keywords:
        return term, keywords
    return term, None
875698
def p_list_terminator(p):
    ''''''
    if p[1] == ';':
        p[0] = ast.node(kind='operator', op=';', pos=p.lexspan(1))
1257141
def term_regex(term):
    
    return re.compile(r'^{0}$'.format(re.escape(term)), re.IGNORECASE)
913312
def comma_choice_list(cls, string):
        ''''''
        items = string.split(',')
        items = CommaChoiceListArgs([item.strip() for item in items])
        return items
282486
def _render_list(self, items, empty='<pre>&lt;empty&gt;</pre>'):
    
    if not items or len(items) == 0:
      self._segments.append(empty)
      return
    self._segments.append('<ul>')
    for o in items:
      self._segments.append('<li>')
      self._segments.append(str(o))
      self._segments.append('</li>')
    self._segments.append('</ul>')
1148170
function(item, term) {
            var numContextWords = 2;
            var text = item.content.match(
                "(?:\\s?(?:[\\w]+)\\s?){0,"+numContextWords+"}" +
                    term+"(?:\\s?(?:[\\w]+)\\s?){0,"+numContextWords+"}");
            item.context = text;
            return '<div class="autocomplete-suggestion" ' +
                'data-term="' + term + '" ' +
                'data-title="' + item.title + '" ' +
                'data-uri="'+ item.uri + '" ' +
                'data-context="' + item.context + '">' +
                '» ' + item.title +
                '<div class="context">' +
                (item.context || '') +'</div>' +
                '</div>';
        }
1185163
def split_strings_in_list_retain_spaces(orig_list):
    
    temp_list = list()
    for line in orig_list:
        line_split = __re.split(r'(\s+)', line)
        temp_list.append(line_split)

    return temp_list
1329160
def tokenlist(item, sep, suppress=True):
    """"""
    if suppress:
        sep = sep.suppress()
    return item + ZeroOrMore(sep + item) + Optional(sep)
134259
public List<Term> getAllTerms() {
        List<Term> ret = new ArrayList<Term>();
        ret.add(subject);

        List<Term> subjectTerms = subject.getTerms();
        if (subjectTerms != null) {
            ret.addAll(subjectTerms);
            for (final Term term : subjectTerms) {
                ret.addAll(term.getAllTerms());
            }
        }

        if (object != null) {
            ret.addAll(object.getAllTerms());
        }
        return ret;
    }
399605
def strnumlist(prefix: str, numbers: List[int], suffix: str = "") -> List[str]:
    
    return ["{}{}{}".format(prefix, num, suffix) for num in numbers]
1360573
@Override
    public String[] tag(List<String> wordList)
    {
        String[] termArray = new String[wordList.size()];
        wordList.toArray(termArray);
        return tag(termArray);
    }
981001
def remove_terms(self,list_term_ids):
        
        nodes_to_remove = set()
        for term in self:
            if term.get_id() in list_term_ids:
                nodes_to_remove.add(term.get_node())
                #For removing the previous comment
                prv = term.get_node().getprevious()
                if prv is not None:
                    nodes_to_remove.add(prv)
        
        for node in nodes_to_remove:
            self.node.remove(node)
1198437
def ensure_a_list(data):
    """"""
    if not data:
        return []
    if isinstance(data, (list, tuple, set)):
        return list(data)
    if isinstance(data, str):
        data = trimmed_split(data)  # settings.toml,other.yaml
        return data
    return [data]
669793
def names(self):
        """"""
        if is_term(self.terms):
            return frozenset([self.terms.name])
        return frozenset(term.name for term in com.flatten(self.terms))
66484
def _from_to_as_term(self, frm, to):
        

        # The wackiness with the conversion to int and str, and adding ' ', is because there
        # can't be a space between the 'TO' and the brackets in the time range
        # when one end is open
        from_year = ''
        to_year = ''

        def year_or_empty(prefix, year, suffix):
            try:
                return prefix + str(int(year)) + suffix
            except (ValueError, TypeError):
                return ''

        if frm:
            from_year = year_or_empty('', frm, ' ')

        if to:
            to_year = year_or_empty(' ', to, '')

        if bool(from_year) or bool(to_year):
            return '[{}TO{}]'.format(from_year, to_year)
        else:
            return None