Ensure the rect spec is valid.
174272
def check_bounding_rect(rect_pos):
    """"""

    if not isinstance(rect_pos, Iterable):
        raise ValueError('rectangle spect must be a tuple of floats '
                         'specifying (left, right, width, height)')

    left, bottom, width, height = rect_pos
    for val, name in zip((left, bottom, width, height),
                         ('left', 'bottom', 'width', 'height')):
        if val < 0.0 or val > 1.0:
            raise ValueError("{}'s value must be >=0 and <= 1.0. "
                             "It is now {}".format(name, val))

    if left + width > 1.0:
        print('rect would extend beyond the width of figure/axis by {}'.format(left + width - 1.0))

    if bottom + height > 1.0:
        print('rect would extend beyond the height of figure/axis by {}'.format(
            bottom + height - 1.0))

    return rect_pos
595778
def validate_fixed(datum, schema, **kwargs):
    
    return (
            (isinstance(datum, bytes) and len(datum) == schema['size'])
            or (isinstance(datum, decimal.Decimal))
    )
211324
def com_google_fonts_check_wght_valid_range(ttFont):
  """"""

  Failed = False
  for instance in ttFont['fvar'].instances:
    if 'wght' in instance.coordinates:
      value = instance.coordinates['wght']
      if value < 1 or value > 1000:
        Failed = True
        yield FAIL, (f"Found a bad wght coordinate with value '{value}'"
                      " outside of the valid range from 1 to 1000.") 
        break

  if not Failed:
    yield PASS, ("OK")
462110
def validate(self, formats_dir="../formats/"):
        """"""
        #TODO: download XSD from web
        if self.inline:
            xmlschema = ElementTree.XMLSchema(ElementTree.parse(StringIO("\n".join(open(formats_dir+"dcoi-dsc.xsd").readlines()))))
            xmlschema.assertValid(self.tree)
            #return xmlschema.validate(self)
        else:
            xmlschema = ElementTree.XMLSchema(ElementTree.parse(StringIO("\n".join(open(formats_dir+"dutchsemcor-standalone.xsd").readlines()))))
            xmlschema.assertValid(self.tree)
1137978
def validate_version(self):
        """"""
        installed = get_installed_version()
        if not versions_compatible(*self.dbt_version):
            msg = IMPOSSIBLE_VERSION_ERROR.format(
                package=self.project_name,
                version_spec=[
                    x.to_version_string() for x in self.dbt_version
                ]
            )
            raise DbtProjectError(msg)

        if not versions_compatible(installed, *self.dbt_version):
            msg = INVALID_VERSION_ERROR.format(
                package=self.project_name,
                installed=installed.to_version_string(),
                version_spec=[
                    x.to_version_string() for x in self.dbt_version
                ]
            )
            raise DbtProjectError(msg)
754671
def validate(self):
        """"""
        validate_edge_direction(self.direction)
        validate_safe_string(self.edge_name)

        if not isinstance(self.within_optional_scope, bool):
            raise TypeError(u'Expected bool within_optional_scope, got: {} '
                            u'{}'.format(type(self.within_optional_scope).__name__,
                                         self.within_optional_scope))

        if not isinstance(self.depth, int):
            raise TypeError(u'Expected int depth, got: {} {}'.format(
                type(self.depth).__name__, self.depth))

        if not (self.depth >= 1):
            raise ValueError(u'depth ({}) >= 1 does not hold!'.format(self.depth))
678349
def validate_v_rgb(value):
    """"""
    if len(value) != 6:
        raise vol.Invalid(
            '{} is not six characters long'.format(value))
    return validate_hex(value)
1228279
def Validate(self):
    """"""
    if len(self.RECURSION_REGEX.findall(self._value)) > 1:
      raise ValueError("Only one ** is permitted per path: %s." % self._value)
652319
def _validate(self, key, cls=None):
        """"""
        if key not in self.manifest:
            raise ValueError("Manifest %s requires '%s'."
                             % (self.manifest_path, key))
        if cls:
            if not isinstance(self.manifest[key], cls):
                raise TypeError("Manifest value '%s' should be %s, not %s"
                                % (key, cls, type(self.manifest[key])))
211285
def validate(self, dct):
        
        if not isinstance(dct, dict):
            # TODO this check should be in side of the validator not here
            self._raise_invalid_fields('', dct, 'wrong type')
        txn_type = dct.get(TXN_TYPE)
        if txn_type is None:
            self._raise_missed_fields(TXN_TYPE)
        if txn_type in self.operations:
            # check only if the schema is defined
            op = self.operations[txn_type]
            op.validate(dct)
1294268
def showSpec(self, fname):
        """"""
        if not self.specPlot.hasImg() and fname is not None:
            self.specPlot.fromFile(fname)
183081
def _validate(self):
        
        # This could be done with a default config

        # Check that specific keys exist
        sections = odict([
                ('catalog',['dirname','basename',
                            'lon_field','lat_field','objid_field',
                            'mag_1_band', 'mag_1_field', 'mag_err_1_field',
                            'mag_2_band', 'mag_2_field', 'mag_err_2_field',
                            ]),
                ('mask',[]),
                ('coords',['nside_catalog','nside_mask','nside_likelihood',
                           'nside_pixel','roi_radius','roi_radius_annulus',
                           'roi_radius_interior','coordsys',
                           ]),
                ('likelihood',[]),
                ('output',[]),
                ('batch',[]),
                ])  

        keys = np.array(list(sections.keys()))
        found = np.in1d(keys,list(self.keys()))

        if not np.all(found):
            msg = 'Missing sections: '+str(keys[~found])
            raise Exception(msg)

        for section,keys in sections.items():
            keys = np.array(keys)
            found = np.in1d(keys,list(self[section].keys()))
            if not np.all(found):
                msg = 'Missing keys in %s: '%(section)+str(keys[~found])
                raise Exception(msg)
719336
def verify(self, **kwargs):
        
        _spec = self.c_param
        try:
            _allowed = self.c_allowed_values
        except KeyError:
            _allowed = {}

        for (attribute, (typ, required, _, _, na)) in _spec.items():
            if attribute == "*":
                continue

            try:
                val = self._dict[attribute]
            except KeyError:
                if required:
                    raise MissingRequiredAttribute("%s" % attribute)
                continue
            else:
                if typ == bool:
                    pass
                elif not val:
                    if required:
                        raise MissingRequiredAttribute("%s" % attribute)
                    continue

            try:
                _allowed_val = _allowed[attribute]
            except KeyError:
                pass
            else:
                if not self._type_check(typ, _allowed_val, val, na):
                    raise NotAllowedValue(val)

        return True
191963
def verify(ctx):
    """"""
    oks = run_configurations(
        skipper(verify_environments),
        read_sections,
    )
    ctx.exit(0
             if False not in oks
             else 1)
807100
protected void validate() {
        Assert.checkNotNullParam("endpoint", endpoint);
        Assert.checkNotNullParam("optionMap", optionMap);
        Assert.checkNotNullParam("uri", uri);
    }
727190
def validate_options(self, k, v):
        """"""

        super().validate_options(k, v)
        if k == 'mode' and v not in MODE:
            raise ValueError("{}: '{}' is not a valid value for '{}'".format(self.__class__.__name, v, k))
634735
def _write_validate(self):
        """"""
        if self.colorspace is None:
            msg = ("Writing colr boxes without enumerated "
                   "colorspaces is not supported at this time.")
            self._dispatch_validation_error(msg, writing=True)

        if self.icc_profile is None:
            if self.colorspace not in [SRGB, GREYSCALE, YCC]:
                msg = ("Colorspace should correspond to one of SRGB, "
                       "GREYSCALE, or YCC.")
                self._dispatch_validation_error(msg, writing=True)

        self._validate(writing=True)