Validate a source for automatic harvesting
179040
def validate_source(ident, comment=None):
    ''''''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_ACCEPTED
    if current_user.is_authenticated:
        source.validation.by = current_user._get_current_object()
    source.save()
    schedule(ident, cron=current_app.config['HARVEST_DEFAULT_SCHEDULE'])
    launch(ident)
    return source
1277846
function validateSourcePath(sourcePath) {
    const materialPackageJSONPath = pathUtils.resolve(sourcePath, 'package.json');

    return fs.readFileAsync(materialPackageJSONPath, { encoding: 'UTF8' })
        .then(materialPackageJSONString => {
            const package = JSON.parse(materialPackageJSONString);
            if (package.name !== sourcePackageName) {
                throw new Error(`Source path ${sourcePath} does not appear to be a clone of https://github.com/callemall/material-ui`);
            }
            return sourcePath;
        });
}
954308
private void validate() {
        if (isValid != null) {
            return;
        }

        ParsingValidator v =
            new ParsingValidator(useSchema ? Languages.W3C_XML_SCHEMA_NS_URI
                                 : Languages.XML_DTD_NS_URI);
        List<Source> schemaSourceList = new ArrayList<Source>();
        if (systemId != null) {
            schemaSourceList.add(new StreamSource(systemId));
        }
        addSchemaSources(schemaSource, schemaSourceList);
        v.setSchemaSources(schemaSourceList.toArray(new Source[0]));

        try {
            ValidationResult r =
                v.validateInstance(new SAXSource(validationInputSource));
            isValid = r.isValid() ? Boolean.TRUE : Boolean.FALSE;
            for (ValidationProblem p : r.getProblems()) {
                validationProblem(p);
            }
        } catch (org.xmlunit.ConfigurationException e) {
            throw new ConfigurationException(e.getCause());
        } catch (org.xmlunit.XMLUnitException e) {
            throw new XMLUnitRuntimeException(e.getMessage(), e.getCause());
        }

        if (usingDoctypeReader && isValid == Boolean.FALSE) {
            try {
                messages.append("\nContent was: ")
                    .append(getOriginalContent(validationInputSource));
            } catch (IOException e) {
                // silent but deadly?
            }
        }
    }
704006
def validate(config):
    '''
    
    '''

    VALID_MASK = [
        'access',
        'attrib',
        'close_nowrite',
        'close_write',
        'create',
        'delete',
        'delete_self',
        'excl_unlink',
        'ignored',
        'modify',
        'moved_from',
        'moved_to',
        'move_self',
        'oneshot',
        'onlydir',
        'open',
        'unmount'
    ]

    # Configuration for inotify beacon should be a dict of dicts
    if not isinstance(config, list):
        return False, 'Configuration for inotify beacon must be a list.'
    else:
        _config = {}
        list(map(_config.update, config))

        if 'files' not in _config:
            return False, 'Configuration for inotify beacon must include files.'
        else:
            for path in _config.get('files'):

                if not isinstance(_config['files'][path], dict):
                    return False, ('Configuration for inotify beacon must '
                                   'be a list of dictionaries.')
                else:
                    if not any(j in ['mask',
                                     'recurse',
                                     'auto_add'] for j in _config['files'][path]):
                        return False, ('Configuration for inotify beacon must '
                                       'contain mask, recurse or auto_add items.')

                    if 'auto_add' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['auto_add'], bool):
                            return False, ('Configuration for inotify beacon '
                                           'auto_add must be boolean.')

                    if 'recurse' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['recurse'], bool):
                            return False, ('Configuration for inotify beacon '
                                           'recurse must be boolean.')

                    if 'mask' in _config['files'][path]:
                        if not isinstance(_config['files'][path]['mask'], list):
                            return False, ('Configuration for inotify beacon '
                                           'mask must be list.')
                        for mask in _config['files'][path]['mask']:
                            if mask not in VALID_MASK:
                                return False, ('Configuration for inotify beacon '
                                               'invalid mask option {0}.'.format(mask))
    return True, 'Valid beacon configuration'
1355657
def RunValidationOutputFromOptions(feed, options):
  """"""
  if options.output.upper() == "CONSOLE":
    return RunValidationOutputToConsole(feed, options)
  else:
    return RunValidationOutputToFilename(feed, options, options.output)
914189
private void validate() {
        LibraryUtils.checkArgumentNotNull(config, "Configuration is null.");
        LibraryUtils.checkArgumentNotNull(eventsProcessor, "Events Processor is null.");
        LibraryUtils.checkArgumentNotNull(sourceFilter, "Source Filter is null.");
        LibraryUtils.checkArgumentNotNull(eventFilter, "Event Filter is null.");
        LibraryUtils.checkArgumentNotNull(progressReporter, "Progress Reporter is null.");
        LibraryUtils.checkArgumentNotNull(exceptionHandler, "Exception Handler is null.");
        LibraryUtils.checkArgumentNotNull(s3Manager, "S3 Manager is null.");
        LibraryUtils.checkArgumentNotNull(sqsManager, "SQS Manager is null.");
    }
1046388
def Validate(self):
    """"""
    Validate(self.target, "Probe has invalid target")
    self.baseliner.Validate()
    self.handler.Validate()
    self.hint.Validate()
388845
def validateStringInput(input_key,input_data, read=False):
    
    log = clog.error_log
    func = None
    if '*' in input_data or '%' in input_data:
        func = validationFunctionWildcard.get(input_key)
        if func is None:
            func = searchstr
    elif input_key == 'migration_input' :
        if input_data.find('#') != -1 : func = block
        else : func = dataset
    else:
        if not read:
            func = validationFunction.get(input_key)
            if func is None:
                func = namestr
        else:
            if input_key == 'dataset':
                func = reading_dataset_check
            elif input_key == 'block_name':
                func = reading_block_check
            elif input_key == 'logical_file_name':
                func = reading_lfn_check
            else:
                func = namestr
    try:
        func(input_data)
    except AssertionError as ae:
        serverLog = str(ae) + " key-value pair (%s, %s) cannot pass input checking" %(input_key, input_data)
        #print serverLog
        dbsExceptionHandler("dbsException-invalid-input2", message="Invalid Input Data %s...:  Not Match Required Format" %input_data[:10], \
            logger=log.error, serverError=serverLog)
    return input_data
354942
def __quick_validate(r, check=('ResultSet', 'Result', 'totalRecords')):
    '''
    
    '''
    if 'ResultSet' in check and 'ResultSet' not in r:
        raise ResultSetError('no ResultSet in server response')
    if 'Result' in check and 'Result' not in r['ResultSet']:
        raise ResultSetError('no Result in server response')
    if 'totalRecords' in check and 'totalRecords' not in r['ResultSet']:
        raise ResultSetError('no totalRecords in server response')
    return True
66775
private void validate() {
        LibraryUtils.checkArgumentNotNull(config, "configuration is null");
        LibraryUtils.checkArgumentNotNull(exceptionHandler, "exceptionHandler is null");
        LibraryUtils.checkArgumentNotNull(progressReporter, "progressReporter is null");
        LibraryUtils.checkArgumentNotNull(sqsClient, "sqsClient is null");
        LibraryUtils.checkArgumentNotNull(sourceSerializer, "sourceSerializer is null");
    }
1151365
def Validate(self):
    """"""
    ValidateMultiple(self.probe, "Method has invalid probes")
    Validate(self.target, "Method has invalid target")
    Validate(self.hint, "Method has invalid hint")
206244
def _validated(self, data):
        """"""
        errors = []
        for sub in self.schemas:
            try:
                return sub(data)
            except NotValid as ex:
                errors.extend(ex.args)

        raise NotValid(' and '.join(errors))
192679
def validate(method):
    """"""

    @wraps(method)
    def mod_run(self, rinput):
        self.validate_input(rinput)
        #
        result = method(self, rinput)
        #
        self.validate_result(result)
        return result

    return mod_run
205599
function validateSeed() {
  return Q.Promise(function(resolve, reject) {
    https.get('https://github.com/olivejs/seed-' + options.seed, function(res) {
      if (res.statusCode === 200) {
        resolve('>> seed exists');
      } else {
        reject(new Error('Invalid seed: ' + options.seed));
      }
    }).on('error', function(err) {
      logger.error('\n  %s\n', err.message);
      reject(err);
    });
  });
}
378316
def validate(self, model, checks=[]):
        """"""
        custom = [
            check_partial(gene_id_check, frozenset(g.id for g in model.genes))
        ]
        super(EssentialityExperiment, self).validate(
            model=model, checks=checks + custom)
1231338
async function validateDirPath (dirPath) {
  try {
    const stats = await fs.lstat(dirPath);
    if (!stats.isDirectory()) {
      throw userError([
        'Source path must be a directory',
        ''
      ]);
    }
  } catch (error) {
    if (error.code === 'ENOENT') {
      throw userError([
        'No files or directories found at ' + dirPath,
        ''
      ]);
    }

    throw error;
  }
}
363172
def validate(folder=None, cleanup=False):
    '''
    '''
    from expfactory.validator import ExperimentValidator
    cli = ExperimentValidator()
    return cli.validate(folder, cleanup=cleanup)