Returns True if the given value is a list of valid MPLS labels.
514111
def is_valid_mpls_labels(labels):
    
    if not isinstance(labels, (list, tuple)):
        return False

    for label in labels:
        if not is_valid_mpls_label(label):
            return False

    return True
527372
def is_valid(data):
        
        return bool(data) and \
            isinstance(data, dict) and \
            bool(data.get("swagger")) and \
            isinstance(data.get('paths'), dict)
1204566
def __is_valid(loc_data):
    """"""
    for key, [value, func] in SENSOR_TYPES.items():
        if (key != CONDITION and key != STATIONNAME and key != MEASURED):
            if (func is not None):
                sens_data = loc_data.get(value)
                if func(sens_data) != 0:
                    return True
37554
def label_from_bin(buf):
    

    mpls_label = type_desc.Int3.to_user(six.binary_type(buf))
    return mpls_label >> 4, mpls_label & 1
476354
def validlines(self):
		""""""

		return [ln for ln in self.lines() if (not ln.isBroken() and not ln.ignoreMe)]
1123862
public boolean isList() {
    Object ptr = cdr;
    while (ptr instanceof ConsValue) {
      ptr = ((ConsValue) ptr).cdr;
    }
    return ptr == ConstantValue.NIL;
  }
453956
public boolean isValid() {

        boolean valid = true;

        switch (shapeType) {

            case POLYLINE_MARKERS:
                valid = ((PolylineMarkers) shape).isValid();
                break;
            case POLYGON_MARKERS:
                valid = ((PolygonMarkers) shape).isValid();
                break;
            case MULTI_POLYLINE_MARKERS:
                valid = ((MultiPolylineMarkers) shape).isValid();
                break;
            case MULTI_POLYGON_MARKERS:
                valid = ((MultiPolygonMarkers) shape).isValid();
                break;
            case COLLECTION:
                @SuppressWarnings("unchecked")
                List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape;
                for (GoogleMapShape shapeListItem : shapeList) {
                    valid = shapeListItem.isValid();
                    if (!valid) {
                        break;
                    }
                }
                break;
            default:
        }

        return valid;
    }
925854
def validate_line_list(dist, attr, value):
    

    # does not work as reliably in Python 2.
    if isinstance(value, str):
        value = value.split()
    value = list(value)

    try:
        check = (' '.join(value)).split()
        if check == value:
            return True
    except Exception:
        pass
    raise DistutilsSetupError("%r must be a list of valid identifiers" % attr)
1106100
def is_true(self, item=None):
        
        if item:
            values = [item]
        else:
            values = []
        self._get_item_and_att_names(*values)
        return self._passes_all
787472
def is_lossy(label):
    
    val = getkey(from_=label, keyword='INST_CMPRS_TYPE').decode().strip()
    if val == 'LOSSY':
        return True
    else:
        return False
1097216
def valid(self, value, level=[]):
		

		# Reset validation failures
		self.validation_failures = []

		# If the value is None and it's optional, we're good
		if value is None and self._optional:
			return True

		# If we are validating an ANY field, immediately return true
		if self._type == 'any':
			pass

		# If we are validating a DATE, DATETIME, IP or TIME data point
		elif self._type in ['base64', 'date', 'datetime', 'ip', 'md5', 'time', 'uuid']:

			# If it's a date or datetime type and the value is a python type
			if self._type == 'date' and isinstance(value, (datetime.date, datetime.datetime)):
				value = value.strftime('%Y-%m-%d')

			elif self._type == 'datetime' and isinstance(value, (datetime.date, datetime.datetime)):
				if isinstance(value, datetime.datetime):
					value = value.strftime('%Y-%m-%d %H:%M:%S')
				elif isinstance(value, datetime.date):
					value = '%s 00:00:00' % value.strftime('%Y-%m-%d')

			# If it's a time type and the value is a python type
			elif self._type == 'time' and isinstance(value, (datetime.time, datetime.datetime)):
				value = value.strftime('%H:%M:%S')

			# Else if the type is md5 and the value is a python type
			elif self._type == 'md5' and isinstance(value, _MD5_TYPE):
				value = value.hexdigest()

			# If the value is not a string
			elif not isinstance(value, basestring):
				self.validation_failures.append(('.'.join(level), 'not a string'))
				return False

			# If there's no match
			if not _typeToRegex[self._type].match(value):
				self.validation_failures.append(('.'.join(level), 'failed regex (internal)'))
				return False

			# If we are checking an IP
			if self._type == 'ip':

				# If there's a min or a max
				if self._minimum is not None or self._maximum is not None:

					# If the IP is greater than the maximum
					if self._maximum is not None and self.__compare_ips(value, self._maximum) == 1:
						self.validation_failures.append(('.'.join(level), 'exceeds maximum'))
						return False

					# If the IP is less than the minimum
					if self._minimum is not None and self.__compare_ips(value, self._minimum) == -1:
						self.validation_failures.append(('.'.join(level), 'did not meet minimum'))
						return False

					# Return OK
					return True

		# Else if we are validating some sort of integer
		elif self._type in ['int', 'timestamp', 'uint']:

			# If the type is a bool, fail immediately
			if type(value) == bool:
				self.validation_failures.append(('.'.join(level), 'is a bool'))
				return False

			# If it's not an int
			if not isinstance(value, (int, long)):

				# And it's a valid representation of an int
				if isinstance(value, basestring) \
					and _typeToRegex['int'].match(value):

					# If it starts with 0
					if value[0] == '0' and len(value) > 1:

						# If it's followed by X or x, it's hex
						if value[1] in ['x', 'X'] and len(value) > 2:
							value = int(value, 16)

						# Else it's octal
						else:
							value = int(value, 8)

					# Else it's base 10
					else:
						value = int(value)

				# Else, return false
				else:
					self.validation_failures.append(('.'.join(level), 'not an integer'))
					return False

			# If it's not signed
			if self._type in ['timestamp', 'uint']:

				# If the value is below 0
				if value < 0:
					self.validation_failures.append(('.'.join(level), 'signed'))
					return False

		# Else if we are validating a bool
		elif self._type == 'bool':

			# If it's already a bool
			if isinstance(value, bool):
				return True

			# If it's an int or long at 0 or 1
			if isinstance(value, (int, long)) and value in [0, 1]:
				return True

			# Else if it's a string
			elif isinstance(value, basestring):

				# If it's t, T, 1, f, F, or 0
				if value in ['true', 'True', 'TRUE', 't', 'T', '1', 'false', 'False', 'FALSE', 'f', 'F', '0']:
					return True
				else:
					self.validation_failures.append(('.'.join(level), 'not a valid string representation of a bool'))
					return False

			# Else it's no valid type
			else:
				self.validation_failures.append(('.'.join(level), 'not valid bool replacement'))
				return False

		# Else if we are validating a decimal value
		elif self._type == 'decimal':

			# If the type is a bool, fail immediately
			if type(value) == bool:
				self.validation_failures.append(('.'.join(level), 'is a bool'))
				return False

			# If it's already a Decimal
			if isinstance(value, Decimal):
				pass

			# Else if we fail to convert the value
			else:
				try: value = Decimal(value)
				except (DecimalInvalid, TypeError, ValueError):
					self.validation_failures.append(('.'.join(level), 'can not be converted to decimal'))
					return False

		# Else if we are validating a floating point value
		elif self._type == 'float':

			# If the type is a bool, fail immediately
			if type(value) == bool:
				self.validation_failures.append(('.'.join(level), 'is a bool'))
				return False

			# If it's already a float
			if isinstance(value, float):
				pass

			# Else if we fail to convert the value
			else:
				try: value = float(value)
				except (ValueError, TypeError):
					self.validation_failures.append(('.'.join(level), 'can not be converted to float'))
					return False

		# Else if we are validating a JSON string
		elif self._type == 'json':

			# If it's already a string
			if isinstance(value, basestring):

				# Try to decode it
				try:
					value = JSON.decode(value)
					return True
				except ValueError:
					self.validation_failures.append(('.'.join(level), 'Can not be decoded from JSON'))
					return False

			# Else
			else:

				# Try to encode it
				try:
					value = JSON.encode(value)
					return True
				except (ValueError, TypeError):
					self.validation_failures.append(('.'.join(level), 'Can not be encoded to JSON'))
					return False

		# Else if we are validating a price value
		elif self._type == 'price':

			# If the type is a bool, fail immediately
			if type(value) == bool:
				self.validation_failures.append(('.'.join(level), 'is a bool'))
				return False

			# If it's not a floating point value
			if not isinstance(value, Decimal):

				# But it is a valid string representing a price, or a float
				if isinstance(value, (basestring, float)) \
					and _typeToRegex['price'].match(str(value)):

					# Convert it to a decimal
					value = Decimal(value).quantize(Decimal('1.00'))

				# Else if it's an int
				elif isinstance(value, int):

					# Convert it to decimal
					value = Decimal(str(value) + '.00')

				# Else whatever it is is no good
				else:
					self.validation_failures.append(('.'.join(level), 'failed regex (internal)'))
					return False

			# Else
			else:

				# If the exponent is longer than 2
				if abs(value.as_tuple().exponent) > 2:
					self.validation_failures.append(('.'.join(level), 'too many decimal points'))
					return False

		# Else if we are validating a string value
		elif self._type == 'string':

			# If the value is not some form of string
			if not isinstance(value, basestring):
				self.validation_failures.append(('.'.join(level), 'is not a string'))
				return False

			# If we have a regex
			if self._regex:

				# If it doesn't match the regex
				if re.match(self._regex, value) == None:
					self.validation_failures.append(('.'.join(level), 'failed regex (custom)'))
					return False

			# Else
			elif self._minimum or self._maximum:

				# If there's a minimum length and we don't reach it
				if self._minimum and len(value) < self._minimum:
					self.validation_failures.append(('.'.join(level), 'not long enough'))
					return False

				# If there's a maximum length and we surpass it
				if self._maximum and len(value) > self._maximum:
					self.validation_failures.append(('.'.join(level), 'too long'))
					return False

				# Return OK
				return True

		# If there's a list of options
		if self._options is not None:

			# Returns based on the option's existance
			if value not in self._options:
				self.validation_failures.append(('.'.join(level), 'not in options'))
				return False
			else:
				return True

		# Else check for basic min/max
		else:

			# If the value is less than the minimum
			if self._minimum and value < self._minimum:
				self.validation_failures.append(('.'.join(level), 'did not meet minimum'))
				return False

			# If the value is greater than the maximum
			if self._maximum and value > self._maximum:
				self.validation_failures.append(('.'.join(level), 'exceeds maximum'))
				return False

		# Value has no issues
		return True
988977
def _is_valid_value(self):
        

        comp_str = self._encoded_value

        value_pattern = []
        value_pattern.append("^((")
        value_pattern.append("~[")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+")
        value_pattern.append(")|(")
        value_pattern.append("[")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+(![")
        value_pattern.append(CPEComponent1_1._STRING)
        value_pattern.append("]+)*")
        value_pattern.append("))$")

        value_rxc = re.compile("".join(value_pattern))
        return value_rxc.match(comp_str) is not None
557663
def _is_valid_endpoint(endpoint):
    """"""
    return any([is_number(endpoint),
                isinstance(endpoint, Timestamp),
                isinstance(endpoint, Timedelta),
                endpoint is None])
649599
def isValidList(self, l):  # modified to flatten lists specified using [ a rdf:List; ] syntax
        
        try:
            if self.store.value(l, RDF.first) is None:
                return False
        except:
            return False
        while l:
            if l != RDF.nil:
                po = list(self.store.predicate_objects(l))
                if (RDF.type, RDF.List) in po and len(po) == 3:
                    pass
                elif len(po) != 2:
                    return False
            l = self.store.value(l, RDF.rest)
        return True
174769
public boolean isValid() {
        boolean valid = true;
        for (PolylineMarkers polyline : polylineMarkers) {
            valid = polyline.isValid();
            if (!valid) {
                break;
            }
        }
        return valid;
    }
1203304
def is_answer_valid(self, ans):
        """"""
        return ans in [str(i+1) for i in range(len(self.choices))]
318479
public boolean validOptions(List<String[]> optlist) {
        Object retVal;
        String options[][] = optlist.toArray(new String[optlist.length()][]);
        String methodName = "validOptions";
        DocErrorReporter reporter = messager;
        Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
        Object[] params = { options, reporter };
        try {
            retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
        } catch (DocletInvokeException exc) {
            return false;
        }
        if (retVal instanceof Boolean) {
            return ((Boolean)retVal);
        } else {
            messager.error(Messager.NOPOS, "main.must_return_boolean",
                           docletClassName, methodName);
            return false;
        }
    }