Basic test view.
761164
def index():
    """"""
    identity = g.identity
    actions = {}
    for action in access.actions.values():
        actions[action.value] = DynamicPermission(action).allows(identity)

    if current_user.is_anonymous:
        return render_template("invenio_access/open.html",
                               actions=actions,
                               identity=identity)
    else:
        return render_template("invenio_access/limited.html",
                               message='',
                               actions=actions,
                               identity=identity)
61600
def main():
    
    parser = argparse.ArgumentParser()
    sub_parser = parser.add_subparsers()

    lint_parser = sub_parser.add_parser('lint')
    lint_parser.set_defaults(func=lint)

    unit_test_parser = sub_parser.add_parser('unit-test')
    unit_test_parser.set_defaults(func=unit_test)

    test_suite_parser = sub_parser.add_parser('test-suite')
    test_suite_parser.set_defaults(func=test_suite)

    args, extra_args = parser.parse_known_args()

    if extra_args:
        args.func(extra_args)
    else:
        args.func()
509114
def sample_view(min_dist, max_dist=None):
  '''
  '''
  if max_dist is None:
    max_dist = min_dist
  dist = np.random.uniform(min_dist, max_dist)
  eye = np.random.normal(size=3)
  eye = normalize(eye)*dist
  return lookat(eye)
1157173
function View(template) {
  this.context = null;
  if (!template) template = this;
  this.template = template;
  if (!this.template.bindings) this.template.bindings = [];
  this.bindings = this.template.bindings.map(mapBinding.bind(this), this);

  this.firstViewNode = this.firstChild;
  this.lastViewNode = this.lastChild;
  if (this.firstViewNode) {
    this.firstViewNode.view = this;
    this.lastViewNode.view = this;
  }
}
426365
function() {
      while (JSLitmus._queue.length) {
        var test = JSLitmus._queue.shift();
        JSLitmus.renderTest(test);
      }
    }
1362848
def main(argv=None, directory=None):
    
    logging.basicConfig(format='%(message)s')

    argv = argv or sys.argv
    arg_dict = parse_coverage_args(argv[1:])
    GitPathTool.set_cwd(directory)
    fail_under = arg_dict.get('fail_under')
    percent_covered = generate_coverage_report(
        arg_dict['coverage_xml'],
        arg_dict['compare_branch'],
        html_report=arg_dict['html_report'],
        css_file=arg_dict['external_css_file'],
        ignore_staged=arg_dict['ignore_staged'],
        ignore_unstaged=arg_dict['ignore_unstaged'],
        exclude=arg_dict['exclude'],
        src_roots=arg_dict['src_roots'],
    )

    if percent_covered >= fail_under:
        return 0
    else:
        LOGGER.error("Failure. Coverage is below {}%.".format(fail_under))
        return 1
520175
function(test) {
      // Make a new row if needed
      if (!test._row) {
        var trow = jsl.$('test_row_template');
        if (!trow) return;

        test._row = trow.cloneNode(true);
        test._row.style.display = '';
        test._row.id = '';
        test._row.onclick = function() {JSLitmus._queueTest(test);};
        test._row.title = 'Run ' + test.name + ' test';
        trow.parentNode.appendChild(test._row);
        test._row.cells[0].innerHTML = test.name;
      }

      var cell = test._row.cells[1];
      var cns = [test.loopArg ? 'test_looping' : 'test_nonlooping'];

      if (test.error) {
        cns.push('test_error');
        cell.innerHTML =
        '<div class="error_head">' + test.error + '</div>' +
        '<ul class="error_body"><li>' +
          jsl.join(test.error, ': ', '</li><li>') +
          '</li></ul>';
      } else {
        if (test.running) {
          cns.push('test_running');
          cell.innerHTML = 'running';
        } else if (jsl.indexOf(JSLitmus._queue, test) >= 0) {
          cns.push('test_pending');
          cell.innerHTML = 'pending';
        } else if (test.count) {
          cns.push('test_done');
          var hz = test.getHz(jsl.$('test_normalize').checked);
          cell.innerHTML = hz != Infinity ? hz : '&infin;';
          cell.title = 'Looped ' + test.count + ' times in ' + test.time + ' seconds';
        } else {
          cell.innerHTML = 'ready';
        }
      }
      cell.className = cns.join(' ');
    }
377339
public function main()
    {
        $fail = $this->nestedConditionPresent() ? $this->testNestedCondition() :
            $this->testIfCondition() && $this->testUnlessCondition();

        if ($fail) {
            $text = null;
            if ($this->message !== null && strlen(trim($this->message)) > 0) {
                $text = trim($this->message);
            } else {
                if ($this->ifCondition !== null && $this->ifCondition !== "" && $this->testIfCondition()) {
                    $text = "if=" . $this->ifCondition;
                }
                if ($this->unlessCondition !== null && $this->unlessCondition !== "" && $this->testUnlessCondition()) {
                    if ($text === null) {
                        $text = "";
                    } else {
                        $text .= " and ";
                    }
                    $text .= "unless=" . $this->unlessCondition;
                }
                if ($this->nestedConditionPresent()) {
                    $text = "condition satisfied";
                } else {
                    if ($text === null) {
                        $text = "No message";
                    }
                }
            }

            $this->log("failing due to " . $text, Project::MSG_DEBUG);
            if ($this->status === null) {
                throw new BuildException($text);
            }

            throw new ExitStatusException($text, $this->status);
        }
    }
58284
def application_view(&block)
      template = read_file('layout/application', 'haml')
      Haml::Engine.new(template).render(self, &block)
    end
165371
def main():
    ''''''
    args = docopt(__doc__, version=__version__)

    if 'bam_coverage' in args:
        bam_coverage(args['<reference>'],
                     args['<alignments>'],
                     int(args['<minmatch>']),
                     min_mapq=int(args['--mapq']),
                     min_len=float(args['--minlen']))
524382
def main():
    """"""
    table = """<table>
    <thead>
    <tr><th>First Name</th><th>Last Name</th></tr>
    </thead>
    <tbody>
    <tr><td>Paul</td><td>McGrath</td></tr>
    <tr><td>Liam</td><td>Brady</td></tr>
    <tr><td>John</td><td>Giles</td></tr>
    </tbody>
    </table>"""
    docraptor = DocRaptor()

    print("Create test_basic.xls")
    with open("test_basic.xls", "wb") as pdf_file:
        pdf_file.write(
            docraptor.create(
                {"document_content": table, "document_type": "xls", "test": True}
            ).content
        )
242418
def main(argv=sys.argv, stream=sys.stderr):
    """"""
    args = parse_args(argv)
    suite = build_suite(args)
    runner = unittest.TextTestRunner(verbosity=args.verbose, stream=stream)
    result = runner.run(suite)

    return get_status(result)
786959
def preview(self, argv):
        """"""
        opts = cmdline(argv, FLAGS_RESULTS)
        self.foreach(opts.args, lambda job: 
            output(job.preview(**opts.kwargs)))
765215
function View(context, type, parentView, data, template, key, onRender) {
		// Constructor for view object in view hierarchy. (Augmented by JsViews if JsViews is loaded)
		var views, parentView_,
			isArray = type === "array",
			self_ = {
				key: 0,
				useKey: isArray ? 0 : 1,
				id: "" + viewId++,
				onRender: onRender,
				bnd: {}
			},
			self = {
				data: data,
				tmpl: template,
				views: isArray ? [] : {},
				parent: parentView,
				ctx: context,
				type: type,
				// If the data is an array, this is an 'array view' with a views array for each child 'item view'
				// If the data is not an array, this is an 'item view' with a views 'map' object for any child nested views
				// ._.useKey is non zero if is not an 'array view' (owning a data array). Uuse this as next key for adding to child views map
				get: getView,
				getIndex: getIndex,
				getRsc: getResource,
				hlp: getHelper,
				_: self_
		};

		if (parentView) {
			views = parentView.views;
			parentView_ = parentView._;
			if (parentView_.useKey) {
				// Parent is an 'item view'. Add this view to its views object
				// self._key = is the key in the parent view map
				views[self_.key = "_" + parentView_.useKey++] = self;
			} else {
				// Parent is an 'array view'. Add this view to its views array
				views.splice(
					// self._.key = self.index - the index in the parent view array
					self_.key = self.index =
						key !== undefined
							? key
							: views.length,
				0, self);
			}
			// If no context was passed in, use parent context
			// If context was passed in, it should have been merged already with parent context
			self.ctx = context || parentView.ctx;
		}
		return self;
	}
732471
public function main()
    {
        if ($this->codecoverage && !extension_loaded('xdebug')) {
            throw new Exception("PHPUnitTask depends on Xdebug being installed to gather code coverage information.");
        }

        $this->loadPHPUnit();

        if (class_exists('\PHPUnit_Framework_TestSuite')) {
            $suite = new PHPUnit_Framework_TestSuite('AllTests');
        } else {
            $suite = new \PHPUnit\Framework\TestSuite('AllTests');
        }

        $autoloadSave = spl_autoload_functions();

        if ($this->bootstrap) {
            include $this->bootstrap;
        }

        if ($this->configuration) {
            $arguments = $this->handlePHPUnitConfiguration($this->configuration);

            if ($arguments['backupGlobals'] === false) {
                $suite->setBackupGlobals(false);
            }

            if ($arguments['backupStaticAttributes'] === true) {
                $suite->setBackupStaticAttributes(true);
            }
        }

        if ($this->printsummary) {
            $fe = new FormatterElement();
            $fe->setParent($this);
            $fe->setType("summary");
            $fe->setUseFile(false);
            $this->formatters[] = $fe;
        }

        foreach ($this->batchtests as $batchTest) {
            $this->appendBatchTestToTestSuite($batchTest, $suite);
        }

        $this->execute($suite);

        if ($this->testfailed) {
            throw new BuildException($this->testfailuremessage);
        }

        $autoloadNew = spl_autoload_functions();
        if (is_array($autoloadNew)) {
            foreach ($autoloadNew as $autoload) {
                spl_autoload_unregister($autoload);
            }
        }

        if (is_array($autoloadSave)) {
            foreach ($autoloadSave as $autoload) {
                spl_autoload_register($autoload);
            }
        }
    }
69737
public void showView(Modality modality) {
        if (! isPrimaryStageView && (stage == null || currentStageModality != modality)) {
            stage = createStage(modality);
        }
        stage.show();
    }
1048124
def main(model_folder):
    """"""
    model_description_file = os.path.join(model_folder, "info.yml")

    # Read the model description file
    with open(model_description_file, 'r') as ymlfile:
        model_description = yaml.load(ymlfile)

    # Analyze model
    logging.info(model_description['model'])
    data = {}
    data['training'] = os.path.join(model_folder, "traindata.hdf5")
    data['testing'] = os.path.join(model_folder, "testdata.hdf5")
    data['validating'] = os.path.join(model_folder, "validdata.hdf5")
    train_model(model_folder)