Runs the schematron file against the input source.
169569
public boolean executeSchematronDriver(InputSource inputDoc,
            File schemaFile, String phase) {

        boolean isValid = false;
        ValidationDriver driver = createSchematronDriver(phase);
        assert null != driver : "Unable to create Schematron ValidationDriver";
        InputSource is = null;
        // Fortify Mod: move fis out so it can be closed on exit
        FileInputStream fis = null;
        try {
            // FileInputStream fis = new FileInputStream(schemaFile);
            fis = new FileInputStream(schemaFile);
            is = new InputSource(fis);
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            if (driver.loadSchema(is)) {
                isValid = driver.validate(inputDoc);
                fis.close(); // Fortify addition
            } else {
                assert false : ("Failed to load Schematron schema: "
                        + schemaFile + "\nIs the schema valid? Is the phase defined?");
            }
        } catch (SAXException e) {
            assert false : e.toString();
        } catch (IOException e) {
            assert false : e.toString();
        }
        return isValid;
    }
260467
def run(self):
        """"""
        pydocstyle.Error.explain = self.options['explain']
        filename, source = load_file(self.filename)
        for error in pydocstyle.PEP257Checker().check_source(source, filename):
            if not hasattr(error, 'code') or ignore(error.code):
                continue
            lineno = error.line
            offset = 0  # Column number starting from 0.
            explanation = error.explanation if pydocstyle.Error.explain else ''
            text = '{0} {1}{2}'.format(error.code, error.message.split(': ', 1)[1], explanation)
            yield lineno, offset, text, Main
634272
public int run() {
        if (outfile == null && compare == null)
            return CommandLineArguments.STATUS_NO_OUTPUT_OR_COMPARISON;
        if (infile == null && generator == null && merge == null)
            return CommandLineArguments.STATUS_NO_INPUT;

        if ((infile == "-") && (bindings == "-"))
            throw new InteropException(
                    "Cannot use standard input for both infile and bindings");

        Document doc;
        if (infile != null) {
            doc = doReadDocument(infile, informat);
        } else if (merge != null) {
            IndexedDocument iDoc = new IndexedDocument(pFactory,
                                                       pFactory.newDocument(),
                                                       flatten != null);
            try {
                List<ToRead> files;
                if (merge.equals("-")) {
                    files = readIndexFile(System.in);
                } else {
                    files = readIndexFile(new File(merge));
                }
                System.err.println("files to merge " + files);
                for (ToRead something : files) {
                    iDoc.merge(readDocument(something));
                }

            } catch (IOException e) {
                System.err.println("problem reading index file");
                e.printStackTrace();

            }
            doc = iDoc.toDocument();

        } else {

            String[] options = generator.split(":");
            String noOfNodes = getOption(options, 0);
            String noOfEdges = getOption(options, 1);
            String firstNode = getOption(options, 2);
            String namespace = "http://expample.org/";
            String seed = getOption(options, 3);
            String term = getOption(options, 4);

            if (term == null)
                term = "e1";

            GeneratorDetails gd = new GeneratorDetails(
                                                       Integer.valueOf(noOfNodes),
                                                       Integer.valueOf(noOfEdges),
                                                       firstNode,
                                                       namespace,
                                                       (seed == null) ? null
                                                               : Long.valueOf(seed),
                                                               term);
            System.err.println(gd);
            GraphGenerator gg = new GraphGenerator(gd, pFactory);
            gg.generateElements();

            doc = gg.getDetails().getDocument();
        }

        if (compare!=null) {
            return doCompare(doc,doReadDocument(compare, informat));
        } 
        
        if (template!=null) {
            BindingsBeanGenerator bbgen=new BindingsBeanGenerator(pFactory);
            
            boolean val=bbgen.generate(doc, template, packge, outfile, location);
            return (val) ? 0 : CommandLineArguments.STATUS_BEAN_GENERATION;
        }

        if (index != null) {
            Document indexedDoc = new IndexedDocument(pFactory, doc,
                                                      (flatten != null)).toDocument();
            doc = indexedDoc;
        }
        if (bindings != null) {
            Expand myExpand=new Expand(pFactory, addOrderp,allExpanded);
            Document expanded;
            System.err.println("bindings version is " + bindingsVersion);
            if (bindingsVersion==3) {
                Bindings bb=BindingsJson.fromBean(BindingsJson.importBean(new File(bindings)),pFactory);
                expanded = myExpand.expander(doc,
                                             bb);

            } else {
                Document docBindings = (Document) doReadDocument(bindings,
                                                                 bindingformat);
                expanded = myExpand.expander(doc,
                                             outfile,
                                             docBindings);
            }
            boolean flag=myExpand.getAllExpanded();
            doWriteDocument(outfile, outformat, expanded);

            if (!flag) {
                return CommandLineArguments.STATUS_TEMPLATE_UNBOUND_VARIABLE;
            }
        } else {
            doWriteDocument(outfile, outformat, doc);
        }
        return CommandLineArguments.STATUS_OK;

    }
762833
def run(self,field=None,simple=False,force=False):
        
        if field is None: fields = [1,2]
        else:             fields = [field]
        for filenames in self.filenames.compress(~self.filenames.mask['catalog']).data:
            infile = filenames['catalog']
            for f in fields:
                outfile = filenames['mask_%i'%f]
                if os.path.exists(outfile) and not force:
                    logger.info("Found %s; skipping..."%outfile)
                    continue
                
                pixels,maglims=self.calculate(infile,f,simple)
                logger.info("Creating %s"%outfile)
                outdir = mkdir(os.path.dirname(outfile))
                data = odict()
                data['PIXEL']=pixels
                data['MAGLIM']=maglims.astype('f4')
                ugali.utils.healpix.write_partial_map(outfile,data,
                                                      self.nside_pixel)
428847
public void run()
    {
        if ((m_url == null) && (m_strHtmlText == null))
        {   // restore the original cursor
            if (m_bChangeCursor)
            {
                if (m_applet != null)
                    m_applet.setStatus(0, m_editorPane, m_oldCursor);
                else
                {
                	Component component = m_editorPane;
                	while (component.getParent() != null)
                	{
                		component = component.getParent();
                	}
                    component.setCursor((Cursor)m_oldCursor);
                }
                Container parent = m_editorPane.getParent();
                parent.repaint();
            }
        }
        else
        {
            if (m_bChangeCursor)
            {
                if (m_applet != null)
                    m_oldCursor = m_applet.setStatus(Cursor.WAIT_CURSOR, m_editorPane, null);
                else
                {
                	Component component = m_editorPane;
                	boolean bIsVisible = true;
                	while (component.getParent() != null)
                	{
                		component = component.getParent();
                		if (!component.isVisible())
                			bIsVisible = false;
                	}
                	m_oldCursor = component.getCursor();
                    Cursor cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
                    if (bIsVisible)
                    	component.setCursor(cursor);
                }
            }
            
            synchronized (m_editorPane)
            {
                Document doc = m_editorPane.getDocument();
                try {
                    if (m_url != null) {
                        m_editorPane.setPage(m_url);
                    } else {
                    	this.setText(doc, m_strHtmlText);
                    }
                } catch (IOException ioe) {
                	String error = ioe.getLocalizedMessage();
                	if ((error != null)
                		&& (error.length() > 0))
                	{
                		String errorText = m_strHtmlErrorText;
                		if (errorText == null)
                			errorText = DEFAULT_ERROR_TEXT;
                		errorText = MessageFormat.format(errorText, m_url.toString(), error);
                    	this.setText(doc, errorText);
                	}
                	else
                		m_editorPane.setDocument(doc);
                    // getToolkit().beep();
                } finally {
                    // schedule the cursor to revert after
                    // the paint has happened.
                    m_url = null;
                    m_strHtmlText = null;
                    if (m_bChangeCursor)
                        SwingUtilities.invokeLater(this);
                }
            }
        }
    }
1360004
public void run()
    {
        Record record = this.getMainRecord();
        String strFileName = this.getProperty("filename");
        String strImport = this.getProperty("import");
        if (strFileName == null)
            strFileName = strImport;
        String strExport = this.getProperty("export");
        if (strFileName == null)
            strFileName = strExport;
        m_bOverwriteDups = false;
        if ((DBConstants.TRUE.equalsIgnoreCase(this.getProperty("overwritedups")))
            || (DBConstants.YES.equalsIgnoreCase(this.getProperty("overwritedups"))))
                m_bOverwriteDups = true;
        boolean bSuccess = false;
        if (strImport != null)
            bSuccess = this.importXML(record.getTable(), strFileName, null);
        else
            bSuccess = this.exportXML(record.getTable(), strFileName);
        if (!bSuccess)
            System.exit(1);
    }
1046250
def runWizard(self, parent):
        
        wizard = XScaffoldWizard(self._scaffold, parent)
        return wizard.exec_()
402496
def run(input, conf, filepath=None):
    
    if conf.is_file_ignored(filepath):
        return ()

    if isinstance(input, (type(b''), type(u''))):  # compat with Python 2 & 3
        return _run(input, conf, filepath)
    elif hasattr(input, 'read'):  # Python 2's file or Python 3's io.IOBase
        # We need to have everything in memory to parse correctly
        content = input.read()
        return _run(content, conf, filepath)
    else:
        raise TypeError('input should be a string or a stream')
983363
def run(self, root):
        " "
        self.markdown.images = []
        for image in root.getiterator("img"):
            self.markdown.images.append(image.attrib["src"])
492533
public void run() {

        try {
            CmsObject cms = m_moduleData.getCms();
            CmsModule module = m_moduleData.getModule();
            CmsModule oldModule = OpenCms.getModuleManager().getModule(module.getName());
            Map<CmsUUID, CmsUUID> conflictingIds = m_moduleData.getConflictingIds();
            if (!conflictingIds.isEmpty()) {
                deleteConflictingResources(cms, module, conflictingIds);
            }
            CmsProject importProject = createAndSetModuleImportProject(cms, module);
            CmsModuleImportExportHandler.reportBeginImport(m_report, module.getName());

            Map<CmsUUID, CmsResourceImportData> importResourcesById = new HashMap<>();
            for (CmsResourceImportData resData : m_moduleData.getResourceData()) {
                importResourcesById.put(resData.getResource().getStructureId(), resData);
            }
            Set<CmsResource> oldModuleResources = getAllResourcesInModule(cms, oldModule);
            List<CmsResource> toDelete = new ArrayList<>();
            Set<String> immutables = OpenCms.getImportExportManager().getImmutableResources().stream().flatMap(
                path -> Arrays.asList(
                    CmsFileUtil.removeTrailingSeparator(path),
                    CmsFileUtil.addTrailingSeparator(path)).stream()).collect(Collectors.toSet());
            for (CmsResource oldRes : oldModuleResources) {
                if (immutables.contains(oldRes.getRootPath())) {
                    continue;
                }
                CmsResourceImportData newRes = importResourcesById.get(oldRes.getStructureId());
                if (newRes == null) {
                    toDelete.add(oldRes);
                }
            }
            int index = 0;
            for (CmsResourceImportData resData1 : m_moduleData.getResourceData()) {
                index += 1;
                processImportResource(cms, resData1, index);
            }
            processDeletions(cms, toDelete);
            parseLinks(cms);

            importRelations(cms);
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(module.getImportScript())) {
                runImportScript(cms, module);
            }
            cms.unlockProject(importProject.getUuid());
            OpenCms.getModuleManager().updateModule(cms, module);
            module.setCheckpointTime(System.currentTimeMillis());
            // reinitialize the resource manager with additional module resource types if necessary
            if (module.getResourceTypes() != Collections.EMPTY_LIST) {
                OpenCms.getResourceManager().initialize(cms);
            }
            // reinitialize the workplace manager with additional module explorer types if necessary
            if (module.getExplorerTypes() != Collections.EMPTY_LIST) {
                OpenCms.getWorkplaceManager().addExplorerTypeSettings(module);
            }
            OpenCms.getPublishManager().publishProject(cms, m_report);
            OpenCms.getPublishManager().waitWhileRunning();
            CmsModuleImportExportHandler.reportEndImport(m_report);
        } catch (Exception e) {
            m_report.println(e);
        } finally {
            cleanUp();
        }
    }
547488
public void execute() throws BuildException
    {
    try
      {
      log( "Generating test cases for inputDef=" + options_.getInputDef());

      File logFile = getLogFile();
      if( logFile != null)
        {
        System.setProperty( "tcases.log.file", logFile.getAbsolutePath());
        log( "For details, see " + logFile.getAbsolutePath());
        }

      TcasesCommand.run( options_);
      }
    catch( Exception e)
      {
      throw new BuildException( e, getLocation());
      }
    }
385068
def run_parse(self):
        """"""
        # Data set already has source file names from load_inputs
        parsedset = {}
        parsedset['data_set'] = []
        for log in self.input_files:
            parsemodule = self.parse_modules[self.args.parser]
            try:
                if self.args.tzone:
                    parsemodule.tzone = self.args.tzone
            except NameError: pass
            parsedset['data_set'].append(parsemodule.parse_file(log))
        self.data_set = parsedset
        del(parsedset)
882540
def run_with(self, inputs, options):
        
        self._inputs = inputs
        self._options = options
869902
@SuppressWarnings("unchecked")
  public void run(RecordReader<K1, V1> input, OutputCollector<K2, V2> output,
                  Reporter reporter) throws IOException {
    Application<K1, V1, K2, V2> application = null;
    try {
      RecordReader<FloatWritable, NullWritable> fakeInput = 
        (!Submitter.getIsJavaRecordReader(job) && 
         !Submitter.getIsJavaMapper(job)) ? 
	  (RecordReader<FloatWritable, NullWritable>) input : null;
      application = new Application<K1, V1, K2, V2>(job, fakeInput, output, 
                                                    reporter,
          (Class<? extends K2>) job.getOutputKeyClass(), 
          (Class<? extends V2>) job.getOutputValueClass());
    } catch (InterruptedException ie) {
      throw new RuntimeException("interrupted", ie);
    }
    DownwardProtocol<K1, V1> downlink = application.getDownlink();
    boolean isJavaInput = Submitter.getIsJavaRecordReader(job);
    downlink.runMap(reporter.getInputSplit(), 
                    job.getNumReduceTasks(), isJavaInput);
    boolean skipping = job.getBoolean("mapred.skip.on", false);
    try {
      if (isJavaInput) {
        // allocate key & value instances that are re-used for all entries
        K1 key = input.createKey();
        V1 value = input.createValue();
        downlink.setInputTypes(key.getClass().getName(),
                               value.getClass().getName());
        
        while (input.next(key, value)) {
          // map pair to output
          downlink.mapItem(key, value);
          if(skipping) {
            //flush the streams on every record input if running in skip mode
            //so that we don't buffer other records surrounding a bad record.
            downlink.flush();
          }
        }
        downlink.endOfInput();
      }
      application.waitForFinish();
    } catch (Throwable t) {
      application.abort(t);
    } finally {
      application.cleanup();
    }
  }
1215767
public void validateWithXmlSchema(String filename, String xmlSchemaPath) throws IOException {
    try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
      if (xmlStream == null) {
        throw new IOException("File not found in classpath: " + filename);
      }
      URL schemaUrl = this.getClass().getResource(xmlSchemaPath);
      if (schemaUrl == null) {
        throw new IOException("XML schema not found in classpath: " + xmlSchemaPath);
      }
      validateInternal(new StreamSource(xmlStream), schemaUrl);
    } catch (Exception e) {
      throw new IOException("Cannot load or parse '" + filename + "'", e);
    }
  }
1003555
public void runWholeFilesetPasses(SoyFileSetNode soyTree, TemplateRegistry templateRegistry) {
    ImmutableList<SoyFileNode> sourceFiles = ImmutableList.copyOf(soyTree.getChildren());
    IdGenerator idGenerator = soyTree.getNodeIdGenerator();
    for (CompilerFileSetPass pass : crossTemplateCheckingPasses) {
      CompilerFileSetPass.Result result = pass.run(sourceFiles, idGenerator, templateRegistry);
      if (result == CompilerFileSetPass.Result.STOP) {
        break;
      }
    }
  }
135072
def run(self, context):
        """"""
        # Don't do something when running non-interactive.
        if not sys.stdout.isatty():
            return

        with local.cwd(context.in_container):
            from benchbuild.projects.gentoo import gentoo
            gentoo.setup_networking()
            gentoo.configure_portage()

            sed_in_chroot = uchroot.uchroot()["/bin/sed"]
            emerge_in_chroot = uchroot.uchroot()["/usr/bin/emerge"]
            has_pkg = uchroot.uchroot()["/usr/bin/qlist", "-I"]

            run.run(sed_in_chroot["-i", '/CC=/d', "/etc/portage/make.conf"])
            run.run(sed_in_chroot["-i", '/CXX=/d', "/etc/portage/make.conf"])

            want_sync = bool(CFG["container"]["strategy"]["polyjit"]["sync"])
            want_upgrade = bool(
                CFG["container"]["strategy"]["polyjit"]["upgrade"])

            packages = \
                CFG["container"]["strategy"]["polyjit"]["packages"].value
            with local.env(MAKEOPTS="-j{0}".format(int(CFG["jobs"]))):
                if want_sync:
                    LOG.debug("Synchronizing portage.")
                    run.run(emerge_in_chroot["--sync"])
                if want_upgrade:
                    LOG.debug("Upgrading world.")
                    run.run(emerge_in_chroot["--autounmask-only=y", "-uUDN",
                                             "--with-bdeps=y", "@world"])
                for pkg in packages:
                    if has_pkg[pkg["name"]] & TF:
                        continue
                    env = pkg["env"]
                    with local.env(**env):
                        run.run(emerge_in_chroot[pkg["name"]])

            gentoo.setup_benchbuild()

        print("Packing new container image.")
        with local.cwd(context.builddir):
            pack_container(context.in_container, context.out_container)