Check RNF validity of a read tuple.

		Args:
			read_tuple_name (str): Read tuple name to be checked.s
322792
def validate(self, read_tuple_name):
        
        if reg_lrn.match(read_tuple_name) is None:
            self.report_error(
                read_tuple_name=read_tuple_name,
                error_name="wrong_read_tuple_name_structure",
                message="'{}' is not matched".format(reg_lrn),
            )
        else:
            parts = read_tuple_name.split("__")

            if reg_prefix_part.match(parts[0]) is None:
                self.report_error(
                    read_tuple_name=read_tuple_name,
                    error_name="wrong_prefix_part",
                    message="'{}' is not matched".format(reg_prefix_part),
                )

            if reg_id_part.match(parts[1]) is None:
                self.report_error(
                    read_tuple_name=read_tuple_name,
                    error_name="wrong_id_part",
                    message="'{}' is not matched".format(reg_id_part),
                )

            if reg_segmental_part.match(parts[2]) is None:
                self.report_error(
                    read_tuple_name=read_tuple_name,
                    error_name="wrong_segmental_part",
                    message="'{}' is not matched".format(reg_segmental_part),
                )

            if reg_suffix_part.match(parts[3]) is None:
                self.report_error(
                    read_tuple_name=read_tuple_name,
                    error_name="wrong_suffix_part",
                    message="'{}' is not matched".format(reg_suffix_part),
                )

            if not self.rnf_profile.check(read_tuple_name):
                self.report_error(
                    read_tuple_name=read_tuple_name,
                    error_name="wrong_profile",
                    message="Read has a wrong profile (wrong widths). It should be: {} but it is: {}.".format(
                        self.rnf_profile,
                        rnftools.rnfformat.RnfProfile(read_tuple_name=read_tuple_name),
                    ),
                    warning=True,
                )
1093951
def check_valid_object_name(sequence):
    """"""
    names = []
    for o in sequence:
        if o.__name__ in names:
            raise ValueError(
                'A tallyable PyMC object called %s already exists. This will cause problems for some database backends.' %
                o.__name__)
        else:
            names.append(o.__name__)
158148
def _cli_check_basis(name, data_dir):
    ''''''

    if name is None:
        return None

    name = misc.transform_basis_name(name)
    metadata = api.get_metadata(data_dir)
    if not name in metadata:
        errstr = "Basis set '" + name + "' does not exist.\n"
        errstr += "For a complete list of basis sets, use the 'bse list-basis-sets' command"
        raise RuntimeError(errstr)

    return name
325752
def check_tuple_size(tuples, tuple_size, context):
  """"""
  if tuple_size is not None and tuples.shape[1] != tuple_size:
    msg_t = (("Tuples of {} element(s) expected{}. Got tuples of {} "
             "element(s) instead (shape={}):\ninput={}.\n")
             .format(tuple_size, context, tuples.shape[1], tuples.shape,
                     tuples))
    raise ValueError(msg_t)
28749
def _readtoken(self, name, pos, length):
        """"""
        if length is not None and int(length) > self.length - pos:
            raise ReadError("Reading off the end of the data. "
                            "Tried to read {0} bits when only {1} available.".format(int(length), self.length - pos))
        try:
            val = name_to_read[name](self, length, pos)
            return val, pos + length
        except KeyError:
            if name == 'pad':
                return None, pos + length
            raise ValueError("Can't parse token {0}:{1}".format(name, length))
        except TypeError:
            # This is for the 'ue', 'se' and 'bool' tokens. They will also return the new pos.
            return name_to_read[name](self, pos)
447353
def _handle_readable(self, f):
        
        count = -1
        if isinstance(f, tuple):
            f, count = f
        handler = self._reads.pop(f, None)
        if handler is not None:
            handler(self, f, count=count)
630647
def check(cls, dic):
        
        res = {}
        for name, text in dic.items():
            try:
                p = getattr(cls, name)
            except AttributeError:
                logging.warning('Ignored unknown parameter %s', name)
            else:
                res[name] = p.validator(text)
        return res
758339
def _validate_attrs(dataset):
    
    def check_attr(name, value):
        if isinstance(name, str):
            if not name:
                raise ValueError('Invalid name for attr: string must be '
                                 'length 1 or greater for serialization to '
                                 'netCDF files')
        else:
            raise TypeError("Invalid name for attr: {} must be a string for "
                            "serialization to netCDF files".format(name))

        if not isinstance(value, (str, Number, np.ndarray, np.number,
                                  list, tuple)):
            raise TypeError('Invalid value for attr: {} must be a number, '
                            'a string, an ndarray or a list/tuple of '
                            'numbers/strings for serialization to netCDF '
                            'files'.format(value))

    # Check attrs on the dataset itself
    for k, v in dataset.attrs.items():
        check_attr(k, v)

    # Check attrs on each variable within the dataset
    for variable in dataset.variables.values():
        for k, v in variable.attrs.items():
            check_attr(k, v)
133640
def check_write(self, name):
        """"""
        assert compat.is_native(name)
        if self.readonly and name not in (
            DirMetadata.META_FILE_NAME,
            DirMetadata.LOCK_FILE_NAME,
        ):
            raise RuntimeError("Target is read-only: {} + {} / ".format(self, name))
323760
def _validate_dataset_names(dataset):
    """"""
    def check_name(name):
        if isinstance(name, str):
            if not name:
                raise ValueError('Invalid name for DataArray or Dataset key: '
                                 'string must be length 1 or greater for '
                                 'serialization to netCDF files')
        elif name is not None:
            raise TypeError('DataArray.name or Dataset key must be either a '
                            'string or None for serialization to netCDF files')

    for k in dataset.variables:
        check_name(k)
1015502
def read_ligolw_flag(source, name=None, **kwargs):
    
    name = [name] if name is not None else None
    return list(read_ligolw_dict(source, names=name, **kwargs).values())[0]
1310346
def lut_read(name)
        return nil unless options = lut_options(name)# HACK

        if options[:use_cache]
          lut_read_from_cache(name)
        else
          lut_read_without_cache(name)
        end
      end
1056771
def assert_valid(self, instance, value=None):
        """"""
        valid = super(Tuple, self).assert_valid(instance, value)
        if not valid:
            return False
        if value is None:
            value = instance._get(self.name)
            if value is None:
                return True
        if (
                (self.min_length is not None and len(value) < self.min_length)
                or
                (self.max_length is not None and len(value) > self.max_length)
        ):
            self.error(
                instance=instance,
                value=value,
                extra='(Length is {})'.format(len(value)),
            )
        for val in value:
            if not self.prop.assert_valid(instance, val):
                return False
        return True
559352
def _get_input_format_from_name(self, name):
        
        try:
            int(name)
            src_format = 'ISOnumeric'
        except ValueError:
            if len(name) == 2:
                src_format = 'ISO2'
            elif len(name) == 3:
                src_format = 'ISO3'
            else:
                src_format = 'regex'
        return src_format
1277499
def create_reader(self, name, *args, **kwargs):
        """"""
        self._check_format(name)
        return self._formats[name]['reader'](*args, **kwargs)
535690
def check_tuple(data: typing.Tuple,
                hint: typing.Union[type, typing.TypingMeta]) -> bool:
    
    if not isinstance(data, tuple):
        raise TypeError(
            'expected {}, not {}'.format(
                typing._type_repr(hint),
                'None' if data is None else '{}: {!r}'.format(
                    typing._type_repr(type(data)),
                    data
                )
            )
        )
    tuple_param = hint.__tuple_params__
    if len(data) != len(tuple_param):
        raise TypeError('expected tuple size is {}, not {}: '
                        '{!r}'.format(len(tuple_param), len(data), data))
    zipped = itertools.zip_longest(data, tuple_param)
    for i, (v, t) in enumerate(zipped):
        _, correct = check_type(v, t)
        if not correct:
            raise TypeError(
                '{0}th item `{1}` in tuple must be {2!r}, not: {3!r}'.format(
                    i, v, t, v
                )
            )
    return hint, True
130378
def _check_input_names(symbol, names, typename, throw):
    """"""
    args = symbol.list_arguments()
    for name in names:
        if name in args:
            continue
        candidates = [arg for arg in args if
                      not arg.endswith('_weight') and
                      not arg.endswith('_bias') and
                      not arg.endswith('_gamma') and
                      not arg.endswith('_beta')]
        msg = "\033[91mYou created Module with Module(..., %s_names=%s) but " \
              "input with name '%s' is not found in symbol.list_arguments(). " \
              "Did you mean one of:\n\t%s\033[0m"%(
                  typename, str(names), name, '\n\t'.join(candidates))
        if throw:
            raise ValueError(msg)
        else:
            warnings.warn(msg)