Return True if text is an allowed abbreviation.
342214
def _is_allowed_abbr(self, tokens):
        """"""
        if len(tokens) <= 2:
            abbr_text = ''.join(tokens)
            if self.abbr_min <= len(abbr_text) <= self.abbr_max and bracket_level(abbr_text) == 0:
                if abbr_text[0].isalnum() and any(c.isalpha() for c in abbr_text):
                    # Disallow property values
                    if re.match('^\d+(\.\d+)?(g|m[lL]|cm)$', abbr_text):
                        return False
                    return True
        return False
637621
def _value_is_type_text(val):
    
    if ((u'type' in val.keys()) and
            (val['type'].lower() == u"text")):
        return True
    return False
193850
function constainRestrictedWords(text) {
	var i,
		restictedWords = ['today', 'tomorrow', 'yesterday', 'tonight'];

	text = text.toLowerCase();
	i = restictedWords.length;
	while (i--) {
		if (text.indexOf(restictedWords[i]) > -1) {
			return true;
		}
	}
	return false;
}
115054
public static boolean isValidIANAEncoding(String ianaEncoding) {
        if (ianaEncoding != null) {
            int length = ianaEncoding.length();
            if (length > 0) {
                char c = ianaEncoding.charAt(0);
                if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
                    for (int i = 1; i < length; i++) {
                        c = ianaEncoding.charAt(i);
                        if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&
                            (c < '0' || c > '9') && c != '.' && c != '_' &&
                            c != '-') {
                            return false;
                        }
                    }
                    return true;
                }
            }
        }
        return false;
    }
322895
def is_url(text):
    
    if text is None:
        return False
    text = text.lower()
    return text.startswith('http://') or text.startswith('https://') or \
        text.startswith('urn:') or text.startswith('file://')
625743
def acceptable(value, capitalize=False):
    """"""
    name = regexes['punctuation'].sub("", regexes['joins'].sub("_", value))
    # Clean up irregularities in underscores.
    name = regexes['repeated_underscore'].sub("_", name.strip('_'))
    if capitalize:
        # We don't use python's built in capitalize method here because it
        # turns all upper chars into lower chars if not at the start of
        # the string and we only want to change the first character.
        name_parts = []
        for word in name.split('_'):
            name_parts.append(word[0].upper())
            if len(word) > 1:
                name_parts.append(word[1:])
        name = ''.join(name_parts)
    return name
476311
def is_valid(self):
        
        return len(self.ref) == 1 and \
               len(self.alt) == 1 and \
               len(self.alt[0]) == 1
1302408
private boolean isValidNamedEntity(final Double score, final String text) {
    return !StringUtils.isBlank(text)
           || score != null;
  }
852800
def confirm(text, default=True):
    
    if default:
        legend = "[y]/n"
    else:
        legend = "y/[n]"
    res = ""
    while (res != "y") and (res != "n"):
        res = raw_input(text + " ({}): ".format(legend)).lower()
        if not res and default:
            res = "y"
        elif not res and not default:
            res = "n"
    if res[0] == "y":
        return True
    else:
        return False
10932
def _is_valid_extension(extension):
    
    if not cfg.CONF.valid_extensions:
        return True

    valid = False
    for cext in cfg.CONF.valid_extensions:
        if not cext.startswith('.'):
            cext = '.%s' % cext
        if extension == cext:
            valid = True
            break

    return valid
70195
def is_valid(self, qstr=None):
        """"""
        if qstr is None:
            qstr = self.currentText()
        return QUrl(qstr).isValid()
401312
private static boolean isValidEscaping(char c) {
        return ((c == 'n') || (c == 'r') || (c == 't') || (c == 'f') || (c == 'b') || (c == '\\') || (c == '/')
                || (c == '"') || (c == 'u'));
    }
1298977
private boolean isValidMsgName(Node nameNode) {
    if (nameNode.isName() || nameNode.isStringKey()) {
      return nameNode.getString().startsWith("MSG_");
    } else if (nameNode.isQualifiedName()) {
      return nameNode.getLastChild().getString().startsWith("MSG_");
    } else {
      return false;
    }
  }
1000756
def get_abbreviation_of(self, name):
        """"""
        for language in self.user_data.languages:
            if language['language_string'] == name:
                return language['language']
        return None
1006699
function isStringLiteralCode(s) {
    return (
        (s.startsWith("'") && s.endsWith("'")) ||
        (s.startsWith('"') && s.endsWith('"'))
    )
}
711577
def check_text(self, text):
        """"""
        if to_text_string(text) == u'':
            self.button_ok.setEnabled(False)
        else:
            self.button_ok.setEnabled(True)
198262
def is_valid(self, qstr=None):
        """"""
        if qstr is None:
            qstr = self.currentText()
        return osp.isfile(to_text_string(qstr))