text
stringlengths 2
1.04M
| meta
dict |
---|---|
utils.extend(CanvasRenderingContext2D.prototype, {
fillOverlapText:function(text, x, y, hook) {
var canvas = this;
var width = this.measureText(text).width;
var height = parseInt(/^(\d*)px.*$/i.exec(this.font)[1]);
if(hook !== undefined) {
hook.call(this, x, y, width, height);
}
this.drawOverlap(function(x, y){canvas.fillText(text, x, y + height / 2);},
{x:x, y:y, width:width, height:height});
},
drawOverlap:function(drawFunc, bounderies) {
var positions = overlap.determine(bounderies, this.canvas);
drawFunc(bounderies.x, bounderies.y);
for(var index in positions) {
drawFunc(positions[index].x, positions[index].y);
}
},
}); | {
"content_hash": "cfdf9300970788f537cd52a2f852de1c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 80,
"avg_line_length": 30.083333333333332,
"alnum_prop": 0.6218836565096952,
"repo_name": "jtkDvlp/patternGen",
"id": "dc84605296109ae39dc59764b701e1d10bc656ab",
"size": "722",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "canvas.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "8696"
}
],
"symlink_target": ""
} |
declare namespace Jymfony.Component.DateTime.Exception {
export class UnknownTimeZoneException extends global.Exception {
}
}
| {
"content_hash": "9923fb6fef082974ac5b981a622c4e5e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 68,
"avg_line_length": 33.5,
"alnum_prop": 0.7910447761194029,
"repo_name": "jymfony/jymfony",
"id": "fde91d0f3585ecd5e5e5692c8d88c6065380f4a5",
"size": "134",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/Component/DateTime/types/Exception/UnknownTimeZoneException.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16998"
},
{
"name": "JavaScript",
"bytes": "11149225"
},
{
"name": "TypeScript",
"bytes": "566"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_20) on Thu Feb 24 01:10:10 PST 2011 -->
<TITLE>
Uses of Class org.apache.hadoop.io.compress.CompressorStream (Hadoop 0.20.2-cdh3u0-SNAPSHOT API)
</TITLE>
<META NAME="date" CONTENT="2011-02-24">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.io.compress.CompressorStream (Hadoop 0.20.2-cdh3u0-SNAPSHOT API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/hadoop/io/compress//class-useCompressorStream.html" target="_top"><B>FRAMES</B></A>
<A HREF="CompressorStream.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.io.compress.CompressorStream</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress">CompressorStream</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.io.compress"><B>org.apache.hadoop.io.compress</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.io.compress"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress">CompressorStream</A> in <A HREF="../../../../../../org/apache/hadoop/io/compress/package-summary.html">org.apache.hadoop.io.compress</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress">CompressorStream</A> in <A HREF="../../../../../../org/apache/hadoop/io/compress/package-summary.html">org.apache.hadoop.io.compress</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/compress/BlockCompressorStream.html" title="class in org.apache.hadoop.io.compress">BlockCompressorStream</A></B></CODE>
<BR>
A <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress"><CODE>CompressorStream</CODE></A> which works
with 'block-based' based compression algorithms, as opposed to
'stream-based' compression algorithms.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected static class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/compress/GzipCodec.GzipOutputStream.html" title="class in org.apache.hadoop.io.compress">GzipCodec.GzipOutputStream</A></B></CODE>
<BR>
A bridge that wraps around a DeflaterOutputStream to make it
a CompressionOutputStream.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../../../org/apache/hadoop/io/compress/package-summary.html">org.apache.hadoop.io.compress</A> with parameters of type <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress">CompressorStream</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/compress/GzipCodec.GzipOutputStream.html#GzipCodec.GzipOutputStream(org.apache.hadoop.io.compress.CompressorStream)">GzipCodec.GzipOutputStream</A></B>(<A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress">CompressorStream</A> out)</CODE>
<BR>
Allow children types to put a different type in here.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/io/compress/CompressorStream.html" title="class in org.apache.hadoop.io.compress"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/hadoop/io/compress//class-useCompressorStream.html" target="_top"><B>FRAMES</B></A>
<A HREF="CompressorStream.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
| {
"content_hash": "24e095bfffa14e9553e469282931ba81",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 377,
"avg_line_length": 48.19024390243902,
"alnum_prop": 0.6418665856868104,
"repo_name": "simplegeo/hadoop",
"id": "2f10786bc10e03ec21ff0e3932d189a87a1bd649",
"size": "9879",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/api/org/apache/hadoop/io/compress/class-use/CompressorStream.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "410770"
},
{
"name": "C++",
"bytes": "387188"
},
{
"name": "Java",
"bytes": "14645413"
},
{
"name": "JavaScript",
"bytes": "112012"
},
{
"name": "Objective-C",
"bytes": "112020"
},
{
"name": "PHP",
"bytes": "152555"
},
{
"name": "Perl",
"bytes": "149888"
},
{
"name": "Python",
"bytes": "1162926"
},
{
"name": "Ruby",
"bytes": "28485"
},
{
"name": "Shell",
"bytes": "1625326"
},
{
"name": "Smalltalk",
"bytes": "56562"
}
],
"symlink_target": ""
} |
a, .outline-btn, .btn-link, .owl-nav > div:hover:after,
header .navbar-default .navbar-nav li.active a, header .navbar-default .navbar-nav li.active a:hover, header .navbar-default .navbar-nav li.active a:focus,
header #navigation .navbar-default .navbar-nav li ul.sub-menu li a:hover, header #navigation .navbar-default .navbar-nav li ul.children li a:hover,
.navbar.navbar-default #navigation .nav.navbar-nav li > a:hover, .listing_info a:hover, .post_category a, .post_info a:hover, .footer_nav ul li a:hover, .icon_div, .plan_price, .office_info_box a:hover, .meta_m .fa, .meta_m a:hover, .sidebar_widgets ul li a:hover, .entry-desc h3 a:hover, .info_m h6 a:hover, .comment-meta.commentmetadata a:hover,
.listing_price span, p.listing_like .fa, .listing_favorites .fa, .listing_favorites a:hover, .listing_favorites a:focus, p.listing_favorites .fa, p.listing_favorites a:hover, p.listing_favorites a:focus, p.listing_like a:hover, p.listing_like a:focus {
color:#6054c2;
fill: #6054c2;
}
a:hover, a:focus, #amenities ul li a:hover, .btn-link:focus, .btn-link:hover {
color:#36299f;
fill: #36299f
}
.btn, .primary-bg, .owl-dots .owl-dot.active span, .owl-dots .owl-dot:hover span, .header_solidbg .submit_listing .btn, #category_slider .item:hover, .review_score, .like_post:hover, .featured_label, .listing_cate span.listing_like, .post_category a:hover, .follow_us ul li a:hover, .category_listing_n, .layout-switcher a.active, .layout-switcher a:hover, .widget_title::after, .post_tag a:hover, #view_map:hover, .demo_changer .demo-icon,
.pagination > .active > a, .pagination > .active > a:focus, .pagination > .active > a:hover, .pagination > .active > span, .pagination > .active > span:focus, .pagination > .active > span:hover, .pagination > li > a:focus, .pagination > li > a:hover, .pagination > li > span:focus, .pagination > li > span:hover {
background:#6054c2;
fill: #6054c2;
}
.btn:hover, .btn:focus, .social_links a {
background-color:#36299f;
fill: #36299f;
}
.outline-btn, .owl-dots .owl-dot.active span, .owl-dots .owl-dot:hover span, .header_solidbg .submit_listing .btn, .post_category a, #view_map:hover:after, #view_map:hover:before, .listing_favorites .fa, p.listing_like .fa, .share_listing a, .submit_listing .btn:hover, .marker-container:hover .face.front, .clicked .marker-container .face.front {
border-color:#6054c2;
}
.form-control:focus, form input:focus, form textarea:focus, form select:focus {
outline-color:#6054c2;
}
.post_category a {
color:#6054c2 !important;
fill: #6054c2;
}
.marker-arrow {
border-top-color:#6054c2;
} | {
"content_hash": "17a944c9007c040f03df4d5d4fdefde0",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 441,
"avg_line_length": 77.23529411764706,
"alnum_prop": 0.7090632140137091,
"repo_name": "MikeLockz/safe-exchange",
"id": "3d9f975394b17a0207fe7e40a8cc20d7e053912e",
"size": "2626",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/views/assets/css/colors/purple.css",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "234765"
},
{
"name": "HTML",
"bytes": "74056"
},
{
"name": "JavaScript",
"bytes": "292043"
}
],
"symlink_target": ""
} |
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, Link, hashHistory } from 'react-router'
import App from './App';
import Repo from './RepoPanel';
import RepoOps from './RepoOps';
import CommitTree from './CommitTreePanel';
import StagingArea from './StagingAreaPanel';
const Routes = (
<Route path="/" component={App} >
<Route path='/repo' component={Repo} />
<Route path='/repoOps' component={RepoOps} >
<Route path='/repoOps/commitTree' component={CommitTree} />
<Route path='/repoOps/stagingArea' component={StagingArea} />
</Route>
</Route>);
ReactDOM.render(
<Router history={hashHistory}>
{Routes}
</Router>,
document.getElementById('app')
);
| {
"content_hash": "65bb7a76b9bc007cf4e8268bf036d83c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 69,
"avg_line_length": 27.48148148148148,
"alnum_prop": 0.6671159029649596,
"repo_name": "cynicaldevil/gitrobotic",
"id": "422b8b7d839700d4678fa458ff92b1be61852621",
"size": "742",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/main.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "548"
},
{
"name": "JavaScript",
"bytes": "71986"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Trees shrubs Japan ed. 2:665, fig. 300. 1927
#### Original name
null
### Remarks
null | {
"content_hash": "b8b002631eca0c02322a23f9768b365e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 44,
"avg_line_length": 13.384615384615385,
"alnum_prop": 0.6954022988505747,
"repo_name": "mdoering/backbone",
"id": "8d719e325608da575eba537873ea6341a2e0c0be",
"size": "249",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Dipsacales/Caprifoliaceae/Lonicera/Lonicera caerulea/Lonicera caerulea emphyllocalyx/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
namespace Zilf\Console;
use Illuminate\Console\GeneratorCommand;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputOption;
class PolicyMakeCommand extends GeneratorCommand
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'make:policy';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new policy class';
/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Policy';
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = $this->replaceUserNamespace(
parent::buildClass($name)
);
$model = $this->option('model');
return $model ? $this->replaceModel($stub, $model) : $stub;
}
/**
* Replace the User model namespace.
*
* @param string $stub
* @return string
*/
protected function replaceUserNamespace($stub)
{
$model = $this->userProviderModel();
if (! $model) {
return $stub;
}
return str_replace(
$this->rootNamespace().'User',
$model,
$stub
);
}
/**
* Replace the model for the given stub.
*
* @param string $stub
* @param string $model
* @return string
*/
protected function replaceModel($stub, $model)
{
$model = str_replace('/', '\\', $model);
$namespaceModel = $this->laravel->getNamespace().$model;
if (Str::startsWith($model, '\\')) {
$stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
} else {
$stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
}
$stub = str_replace(
"use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
);
$model = class_basename(trim($model, '\\'));
$dummyUser = class_basename($this->userProviderModel());
$dummyModel = Str::camel($model) === 'user' ? 'model' : $model;
$stub = str_replace('DocDummyModel', Str::snake($dummyModel, ' '), $stub);
$stub = str_replace('DummyModel', $model, $stub);
$stub = str_replace('dummyModel', Str::camel($dummyModel), $stub);
$stub = str_replace('DummyUser', $dummyUser, $stub);
return str_replace('DocDummyPluralModel', Str::snake(Str::pluralStudly($dummyModel), ' '), $stub);
}
/**
* Get the stub file for the generator.
*
* @return string
*/
protected function getStub()
{
return $this->option('model')
? __DIR__.'/stubs/policy.stub'
: __DIR__.'/stubs/policy.plain.stub';
}
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Policies';
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getOptions()
{
return [
['model', 'm', InputOption::VALUE_OPTIONAL, 'The model that the policy applies to'],
];
}
}
| {
"content_hash": "91cb281cb79d5a082b611e1147a0c178",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 106,
"avg_line_length": 23.805555555555557,
"alnum_prop": 0.5396732788798133,
"repo_name": "txj123/zilf",
"id": "79d60e68f3444fd5e55876a92f650fc932bf39e8",
"size": "3428",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Zilf/Console/PolicyMakeCommand.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "15635"
},
{
"name": "JavaScript",
"bytes": "2966"
},
{
"name": "PHP",
"bytes": "2094306"
},
{
"name": "Vue",
"bytes": "552"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "1146a1253f781b837b3980ce276eac5b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "f7079b005b26ad2c83a69068c39e61622341f017",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Apocynaceae/Vincetoxicum/Vincetoxicum calcicola/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.advancedpwr.record;
public interface ObjectRecorder
{
public abstract <T> T record( T inObject );
} | {
"content_hash": "9144eff296a86bc7bdcfb4b87156153f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 11.8,
"alnum_prop": 0.7372881355932204,
"repo_name": "hani/jtor",
"id": "4267e3a0d38100d1e817915f88fea64d9ff54d74",
"size": "741",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/com/advancedpwr/record/ObjectRecorder.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "398"
},
{
"name": "Java",
"bytes": "185571"
},
{
"name": "JavaScript",
"bytes": "388"
},
{
"name": "Shell",
"bytes": "5079"
}
],
"symlink_target": ""
} |
"""
A simple gauge with a label that is suitable for use in places like a
status bar. It can be used in either an automatic indeterminant
(pulse) mode or in determinante mode where the programmer will need to
update the position of the progress bar. The indicator can be set to
hide itself when it is not active.
"""
import wx
#----------------------------------------------------------------------
# Supported Styles
PI_PULSEMODE = 1
PI_HIDEINACTIVE = 2
#----------------------------------------------------------------------
class ProgressIndicator(wx.Panel):
def __init__(self, *args, **kw):
wx.Panel.__init__(self, *args, **kw)
self.label = wx.StaticText(self)
self.gauge = wx.Gauge(self, range=100,
style=wx.GA_HORIZONTAL|wx.GA_SMOOTH)
self._startCount = 0
self.Sizer = wx.BoxSizer(wx.HORIZONTAL)
self.Sizer.Add(self.label, 0, wx.ALIGN_CENTER_VERTICAL)
self.Sizer.Add(self.gauge, 1, wx.EXPAND)
size = wx.DefaultSize
if kw.has_key('size'):
size = kw['size']
elif len(args) >= 4:
size=args[3] # parent, id, pos, size, style, name
self.SetInitialSize(size)
if self.HasFlag(PI_PULSEMODE):
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.onTimer)
if self.HasFlag(PI_HIDEINACTIVE):
self.Hide()
def __del__(self):
if hasattr(self, 'timer'):
self.timer.Stop()
del self.timer
def Start(self, label=None):
"""
Show (if necessary) and begin displaying progress
"""
self._startCount += 1
if label is not None:
self.SetLabel(label)
if self.HasFlag(PI_HIDEINACTIVE):
self.Show()
self.Layout()
if self.HasFlag(PI_PULSEMODE):
self.gauge.Pulse()
self.timer.Start(250)
else:
self.gauge.SetValue(0)
def Stop(self, clearLabel=False):
"""
Stop showing progress
"""
# Make sure Stop is called as many times as Start was. Only really
# stop when the count reaches zero.
if self._startCount == 0:
return # should be already stopped...
self._startCount -= 1
if self._startCount:
return # there's still more starts than stops...
if self.HasFlag(PI_HIDEINACTIVE):
self.Hide()
if self.HasFlag(PI_PULSEMODE):
self.timer.Stop()
if clearLabel:
self.label.SetLabel("")
def SetLabel(self, text):
"""
Set the text displayed in the label.
"""
self.label.SetLabel(text)
self.Layout()
def SetValue(self, value, label=None):
"""
For determinante mode (non-pulse) update the progress indicator to the
given value. For example, if the job is 45% done then pass 45 to this
method (as long as the range is still set to 100.)
"""
if label is not None:
self.SetLabel(label)
self.gauge.SetValue(value)
def SetRange(self, maxval):
"""
For determinante mode (non-pulse) set the max value that the gauge can
be set to. Defaults to 100.
"""
self.gauge.SetRange(maxval)
def onTimer(self, evt):
self.gauge.Pulse()
#----------------------------------------------------------------------
if __name__ == '__main__':
app = wx.App(redirect=False)
frm = wx.Frame(None, title="ProgressIndicator")
pnl = wx.Panel(frm)
pi1 = ProgressIndicator(pnl, pos=(20,20), size=(150,-1),
style=PI_HIDEINACTIVE|PI_PULSEMODE)
pi2 = ProgressIndicator(pnl, pos=(20,60), size=(150,-1),
style=PI_HIDEINACTIVE)
import wx.lib.inspection
wx.lib.inspection.InspectionTool().Show()
frm.Show()
app.MainLoop()
| {
"content_hash": "fc97d47278b3e12da3b310c57aba158c",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 78,
"avg_line_length": 30.382978723404257,
"alnum_prop": 0.4992997198879552,
"repo_name": "ktan2020/legacy-automation",
"id": "30ab13edf8c885d1e41419bc99095d636bf9aa92",
"size": "4657",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "win/Lib/site-packages/wx-3.0-msw/wx/lib/progressindicator.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "913"
},
{
"name": "Ada",
"bytes": "289"
},
{
"name": "Assembly",
"bytes": "687"
},
{
"name": "Boo",
"bytes": "540"
},
{
"name": "C",
"bytes": "40116"
},
{
"name": "C#",
"bytes": "474"
},
{
"name": "C++",
"bytes": "393"
},
{
"name": "CSS",
"bytes": "70883"
},
{
"name": "ColdFusion",
"bytes": "1012"
},
{
"name": "Common Lisp",
"bytes": "1034"
},
{
"name": "D",
"bytes": "1858"
},
{
"name": "Eiffel",
"bytes": "426"
},
{
"name": "Erlang",
"bytes": "9243"
},
{
"name": "FORTRAN",
"bytes": "1810"
},
{
"name": "Forth",
"bytes": "182"
},
{
"name": "Groovy",
"bytes": "2366"
},
{
"name": "Haskell",
"bytes": "816"
},
{
"name": "Haxe",
"bytes": "455"
},
{
"name": "Java",
"bytes": "1155"
},
{
"name": "JavaScript",
"bytes": "69444"
},
{
"name": "Lua",
"bytes": "795"
},
{
"name": "Matlab",
"bytes": "1278"
},
{
"name": "OCaml",
"bytes": "350"
},
{
"name": "Objective-C++",
"bytes": "885"
},
{
"name": "PHP",
"bytes": "1411"
},
{
"name": "Pascal",
"bytes": "388"
},
{
"name": "Perl",
"bytes": "252651"
},
{
"name": "Pike",
"bytes": "589"
},
{
"name": "Python",
"bytes": "42085780"
},
{
"name": "R",
"bytes": "1156"
},
{
"name": "Ruby",
"bytes": "480"
},
{
"name": "Scheme",
"bytes": "282"
},
{
"name": "Shell",
"bytes": "30518"
},
{
"name": "Smalltalk",
"bytes": "926"
},
{
"name": "Squirrel",
"bytes": "697"
},
{
"name": "Stata",
"bytes": "302"
},
{
"name": "SystemVerilog",
"bytes": "3145"
},
{
"name": "Tcl",
"bytes": "1039"
},
{
"name": "TeX",
"bytes": "1746"
},
{
"name": "VHDL",
"bytes": "985"
},
{
"name": "Vala",
"bytes": "664"
},
{
"name": "Verilog",
"bytes": "439"
},
{
"name": "Visual Basic",
"bytes": "2142"
},
{
"name": "XSLT",
"bytes": "152770"
},
{
"name": "ooc",
"bytes": "890"
},
{
"name": "xBase",
"bytes": "769"
}
],
"symlink_target": ""
} |
[javascript-redux-generating-containers-with-connect-from-react-redux-visibletodolist](https://egghead.io/lessons/javascript-redux-generating-containers-with-connect-from-react-redux-visibletodolist)
### note bug
- target is not a DOM element => DOM haven't rendered
- Unknown DOM property class. Did you mean className. => use className in ReactJS ,not class for css.
- Cannot read property 'setState' of undefined , => this.state = {} on constructor
- performUpdateIfNecessary: Unexpected batch number
1. React elements are immutable.
2. **pure** never change prop , and Props are read-only
3. one-way data flow (also called one-way binding)
### basic
ReactDom.render
function == Component
class way
### === this.prop ===
input parameters from element attribute or ?
prop.children => sub elements in array
### === this.state ===
component statement
State is reserved only for interactivity. Don't use state at all to build this static version.
##### this.setState()
https://facebook.github.io/react/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous
use `this.setState((prevState, props) => ({ counter: prevState.counter + props.increment }));` , and this.setState is left merge.
##### life state up
two or more component need this value , you need to take it up to ancestor.
### === HOW TO prevent render this component ===
return null instead of return component
### === list component ===
to create list of component
```javascript
function NumberList(props) {
const numbers = props.numbers;
const listItems = numbers.map((number) =>
<li key={number.toString()}>
{number}
</li>
);
return (
<ul>{listItems}</ul>
);
}
```
##### what is key
help React identify which items have changed , added , and removed. So the best key for each is unique. You can use index as well, but not recommended. because it'll be slow [in-depth explanation about why keys are necessary ](https://facebook.github.io/react/docs/reconciliation.html#recursing-on-children)
key don't pass it to this.prop value | {
"content_hash": "9d143455599865cd8675cf79b9300cf1",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 309,
"avg_line_length": 30.671641791044777,
"alnum_prop": 0.7250608272506083,
"repo_name": "BizShuk/code_sandbox",
"id": "9f6d1cefcba6e9a47e91e4bb99fad619d7771bd7",
"size": "2067",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "js/ReactJS.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "51783"
},
{
"name": "CSS",
"bytes": "495"
},
{
"name": "Go",
"bytes": "14706"
},
{
"name": "HTML",
"bytes": "708"
},
{
"name": "Java",
"bytes": "358"
},
{
"name": "JavaScript",
"bytes": "26768"
},
{
"name": "Lua",
"bytes": "1108"
},
{
"name": "Makefile",
"bytes": "576"
},
{
"name": "PHP",
"bytes": "8912"
},
{
"name": "Python",
"bytes": "23981"
},
{
"name": "Shell",
"bytes": "115"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "a4a28211c455dd42f8fd73f22108f81d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "9036a7ad142b0fba2960adbe5779ae946e4c914a",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Ainsliaea apiculata/ Syn. Ainsliaea liukiuensis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#include<sstream>
#include"ast.h"
#include"ast_pp.h"
#include"ast_ll_pp.h"
#include"buffer.h"
#include"warning.h"
#include"string_buffer.h"
#include"ast_util.h"
#include"ast_smt2_pp.h"
// -----------------------------------
//
// parameter
//
// -----------------------------------
parameter::~parameter() {
if (m_kind == PARAM_RATIONAL) {
reinterpret_cast<rational *>(m_rational)->~rational();
}
}
parameter::parameter(parameter const& other) {
m_kind = PARAM_INT;
m_int = 0;
*this = other;
}
parameter& parameter::operator=(parameter const& other) {
if (this == &other) {
return *this;
}
if (m_kind == PARAM_RATIONAL) {
reinterpret_cast<rational *>(m_rational)->~rational();
}
m_kind = other.m_kind;
switch(other.m_kind) {
case PARAM_INT: m_int = other.get_int(); break;
case PARAM_AST: m_ast = other.get_ast(); break;
case PARAM_SYMBOL: new (m_symbol) symbol(other.get_symbol()); break;
case PARAM_RATIONAL: new (m_rational) rational(other.get_rational()); break;
case PARAM_DOUBLE: m_dval = other.m_dval; break;
case PARAM_EXTERNAL: m_ext_id = other.m_ext_id; break;
default:
UNREACHABLE();
break;
}
return *this;
}
void parameter::init_eh(ast_manager & m) {
if (is_ast()) {
m.inc_ref(get_ast());
}
}
void parameter::del_eh(ast_manager & m, family_id fid) {
if (is_ast()) {
m.dec_ref(get_ast());
}
else if (is_external()) {
SASSERT(fid != null_family_id);
m.get_plugin(fid)->del(*this);
}
}
bool parameter::operator==(parameter const & p) const {
if (m_kind != p.m_kind) return false;
switch(m_kind) {
case PARAM_INT: return m_int == p.m_int;
case PARAM_AST: return m_ast == p.m_ast;
case PARAM_SYMBOL: return get_symbol() == p.get_symbol();
case PARAM_RATIONAL: return get_rational() == p.get_rational();
case PARAM_DOUBLE: return m_dval == p.m_dval;
case PARAM_EXTERNAL: return m_ext_id == p.m_ext_id;
default: UNREACHABLE(); return false;
}
}
unsigned parameter::hash() const {
unsigned b = 0;
switch(m_kind) {
case PARAM_INT: b = m_int; break;
case PARAM_AST: b = m_ast->hash(); break;
case PARAM_SYMBOL: b = get_symbol().hash(); break;
case PARAM_RATIONAL: b = get_rational().hash(); break;
case PARAM_DOUBLE: b = static_cast<unsigned>(m_dval); break;
case PARAM_EXTERNAL: b = m_ext_id; break;
}
return (b << 2) | m_kind;
}
std::ostream& parameter::display(std::ostream& out) const {
switch(m_kind) {
case PARAM_INT: return out << get_int();
case PARAM_SYMBOL: return out << get_symbol();
case PARAM_RATIONAL: return out << get_rational();
case PARAM_AST: return out << "#" << get_ast()->get_id();
case PARAM_DOUBLE: return out << m_dval;
case PARAM_EXTERNAL: return out << "@" << m_ext_id;
default:
UNREACHABLE();
return out << "[invalid parameter]";
}
}
void display_parameters(std::ostream & out, unsigned n, parameter const * p) {
if (n > 0) {
out << "[";
for (unsigned i = 0; i < n; i ++)
out << p[i] << (i < n-1 ? ":" : "");
out << "]";
}
}
// -----------------------------------
//
// family_manager
//
// -----------------------------------
family_id family_manager::mk_family_id(symbol const & s) {
family_id r;
if (m_families.find(s, r)) {
return r;
}
r = m_next_id;
m_next_id++;
m_families.insert(s, r);
m_names.push_back(s);
return r;
}
family_id family_manager::get_family_id(symbol const & s) const {
family_id r;
if (m_families.find(s, r))
return r;
else
return null_family_id;
}
bool family_manager::has_family(symbol const & s) const {
return m_families.contains(s);
}
// -----------------------------------
//
// decl_info
//
// -----------------------------------
decl_info::decl_info(family_id family_id, decl_kind k, unsigned num_parameters,
parameter const * parameters, bool private_params):
m_family_id(family_id),
m_kind(k),
m_parameters(num_parameters, const_cast<parameter *>(parameters)),
m_private_parameters(private_params) {
}
decl_info::decl_info(decl_info const& other) :
m_family_id(other.m_family_id),
m_kind(other.m_kind),
m_parameters(other.m_parameters.size(), other.m_parameters.c_ptr()),
m_private_parameters(other.m_private_parameters) {
}
void decl_info::init_eh(ast_manager & m) {
vector<parameter>::iterator it = m_parameters.begin();
vector<parameter>::iterator end = m_parameters.end();
for (; it != end; ++it) {
it->init_eh(m);
}
}
void decl_info::del_eh(ast_manager & m) {
vector<parameter>::iterator it = m_parameters.begin();
vector<parameter>::iterator end = m_parameters.end();
for (; it != end; ++it) {
it->del_eh(m, m_family_id);
}
}
struct decl_info_child_hash_proc {
unsigned operator()(decl_info const * info, unsigned idx) const { return info->get_parameter(idx).hash(); }
};
unsigned decl_info::hash() const {
unsigned a = m_family_id;
unsigned b = m_kind;
unsigned c = get_num_parameters() == 0 ? 0 : get_composite_hash<decl_info const *, default_kind_hash_proc<decl_info const *>, decl_info_child_hash_proc>(this, get_num_parameters());
mix(a, b, c);
return c;
}
bool decl_info::operator==(decl_info const & info) const {
return m_family_id == info.m_family_id && m_kind == info.m_kind &&
compare_arrays<parameter>(m_parameters.begin(), info.m_parameters.begin(), m_parameters.size());
}
std::ostream & operator<<(std::ostream & out, decl_info const & info) {
out << ":fid " << info.get_family_id() << " :decl-kind " << info.get_decl_kind() << " :parameters (";
for (unsigned i = 0; i < info.get_num_parameters(); i++) {
if (i > 0) out << " ";
out << info.get_parameter(i);
}
out << ")";
return out;
}
// -----------------------------------
//
// sort_size
//
// -----------------------------------
std::ostream& operator<<(std::ostream& out, sort_size const & ss) {
if (ss.is_infinite()) { return out << "infinite"; }
else if (ss.is_very_big()) { return out << "very-big"; }
else { SASSERT(ss.is_finite()); return out << ss.size(); }
}
// -----------------------------------
//
// sort_info
//
// -----------------------------------
std::ostream & operator<<(std::ostream & out, sort_info const & info) {
operator<<(out, static_cast<decl_info const&>(info));
out << " :size " << info.get_num_elements();
return out;
}
// -----------------------------------
//
// func_decl_info
//
// -----------------------------------
func_decl_info::func_decl_info(family_id family_id, decl_kind k, unsigned num_parameters, parameter const * parameters):
decl_info(family_id, k, num_parameters, parameters),
m_left_assoc(false),
m_right_assoc(false),
m_flat_associative(false),
m_commutative(false),
m_chainable(false),
m_pairwise(false),
m_injective(false),
m_idempotent(false),
m_skolem(false) {
}
bool func_decl_info::operator==(func_decl_info const & info) const {
return decl_info::operator==(info) &&
m_left_assoc == info.m_left_assoc &&
m_right_assoc == info.m_right_assoc &&
m_flat_associative == info.m_flat_associative &&
m_commutative == info.m_commutative &&
m_chainable == info.m_chainable &&
m_pairwise == info.m_pairwise &&
m_injective == info.m_injective &&
m_skolem == info.m_skolem;
}
std::ostream & operator<<(std::ostream & out, func_decl_info const & info) {
operator<<(out, static_cast<decl_info const&>(info));
out << " :left-assoc " << info.is_left_associative();
out << " :right-assoc " << info.is_right_associative();
out << " :flat-associative " << info.is_flat_associative();
out << " :commutative " << info.is_commutative();
out << " :chainable " << info.is_chainable();
out << " :pairwise " << info.is_pairwise();
out << " :injective " << info.is_injective();
out << " :idempotent " << info.is_idempotent();
out << " :skolem " << info.is_skolem();
return out;
}
// -----------------------------------
//
// ast
//
// -----------------------------------
static char const * g_ast_kind_names[] = {"application", "variable", "quantifier", "sort", "function declaration" };
char const * get_ast_kind_name(ast_kind k) {
return g_ast_kind_names[k];
}
// -----------------------------------
//
// func_decl
//
// -----------------------------------
func_decl::func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range, func_decl_info * info):
decl(AST_FUNC_DECL, name, info),
m_arity(arity),
m_range(range) {
if (arity != 0)
memcpy(const_cast<sort **>(get_domain()), domain, sizeof(sort *) * arity);
}
// -----------------------------------
//
// application
//
// -----------------------------------
static app_flags mk_const_flags() {
app_flags r;
r.m_depth = 1;
r.m_ground = true;
r.m_has_quantifiers = false;
r.m_has_labels = false;
return r;
}
static app_flags mk_default_app_flags() {
app_flags r;
r.m_depth = 1;
r.m_ground = true;
r.m_has_quantifiers = false;
r.m_has_labels = false;
return r;
}
app_flags app::g_constant_flags = mk_const_flags();
app::app(func_decl * decl, unsigned num_args, expr * const * args):
expr(AST_APP),
m_decl(decl),
m_num_args(num_args) {
for (unsigned i = 0; i < num_args; i++)
m_args[i] = args[i];
}
// -----------------------------------
//
// quantifier
//
// -----------------------------------
quantifier::quantifier(bool forall, unsigned num_decls, sort * const * decl_sorts, symbol const * decl_names, expr * body,
int weight, symbol const & qid, symbol const & skid, unsigned num_patterns, expr * const * patterns,
unsigned num_no_patterns, expr * const * no_patterns):
expr(AST_QUANTIFIER),
m_forall(forall),
m_num_decls(num_decls),
m_expr(body),
m_depth(::get_depth(body) + 1),
m_weight(weight),
m_has_unused_vars(true),
m_has_labels(::has_labels(body)),
m_qid(qid),
m_skid(skid),
m_num_patterns(num_patterns),
m_num_no_patterns(num_no_patterns) {
SASSERT(m_num_patterns == 0 || m_num_no_patterns == 0);
memcpy(const_cast<sort **>(get_decl_sorts()), decl_sorts, sizeof(sort *) * num_decls);
memcpy(const_cast<symbol*>(get_decl_names()), decl_names, sizeof(symbol) * num_decls);
if (num_patterns != 0)
memcpy(const_cast<expr **>(get_patterns()), patterns, sizeof(expr *) * num_patterns);
if (num_no_patterns != 0)
memcpy(const_cast<expr **>(get_no_patterns()), no_patterns, sizeof(expr *) * num_no_patterns);
}
// -----------------------------------
//
// Auxiliary functions
//
// -----------------------------------
sort * get_sort(expr const * n) {
while (true) {
switch(n->get_kind()) {
case AST_APP:
return to_app(n)->get_decl()->get_range();
case AST_VAR:
return to_var(n)->get_sort();
case AST_QUANTIFIER:
// The sort of the quantifier is the sort of the nested expression.
// This code assumes the given expression is well-sorted.
n = to_quantifier(n)->get_expr();
break;
default:
UNREACHABLE();
return 0;
}
}
}
// -----------------------------------
//
// AST hash-consing
//
// -----------------------------------
unsigned get_node_size(ast const * n) {
switch(n->get_kind()) {
case AST_SORT: return to_sort(n)->get_size();
case AST_FUNC_DECL: return to_func_decl(n)->get_size();
case AST_APP: return to_app(n)->get_size();
case AST_VAR: return to_var(n)->get_size();
case AST_QUANTIFIER: return to_quantifier(n)->get_size();
default: UNREACHABLE();
}
return 0;
}
bool compare_nodes(ast const * n1, ast const * n2) {
if (n1->get_kind() != n2->get_kind()) {
return false;
}
switch (n1->get_kind()) {
case AST_SORT:
if ((to_sort(n1)->get_info() == 0) != (to_sort(n2)->get_info() == 0)) {
return false;
}
if (to_sort(n1)->get_info() != 0 && !(*to_sort(n1)->get_info() == *to_sort(n2)->get_info())) {
return false;
}
return to_sort(n1)->get_name() == to_sort(n2)->get_name();
case AST_FUNC_DECL:
if ((to_func_decl(n1)->get_info() == 0) != (to_func_decl(n2)->get_info() == 0)) {
return false;
}
if (to_func_decl(n1)->get_info() != 0 && !(*to_func_decl(n1)->get_info() == *to_func_decl(n2)->get_info())) {
return false;
}
return
to_func_decl(n1)->get_name() == to_func_decl(n2)->get_name() &&
to_func_decl(n1)->get_arity() == to_func_decl(n2)->get_arity() &&
to_func_decl(n1)->get_range() == to_func_decl(n2)->get_range() &&
compare_arrays(to_func_decl(n1)->get_domain(),
to_func_decl(n2)->get_domain(),
to_func_decl(n1)->get_arity());
case AST_APP:
return
to_app(n1)->get_decl() == to_app(n2)->get_decl() &&
to_app(n1)->get_num_args() == to_app(n2)->get_num_args() &&
compare_arrays(to_app(n1)->get_args(), to_app(n2)->get_args(), to_app(n1)->get_num_args());
case AST_VAR:
return
to_var(n1)->get_idx() == to_var(n2)->get_idx() &&
to_var(n1)->get_sort() == to_var(n2)->get_sort();
case AST_QUANTIFIER:
return
to_quantifier(n1)->is_forall() == to_quantifier(n2)->is_forall() &&
to_quantifier(n1)->get_num_decls() == to_quantifier(n2)->get_num_decls() &&
compare_arrays(to_quantifier(n1)->get_decl_sorts(),
to_quantifier(n2)->get_decl_sorts(),
to_quantifier(n1)->get_num_decls()) &&
to_quantifier(n1)->get_expr() == to_quantifier(n2)->get_expr() &&
to_quantifier(n1)->get_weight() == to_quantifier(n2)->get_weight() &&
to_quantifier(n1)->get_num_patterns() == to_quantifier(n2)->get_num_patterns() &&
compare_arrays(to_quantifier(n1)->get_patterns(),
to_quantifier(n2)->get_patterns(),
to_quantifier(n1)->get_num_patterns()) &&
to_quantifier(n1)->get_num_no_patterns() == to_quantifier(n2)->get_num_no_patterns() &&
compare_arrays(to_quantifier(n1)->get_no_patterns(),
to_quantifier(n2)->get_no_patterns(),
to_quantifier(n1)->get_num_no_patterns());
default:
UNREACHABLE();
}
return false;
}
template<typename T>
inline unsigned ast_array_hash(T * const * array, unsigned size, unsigned init_value) {
if (size == 0)
return init_value;
switch (size) {
case 1:
return combine_hash(array[0]->hash(), init_value);
case 2:
return combine_hash(combine_hash(array[0]->hash(), array[1]->hash()),
init_value);
case 3:
return combine_hash(combine_hash(array[0]->hash(), array[1]->hash()),
combine_hash(array[2]->hash(), init_value));
default: {
unsigned a, b, c;
a = b = 0x9e3779b9;
c = init_value;
while (size >= 3) {
size--;
a += array[size]->hash();
size--;
b += array[size]->hash();
size--;
c += array[size]->hash();
mix(a, b, c);
}
switch (size) {
case 2:
b += array[1]->hash();
Z3_fallthrough;
case 1:
c += array[0]->hash();
}
mix(a, b, c);
return c;
} }
}
unsigned get_asts_hash(unsigned sz, ast * const* ns, unsigned init) {
return ast_array_hash<ast>(ns, sz, init);
}
unsigned get_apps_hash(unsigned sz, app * const* ns, unsigned init) {
return ast_array_hash<app>(ns, sz, init);
}
unsigned get_exprs_hash(unsigned sz, expr * const* ns, unsigned init) {
return ast_array_hash<expr>(ns, sz, init);
}
unsigned get_sorts_hash(unsigned sz, sort * const* ns, unsigned init) {
return ast_array_hash<sort>(ns, sz, init);
}
unsigned get_decl_hash(unsigned sz, func_decl* const* ns, unsigned init) {
return ast_array_hash<func_decl>(ns, sz, init);
}
unsigned get_node_hash(ast const * n) {
unsigned a, b, c;
switch (n->get_kind()) {
case AST_SORT:
if (to_sort(n)->get_info() == 0)
return to_sort(n)->get_name().hash();
else
return combine_hash(to_sort(n)->get_name().hash(), to_sort(n)->get_info()->hash());
case AST_FUNC_DECL:
return ast_array_hash(to_func_decl(n)->get_domain(), to_func_decl(n)->get_arity(),
to_func_decl(n)->get_info() == 0 ?
to_func_decl(n)->get_name().hash() : combine_hash(to_func_decl(n)->get_name().hash(), to_func_decl(n)->get_info()->hash()));
case AST_APP:
return ast_array_hash(to_app(n)->get_args(),
to_app(n)->get_num_args(),
to_app(n)->get_decl()->hash());
case AST_VAR:
return combine_hash(to_var(n)->get_idx(), to_var(n)->get_sort()->hash());
case AST_QUANTIFIER:
a = ast_array_hash(to_quantifier(n)->get_decl_sorts(),
to_quantifier(n)->get_num_decls(),
to_quantifier(n)->is_forall() ? 31 : 19);
b = to_quantifier(n)->get_num_patterns();
c = to_quantifier(n)->get_expr()->hash();
mix(a,b,c);
return c;
default:
UNREACHABLE();
}
return 0;
}
void ast_table::erase(ast * n) {
// Customized erase method
// It uses two important properties:
// 1. n is known to be in the table.
// 2. operator== can be used instead of compare_nodes (big savings)
unsigned mask = m_slots - 1;
unsigned h = n->hash();
unsigned idx = h & mask;
cell * c = m_table + idx;
SASSERT(!c->is_free());
cell * prev = 0;
while (true) {
if (c->m_data == n) {
m_size--;
if (prev == 0) {
cell * next = c->m_next;
if (next == 0) {
m_used_slots--;
c->mark_free();
SASSERT(c->is_free());
}
else {
*c = *next;
recycle_cell(next);
}
}
else {
prev->m_next = c->m_next;
recycle_cell(c);
}
return;
}
CHS_CODE(m_collisions++;);
prev = c;
c = c->m_next;
SASSERT(c);
}
}
// -----------------------------------
//
// decl_plugin
//
// -----------------------------------
func_decl * decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned num_args, expr * const * args, sort * range) {
ptr_buffer<sort> sorts;
for (unsigned i = 0; i < num_args; i++) {
sorts.push_back(m_manager->get_sort(args[i]));
}
return mk_func_decl(k, num_parameters, parameters, num_args, sorts.c_ptr(), range);
}
// -----------------------------------
//
// basic_decl_plugin (i.e., builtin plugin)
//
// -----------------------------------
basic_decl_plugin::basic_decl_plugin():
m_bool_sort(0),
m_true_decl(0),
m_false_decl(0),
m_and_decl(0),
m_or_decl(0),
m_iff_decl(0),
m_xor_decl(0),
m_not_decl(0),
m_interp_decl(0),
m_implies_decl(0),
m_proof_sort(0),
m_undef_decl(0),
m_true_pr_decl(0),
m_asserted_decl(0),
m_goal_decl(0),
m_modus_ponens_decl(0),
m_reflexivity_decl(0),
m_symmetry_decl(0),
m_transitivity_decl(0),
m_quant_intro_decl(0),
m_and_elim_decl(0),
m_not_or_elim_decl(0),
m_rewrite_decl(0),
m_pull_quant_decl(0),
m_pull_quant_star_decl(0),
m_push_quant_decl(0),
m_elim_unused_vars_decl(0),
m_der_decl(0),
m_quant_inst_decl(0),
m_hypothesis_decl(0),
m_iff_true_decl(0),
m_iff_false_decl(0),
m_commutativity_decl(0),
m_def_axiom_decl(0),
m_lemma_decl(0),
m_def_intro_decl(0),
m_iff_oeq_decl(0),
m_skolemize_decl(0),
m_mp_oeq_decl(0),
m_hyper_res_decl0(0) {
}
bool basic_decl_plugin::check_proof_sorts(basic_op_kind k, unsigned arity, sort * const * domain) const {
if (k == PR_UNDEF)
return arity == 0;
if (arity == 0)
return false;
else {
for (unsigned i = 0; i < arity - 1; i++)
if (domain[i] != m_proof_sort)
return false;
return domain[arity-1] == m_bool_sort || domain[arity-1] == m_proof_sort;
}
}
bool basic_decl_plugin::check_proof_args(basic_op_kind k, unsigned num_args, expr * const * args) const {
if (k == PR_UNDEF)
return num_args == 0;
if (num_args == 0)
return false;
else {
for (unsigned i = 0; i < num_args - 1; i++)
if (m_manager->get_sort(args[i]) != m_proof_sort)
return false;
return
m_manager->get_sort(args[num_args - 1]) == m_bool_sort ||
m_manager->get_sort(args[num_args - 1]) == m_proof_sort;
}
}
func_decl * basic_decl_plugin::mk_bool_op_decl(char const * name, basic_op_kind k, unsigned num_args, bool assoc, bool comm, bool idempotent,
bool flat_associative, bool chainable) {
ptr_buffer<sort> domain;
for (unsigned i = 0; i < num_args; i++)
domain.push_back(m_bool_sort);
func_decl_info info(m_family_id, k);
info.set_associative(assoc);
info.set_flat_associative(flat_associative);
info.set_commutative(comm);
info.set_idempotent(idempotent);
info.set_chainable(chainable);
func_decl * d = m_manager->mk_func_decl(symbol(name), num_args, domain.c_ptr(), m_bool_sort, info);
m_manager->inc_ref(d);
return d;
}
func_decl * basic_decl_plugin::mk_implies_decl() {
sort * domain[2] = { m_bool_sort, m_bool_sort };
func_decl_info info(m_family_id, OP_IMPLIES);
info.set_right_associative();
func_decl * d = m_manager->mk_func_decl(symbol("=>"), 2, domain, m_bool_sort, info);
m_manager->inc_ref(d);
return d;
}
func_decl * basic_decl_plugin::mk_proof_decl(
char const * name, basic_op_kind k,
unsigned num_parameters, parameter const* params, unsigned num_parents) {
ptr_buffer<sort> domain;
for (unsigned i = 0; i < num_parents; i++)
domain.push_back(m_proof_sort);
domain.push_back(m_bool_sort);
func_decl_info info(m_family_id, k, num_parameters, params);
return m_manager->mk_func_decl(symbol(name), num_parents+1, domain.c_ptr(), m_proof_sort, info);
}
func_decl * basic_decl_plugin::mk_proof_decl(char const * name, basic_op_kind k, unsigned num_parents) {
ptr_buffer<sort> domain;
for (unsigned i = 0; i < num_parents; i++)
domain.push_back(m_proof_sort);
domain.push_back(m_bool_sort);
func_decl * d = m_manager->mk_func_decl(symbol(name), num_parents+1, domain.c_ptr(), m_proof_sort, func_decl_info(m_family_id, k));
m_manager->inc_ref(d);
return d;
}
func_decl * basic_decl_plugin::mk_compressed_proof_decl(char const * name, basic_op_kind k, unsigned num_parents) {
ptr_buffer<sort> domain;
for (unsigned i = 0; i < num_parents; i++)
domain.push_back(m_proof_sort);
func_decl * d = m_manager->mk_func_decl(symbol(name), num_parents, domain.c_ptr(), m_proof_sort, func_decl_info(m_family_id, k));
m_manager->inc_ref(d);
return d;
}
func_decl * basic_decl_plugin::mk_proof_decl(char const * name, basic_op_kind k, unsigned num_parents, ptr_vector<func_decl> & cache) {
if (num_parents >= cache.size()) {
cache.resize(num_parents+1, 0);
}
if (cache[num_parents] == 0) {
cache[num_parents] = mk_proof_decl(name, k, num_parents);
}
return cache[num_parents];
}
func_decl * basic_decl_plugin::mk_proof_decl(basic_op_kind k, unsigned num_parameters, parameter const* params, unsigned num_parents) {
switch(k) {
case PR_TH_LEMMA: {
return mk_proof_decl("th-lemma", k, num_parameters, params, num_parents);
}
case PR_QUANT_INST: {
SASSERT(num_parents == 0);
return mk_proof_decl("quant-inst", k, num_parameters, params, num_parents);
}
case PR_HYPER_RESOLVE: {
return mk_proof_decl("hyper-res", k, num_parameters, params, num_parents);
}
default:
UNREACHABLE();
return 0;
}
}
#define MK_DECL(_decl_,_mk_decl_) if (!_decl_) _decl_ = _mk_decl_; return _decl_;
func_decl * basic_decl_plugin::mk_proof_decl(char const* name, basic_op_kind k, unsigned num_parents, func_decl*& fn) {
if (!fn) {
fn = mk_proof_decl(name, k, num_parents);
}
return fn;
}
func_decl * basic_decl_plugin::mk_proof_decl(basic_op_kind k, unsigned num_parents) {
SASSERT(k == PR_UNDEF || m_manager->proofs_enabled());
switch (static_cast<basic_op_kind>(k)) {
//
// A description of the semantics of the proof
// declarations is provided in z3_api.h
//
case PR_UNDEF: return m_undef_decl;
case PR_TRUE: return mk_proof_decl("true-axiom", k, 0, m_true_pr_decl);
case PR_ASSERTED: return mk_proof_decl("asserted", k, 0, m_asserted_decl);
case PR_GOAL: return mk_proof_decl("goal", k, 2, m_goal_decl);
case PR_MODUS_PONENS: return mk_proof_decl("mp", k, 2, m_modus_ponens_decl);
case PR_REFLEXIVITY: return mk_proof_decl("refl", k, 0, m_reflexivity_decl);
case PR_SYMMETRY: return mk_proof_decl("symm", k, 1, m_symmetry_decl);
case PR_TRANSITIVITY: return mk_proof_decl("trans", k, 2, m_transitivity_decl);
case PR_TRANSITIVITY_STAR: return mk_proof_decl("trans*", k, num_parents, m_transitivity_star_decls);
case PR_MONOTONICITY: return mk_proof_decl("monotonicity", k, num_parents, m_monotonicity_decls);
case PR_QUANT_INTRO: return mk_proof_decl("quant-intro", k, 1, m_quant_intro_decl);
case PR_DISTRIBUTIVITY: return mk_proof_decl("distributivity", k, num_parents, m_distributivity_decls);
case PR_AND_ELIM: return mk_proof_decl("and-elim", k, 1, m_and_elim_decl);
case PR_NOT_OR_ELIM: return mk_proof_decl("not-or-elim", k, 1, m_not_or_elim_decl);
case PR_REWRITE: return mk_proof_decl("rewrite", k, 0, m_rewrite_decl);
case PR_REWRITE_STAR: return mk_proof_decl("rewrite*", k, num_parents, m_rewrite_star_decls);
case PR_PULL_QUANT: return mk_proof_decl("pull-quant", k, 0, m_pull_quant_decl);
case PR_PULL_QUANT_STAR: return mk_proof_decl("pull-quant*", k, 0, m_pull_quant_star_decl);
case PR_PUSH_QUANT: return mk_proof_decl("push-quant", k, 0, m_push_quant_decl);
case PR_ELIM_UNUSED_VARS: return mk_proof_decl("elim-unused", k, 0, m_elim_unused_vars_decl);
case PR_DER: return mk_proof_decl("der", k, 0, m_der_decl);
case PR_QUANT_INST: return mk_proof_decl("quant-inst", k, 0, m_quant_inst_decl);
case PR_HYPOTHESIS: return mk_proof_decl("hypothesis", k, 0, m_hypothesis_decl);
case PR_LEMMA: return mk_proof_decl("lemma", k, 1, m_lemma_decl);
case PR_UNIT_RESOLUTION: return mk_proof_decl("unit-resolution", k, num_parents, m_unit_resolution_decls);
case PR_IFF_TRUE: return mk_proof_decl("iff-true", k, 1, m_iff_true_decl);
case PR_IFF_FALSE: return mk_proof_decl("iff-false", k, 1, m_iff_false_decl);
case PR_COMMUTATIVITY: return mk_proof_decl("commutativity", k, 0, m_commutativity_decl);
case PR_DEF_AXIOM: return mk_proof_decl("def-axiom", k, 0, m_def_axiom_decl);
case PR_DEF_INTRO: return mk_proof_decl("intro-def", k, 0, m_def_intro_decl);
case PR_APPLY_DEF: return mk_proof_decl("apply-def", k, num_parents, m_apply_def_decls);
case PR_IFF_OEQ: return mk_proof_decl("iff~", k, 1, m_iff_oeq_decl);
case PR_NNF_POS: return mk_proof_decl("nnf-pos", k, num_parents, m_nnf_pos_decls);
case PR_NNF_NEG: return mk_proof_decl("nnf-neg", k, num_parents, m_nnf_neg_decls);
case PR_NNF_STAR: return mk_proof_decl("nnf*", k, num_parents, m_nnf_star_decls);
case PR_CNF_STAR: return mk_proof_decl("cnf*", k, num_parents, m_cnf_star_decls);
case PR_SKOLEMIZE: return mk_proof_decl("sk", k, 0, m_skolemize_decl);
case PR_MODUS_PONENS_OEQ: return mk_proof_decl("mp~", k, 2, m_mp_oeq_decl);
case PR_TH_LEMMA: return mk_proof_decl("th-lemma", k, num_parents, m_th_lemma_decls);
case PR_HYPER_RESOLVE: return mk_proof_decl("hyper-res", k, num_parents, m_hyper_res_decl0);
default:
UNREACHABLE();
return 0;
}
}
void basic_decl_plugin::set_manager(ast_manager * m, family_id id) {
decl_plugin::set_manager(m, id);
m_bool_sort = m->mk_sort(symbol("Bool"), sort_info(id, BOOL_SORT, sort_size(2)));
m->inc_ref(m_bool_sort);
m_true_decl = mk_bool_op_decl("true", OP_TRUE);
m_false_decl = mk_bool_op_decl("false", OP_FALSE);
m_and_decl = mk_bool_op_decl("and", OP_AND, 2, true, true, true, true);
m_or_decl = mk_bool_op_decl("or", OP_OR, 2, true, true, true, true);
m_iff_decl = mk_bool_op_decl("iff", OP_IFF, 2, false, true, false, false, true);
m_xor_decl = mk_bool_op_decl("xor", OP_XOR, 2, true, true);
m_not_decl = mk_bool_op_decl("not", OP_NOT, 1);
m_interp_decl = mk_bool_op_decl("interp", OP_INTERP, 1);
m_implies_decl = mk_implies_decl();
m_proof_sort = m->mk_sort(symbol("Proof"), sort_info(id, PROOF_SORT));
m->inc_ref(m_proof_sort);
m_undef_decl = mk_compressed_proof_decl("undef", PR_UNDEF, 0);
}
void basic_decl_plugin::get_sort_names(svector<builtin_name> & sort_names, symbol const & logic) {
if (logic == symbol::null)
sort_names.push_back(builtin_name("bool", BOOL_SORT));
sort_names.push_back(builtin_name("Bool", BOOL_SORT));
}
void basic_decl_plugin::get_op_names(svector<builtin_name> & op_names, symbol const & logic) {
op_names.push_back(builtin_name("true", OP_TRUE));
op_names.push_back(builtin_name("false", OP_FALSE));
op_names.push_back(builtin_name("=", OP_EQ));
op_names.push_back(builtin_name("distinct", OP_DISTINCT));
op_names.push_back(builtin_name("ite", OP_ITE));
op_names.push_back(builtin_name("and", OP_AND));
op_names.push_back(builtin_name("or", OP_OR));
op_names.push_back(builtin_name("xor", OP_XOR));
op_names.push_back(builtin_name("not", OP_NOT));
op_names.push_back(builtin_name("interp", OP_INTERP));
op_names.push_back(builtin_name("=>", OP_IMPLIES));
if (logic == symbol::null) {
// user friendly aliases
op_names.push_back(builtin_name("implies", OP_IMPLIES));
op_names.push_back(builtin_name("iff", OP_IFF));
op_names.push_back(builtin_name("if_then_else", OP_ITE));
op_names.push_back(builtin_name("if", OP_ITE));
op_names.push_back(builtin_name("&&", OP_AND));
op_names.push_back(builtin_name("||", OP_OR));
op_names.push_back(builtin_name("equals", OP_EQ));
op_names.push_back(builtin_name("equiv", OP_IFF));
op_names.push_back(builtin_name("@@", OP_INTERP));
}
}
bool basic_decl_plugin::is_value(app* a) const {
return a->get_decl() == m_true_decl || a->get_decl() == m_false_decl;
}
bool basic_decl_plugin::is_unique_value(app* a) const {
return is_value(a);
}
void basic_decl_plugin::finalize() {
#define DEC_REF(FIELD) if (FIELD) { m_manager->dec_ref(FIELD); }
#define DEC_ARRAY_REF(FIELD) m_manager->dec_array_ref(FIELD.size(), FIELD.begin())
DEC_REF(m_bool_sort);
DEC_REF(m_true_decl);
DEC_REF(m_false_decl);
DEC_REF(m_and_decl);
DEC_REF(m_or_decl);
DEC_REF(m_not_decl);
DEC_REF(m_interp_decl);
DEC_REF(m_iff_decl);
DEC_REF(m_xor_decl);
DEC_REF(m_implies_decl);
DEC_ARRAY_REF(m_eq_decls);
DEC_ARRAY_REF(m_ite_decls);
DEC_ARRAY_REF(m_oeq_decls);
DEC_REF(m_proof_sort);
DEC_REF(m_undef_decl);
DEC_REF(m_true_pr_decl);
DEC_REF(m_asserted_decl);
DEC_REF(m_goal_decl);
DEC_REF(m_modus_ponens_decl);
DEC_REF(m_reflexivity_decl);
DEC_REF(m_symmetry_decl);
DEC_REF(m_transitivity_decl);
DEC_REF(m_quant_intro_decl);
DEC_REF(m_and_elim_decl);
DEC_REF(m_not_or_elim_decl);
DEC_REF(m_rewrite_decl);
DEC_REF(m_pull_quant_decl);
DEC_REF(m_pull_quant_star_decl);
DEC_REF(m_push_quant_decl);
DEC_REF(m_elim_unused_vars_decl);
DEC_REF(m_der_decl);
DEC_REF(m_quant_inst_decl);
DEC_ARRAY_REF(m_monotonicity_decls);
DEC_ARRAY_REF(m_transitivity_star_decls);
DEC_ARRAY_REF(m_distributivity_decls);
DEC_ARRAY_REF(m_assoc_flat_decls);
DEC_ARRAY_REF(m_rewrite_star_decls);
DEC_REF(m_hypothesis_decl);
DEC_REF(m_iff_true_decl);
DEC_REF(m_iff_false_decl);
DEC_REF(m_commutativity_decl);
DEC_REF(m_def_axiom_decl);
DEC_REF(m_lemma_decl);
DEC_ARRAY_REF(m_unit_resolution_decls);
DEC_REF(m_def_intro_decl);
DEC_REF(m_iff_oeq_decl);
DEC_REF(m_skolemize_decl);
DEC_REF(m_mp_oeq_decl);
DEC_ARRAY_REF(m_apply_def_decls);
DEC_ARRAY_REF(m_nnf_pos_decls);
DEC_ARRAY_REF(m_nnf_neg_decls);
DEC_ARRAY_REF(m_nnf_star_decls);
DEC_ARRAY_REF(m_cnf_star_decls);
DEC_ARRAY_REF(m_th_lemma_decls);
DEC_REF(m_hyper_res_decl0);
}
sort * basic_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
if (k == BOOL_SORT)
return m_bool_sort;
SASSERT(k == PROOF_SORT);
return m_proof_sort;
}
func_decl * basic_decl_plugin::mk_eq_decl_core(char const * name, decl_kind k, sort * s, ptr_vector<func_decl> & cache) {
unsigned id = s->get_decl_id();
force_ptr_array_size(cache, id + 1);
if (cache[id] == 0) {
sort * domain[2] = { s, s};
func_decl_info info(m_family_id, k);
info.set_commutative();
info.set_chainable();
func_decl * decl = m_manager->mk_func_decl(symbol(name), 2, domain, m_bool_sort, info);
SASSERT(decl->is_chainable());
cache[id] = decl;
m_manager->inc_ref(decl);
}
return cache[id];
}
func_decl * basic_decl_plugin::mk_ite_decl(sort * s) {
unsigned id = s->get_decl_id();
force_ptr_array_size(m_ite_decls, id + 1);
if (m_ite_decls[id] == 0) {
sort * domain[3] = { m_bool_sort, s, s};
func_decl * decl = m_manager->mk_func_decl(symbol("if"), 3, domain, s, func_decl_info(m_family_id, OP_ITE));
m_ite_decls[id] = decl;
m_manager->inc_ref(decl);
}
return m_ite_decls[id];
}
sort* basic_decl_plugin::join(unsigned n, sort* const* srts) {
SASSERT(n > 0);
sort* s = srts[0];
while (n > 1) {
++srts;
--n;
s = join(s, *srts);
}
return s;
}
sort* basic_decl_plugin::join(unsigned n, expr* const* es) {
SASSERT(n > 0);
sort* s = m_manager->get_sort(*es);
while (n > 1) {
++es;
--n;
s = join(s, m_manager->get_sort(*es));
}
return s;
}
sort* basic_decl_plugin::join(sort* s1, sort* s2) {
if (s1 == s2) return s1;
if (s1->get_family_id() == m_manager->m_arith_family_id &&
s2->get_family_id() == m_manager->m_arith_family_id) {
if (s1->get_decl_kind() == REAL_SORT) {
return s1;
}
return s2;
}
std::ostringstream buffer;
buffer << "Sorts " << mk_pp(s1, *m_manager) << " and " << mk_pp(s2, *m_manager) << " are incompatible";
throw ast_exception(buffer.str().c_str());
}
func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
switch (static_cast<basic_op_kind>(k)) {
case OP_TRUE: return m_true_decl;
case OP_FALSE: return m_false_decl;
case OP_AND: return m_and_decl;
case OP_OR: return m_or_decl;
case OP_NOT: return m_not_decl;
case OP_INTERP: return m_interp_decl;
case OP_IFF: return m_iff_decl;
case OP_IMPLIES: return m_implies_decl;
case OP_XOR: return m_xor_decl;
case OP_ITE: return arity == 3 ? mk_ite_decl(join(domain[1], domain[2])) : 0;
// eq and oeq must have at least two arguments, they can have more since they are chainable
case OP_EQ: return arity >= 2 ? mk_eq_decl_core("=", OP_EQ, join(arity, domain), m_eq_decls) : 0;
case OP_OEQ: return arity >= 2 ? mk_eq_decl_core("~", OP_OEQ, join(arity, domain), m_oeq_decls) : 0;
case OP_DISTINCT: {
func_decl_info info(m_family_id, OP_DISTINCT);
info.set_pairwise();
for (unsigned i = 1; i < arity; i++) {
if (domain[i] != domain[0]) {
std::ostringstream buffer;
buffer << "Sort mismatch between first argument and argument " << (i+1);
throw ast_exception(buffer.str().c_str());
}
}
return m_manager->mk_func_decl(symbol("distinct"), arity, domain, m_bool_sort, info);
}
default:
break;
}
SASSERT(is_proof(k));
if (!check_proof_sorts(static_cast<basic_op_kind>(k), arity, domain))
m_manager->raise_exception("Invalid proof object.");
if (num_parameters == 0) {
return mk_proof_decl(static_cast<basic_op_kind>(k), arity - 1);
}
return mk_proof_decl(static_cast<basic_op_kind>(k), num_parameters, parameters, arity - 1);
}
func_decl * basic_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned num_args, expr * const * args, sort * range) {
switch (static_cast<basic_op_kind>(k)) {
case OP_TRUE: return m_true_decl;
case OP_FALSE: return m_false_decl;
case OP_AND: return m_and_decl;
case OP_OR: return m_or_decl;
case OP_NOT: return m_not_decl;
case OP_INTERP: return m_interp_decl;
case OP_IFF: return m_iff_decl;
case OP_IMPLIES: return m_implies_decl;
case OP_XOR: return m_xor_decl;
case OP_ITE: return num_args == 3 ? mk_ite_decl(join(m_manager->get_sort(args[1]), m_manager->get_sort(args[2]))): 0;
// eq and oeq must have at least two arguments, they can have more since they are chainable
case OP_EQ: return num_args >= 2 ? mk_eq_decl_core("=", OP_EQ, join(num_args, args), m_eq_decls) : 0;
case OP_OEQ: return num_args >= 2 ? mk_eq_decl_core("~", OP_OEQ, join(num_args, args), m_oeq_decls) : 0;
case OP_DISTINCT:
return decl_plugin::mk_func_decl(k, num_parameters, parameters, num_args, args, range);
default:
break;
}
SASSERT(is_proof(k));
if (!check_proof_args(static_cast<basic_op_kind>(k), num_args, args))
m_manager->raise_exception("Invalid proof object.");
if (num_parameters == 0) {
return mk_proof_decl(static_cast<basic_op_kind>(k), num_args - 1);
}
return mk_proof_decl(static_cast<basic_op_kind>(k), num_parameters, parameters, num_args - 1);
}
expr * basic_decl_plugin::get_some_value(sort * s) {
if (s == m_bool_sort)
return m_manager->mk_false();
return 0;
}
bool basic_recognizers::is_ite(expr const * n, expr * & t1, expr * & t2, expr * & t3) const {
if (is_ite(n)) {
t1 = to_app(n)->get_arg(0);
t2 = to_app(n)->get_arg(1);
t3 = to_app(n)->get_arg(2);
return true;
}
return false;
}
// -----------------------------------
//
// label_decl_plugin
//
// -----------------------------------
label_decl_plugin::label_decl_plugin():
m_lblpos("lblpos"),
m_lblneg("lblneg"),
m_lbllit("lbl-lit") {
}
label_decl_plugin::~label_decl_plugin() {
}
void label_decl_plugin::set_manager(ast_manager * m, family_id id) {
decl_plugin::set_manager(m, id);
}
sort * label_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
UNREACHABLE();
return 0;
}
func_decl * label_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
if (k == OP_LABEL) {
if (arity != 1 || num_parameters < 2 || !parameters[0].is_int() || !parameters[1].is_symbol() || !m_manager->is_bool(domain[0])) {
m_manager->raise_exception("invalid label declaration");
return 0;
}
for (unsigned i = 2; i < num_parameters; i++) {
if (!parameters[i].is_symbol()) {
m_manager->raise_exception("invalid label declaration");
return 0;
}
}
return m_manager->mk_func_decl(parameters[0].get_int() ? m_lblpos : m_lblneg, arity, domain, domain[0],
func_decl_info(m_family_id, OP_LABEL, num_parameters, parameters));
}
else {
SASSERT(k == OP_LABEL_LIT);
if (arity != 0) {
m_manager->raise_exception("invalid label literal declaration");
return 0;
}
for (unsigned i = 0; i < num_parameters; i++) {
if (!parameters[i].is_symbol()) {
m_manager->raise_exception("invalid label literal declaration");
return 0;
}
}
return m_manager->mk_func_decl(m_lbllit, 0, static_cast<sort * const *>(0), m_manager->mk_bool_sort(),
func_decl_info(m_family_id, OP_LABEL_LIT, num_parameters, parameters));
}
}
// -----------------------------------
//
// pattern_decl_plugin
//
// -----------------------------------
sort * pattern_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
UNREACHABLE();
return 0;
}
func_decl * pattern_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
return m_manager->mk_func_decl(symbol("pattern"), arity, domain,
m_manager->mk_bool_sort(), // the range can be an arbitrary sort.
func_decl_info(m_family_id, OP_PATTERN));
}
// -----------------------------------
//
// model_value_decl_plugin
//
// -----------------------------------
sort * model_value_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
UNREACHABLE();
return 0;
}
func_decl * model_value_decl_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
SASSERT(k == OP_MODEL_VALUE);
if (arity != 0 || num_parameters != 2 || !parameters[0].is_int() || !parameters[1].is_ast() || !is_sort(parameters[1].get_ast())) {
UNREACHABLE();
m_manager->raise_exception("invalid model value");
return 0;
}
int idx = parameters[0].get_int();
sort * s = to_sort(parameters[1].get_ast());
string_buffer<64> buffer;
buffer << s->get_name().bare_str() << "!val!" << idx;
func_decl_info info(m_family_id, k, num_parameters, parameters);
info.m_private_parameters = true;
return m_manager->mk_func_decl(symbol(buffer.c_str()), 0, static_cast<sort * const *>(0), s, info);
}
bool model_value_decl_plugin::is_value(app* n) const {
return is_app_of(n, m_family_id, OP_MODEL_VALUE);
}
bool model_value_decl_plugin::is_unique_value(app* n) const {
return is_value(n);
}
// -----------------------------------
//
// user_sort_plugin
//
// -----------------------------------
sort * user_sort_plugin::mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters) {
SASSERT(m_family_id != null_family_id);
SASSERT(k < static_cast<int>(m_sort_names.size()));
sort_info si(m_family_id, k, num_parameters, parameters);
return m_manager->mk_sort(m_sort_names[k], si);
}
func_decl * user_sort_plugin::mk_func_decl(decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
UNREACHABLE();
return 0;
}
decl_kind user_sort_plugin::register_name(symbol s) {
decl_kind k;
if (m_name2decl_kind.find(s, k))
return k;
k = m_sort_names.size();
m_sort_names.push_back(s);
m_name2decl_kind.insert(s, k);
return k;
}
decl_plugin * user_sort_plugin::mk_fresh() {
user_sort_plugin * p = alloc(user_sort_plugin);
svector<symbol>::iterator it = m_sort_names.begin();
svector<symbol>::iterator end = m_sort_names.end();
for (; it != end; ++it)
p->register_name(*it);
return p;
}
// -----------------------------------
//
// ast_manager
//
// -----------------------------------
ast_manager::ast_manager(proof_gen_mode m, char const * trace_file, bool is_format_manager):
m_alloc("ast_manager"),
m_expr_array_manager(*this, m_alloc),
m_expr_dependency_manager(*this, m_alloc),
m_expr_dependency_array_manager(*this, m_alloc),
m_proof_mode(m),
m_trace_stream(0),
m_trace_stream_owner(false) {
if (trace_file) {
m_trace_stream = alloc(std::fstream, trace_file, std::ios_base::out);
m_trace_stream_owner = true;
}
if (!is_format_manager)
m_format_manager = alloc(ast_manager, PGM_DISABLED, m_trace_stream, true);
else
m_format_manager = 0;
init();
}
ast_manager::ast_manager(proof_gen_mode m, std::fstream * trace_stream, bool is_format_manager):
m_alloc("ast_manager"),
m_expr_array_manager(*this, m_alloc),
m_expr_dependency_manager(*this, m_alloc),
m_expr_dependency_array_manager(*this, m_alloc),
m_proof_mode(m),
m_trace_stream(trace_stream),
m_trace_stream_owner(false) {
if (!is_format_manager)
m_format_manager = alloc(ast_manager, PGM_DISABLED, trace_stream, true);
else
m_format_manager = 0;
init();
}
ast_manager::ast_manager(ast_manager const & src, bool disable_proofs):
m_alloc("ast_manager"),
m_expr_array_manager(*this, m_alloc),
m_expr_dependency_manager(*this, m_alloc),
m_expr_dependency_array_manager(*this, m_alloc),
m_proof_mode(disable_proofs ? PGM_DISABLED : src.m_proof_mode),
m_trace_stream(src.m_trace_stream),
m_trace_stream_owner(false) {
SASSERT(!src.is_format_manager());
m_format_manager = alloc(ast_manager, PGM_DISABLED, m_trace_stream, true);
init();
copy_families_plugins(src);
}
void ast_manager::init() {
m_int_real_coercions = true;
m_debug_ref_count = false;
m_fresh_id = 0;
m_expr_id_gen.reset(0);
m_decl_id_gen.reset(c_first_decl_id);
m_some_value_proc = 0;
m_basic_family_id = mk_family_id("basic");
m_label_family_id = mk_family_id("label");
m_pattern_family_id = mk_family_id("pattern");
m_model_value_family_id = mk_family_id("model-value");
m_user_sort_family_id = mk_family_id("user-sort");
m_arith_family_id = mk_family_id("arith");
basic_decl_plugin * plugin = alloc(basic_decl_plugin);
register_plugin(m_basic_family_id, plugin);
m_bool_sort = plugin->mk_bool_sort();
inc_ref(m_bool_sort);
m_proof_sort = plugin->mk_proof_sort();
inc_ref(m_proof_sort);
m_undef_proof = mk_const(m_basic_family_id, PR_UNDEF);
inc_ref(m_undef_proof);
register_plugin(m_label_family_id, alloc(label_decl_plugin));
register_plugin(m_pattern_family_id, alloc(pattern_decl_plugin));
register_plugin(m_model_value_family_id, alloc(model_value_decl_plugin));
register_plugin(m_user_sort_family_id, alloc(user_sort_plugin));
m_true = mk_const(m_basic_family_id, OP_TRUE);
inc_ref(m_true);
m_false = mk_const(m_basic_family_id, OP_FALSE);
inc_ref(m_false);
}
ast_manager::~ast_manager() {
SASSERT(is_format_manager() || !m_family_manager.has_family(symbol("format")));
dec_ref(m_bool_sort);
dec_ref(m_proof_sort);
dec_ref(m_true);
dec_ref(m_false);
dec_ref(m_undef_proof);
ptr_vector<decl_plugin>::iterator it = m_plugins.begin();
ptr_vector<decl_plugin>::iterator end = m_plugins.end();
for (; it != end; ++it) {
if (*it)
(*it)->finalize();
}
it = m_plugins.begin();
for (; it != end; ++it) {
if (*it)
dealloc(*it);
}
DEBUG_CODE({
if (!m_ast_table.empty())
std::cout << "ast_manager LEAKED: " << m_ast_table.size() << std::endl;
});
#if 1
DEBUG_CODE({
ast_table::iterator it_a = m_ast_table.begin();
ast_table::iterator end_a = m_ast_table.end();
for (; it_a != end_a; ++it_a) {
ast* a = (*it_a);
std::cout << "Leaked: ";
if (is_sort(a)) {
std::cout << to_sort(a)->get_name() << "\n";
}
else {
std::cout << mk_ll_pp(a, *this, false);
}
}
});
#endif
if (m_format_manager != 0)
dealloc(m_format_manager);
if (m_trace_stream_owner) {
std::fstream & tmp = * m_trace_stream;
tmp << "[eof]\n";
tmp.close();
dealloc(m_trace_stream);
m_trace_stream = 0;
}
}
void ast_manager::set_cancel(bool f) {
for (unsigned i = 0; i < m_plugins.size(); i++) {
m_plugins[i]->set_cancel(f);
}
}
void ast_manager::compact_memory() {
m_alloc.consolidate();
unsigned capacity = m_ast_table.capacity();
if (capacity > 4*m_ast_table.size()) {
ast_table new_ast_table;
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
for (; it != end; ++it) {
new_ast_table.insert(*it);
}
m_ast_table.swap(new_ast_table);
IF_VERBOSE(10, verbose_stream() << "(ast-table :prev-capacity " << capacity
<< " :capacity " << m_ast_table.capacity() << " :size " << m_ast_table.size() << ")\n";);
}
else {
IF_VERBOSE(10, verbose_stream() << "(ast-table :capacity " << m_ast_table.capacity() << " :size " << m_ast_table.size() << ")\n";);
}
}
void ast_manager::compress_ids() {
ptr_vector<ast> asts;
m_expr_id_gen.cleanup();
m_decl_id_gen.cleanup(c_first_decl_id);
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
for (; it != end; ++it) {
ast * n = *it;
if (is_decl(n))
n->m_id = m_decl_id_gen.mk();
else
n->m_id = m_expr_id_gen.mk();
asts.push_back(n);
}
m_ast_table.finalize();
ptr_vector<ast>::iterator it2 = asts.begin();
ptr_vector<ast>::iterator end2 = asts.end();
for (; it2 != end2; ++it2)
m_ast_table.insert(*it2);
}
void ast_manager::raise_exception(char const * msg) {
throw ast_exception(msg);
}
void ast_manager::copy_families_plugins(ast_manager const & from) {
TRACE("copy_families_plugins",
tout << "target:\n";
for (family_id fid = 0; m_family_manager.has_family(fid); fid++) {
tout << "fid: " << fid << " fidname: " << get_family_name(fid) << "\n";
});
for (family_id fid = 0; from.m_family_manager.has_family(fid); fid++) {
SASSERT(from.is_builtin_family_id(fid) == is_builtin_family_id(fid));
SASSERT(!from.is_builtin_family_id(fid) || m_family_manager.has_family(fid));
symbol fid_name = from.get_family_name(fid);
TRACE("copy_families_plugins", tout << "copying: " << fid_name << ", src fid: " << fid
<< ", target has_family: " << m_family_manager.has_family(fid) << "\n";
if (m_family_manager.has_family(fid)) tout << get_family_id(fid_name) << "\n";);
if (!m_family_manager.has_family(fid)) {
family_id new_fid = mk_family_id(fid_name);
TRACE("copy_families_plugins", tout << "new target fid created: " << new_fid << " fid_name: " << fid_name << "\n";);
}
TRACE("copy_families_plugins", tout << "target fid: " << get_family_id(fid_name) << "\n";);
SASSERT(fid == get_family_id(fid_name));
if (from.has_plugin(fid) && !has_plugin(fid)) {
decl_plugin * new_p = from.get_plugin(fid)->mk_fresh();
register_plugin(fid, new_p);
SASSERT(new_p->get_family_id() == fid);
SASSERT(has_plugin(fid));
}
SASSERT(from.m_family_manager.has_family(fid) == m_family_manager.has_family(fid));
SASSERT(from.get_family_id(fid_name) == get_family_id(fid_name));
SASSERT(!from.has_plugin(fid) || has_plugin(fid));
}
}
void ast_manager::set_next_expr_id(unsigned id) {
while (true) {
id = m_expr_id_gen.set_next_id(id);
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
for (; it != end; ++it) {
ast * curr = *it;
if (curr->get_id() == id)
break;
}
if (it == end)
return;
// id is in use, move to the next one.
id++;
}
}
unsigned ast_manager::get_node_size(ast const * n) { return ::get_node_size(n); }
void ast_manager::register_plugin(symbol const & s, decl_plugin * plugin) {
family_id id = m_family_manager.mk_family_id(s);
SASSERT(is_format_manager() || s != symbol("format"));
register_plugin(id, plugin);
}
decl_plugin * ast_manager::get_plugin(family_id fid) const {
return m_plugins.get(fid, 0);
}
bool ast_manager::is_value(expr* e) const {
decl_plugin const * p = 0;
if (is_app(e)) {
p = get_plugin(to_app(e)->get_family_id());
return p && p->is_value(to_app(e));
}
return false;
}
bool ast_manager::is_unique_value(expr* e) const {
decl_plugin const * p = 0;
if (is_app(e)) {
p = get_plugin(to_app(e)->get_family_id());
return p && p->is_unique_value(to_app(e));
}
return false;
}
bool ast_manager::are_equal(expr * a, expr * b) const {
if (is_app(a) && is_app(b)) {
app* ap = to_app(a), *bp = to_app(b);
decl_plugin const * p = get_plugin(ap->get_family_id());
if (!p) {
p = get_plugin(bp->get_family_id());
}
return p && p->are_equal(ap, bp);
}
return false;
}
bool ast_manager::are_distinct(expr* a, expr* b) const {
if (is_app(a) && is_app(b)) {
app* ap = to_app(a), *bp = to_app(b);
decl_plugin const * p = get_plugin(ap->get_family_id());
if (!p) {
p = get_plugin(bp->get_family_id());
}
return p && p->are_distinct(ap, bp);
}
return false;
}
void ast_manager::register_plugin(family_id id, decl_plugin * plugin) {
SASSERT(m_plugins.get(id, 0) == 0);
m_plugins.setx(id, plugin, 0);
plugin->set_manager(this, id);
}
bool ast_manager::is_bool(expr const * n) const {
return get_sort(n) == m_bool_sort;
}
#ifdef Z3DEBUG
bool ast_manager::slow_not_contains(ast const * n) {
ast_table::iterator it = m_ast_table.begin();
ast_table::iterator end = m_ast_table.end();
unsigned num = 0;
for (; it != end; ++it) {
ast * curr = *it;
if (compare_nodes(curr, n)) {
TRACE("nondet_bug",
tout << "id1: " << curr->get_id() << ", id2: " << n->get_id() << "\n";
tout << "hash1: " << get_node_hash(curr) << ", hash2: " << get_node_hash(n) << "\n";);
return false;
}
SASSERT(!(is_app(n) && is_app(curr) &&
to_app(n)->get_decl() == to_app(curr)->get_decl() &&
to_app(n)->get_num_args() == 0 &&
to_app(curr)->get_num_args() == 0));
num++;
}
SASSERT(num == m_ast_table.size());
return true;
}
#endif
ast * ast_manager::register_node_core(ast * n) {
unsigned h = get_node_hash(n);
n->m_hash = h;
#ifdef Z3DEBUG
bool contains = m_ast_table.contains(n);
CASSERT("nondet_bug", contains || slow_not_contains(n));
#endif
#if 0
static unsigned counter = 0;
counter++;
if (counter % 100000 == 0)
verbose_stream() << "[ast-table] counter: " << counter << " collisions: " << m_ast_table.collisions() << " capacity: " << m_ast_table.capacity() << " size: " << m_ast_table.size() << "\n";
#endif
ast * r = m_ast_table.insert_if_not_there(n);
SASSERT(r->m_hash == h);
if (r != n) {
#if 0
static unsigned reused = 0;
reused++;
if (reused % 100000 == 0)
verbose_stream() << "[ast-table] reused: " << reused << "\n";
#endif
SASSERT(contains);
SASSERT(m_ast_table.contains(n));
if (is_func_decl(r) && to_func_decl(r)->get_range() != to_func_decl(n)->get_range()) {
std::ostringstream buffer;
buffer << "Recycling of declaration for the same name '" << to_func_decl(r)->get_name().str().c_str() << "'"
<< " and domain, but different range type is not permitted";
throw ast_exception(buffer.str().c_str());
}
deallocate_node(n, ::get_node_size(n));
return r;
}
else {
SASSERT(!contains);
SASSERT(m_ast_table.contains(n));
}
n->m_id = is_decl(n) ? m_decl_id_gen.mk() : m_expr_id_gen.mk();
TRACE("ast", tout << "Object " << n->m_id << " was created.\n";);
TRACE("mk_var_bug", tout << "mk_ast: " << n->m_id << "\n";);
// increment reference counters
switch (n->get_kind()) {
case AST_SORT:
if (to_sort(n)->m_info != 0) {
to_sort(n)->m_info = alloc(sort_info, *(to_sort(n)->get_info()));
to_sort(n)->m_info->init_eh(*this);
}
break;
case AST_FUNC_DECL:
if (to_func_decl(n)->m_info != 0) {
to_func_decl(n)->m_info = alloc(func_decl_info, *(to_func_decl(n)->get_info()));
to_func_decl(n)->m_info->init_eh(*this);
}
inc_array_ref(to_func_decl(n)->get_arity(), to_func_decl(n)->get_domain());
inc_ref(to_func_decl(n)->get_range());
break;
case AST_APP: {
app * t = to_app(n);
inc_ref(t->get_decl());
unsigned num_args = t->get_num_args();
if (num_args > 0) {
app_flags * f = t->flags();
*f = mk_default_app_flags();
SASSERT(t->is_ground());
SASSERT(!t->has_quantifiers());
SASSERT(!t->has_labels());
if (is_label(t))
f->m_has_labels = true;
unsigned depth = 0;
for (unsigned i = 0; i < num_args; i++) {
expr * arg = t->get_arg(i);
inc_ref(arg);
unsigned arg_depth = 0;
switch (arg->get_kind()) {
case AST_APP: {
app_flags * arg_flags = to_app(arg)->flags();
arg_depth = arg_flags->m_depth;
if (arg_flags->m_has_quantifiers)
f->m_has_quantifiers = true;
if (arg_flags->m_has_labels)
f->m_has_labels = true;
if (!arg_flags->m_ground)
f->m_ground = false;
break;
}
case AST_QUANTIFIER:
f->m_has_quantifiers = true;
f->m_ground = false;
arg_depth = to_quantifier(arg)->get_depth();
break;
case AST_VAR:
f->m_ground = false;
arg_depth = 1;
break;
default:
UNREACHABLE();
}
if (arg_depth > depth)
depth = arg_depth;
}
depth++;
if (depth > c_max_depth)
depth = c_max_depth;
f->m_depth = depth;
SASSERT(t->get_depth() == depth);
}
break;
}
case AST_VAR:
inc_ref(to_var(n)->get_sort());
break;
case AST_QUANTIFIER:
inc_array_ref(to_quantifier(n)->get_num_decls(), to_quantifier(n)->get_decl_sorts());
inc_ref(to_quantifier(n)->get_expr());
inc_array_ref(to_quantifier(n)->get_num_patterns(), to_quantifier(n)->get_patterns());
inc_array_ref(to_quantifier(n)->get_num_no_patterns(), to_quantifier(n)->get_no_patterns());
break;
default:
break;
}
return n;
}
void ast_manager::delete_node(ast * n) {
TRACE("delete_node_bug", tout << mk_ll_pp(n, *this) << "\n";);
ptr_buffer<ast> worklist;
worklist.push_back(n);
while (!worklist.empty()) {
n = worklist.back();
worklist.pop_back();
TRACE("ast", tout << "Deleting object " << n->m_id << " " << n << "\n";);
CTRACE("del_quantifier", is_quantifier(n), tout << "deleting quantifier " << n->m_id << " " << n << "\n";);
TRACE("mk_var_bug", tout << "del_ast: " << n->m_id << "\n";);
TRACE("ast_delete_node", tout << mk_bounded_pp(n, *this) << "\n";);
SASSERT(m_ast_table.contains(n));
m_ast_table.erase(n);
SASSERT(!m_ast_table.contains(n));
SASSERT(!m_debug_ref_count || !m_debug_free_indices.contains(n->m_id));
#ifdef RECYCLE_FREE_AST_INDICES
if (!m_debug_ref_count) {
if (is_decl(n))
m_decl_id_gen.recycle(n->m_id);
else
m_expr_id_gen.recycle(n->m_id);
}
#endif
switch (n->get_kind()) {
case AST_SORT:
if (to_sort(n)->m_info != 0 && !m_debug_ref_count) {
sort_info * info = to_sort(n)->get_info();
info->del_eh(*this);
dealloc(info);
}
break;
case AST_FUNC_DECL:
if (to_func_decl(n)->m_info != 0 && !m_debug_ref_count) {
func_decl_info * info = to_func_decl(n)->get_info();
info->del_eh(*this);
dealloc(info);
}
dec_array_ref(worklist, to_func_decl(n)->get_arity(), to_func_decl(n)->get_domain());
dec_ref(worklist, to_func_decl(n)->get_range());
break;
case AST_APP:
dec_ref(worklist, to_app(n)->get_decl());
dec_array_ref(worklist, to_app(n)->get_num_args(), to_app(n)->get_args());
break;
case AST_VAR:
dec_ref(worklist, to_var(n)->get_sort());
break;
case AST_QUANTIFIER:
dec_array_ref(worklist, to_quantifier(n)->get_num_decls(), to_quantifier(n)->get_decl_sorts());
dec_ref(worklist, to_quantifier(n)->get_expr());
dec_array_ref(worklist, to_quantifier(n)->get_num_patterns(), to_quantifier(n)->get_patterns());
dec_array_ref(worklist, to_quantifier(n)->get_num_no_patterns(), to_quantifier(n)->get_no_patterns());
break;
default:
break;
}
if (m_debug_ref_count) {
m_debug_free_indices.insert(n->m_id,0);
}
deallocate_node(n, ::get_node_size(n));
}
}
sort * ast_manager::mk_sort(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters) {
decl_plugin * p = get_plugin(fid);
if (p)
return p->mk_sort(k, num_parameters, parameters);
return 0;
}
func_decl * ast_manager::mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range) {
decl_plugin * p = get_plugin(fid);
if (p)
return p->mk_func_decl(k, num_parameters, parameters, arity, domain, range);
return 0;
}
func_decl * ast_manager::mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned num_args, expr * const * args, sort * range) {
decl_plugin * p = get_plugin(fid);
if (p)
return p->mk_func_decl(k, num_parameters, parameters, num_args, args, range);
return 0;
}
app * ast_manager::mk_app(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned num_args, expr * const * args, sort * range) {
func_decl * decl = mk_func_decl(fid, k, num_parameters, parameters, num_args, args, range);
if (decl != 0)
return mk_app(decl, num_args, args);
return 0;
}
app * ast_manager::mk_app(family_id fid, decl_kind k, unsigned num_args, expr * const * args) {
return mk_app(fid, k, 0, 0, num_args, args);
}
app * ast_manager::mk_app(family_id fid, decl_kind k, expr * arg) {
return mk_app(fid, k, 0, 0, 1, &arg);
}
app * ast_manager::mk_app(family_id fid, decl_kind k, expr * arg1, expr * arg2) {
expr * args[2] = { arg1, arg2 };
return mk_app(fid, k, 0, 0, 2, args);
}
app * ast_manager::mk_app(family_id fid, decl_kind k, expr * arg1, expr * arg2, expr * arg3) {
expr * args[3] = { arg1, arg2, arg3 };
return mk_app(fid, k, 0, 0, 3, args);
}
sort * ast_manager::mk_sort(symbol const & name, sort_info * info) {
unsigned sz = sort::get_obj_size();
void * mem = allocate_node(sz);
sort * new_node = new (mem) sort(name, info);
return register_node(new_node);
}
sort * ast_manager::mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters) {
user_sort_plugin * plugin = get_user_sort_plugin();
decl_kind kind = plugin->register_name(name);
return plugin->mk_sort(kind, num_parameters, parameters);
}
func_decl * ast_manager::mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range,
bool assoc, bool comm, bool inj) {
func_decl_info info(null_family_id, null_decl_kind);
info.set_associative(assoc);
info.set_commutative(comm);
info.set_injective(inj);
return mk_func_decl(name, arity, domain, range, info);
}
func_decl * ast_manager::mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range, func_decl_info * info) {
SASSERT(arity == 1 || info == 0 || !info->is_injective());
SASSERT(arity == 2 || info == 0 || !info->is_associative());
SASSERT(arity == 2 || info == 0 || !info->is_commutative());
unsigned sz = func_decl::get_obj_size(arity);
void * mem = allocate_node(sz);
func_decl * new_node = new (mem) func_decl(name, arity, domain, range, info);
return register_node(new_node);
}
void ast_manager::check_sort(func_decl const * decl, unsigned num_args, expr * const * args) const {
ast_manager& m = const_cast<ast_manager&>(*this);
if (decl->is_associative()) {
sort * expected = decl->get_domain(0);
for (unsigned i = 0; i < num_args; i++) {
sort * given = get_sort(args[i]);
if (!compatible_sorts(expected, given)) {
std::ostringstream buff;
buff << "invalid function application for " << decl->get_name() << ", ";
buff << "sort mismatch on argument at position " << (i+1) << ", ";
buff << "expected " << mk_pp(expected, m) << " but given " << mk_pp(given, m);
throw ast_exception(buff.str().c_str());
}
}
}
else {
if (decl->get_arity() != num_args) {
throw ast_exception("invalid function application, wrong number of arguments");
}
for (unsigned i = 0; i < num_args; i++) {
sort * expected = decl->get_domain(i);
sort * given = get_sort(args[i]);
if (!compatible_sorts(expected, given)) {
std::ostringstream buff;
buff << "invalid function application for " << decl->get_name() << ", ";
buff << "sort mismatch on argument at position " << (i+1) << ", ";
buff << "expected " << mk_pp(expected, m) << " but given " << mk_pp(given, m);
throw ast_exception(buff.str().c_str());
}
}
}
}
/**
\brief Shallow sort checker.
Return true if success.
If n == 0, then fail.
If n is an application, checks whether the arguments of n match the expected types.
*/
void ast_manager::check_sorts_core(ast const * n) const {
if (!n) {
throw ast_exception("expression is null");
}
if (n->get_kind() != AST_APP)
return; // nothing else to check...
app const * a = to_app(n);
func_decl* d = a->get_decl();
check_sort(d, a->get_num_args(), a->get_args());
if (a->get_num_args() == 2 &&
!d->is_flat_associative() &&
d->is_right_associative()) {
check_sorts_core(a->get_arg(1));
}
if (a->get_num_args() == 2 &&
!d->is_flat_associative() &&
d->is_left_associative()) {
check_sorts_core(a->get_arg(0));
}
}
bool ast_manager::check_sorts(ast const * n) const {
try {
check_sorts_core(n);
return true;
}
catch (ast_exception & ex) {
warning_msg(ex.msg());
return false;
}
}
bool ast_manager::compatible_sorts(sort * s1, sort * s2) const {
if (s1 == s2)
return true;
if (m_int_real_coercions)
return s1->get_family_id() == m_arith_family_id && s2->get_family_id() == m_arith_family_id;
return false;
}
bool ast_manager::coercion_needed(func_decl * decl, unsigned num_args, expr * const * args) {
SASSERT(m_int_real_coercions);
if (decl->is_associative()) {
sort * d = decl->get_domain(0);
if (d->get_family_id() == m_arith_family_id) {
for (unsigned i = 0; i < num_args; i++) {
if (d != get_sort(args[i]))
return true;
}
}
}
else {
if (decl->get_arity() != num_args) {
// Invalid input: unexpected number of arguments for non-associative operator.
// So, there is no point in coercing the input arguments.
return false;
}
for (unsigned i = 0; i < num_args; i++) {
sort * d = decl->get_domain(i);
if (d->get_family_id() == m_arith_family_id && d != get_sort(args[i]))
return true;
}
}
return false;
}
app * ast_manager::mk_app_core(func_decl * decl, unsigned num_args, expr * const * args) {
app * r = 0;
app * new_node = 0;
unsigned sz = app::get_obj_size(num_args);
void * mem = allocate_node(sz);
try {
if (m_int_real_coercions && coercion_needed(decl, num_args, args)) {
expr_ref_buffer new_args(*this);
if (decl->is_associative()) {
sort * d = decl->get_domain(0);
for (unsigned i = 0; i < num_args; i++) {
sort * s = get_sort(args[i]);
if (d != s && d->get_family_id() == m_arith_family_id && s->get_family_id() == m_arith_family_id) {
if (d->get_decl_kind() == REAL_SORT)
new_args.push_back(mk_app(m_arith_family_id, OP_TO_REAL, args[i]));
else
new_args.push_back(mk_app(m_arith_family_id, OP_TO_INT, args[i]));
}
else {
new_args.push_back(args[i]);
}
}
}
else {
for (unsigned i = 0; i < num_args; i++) {
sort * d = decl->get_domain(i);
sort * s = get_sort(args[i]);
if (d != s && d->get_family_id() == m_arith_family_id && s->get_family_id() == m_arith_family_id) {
if (d->get_decl_kind() == REAL_SORT)
new_args.push_back(mk_app(m_arith_family_id, OP_TO_REAL, args[i]));
else
new_args.push_back(mk_app(m_arith_family_id, OP_TO_INT, args[i]));
}
else {
new_args.push_back(args[i]);
}
}
}
check_args(decl, num_args, new_args.c_ptr());
SASSERT(new_args.size() == num_args);
new_node = new (mem)app(decl, num_args, new_args.c_ptr());
r = register_node(new_node);
}
else {
check_args(decl, num_args, args);
new_node = new (mem)app(decl, num_args, args);
r = register_node(new_node);
}
if (m_trace_stream && r == new_node) {
*m_trace_stream << "[mk-app] #" << r->get_id() << " ";
if (r->get_num_args() == 0 && r->get_decl()->get_name() == "int") {
ast_ll_pp(*m_trace_stream, *this, r);
}
else if (is_label_lit(r)) {
ast_ll_pp(*m_trace_stream, *this, r);
}
else {
*m_trace_stream << r->get_decl()->get_name();
for (unsigned i = 0; i < r->get_num_args(); i++)
*m_trace_stream << " #" << r->get_arg(i)->get_id();
*m_trace_stream << "\n";
}
}
}
catch (...) {
deallocate_node(static_cast<ast*>(mem), sz);
throw;
}
return r;
}
void ast_manager::check_args(func_decl* f, unsigned n, expr* const* es) {
for (unsigned i = 0; i < n; i++) {
sort * actual_sort = get_sort(es[i]);
sort * expected_sort = f->is_associative() ? f->get_domain(0) : f->get_domain(i);
if (expected_sort != actual_sort) {
std::ostringstream buffer;
buffer << "Sort mismatch at argument #" << (i+1)
<< " for function " << mk_pp(f,*this)
<< " supplied sort is "
<< mk_pp(actual_sort, *this);
throw ast_exception(buffer.str().c_str());
}
}
}
inline app * ast_manager::mk_app_core(func_decl * decl, expr * arg1, expr * arg2) {
expr * args[2] = { arg1, arg2 };
return mk_app_core(decl, 2, args);
}
app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * args) {
bool type_error =
decl->get_arity() != num_args && !decl->is_right_associative() &&
!decl->is_left_associative() && !decl->is_chainable();
type_error |= (decl->get_arity() != num_args && num_args < 2 &&
decl->get_family_id() == m_basic_family_id && !decl->is_associative());
if (type_error) {
std::ostringstream buffer;
buffer << "Wrong number of arguments (" << num_args
<< ") passed to function " << mk_pp(decl, *this);
throw ast_exception(buffer.str().c_str());
}
app * r = 0;
if (num_args > 2 && !decl->is_flat_associative()) {
if (decl->is_right_associative()) {
unsigned j = num_args - 1;
r = mk_app_core(decl, args[j-1], args[j]);
-- j;
while (j > 0) {
--j;
r = mk_app_core(decl, args[j], r);
}
}
else if (decl->is_left_associative()) {
r = mk_app_core(decl, args[0], args[1]);
for (unsigned i = 2; i < num_args; i++) {
r = mk_app_core(decl, r, args[i]);
}
}
else if (decl->is_chainable()) {
TRACE("chainable", tout << "chainable...\n";);
ptr_buffer<expr> new_args;
for (unsigned i = 1; i < num_args; i++) {
new_args.push_back(mk_app_core(decl, args[i-1], args[i]));
}
r = mk_and(new_args.size(), new_args.c_ptr());
}
}
if (r == 0) {
r = mk_app_core(decl, num_args, args);
}
SASSERT(r != 0);
TRACE("app_ground", tout << "ground: " << r->is_ground() << "\n" << mk_ll_pp(r, *this) << "\n";);
return r;
}
func_decl * ast_manager::mk_fresh_func_decl(symbol const & prefix, symbol const & suffix, unsigned arity,
sort * const * domain, sort * range) {
func_decl_info info(null_family_id, null_decl_kind);
info.m_skolem = true;
SASSERT(info.is_skolem());
func_decl * d;
if (prefix == symbol::null && suffix == symbol::null) {
d = mk_func_decl(symbol(m_fresh_id), arity, domain, range, &info);
}
else {
string_buffer<64> buffer;
buffer << prefix;
if (prefix == symbol::null)
buffer << "sk";
buffer << "!";
if (suffix != symbol::null)
buffer << suffix << "!";
buffer << m_fresh_id;
d = mk_func_decl(symbol(buffer.c_str()), arity, domain, range, &info);
}
m_fresh_id++;
SASSERT(d->get_info());
SASSERT(d->is_skolem());
return d;
}
sort * ast_manager::mk_fresh_sort(char const * prefix) {
string_buffer<32> buffer;
buffer << prefix << "!" << m_fresh_id;
m_fresh_id++;
return mk_uninterpreted_sort(symbol(buffer.c_str()));
}
symbol ast_manager::mk_fresh_var_name(char const * prefix) {
string_buffer<32> buffer;
buffer << (prefix ? prefix : "var") << "!" << m_fresh_id;
m_fresh_id++;
return symbol(buffer.c_str());
}
var * ast_manager::mk_var(unsigned idx, sort * s) {
unsigned sz = var::get_obj_size();
void * mem = allocate_node(sz);
var * new_node = new (mem) var(idx, s);
return register_node(new_node);
}
app * ast_manager::mk_label(bool pos, unsigned num_names, symbol const * names, expr * n) {
SASSERT(num_names > 0);
SASSERT(get_sort(n) == m_bool_sort);
buffer<parameter> p;
p.push_back(parameter(static_cast<int>(pos)));
for (unsigned i = 0; i < num_names; i++)
p.push_back(parameter(names[i]));
return mk_app(m_label_family_id, OP_LABEL, p.size(), p.c_ptr(), 1, &n);
}
app * ast_manager::mk_label(bool pos, symbol const & name, expr * n) {
return mk_label(pos, 1, &name, n);
}
bool ast_manager::is_label(expr const * n, bool & pos, buffer<symbol> & names) const {
if (!is_app_of(n, m_label_family_id, OP_LABEL)) {
return false;
}
func_decl const * decl = to_app(n)->get_decl();
pos = decl->get_parameter(0).get_int() != 0;
for (unsigned i = 1; i < decl->get_num_parameters(); i++)
names.push_back(decl->get_parameter(i).get_symbol());
return true;
}
app * ast_manager::mk_label_lit(unsigned num_names, symbol const * names) {
SASSERT(num_names > 0);
buffer<parameter> p;
for (unsigned i = 0; i < num_names; i++)
p.push_back(parameter(names[i]));
return mk_app(m_label_family_id, OP_LABEL_LIT, p.size(), p.c_ptr(), 0, 0);
}
app * ast_manager::mk_label_lit(symbol const & name) {
return mk_label_lit(1, &name);
}
bool ast_manager::is_label_lit(expr const * n, buffer<symbol> & names) const {
if (!is_app_of(n, m_label_family_id, OP_LABEL_LIT)) {
return false;
}
func_decl const * decl = to_app(n)->get_decl();
for (unsigned i = 0; i < decl->get_num_parameters(); i++)
names.push_back(decl->get_parameter(i).get_symbol());
return true;
}
app * ast_manager::mk_pattern(unsigned num_exprs, app * const * exprs) {
DEBUG_CODE({
for (unsigned i = 0; i < num_exprs; ++i) {
SASSERT(is_app(exprs[i]));
}});
return mk_app(m_pattern_family_id, OP_PATTERN, 0, 0, num_exprs, (expr*const*)exprs);
}
bool ast_manager::is_pattern(expr const * n) const {
if (!is_app_of(n, m_pattern_family_id, OP_PATTERN)) {
return false;
}
for (unsigned i = 0; i < to_app(n)->get_num_args(); ++i) {
if (!is_app(to_app(n)->get_arg(i))) {
return false;
}
}
return true;
}
quantifier * ast_manager::mk_quantifier(bool forall, unsigned num_decls, sort * const * decl_sorts, symbol const * decl_names,
expr * body, int weight , symbol const & qid, symbol const & skid,
unsigned num_patterns, expr * const * patterns,
unsigned num_no_patterns, expr * const * no_patterns) {
SASSERT(body);
SASSERT(num_patterns == 0 || num_no_patterns == 0);
SASSERT(num_decls > 0);
DEBUG_CODE({
for (unsigned i = 0; i < num_patterns; ++i) {
SASSERT(is_pattern(patterns[i]));
}});
unsigned sz = quantifier::get_obj_size(num_decls, num_patterns, num_no_patterns);
void * mem = allocate_node(sz);
quantifier * new_node = new (mem) quantifier(forall, num_decls, decl_sorts, decl_names, body,
weight, qid, skid, num_patterns, patterns,
num_no_patterns, no_patterns);
quantifier * r = register_node(new_node);
if (m_trace_stream && r == new_node) {
*m_trace_stream << "[mk-quant] #" << r->get_id() << " " << qid;
for (unsigned i = 0; i < num_patterns; ++i) {
*m_trace_stream << " #" << patterns[i]->get_id();
}
*m_trace_stream << " #" << body->get_id() << "\n";
}
return r;
}
// Return true if the patterns of q are the given ones.
static bool same_patterns(quantifier * q, unsigned num_patterns, expr * const * patterns) {
if (num_patterns != q->get_num_patterns())
return false;
for (unsigned i = 0; i < num_patterns; i++)
if (q->get_pattern(i) != patterns[i])
return false;
return true;
}
// Return true if the no patterns of q are the given ones.
static bool same_no_patterns(quantifier * q, unsigned num_no_patterns, expr * const * no_patterns) {
if (num_no_patterns != q->get_num_no_patterns())
return false;
for (unsigned i = 0; i < num_no_patterns; i++)
if (q->get_no_pattern(i) != no_patterns[i])
return false;
return true;
}
quantifier * ast_manager::update_quantifier(quantifier * q, unsigned num_patterns, expr * const * patterns, expr * body) {
if (q->get_expr() == body && same_patterns(q, num_patterns, patterns))
return q;
return mk_quantifier(q->is_forall(),
q->get_num_decls(),
q->get_decl_sorts(),
q->get_decl_names(),
body,
q->get_weight(),
q->get_qid(),
q->get_skid(),
num_patterns,
patterns,
num_patterns == 0 ? q->get_num_no_patterns() : 0,
num_patterns == 0 ? q->get_no_patterns() : 0);
}
quantifier * ast_manager::update_quantifier(quantifier * q, unsigned num_patterns, expr * const * patterns, unsigned num_no_patterns, expr * const * no_patterns, expr * body) {
if (q->get_expr() == body && same_patterns(q, num_patterns, patterns) && same_no_patterns(q, num_no_patterns, no_patterns))
return q;
return mk_quantifier(q->is_forall(),
q->get_num_decls(),
q->get_decl_sorts(),
q->get_decl_names(),
body,
q->get_weight(),
q->get_qid(),
q->get_skid(),
num_patterns,
patterns,
num_no_patterns,
no_patterns);
}
quantifier * ast_manager::update_quantifier(quantifier * q, expr * body) {
if (q->get_expr() == body)
return q;
return mk_quantifier(q->is_forall(),
q->get_num_decls(),
q->get_decl_sorts(),
q->get_decl_names(),
body,
q->get_weight(),
q->get_qid(),
q->get_skid(),
q->get_num_patterns(),
q->get_patterns(),
q->get_num_no_patterns(),
q->get_no_patterns());
}
quantifier * ast_manager::update_quantifier_weight(quantifier * q, int w) {
if (q->get_weight() == w)
return q;
TRACE("update_quantifier_weight", tout << "#" << q->get_id() << " " << q->get_weight() << " -> " << w << "\n";);
return mk_quantifier(q->is_forall(),
q->get_num_decls(),
q->get_decl_sorts(),
q->get_decl_names(),
q->get_expr(),
w,
q->get_qid(),
q->get_skid(),
q->get_num_patterns(),
q->get_patterns(),
q->get_num_no_patterns(),
q->get_no_patterns());
}
quantifier * ast_manager::update_quantifier(quantifier * q, bool is_forall, expr * body) {
if (q->get_expr() == body && q->is_forall() == is_forall)
return q;
return mk_quantifier(is_forall,
q->get_num_decls(),
q->get_decl_sorts(),
q->get_decl_names(),
body,
q->get_weight(),
q->get_qid(),
q->get_skid(),
q->get_num_patterns(),
q->get_patterns(),
q->get_num_no_patterns(),
q->get_no_patterns());
}
quantifier * ast_manager::update_quantifier(quantifier * q, bool is_forall, unsigned num_patterns, expr * const * patterns, expr * body) {
if (q->get_expr() == body && q->is_forall() == is_forall && same_patterns(q, num_patterns, patterns))
return q;
return mk_quantifier(is_forall,
q->get_num_decls(),
q->get_decl_sorts(),
q->get_decl_names(),
body,
q->get_weight(),
q->get_qid(),
q->get_skid(),
num_patterns,
patterns,
num_patterns == 0 ? q->get_num_no_patterns() : 0,
num_patterns == 0 ? q->get_no_patterns() : 0);
}
app * ast_manager::mk_distinct(unsigned num_args, expr * const * args) {
return mk_app(m_basic_family_id, OP_DISTINCT, num_args, args);
}
app * ast_manager::mk_distinct_expanded(unsigned num_args, expr * const * args) {
if (num_args < 2)
return mk_true();
if (num_args == 2)
return mk_not(mk_eq(args[0], args[1]));
ptr_buffer<expr> new_args;
for (unsigned i = 0; i < num_args - 1; i++) {
expr * a1 = args[i];
for (unsigned j = i + 1; j < num_args; j++) {
expr * a2 = args[j];
new_args.push_back(mk_not(mk_eq(a1, a2)));
}
}
app * r = mk_and(new_args.size(), new_args.c_ptr());
TRACE("distinct", tout << "expanded distinct:\n" << mk_pp(r, *this) << "\n";);
return r;
}
// -----------------------------------
//
// expr_dependency
//
// -----------------------------------
expr_dependency * ast_manager::mk_leaf(expr * t) {
if (t == 0)
return 0;
else
return m_expr_dependency_manager.mk_leaf(t);
}
expr_dependency * ast_manager::mk_join(unsigned n, expr * const * ts) {
expr_dependency * d = 0;
for (unsigned i = 0; i < n; i++)
d = mk_join(d, mk_leaf(ts[i]));
return d;
}
void ast_manager::linearize(expr_dependency * d, ptr_vector<expr> & ts) {
m_expr_dependency_manager.linearize(d, ts);
remove_duplicates(ts);
}
// -----------------------------------
//
// Values
//
// -----------------------------------
app * ast_manager::mk_model_value(unsigned idx, sort * s) {
parameter p[2] = { parameter(idx), parameter(s) };
return mk_app(m_model_value_family_id, OP_MODEL_VALUE, 2, p, 0, static_cast<expr * const *>(0));
}
expr * ast_manager::get_some_value(sort * s, some_value_proc * p) {
flet<some_value_proc*> l(m_some_value_proc, p);
return get_some_value(s);
}
expr * ast_manager::get_some_value(sort * s) {
expr * v = 0;
if (m_some_value_proc)
v = (*m_some_value_proc)(s);
if (v != 0)
return v;
family_id fid = s->get_family_id();
if (fid != null_family_id) {
decl_plugin * p = get_plugin(fid);
if (p != 0) {
v = p->get_some_value(s);
if (v != 0)
return v;
}
}
return mk_model_value(0, s);
}
bool ast_manager::is_fully_interp(sort const * s) const {
if (is_uninterp(s))
return false;
family_id fid = s->get_family_id();
SASSERT(fid != null_family_id);
decl_plugin * p = get_plugin(fid);
if (p != 0)
return p->is_fully_interp(s);
return false;
}
// -----------------------------------
//
// Proof generation
//
// -----------------------------------
proof * ast_manager::mk_proof(family_id fid, decl_kind k, unsigned num_args, expr * const * args) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(fid, k, num_args, args);
}
proof * ast_manager::mk_proof(family_id fid, decl_kind k, expr * arg) {
return mk_proof(fid, k, 1, &arg);
}
proof * ast_manager::mk_proof(family_id fid, decl_kind k, expr * arg1, expr * arg2) {
expr * args[2] = { arg1, arg2 };
return mk_proof(fid, k, 2, args);
}
proof * ast_manager::mk_proof(family_id fid, decl_kind k, expr * arg1, expr * arg2, expr * arg3) {
expr * args[3] = { arg1, arg2, arg3 };
return mk_proof(fid, k, 2, args);
}
proof * ast_manager::mk_true_proof() {
expr * f = mk_true();
return mk_proof(m_basic_family_id, PR_TRUE, f);
}
proof * ast_manager::mk_asserted(expr * f) {
CTRACE("mk_asserted_bug", !is_bool(f), tout << mk_ismt2_pp(f, *this) << "\nsort: " << mk_ismt2_pp(get_sort(f), *this) << "\n";);
SASSERT(is_bool(f));
return mk_proof(m_basic_family_id, PR_ASSERTED, f);
}
proof * ast_manager::mk_goal(expr * f) {
SASSERT(is_bool(f));
return mk_proof(m_basic_family_id, PR_GOAL, f);
}
proof * ast_manager::mk_modus_ponens(proof * p1, proof * p2) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(has_fact(p1));
SASSERT(has_fact(p2));
CTRACE("mk_modus_ponens", !(is_implies(get_fact(p2)) || is_iff(get_fact(p2)) || is_oeq(get_fact(p2))),
tout << mk_ll_pp(p1, *this) << "\n";
tout << mk_ll_pp(p2, *this) << "\n";);
SASSERT(is_implies(get_fact(p2)) || is_iff(get_fact(p2)) || is_oeq(get_fact(p2)));
CTRACE("mk_modus_ponens", to_app(get_fact(p2))->get_arg(0) != get_fact(p1),
tout << mk_pp(get_fact(p1), *this) << "\n" << mk_pp(get_fact(p2), *this) << "\n";);
SASSERT(to_app(get_fact(p2))->get_arg(0) == get_fact(p1));
if (is_reflexivity(p2))
return p1;
expr * f = to_app(get_fact(p2))->get_arg(1);
if (is_oeq(get_fact(p2)))
return mk_app(m_basic_family_id, PR_MODUS_PONENS_OEQ, p1, p2, f);
return mk_app(m_basic_family_id, PR_MODUS_PONENS, p1, p2, f);
}
proof * ast_manager::mk_reflexivity(expr * e) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_REFLEXIVITY, mk_eq(e, e));
}
proof * ast_manager::mk_oeq_reflexivity(expr * e) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_REFLEXIVITY, mk_oeq(e, e));
}
proof * ast_manager::mk_commutativity(app * f) {
SASSERT(f->get_num_args() == 2);
app * f_prime = mk_app(f->get_decl(), f->get_arg(1), f->get_arg(0));
return mk_app(m_basic_family_id, PR_COMMUTATIVITY, mk_eq(f, f_prime));
}
/**
\brief Given a proof of p, return a proof of (p <=> true)
*/
proof * ast_manager::mk_iff_true(proof * pr) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(has_fact(pr));
SASSERT(is_bool(get_fact(pr)));
return mk_app(m_basic_family_id, PR_IFF_TRUE, pr, mk_iff(get_fact(pr), mk_true()));
}
/**
\brief Given a proof of (not p), return a proof of (p <=> false)
*/
proof * ast_manager::mk_iff_false(proof * pr) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(has_fact(pr));
SASSERT(is_not(get_fact(pr)));
expr * p = to_app(get_fact(pr))->get_arg(0);
return mk_app(m_basic_family_id, PR_IFF_FALSE, pr, mk_iff(p, mk_false()));
}
proof * ast_manager::mk_symmetry(proof * p) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
if (!p)
return p;
if (is_reflexivity(p))
return p;
if (is_symmetry(p))
return get_parent(p, 0);
SASSERT(has_fact(p));
SASSERT(is_app(get_fact(p)));
SASSERT(to_app(get_fact(p))->get_num_args() == 2);
return mk_app(m_basic_family_id, PR_SYMMETRY, p,
mk_app(to_app(get_fact(p))->get_decl(), to_app(get_fact(p))->get_arg(1), to_app(get_fact(p))->get_arg(0)));
}
proof * ast_manager::mk_transitivity(proof * p1, proof * p2) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
if (!p1)
return p2;
if (!p2)
return p1;
SASSERT(has_fact(p1));
SASSERT(has_fact(p2));
SASSERT(is_app(get_fact(p1)));
SASSERT(is_app(get_fact(p2)));
SASSERT(to_app(get_fact(p1))->get_num_args() == 2);
SASSERT(to_app(get_fact(p2))->get_num_args() == 2);
CTRACE("mk_transitivity", to_app(get_fact(p1))->get_decl() != to_app(get_fact(p2))->get_decl(),
tout << mk_pp(get_fact(p1), *this) << "\n\n" << mk_pp(get_fact(p2), *this) << "\n";
tout << mk_pp(to_app(get_fact(p1))->get_decl(), *this) << "\n";
tout << mk_pp(to_app(get_fact(p2))->get_decl(), *this) << "\n";);
SASSERT(to_app(get_fact(p1))->get_decl() == to_app(get_fact(p2))->get_decl() ||
((is_iff(get_fact(p1)) || is_eq(get_fact(p1))) &&
(is_iff(get_fact(p2)) || is_eq(get_fact(p2)))) ||
( (is_eq(get_fact(p1)) || is_oeq(get_fact(p1))) &&
(is_eq(get_fact(p2)) || is_oeq(get_fact(p2)))));
CTRACE("mk_transitivity", to_app(get_fact(p1))->get_arg(1) != to_app(get_fact(p2))->get_arg(0),
tout << mk_pp(get_fact(p1), *this) << "\n\n" << mk_pp(get_fact(p2), *this) << "\n";
tout << mk_bounded_pp(p1, *this, 5) << "\n\n";
tout << mk_bounded_pp(p2, *this, 5) << "\n\n";
);
SASSERT(to_app(get_fact(p1))->get_arg(1) == to_app(get_fact(p2))->get_arg(0));
if (is_reflexivity(p1))
return p2;
if (is_reflexivity(p2))
return p1;
// OEQ is compatible with EQ for transitivity.
func_decl* f = to_app(get_fact(p1))->get_decl();
if (is_oeq(get_fact(p2))) f = to_app(get_fact(p2))->get_decl();
return mk_app(m_basic_family_id, PR_TRANSITIVITY, p1, p2, mk_app(f, to_app(get_fact(p1))->get_arg(0), to_app(get_fact(p2))->get_arg(1)));
}
proof * ast_manager::mk_transitivity(proof * p1, proof * p2, proof * p3) {
return mk_transitivity(mk_transitivity(p1,p2), p3);
}
proof * ast_manager::mk_transitivity(proof * p1, proof * p2, proof * p3, proof * p4) {
return mk_transitivity(mk_transitivity(mk_transitivity(p1,p2), p3), p4);
}
proof * ast_manager::mk_transitivity(unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(num_proofs > 0);
proof * r = proofs[0];
for (unsigned i = 1; i < num_proofs; i++)
r = mk_transitivity(r, proofs[i]);
return r;
}
proof * ast_manager::mk_transitivity(unsigned num_proofs, proof * const * proofs, expr * n1, expr * n2) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
if (fine_grain_proofs())
return mk_transitivity(num_proofs, proofs);
SASSERT(num_proofs > 0);
if (num_proofs == 1)
return proofs[0];
DEBUG_CODE({
for (unsigned i = 0; i < num_proofs; i++) {
SASSERT(proofs[i]);
SASSERT(!is_reflexivity(proofs[i]));
}
});
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_eq(n1,n2));
return mk_app(m_basic_family_id, PR_TRANSITIVITY_STAR, args.size(), args.c_ptr());
}
proof * ast_manager::mk_monotonicity(func_decl * R, app * f1, app * f2, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(f1->get_num_args() == f2->get_num_args());
SASSERT(f1->get_decl() == f2->get_decl());
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_app(R, f1, f2));
return mk_app(m_basic_family_id, PR_MONOTONICITY, args.size(), args.c_ptr());
}
proof * ast_manager::mk_congruence(app * f1, app * f2, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(get_sort(f1) == get_sort(f2));
sort * s = get_sort(f1);
sort * d[2] = { s, s };
return mk_monotonicity(mk_func_decl(m_basic_family_id, get_eq_op(f1), 0, 0, 2, d), f1, f2, num_proofs, proofs);
}
proof * ast_manager::mk_oeq_congruence(app * f1, app * f2, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(get_sort(f1) == get_sort(f2));
sort * s = get_sort(f1);
sort * d[2] = { s, s };
return mk_monotonicity(mk_func_decl(m_basic_family_id, OP_OEQ, 0, 0, 2, d), f1, f2, num_proofs, proofs);
}
proof * ast_manager::mk_quant_intro(quantifier * q1, quantifier * q2, proof * p) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
if (!p) {
return 0;
}
SASSERT(q1->get_num_decls() == q2->get_num_decls());
SASSERT(has_fact(p));
SASSERT(is_iff(get_fact(p)));
return mk_app(m_basic_family_id, PR_QUANT_INTRO, p, mk_iff(q1, q2));
}
proof * ast_manager::mk_oeq_quant_intro(quantifier * q1, quantifier * q2, proof * p) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(q1->get_num_decls() == q2->get_num_decls());
SASSERT(has_fact(p));
SASSERT(is_oeq(get_fact(p)));
return mk_app(m_basic_family_id, PR_QUANT_INTRO, p, mk_oeq(q1, q2));
}
proof * ast_manager::mk_distributivity(expr * s, expr * r) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_DISTRIBUTIVITY, mk_eq(s, r));
}
proof * ast_manager::mk_rewrite(expr * s, expr * t) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_REWRITE, mk_eq(s, t));
}
proof * ast_manager::mk_oeq_rewrite(expr * s, expr * t) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_REWRITE, mk_oeq(s, t));
}
proof * ast_manager::mk_rewrite_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_eq(s, t));
return mk_app(m_basic_family_id, PR_REWRITE_STAR, args.size(), args.c_ptr());
}
proof * ast_manager::mk_pull_quant(expr * e, quantifier * q) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_PULL_QUANT, mk_iff(e, q));
}
proof * ast_manager::mk_pull_quant_star(expr * e, quantifier * q) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_PULL_QUANT_STAR, mk_iff(e, q));
}
proof * ast_manager::mk_push_quant(quantifier * q, expr * e) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_PUSH_QUANT, mk_iff(q, e));
}
proof * ast_manager::mk_elim_unused_vars(quantifier * q, expr * e) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_ELIM_UNUSED_VARS, mk_iff(q, e));
}
proof * ast_manager::mk_der(quantifier * q, expr * e) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_DER, mk_iff(q, e));
}
proof * ast_manager::mk_quant_inst(expr * not_q_or_i, unsigned num_bind, expr* const* binding) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
vector<parameter> params;
for (unsigned i = 0; i < num_bind; ++i) {
params.push_back(parameter(binding[i]));
SASSERT(params.back().is_ast());
}
return mk_app(m_basic_family_id, PR_QUANT_INST, num_bind, params.c_ptr(), 1, & not_q_or_i);
}
bool ast_manager::is_quant_inst(expr const* e, expr*& not_q_or_i, ptr_vector<expr>& binding) const {
if (is_quant_inst(e)) {
not_q_or_i = to_app(e)->get_arg(0);
func_decl* d = to_app(e)->get_decl();
SASSERT(binding.empty());
for (unsigned i = 0; i < d->get_num_parameters(); ++i) {
binding.push_back(to_expr(d->get_parameter(i).get_ast()));
}
return true;
}
return false;
}
bool ast_manager::is_rewrite(expr const* e, expr*& r1, expr*& r2) const {
if (is_rewrite(e)) {
VERIFY (is_eq(to_app(e)->get_arg(0), r1, r2) ||
is_iff(to_app(e)->get_arg(0), r1, r2));
return true;
}
else {
return false;
}
}
proof * ast_manager::mk_def_axiom(expr * ax) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_DEF_AXIOM, ax);
}
proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * proofs) {
SASSERT(num_proofs >= 2);
for (unsigned i = 0; i < num_proofs; i++) {
SASSERT(has_fact(proofs[i]));
}
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
expr * fact;
expr * f1 = get_fact(proofs[0]);
expr * f2 = get_fact(proofs[1]);
if (num_proofs == 2 && is_complement(f1, f2)) {
fact = mk_false();
}
else {
CTRACE("mk_unit_resolution_bug", !is_or(f1), tout << mk_pp(f1, *this) << " " << mk_pp(f2, *this) << "\n";);
SASSERT(is_or(f1));
ptr_buffer<expr> new_lits;
app const * cls = to_app(f1);
unsigned num_args = cls->get_num_args();
#ifdef Z3DEBUG
svector<bool> found;
#endif
for (unsigned i = 0; i < num_args; i++) {
expr * lit = cls->get_arg(i);
unsigned j = 1;
for (; j < num_proofs; j++) {
expr const * _fact = get_fact(proofs[j]);
if (is_complement(lit, _fact)) {
DEBUG_CODE(found.setx(j, true, false););
break;
}
}
if (j == num_proofs)
new_lits.push_back(lit);
}
DEBUG_CODE({
for (unsigned i = 1; m_proof_mode == PGM_FINE && i < num_proofs; i++) {
CTRACE("mk_unit_resolution_bug", !found.get(i, false),
for (unsigned j = 0; j < num_proofs; j++) {
tout << mk_ll_pp(get_fact(proofs[j]), *this);
});
SASSERT(found.get(i, false));
}
});
switch (new_lits.size()) {
case 0:
fact = mk_false();
break;
case 1:
fact = new_lits[0];
break;
default:
fact = mk_or(new_lits.size(), new_lits.c_ptr());
break;
}
}
args.push_back(fact);
proof * pr = mk_app(m_basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.c_ptr());
TRACE("unit_resolution", tout << "unit_resolution generating fact\n" << mk_ll_pp(pr, *this););
return pr;
}
proof * ast_manager::mk_unit_resolution(unsigned num_proofs, proof * const * proofs, expr * new_fact) {
TRACE("unit_bug",
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
tout << "===>\n";
tout << mk_pp(new_fact, *this) << "\n";);
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(new_fact);
#ifdef Z3DEBUG
expr * f1 = get_fact(proofs[0]);
expr const * f2 = get_fact(proofs[1]);
if (num_proofs == 2 && is_complement(f1, f2)) {
SASSERT(is_false(new_fact));
}
else {
SASSERT(is_or(f1));
app * cls = to_app(f1);
unsigned cls_sz = cls->get_num_args();
CTRACE("cunit_bug", !(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact))),
for (unsigned i = 0; i < num_proofs; i++) tout << mk_pp(get_fact(proofs[i]), *this) << "\n";
tout << "===>\n";
tout << mk_pp(new_fact, *this) << "\n";);
SASSERT(num_proofs == cls_sz || (num_proofs == cls_sz + 1 && is_false(new_fact)));
unsigned num_matches = 0;
for (unsigned i = 0; i < cls_sz; i++) {
expr * lit = cls->get_arg(i);
unsigned j = 1;
for (; j < num_proofs; j++) {
if (is_complement(lit, get_fact(proofs[j]))) {
num_matches++;
break;
}
}
if (j == num_proofs) {
CTRACE("unit_bug1", new_fact != lit, tout << mk_ll_pp(new_fact, *this) << "\n" << mk_ll_pp(lit, *this) << "\n";);
SASSERT(new_fact == lit);
}
}
SASSERT(num_matches == cls_sz || num_matches == cls_sz - 1);
SASSERT(num_matches != cls_sz || is_false(new_fact));
}
#endif
proof * pr = mk_app(m_basic_family_id, PR_UNIT_RESOLUTION, args.size(), args.c_ptr());
TRACE("unit_resolution", tout << "unit_resolution using fact\n" << mk_ll_pp(pr, *this););
return pr;
}
proof * ast_manager::mk_hypothesis(expr * h) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
return mk_app(m_basic_family_id, PR_HYPOTHESIS, h);
}
proof * ast_manager::mk_lemma(proof * p, expr * lemma) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(has_fact(p));
CTRACE("mk_lemma", !is_false(get_fact(p)), tout << mk_ll_pp(p, *this) << "\n";);
SASSERT(is_false(get_fact(p)));
return mk_app(m_basic_family_id, PR_LEMMA, p, lemma);
}
proof * ast_manager::mk_def_intro(expr * new_def) {
SASSERT(is_bool(new_def));
return mk_proof(m_basic_family_id, PR_DEF_INTRO, new_def);
}
proof * ast_manager::mk_apply_defs(expr * n, expr * def, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(n, def));
return mk_app(m_basic_family_id, PR_APPLY_DEF, args.size(), args.c_ptr());
}
proof * ast_manager::mk_iff_oeq(proof * p) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
if (!p)
return p;
SASSERT(has_fact(p));
SASSERT(is_iff(get_fact(p)) || is_oeq(get_fact(p)));
if (is_oeq(get_fact(p)))
return p;
app * iff = to_app(get_fact(p));
expr * lhs = iff->get_arg(0);
expr * rhs = iff->get_arg(1);
return mk_app(m_basic_family_id, PR_IFF_OEQ, p, mk_oeq(lhs, rhs));
}
bool ast_manager::check_nnf_proof_parents(unsigned num_proofs, proof * const * proofs) const {
for (unsigned i = 0; i < num_proofs; i++) {
if (!has_fact(proofs[i]))
return false;
if (!is_oeq(get_fact(proofs[i])))
return false;
}
return true;
}
proof * ast_manager::mk_nnf_pos(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
check_nnf_proof_parents(num_proofs, proofs);
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(s, t));
return mk_app(m_basic_family_id, PR_NNF_POS, args.size(), args.c_ptr());
}
proof * ast_manager::mk_nnf_neg(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
check_nnf_proof_parents(num_proofs, proofs);
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(mk_not(s), t));
return mk_app(m_basic_family_id, PR_NNF_NEG, args.size(), args.c_ptr());
}
proof * ast_manager::mk_nnf_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(s, t));
return mk_app(m_basic_family_id, PR_NNF_STAR, args.size(), args.c_ptr());
}
proof * ast_manager::mk_skolemization(expr * q, expr * e) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(is_bool(q));
SASSERT(is_bool(e));
return mk_app(m_basic_family_id, PR_SKOLEMIZE, mk_oeq(q, e));
}
proof * ast_manager::mk_cnf_star(expr * s, expr * t, unsigned num_proofs, proof * const * proofs) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
ptr_buffer<expr> args;
args.append(num_proofs, (expr**) proofs);
args.push_back(mk_oeq(s, t));
return mk_app(m_basic_family_id, PR_CNF_STAR, args.size(), args.c_ptr());
}
proof * ast_manager::mk_and_elim(proof * p, unsigned i) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(has_fact(p));
SASSERT(is_and(get_fact(p)));
CTRACE("mk_and_elim", i >= to_app(get_fact(p))->get_num_args(), tout << "i: " << i << "\n" << mk_pp(get_fact(p), *this) << "\n";);
SASSERT(i < to_app(get_fact(p))->get_num_args());
expr * f = to_app(get_fact(p))->get_arg(i);
return mk_app(m_basic_family_id, PR_AND_ELIM, p, f);
}
proof * ast_manager::mk_not_or_elim(proof * p, unsigned i) {
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
SASSERT(has_fact(p));
SASSERT(is_not(get_fact(p)));
SASSERT(is_or(to_app(get_fact(p))->get_arg(0)));
app * or_app = to_app(to_app(get_fact(p))->get_arg(0));
SASSERT(i < or_app->get_num_args());
expr * c = or_app->get_arg(i);
expr * f;
if (is_not(c))
f = to_app(c)->get_arg(0);
else
f = mk_not(c);
return mk_app(m_basic_family_id, PR_NOT_OR_ELIM, p, f);
}
proof * ast_manager::mk_th_lemma(
family_id tid,
expr * fact, unsigned num_proofs, proof * const * proofs,
unsigned num_params, parameter const* params
)
{
if (m_proof_mode == PGM_DISABLED)
return m_undef_proof;
ptr_buffer<expr> args;
vector<parameter> parameters;
parameters.push_back(parameter(get_family_name(tid)));
for (unsigned i = 0; i < num_params; ++i) {
parameters.push_back(params[i]);
}
args.append(num_proofs, (expr**) proofs);
args.push_back(fact);
return mk_app(m_basic_family_id, PR_TH_LEMMA, num_params+1, parameters.c_ptr(), args.size(), args.c_ptr());
}
proof* ast_manager::mk_hyper_resolve(unsigned num_premises, proof* const* premises, expr* concl,
svector<std::pair<unsigned, unsigned> > const& positions,
vector<expr_ref_vector> const& substs) {
ptr_vector<expr> fmls;
SASSERT(positions.size() + 1 == substs.size());
for (unsigned i = 0; i < num_premises; ++i) {
TRACE("hyper_res", tout << mk_pp(premises[i], *this) << "\n";);
fmls.push_back(get_fact(premises[i]));
}
SASSERT(is_bool(concl));
vector<parameter> params;
for (unsigned i = 0; i < substs.size(); ++i) {
expr_ref_vector const& vec = substs[i];
for (unsigned j = 0; j < vec.size(); ++j) {
params.push_back(parameter(vec[j]));
}
if (i + 1 < substs.size()) {
params.push_back(parameter(positions[i].first));
params.push_back(parameter(positions[i].second));
}
}
TRACE("hyper_res",
for (unsigned i = 0; i < params.size(); ++i) {
params[i].display(tout); tout << "\n";
});
ptr_vector<sort> sorts;
ptr_vector<expr> args;
for (unsigned i = 0; i < num_premises; ++i) {
sorts.push_back(mk_proof_sort());
args.push_back(premises[i]);
}
sorts.push_back(mk_bool_sort());
args.push_back(concl);
app* result = mk_app(m_basic_family_id, PR_HYPER_RESOLVE, params.size(), params.c_ptr(), args.size(), args.c_ptr());
SASSERT(result->get_family_id() == m_basic_family_id);
SASSERT(result->get_decl_kind() == PR_HYPER_RESOLVE);
return result;
}
bool ast_manager::is_hyper_resolve(
proof* p,
proof_ref_vector& premises,
expr_ref& conclusion,
svector<std::pair<unsigned, unsigned> > & positions,
vector<expr_ref_vector> & substs) {
if (!is_hyper_resolve(p)) {
return false;
}
unsigned sz = p->get_num_args();
SASSERT(sz > 0);
for (unsigned i = 0; i + 1 < sz; ++i) {
premises.push_back(to_app(p->get_arg(i)));
}
conclusion = p->get_arg(sz-1);
func_decl* d = p->get_decl();
unsigned num_p = d->get_num_parameters();
parameter const* params = d->get_parameters();
substs.push_back(expr_ref_vector(*this));
for (unsigned i = 0; i < num_p; ++i) {
if (params[i].is_int()) {
SASSERT(i + 1 < num_p);
SASSERT(params[i+1].is_int());
unsigned x = static_cast<unsigned>(params[i].get_int());
unsigned y = static_cast<unsigned>(params[i+1].get_int());
positions.push_back(std::make_pair(x, y));
substs.push_back(expr_ref_vector(*this));
++i;
}
else {
SASSERT(params[i].is_ast());
ast* a = params[i].get_ast();
SASSERT(is_expr(a));
substs.back().push_back(to_expr(a));
}
}
return true;
}
// -----------------------------------
//
// ast_mark
//
// -----------------------------------
bool ast_mark::is_marked(ast * n) const {
if (is_decl(n))
return m_decl_marks.is_marked(to_decl(n));
else
return m_expr_marks.is_marked(to_expr(n));
}
void ast_mark::mark(ast * n, bool flag) {
if (is_decl(n))
return m_decl_marks.mark(to_decl(n), flag);
else
return m_expr_marks.mark(to_expr(n), flag);
}
void ast_mark::reset() {
m_decl_marks.reset();
m_expr_marks.reset();
}
// -----------------------------------
//
// scoped_mark
//
// -----------------------------------
void scoped_mark::mark(ast * n, bool flag) {
SASSERT(flag);
mark(n);
}
void scoped_mark::mark(ast * n) {
if (!ast_mark::is_marked(n)) {
m_stack.push_back(n);
ast_mark::mark(n, true);
}
}
void scoped_mark::reset() {
ast_mark::reset();
m_stack.reset();
m_lim.reset();
}
void scoped_mark::push_scope() {
m_lim.push_back(m_stack.size());
}
void scoped_mark::pop_scope() {
unsigned new_size = m_stack.size();
unsigned old_size = m_lim.back();
for (unsigned i = old_size; i < new_size; ++i) {
ast_mark::mark(m_stack[i].get(), false);
}
m_lim.pop_back();
m_stack.resize(old_size);
}
void scoped_mark::pop_scope(unsigned num_scopes) {
for (unsigned i = 0; i < num_scopes; ++i) {
pop_scope();
}
}
// Added by KLM for use in GDB
// show an expr_ref on stdout
void prexpr(expr_ref &e){
std::cout << mk_pp(e.get(), e.get_manager()) << std::endl;
}
void ast_manager::show_id_gen(){
std::cout << "id_gen: " << m_expr_id_gen.show_hash() << " " << m_decl_id_gen.show_hash() << "\n";
}
| {
"content_hash": "dd35f4d0cbe4cbd80c2f1049bd7d6f91",
"timestamp": "",
"source": "github",
"line_count": 3255,
"max_line_length": 196,
"avg_line_length": 36.125960061443934,
"alnum_prop": 0.5351135300620801,
"repo_name": "jirislaby/z3",
"id": "111f1df78bb7c332b9ca01742989b10f79f4a95b",
"size": "117772",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/ast/ast.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "378211"
},
{
"name": "C#",
"bytes": "483436"
},
{
"name": "C++",
"bytes": "15094415"
},
{
"name": "Java",
"bytes": "358543"
},
{
"name": "Makefile",
"bytes": "272"
},
{
"name": "OCaml",
"bytes": "277931"
},
{
"name": "Objective-C",
"bytes": "3615"
},
{
"name": "Python",
"bytes": "551223"
},
{
"name": "SMT",
"bytes": "30220"
},
{
"name": "Shell",
"bytes": "353"
}
],
"symlink_target": ""
} |
package com.intellij.openapi.vcs.changes.ui;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import javax.swing.tree.DefaultTreeModel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public abstract class ChangesTreeImpl<T> extends ChangesTree {
@NotNull private final List<T> myChanges = new ArrayList<>();
@NotNull private final Class<T> myClazz;
public ChangesTreeImpl(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems,
@NotNull Class<T> clazz) {
super(project, showCheckboxes, highlightProblems);
myClazz = clazz;
}
public ChangesTreeImpl(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems,
@NotNull Class<T> clazz,
@NotNull List<? extends T> changes) {
this(project, showCheckboxes, highlightProblems, clazz);
if (showCheckboxes) setIncludedChanges(changes);
setChangesToDisplay(changes);
}
public void setChangesToDisplay(@NotNull Collection<? extends T> changes) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (myProject.isDisposed()) return;
myChanges.clear();
myChanges.addAll(changes);
rebuildTree();
}
@NotNull
protected abstract DefaultTreeModel buildTreeModel(@NotNull List<T> changes);
@Override
public void rebuildTree() {
DefaultTreeModel newModel = buildTreeModel(myChanges);
updateTreeModel(newModel);
}
@NotNull
public List<T> getChanges() {
return VcsTreeModelData.all(this).userObjects(myClazz);
}
@NotNull
public List<T> getSelectedChanges() {
return VcsTreeModelData.selected(this).userObjects(myClazz);
}
@NotNull
public Collection<T> getIncludedChanges() {
return VcsTreeModelData.included(this).userObjects(myClazz);
}
public static class Changes extends ChangesTreeImpl<Change> {
public Changes(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems) {
super(project, showCheckboxes, highlightProblems, Change.class);
}
public Changes(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems,
@NotNull List<Change> changes) {
super(project, showCheckboxes, highlightProblems, Change.class, changes);
}
@NotNull
@Override
protected DefaultTreeModel buildTreeModel(@NotNull List<Change> changes) {
return TreeModelBuilder.buildFromChanges(myProject, isShowFlatten(), changes, null);
}
}
public static class FilePaths extends ChangesTreeImpl<FilePath> {
public FilePaths(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems) {
super(project, showCheckboxes, highlightProblems, FilePath.class);
}
public FilePaths(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems,
@NotNull List<FilePath> paths) {
super(project, showCheckboxes, highlightProblems, FilePath.class, paths);
}
@NotNull
@Override
protected DefaultTreeModel buildTreeModel(@NotNull List<FilePath> changes) {
return TreeModelBuilder.buildFromFilePaths(myProject, isShowFlatten(), changes);
}
}
public static class VirtualFiles extends ChangesTreeImpl<VirtualFile> {
public VirtualFiles(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems) {
super(project, showCheckboxes, highlightProblems, VirtualFile.class);
}
public VirtualFiles(@NotNull Project project,
boolean showCheckboxes,
boolean highlightProblems,
@NotNull List<VirtualFile> files) {
super(project, showCheckboxes, highlightProblems, VirtualFile.class, files);
}
@NotNull
@Override
protected DefaultTreeModel buildTreeModel(@NotNull List<VirtualFile> changes) {
return TreeModelBuilder.buildFromVirtualFiles(myProject, isShowFlatten(), changes);
}
}
}
| {
"content_hash": "09abb9c36e1f9741f4c0a62d698d5e32",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 90,
"avg_line_length": 33.338235294117645,
"alnum_prop": 0.6775474194971328,
"repo_name": "ThiagoGarciaAlves/intellij-community",
"id": "630a453d499d6209807d0c0b592b7de5e548dcce",
"size": "4681",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "63518"
},
{
"name": "C",
"bytes": "214180"
},
{
"name": "C#",
"bytes": "1538"
},
{
"name": "C++",
"bytes": "190028"
},
{
"name": "CSS",
"bytes": "111474"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Cucumber",
"bytes": "14382"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "FLUX",
"bytes": "57"
},
{
"name": "Groff",
"bytes": "35232"
},
{
"name": "Groovy",
"bytes": "2194261"
},
{
"name": "HTML",
"bytes": "1726130"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "148273590"
},
{
"name": "JavaScript",
"bytes": "125292"
},
{
"name": "Kotlin",
"bytes": "454154"
},
{
"name": "Lex",
"bytes": "166177"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "85969"
},
{
"name": "Objective-C",
"bytes": "28634"
},
{
"name": "Perl6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6570"
},
{
"name": "Python",
"bytes": "21460459"
},
{
"name": "Ruby",
"bytes": "1213"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "63190"
},
{
"name": "Smalltalk",
"bytes": "64"
},
{
"name": "TeX",
"bytes": "60798"
},
{
"name": "TypeScript",
"bytes": "6152"
},
{
"name": "XSLT",
"bytes": "113040"
}
],
"symlink_target": ""
} |
package org.springframework.context.annotation;
import org.springframework.beans.factory.parsing.Location;
import org.springframework.beans.factory.parsing.ProblemReporter;
import org.springframework.core.type.MethodMetadata;
/**
* @author Chris Beams
* @since 3.1
*/
abstract class ConfigurationMethod {
protected final MethodMetadata metadata;
protected final ConfigurationClass configurationClass;
public ConfigurationMethod(MethodMetadata metadata, ConfigurationClass configurationClass) {
this.metadata = metadata;
this.configurationClass = configurationClass;
}
public MethodMetadata getMetadata() {
return this.metadata;
}
public ConfigurationClass getConfigurationClass() {
return this.configurationClass;
}
public Location getResourceLocation() {
return new Location(this.configurationClass.getResource(), this.metadata);
}
String getFullyQualifiedMethodName() {
return this.metadata.getDeclaringClassName() + "#" + this.metadata.getMethodName();
}
static String getShortMethodName(String fullyQualifiedMethodName) {
return fullyQualifiedMethodName.substring(fullyQualifiedMethodName.indexOf('#') + 1);
}
public void validate(ProblemReporter problemReporter) {
}
@Override
public String toString() {
return String.format("[%s:name=%s,declaringClass=%s]",
getClass().getSimpleName(), getMetadata().getMethodName(), getMetadata().getDeclaringClassName());
}
}
| {
"content_hash": "46c508d97ed95460ce880728dd578c0a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 102,
"avg_line_length": 25.482142857142858,
"alnum_prop": 0.7834618079887876,
"repo_name": "leogoing/spring_jeesite",
"id": "b359be7d64b8bb46daf39792b2342ec88ae97132",
"size": "2047",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "spring-context-4.0/org/springframework/context/annotation/ConfigurationMethod.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "3753"
},
{
"name": "ApacheConf",
"bytes": "768"
},
{
"name": "Batchfile",
"bytes": "6843"
},
{
"name": "CSS",
"bytes": "1298840"
},
{
"name": "FreeMarker",
"bytes": "13871"
},
{
"name": "GAP",
"bytes": "6137"
},
{
"name": "Groovy",
"bytes": "3685"
},
{
"name": "HTML",
"bytes": "2866133"
},
{
"name": "Java",
"bytes": "17206173"
},
{
"name": "JavaScript",
"bytes": "9687192"
},
{
"name": "PHP",
"bytes": "8060"
},
{
"name": "PLSQL",
"bytes": "66284"
}
],
"symlink_target": ""
} |
<menu>
<VPN>
<Stunnel cssClass="fa fa-dot-circle-o fa-fw" order="110">
<Configuration url="/ui/stunnel/services/"/>
<LogFile VisibleName="Log File" url="/ui/diagnostics/log/core/stunnel"/>
</Stunnel>
</VPN>
</menu>
| {
"content_hash": "f6847916008d8f8db7ac6d0566938ab2",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 84,
"avg_line_length": 33,
"alnum_prop": 0.5681818181818182,
"repo_name": "fraenki/plugins",
"id": "6cd50fa8c7570503ec3fe2b9e8a17a5c83382f8b",
"size": "264",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "security/stunnel/src/opnsense/mvc/app/models/OPNsense/Stunnel/Menu/Menu.xml",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C++",
"bytes": "1068"
},
{
"name": "CSS",
"bytes": "761450"
},
{
"name": "D",
"bytes": "8659"
},
{
"name": "HTML",
"bytes": "44879"
},
{
"name": "JavaScript",
"bytes": "50738"
},
{
"name": "Jinja",
"bytes": "5868"
},
{
"name": "Less",
"bytes": "1176"
},
{
"name": "Makefile",
"bytes": "36929"
},
{
"name": "Mathematica",
"bytes": "607"
},
{
"name": "NASL",
"bytes": "207"
},
{
"name": "PHP",
"bytes": "2084302"
},
{
"name": "Perl",
"bytes": "3686"
},
{
"name": "Python",
"bytes": "192606"
},
{
"name": "Ruby",
"bytes": "10525"
},
{
"name": "SCSS",
"bytes": "1537266"
},
{
"name": "Shell",
"bytes": "86332"
},
{
"name": "Volt",
"bytes": "865194"
}
],
"symlink_target": ""
} |
using System;
using System.Numerics;
class FactorialExpression1
{
static void Main()
{
int n, k;
BigInteger factorial = 1;
string consoleInput;
do
{
Console.Write("Enter valid number n=");
consoleInput = Console.ReadLine();
}
while (!int.TryParse(consoleInput, out n) || n <= 1);
do
{
Console.Write("Enter valid number k=");
consoleInput = Console.ReadLine();
}
while (!int.TryParse(consoleInput, out k) || (k < 1) || (k >= n));
for (int i = k + 1; i <= n; i++)
{
factorial *= i;
}
Console.WriteLine("The result of N!/K! for 1<K<N is : {0}", factorial);
}
}
| {
"content_hash": "6dbafb824386e51cb3e68154850d7f3c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 25.93103448275862,
"alnum_prop": 0.488031914893617,
"repo_name": "madbadPi/TelerikAcademy",
"id": "1cae16edcd8e7cc6609b36830cd9daa3ae61d2ec",
"size": "754",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CSharpPartOne/Loops/4.FactorialExpression/FactorialExpression1.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "785303"
},
{
"name": "C++",
"bytes": "59651"
},
{
"name": "HTML",
"bytes": "248"
},
{
"name": "PLSQL",
"bytes": "1758"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Hist. Class. Discom. Eur. (Paris) 126 (1907)
#### Original name
Hyaloscypha hyalina var. hyalina
### Remarks
null | {
"content_hash": "974cd85b277d04bbbe7786c937bf59b2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 44,
"avg_line_length": 13.615384615384615,
"alnum_prop": 0.7005649717514124,
"repo_name": "mdoering/backbone",
"id": "aebcec6439deed0ed7cf70e32bbb789d860ab1f6",
"size": "233",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Leotiomycetes/Helotiales/Hyaloscyphaceae/Hyaloscypha/Hyaloscypha hyalina/Hyaloscypha hyalina hyalina/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package channel;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.concurrent.TimeUnit;
/**
* Created by Administrator on 2014/12/19.
*/
public class FileLockTest {
public static void main(String[] args) throws IOException, InterruptedException {
Thread t = new Thread() {
@Override
public void run() {
test();
}
};
t.start();
TimeUnit.SECONDS.sleep(3);
test();
}
private static void test() {
try {
String filename = "blahblah.txt";
RandomAccessFile raf = new RandomAccessFile(filename, "r");
FileChannel fileChannel = raf.getChannel();
FileLock fileLock = fileChannel.lock(0L, Long.MAX_VALUE, true);
try {
System.out.println(fileLock.isShared());
TimeUnit.SECONDS.sleep(10);
} finally {
fileLock.release();
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| {
"content_hash": "d908e9168b08d7712766d1cc93ffce07",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 85,
"avg_line_length": 28,
"alnum_prop": 0.5706349206349206,
"repo_name": "edgar615/javase-study",
"id": "3c54572db49378373d01836fe89f5ccb1fddaaee",
"size": "1260",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nio-study/src/test/java/channel/FileLockTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "8370"
},
{
"name": "HTML",
"bytes": "3894"
},
{
"name": "Java",
"bytes": "1471108"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE369_Divide_by_Zero__int_zero_modulo_32.c
Label Definition File: CWE369_Divide_by_Zero__int.label.xml
Template File: sources-sinks-32.tmpl.c
*/
/*
* @description
* CWE: 369 Divide by Zero
* BadSource: zero Fixed value of zero
* GoodSource: Non-zero
* Sinks: modulo
* GoodSink: Check for zero before modulo
* BadSink : Modulo a constant with data
* Flow Variant: 32 Data flow using two pointers to the same value within the same function
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE369_Divide_by_Zero__int_zero_modulo_32_bad()
{
int data;
int *dataPtr1 = &data;
int *dataPtr2 = &data;
/* Initialize data */
data = -1;
{
int data = *dataPtr1;
/* POTENTIAL FLAW: Set data to zero */
data = 0;
*dataPtr1 = data;
}
{
int data = *dataPtr2;
/* POTENTIAL FLAW: Possibly divide by zero */
printIntLine(100 % data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2B()
{
int data;
int *dataPtr1 = &data;
int *dataPtr2 = &data;
/* Initialize data */
data = -1;
{
int data = *dataPtr1;
/* FIX: Use a value not equal to zero */
data = 7;
*dataPtr1 = data;
}
{
int data = *dataPtr2;
/* POTENTIAL FLAW: Possibly divide by zero */
printIntLine(100 % data);
}
}
/* goodB2G() uses the BadSource with the GoodSink */
static void goodB2G()
{
int data;
int *dataPtr1 = &data;
int *dataPtr2 = &data;
/* Initialize data */
data = -1;
{
int data = *dataPtr1;
/* POTENTIAL FLAW: Set data to zero */
data = 0;
*dataPtr1 = data;
}
{
int data = *dataPtr2;
/* FIX: test for a zero denominator */
if( data != 0 )
{
printIntLine(100 % data);
}
else
{
printLine("This would result in a divide by zero");
}
}
}
void CWE369_Divide_by_Zero__int_zero_modulo_32_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE369_Divide_by_Zero__int_zero_modulo_32_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE369_Divide_by_Zero__int_zero_modulo_32_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"content_hash": "3767be2f97ba9390633058aa9e2d342b",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 91,
"avg_line_length": 24.253968253968253,
"alnum_prop": 0.569371727748691,
"repo_name": "JianpingZeng/xcc",
"id": "4ba36798fdd4cdc4cffcc4734a8372e8faca5b58",
"size": "3056",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE369_Divide_by_Zero/s02/CWE369_Divide_by_Zero__int_zero_modulo_32.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="gu_IN" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About WOOLFCOIN</source>
<translation>બીટકોઈન વિષે</translation>
</message>
<message>
<location line="+39"/>
<source><b>WOOLFCOIN</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The WOOLFCOIN developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your WOOLFCOIN addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a WOOLFCOIN address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified WOOLFCOIN address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your WOOLFCOIN addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR WOOLFCOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-56"/>
<source>WOOLFCOIN will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your woolfcoins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Show information about WOOLFCOIN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a WOOLFCOIN address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for WOOLFCOIN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>WOOLFCOIN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About WOOLFCOIN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your WOOLFCOIN addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified WOOLFCOIN addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>WOOLFCOIN client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to WOOLFCOIN network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid WOOLFCOIN address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. WOOLFCOIN can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid WOOLFCOIN address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>WOOLFCOIN-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start WOOLFCOIN after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start WOOLFCOIN on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the WOOLFCOIN client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the WOOLFCOIN network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting WOOLFCOIN.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show WOOLFCOIN addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting WOOLFCOIN.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the WOOLFCOIN network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start woolfcoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the WOOLFCOIN-Qt help message to get a list with possible WOOLFCOIN command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>WOOLFCOIN - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>WOOLFCOIN Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the WOOLFCOIN debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the WOOLFCOIN RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a WOOLFCOIN address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this WOOLFCOIN address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified WOOLFCOIN address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a WOOLFCOIN address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter WOOLFCOIN signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The WOOLFCOIN developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>WOOLFCOIN version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or woolfcoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: woolfcoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: woolfcoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 4267 or testnet: 14267)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 4268 or testnet: 14268)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=woolfcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "WOOLFCOIN Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. WOOLFCOIN is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong WOOLFCOIN will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the WOOLFCOIN Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of WOOLFCOIN</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart WOOLFCOIN to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. WOOLFCOIN is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | {
"content_hash": "33cfd62ed3059e5314c8f4c3f8f594ad",
"timestamp": "",
"source": "github",
"line_count": 2917,
"max_line_length": 395,
"avg_line_length": 33.089475488515596,
"alnum_prop": 0.5853276973125298,
"repo_name": "woocoins/wooo",
"id": "983d9ae0d980a925ce6f914bdb5926d75b90e8de",
"size": "96544",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_gu_IN.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "32092"
},
{
"name": "C++",
"bytes": "2606499"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18284"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "102289"
},
{
"name": "NSIS",
"bytes": "5970"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69719"
},
{
"name": "QMake",
"bytes": "14718"
},
{
"name": "Shell",
"bytes": "13173"
}
],
"symlink_target": ""
} |
/***************************************************************************
RTCP.h - description
-------------------
(C) 2007 Ahmed Ayadi <[email protected]>
(C) 2001 Matthias Oppitz <[email protected]>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef __INET_RTCP_H
#define __INET_RTCP_H
#include "inet/common/INETDefs.h"
#include "inet/common/lifecycle/ILifecycle.h"
#include "inet/networklayer/contract/ipv4/IPv4Address.h"
#include "inet/transportlayer/contract/udp/UDPSocket.h"
namespace inet {
namespace rtp {
//Forward declarations:
class RTCPByePacket;
class RTCPCompoundPacket;
class RTCPReceiverReportPacket;
class RTCPSDESPacket;
class RTCPSenderReportPacket;
class RTPInnerPacket;
class RTPPacket;
class RTPParticipantInfo;
class RTPSenderInfo;
/**
* The class RTCP is responsible for creating, receiving and
* processing of rtcp packets. It also keeps track of this and other
* RTP end systems.
*/
class INET_API RTCP : public cSimpleModule, public ILifecycle
{
public:
RTCP();
virtual ~RTCP();
virtual bool handleOperationStage(LifecycleOperation *operation, int stage, IDoneCallback *doneCallback);
protected:
/**
* Initializes variables.
*/
virtual void initialize(int stage);
virtual int numInitStages() const { return NUM_INIT_STAGES; }
/**
* Message handling. Dispatches messages by arrival gate.
*/
virtual void handleMessage(cMessage *msg);
/**
* Handles messages from the RTP module.
*/
virtual void handleMessageFromRTP(cMessage *msg);
/**
* Handles messages coming from the socket layer.
*/
virtual void handleMessageFromUDP(cMessage *msg);
/**
* Handles self messages.
*/
virtual void handleSelfMessage(cMessage *msg);
/**
* Initializes the rtcp module when the session is started.
*/
virtual void handleInitializeRTCP(RTPInnerPacket *rinp);
/**
* Stores information about the new transmission.
*/
virtual void handleSenderModuleInitialized(RTPInnerPacket *rinp);
/**
* Stores information about an outgoing RTP data packet.
*/
virtual void handleDataOut(RTPInnerPacket *packet);
/**
* Stores information about an outgoing RTP data packet.
*/
virtual void handleDataIn(RTPInnerPacket *rinp);
/**
* Makes the rtcp module send an RTCPByePacket in the next
* RTCPCompoundPacket to tell other participants in the RTP
* session that this end system leaves.
*/
virtual void handleLeaveSession(RTPInnerPacket *rinp);
/**
* Called when the socket layer has finished a connect.
*/
virtual void connectRet();
/**
* Called when this rtcp module receives data from the
* socket layer.
*/
virtual void readRet(cPacket *sifpIn);
/**
* Request a server socket from the socket layer.
*/
virtual void createSocket();
/**
* Chooses the ssrc identifier for this end system.
*/
virtual void chooseSSRC();
/**
* Calculates the length of the next rtcp interval an issues
* a self message to remind itself.
*/
virtual void scheduleInterval();
/**
* Creates and sends an RTCPCompoundPacket.
*/
virtual void createPacket();
/**
* Extracts information of a sent RTPPacket.
*/
virtual void processOutgoingRTPPacket(RTPPacket *packet);
/**
* Extracts information of a received RTPPacket.
*/
virtual void processIncomingRTPPacket(RTPPacket *packet, IPv4Address address, int port);
/**
* Extracts information of a received RTCPCompoundPacket.
*/
virtual void processIncomingRTCPPacket(RTCPCompoundPacket *packet, IPv4Address address, int port);
void processIncomingRTCPSenderReportPacket(RTCPSenderReportPacket *rtcpSenderReportPacket, IPv4Address address, int port);
void processIncomingRTCPReceiverReportPacket(RTCPReceiverReportPacket *rtcpReceiverReportPacket, IPv4Address address, int port);
void processIncomingRTCPSDESPacket(RTCPSDESPacket *rtcpSDESPacket, IPv4Address address, int port, simtime_t arrivalTime);
void processIncomingRTCPByePacket(RTCPByePacket *rtcpByePacket, IPv4Address address, int port);
/**
* Returns the RTPParticipantInfo object used for storing information
* about the RTP end system with this ssrc identifier.
* Returns NULL if this end system is unknown.
*/
virtual RTPParticipantInfo *findParticipantInfo(uint32 ssrc);
/**
* Recalculates the average size of an RTCPCompoundPacket when
* one of this size has been sent or received.
*/
virtual void calculateAveragePacketSize(int size);
protected:
/**
* The maximum size an RTCPCompundPacket can have.
*/
int _mtu;
/**
* The bandwidth for this RTP session.
*/
int _bandwidth;
/**
* The percentage of bandwidth for rtcp.
*/
int _rtcpPercentage;
/**
* The destination address.
*/
IPv4Address _destinationAddress;
/**
* The rtcp port.
*/
int _port;
/**
* True when this end system has chosen its ssrc identifier.
*/
bool _ssrcChosen;
/**
* True when this end system is about to leave the session.
*/
bool _leaveSession;
/**
* The RTPSenderInfo about this end system.
*/
RTPSenderInfo *_senderInfo;
/**
* Information about all known RTP end system participating in
* this RTP session.
*/
cArray _participantInfos;
/**
* The UDP socket for sending/receiving rtcp packets.
*/
UDPSocket _udpSocket;
/**
* The number of packets this rtcp module has
* calculated.
*/
int _packetsCalculated;
/**
* The average size of an RTCPCompoundPacket.
*/
double _averagePacketSize;
/**
* The output vector for statistical data about the
* behaviour of rtcp. Every participant's rtcp module
* writes its calculated rtcp interval (without variation
*/
// cOutVector *_rtcpIntervalOutVector;
//statistics
static simsignal_t rcvdPkSignal;
};
} // namespace rtp
} // namespace inet
#endif // ifndef __INET_RTCP_H
| {
"content_hash": "d32107e9504057db79de44543086c51c",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 132,
"avg_line_length": 27.788,
"alnum_prop": 0.6221390528285591,
"repo_name": "googleinterns/vectio",
"id": "178dd7b783ccd88e984f5fd6a480aa9a48667c48",
"size": "6947",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "inet/src/inet/transportlayer/rtp/RTCP.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12899"
},
{
"name": "C",
"bytes": "187862"
},
{
"name": "C++",
"bytes": "10383707"
},
{
"name": "CSS",
"bytes": "2751"
},
{
"name": "FreeMarker",
"bytes": "15828"
},
{
"name": "HTML",
"bytes": "41036"
},
{
"name": "Makefile",
"bytes": "5303"
},
{
"name": "Perl",
"bytes": "25486"
},
{
"name": "Python",
"bytes": "158836"
},
{
"name": "R",
"bytes": "51230"
},
{
"name": "Raku",
"bytes": "150"
},
{
"name": "Roff",
"bytes": "22957"
},
{
"name": "Shell",
"bytes": "21282"
},
{
"name": "Tcl",
"bytes": "18098"
},
{
"name": "XSLT",
"bytes": "14040"
}
],
"symlink_target": ""
} |
from django.core.management.base import BaseCommand
from optparse import make_option
from sam.models import Quote
import os
class Command(BaseCommand):
help = 'This creates Quote objects from text file input or writes Quotes to text file'
option_list = BaseCommand.option_list + (
make_option('-r',
'--read',
dest='read',
default=False,
action='store_true',
help='This will create Quote objects from a text file.'),
make_option('-w',
'--write',
dest='write',
default=False,
action='store_true',
help='This will create a text file with Quote objects.'),
)
def handle(self, *args, **options):
write = options['write']
module_dir = os.path.dirname(__file__)
file_path = os.path.join(module_dir, 'quotes.txt')
if not write:
quote_file = open(file_path, 'r')
for line in quote_file:
if len(line.strip()) > 0:
parts = line.split("-=-")
quote = parts[0].strip()
author = parts[1].strip()
Quote(quote=quote, author=author).save()
else:
quote_file = open(file_path, 'w')
for quote in Quote.objects.all():
quote_file.write(quote.quote + " -=- " + quote.author + "\n")
| {
"content_hash": "a87bc1bbcb639c13273f6732655f4398",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 90,
"avg_line_length": 37.35,
"alnum_prop": 0.500669344042838,
"repo_name": "samolds/samster",
"id": "5e37ab7b25882c7bc3a265e6b0218dbb3b55644b",
"size": "1494",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sam/management/commands/quotes.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9741"
},
{
"name": "HTML",
"bytes": "38115"
},
{
"name": "JavaScript",
"bytes": "12171"
},
{
"name": "Python",
"bytes": "75966"
}
],
"symlink_target": ""
} |
#region Copyright
//
// DotNetNuke® - http://www.dotnetnuke.com
// Copyright (c) 2002-2014
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
#region Usings
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Localization;
using DotNetNuke.Web.Razor;
#endregion
namespace DotNetNuke.Modules.RazorHost
{
public partial class RazorHost : RazorModuleBase, IActionable
{
private string razorScriptFileFormatString = "~/DesktopModules/RazorModules/RazorHost/Scripts/{0}";
protected override string RazorScriptFile
{
get
{
string m_RazorScriptFile = base.RazorScriptFile;
var scriptFileSetting = ModuleContext.Settings["ScriptFile"] as string;
if (! (string.IsNullOrEmpty(scriptFileSetting)))
{
m_RazorScriptFile = string.Format(razorScriptFileFormatString, scriptFileSetting);
}
return m_RazorScriptFile;
}
}
#region IActionable Members
public ModuleActionCollection ModuleActions
{
get
{
var Actions = new ModuleActionCollection();
Actions.Add(ModuleContext.GetNextActionID(),
Localization.GetString(ModuleActionType.EditContent, LocalResourceFile),
ModuleActionType.AddContent,
"",
"edit.gif",
ModuleContext.EditUrl(),
false,
SecurityAccessLevel.Host,
true,
false);
Actions.Add(ModuleContext.GetNextActionID(),
Localization.GetString("CreateModule.Action", LocalResourceFile),
ModuleActionType.AddContent,
"",
"edit.gif",
ModuleContext.EditUrl("CreateModule"),
false,
SecurityAccessLevel.Host,
true,
false);
return Actions;
}
}
#endregion
}
} | {
"content_hash": "034a21ffe67af4580ca0eeff313c6d93",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 116,
"avg_line_length": 40.833333333333336,
"alnum_prop": 0.5970845481049563,
"repo_name": "abukres/Dnn.Platform",
"id": "a68d1eadfe6b83ac2f44b11e0a831c76910d5e02",
"size": "3433",
"binary": false,
"copies": "6",
"ref": "refs/heads/development",
"path": "DNN Platform/Modules/RazorHost/RazorHost.ascx.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "1272702"
},
{
"name": "Batchfile",
"bytes": "276"
},
{
"name": "C#",
"bytes": "20759543"
},
{
"name": "CSS",
"bytes": "1113800"
},
{
"name": "Erlang",
"bytes": "2168"
},
{
"name": "HTML",
"bytes": "634203"
},
{
"name": "JavaScript",
"bytes": "3923391"
},
{
"name": "Smalltalk",
"bytes": "65040"
},
{
"name": "Visual Basic",
"bytes": "139421"
},
{
"name": "XSLT",
"bytes": "16560"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" fullPackage="PhpUnderControl.Documentation" category="QualityAssurance" package="PhpUnderControl" subpackage="Documentation" tests="24" failures="4" errors="6" time="0.081376">
<testsuite name="phpucMergeCodeTest::testVersionSpecific" time="0.047997" tests="4" errors="1" failures="0">
<testcase name="testVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="72" time="0.001766" build="php-5.2.0"/>
<testcase name="testVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="72" time="0.043849" build="php-5.2.5"/>
<testcase name="testVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="72" time="0.002382" build="php-5.2.6RC2"/>
<testcase name="testVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="72" time="0.000000" build="php-5.1.9">
<error type="PHPUnit_Framework_Error"><![CDATA[testVersionSpecific(phpucMergeCodeTest)
Was never executed.
]]></error>
</testcase>
</testsuite>
<testsuite name="phpucMergeCodeTest::testNotVersionSpecific" time="0.007821" tests="4" errors="1" failures="1">
<testcase name="testNotVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="78" time="0.001754" build="php-5.2.0"/>
<testcase name="testNotVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="78" time="0.001859" build="php-5.2.5"/>
<testcase name="testNotVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="78" time="0.004208" build="php-5.2.6RC2">
<failure type="PHPUnit_Framework_ExpectationFailedException"><![CDATA[testNotVersionSpecific(phpucMergeCodeTest)
Failed asserting that two strings are equal.
expected string <ilc>
difference <xxx>
got string <cli>
/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php:91
]]></failure>
</testcase>
<testcase name="testNotVersionSpecific" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="78" time="0.000000" build="php-5.1.9">
<error type="PHPUnit_Framework_Error"><![CDATA[testNotVersionSpecific(phpucMergeCodeTest)
Was never executed.
]]></error>
</testcase>
</testsuite>
<testsuite name="phpucMergeCodeTest::testCalculate" tests="16" failures="3" errors="4" time="0.025558">
<testsuite name="phpucMergeCodeTest::testCalculate" tests="4" failures="1" errors="0" time="0.007542" build="php-5.2.0">
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001496"/>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001501"/>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.003035">
<failure type="PHPUnit_Framework_ExpectationFailedException"><![CDATA[testCalculate(phpucMergeCodeTest) with data set #2 (2, 2)
Failed asserting that <integer:4> matches expected value <integer:3>.
/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php:107
]]></failure>
</testcase>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001510"/>
</testsuite>
<testsuite name="phpucMergeCodeTest::testCalculate" tests="4" failures="1" errors="0" time="0.007984" build="php-5.2.5">
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001595"/>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001579"/>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.003200">
<failure type="PHPUnit_Framework_ExpectationFailedException"><![CDATA[testCalculate(phpucMergeCodeTest) with data set #2 (2, 2)
Failed asserting that <integer:4> matches expected value <integer:3>.
/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php:107
]]></failure>
</testcase>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001610"/>
</testsuite>
<testsuite name="phpucMergeCodeTest::testCalculate" tests="4" failures="1" errors="0" time="0.010032" build="php-5.2.6RC2">
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001987"/>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001953"/>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.004110">
<failure type="PHPUnit_Framework_ExpectationFailedException"><![CDATA[testCalculate(phpucMergeCodeTest) with data set #2 (2, 2)
Failed asserting that <integer:4> matches expected value <integer:3>.
/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php:107
]]></failure>
</testcase>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.001982"/>
</testsuite>
<testsuite name="phpucMergeCodeTest::testCalculate" tests="4" failures="0" errors="4" time="0.000000" build="php-5.1.9">
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.000000">
<error type="PHPUnit_Framework_Error"><![CDATA[testCalculate(phpucMergeCodeTest)
Was never executed.
]]></error>
</testcase>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.000000">
<error type="PHPUnit_Framework_Error"><![CDATA[testCalculate(phpucMergeCodeTest)
Was never executed.
]]></error>
</testcase>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.000000">
<error type="PHPUnit_Framework_Error"><![CDATA[testCalculate(phpucMergeCodeTest)
Was never executed.
]]></error>
</testcase>
<testcase name="testCalculate" class="phpucMergeCodeTest" file="/home/manu/Projects/workspace.zend-studio/phpUnderControl/trunk/docs/log-merge/MergeCodeTest.php" line="103" time="0.000000">
<error type="PHPUnit_Framework_Error"><![CDATA[testCalculate(phpucMergeCodeTest)
Was never executed.
]]></error>
</testcase>
</testsuite>
</testsuite>
</testsuite>
</testsuites> | {
"content_hash": "d9e288f6bc3bae4e79a9fc808846295a",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 319,
"avg_line_length": 91.37234042553192,
"alnum_prop": 0.7492141110723017,
"repo_name": "manuelpichler/phpUnderControl-copy-fork-and-follow-organization-repo",
"id": "88e7fc1e9d6ef24ee291884775c0b340315ed3f0",
"size": "8589",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tests/_data/phpunit/expected-failed/log.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "23970"
},
{
"name": "JavaScript",
"bytes": "296028"
},
{
"name": "PHP",
"bytes": "1966171"
},
{
"name": "Shell",
"bytes": "1359"
}
],
"symlink_target": ""
} |
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('cs-editor-switch', 'Integration | Component | cs editor switch', {
integration: true
});
test('it renders', function(assert) {
this.render(hbs`{{cs-editor-switch}}`);
assert.equal(this.$('label:contains(Editor)').length, 1, "found label");
});
| {
"content_hash": "741871aeffb8b205d9d6343f8e3c2449",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 86,
"avg_line_length": 34,
"alnum_prop": 0.7085561497326203,
"repo_name": "courajs/cardstack",
"id": "b4c18e3c5e5065eeb177658f0949df69e00c2692",
"size": "374",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/tools/tests/integration/components/cs-editor-switch-test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15747"
},
{
"name": "HTML",
"bytes": "40412"
},
{
"name": "JavaScript",
"bytes": "671188"
},
{
"name": "Shell",
"bytes": "1081"
}
],
"symlink_target": ""
} |
FROM balenalib/ccimx8x-sbc-pro-ubuntu:cosmic-run
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# install python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
&& rm -rf /var/lib/apt/lists/*
# key 63C7CC90: public key "Simon McVittie <[email protected]>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <[email protected]>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.6.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& buildDeps=' \
curl \
' \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& echo "f44f5617a7cd5593250bb8ad02044c37b433293343eacc84d78acae6490b7c53 Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/[email protected]" \
&& echo "Running test-stack@python" \
&& chmod +x [email protected] \
&& bash [email protected] \
&& rm -rf [email protected]
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Ubuntu cosmic \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.6.12, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "c56a980b402a0ac6a7fc4f96f6a6c0b8",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 709,
"avg_line_length": 51.98717948717949,
"alnum_prop": 0.7082614056720099,
"repo_name": "nghiant2710/base-images",
"id": "7e6d8339d2785cb22d16b67843a436f7e4e73fa9",
"size": "4076",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/ccimx8x-sbc-pro/ubuntu/cosmic/3.6.12/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
/* global QUnit */
sap.ui.define([
"sap-ui-integration-editor",
"sap/ui/integration/editor/Editor",
"sap/ui/integration/Host",
"sap/ui/thirdparty/sinon-4",
"./../../../../ContextHost",
"sap/base/util/deepEqual",
"sap/ui/core/Core",
"sap/base/util/deepClone",
"sap/base/util/merge"
], function (
x,
Editor,
Host,
sinon,
ContextHost,
deepEqual,
Core,
deepClone,
merge
) {
"use strict";
QUnit.config.reorder = false;
var sBaseUrl = "test-resources/sap/ui/integration/qunit/editor/jsons/withDesigntime/sap.card/";
var _aCheckedLanguages = [
{
"key": "fr-CA",
"description": "Français (Canada)"
},
{
"key": "zh-CN",
"description": "简体中文"
},
{
"key": "zh-TW",
"description": "繁體中文"
}
];
var oManifestForObjectListFieldsWithTranslations = {
"sap.app": {
"id": "test.sample",
"i18n": "../i18ntrans/i18n.properties"
},
"sap.card": {
"designtime": "designtime/objectListFieldWithTranslation",
"type": "List",
"configuration": {
"parameters": {
"objectsWithPropertiesDefinedAndValueFromJsonList": {}
},
"destinations": {
"local": {
"name": "local",
"defaultUrl": "./"
},
"mock_request": {
"name": "mock_request"
}
}
}
}
};
var oObject1InContentChange = {
"_dt": {
"_uuid": "111771a4-0d3f-4fec-af20-6f28f1b894cb"
},
"key": "string2",
"icon": "sap-icon://add",
"text": "text",
"url": "http://",
"number": 0.5
};
var oObject2InContentChange = {
"_dt": {
"_uuid": "222771a4-0d3f-4fec-af20-6f28f1b894cb"
},
"key": "{i18n>string1}",
"icon": "sap-icon://add",
"text": "text",
"url": "http://",
"number": 0.5
};
var oObject3InContentChange = {
"_dt": {
"_uuid": "333771a4-0d3f-4fec-af20-6f28f1b894cb"
},
"key": "string4",
"icon": "sap-icon://add",
"text": "text",
"url": "http://",
"number": 0.5
};
var _oContentChangesOfObjectListsWithTranslations = {
"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": [oObject1InContentChange, oObject2InContentChange, oObject3InContentChange],
":layer": 5,
":multipleLanguage": true,
":errors": false,
"texts": {
"en": {
"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": {
"222771a4-0d3f-4fec-af20-6f28f1b894cb": {
"key": "String1 EN Content"
}
}
},
"fr": {
"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": {
"222771a4-0d3f-4fec-af20-6f28f1b894cb": {
"key": "String1 FR Content"
}
}
},
"zh-CN": {
"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": {
"222771a4-0d3f-4fec-af20-6f28f1b894cb": {
"key": "String1 简体 Content"
}
}
}
}
};
var _oExpectedValuesOfChangesFromContent = {
"object2": {
"default": "String 1 English",
"en": "String1 EN Content",
"en-US": "String 1 US English",
"es-MX": "String 1 Spanish MX",
"fr": "String1 FR Content",
"fr-FR": "String 1 French",
"fr-CA": "String 1 French CA",
"zh-CN": "String1 简体 Content"
}
};
function createEditor(sLanguage, oDesigntime) {
sLanguage = sLanguage || "en";
Core.getConfiguration().setLanguage(sLanguage);
var oEditor = new Editor({
designtime: oDesigntime
});
var oContent = document.getElementById("content");
if (!oContent) {
oContent = document.createElement("div");
oContent.style.position = "absolute";
oContent.style.top = "200px";
oContent.style.background = "white";
oContent.setAttribute("id", "content");
document.body.appendChild(oContent);
document.body.style.zIndex = 1000;
}
oEditor.placeAt(oContent);
return oEditor;
}
function destroyEditor(oEditor) {
oEditor.destroy();
var oContent = document.getElementById("content");
if (oContent) {
oContent.innerHTML = "";
document.body.style.zIndex = "unset";
}
}
Core.getConfiguration().setLanguage("en");
document.body.className = document.body.className + " sapUiSizeCompact ";
function wait(ms) {
return new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, ms || 1000);
});
}
QUnit.module("content mode", {
beforeEach: function () {
this.oHost = new Host("host");
this.oContextHost = new ContextHost("contexthost");
},
afterEach: function () {
this.oHost.destroy();
this.oContextHost.destroy();
}
}, function () {
_aCheckedLanguages.forEach(function(sLanguage) {
var sLanguageKey = sLanguage.key;
var sCaseTitle = "in " + sLanguageKey + " (" + sLanguage.description + ")";
QUnit.test(sCaseTitle, function (assert) {
var that = this;
return new Promise(function (resolve, reject) {
that.oEditor = createEditor(sLanguageKey);
that.oEditor.setMode("content");
that.oEditor.setAllowSettings(true);
that.oEditor.setAllowDynamicValues(true);
that.oEditor.setJson({
baseUrl: sBaseUrl,
host: "contexthost",
manifest: oManifestForObjectListFieldsWithTranslations,
manifestChanges: [_oContentChangesOfObjectListsWithTranslations]
});
that.oEditor.attachReady(function () {
assert.ok(that.oEditor.isReady(), "Editor is ready");
var oLabel1 = that.oEditor.getAggregation("_formContent")[1];
var oField1 = that.oEditor.getAggregation("_formContent")[2];
var oSelectedValue1 = merge(deepClone(oObject1InContentChange, 500), {"_dt": {"_selected": true, "_position": 1}});
var oSelectedValue2 = merge(deepClone(oObject2InContentChange, 500), {"_dt": {"_selected": true, "_position": 2}});
var oSelectedValue3 = merge(deepClone(oObject3InContentChange, 500), {"_dt": {"_selected": true, "_position": 3}});
wait().then(function () {
assert.ok(oLabel1.isA("sap.m.Label"), "Label 1: Form content contains a Label");
assert.equal(oLabel1.getText(), "Object properties defined: value from Json list", "Label 1: Has label text");
assert.ok(oField1.isA("sap.ui.integration.editor.fields.ObjectListField"), "Field 1: Object List Field");
assert.ok(deepEqual(oField1._getCurrentProperty("value"), [oObject1InContentChange, oObject2InContentChange, oObject3InContentChange]), "Field 1: Value");
var oTable1 = oField1.getAggregation("_field");
var oToolbar1 = oTable1.getToolbar();
assert.equal(oTable1.getBinding().getCount(), 11, "Table 1: value length is 11");
assert.equal(oToolbar1.getContent().length, 9, "Table toolbar 1: content length");
var oEditButton1 = oToolbar1.getContent()[2];
assert.ok(oEditButton1.getVisible(), "Table toolbar 1: edit button visible");
assert.ok(!oEditButton1.getEnabled(), "Table toolbar 1: edit button disabled");
var oRow1 = oTable1.getRows()[0];
assert.ok(deepEqual(oRow1.getBindingContext().getObject(), oSelectedValue1), "Table 1: value object is the first row");
var oKeyCell1 = oRow1.getCells()[1];
assert.equal(oKeyCell1.getText(), "string2", "Row 1: key cell value");
oTable1.setSelectedIndex(0);
oTable1.fireRowSelectionChange({
rowIndex: 0,
userInteraction: true
});
assert.ok(oEditButton1.getEnabled(), "Table toolbar 1: edit button enabled");
oEditButton1.onAfterRendering = function(oEvent) {
oEditButton1.onAfterRendering = function () {};
oEditButton1.firePress();
wait().then(function () {
var oAddButtonInPopover1 = oField1._oObjectDetailsPopover._oAddButton;
assert.ok(!oAddButtonInPopover1.getVisible(), "Popover 1: add button not visible");
var oUpdateButtonInPopover1 = oField1._oObjectDetailsPopover._oUpdateButton;
assert.ok(oUpdateButtonInPopover1.getVisible(), "Popover 1: update button visible");
var oCancelButtonInPopover1 = oField1._oObjectDetailsPopover._oCancelButton;
assert.ok(oCancelButtonInPopover1.getVisible(), "Popover 1: cancel button visible");
var oCloseButtonInPopover1 = oField1._oObjectDetailsPopover._oCloseButton;
assert.ok(!oCloseButtonInPopover1.getVisible(), "Popover 1: close button not visible");
var oSimpleForm1 = oField1._oObjectDetailsPopover.getContent()[0].getPages()[0].getContent()[0];
assert.ok(oSimpleForm1.isA("sap.ui.layout.form.SimpleForm"), "Popover 1: content is SimpleForm");
var oContents1 = oSimpleForm1.getContent();
assert.equal(oContents1.length, 16, "SimpleForm 1: length");
assert.ok(deepEqual(JSON.parse(oContents1[15].getValue()), oSelectedValue1), "SimpleForm 1 field textArea: Has the value");
var oFormField1 = oContents1[1];
assert.ok(oFormField1.isA("sap.m.Input"), "SimpleForm 1 field 1: Input Field");
assert.ok(oFormField1.getVisible(), "SimpleForm 1 field 1: Visible");
assert.ok(oFormField1.getEditable(), "SimpleForm 1 field 1: Editable");
assert.equal(oFormField1.getValue(), oObject1InContentChange.key, "SimpleForm 1 field 1: Has value");
assert.ok(!oFormField1.getShowValueHelp(), "SimpleForm 1 field 1: ShowValueHelp not true");
var oValueHelpIcon1 = oFormField1._oValueHelpIcon;
assert.ok(!oValueHelpIcon1, "SimpleForm 1 field 1: Value help icon not exist");
oCancelButtonInPopover1.firePress();
wait().then(function () {
oField1._oObjectDetailsPopover.attachEventOnce("afterOpen", function(oEvent) {
var oCancelButtonInPopover2 = oField1._oObjectDetailsPopover._oCancelButton;
assert.ok(oCancelButtonInPopover2.getVisible(), "Popover 2: cancel button visible");
var oSimpleForm2 = oField1._oObjectDetailsPopover.getContent()[0].getPages()[0].getContent()[0];
assert.ok(oSimpleForm2.isA("sap.ui.layout.form.SimpleForm"), "Popover 2: content is SimpleForm");
var oContents2 = oSimpleForm2.getContent();
assert.equal(oContents2.length, 16, "SimpleForm 2: length");
assert.ok(deepEqual(JSON.parse(oContents2[15].getValue()), oSelectedValue2), "SimpleForm 2 field textArea: Has the value");
var oFormField2 = oContents2[1];
assert.ok(oFormField2.isA("sap.m.Input"), "SimpleForm 2 field 1: Input Field");
assert.ok(oFormField2.getVisible(), "SimpleForm 2 field 1: Visible");
assert.ok(oFormField2.getEditable(), "SimpleForm 2 field 1: Editable");
assert.equal(oFormField2.getValue(), oObject2InContentChange.key, "SimpleForm 2 field 1: Has value");
assert.ok(oFormField2.getShowValueHelp(), "SimpleForm 2 field 1: ShowValueHelp true");
var oValueHelpIcon2 = oFormField2._oValueHelpIcon;
assert.ok(oValueHelpIcon2, "SimpleForm 2 field 1: Value help icon exist");
assert.ok(oValueHelpIcon2.getVisible(), "SimpleForm 2 field 1: Value help icon visible");
assert.ok(oValueHelpIcon2.isA("sap.ui.core.Icon"), "SimpleForm 2 field 1: Input value help icon");
assert.equal(oValueHelpIcon2.getSrc(), "sap-icon://translate", "SimpleForm 2 field 1: Input value help icon src");
oValueHelpIcon2.firePress();
wait(1500).then(function () {
var oTranslationListPage2 = oField1._oTranslationListPage;
var oSaveButton2 = oTranslationListPage2.getFooter().getContent()[1];
assert.ok(oSaveButton2.getVisible(), "oTranslationListPage 2 footer: save button visible");
assert.ok(!oSaveButton2.getEnabled(), "oTranslationListPage 2 footer: save button disabled");
var oResetButton2 = oTranslationListPage2.getFooter().getContent()[2];
assert.ok(oResetButton2.getVisible(), "oTranslationListPage 2 footer: reset button visible");
assert.ok(!oResetButton2.getEnabled(), "oTranslationListPage 2 footer: reset button disabled");
var oCancelButton2 = oTranslationListPage2.getFooter().getContent()[3];
assert.ok(!oCancelButton2.getVisible(), "oTranslationListPage 2 footer: cancel button not visible");
var oLanguageItems2 = oTranslationListPage2.getContent()[0].getItems();
assert.equal(oLanguageItems2.length, 50, "oTranslationPopover 2 Content: length");
for (var i = 0; i < oLanguageItems2.length; i++) {
var oCustomData = oLanguageItems2[i].getCustomData();
if (oCustomData && oCustomData.length > 0) {
var sLanguage = oCustomData[0].getKey();
var sExpectedValue = _oExpectedValuesOfChangesFromContent["object2"][sLanguage] || _oExpectedValuesOfChangesFromContent["object2"]["default"];
var sCurrentValue = oLanguageItems2[i].getContent()[0].getItems()[1].getValue();
assert.equal(sCurrentValue, sExpectedValue, "oTranslationPopover 2 Content: item " + i + " " + sLanguage + ", current: " + sCurrentValue + ", expected: " + sExpectedValue);
}
}
oTranslationListPage2._navBtn.firePress();
oCancelButtonInPopover2.firePress();
wait().then(function () {
oField1._oObjectDetailsPopover.attachEventOnce("afterOpen", function(oEvent) {
var oSimpleForm3 = oField1._oObjectDetailsPopover.getContent()[0].getPages()[0].getContent()[0];
assert.ok(oSimpleForm3.isA("sap.ui.layout.form.SimpleForm"), "Popover 3: content is SimpleForm");
var oContents3 = oSimpleForm3.getContent();
assert.equal(oContents3.length, 16, "SimpleForm 3: length");
assert.ok(deepEqual(JSON.parse(oContents3[15].getValue()), oSelectedValue3), "SimpleForm 3 field textArea: Has the value");
var oFormField3 = oContents3[1];
assert.ok(oFormField3.isA("sap.m.Input"), "SimpleForm 3 field 1: Input Field");
assert.ok(oFormField3.getVisible(), "SimpleForm 3 field 1: Visible");
assert.ok(oFormField3.getEditable(), "SimpleForm 3 field 1: Editable");
assert.equal(oFormField3.getValue(), oObject3InContentChange.key, "SimpleForm 3 field 1: Has value");
assert.ok(!oFormField3.getShowValueHelp(), "SimpleForm 3 field 1: ShowValueHelp not true");
var oValueHelpIcon3 = oFormField3._oValueHelpIcon;
assert.ok(oValueHelpIcon3, "SimpleForm 3 field 1: Value help icon exist");
assert.ok(!oValueHelpIcon3.getVisible(), "SimpleForm 3 field 1: Value help icon not visible");
destroyEditor(that.oEditor);
resolve();
});
oTable1.setSelectedIndex(2);
oTable1.fireRowSelectionChange({
rowIndex: 2,
userInteraction: true
});
assert.ok(oEditButton1.getEnabled(), "Table toolbar 1: edit button enabled");
oEditButton1.firePress();
});
});
});
oTable1.setSelectedIndex(1);
oTable1.fireRowSelectionChange({
rowIndex: 1,
userInteraction: true
});
assert.ok(oEditButton1.getEnabled(), "Table toolbar 1: edit button enabled");
oEditButton1.firePress();
});
});
};
});
});
});
});
});
});
QUnit.done(function () {
document.getElementById("qunit-fixture").style.display = "none";
});
});
| {
"content_hash": "643e9b5673623228c89af275497faefc",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 186,
"avg_line_length": 43.57507082152974,
"alnum_prop": 0.6531010271746197,
"repo_name": "SAP/openui5",
"id": "624f5625a710c55f4be6982ea64cd9e22aab43b6",
"size": "15407",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/sap.ui.integration/test/sap/ui/integration/qunit/editor/objectListField/propertyTranslation/table/typeKey/ChangesByContentForContentMode02.qunit.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "294216"
},
{
"name": "Gherkin",
"bytes": "17201"
},
{
"name": "HTML",
"bytes": "6443688"
},
{
"name": "Java",
"bytes": "83398"
},
{
"name": "JavaScript",
"bytes": "109546491"
},
{
"name": "Less",
"bytes": "8741757"
},
{
"name": "TypeScript",
"bytes": "20918"
}
],
"symlink_target": ""
} |
using System;
using Newtonsoft.Json;
namespace WebExtras.JQPlot.SubOptions
{
/// <summary>
/// Legend options
/// </summary>
[Serializable]
public class LegendOptions
{
/// <summary>
/// Whether to display the legend on the graph
/// </summary>
public bool? show;
/// <summary>
/// Legend location
/// </summary>
[JsonConverter(typeof(JQPlotEnumStringValueJsonConverter))]
public ELocation? location;
/// <summary>
/// Array of labels to use. By default the renderer will look
/// for labels on the series. Labels specified in this array
/// will override labels specified on the series.
/// </summary>
public string[] labels;
/// <summary>
/// Whether to show the label text on the legend.
/// </summary>
public bool? showLabels;
/// <summary>
/// Whether to show the color swatches on the legend.
/// </summary>
public bool? showSwatch;
/// <summary>
/// ”insideGrid” places legend inside the grid area of the plot.
/// “outsideGrid” places the legend outside the grid but inside
/// the plot container, shrinking the grid to accomodate the legend.
/// “inside” synonym for “insideGrid”, “outside” places the legend
/// ouside the grid area, but does not shrink the grid which can
/// cause the legend to overflow the plot container.
/// </summary>
[JsonConverter(typeof(JQPlotEnumStringValueJsonConverter))]
public ELegendPlacement? placement;
/// <summary>
/// Set the margins on the legend using the marginTop, marginLeft,
/// etc. properties or via CSS margin styling of the .jqplot-table-legend class.
/// </summary>
[Obsolete("Use 'marginTop', 'marginBottom', 'marginLeft' and 'marginRight' instead")]
public int? xoffset;
/// <summary>
/// Set the margins on the legend using the marginTop, marginLeft,
/// etc. properties or via CSS margin styling of the .jqplot-table-legend class.
/// </summary>
[Obsolete("Use 'marginTop', 'marginBottom', 'marginLeft' and 'marginRight' instead")]
public int? yoffset;
/// <summary>
/// css spec for the border around the legend box.
/// </summary>
public string border;
/// <summary>
/// css spec for the background of the legend box.
/// </summary>
public string background;
/// <summary>
/// css color spec for the legend text.
/// </summary>
public string textColor;
/// <summary>
/// css font-family spec for the legend text.
/// </summary>
public string fontFamily;
/// <summary>
/// css font-size spec for the legend text.
/// </summary>
public string fontSize;
/// <summary>
/// css padding-top spec for the rows in the legend.
/// </summary>
public string rowSpacing;
/// <summary>
/// renderer specific options passed to the renderer.
/// </summary>
public object rendererOptions;
/// <summary>
/// Whether to draw the legend before the series or not.
/// Used with series specific legend renderers for pie, donut, mekko charts, etc.
/// </summary>
public bool? predraw;
/// <summary>
/// CSS margin for the legend DOM element. This will set an element CSS style for
/// the margin which will override any style sheet setting. The default will be
/// taken from the stylesheet.
/// </summary>
public string marginTop;
/// <summary>
/// CSS margin for the legend DOM element. This will set an element CSS style for
/// the margin which will override any style sheet setting. The default will be
/// taken from the stylesheet.
/// </summary>
public string marginBottom;
/// <summary>
/// CSS margin for the legend DOM element. This will set an element CSS style for
/// the margin which will override any style sheet setting. The default will be
/// taken from the stylesheet.
/// </summary>
public string marginLeft;
/// <summary>
/// CSS margin for the legend DOM element. This will set an element CSS style for
/// the margin which will override any style sheet setting. The default will be
/// taken from the stylesheet.
/// </summary>
public string marginRight;
}
}
| {
"content_hash": "5b2e1a7ad3af528896c2e9134e1e51b9",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 89,
"avg_line_length": 32.56617647058823,
"alnum_prop": 0.6220365771054414,
"repo_name": "monemihir/webextras",
"id": "e6f6d21be6523524faf8ec7f26b66fe02335c2e8",
"size": "5196",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trunk/WebExtras/JQPlot/SubOptions/LegendOptions.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "3227"
},
{
"name": "Batchfile",
"bytes": "1610"
},
{
"name": "C#",
"bytes": "1576559"
},
{
"name": "CSS",
"bytes": "577986"
},
{
"name": "HTML",
"bytes": "215168"
},
{
"name": "JavaScript",
"bytes": "881525"
}
],
"symlink_target": ""
} |
package com.oneops.notification;
/**
* Notification message type severity
*/
public enum NotificationSeverity {
/**
* Critical event type
*/
critical("critical", 3),
/**
* Warning event type
*/
warning("warning", 2),
/**
* Info event type
*/
info("info", 1),
/**
* None. Added for filtering
*/
none("none", 0);
/**
* Severity name
*/
private String name;
/**
* Severity log level
*/
private int level;
/**
* Enum constructor
*
* @param name severity name
* @param level severity level
*/
NotificationSeverity(String name, int level) {
this.name = name;
this.level = level;
}
/**
* Returns the notification severity name
*
* @return severity name
*/
public String getName() {
return name;
}
/**
* Returns notification severity level
*
* @return severity level
*/
public int getLevel() {
return level;
}
}
| {
"content_hash": "f9d97c47e0ecfbf44d1e8cd60c5c8138",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 48,
"avg_line_length": 14.796875,
"alnum_prop": 0.5797254487856388,
"repo_name": "oneops/OneOps",
"id": "e353186522114142b4e23cfafcf9e3cd5bbb87a3",
"size": "1725",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "oneops-model/src/main/java/com/oneops/notification/NotificationSeverity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<Module specificationVersion='2'>
<ModulePrefs title="SAMLBearerAssertion">
<Require feature="dynamic-height"/>
<Require feature="osapi"/>
<Locale lang="all">
<msg name="title">My Groups</msg>
</Locale>
<OAuth2>
<Service name="YOUR_OAUTH_SERVICE_NAME">
<!-- Gadget Calling SAP Jam API -->
<!-- 4. Request Oauth 2.0 Access Token (SAML 2.0 Bearer Assertion) -->
<Token url="https://CALL_TO_YOUR_ODATA_TOKEN_PROVIDER"/>
</Service>
</OAuth2>
</ModulePrefs>
<Content type="html" href="SAMLBearerAssertion.html"/>
</Module>
| {
"content_hash": "527c4cf26f5252b4510290aa47fcff28",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 78,
"avg_line_length": 34.705882352941174,
"alnum_prop": 0.6254237288135593,
"repo_name": "shanaithal/SAPJamSampleCode",
"id": "868f2ed39c0607515f73e838496a1ca309571c5f",
"size": "590",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "OpenSocial/Gadget/SAMLBearerAssertion/SAMLBearerAssertion.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3365"
},
{
"name": "HTML",
"bytes": "16911"
},
{
"name": "Java",
"bytes": "170275"
},
{
"name": "JavaScript",
"bytes": "21813"
}
],
"symlink_target": ""
} |
<a name="Environment-Access"></a>
<div class="header">
<p>
Next: <a href="Standard-Environment.html#Standard-Environment" accesskey="n" rel="next">Standard Environment</a>, Up: <a href="Environment-Variables.html#Environment-Variables" accesskey="u" rel="up">Environment Variables</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Environment-Access-1"></a>
<h4 class="subsection">25.4.1 Environment Access</h4>
<a name="index-environment-access"></a>
<a name="index-environment-representation"></a>
<p>The value of an environment variable can be accessed with the
<code>getenv</code> function. This is declared in the header file
<samp>stdlib.h</samp>.
<a name="index-stdlib_002eh-19"></a>
</p>
<p>Libraries should use <code>secure_getenv</code> instead of <code>getenv</code>, so
that they do not accidentally use untrusted environment variables.
Modifications of environment variables are not allowed in
multi-threaded programs. The <code>getenv</code> and <code>secure_getenv</code>
functions can be safely used in multi-threaded programs.
</p>
<dl>
<dt><a name="index-getenv"></a>Function: <em>char *</em> <strong>getenv</strong> <em>(const char *<var>name</var>)</em></dt>
<dd><p>Preliminary:
| MT-Safe env
| AS-Safe
| AC-Safe
| See <a href="POSIX-Safety-Concepts.html#POSIX-Safety-Concepts">POSIX Safety Concepts</a>.
</p>
<p>This function returns a string that is the value of the environment
variable <var>name</var>. You must not modify this string. In some non-Unix
systems not using the GNU C Library, it might be overwritten by subsequent
calls to <code>getenv</code> (but not by any other library function). If the
environment variable <var>name</var> is not defined, the value is a null
pointer.
</p></dd></dl>
<dl>
<dt><a name="index-secure_005fgetenv"></a>Function: <em>char *</em> <strong>secure_getenv</strong> <em>(const char *<var>name</var>)</em></dt>
<dd><p>Preliminary:
| MT-Safe env
| AS-Safe
| AC-Safe
| See <a href="POSIX-Safety-Concepts.html#POSIX-Safety-Concepts">POSIX Safety Concepts</a>.
</p>
<p>This function is similar to <code>getenv</code>, but it returns a null
pointer if the environment is untrusted. This happens when the
program file has SUID or SGID bits set. General-purpose libraries
should always prefer this function over <code>getenv</code> to avoid
vulnerabilities if the library is referenced from a SUID/SGID program.
</p>
<p>This function is a GNU extension.
</p></dd></dl>
<dl>
<dt><a name="index-putenv"></a>Function: <em>int</em> <strong>putenv</strong> <em>(char *<var>string</var>)</em></dt>
<dd><p>Preliminary:
| MT-Unsafe const:env
| AS-Unsafe heap lock
| AC-Unsafe corrupt lock mem
| See <a href="POSIX-Safety-Concepts.html#POSIX-Safety-Concepts">POSIX Safety Concepts</a>.
</p>
<p>The <code>putenv</code> function adds or removes definitions from the environment.
If the <var>string</var> is of the form ‘<samp><var>name</var>=<var>value</var></samp>’, the
definition is added to the environment. Otherwise, the <var>string</var> is
interpreted as the name of an environment variable, and any definition
for this variable in the environment is removed.
</p>
<p>If the function is successful it returns <code>0</code>. Otherwise the return
value is nonzero and <code>errno</code> is set to indicate the error.
</p>
<p>The difference to the <code>setenv</code> function is that the exact string
given as the parameter <var>string</var> is put into the environment. If the
user should change the string after the <code>putenv</code> call this will
reflect automatically in the environment. This also requires that
<var>string</var> not be an automatic variable whose scope is left before the
variable is removed from the environment. The same applies of course to
dynamically allocated variables which are freed later.
</p>
<p>This function is part of the extended Unix interface. You should define
<var>_XOPEN_SOURCE</var> before including any header.
</p></dd></dl>
<dl>
<dt><a name="index-setenv"></a>Function: <em>int</em> <strong>setenv</strong> <em>(const char *<var>name</var>, const char *<var>value</var>, int <var>replace</var>)</em></dt>
<dd><p>Preliminary:
| MT-Unsafe const:env
| AS-Unsafe heap lock
| AC-Unsafe corrupt lock mem
| See <a href="POSIX-Safety-Concepts.html#POSIX-Safety-Concepts">POSIX Safety Concepts</a>.
</p>
<p>The <code>setenv</code> function can be used to add a new definition to the
environment. The entry with the name <var>name</var> is replaced by the
value ‘<samp><var>name</var>=<var>value</var></samp>’. Please note that this is also true
if <var>value</var> is the empty string. To do this a new string is created
and the strings <var>name</var> and <var>value</var> are copied. A null pointer
for the <var>value</var> parameter is illegal. If the environment already
contains an entry with key <var>name</var> the <var>replace</var> parameter
controls the action. If replace is zero, nothing happens. Otherwise
the old entry is replaced by the new one.
</p>
<p>Please note that you cannot remove an entry completely using this function.
</p>
<p>If the function is successful it returns <code>0</code>. Otherwise the
environment is unchanged and the return value is <code>-1</code> and
<code>errno</code> is set.
</p>
<p>This function was originally part of the BSD library but is now part of
the Unix standard.
</p></dd></dl>
<dl>
<dt><a name="index-unsetenv"></a>Function: <em>int</em> <strong>unsetenv</strong> <em>(const char *<var>name</var>)</em></dt>
<dd><p>Preliminary:
| MT-Unsafe const:env
| AS-Unsafe lock
| AC-Unsafe lock
| See <a href="POSIX-Safety-Concepts.html#POSIX-Safety-Concepts">POSIX Safety Concepts</a>.
</p>
<p>Using this function one can remove an entry completely from the
environment. If the environment contains an entry with the key
<var>name</var> this whole entry is removed. A call to this function is
equivalent to a call to <code>putenv</code> when the <var>value</var> part of the
string is empty.
</p>
<p>The function return <code>-1</code> if <var>name</var> is a null pointer, points to
an empty string, or points to a string containing a <code>=</code> character.
It returns <code>0</code> if the call succeeded.
</p>
<p>This function was originally part of the BSD library but is now part of
the Unix standard. The BSD version had no return value, though.
</p></dd></dl>
<p>There is one more function to modify the whole environment. This
function is said to be used in the POSIX.9 (POSIX bindings for Fortran
77) and so one should expect it did made it into POSIX.1. But this
never happened. But we still provide this function as a GNU extension
to enable writing standard compliant Fortran environments.
</p>
<dl>
<dt><a name="index-clearenv"></a>Function: <em>int</em> <strong>clearenv</strong> <em>(void)</em></dt>
<dd><p>Preliminary:
| MT-Unsafe const:env
| AS-Unsafe heap lock
| AC-Unsafe lock mem
| See <a href="POSIX-Safety-Concepts.html#POSIX-Safety-Concepts">POSIX Safety Concepts</a>.
</p>
<p>The <code>clearenv</code> function removes all entries from the environment.
Using <code>putenv</code> and <code>setenv</code> new entries can be added again
later.
</p>
<p>If the function is successful it returns <code>0</code>. Otherwise the return
value is nonzero.
</p></dd></dl>
<p>You can deal directly with the underlying representation of environment
objects to add more variables to the environment (for example, to
communicate with another program you are about to execute;
see <a href="Executing-a-File.html#Executing-a-File">Executing a File</a>).
</p>
<dl>
<dt><a name="index-environ"></a>Variable: <em>char **</em> <strong>environ</strong></dt>
<dd><p>The environment is represented as an array of strings. Each string is
of the format ‘<samp><var>name</var>=<var>value</var></samp>’. The order in which
strings appear in the environment is not significant, but the same
<var>name</var> must not appear more than once. The last element of the
array is a null pointer.
</p>
<p>This variable is declared in the header file <samp>unistd.h</samp>.
</p>
<p>If you just want to get the value of an environment variable, use
<code>getenv</code>.
</p></dd></dl>
<p>Unix systems, and GNU systems, pass the initial value of
<code>environ</code> as the third argument to <code>main</code>.
See <a href="Program-Arguments.html#Program-Arguments">Program Arguments</a>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Standard-Environment.html#Standard-Environment" accesskey="n" rel="next">Standard Environment</a>, Up: <a href="Environment-Variables.html#Environment-Variables" accesskey="u" rel="up">Environment Variables</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
| {
"content_hash": "52ea30030081033d5af4a2f131cd1685",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 406,
"avg_line_length": 45.964285714285715,
"alnum_prop": 0.7312687312687313,
"repo_name": "elmerland/elmerland",
"id": "87aab7f8bc0cc1eccc3a899676a9de2def49cfd0",
"size": "9009",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gnu_formatted/Environment-Access.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "13466"
},
{
"name": "C++",
"bytes": "554"
},
{
"name": "CSS",
"bytes": "26368"
},
{
"name": "HTML",
"bytes": "13695807"
},
{
"name": "JavaScript",
"bytes": "12986"
},
{
"name": "Makefile",
"bytes": "782"
},
{
"name": "Ruby",
"bytes": "781"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace ApiPlatform\Core\Hal\Serializer;
use ApiPlatform\Core\Exception\RuntimeException;
use ApiPlatform\Core\Serializer\AbstractItemNormalizer;
use ApiPlatform\Core\Serializer\ContextTrait;
/**
* Converts between objects and array including HAL metadata.
*
* @author Kévin Dunglas <[email protected]>
*/
final class ItemNormalizer extends AbstractItemNormalizer
{
use ContextTrait;
const FORMAT = 'jsonhal';
private $componentsCache = [];
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
{
return self::FORMAT === $format && parent::supportsNormalization($data, $format);
}
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = [])
{
$context['cache_key'] = $this->getHalCacheKey($format, $context);
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null, true);
$context = $this->initContext($resourceClass, $context);
$rawData = parent::normalize($object, $format, $context);
if (!is_array($rawData)) {
return $rawData;
}
$data = ['_links' => ['self' => ['href' => $this->iriConverter->getIriFromItem($object)]]];
$components = $this->getComponents($object, $format, $context);
$data = $this->populateRelation($data, $object, $format, $context, $components, 'links');
$data = $this->populateRelation($data, $object, $format, $context, $components, 'embedded');
return $data + $rawData;
}
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null)
{
return false;
}
/**
* {@inheritdoc}
*
* @throws RuntimeException
*/
public function denormalize($data, $class, $format = null, array $context = [])
{
throw new RuntimeException(sprintf('%s is a read-only format.', self::FORMAT));
}
/**
* {@inheritdoc}
*/
protected function getAttributes($object, $format, array $context)
{
return $this->getComponents($object, $format, $context)['states'];
}
/**
* Gets HAL components of the resource: states, links and embedded.
*
* @param object $object
* @param string|null $format
* @param array $context
*
* @return array
*/
private function getComponents($object, string $format = null, array $context)
{
if (false !== $context['cache_key'] && isset($this->componentsCache[$context['cache_key']])) {
return $this->componentsCache[$context['cache_key']];
}
$attributes = parent::getAttributes($object, $format, $context);
$options = $this->getFactoryOptions($context);
$components = [
'states' => [],
'links' => [],
'embedded' => [],
];
foreach ($attributes as $attribute) {
$propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $options);
$type = $propertyMetadata->getType();
$isOne = $isMany = false;
if (null !== $type) {
if ($type->isCollection()) {
$valueType = $type->getCollectionValueType();
$isMany = null !== $valueType && ($className = $valueType->getClassName()) && $this->resourceClassResolver->isResourceClass($className);
} else {
$className = $type->getClassName();
$isOne = $className && $this->resourceClassResolver->isResourceClass($className);
}
}
if (!$isOne && !$isMany) {
$components['states'][] = $attribute;
continue;
}
$relation = ['name' => $attribute, 'cardinality' => $isOne ? 'one' : 'many'];
if ($propertyMetadata->isReadableLink()) {
$components['embedded'][] = $relation;
}
$components['links'][] = $relation;
}
if (false !== $context['cache_key']) {
$this->componentsCache[$context['cache_key']] = $components;
}
return $components;
}
/**
* Populates _links and _embedded keys.
*
* @param array $data
* @param object $object
* @param string|null $format
* @param array $context
* @param array $components
* @param string $type
*
* @return array
*/
private function populateRelation(array $data, $object, string $format = null, array $context, array $components, string $type): array
{
$key = '_'.$type;
foreach ($components[$type] as $relation) {
$attributeValue = $this->getAttributeValue($object, $relation['name'], $format, $context);
if (empty($attributeValue)) {
continue;
}
if ('one' === $relation['cardinality']) {
if ('links' === $type) {
$data[$key][$relation['name']]['href'] = $this->getRelationIri($attributeValue);
continue;
}
$data[$key][$relation['name']] = $attributeValue;
continue;
}
// many
$data[$key][$relation['name']] = [];
foreach ($attributeValue as $rel) {
if ('links' === $type) {
$rel = ['href' => $this->getRelationIri($rel)];
}
$data[$key][$relation['name']][] = $rel;
}
}
return $data;
}
/**
* Gets the IRI of the given relation.
*
* @param array|string $rel
*
* @return string
*/
private function getRelationIri($rel): string
{
return $rel['_links']['self']['href'] ?? $rel;
}
/**
* Gets the cache key to use.
*
* @param string|null $format
* @param array $context
*
* @return bool|string
*/
private function getHalCacheKey(string $format = null, array $context)
{
try {
return md5($format.serialize($context));
} catch (\Exception $exception) {
// The context cannot be serialized, skip the cache
return false;
}
}
}
| {
"content_hash": "79d2cdb4aee9b6cdc56f61ad27d192f6",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 156,
"avg_line_length": 29.89814814814815,
"alnum_prop": 0.5329823474759987,
"repo_name": "safy-group/safy-api",
"id": "4fcc1e2f3a8fb618a5096d6c5862808767cf2bc5",
"size": "6690",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/api-platform/core/src/Hal/Serializer/ItemNormalizer.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3686"
},
{
"name": "PHP",
"bytes": "73489"
},
{
"name": "Shell",
"bytes": "2344"
}
],
"symlink_target": ""
} |
package org.zstack.core.thread;
import java.util.concurrent.Callable;
/**
* Created by mingjian.deng on 2019/10/15.
*/
public class PendingProperty {
private int maxPendingSize = -1;
private Callable<Boolean> callable = new Callable<Boolean>() {
@Override
public Boolean call() {
return false;
}
};
public int getMaxPendingSize() {
return maxPendingSize;
}
public void setMaxPendingSize(int maxPendingSize) {
this.maxPendingSize = maxPendingSize;
}
public Callable<Boolean> getCallable() {
return callable;
}
public void setCallable(Callable<Boolean> callable) {
this.callable = callable;
}
}
| {
"content_hash": "546f3ef491600adb8f6e87660c57b9be",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 22.28125,
"alnum_prop": 0.6395511921458625,
"repo_name": "MatheMatrix/zstack",
"id": "2736339495f87ee90a63efbd7c1be4d251b3f948",
"size": "713",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/zstack/core/thread/PendingProperty.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4616"
},
{
"name": "AspectJ",
"bytes": "74321"
},
{
"name": "Batchfile",
"bytes": "2932"
},
{
"name": "Groovy",
"bytes": "6674413"
},
{
"name": "Java",
"bytes": "25924839"
},
{
"name": "Python",
"bytes": "1062162"
},
{
"name": "Shell",
"bytes": "176428"
}
],
"symlink_target": ""
} |
package macbury.forge.octree;
/**
* Created by macbury on 21.10.14.
*/
public enum OctreePart {
FrontTopLeft(0), FrontTopRight(1), FrontBottomLeft(2), FrontBottomRight(3),
BackTopLeft(4), BackTopRight(5), BackBottomLeft(6), BackBottomRight(7);
private final int index;
OctreePart(int ni) {
this.index = ni;
}
public int getIndex() {
return index;
}
}
| {
"content_hash": "7fde407517ad804291c60291ff659c90",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 77,
"avg_line_length": 21,
"alnum_prop": 0.6851851851851852,
"repo_name": "macbury/ForgE",
"id": "c3d2b594df4093884fe0c3368784f8b601c69b6a",
"size": "378",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/macbury/forge/octree/OctreePart.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "GLSL",
"bytes": "22723"
},
{
"name": "Java",
"bytes": "747053"
},
{
"name": "Ruby",
"bytes": "11120"
}
],
"symlink_target": ""
} |
$hash = .\New-AzureSql.ps1 -SubscriptionName "Visual Studio Ultimate with MSDN" -DatabaseName HeroVsXmen_db -UserName taborro -Password "MrT!bbl3$" -FirewallRuleName HeroVsXmenFirewallRule -Location "East US"
$hash | {
"content_hash": "2cb191d973152af1c3f7e56680c01824",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 208,
"avg_line_length": 71.66666666666667,
"alnum_prop": 0.8,
"repo_name": "LearnVisualStudio/HeroVsRobot",
"id": "58a4c2084984bfc9c579663dc6b9ee529a53cceb",
"size": "215",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "run-sql.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "68183"
},
{
"name": "C#",
"bytes": "97108"
},
{
"name": "CSS",
"bytes": "2017"
},
{
"name": "JavaScript",
"bytes": "179184"
},
{
"name": "PowerShell",
"bytes": "87859"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>polymorphic_routes.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../../../../../../../../../../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../../../../../../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../../../../../../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../../../../../../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../../../../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../../../../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../../../../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<span>Ruby on Rails 4.1.8</span><br />
<h1>
polymorphic_routes.rb
</h1>
<ul class="files">
<li>
../../../../usr/local/share/gems/gems/actionpack-4.1.8/lib/action_dispatch/routing/polymorphic_routes.rb
</li>
<li>Last modified: 2014-11-25 22:16:18 +0530</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- File only: requires -->
<div class="sectiontitle">Required Files</div>
<ul>
<li>action_controller/model_naming</li>
</ul>
<!-- Namespace -->
<div class="sectiontitle">Namespace</div>
<ul>
<li>
<span class="type">MODULE</span>
<a href="../../../../../../../../../../../../../../classes/ActionDispatch.html">ActionDispatch</a>
</li>
<li>
<span class="type">MODULE</span>
<a href="../../../../../../../../../../../../../../classes/ActionDispatch/Routing.html">ActionDispatch::Routing</a>
</li>
<li>
<span class="type">MODULE</span>
<a href="../../../../../../../../../../../../../../classes/ActionDispatch/Routing/PolymorphicRoutes.html">ActionDispatch::Routing::PolymorphicRoutes</a>
</li>
</ul>
<!-- Methods -->
</div>
</div>
</body>
</html> | {
"content_hash": "06d21d6d035e2262c8c0fe6c7f729a81",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 162,
"avg_line_length": 26.941747572815533,
"alnum_prop": 0.4666666666666667,
"repo_name": "delta/DalalStreet",
"id": "1b2b7855866852f7637b9bebb6d6b00716052c9f",
"size": "2775",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "doc/api/files/__/__/__/__/usr/local/share/gems/gems/actionpack-4_1_8/lib/action_dispatch/routing/polymorphic_routes_rb.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16443"
},
{
"name": "CoffeeScript",
"bytes": "211"
},
{
"name": "HTML",
"bytes": "210460"
},
{
"name": "JavaScript",
"bytes": "7965"
},
{
"name": "Ruby",
"bytes": "157621"
},
{
"name": "Shell",
"bytes": "219"
}
],
"symlink_target": ""
} |
package action_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/cloudfoundry/bosh-agent/agent/action"
"github.com/cloudfoundry/bosh-agent/platform/platformfakes"
boshdirs "github.com/cloudfoundry/bosh-agent/settings/directories"
boshassert "github.com/cloudfoundry/bosh-utils/assert"
)
var _ = Describe("Testing with Ginkgo", func() {
var (
migrateDiskAction action.MigrateDiskAction
platform *platformfakes.FakePlatform
)
BeforeEach(func() {
platform = &platformfakes.FakePlatform{}
dirProvider := boshdirs.NewProvider("/foo")
migrateDiskAction = action.NewMigrateDisk(platform, dirProvider)
})
AssertActionIsAsynchronous(migrateDiskAction)
AssertActionIsNotPersistent(migrateDiskAction)
AssertActionIsLoggable(migrateDiskAction)
AssertActionIsNotResumable(migrateDiskAction)
AssertActionIsNotCancelable(migrateDiskAction)
It("migrate disk migrateDiskAction run", func() {
value, err := migrateDiskAction.Run()
Expect(err).ToNot(HaveOccurred())
boshassert.MatchesJSONString(GinkgoT(), value, "{}")
Expect(platform.MigratePersistentDiskCallCount()).To(Equal(1))
fromPath, toPath := platform.MigratePersistentDiskArgsForCall(0)
Expect(fromPath).To(boshassert.MatchPath("/foo/store"))
Expect(toPath).To(boshassert.MatchPath("/foo/store_migration_target"))
})
})
| {
"content_hash": "d62c8ffd71e2aeadd1212397d9ef54ee",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 72,
"avg_line_length": 32.11904761904762,
"alnum_prop": 0.7776130467012602,
"repo_name": "cloudfoundry/bosh-agent",
"id": "ca61ad189414ab88f84d37bd7d7690096acb34b5",
"size": "1349",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "agent/action/migrate_disk_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1009"
},
{
"name": "Go",
"bytes": "2394908"
},
{
"name": "PowerShell",
"bytes": "5664"
},
{
"name": "Shell",
"bytes": "26112"
}
],
"symlink_target": ""
} |
#ifndef __CPU_O3_COMMIT_HH__
#define __CPU_O3_COMMIT_HH__
#include <queue>
#include "base/statistics.hh"
#include "cpu/exetrace.hh"
#include "cpu/inst_seq.hh"
#include "cpu/timebuf.hh"
struct DerivO3CPUParams;
template <class>
struct O3ThreadState;
/**
* DefaultCommit handles single threaded and SMT commit. Its width is
* specified by the parameters; each cycle it tries to commit that
* many instructions. The SMT policy decides which thread it tries to
* commit instructions from. Non- speculative instructions must reach
* the head of the ROB before they are ready to execute; once they
* reach the head, commit will broadcast the instruction's sequence
* number to the previous stages so that they can issue/ execute the
* instruction. Only one non-speculative instruction is handled per
* cycle. Commit is responsible for handling all back-end initiated
* redirects. It receives the redirect, and then broadcasts it to all
* stages, indicating the sequence number they should squash until,
* and any necessary branch misprediction information as well. It
* priortizes redirects by instruction's age, only broadcasting a
* redirect if it corresponds to an instruction that should currently
* be in the ROB. This is done by tracking the sequence number of the
* youngest instruction in the ROB, which gets updated to any
* squashing instruction's sequence number, and only broadcasting a
* redirect if it corresponds to an older instruction. Commit also
* supports multiple cycle squashing, to model a ROB that can only
* remove a certain number of instructions per cycle.
*/
template<class Impl>
class DefaultCommit
{
public:
// Typedefs from the Impl.
typedef typename Impl::O3CPU O3CPU;
typedef typename Impl::DynInstPtr DynInstPtr;
typedef typename Impl::CPUPol CPUPol;
typedef typename CPUPol::RenameMap RenameMap;
typedef typename CPUPol::ROB ROB;
typedef typename CPUPol::TimeStruct TimeStruct;
typedef typename CPUPol::FetchStruct FetchStruct;
typedef typename CPUPol::IEWStruct IEWStruct;
typedef typename CPUPol::RenameStruct RenameStruct;
typedef typename CPUPol::Fetch Fetch;
typedef typename CPUPol::IEW IEW;
typedef O3ThreadState<Impl> Thread;
/** Event class used to schedule a squash due to a trap (fault or
* interrupt) to happen on a specific cycle.
*/
class TrapEvent : public Event {
private:
DefaultCommit<Impl> *commit;
ThreadID tid;
public:
TrapEvent(DefaultCommit<Impl> *_commit, ThreadID _tid);
void process();
const char *description() const;
};
/** Overall commit status. Used to determine if the CPU can deschedule
* itself due to a lack of activity.
*/
enum CommitStatus{
Active,
Inactive
};
/** Individual thread status. */
enum ThreadStatus {
Running,
Idle,
ROBSquashing,
TrapPending,
FetchTrapPending
};
/** Commit policy for SMT mode. */
enum CommitPolicy {
Aggressive,
RoundRobin,
OldestReady
};
private:
/** Overall commit status. */
CommitStatus _status;
/** Next commit status, to be set at the end of the cycle. */
CommitStatus _nextStatus;
/** Per-thread status. */
ThreadStatus commitStatus[Impl::MaxThreads];
/** Commit policy used in SMT mode. */
CommitPolicy commitPolicy;
public:
/** Construct a DefaultCommit with the given parameters. */
DefaultCommit(O3CPU *_cpu, DerivO3CPUParams *params);
/** Returns the name of the DefaultCommit. */
std::string name() const;
/** Registers statistics. */
void regStats();
/** Sets the list of threads. */
void setThreads(std::vector<Thread *> &threads);
/** Sets the main time buffer pointer, used for backwards communication. */
void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr);
void setFetchQueue(TimeBuffer<FetchStruct> *fq_ptr);
/** Sets the pointer to the queue coming from rename. */
void setRenameQueue(TimeBuffer<RenameStruct> *rq_ptr);
/** Sets the pointer to the queue coming from IEW. */
void setIEWQueue(TimeBuffer<IEWStruct> *iq_ptr);
/** Sets the pointer to the IEW stage. */
void setIEWStage(IEW *iew_stage);
/** Skid buffer between rename and commit. */
std::queue<DynInstPtr> skidBuffer;
/** The pointer to the IEW stage. Used solely to ensure that
* various events (traps, interrupts, syscalls) do not occur until
* all stores have written back.
*/
IEW *iewStage;
/** Sets pointer to list of active threads. */
void setActiveThreads(std::list<ThreadID> *at_ptr);
/** Sets pointer to the commited state rename map. */
void setRenameMap(RenameMap rm_ptr[Impl::MaxThreads]);
/** Sets pointer to the ROB. */
void setROB(ROB *rob_ptr);
/** Initializes stage by sending back the number of free entries. */
void initStage();
/** Initializes the draining of commit. */
bool drain();
/** Resumes execution after draining. */
void resume();
/** Completes the switch out of commit. */
void switchOut();
/** Takes over from another CPU's thread. */
void takeOverFrom();
/** Ticks the commit stage, which tries to commit instructions. */
void tick();
/** Handles any squashes that are sent from IEW, and adds instructions
* to the ROB and tries to commit instructions.
*/
void commit();
/** Returns the number of free ROB entries for a specific thread. */
size_t numROBFreeEntries(ThreadID tid);
/** Generates an event to schedule a squash due to a trap. */
void generateTrapEvent(ThreadID tid);
/** Records that commit needs to initiate a squash due to an
* external state update through the TC.
*/
void generateTCEvent(ThreadID tid);
private:
/** Updates the overall status of commit with the nextStatus, and
* tell the CPU if commit is active/inactive.
*/
void updateStatus();
/** Sets the next status based on threads' statuses, which becomes the
* current status at the end of the cycle.
*/
void setNextStatus();
/** Checks if the ROB is completed with squashing. This is for the case
* where the ROB can take multiple cycles to complete squashing.
*/
bool robDoneSquashing();
/** Returns if any of the threads have the number of ROB entries changed
* on this cycle. Used to determine if the number of free ROB entries needs
* to be sent back to previous stages.
*/
bool changedROBEntries();
/** Squashes all in flight instructions. */
void squashAll(ThreadID tid);
/** Handles squashing due to a trap. */
void squashFromTrap(ThreadID tid);
/** Handles squashing due to an TC write. */
void squashFromTC(ThreadID tid);
/** Handles squashing from instruction with SquashAfter set.
* This differs from the other squashes as it squashes following
* instructions instead of the current instruction and doesn't
* clean up various status bits about traps/tc writes pending.
*/
void squashAfter(ThreadID tid, DynInstPtr &head_inst,
uint64_t squash_after_seq_num);
/** Handles processing an interrupt. */
void handleInterrupt();
/** Get fetch redirecting so we can handle an interrupt */
void propagateInterrupt();
/** Commits as many instructions as possible. */
void commitInsts();
/** Tries to commit the head ROB instruction passed in.
* @param head_inst The instruction to be committed.
*/
bool commitHead(DynInstPtr &head_inst, unsigned inst_num);
/** Gets instructions from rename and inserts them into the ROB. */
void getInsts();
/** Insert all instructions from rename into skidBuffer */
void skidInsert();
/** Marks completed instructions using information sent from IEW. */
void markCompletedInsts();
/** Gets the thread to commit, based on the SMT policy. */
ThreadID getCommittingThread();
/** Returns the thread ID to use based on a round robin policy. */
ThreadID roundRobin();
/** Returns the thread ID to use based on an oldest instruction policy. */
ThreadID oldestReady();
public:
/** Reads the PC of a specific thread. */
TheISA::PCState pcState(ThreadID tid) { return pc[tid]; }
/** Sets the PC of a specific thread. */
void pcState(const TheISA::PCState &val, ThreadID tid)
{ pc[tid] = val; }
/** Returns the PC of a specific thread. */
Addr instAddr(ThreadID tid) { return pc[tid].instAddr(); }
/** Returns the next PC of a specific thread. */
Addr nextInstAddr(ThreadID tid) { return pc[tid].nextInstAddr(); }
/** Reads the micro PC of a specific thread. */
Addr microPC(ThreadID tid) { return pc[tid].microPC(); }
private:
/** Time buffer interface. */
TimeBuffer<TimeStruct> *timeBuffer;
/** Wire to write information heading to previous stages. */
typename TimeBuffer<TimeStruct>::wire toIEW;
/** Wire to read information from IEW (for ROB). */
typename TimeBuffer<TimeStruct>::wire robInfoFromIEW;
TimeBuffer<FetchStruct> *fetchQueue;
typename TimeBuffer<FetchStruct>::wire fromFetch;
/** IEW instruction queue interface. */
TimeBuffer<IEWStruct> *iewQueue;
/** Wire to read information from IEW queue. */
typename TimeBuffer<IEWStruct>::wire fromIEW;
/** Rename instruction queue interface, for ROB. */
TimeBuffer<RenameStruct> *renameQueue;
/** Wire to read information from rename queue. */
typename TimeBuffer<RenameStruct>::wire fromRename;
public:
/** ROB interface. */
ROB *rob;
private:
/** Pointer to O3CPU. */
O3CPU *cpu;
/** Vector of all of the threads. */
std::vector<Thread *> thread;
/** Records that commit has written to the time buffer this cycle. Used for
* the CPU to determine if it can deschedule itself if there is no activity.
*/
bool wroteToTimeBuffer;
/** Records if the number of ROB entries has changed this cycle. If it has,
* then the number of free entries must be re-broadcast.
*/
bool changedROBNumEntries[Impl::MaxThreads];
/** A counter of how many threads are currently squashing. */
ThreadID squashCounter;
/** Records if a thread has to squash this cycle due to a trap. */
bool trapSquash[Impl::MaxThreads];
/** Records if a thread has to squash this cycle due to an XC write. */
bool tcSquash[Impl::MaxThreads];
/** Priority List used for Commit Policy */
std::list<ThreadID> priority_list;
/** IEW to Commit delay, in ticks. */
unsigned iewToCommitDelay;
/** Commit to IEW delay, in ticks. */
unsigned commitToIEWDelay;
/** Rename to ROB delay, in ticks. */
unsigned renameToROBDelay;
unsigned fetchToCommitDelay;
/** Rename width, in instructions. Used so ROB knows how many
* instructions to get from the rename instruction queue.
*/
unsigned renameWidth;
/** Commit width, in instructions. */
unsigned commitWidth;
/** Number of Reorder Buffers */
unsigned numRobs;
/** Number of Active Threads */
ThreadID numThreads;
/** Is a drain pending. */
bool drainPending;
/** Is commit switched out. */
bool switchedOut;
/** The latency to handle a trap. Used when scheduling trap
* squash event.
*/
Tick trapLatency;
/** The interrupt fault. */
Fault interrupt;
/** The commit PC state of each thread. Refers to the instruction that
* is currently being processed/committed.
*/
TheISA::PCState pc[Impl::MaxThreads];
/** The sequence number of the youngest valid instruction in the ROB. */
InstSeqNum youngestSeqNum[Impl::MaxThreads];
/** The sequence number of the last commited instruction. */
InstSeqNum lastCommitedSeqNum[Impl::MaxThreads];
/** Records if there is a trap currently in flight. */
bool trapInFlight[Impl::MaxThreads];
/** Records if there were any stores committed this cycle. */
bool committedStores[Impl::MaxThreads];
/** Records if commit should check if the ROB is truly empty (see
commit_impl.hh). */
bool checkEmptyROB[Impl::MaxThreads];
/** Pointer to the list of active threads. */
std::list<ThreadID> *activeThreads;
/** Rename map interface. */
RenameMap *renameMap[Impl::MaxThreads];
/** True if last committed microop can be followed by an interrupt */
bool canHandleInterrupts;
/** Updates commit stats based on this instruction. */
void updateComInstStats(DynInstPtr &inst);
/** Stat for the total number of committed instructions. */
Stats::Scalar commitCommittedInsts;
/** Stat for the total number of committed ops. */
Stats::Scalar commitCommittedOps;
/** Stat for the total number of squashed instructions discarded by commit.
*/
Stats::Scalar commitSquashedInsts;
/** Stat for the total number of times commit is told to squash.
* @todo: Actually increment this stat.
*/
Stats::Scalar commitSquashEvents;
/** Stat for the total number of times commit has had to stall due to a non-
* speculative instruction reaching the head of the ROB.
*/
Stats::Scalar commitNonSpecStalls;
/** Stat for the total number of branch mispredicts that caused a squash. */
Stats::Scalar branchMispredicts;
/** Distribution of the number of committed instructions each cycle. */
Stats::Distribution numCommittedDist;
/** Total number of instructions committed. */
Stats::Vector instsCommitted;
/** Total number of ops (including micro ops) committed. */
Stats::Vector opsCommitted;
/** Total number of software prefetches committed. */
Stats::Vector statComSwp;
/** Stat for the total number of committed memory references. */
Stats::Vector statComRefs;
/** Stat for the total number of committed loads. */
Stats::Vector statComLoads;
/** Total number of committed memory barriers. */
Stats::Vector statComMembars;
/** Total number of committed branches. */
Stats::Vector statComBranches;
/** Total number of floating point instructions */
Stats::Vector statComFloating;
/** Total number of integer instructions */
Stats::Vector statComInteger;
/** Total number of function calls */
Stats::Vector statComFunctionCalls;
/** Number of cycles where the commit bandwidth limit is reached. */
Stats::Scalar commitEligibleSamples;
/** Number of instructions not committed due to bandwidth limits. */
Stats::Vector commitEligible;
};
#endif // __CPU_O3_COMMIT_HH__
| {
"content_hash": "cccdd5389ffd800d4ce5e05d2732db47",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 80,
"avg_line_length": 32.478070175438596,
"alnum_prop": 0.6793382849426064,
"repo_name": "shenyy/lily2-gem5",
"id": "b5539c702d2e14de2a80ecb73b9c1ce0d20be010",
"size": "17065",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "src/cpu/o3/commit.hh",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "232078"
},
{
"name": "C",
"bytes": "813454"
},
{
"name": "C++",
"bytes": "9460019"
},
{
"name": "Emacs Lisp",
"bytes": "1969"
},
{
"name": "Java",
"bytes": "3096"
},
{
"name": "JavaScript",
"bytes": "20182"
},
{
"name": "Perl",
"bytes": "431686"
},
{
"name": "Python",
"bytes": "2989296"
},
{
"name": "Ruby",
"bytes": "18698"
},
{
"name": "Shell",
"bytes": "2704"
},
{
"name": "Visual Basic",
"bytes": "2884"
}
],
"symlink_target": ""
} |
package org.jivesoftware.openfire.spi;
import org.jivesoftware.openfire.PacketDeliverer;
import org.jivesoftware.openfire.PacketException;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.auth.UnauthorizedException;
import org.jivesoftware.openfire.container.BasicModule;
import org.jivesoftware.openfire.net.SocketPacketWriteHandler;
import org.xmpp.packet.Packet;
/**
* In-memory implementation of the packet deliverer service
*
* @author Iain Shigeoka
*/
public class PacketDelivererImpl extends BasicModule implements PacketDeliverer {
/**
* The handler that does the actual delivery (could be a channel instead)
*/
protected SocketPacketWriteHandler deliverHandler;
public PacketDelivererImpl() {
super("Packet Delivery");
}
public void deliver(Packet packet) throws UnauthorizedException, PacketException {
if (packet == null) {
throw new PacketException("Packet was null");
}
if (deliverHandler == null) {
throw new PacketException("Could not send packet - no route" + packet.toString());
}
// Let the SocketPacketWriteHandler process the packet. SocketPacketWriteHandler may send
// it over the socket or store it when user is offline or drop it.
deliverHandler.process(packet);
}
@Override
public void start() throws IllegalStateException {
super.start();
deliverHandler = new SocketPacketWriteHandler(XMPPServer.getInstance().getRoutingTable());
}
@Override
public void stop() {
super.stop();
deliverHandler = null;
}
}
| {
"content_hash": "5fbd6d1d0f2ecf1b47ca41f2504aba8b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 98,
"avg_line_length": 31.615384615384617,
"alnum_prop": 0.7128953771289538,
"repo_name": "qyj415/openfire",
"id": "0245248e306a3c2073b0d2941f431dfcaa8ef991",
"size": "2395",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "src/java/org/jivesoftware/openfire/spi/PacketDelivererImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "3814"
},
{
"name": "CSS",
"bytes": "442234"
},
{
"name": "D",
"bytes": "2325"
},
{
"name": "Java",
"bytes": "16738865"
},
{
"name": "JavaScript",
"bytes": "4701670"
},
{
"name": "Objective-C",
"bytes": "6879"
},
{
"name": "Shell",
"bytes": "20543"
}
],
"symlink_target": ""
} |
define("arale/events/1.1.0/events-debug", [], function() {
// Events
// -----------------
// Thanks to:
// - https://github.com/documentcloud/backbone/blob/master/backbone.js
// - https://github.com/joyent/node/blob/master/lib/events.js
// Regular expression used to split event strings
var eventSplitter = /\s+/;
// A module that can be mixed in to *any object* in order to provide it
// with custom events. You may bind with `on` or remove with `off` callback
// functions to an event; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = new Events();
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
//
function Events() {}
// Bind one or more space separated events, `events`, to a `callback`
// function. Passing `"all"` will bind the callback to all events fired.
Events.prototype.on = function(events, callback, context) {
var cache, event, list;
if (!callback) return this;
cache = this.__events || (this.__events = {});
events = events.split(eventSplitter);
while (event = events.shift()) {
list = cache[event] || (cache[event] = []);
list.push(callback, context);
}
return this;
};
// Remove one or many callbacks. If `context` is null, removes all callbacks
// with that function. If `callback` is null, removes all callbacks for the
// event. If `events` is null, removes all bound callbacks for all events.
Events.prototype.off = function(events, callback, context) {
var cache, event, list, i;
// No events, or removing *all* events.
if (!(cache = this.__events)) return this;
if (!(events || callback || context)) {
delete this.__events;
return this;
}
events = events ? events.split(eventSplitter) : keys(cache);
// Loop through the callback list, splicing where appropriate.
while (event = events.shift()) {
list = cache[event];
if (!list) continue;
if (!(callback || context)) {
delete cache[event];
continue;
}
for (i = list.length - 2; i >= 0; i -= 2) {
if (!(callback && list[i] !== callback || context && list[i + 1] !== context)) {
list.splice(i, 2);
}
}
}
return this;
};
// Trigger one or many events, firing all bound callbacks. Callbacks are
// passed the same arguments as `trigger` is, apart from the event name
// (unless you're listening on `"all"`, which will cause your callback to
// receive the true name of the event as the first argument).
Events.prototype.trigger = function(events) {
var cache, event, all, list, i, len, rest = [], args, returned = {
status: true
};
if (!(cache = this.__events)) return this;
events = events.split(eventSplitter);
// Fill up `rest` with the callback arguments. Since we're only copying
// the tail of `arguments`, a loop is much faster than Array#slice.
for (i = 1, len = arguments.length; i < len; i++) {
rest[i - 1] = arguments[i];
}
// For each event, walk through the list of callbacks twice, first to
// trigger the event, then to trigger any `"all"` callbacks.
while (event = events.shift()) {
// Copy callback lists to prevent modification.
if (all = cache.all) all = all.slice();
if (list = cache[event]) list = list.slice();
// Execute event callbacks.
callEach(list, rest, this, returned);
// Execute "all" callbacks.
callEach(all, [ event ].concat(rest), this, returned);
}
return returned.status;
};
// Mix `Events` to object instance or Class function.
Events.mixTo = function(receiver) {
receiver = receiver.prototype || receiver;
var proto = Events.prototype;
for (var p in proto) {
if (proto.hasOwnProperty(p)) {
receiver[p] = proto[p];
}
}
};
// Helpers
// -------
var keys = Object.keys;
if (!keys) {
keys = function(o) {
var result = [];
for (var name in o) {
if (o.hasOwnProperty(name)) {
result.push(name);
}
}
return result;
};
}
// Execute callbacks
function callEach(list, args, context, returned) {
var r;
if (list) {
for (var i = 0, len = list.length; i < len; i += 2) {
try {
r = list[i].apply(list[i + 1] || context, args);
} catch (e) {
if (window.console && console.error && Object.prototype.toString.call(console.error) === "[object Function]") {
console.error(e.stack || e);
}
// go next with error
continue;
}
// trigger will return false if one of the callbacks return false
r === false && returned.status && (returned.status = false);
}
}
}
return Events;
});
| {
"content_hash": "b5eb305ce6b9c82c7f363aa37eed2dc7",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 131,
"avg_line_length": 41.03787878787879,
"alnum_prop": 0.5292597378622854,
"repo_name": "smeagonline-developers/OnlineEducationPlatform---SMEAGonline",
"id": "62d87b3837dd626b5f4262dc3799e6331d76dc35",
"size": "5417",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/assets/libs/arale/events/1.1.0/events-debug.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "2691"
},
{
"name": "CSS",
"bytes": "9937162"
},
{
"name": "CoffeeScript",
"bytes": "167262"
},
{
"name": "HTML",
"bytes": "4919069"
},
{
"name": "JavaScript",
"bytes": "42925514"
},
{
"name": "PHP",
"bytes": "22450097"
},
{
"name": "PLSQL",
"bytes": "7483"
},
{
"name": "Shell",
"bytes": "9237"
},
{
"name": "Smarty",
"bytes": "6"
}
],
"symlink_target": ""
} |
class UsersController < ApplicationController
def index
end
def show
@user = User.find(params[:id])
render json: @user
end
def create
@user = User.new(user_params)
if @user.save
flash[:success] = "Welcome to the SVSP training log"
render json: flash[:success]
end
end
private
def user_params
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :username)
end
end
| {
"content_hash": "3ad8fedb9bf9129e8121b84c9f015708",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 111,
"avg_line_length": 17.68,
"alnum_prop": 0.7013574660633484,
"repo_name": "jzuiches/patrol_app",
"id": "137af3122329d90738f2d38824b0413f6071b78f",
"size": "442",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/controllers/users_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "242"
},
{
"name": "Ruby",
"bytes": "24153"
}
],
"symlink_target": ""
} |
namespace boost {
namespace interprocess {
namespace ipcdetail{
class file_wrapper
{
/// @cond
BOOST_MOVABLE_BUT_NOT_COPYABLE(file_wrapper)
/// @endcond
public:
//!Default constructor.
//!Represents an empty file_wrapper.
file_wrapper();
//!Creates a file object with name "name" and mode "mode", with the access mode "mode"
//!If the file previously exists, throws an error.
file_wrapper(create_only_t, const char *name, mode_t mode, const permissions &perm = permissions())
{ this->priv_open_or_create(ipcdetail::DoCreate, name, mode, perm); }
//!Tries to create a file with name "name" and mode "mode", with the
//!access mode "mode". If the file previously exists, it tries to open it with mode "mode".
//!Otherwise throws an error.
file_wrapper(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions())
{ this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, perm); }
//!Tries to open a file with name "name", with the access mode "mode".
//!If the file does not previously exist, it throws an error.
file_wrapper(open_only_t, const char *name, mode_t mode)
{ this->priv_open_or_create(ipcdetail::DoOpen, name, mode, permissions()); }
//!Moves the ownership of "moved"'s file to *this.
//!After the call, "moved" does not represent any file.
//!Does not throw
file_wrapper(BOOST_RV_REF(file_wrapper) moved)
: m_handle(file_handle_t(ipcdetail::invalid_file()))
{ this->swap(moved); }
//!Moves the ownership of "moved"'s file to *this.
//!After the call, "moved" does not represent any file.
//!Does not throw
file_wrapper &operator=(BOOST_RV_REF(file_wrapper) moved)
{
file_wrapper tmp(boost::move(moved));
this->swap(tmp);
return *this;
}
//!Swaps to file_wrappers.
//!Does not throw
void swap(file_wrapper &other);
//!Erases a file from the system.
//!Returns false on error. Never throws
static bool remove(const char *name);
//!Sets the size of the file
void truncate(offset_t length);
//!Closes the
//!file
~file_wrapper();
//!Returns the name of the file
//!used in the constructor
const char *get_name() const;
//!Returns the name of the file
//!used in the constructor
bool get_size(offset_t &size) const;
//!Returns access mode
//!used in the constructor
mode_t get_mode() const;
//!Get mapping handle
//!to use with mapped_region
mapping_handle_t get_mapping_handle() const;
private:
//!Closes a previously opened file mapping. Never throws.
void priv_close();
//!Closes a previously opened file mapping. Never throws.
bool priv_open_or_create(ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm);
file_handle_t m_handle;
mode_t m_mode;
std::string m_filename;
};
inline file_wrapper::file_wrapper()
: m_handle(file_handle_t(ipcdetail::invalid_file()))
{}
inline file_wrapper::~file_wrapper()
{ this->priv_close(); }
inline const char *file_wrapper::get_name() const
{ return m_filename.c_str(); }
inline bool file_wrapper::get_size(offset_t &size) const
{ return get_file_size((file_handle_t)m_handle, size); }
inline void file_wrapper::swap(file_wrapper &other)
{
std::swap(m_handle, other.m_handle);
std::swap(m_mode, other.m_mode);
m_filename.swap(other.m_filename);
}
inline mapping_handle_t file_wrapper::get_mapping_handle() const
{ return mapping_handle_from_file_handle(m_handle); }
inline mode_t file_wrapper::get_mode() const
{ return m_mode; }
inline bool file_wrapper::priv_open_or_create
(ipcdetail::create_enum_t type,
const char *filename,
mode_t mode,
const permissions &perm = permissions())
{
m_filename = filename;
if(mode != read_only && mode != read_write){
error_info err(mode_error);
throw interprocess_exception(err);
}
//Open file existing native API to obtain the handle
switch(type){
case ipcdetail::DoOpen:
m_handle = open_existing_file(filename, mode);
break;
case ipcdetail::DoCreate:
m_handle = create_new_file(filename, mode, perm);
break;
case ipcdetail::DoOpenOrCreate:
m_handle = create_or_open_file(filename, mode, perm);
break;
default:
{
error_info err = other_error;
throw interprocess_exception(err);
}
}
//Check for error
if(m_handle == invalid_file()){
throw interprocess_exception(error_info(system_error_code()));
}
m_mode = mode;
return true;
}
inline bool file_wrapper::remove(const char *filename)
{ return delete_file(filename); }
inline void file_wrapper::truncate(offset_t length)
{
if(!truncate_file(m_handle, length)){
error_info err(system_error_code());
throw interprocess_exception(err);
}
}
inline void file_wrapper::priv_close()
{
if(m_handle != invalid_file()){
close_file(m_handle);
m_handle = invalid_file();
}
}
} //namespace ipcdetail{
} //namespace interprocess {
} //namespace boost {
#include <boost/interprocess/detail/config_end.hpp>
#endif //BOOST_INTERPROCESS_DETAIL_FILE_WRAPPER_HPP
| {
"content_hash": "ab0bbe30488f4c0d64fa872fca468150",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 119,
"avg_line_length": 28.939560439560438,
"alnum_prop": 0.657300170875261,
"repo_name": "scen/ionlib",
"id": "586e20db4dcbd34f11dc4d4b9e12691e48cc7b65",
"size": "6086",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "inc/boost/interprocess/detail/file_wrapper.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "9790968"
},
{
"name": "C++",
"bytes": "149439667"
},
{
"name": "D",
"bytes": "81870968"
},
{
"name": "Objective-C",
"bytes": "376824"
},
{
"name": "Perl",
"bytes": "77795"
},
{
"name": "Python",
"bytes": "2596"
},
{
"name": "Shell",
"bytes": "2289"
},
{
"name": "Squirrel",
"bytes": "4289"
}
],
"symlink_target": ""
} |
function process(tag, timestamp, record)
local __field_0 = (function()
return record["agent.googleapis.com/log_file_path"]
end)();
local __field_1 = (function()
if record["logging.googleapis.com/labels"] == nil
then
return nil
end
return record["logging.googleapis.com/labels"]["compute.googleapis.com/resource_name"]
end)();
local __field_2 = (function()
return record["logging.googleapis.com/logName"]
end)();
(function(value)
record["agent.googleapis.com/log_file_path"] = value
end)(nil);
local v = __field_0;
(function(value)
if record["logging.googleapis.com/labels"] == nil
then
record["logging.googleapis.com/labels"] = {}
end
record["logging.googleapis.com/labels"]["agent.googleapis.com/log_file_path"] = value
end)(v)
local v = __field_1;
if v == nil then v = "" end;
(function(value)
if record["logging.googleapis.com/labels"] == nil
then
record["logging.googleapis.com/labels"] = {}
end
record["logging.googleapis.com/labels"]["compute.googleapis.com/resource_name"] = value
end)(v)
local v = __field_2;
if v == nil then v = "cassandra_custom_debug" end;
(function(value)
record["logging.googleapis.com/logName"] = value
end)(v)
return 2, timestamp, record
end
| {
"content_hash": "dbfb3c09deb4713d0e476c4c6ad403fb",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 87,
"avg_line_length": 28.634146341463413,
"alnum_prop": 0.7206132879045997,
"repo_name": "GoogleCloudPlatform/ops-agent",
"id": "7864dc004b84b5c50925a7bfac8df0f3ab8ceea4",
"size": "1175",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "confgenerator/testdata/valid/linux/logging-receiver_cassandra_custom/dbfb3c09deb4713d0e476c4c6ad403fb.lua",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "282"
},
{
"name": "Dockerfile",
"bytes": "12021"
},
{
"name": "Go",
"bytes": "772130"
},
{
"name": "Makefile",
"bytes": "3328"
},
{
"name": "PowerShell",
"bytes": "5896"
},
{
"name": "Shell",
"bytes": "20216"
}
],
"symlink_target": ""
} |
package org.springframework.boot.autoconfigure.condition;
import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.autoconfigure.condition.ConditionMessage.Style;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
/**
* {@link Condition} that checks for specific resources.
*
* @author Dave Syer
* @see ConditionalOnResource
*/
@Order(Ordered.HIGHEST_PRECEDENCE + 20)
class OnResourceCondition extends SpringBootCondition {
private final ResourceLoader defaultResourceLoader = new DefaultResourceLoader();
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
ResourceLoader loader = context.getResourceLoader() == null
? this.defaultResourceLoader : context.getResourceLoader();
List<String> locations = new ArrayList<String>();
collectValues(locations, attributes.get("resources"));
Assert.isTrue(!locations.isEmpty(),
"@ConditionalOnResource annotations must specify at "
+ "least one resource location");
List<String> missing = new ArrayList<String>();
for (String location : locations) {
String resource = context.getEnvironment().resolvePlaceholders(location);
if (!loader.getResource(resource).exists()) {
missing.add(location);
}
}
if (!missing.isEmpty()) {
return ConditionOutcome.noMatch(ConditionMessage
.forCondition(ConditionalOnResource.class)
.didNotFind("resource", "resources").items(Style.QUOTE, missing));
}
return ConditionOutcome
.match(ConditionMessage.forCondition(ConditionalOnResource.class)
.found("location", "locations").items(locations));
}
private void collectValues(List<String> names, List<Object> values) {
for (Object value : values) {
for (Object item : (Object[]) value) {
names.add((String) item);
}
}
}
}
| {
"content_hash": "9b1eb3c68095fdb769c4895ba04dc12f",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 82,
"avg_line_length": 35.53731343283582,
"alnum_prop": 0.7719445611087778,
"repo_name": "jvz/spring-boot",
"id": "b36627dd1be81cbc5ba65971f8d3ed5c649375c9",
"size": "3001",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6954"
},
{
"name": "CSS",
"bytes": "5769"
},
{
"name": "FreeMarker",
"bytes": "2134"
},
{
"name": "Groovy",
"bytes": "48935"
},
{
"name": "HTML",
"bytes": "89609"
},
{
"name": "Java",
"bytes": "10393018"
},
{
"name": "JavaScript",
"bytes": "37789"
},
{
"name": "Ruby",
"bytes": "1307"
},
{
"name": "SQLPL",
"bytes": "20085"
},
{
"name": "Shell",
"bytes": "22357"
},
{
"name": "Smarty",
"bytes": "3276"
},
{
"name": "XSLT",
"bytes": "34105"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_05) on Mon Aug 18 21:34:49 IST 2014 -->
<title>Uses of Class android.support.v7.appcompat.R.integer</title>
<meta name="date" content="2014-08-18">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class android.support.v7.appcompat.R.integer";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../android/support/v7/appcompat/R.integer.html" title="class in android.support.v7.appcompat">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?android/support/v7/appcompat/class-use/R.integer.html" target="_top">Frames</a></li>
<li><a href="R.integer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class android.support.v7.appcompat.R.integer" class="title">Uses of Class<br>android.support.v7.appcompat.R.integer</h2>
</div>
<div class="classUseContainer">No usage of android.support.v7.appcompat.R.integer</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../android/support/v7/appcompat/R.integer.html" title="class in android.support.v7.appcompat">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?android/support/v7/appcompat/class-use/R.integer.html" target="_top">Frames</a></li>
<li><a href="R.integer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "6b54b423e00c6a90eba3abbc6711d829",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 139,
"avg_line_length": 35.46774193548387,
"alnum_prop": 0.6091405184174625,
"repo_name": "rohanagarwal94/Mobile-applications",
"id": "9a9160685143101b497ce22034a25f275e0737c6",
"size": "4398",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Learn from Map/doc/android/support/v7/appcompat/class-use/R.integer.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "59708"
},
{
"name": "CSS",
"bytes": "24304"
},
{
"name": "HTML",
"bytes": "8691643"
},
{
"name": "Java",
"bytes": "1346332"
},
{
"name": "JavaScript",
"bytes": "4495"
},
{
"name": "Makefile",
"bytes": "1916"
}
],
"symlink_target": ""
} |
<Record>
<Term>Eye Infections</Term>
<SemanticType>Disease or Syndrome</SemanticType>
<ParentTerm>Infection</ParentTerm>
<ParentTerm>Eye Diseases</ParentTerm>
<ClassificationPath>Eye Diseases/Eye Infections</ClassificationPath>
<ClassificationPath>Bacterial Infections and Mycoses/Infection/Eye Infections</ClassificationPath>
<BroaderTerm>Infection</BroaderTerm>
<BroaderTerm>Eye Infections</BroaderTerm>
<BroaderTerm>Bacterial Infections and Mycoses</BroaderTerm>
<BroaderTerm>Eye Diseases</BroaderTerm>
<ChildTerm>Eye Infections, Bacterial</ChildTerm>
<ChildTerm>Corneal Ulcer</ChildTerm>
<ChildTerm>Eye Infections, Parasitic</ChildTerm>
<ChildTerm>Eye Infections, Fungal</ChildTerm>
<ChildTerm>Eye Infections, Viral</ChildTerm>
<Synonym>Eye Infection</Synonym>
<Synonym>Ocular Infections</Synonym>
<Synonym>Eye Infections</Synonym>
<Synonym>Ocular Infection</Synonym>
<Description>Infection, moderate to severe, caused by bacteria, fungi, or viruses, which occurs either on the external surface of the eye or intraocularly with probable inflammation, visual impairment, or blindness.</Description>
<Source>MeSH</Source>
</Record>
| {
"content_hash": "c46839623ee57413cb6b3472da011b82",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 229,
"avg_line_length": 50.30434782608695,
"alnum_prop": 0.8038029386343993,
"repo_name": "detnavillus/modular-informatic-designs",
"id": "1f87d63eebfa463a92cbda10852bfaa133e1b337",
"size": "1157",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pipeline/src/test/resources/thesaurus/diseaseorsyndrome/eyeinfections.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2069134"
}
],
"symlink_target": ""
} |
#if !defined(FUSION_INCLUDE_DEQUE)
#define FUSION_INCLUDE_DEQUE
#include <boost/fusion/container/deque.hpp>
#endif
| {
"content_hash": "a922ea0f3076dd2481b46dd5c252263b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 43,
"avg_line_length": 17.857142857142858,
"alnum_prop": 0.728,
"repo_name": "pennwin2013/netsvr",
"id": "2df2648fd6f2c3035ac49bd7fc421cb56e36ba4f",
"size": "489",
"binary": false,
"copies": "45",
"ref": "refs/heads/master",
"path": "include/boost/fusion/include/deque.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "67355"
},
{
"name": "C++",
"bytes": "52439988"
},
{
"name": "Python",
"bytes": "2525"
}
],
"symlink_target": ""
} |
/*
Leaflet.markercluster, Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps.
https://github.com/Leaflet/Leaflet.markercluster
(c) 2012-2013, Dave Leaver, smartrak
*/
(function (window, document, undefined) {/*
* L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
*/
L.MarkerClusterGroup = L.FeatureGroup.extend({
options: {
maxClusterRadius: 80, //A cluster will cover at most this many pixels from its center
iconCreateFunction: null,
spiderfyOnMaxZoom: true,
showCoverageOnHover: true,
zoomToBoundsOnClick: true,
singleMarkerMode: false,
disableClusteringAtZoom: null,
// Setting this to false prevents the removal of any clusters outside of the viewpoint, which
// is the default behaviour for performance reasons.
removeOutsideVisibleBounds: true,
//Whether to animate adding markers after adding the MarkerClusterGroup to the map
// If you are adding individual markers set to true, if adding bulk markers leave false for massive performance gains.
animateAddingMarkers: false,
//Increase to increase the distance away that spiderfied markers appear from the center
spiderfyDistanceMultiplier: 1,
// When bulk adding layers, adds markers in chunks. Means addLayers may not add all the layers in the call, others will be loaded during setTimeouts
chunkedLoading: false,
chunkInterval: 200, // process markers for a maximum of ~ n milliseconds (then trigger the chunkProgress callback)
chunkDelay: 50, // at the end of each interval, give n milliseconds back to system/browser
chunkProgress: null, // progress callback: function(processed, total, elapsed) (e.g. for a progress indicator)
//Options to pass to the L.Polygon constructor
polygonOptions: {}
},
initialize: function (options) {
L.Util.setOptions(this, options);
if (!this.options.iconCreateFunction) {
this.options.iconCreateFunction = this._defaultIconCreateFunction;
}
this._featureGroup = L.featureGroup();
this._featureGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
this._nonPointGroup = L.featureGroup();
this._nonPointGroup.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
this._inZoomAnimation = 0;
this._needsClustering = [];
this._needsRemoving = []; //Markers removed while we aren't on the map need to be kept track of
//The bounds of the currently shown area (from _getExpandedVisibleBounds) Updated on zoom/move
this._currentShownBounds = null;
this._queue = [];
},
addLayer: function (layer) {
if (layer instanceof L.LayerGroup) {
var array = [];
for (var i in layer._layers) {
array.push(layer._layers[i]);
}
return this.addLayers(array);
}
//Don't cluster non point data
if (!layer.getLatLng) {
this._nonPointGroup.addLayer(layer);
return this;
}
if (!this._map) {
this._needsClustering.push(layer);
return this;
}
if (this.hasLayer(layer)) {
return this;
}
//If we have already clustered we'll need to add this one to a cluster
if (this._unspiderfy) {
this._unspiderfy();
}
this._addLayer(layer, this._maxZoom);
//Work out what is visible
var visibleLayer = layer,
currentZoom = this._map.getZoom();
if (layer.__parent) {
while (visibleLayer.__parent._zoom >= currentZoom) {
visibleLayer = visibleLayer.__parent;
}
}
if (this._currentShownBounds.contains(visibleLayer.getLatLng())) {
if (this.options.animateAddingMarkers) {
this._animationAddLayer(layer, visibleLayer);
} else {
this._animationAddLayerNonAnimated(layer, visibleLayer);
}
}
return this;
},
removeLayer: function (layer) {
if (layer instanceof L.LayerGroup)
{
var array = [];
for (var i in layer._layers) {
array.push(layer._layers[i]);
}
return this.removeLayers(array);
}
//Non point layers
if (!layer.getLatLng) {
this._nonPointGroup.removeLayer(layer);
return this;
}
if (!this._map) {
if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) {
this._needsRemoving.push(layer);
}
return this;
}
if (!layer.__parent) {
return this;
}
if (this._unspiderfy) {
this._unspiderfy();
this._unspiderfyLayer(layer);
}
//Remove the marker from clusters
this._removeLayer(layer, true);
if (this._featureGroup.hasLayer(layer)) {
this._featureGroup.removeLayer(layer);
if (layer.setOpacity) {
layer.setOpacity(1);
}
}
return this;
},
//Takes an array of markers and adds them in bulk
addLayers: function (layersArray) {
var fg = this._featureGroup,
npg = this._nonPointGroup,
chunked = this.options.chunkedLoading,
chunkInterval = this.options.chunkInterval,
chunkProgress = this.options.chunkProgress,
newMarkers, i, l, m;
if (this._map) {
var offset = 0,
started = (new Date()).getTime();
var process = L.bind(function () {
var start = (new Date()).getTime();
for (; offset < layersArray.length; offset++) {
if (chunked && offset % 200 === 0) {
// every couple hundred markers, instrument the time elapsed since processing started:
var elapsed = (new Date()).getTime() - start;
if (elapsed > chunkInterval) {
break; // been working too hard, time to take a break :-)
}
}
m = layersArray[offset];
//Not point data, can't be clustered
if (!m.getLatLng) {
npg.addLayer(m);
continue;
}
if (this.hasLayer(m)) {
continue;
}
this._addLayer(m, this._maxZoom);
//If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
if (m.__parent) {
if (m.__parent.getChildCount() === 2) {
var markers = m.__parent.getAllChildMarkers(),
otherMarker = markers[0] === m ? markers[1] : markers[0];
fg.removeLayer(otherMarker);
}
}
}
if (chunkProgress) {
// report progress and time elapsed:
chunkProgress(offset, layersArray.length, (new Date()).getTime() - started);
}
if (offset === layersArray.length) {
//Update the icons of all those visible clusters that were affected
this._featureGroup.eachLayer(function (c) {
if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
c._updateIcon();
}
});
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
} else {
setTimeout(process, this.options.chunkDelay);
}
}, this);
process();
} else {
newMarkers = [];
for (i = 0, l = layersArray.length; i < l; i++) {
m = layersArray[i];
//Not point data, can't be clustered
if (!m.getLatLng) {
npg.addLayer(m);
continue;
}
if (this.hasLayer(m)) {
continue;
}
newMarkers.push(m);
}
this._needsClustering = this._needsClustering.concat(newMarkers);
}
return this;
},
//Takes an array of markers and removes them in bulk
removeLayers: function (layersArray) {
var i, l, m,
fg = this._featureGroup,
npg = this._nonPointGroup;
if (!this._map) {
for (i = 0, l = layersArray.length; i < l; i++) {
m = layersArray[i];
this._arraySplice(this._needsClustering, m);
npg.removeLayer(m);
}
return this;
}
for (i = 0, l = layersArray.length; i < l; i++) {
m = layersArray[i];
if (!m.__parent) {
npg.removeLayer(m);
continue;
}
this._removeLayer(m, true, true);
if (fg.hasLayer(m)) {
fg.removeLayer(m);
if (m.setOpacity) {
m.setOpacity(1);
}
}
}
//Fix up the clusters and markers on the map
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
fg.eachLayer(function (c) {
if (c instanceof L.MarkerCluster) {
c._updateIcon();
}
});
return this;
},
//Removes all layers from the MarkerClusterGroup
clearLayers: function () {
//Need our own special implementation as the LayerGroup one doesn't work for us
//If we aren't on the map (yet), blow away the markers we know of
if (!this._map) {
this._needsClustering = [];
delete this._gridClusters;
delete this._gridUnclustered;
}
if (this._noanimationUnspiderfy) {
this._noanimationUnspiderfy();
}
//Remove all the visible layers
this._featureGroup.clearLayers();
this._nonPointGroup.clearLayers();
this.eachLayer(function (marker) {
delete marker.__parent;
});
if (this._map) {
//Reset _topClusterLevel and the DistanceGrids
this._generateInitialClusters();
}
return this;
},
//Override FeatureGroup.getBounds as it doesn't work
getBounds: function () {
var bounds = new L.LatLngBounds();
if (this._topClusterLevel) {
bounds.extend(this._topClusterLevel._bounds);
}
for (var i = this._needsClustering.length - 1; i >= 0; i--) {
bounds.extend(this._needsClustering[i].getLatLng());
}
bounds.extend(this._nonPointGroup.getBounds());
return bounds;
},
//Overrides LayerGroup.eachLayer
eachLayer: function (method, context) {
var markers = this._needsClustering.slice(),
i;
if (this._topClusterLevel) {
this._topClusterLevel.getAllChildMarkers(markers);
}
for (i = markers.length - 1; i >= 0; i--) {
method.call(context, markers[i]);
}
this._nonPointGroup.eachLayer(method, context);
},
//Overrides LayerGroup.getLayers
getLayers: function () {
var layers = [];
this.eachLayer(function (l) {
layers.push(l);
});
return layers;
},
//Overrides LayerGroup.getLayer, WARNING: Really bad performance
getLayer: function (id) {
var result = null;
this.eachLayer(function (l) {
if (L.stamp(l) === id) {
result = l;
}
});
return result;
},
//Returns true if the given layer is in this MarkerClusterGroup
hasLayer: function (layer) {
if (!layer) {
return false;
}
var i, anArray = this._needsClustering;
for (i = anArray.length - 1; i >= 0; i--) {
if (anArray[i] === layer) {
return true;
}
}
anArray = this._needsRemoving;
for (i = anArray.length - 1; i >= 0; i--) {
if (anArray[i] === layer) {
return false;
}
}
return !!(layer.__parent && layer.__parent._group === this) || this._nonPointGroup.hasLayer(layer);
},
//Zoom down to show the given layer (spiderfying if necessary) then calls the callback
zoomToShowLayer: function (layer, callback) {
var showMarker = function () {
if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) {
this._map.off('moveend', showMarker, this);
this.off('animationend', showMarker, this);
if (layer._icon) {
callback();
} else if (layer.__parent._icon) {
var afterSpiderfy = function () {
this.off('spiderfied', afterSpiderfy, this);
callback();
};
this.on('spiderfied', afterSpiderfy, this);
layer.__parent.spiderfy();
}
}
};
if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
//Layer is visible ond on screen, immediate return
callback();
} else if (layer.__parent._zoom < this._map.getZoom()) {
//Layer should be visible at this zoom level. It must not be on screen so just pan over to it
this._map.on('moveend', showMarker, this);
this._map.panTo(layer.getLatLng());
} else {
var moveStart = function () {
this._map.off('movestart', moveStart, this);
moveStart = null;
};
this._map.on('movestart', moveStart, this);
this._map.on('moveend', showMarker, this);
this.on('animationend', showMarker, this);
layer.__parent.zoomToBounds();
if (moveStart) {
//Never started moving, must already be there, probably need clustering however
showMarker.call(this);
}
}
},
//Overrides FeatureGroup.onAdd
onAdd: function (map) {
this._map = map;
var i, l, layer;
if (!isFinite(this._map.getMaxZoom())) {
throw "Map has no maxZoom specified";
}
this._featureGroup.onAdd(map);
this._nonPointGroup.onAdd(map);
if (!this._gridClusters) {
this._generateInitialClusters();
}
for (i = 0, l = this._needsRemoving.length; i < l; i++) {
layer = this._needsRemoving[i];
this._removeLayer(layer, true);
}
this._needsRemoving = [];
//Remember the current zoom level and bounds
this._zoom = this._map.getZoom();
this._currentShownBounds = this._getExpandedVisibleBounds();
this._map.on('zoomend', this._zoomEnd, this);
this._map.on('moveend', this._moveEnd, this);
if (this._spiderfierOnAdd) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely
this._spiderfierOnAdd();
}
this._bindEvents();
//Actually add our markers to the map:
l = this._needsClustering;
this._needsClustering = [];
this.addLayers(l);
},
//Overrides FeatureGroup.onRemove
onRemove: function (map) {
map.off('zoomend', this._zoomEnd, this);
map.off('moveend', this._moveEnd, this);
this._unbindEvents();
//In case we are in a cluster animation
this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
if (this._spiderfierOnRemove) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely
this._spiderfierOnRemove();
}
//Clean up all the layers we added to the map
this._hideCoverage();
this._featureGroup.onRemove(map);
this._nonPointGroup.onRemove(map);
this._featureGroup.clearLayers();
this._map = null;
},
getVisibleParent: function (marker) {
var vMarker = marker;
while (vMarker && !vMarker._icon) {
vMarker = vMarker.__parent;
}
return vMarker || null;
},
//Remove the given object from the given array
_arraySplice: function (anArray, obj) {
for (var i = anArray.length - 1; i >= 0; i--) {
if (anArray[i] === obj) {
anArray.splice(i, 1);
return true;
}
}
},
//Internal function for removing a marker from everything.
//dontUpdateMap: set to true if you will handle updating the map manually (for bulk functions)
_removeLayer: function (marker, removeFromDistanceGrid, dontUpdateMap) {
var gridClusters = this._gridClusters,
gridUnclustered = this._gridUnclustered,
fg = this._featureGroup,
map = this._map;
//Remove the marker from distance clusters it might be in
if (removeFromDistanceGrid) {
for (var z = this._maxZoom; z >= 0; z--) {
if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) {
break;
}
}
}
//Work our way up the clusters removing them as we go if required
var cluster = marker.__parent,
markers = cluster._markers,
otherMarker;
//Remove the marker from the immediate parents marker list
this._arraySplice(markers, marker);
while (cluster) {
cluster._childCount--;
if (cluster._zoom < 0) {
//Top level, do nothing
break;
} else if (removeFromDistanceGrid && cluster._childCount <= 1) { //Cluster no longer required
//We need to push the other marker up to the parent
otherMarker = cluster._markers[0] === marker ? cluster._markers[1] : cluster._markers[0];
//Update distance grid
gridClusters[cluster._zoom].removeObject(cluster, map.project(cluster._cLatLng, cluster._zoom));
gridUnclustered[cluster._zoom].addObject(otherMarker, map.project(otherMarker.getLatLng(), cluster._zoom));
//Move otherMarker up to parent
this._arraySplice(cluster.__parent._childClusters, cluster);
cluster.__parent._markers.push(otherMarker);
otherMarker.__parent = cluster.__parent;
if (cluster._icon) {
//Cluster is currently on the map, need to put the marker on the map instead
fg.removeLayer(cluster);
if (!dontUpdateMap) {
fg.addLayer(otherMarker);
}
}
} else {
cluster._recalculateBounds();
if (!dontUpdateMap || !cluster._icon) {
cluster._updateIcon();
}
}
cluster = cluster.__parent;
}
delete marker.__parent;
},
_isOrIsParent: function (el, oel) {
while (oel) {
if (el === oel) {
return true;
}
oel = oel.parentNode;
}
return false;
},
_propagateEvent: function (e) {
if (e.layer instanceof L.MarkerCluster) {
//Prevent multiple clustermouseover/off events if the icon is made up of stacked divs (Doesn't work in ie <= 8, no relatedTarget)
if (e.originalEvent && this._isOrIsParent(e.layer._icon, e.originalEvent.relatedTarget)) {
return;
}
e.type = 'cluster' + e.type;
}
this.fire(e.type, e);
},
//Default functionality
_defaultIconCreateFunction: function (cluster) {
var childCount = cluster.getChildCount();
var c = ' marker-cluster-';
if (childCount < 10) {
c += 'small';
} else if (childCount < 100) {
c += 'medium';
} else {
c += 'large';
}
return new L.DivIcon({ html: '<div><span>' + childCount + '</span></div>', className: 'marker-cluster' + c, iconSize: new L.Point(40, 40) });
},
_bindEvents: function () {
var map = this._map,
spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
showCoverageOnHover = this.options.showCoverageOnHover,
zoomToBoundsOnClick = this.options.zoomToBoundsOnClick;
//Zoom on cluster click or spiderfy if we are at the lowest level
if (spiderfyOnMaxZoom || zoomToBoundsOnClick) {
this.on('clusterclick', this._zoomOrSpiderfy, this);
}
//Show convex hull (boundary) polygon on mouse over
if (showCoverageOnHover) {
this.on('clustermouseover', this._showCoverage, this);
this.on('clustermouseout', this._hideCoverage, this);
map.on('zoomend', this._hideCoverage, this);
}
},
_zoomOrSpiderfy: function (e) {
var map = this._map;
if (map.getMaxZoom() === map.getZoom()) {
if (this.options.spiderfyOnMaxZoom) {
e.layer.spiderfy();
}
} else if (this.options.zoomToBoundsOnClick) {
e.layer.zoomToBounds();
}
// Focus the map again for keyboard users.
if (e.originalEvent && e.originalEvent.keyCode === 13) {
map._container.focus();
}
},
_showCoverage: function (e) {
var map = this._map;
if (this._inZoomAnimation) {
return;
}
if (this._shownPolygon) {
map.removeLayer(this._shownPolygon);
}
if (e.layer.getChildCount() > 2 && e.layer !== this._spiderfied) {
this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions);
map.addLayer(this._shownPolygon);
}
},
_hideCoverage: function () {
if (this._shownPolygon) {
this._map.removeLayer(this._shownPolygon);
this._shownPolygon = null;
}
},
_unbindEvents: function () {
var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
showCoverageOnHover = this.options.showCoverageOnHover,
zoomToBoundsOnClick = this.options.zoomToBoundsOnClick,
map = this._map;
if (spiderfyOnMaxZoom || zoomToBoundsOnClick) {
this.off('clusterclick', this._zoomOrSpiderfy, this);
}
if (showCoverageOnHover) {
this.off('clustermouseover', this._showCoverage, this);
this.off('clustermouseout', this._hideCoverage, this);
map.off('zoomend', this._hideCoverage, this);
}
},
_zoomEnd: function () {
if (!this._map) { //May have been removed from the map by a zoomEnd handler
return;
}
this._mergeSplitClusters();
this._zoom = this._map._zoom;
this._currentShownBounds = this._getExpandedVisibleBounds();
},
_moveEnd: function () {
if (this._inZoomAnimation) {
return;
}
var newBounds = this._getExpandedVisibleBounds();
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, newBounds);
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._map._zoom, newBounds);
this._currentShownBounds = newBounds;
return;
},
_generateInitialClusters: function () {
var maxZoom = this._map.getMaxZoom(),
radius = this.options.maxClusterRadius,
radiusFn = radius;
//If we just set maxClusterRadius to a single number, we need to create
//a simple function to return that number. Otherwise, we just have to
//use the function we've passed in.
if (typeof radius !== "function") {
radiusFn = function () { return radius; };
}
if (this.options.disableClusteringAtZoom) {
maxZoom = this.options.disableClusteringAtZoom - 1;
}
this._maxZoom = maxZoom;
this._gridClusters = {};
this._gridUnclustered = {};
//Set up DistanceGrids for each zoom
for (var zoom = maxZoom; zoom >= 0; zoom--) {
this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
}
this._topClusterLevel = new L.MarkerCluster(this, -1);
},
//Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom)
_addLayer: function (layer, zoom) {
var gridClusters = this._gridClusters,
gridUnclustered = this._gridUnclustered,
markerPoint, z;
if (this.options.singleMarkerMode) {
layer.options.icon = this.options.iconCreateFunction({
getChildCount: function () {
return 1;
},
getAllChildMarkers: function () {
return [layer];
}
});
}
//Find the lowest zoom level to slot this one in
for (; zoom >= 0; zoom--) {
markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position
//Try find a cluster close by
var closest = gridClusters[zoom].getNearObject(markerPoint);
if (closest) {
closest._addChild(layer);
layer.__parent = closest;
return;
}
//Try find a marker close by to form a new cluster with
closest = gridUnclustered[zoom].getNearObject(markerPoint);
if (closest) {
var parent = closest.__parent;
if (parent) {
this._removeLayer(closest, false);
}
//Create new cluster with these 2 in it
var newCluster = new L.MarkerCluster(this, zoom, closest, layer);
gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom));
closest.__parent = newCluster;
layer.__parent = newCluster;
//First create any new intermediate parent clusters that don't exist
var lastParent = newCluster;
for (z = zoom - 1; z > parent._zoom; z--) {
lastParent = new L.MarkerCluster(this, z, lastParent);
gridClusters[z].addObject(lastParent, this._map.project(closest.getLatLng(), z));
}
parent._addChild(lastParent);
//Remove closest from this zoom level and any above that it is in, replace with newCluster
for (z = zoom; z >= 0; z--) {
if (!gridUnclustered[z].removeObject(closest, this._map.project(closest.getLatLng(), z))) {
break;
}
}
return;
}
//Didn't manage to cluster in at this zoom, record us as a marker here and continue upwards
gridUnclustered[zoom].addObject(layer, markerPoint);
}
//Didn't get in anything, add us to the top
this._topClusterLevel._addChild(layer);
layer.__parent = this._topClusterLevel;
return;
},
//Enqueue code to fire after the marker expand/contract has happened
_enqueue: function (fn) {
this._queue.push(fn);
if (!this._queueTimeout) {
this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300);
}
},
_processQueue: function () {
for (var i = 0; i < this._queue.length; i++) {
this._queue[i].call(this);
}
this._queue.length = 0;
clearTimeout(this._queueTimeout);
this._queueTimeout = null;
},
//Merge and split any existing clusters that are too big or small
_mergeSplitClusters: function () {
//Incase we are starting to split before the animation finished
this._processQueue();
if (this._zoom < this._map._zoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split
this._animationStart();
//Remove clusters now off screen
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, this._getExpandedVisibleBounds());
this._animationZoomIn(this._zoom, this._map._zoom);
} else if (this._zoom > this._map._zoom) { //Zoom out, merge
this._animationStart();
this._animationZoomOut(this._zoom, this._map._zoom);
} else {
this._moveEnd();
}
},
//Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan)
_getExpandedVisibleBounds: function () {
if (!this.options.removeOutsideVisibleBounds) {
return this.getBounds();
}
var map = this._map,
bounds = map.getBounds(),
sw = bounds._southWest,
ne = bounds._northEast,
latDiff = L.Browser.mobile ? 0 : Math.abs(sw.lat - ne.lat),
lngDiff = L.Browser.mobile ? 0 : Math.abs(sw.lng - ne.lng);
return new L.LatLngBounds(
new L.LatLng(sw.lat - latDiff, sw.lng - lngDiff, true),
new L.LatLng(ne.lat + latDiff, ne.lng + lngDiff, true));
},
//Shared animation code
_animationAddLayerNonAnimated: function (layer, newCluster) {
if (newCluster === layer) {
this._featureGroup.addLayer(layer);
} else if (newCluster._childCount === 2) {
newCluster._addToMap();
var markers = newCluster.getAllChildMarkers();
this._featureGroup.removeLayer(markers[0]);
this._featureGroup.removeLayer(markers[1]);
} else {
newCluster._updateIcon();
}
}
});
L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
//Non Animated versions of everything
_animationStart: function () {
//Do nothing...
},
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
//We didn't actually animate, but we use this event to mean "clustering animations have finished"
this.fire('animationend');
},
_animationZoomOut: function (previousZoomLevel, newZoomLevel) {
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel);
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
//We didn't actually animate, but we use this event to mean "clustering animations have finished"
this.fire('animationend');
},
_animationAddLayer: function (layer, newCluster) {
this._animationAddLayerNonAnimated(layer, newCluster);
}
} : {
//Animated versions here
_animationStart: function () {
this._map._mapPane.className += ' leaflet-cluster-anim';
this._inZoomAnimation++;
},
_animationEnd: function () {
if (this._map) {
this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
}
this._inZoomAnimation--;
this.fire('animationend');
},
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds(),
fg = this._featureGroup,
i;
//Add all children of current clusters to map and remove those clusters from map
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
var startPos = c._latlng,
markers = c._markers,
m;
if (!bounds.contains(startPos)) {
startPos = null;
}
if (c._isSingleParent() && previousZoomLevel + 1 === newZoomLevel) { //Immediately add the new child and remove us
fg.removeLayer(c);
c._recursivelyAddChildrenToMap(null, newZoomLevel, bounds);
} else {
//Fade out old cluster
c.setOpacity(0);
c._recursivelyAddChildrenToMap(startPos, newZoomLevel, bounds);
}
//Remove all markers that aren't visible any more
//TODO: Do we actually need to do this on the higher levels too?
for (i = markers.length - 1; i >= 0; i--) {
m = markers[i];
if (!bounds.contains(m._latlng)) {
fg.removeLayer(m);
}
}
});
this._forceLayout();
//Update opacities
this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
//TODO Maybe? Update markers in _recursivelyBecomeVisible
fg.eachLayer(function (n) {
if (!(n instanceof L.MarkerCluster) && n._icon) {
n.setOpacity(1);
}
});
//update the positions of the just added clusters/markers
this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) {
c._recursivelyRestoreChildPositions(newZoomLevel);
});
//Remove the old clusters and close the zoom animation
this._enqueue(function () {
//update the positions of the just added clusters/markers
this._topClusterLevel._recursively(bounds, previousZoomLevel, 0, function (c) {
fg.removeLayer(c);
c.setOpacity(1);
});
this._animationEnd();
});
},
_animationZoomOut: function (previousZoomLevel, newZoomLevel) {
this._animationZoomOutSingle(this._topClusterLevel, previousZoomLevel - 1, newZoomLevel);
//Need to add markers for those that weren't on the map before but are now
this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds());
//Remove markers that were on the map before but won't be now
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel, this._getExpandedVisibleBounds());
},
_animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds();
//Animate all of the markers in the clusters to move to their cluster center point
cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, previousZoomLevel + 1, newZoomLevel);
var me = this;
//Update the opacity (If we immediately set it they won't animate)
this._forceLayout();
cluster._recursivelyBecomeVisible(bounds, newZoomLevel);
//TODO: Maybe use the transition timing stuff to make this more reliable
//When the animations are done, tidy up
this._enqueue(function () {
//This cluster stopped being a cluster before the timeout fired
if (cluster._childCount === 1) {
var m = cluster._markers[0];
//If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it
m.setLatLng(m.getLatLng());
if (m.setOpacity) {
m.setOpacity(1);
}
} else {
cluster._recursively(bounds, newZoomLevel, 0, function (c) {
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel + 1);
});
}
me._animationEnd();
});
},
_animationAddLayer: function (layer, newCluster) {
var me = this,
fg = this._featureGroup;
fg.addLayer(layer);
if (newCluster !== layer) {
if (newCluster._childCount > 2) { //Was already a cluster
newCluster._updateIcon();
this._forceLayout();
this._animationStart();
layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng()));
layer.setOpacity(0);
this._enqueue(function () {
fg.removeLayer(layer);
layer.setOpacity(1);
me._animationEnd();
});
} else { //Just became a cluster
this._forceLayout();
me._animationStart();
me._animationZoomOutSingle(newCluster, this._map.getMaxZoom(), this._map.getZoom());
}
}
},
//Force a browser layout of stuff in the map
// Should apply the current opacity and location to all elements so we can update them again for an animation
_forceLayout: function () {
//In my testing this works, infact offsetWidth of any element seems to work.
//Could loop all this._layers and do this for each _icon if it stops working
L.Util.falseFn(document.body.offsetWidth);
}
});
L.markerClusterGroup = function (options) {
return new L.MarkerClusterGroup(options);
};
L.MarkerCluster = L.Marker.extend({
initialize: function (group, zoom, a, b) {
L.Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new L.LatLng(0, 0), { icon: this });
this._group = group;
this._zoom = zoom;
this._markers = [];
this._childClusters = [];
this._childCount = 0;
this._iconNeedsUpdate = true;
this._bounds = new L.LatLngBounds();
if (a) {
this._addChild(a);
}
if (b) {
this._addChild(b);
}
},
//Recursively retrieve all child markers of this cluster
getAllChildMarkers: function (storageArray) {
storageArray = storageArray || [];
for (var i = this._childClusters.length - 1; i >= 0; i--) {
this._childClusters[i].getAllChildMarkers(storageArray);
}
for (var j = this._markers.length - 1; j >= 0; j--) {
storageArray.push(this._markers[j]);
}
return storageArray;
},
//Returns the count of how many child markers we have
getChildCount: function () {
return this._childCount;
},
//Zoom to the minimum of showing all of the child markers, or the extents of this cluster
zoomToBounds: function () {
var childClusters = this._childClusters.slice(),
map = this._group._map,
boundsZoom = map.getBoundsZoom(this._bounds),
zoom = this._zoom + 1,
mapZoom = map.getZoom(),
i;
//calculate how far we need to zoom down to see all of the markers
while (childClusters.length > 0 && boundsZoom > zoom) {
zoom++;
var newClusters = [];
for (i = 0; i < childClusters.length; i++) {
newClusters = newClusters.concat(childClusters[i]._childClusters);
}
childClusters = newClusters;
}
if (boundsZoom > zoom) {
this._group._map.setView(this._latlng, zoom);
} else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead
this._group._map.setView(this._latlng, mapZoom + 1);
} else {
this._group._map.fitBounds(this._bounds);
}
},
getBounds: function () {
var bounds = new L.LatLngBounds();
bounds.extend(this._bounds);
return bounds;
},
_updateIcon: function () {
this._iconNeedsUpdate = true;
if (this._icon) {
this.setIcon(this);
}
},
//Cludge for Icon, we pretend to be an icon for performance
createIcon: function () {
if (this._iconNeedsUpdate) {
this._iconObj = this._group.options.iconCreateFunction(this);
this._iconNeedsUpdate = false;
}
return this._iconObj.createIcon();
},
createShadow: function () {
return this._iconObj.createShadow();
},
_addChild: function (new1, isNotificationFromChild) {
this._iconNeedsUpdate = true;
this._expandBounds(new1);
if (new1 instanceof L.MarkerCluster) {
if (!isNotificationFromChild) {
this._childClusters.push(new1);
new1.__parent = this;
}
this._childCount += new1._childCount;
} else {
if (!isNotificationFromChild) {
this._markers.push(new1);
}
this._childCount++;
}
if (this.__parent) {
this.__parent._addChild(new1, true);
}
},
//Expand our bounds and tell our parent to
_expandBounds: function (marker) {
var addedCount,
addedLatLng = marker._wLatLng || marker._latlng;
if (marker instanceof L.MarkerCluster) {
this._bounds.extend(marker._bounds);
addedCount = marker._childCount;
} else {
this._bounds.extend(addedLatLng);
addedCount = 1;
}
if (!this._cLatLng) {
// when clustering, take position of the first point as the cluster center
this._cLatLng = marker._cLatLng || addedLatLng;
}
// when showing clusters, take weighted average of all points as cluster center
var totalCount = this._childCount + addedCount;
//Calculate weighted latlng for display
if (!this._wLatLng) {
this._latlng = this._wLatLng = new L.LatLng(addedLatLng.lat, addedLatLng.lng);
} else {
this._wLatLng.lat = (addedLatLng.lat * addedCount + this._wLatLng.lat * this._childCount) / totalCount;
this._wLatLng.lng = (addedLatLng.lng * addedCount + this._wLatLng.lng * this._childCount) / totalCount;
}
},
//Set our markers position as given and add it to the map
_addToMap: function (startPos) {
if (startPos) {
this._backupLatlng = this._latlng;
this.setLatLng(startPos);
}
this._group._featureGroup.addLayer(this);
},
_recursivelyAnimateChildrenIn: function (bounds, center, maxZoom) {
this._recursively(bounds, 0, maxZoom - 1,
function (c) {
var markers = c._markers,
i, m;
for (i = markers.length - 1; i >= 0; i--) {
m = markers[i];
//Only do it if the icon is still on the map
if (m._icon) {
m._setPos(center);
m.setOpacity(0);
}
}
},
function (c) {
var childClusters = c._childClusters,
j, cm;
for (j = childClusters.length - 1; j >= 0; j--) {
cm = childClusters[j];
if (cm._icon) {
cm._setPos(center);
cm.setOpacity(0);
}
}
}
);
},
_recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, previousZoomLevel, newZoomLevel) {
this._recursively(bounds, newZoomLevel, 0,
function (c) {
c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel);
//TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be.
//As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate
if (c._isSingleParent() && previousZoomLevel - 1 === newZoomLevel) {
c.setOpacity(1);
c._recursivelyRemoveChildrenFromMap(bounds, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
} else {
c.setOpacity(0);
}
c._addToMap();
}
);
},
_recursivelyBecomeVisible: function (bounds, zoomLevel) {
this._recursively(bounds, 0, zoomLevel, null, function (c) {
c.setOpacity(1);
});
},
_recursivelyAddChildrenToMap: function (startPos, zoomLevel, bounds) {
this._recursively(bounds, -1, zoomLevel,
function (c) {
if (zoomLevel === c._zoom) {
return;
}
//Add our child markers at startPos (so they can be animated out)
for (var i = c._markers.length - 1; i >= 0; i--) {
var nm = c._markers[i];
if (!bounds.contains(nm._latlng)) {
continue;
}
if (startPos) {
nm._backupLatlng = nm.getLatLng();
nm.setLatLng(startPos);
if (nm.setOpacity) {
nm.setOpacity(0);
}
}
c._group._featureGroup.addLayer(nm);
}
},
function (c) {
c._addToMap(startPos);
}
);
},
_recursivelyRestoreChildPositions: function (zoomLevel) {
//Fix positions of child markers
for (var i = this._markers.length - 1; i >= 0; i--) {
var nm = this._markers[i];
if (nm._backupLatlng) {
nm.setLatLng(nm._backupLatlng);
delete nm._backupLatlng;
}
}
if (zoomLevel - 1 === this._zoom) {
//Reposition child clusters
for (var j = this._childClusters.length - 1; j >= 0; j--) {
this._childClusters[j]._restorePosition();
}
} else {
for (var k = this._childClusters.length - 1; k >= 0; k--) {
this._childClusters[k]._recursivelyRestoreChildPositions(zoomLevel);
}
}
},
_restorePosition: function () {
if (this._backupLatlng) {
this.setLatLng(this._backupLatlng);
delete this._backupLatlng;
}
},
//exceptBounds: If set, don't remove any markers/clusters in it
_recursivelyRemoveChildrenFromMap: function (previousBounds, zoomLevel, exceptBounds) {
var m, i;
this._recursively(previousBounds, -1, zoomLevel - 1,
function (c) {
//Remove markers at every level
for (i = c._markers.length - 1; i >= 0; i--) {
m = c._markers[i];
if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
c._group._featureGroup.removeLayer(m);
if (m.setOpacity) {
m.setOpacity(1);
}
}
}
},
function (c) {
//Remove child clusters at just the bottom level
for (i = c._childClusters.length - 1; i >= 0; i--) {
m = c._childClusters[i];
if (!exceptBounds || !exceptBounds.contains(m._latlng)) {
c._group._featureGroup.removeLayer(m);
if (m.setOpacity) {
m.setOpacity(1);
}
}
}
}
);
},
//Run the given functions recursively to this and child clusters
// boundsToApplyTo: a L.LatLngBounds representing the bounds of what clusters to recurse in to
// zoomLevelToStart: zoom level to start running functions (inclusive)
// zoomLevelToStop: zoom level to stop running functions (inclusive)
// runAtEveryLevel: function that takes an L.MarkerCluster as an argument that should be applied on every level
// runAtBottomLevel: function that takes an L.MarkerCluster as an argument that should be applied at only the bottom level
_recursively: function (boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel) {
var childClusters = this._childClusters,
zoom = this._zoom,
i, c;
if (zoomLevelToStart > zoom) { //Still going down to required depth, just recurse to child clusters
for (i = childClusters.length - 1; i >= 0; i--) {
c = childClusters[i];
if (boundsToApplyTo.intersects(c._bounds)) {
c._recursively(boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel);
}
}
} else { //In required depth
if (runAtEveryLevel) {
runAtEveryLevel(this);
}
if (runAtBottomLevel && this._zoom === zoomLevelToStop) {
runAtBottomLevel(this);
}
//TODO: This loop is almost the same as above
if (zoomLevelToStop > zoom) {
for (i = childClusters.length - 1; i >= 0; i--) {
c = childClusters[i];
if (boundsToApplyTo.intersects(c._bounds)) {
c._recursively(boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel);
}
}
}
}
},
_recalculateBounds: function () {
var markers = this._markers,
childClusters = this._childClusters,
i;
this._bounds = new L.LatLngBounds();
delete this._wLatLng;
for (i = markers.length - 1; i >= 0; i--) {
this._expandBounds(markers[i]);
}
for (i = childClusters.length - 1; i >= 0; i--) {
this._expandBounds(childClusters[i]);
}
},
//Returns true if we are the parent of only one cluster and that cluster is the same as us
_isSingleParent: function () {
//Don't need to check this._markers as the rest won't work if there are any
return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount;
}
});
L.DistanceGrid = function (cellSize) {
this._cellSize = cellSize;
this._sqCellSize = cellSize * cellSize;
this._grid = {};
this._objectPoint = { };
};
L.DistanceGrid.prototype = {
addObject: function (obj, point) {
var x = this._getCoord(point.x),
y = this._getCoord(point.y),
grid = this._grid,
row = grid[y] = grid[y] || {},
cell = row[x] = row[x] || [],
stamp = L.Util.stamp(obj);
this._objectPoint[stamp] = point;
cell.push(obj);
},
updateObject: function (obj, point) {
this.removeObject(obj);
this.addObject(obj, point);
},
//Returns true if the object was found
removeObject: function (obj, point) {
var x = this._getCoord(point.x),
y = this._getCoord(point.y),
grid = this._grid,
row = grid[y] = grid[y] || {},
cell = row[x] = row[x] || [],
i, len;
delete this._objectPoint[L.Util.stamp(obj)];
for (i = 0, len = cell.length; i < len; i++) {
if (cell[i] === obj) {
cell.splice(i, 1);
if (len === 1) {
delete row[x];
}
return true;
}
}
},
eachObject: function (fn, context) {
var i, j, k, len, row, cell, removed,
grid = this._grid;
for (i in grid) {
row = grid[i];
for (j in row) {
cell = row[j];
for (k = 0, len = cell.length; k < len; k++) {
removed = fn.call(context, cell[k]);
if (removed) {
k--;
len--;
}
}
}
}
},
getNearObject: function (point) {
var x = this._getCoord(point.x),
y = this._getCoord(point.y),
i, j, k, row, cell, len, obj, dist,
objectPoint = this._objectPoint,
closestDistSq = this._sqCellSize,
closest = null;
for (i = y - 1; i <= y + 1; i++) {
row = this._grid[i];
if (row) {
for (j = x - 1; j <= x + 1; j++) {
cell = row[j];
if (cell) {
for (k = 0, len = cell.length; k < len; k++) {
obj = cell[k];
dist = this._sqDist(objectPoint[L.Util.stamp(obj)], point);
if (dist < closestDistSq) {
closestDistSq = dist;
closest = obj;
}
}
}
}
}
}
return closest;
},
_getCoord: function (x) {
return Math.floor(x / this._cellSize);
},
_sqDist: function (p, p2) {
var dx = p2.x - p.x,
dy = p2.y - p.y;
return dx * dx + dy * dy;
}
};
/* Copyright (c) 2012 the authors listed at the following URL, and/or
the authors of referenced articles or incorporated external code:
http://en.literateprograms.org/Quickhull_(Javascript)?action=history&offset=20120410175256
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=18434
*/
(function () {
L.QuickHull = {
/*
* @param {Object} cpt a point to be measured from the baseline
* @param {Array} bl the baseline, as represented by a two-element
* array of latlng objects.
* @returns {Number} an approximate distance measure
*/
getDistant: function (cpt, bl) {
var vY = bl[1].lat - bl[0].lat,
vX = bl[0].lng - bl[1].lng;
return (vX * (cpt.lat - bl[0].lat) + vY * (cpt.lng - bl[0].lng));
},
/*
* @param {Array} baseLine a two-element array of latlng objects
* representing the baseline to project from
* @param {Array} latLngs an array of latlng objects
* @returns {Object} the maximum point and all new points to stay
* in consideration for the hull.
*/
findMostDistantPointFromBaseLine: function (baseLine, latLngs) {
var maxD = 0,
maxPt = null,
newPoints = [],
i, pt, d;
for (i = latLngs.length - 1; i >= 0; i--) {
pt = latLngs[i];
d = this.getDistant(pt, baseLine);
if (d > 0) {
newPoints.push(pt);
} else {
continue;
}
if (d > maxD) {
maxD = d;
maxPt = pt;
}
}
return { maxPoint: maxPt, newPoints: newPoints };
},
/*
* Given a baseline, compute the convex hull of latLngs as an array
* of latLngs.
*
* @param {Array} latLngs
* @returns {Array}
*/
buildConvexHull: function (baseLine, latLngs) {
var convexHullBaseLines = [],
t = this.findMostDistantPointFromBaseLine(baseLine, latLngs);
if (t.maxPoint) { // if there is still a point "outside" the base line
convexHullBaseLines =
convexHullBaseLines.concat(
this.buildConvexHull([baseLine[0], t.maxPoint], t.newPoints)
);
convexHullBaseLines =
convexHullBaseLines.concat(
this.buildConvexHull([t.maxPoint, baseLine[1]], t.newPoints)
);
return convexHullBaseLines;
} else { // if there is no more point "outside" the base line, the current base line is part of the convex hull
return [baseLine[0]];
}
},
/*
* Given an array of latlngs, compute a convex hull as an array
* of latlngs
*
* @param {Array} latLngs
* @returns {Array}
*/
getConvexHull: function (latLngs) {
// find first baseline
var maxLat = false, minLat = false,
maxPt = null, minPt = null,
i;
for (i = latLngs.length - 1; i >= 0; i--) {
var pt = latLngs[i];
if (maxLat === false || pt.lat > maxLat) {
maxPt = pt;
maxLat = pt.lat;
}
if (minLat === false || pt.lat < minLat) {
minPt = pt;
minLat = pt.lat;
}
}
var ch = [].concat(this.buildConvexHull([minPt, maxPt], latLngs),
this.buildConvexHull([maxPt, minPt], latLngs));
return ch;
}
};
}());
L.MarkerCluster.include({
getConvexHull: function () {
var childMarkers = this.getAllChildMarkers(),
points = [],
p, i;
for (i = childMarkers.length - 1; i >= 0; i--) {
p = childMarkers[i].getLatLng();
points.push(p);
}
return L.QuickHull.getConvexHull(points);
}
});
//This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet
//Huge thanks to jawj for implementing it first to make my job easy :-)
L.MarkerCluster.include({
_2PI: Math.PI * 2,
_circleFootSeparation: 25, //related to circumference of circle
_circleStartAngle: Math.PI / 6,
_spiralFootSeparation: 28, //related to size of spiral (experiment!)
_spiralLengthStart: 11,
_spiralLengthFactor: 5,
_circleSpiralSwitchover: 9, //show spiral instead of circle from this marker count upwards.
// 0 -> always spiral; Infinity -> always circle
spiderfy: function () {
if (this._group._spiderfied === this || this._group._inZoomAnimation) {
return;
}
var childMarkers = this.getAllChildMarkers(),
group = this._group,
map = group._map,
center = map.latLngToLayerPoint(this._latlng),
positions;
this._group._unspiderfy();
this._group._spiderfied = this;
//TODO Maybe: childMarkers order by distance to center
if (childMarkers.length >= this._circleSpiralSwitchover) {
positions = this._generatePointsSpiral(childMarkers.length, center);
} else {
center.y += 10; //Otherwise circles look wrong
positions = this._generatePointsCircle(childMarkers.length, center);
}
this._animationSpiderfy(childMarkers, positions);
},
unspiderfy: function (zoomDetails) {
/// <param Name="zoomDetails">Argument from zoomanim if being called in a zoom animation or null otherwise</param>
if (this._group._inZoomAnimation) {
return;
}
this._animationUnspiderfy(zoomDetails);
this._group._spiderfied = null;
},
_generatePointsCircle: function (count, centerPt) {
var circumference = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + count),
legLength = circumference / this._2PI, //radius from circumference
angleStep = this._2PI / count,
res = [],
i, angle;
res.length = count;
for (i = count - 1; i >= 0; i--) {
angle = this._circleStartAngle + i * angleStep;
res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
}
return res;
},
_generatePointsSpiral: function (count, centerPt) {
var legLength = this._group.options.spiderfyDistanceMultiplier * this._spiralLengthStart,
separation = this._group.options.spiderfyDistanceMultiplier * this._spiralFootSeparation,
lengthFactor = this._group.options.spiderfyDistanceMultiplier * this._spiralLengthFactor,
angle = 0,
res = [],
i;
res.length = count;
for (i = count - 1; i >= 0; i--) {
angle += separation / legLength + i * 0.0005;
res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
legLength += this._2PI * lengthFactor / angle;
}
return res;
},
_noanimationUnspiderfy: function () {
var group = this._group,
map = group._map,
fg = group._featureGroup,
childMarkers = this.getAllChildMarkers(),
m, i;
this.setOpacity(1);
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
fg.removeLayer(m);
if (m._preSpiderfyLatlng) {
m.setLatLng(m._preSpiderfyLatlng);
delete m._preSpiderfyLatlng;
}
if (m.setZIndexOffset) {
m.setZIndexOffset(0);
}
if (m._spiderLeg) {
map.removeLayer(m._spiderLeg);
delete m._spiderLeg;
}
}
group._spiderfied = null;
}
});
L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
//Non Animated versions of everything
_animationSpiderfy: function (childMarkers, positions) {
var group = this._group,
map = group._map,
fg = group._featureGroup,
i, m, leg, newPos;
for (i = childMarkers.length - 1; i >= 0; i--) {
newPos = map.layerPointToLatLng(positions[i]);
m = childMarkers[i];
m._preSpiderfyLatlng = m._latlng;
m.setLatLng(newPos);
if (m.setZIndexOffset) {
m.setZIndexOffset(1000000); //Make these appear on top of EVERYTHING
}
fg.addLayer(m);
leg = new L.Polyline([this._latlng, newPos], { weight: 1.5, color: '#222' });
map.addLayer(leg);
m._spiderLeg = leg;
}
this.setOpacity(0.3);
group.fire('spiderfied');
},
_animationUnspiderfy: function () {
this._noanimationUnspiderfy();
}
} : {
//Animated versions here
SVG_ANIMATION: (function () {
return document.createElementNS('http://www.w3.org/2000/svg', 'animate').toString().indexOf('SVGAnimate') > -1;
}()),
_animationSpiderfy: function (childMarkers, positions) {
var me = this,
group = this._group,
map = group._map,
fg = group._featureGroup,
thisLayerPos = map.latLngToLayerPoint(this._latlng),
i, m, leg, newPos;
//Add markers to map hidden at our center point
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
//If it is a marker, add it now and we'll animate it out
if (m.setOpacity) {
m.setZIndexOffset(1000000); //Make these appear on top of EVERYTHING
m.setOpacity(0);
fg.addLayer(m);
m._setPos(thisLayerPos);
} else {
//Vectors just get immediately added
fg.addLayer(m);
}
}
group._forceLayout();
group._animationStart();
var initialLegOpacity = L.Path.SVG ? 0 : 0.3,
xmlns = L.Path.SVG_NS;
for (i = childMarkers.length - 1; i >= 0; i--) {
newPos = map.layerPointToLatLng(positions[i]);
m = childMarkers[i];
//Move marker to new position
m._preSpiderfyLatlng = m._latlng;
m.setLatLng(newPos);
if (m.setOpacity) {
m.setOpacity(1);
}
//Add Legs.
leg = new L.Polyline([me._latlng, newPos], { weight: 1.5, color: '#222', opacity: initialLegOpacity });
map.addLayer(leg);
m._spiderLeg = leg;
//Following animations don't work for canvas
if (!L.Path.SVG || !this.SVG_ANIMATION) {
continue;
}
//How this works:
//http://stackoverflow.com/questions/5924238/how-do-you-animate-an-svg-path-in-ios
//http://dev.opera.com/articles/view/advanced-svg-animation-techniques/
//Animate length
var length = leg._path.getTotalLength();
leg._path.setAttribute("stroke-dasharray", length + "," + length);
var anim = document.createElementNS(xmlns, "animate");
anim.setAttribute("attributeName", "stroke-dashoffset");
anim.setAttribute("begin", "indefinite");
anim.setAttribute("from", length);
anim.setAttribute("to", 0);
anim.setAttribute("dur", 0.25);
leg._path.appendChild(anim);
anim.beginElement();
//Animate opacity
anim = document.createElementNS(xmlns, "animate");
anim.setAttribute("attributeName", "stroke-opacity");
anim.setAttribute("attributeName", "stroke-opacity");
anim.setAttribute("begin", "indefinite");
anim.setAttribute("from", 0);
anim.setAttribute("to", 0.5);
anim.setAttribute("dur", 0.25);
leg._path.appendChild(anim);
anim.beginElement();
}
me.setOpacity(0.3);
//Set the opacity of the spiderLegs back to their correct value
// The animations above override this until they complete.
// If the initial opacity of the spiderlegs isn't 0 then they appear before the animation starts.
if (L.Path.SVG) {
this._group._forceLayout();
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i]._spiderLeg;
m.options.opacity = 0.5;
m._path.setAttribute('stroke-opacity', 0.5);
}
}
setTimeout(function () {
group._animationEnd();
group.fire('spiderfied');
}, 200);
},
_animationUnspiderfy: function (zoomDetails) {
var group = this._group,
map = group._map,
fg = group._featureGroup,
thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng),
childMarkers = this.getAllChildMarkers(),
svg = L.Path.SVG && this.SVG_ANIMATION,
m, i, a;
group._animationStart();
//Make us visible and bring the child markers back in
this.setOpacity(1);
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
//Marker was added to us after we were spidified
if (!m._preSpiderfyLatlng) {
continue;
}
//Fix up the location to the real one
m.setLatLng(m._preSpiderfyLatlng);
delete m._preSpiderfyLatlng;
//Hack override the location to be our center
if (m.setOpacity) {
m._setPos(thisLayerPos);
m.setOpacity(0);
} else {
fg.removeLayer(m);
}
//Animate the spider legs back in
if (svg) {
a = m._spiderLeg._path.childNodes[0];
a.setAttribute('to', a.getAttribute('from'));
a.setAttribute('from', 0);
a.beginElement();
a = m._spiderLeg._path.childNodes[1];
a.setAttribute('from', 0.5);
a.setAttribute('to', 0);
a.setAttribute('stroke-opacity', 0);
a.beginElement();
m._spiderLeg._path.setAttribute('stroke-opacity', 0);
}
}
setTimeout(function () {
//If we have only <= one child left then that marker will be shown on the map so don't remove it!
var stillThereChildCount = 0;
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
if (m._spiderLeg) {
stillThereChildCount++;
}
}
for (i = childMarkers.length - 1; i >= 0; i--) {
m = childMarkers[i];
if (!m._spiderLeg) { //Has already been unspiderfied
continue;
}
if (m.setOpacity) {
m.setOpacity(1);
m.setZIndexOffset(0);
}
if (stillThereChildCount > 1) {
fg.removeLayer(m);
}
map.removeLayer(m._spiderLeg);
delete m._spiderLeg;
}
group._animationEnd();
}, 200);
}
});
L.MarkerClusterGroup.include({
//The MarkerCluster currently spiderfied (if any)
_spiderfied: null,
_spiderfierOnAdd: function () {
this._map.on('click', this._unspiderfyWrapper, this);
if (this._map.options.zoomAnimation) {
this._map.on('zoomstart', this._unspiderfyZoomStart, this);
}
//Browsers without zoomAnimation or a big zoom don't fire zoomstart
this._map.on('zoomend', this._noanimationUnspiderfy, this);
if (L.Path.SVG && !L.Browser.touch) {
this._map._initPathRoot();
//Needs to happen in the pageload, not after, or animations don't work in webkit
// http://stackoverflow.com/questions/8455200/svg-animate-with-dynamically-added-elements
//Disable on touch browsers as the animation messes up on a touch zoom and isn't very noticable
}
},
_spiderfierOnRemove: function () {
this._map.off('click', this._unspiderfyWrapper, this);
this._map.off('zoomstart', this._unspiderfyZoomStart, this);
this._map.off('zoomanim', this._unspiderfyZoomAnim, this);
this._unspiderfy(); //Ensure that markers are back where they should be
},
//On zoom start we add a zoomanim handler so that we are guaranteed to be last (after markers are animated)
//This means we can define the animation they do rather than Markers doing an animation to their actual location
_unspiderfyZoomStart: function () {
if (!this._map) { //May have been removed from the map by a zoomEnd handler
return;
}
this._map.on('zoomanim', this._unspiderfyZoomAnim, this);
},
_unspiderfyZoomAnim: function (zoomDetails) {
//Wait until the first zoomanim after the user has finished touch-zooming before running the animation
if (L.DomUtil.hasClass(this._map._mapPane, 'leaflet-touching')) {
return;
}
this._map.off('zoomanim', this._unspiderfyZoomAnim, this);
this._unspiderfy(zoomDetails);
},
_unspiderfyWrapper: function () {
/// <summary>_unspiderfy but passes no arguments</summary>
this._unspiderfy();
},
_unspiderfy: function (zoomDetails) {
if (this._spiderfied) {
this._spiderfied.unspiderfy(zoomDetails);
}
},
_noanimationUnspiderfy: function () {
if (this._spiderfied) {
this._spiderfied._noanimationUnspiderfy();
}
},
//If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc
_unspiderfyLayer: function (layer) {
if (layer._spiderLeg) {
this._featureGroup.removeLayer(layer);
layer.setOpacity(1);
//Position will be fixed up immediately in _animationUnspiderfy
layer.setZIndexOffset(0);
this._map.removeLayer(layer._spiderLeg);
delete layer._spiderLeg;
}
}
});
}(window, document));
| {
"content_hash": "ba69a451019b980409b7421fea894c72",
"timestamp": "",
"source": "github",
"line_count": 2163,
"max_line_length": 164,
"avg_line_length": 30.12528895053167,
"alnum_prop": 0.6153987814797195,
"repo_name": "johan--/polarmap.js",
"id": "075c4f557e3c80cb0658ade5a76ed2a8fc782684",
"size": "65161",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "js/leaflet.markercluster.js",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "12967"
},
{
"name": "HTML",
"bytes": "1560"
},
{
"name": "JavaScript",
"bytes": "932602"
}
],
"symlink_target": ""
} |
@interface PaginationAPI : GetAPI
@property (nonatomic, readonly) NSUInteger page;
@property (nonatomic) NSUInteger objectsPerPage;
@property (nonatomic, readonly) BOOL isFirstPage, isLastPage;
// Requests next page of objects
- (void)requestNextPage;
// Resets API to first page and requests next page
- (void)requestFromFirstPage;
// Resets API to first page
- (void)resetToFirstPage;
@end
| {
"content_hash": "e5b3752455f0a193748132bc64752d99",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 61,
"avg_line_length": 23.41176470588235,
"alnum_prop": 0.7738693467336684,
"repo_name": "alkozin/iOS-API-Wrapper",
"id": "6ce43deec3842b3cb59062cf813b57e502635f29",
"size": "500",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AF Wrapper/Library/Helpers/API/Base/PaginationAPI.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "550"
},
{
"name": "Objective-C",
"bytes": "85394"
},
{
"name": "Ruby",
"bytes": "54"
}
],
"symlink_target": ""
} |
package freemarker.ext.beans;
import freemarker.template.Configuration;
public class DefaultObjectWrapperInc2003021 extends DefaultObjectWrapperWithSortedMethods {
public DefaultObjectWrapperInc2003021() {
super(Configuration.VERSION_2_3_21, false);
}
}
| {
"content_hash": "522f16cb00b84eae58d87d8cd6d2d7dc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 91,
"avg_line_length": 21.23076923076923,
"alnum_prop": 0.7862318840579711,
"repo_name": "vicre/dsl-appliance",
"id": "f3811a93ffe84c8aa1e0fa6669bdcd7be0524168",
"size": "905",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "appliance/com.datascilab.core.codeGenerator/src/test/java/freemarker/ext/beans/DefaultObjectWrapperInc2003021.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "16945"
},
{
"name": "FreeMarker",
"bytes": "214698"
},
{
"name": "HTML",
"bytes": "10289528"
},
{
"name": "Java",
"bytes": "2970162"
},
{
"name": "JavaScript",
"bytes": "2063"
}
],
"symlink_target": ""
} |
<html>
<head>
<title></title>
<script type="text/javascript">
function convertCrLf(str) {
return "'" + str.replace(/\r/g, "\\r").replace(/\n/g, "\\n") + "'";
}
window.onload = function() {
var pre1 = document.getElementById("pre1");
var pre2 = document.getElementById("pre2");
var pre3 = document.getElementById("pre3");
alert(convertCrLf(pre1.firstChild.data) + "\n" + convertCrLf(pre2.childNodes[1].data) + "\n" + convertCrLf(pre3.childNodes[1].data));
alert(convertCrLf(pre1.firstChild.nodeValue) + "\n" + convertCrLf(pre2.childNodes[1].nodeValue) + "\n" + convertCrLf(pre3.childNodes[1].nodeValue));
var range = document.body.createTextRange();
range.moveToElementText(pre1);
alert(convertCrLf(range.text));
alert(convertCrLf(range.htmlText));
};
</script>
</head>
<body>
<pre id="pre1">
One
</pre>
<pre id="pre2"><script type="text/javascript">document.write("\n\nTwo\n\n")</script></pre>
<pre id="pre3"><script type="text/javascript">document.write("\r\rThree\r\r")</script></pre>
</body>
</html> | {
"content_hash": "bdbc8f0e25bc0355a24d07b68cd9eddc",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 160,
"avg_line_length": 33.857142857142854,
"alnum_prop": 0.5881856540084388,
"repo_name": "GerHobbelt/Rangy",
"id": "3cc9285cceb28b974d15c4b5046f94e0f88ebec7",
"size": "1185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/ietextnodes.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17380"
},
{
"name": "HTML",
"bytes": "204228"
},
{
"name": "JavaScript",
"bytes": "2122205"
}
],
"symlink_target": ""
} |
int unify(Terms &, Terms &, Substitutions &);
int unify(Literal &, Literal &, Substitutions &);
// unify lists of literals
int unify(List<Literal> &, Substitutions &);
#endif
| {
"content_hash": "d1de09bbfc5055ab6499b51a47725d07",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 49,
"avg_line_length": 25.285714285714285,
"alnum_prop": 0.6949152542372882,
"repo_name": "ombt/ombt",
"id": "3a3a92b64a465e0c4abc0172aa3ae72a45c026bd",
"size": "463",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/ai/atp/atp.prototype/pr/unification.h",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "AngelScript",
"bytes": "387"
},
{
"name": "Assembly",
"bytes": "337961"
},
{
"name": "Awk",
"bytes": "19196"
},
{
"name": "Batchfile",
"bytes": "1455"
},
{
"name": "C",
"bytes": "18492457"
},
{
"name": "C#",
"bytes": "7338"
},
{
"name": "C++",
"bytes": "11440913"
},
{
"name": "CSS",
"bytes": "28033"
},
{
"name": "Fortran",
"bytes": "103924"
},
{
"name": "GLSL",
"bytes": "4629"
},
{
"name": "HTML",
"bytes": "116310"
},
{
"name": "Harbour",
"bytes": "12291"
},
{
"name": "Java",
"bytes": "477588"
},
{
"name": "JavaScript",
"bytes": "26054"
},
{
"name": "Lex",
"bytes": "137956"
},
{
"name": "Makefile",
"bytes": "951705"
},
{
"name": "PHP",
"bytes": "16"
},
{
"name": "Perl",
"bytes": "5625197"
},
{
"name": "Python",
"bytes": "10696"
},
{
"name": "QMake",
"bytes": "2403"
},
{
"name": "R",
"bytes": "220944"
},
{
"name": "Raku",
"bytes": "191928"
},
{
"name": "Roff",
"bytes": "819974"
},
{
"name": "SWIG",
"bytes": "504140"
},
{
"name": "Scilab",
"bytes": "25999"
},
{
"name": "Shell",
"bytes": "1584381"
},
{
"name": "SourcePawn",
"bytes": "374363"
},
{
"name": "TSQL",
"bytes": "53230"
},
{
"name": "Tcl",
"bytes": "1475389"
},
{
"name": "VBA",
"bytes": "194"
},
{
"name": "XS",
"bytes": "10959"
},
{
"name": "Yacc",
"bytes": "1012991"
}
],
"symlink_target": ""
} |
@import url(http://fonts.googleapis.com/css?family=Raleway:400,700);
@font-face {
font-weight: normal;
font-style: normal;
font-family: 'codropsicons';
src:url('../fonts/codropsicons/codropsicons.eot');
src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'),
url('../fonts/codropsicons/codropsicons.woff') format('woff'),
url('../fonts/codropsicons/codropsicons.ttf') format('truetype'),
url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');
}
*, *:after, *:before { -webkit-box-sizing: border-box; box-sizing: border-box; }
.clearfix:before, .clearfix:after { content: ''; display: table; }
.clearfix:after { clear: both; }
html, body, .container {
height: 100%;
}
body {
background: #3b3f45;
color: #fff;
font-weight: 400;
font-size: 1em;
font-family: 'Raleway', Arial, sans-serif;
overflow: hidden;
overflow-y: scroll;
min-height: 590px;
}
a {
color: rgba(0,0,0,0.3);
text-decoration: none;
outline: none;
}
a:hover, a:focus {
color: #fff;
}
/* Top Navigation Style */
.codrops-top {
margin-top: 1em;
}
.codrops-top a {
font-size: 0.69em;
padding: 0 0.25em;
display: inline-block;
text-decoration: none;
font-size: 1.2em;
}
.codrops-icon:before {
margin: 0 4px;
text-transform: none;
font-weight: normal;
font-style: normal;
font-variant: normal;
font-family: 'codropsicons';
line-height: 1;
speak: none;
-webkit-font-smoothing: antialiased;
}
.codrops-icon-drop:before {
content: "\e001";
}
.codrops-icon-prev:before {
content: "\e004";
}
.codrops-icon-info:before {
content: "\e003";
}
.codrops-icon span {
display: none;
position: absolute;
font-size: 0.85em;
padding: 0.5em 0 0 0.25em;
font-weight: 700;
}
.codrops-icon:hover span {
display: block;
color: #6a7b7e;
}
/* Related demos */
.related {
font-weight: 700;
text-align: center;
padding: 5em 0;
display: none;
background: #fff;
color: rgba(0,0,0,0.3);
}
.overview .related {
display: block;
}
.related > a {
border: 3px solid black;
border-color: initial;
display: inline-block;
text-align: center;
margin: 20px 10px;
padding: 25px;
}
.related > a:hover,
.related > a:focus {
color: rgba(0,0,0,0.5);
}
.related a img {
max-width: 100%;
opacity: 0.8;
}
.related a:hover img,
.related a:active img {
opacity: 1;
}
.related a h3 {
margin: 0;
padding: 0.5em 0 0.3em;
max-width: 300px;
text-align: left;
} | {
"content_hash": "ac0e3c07edd1dc071c7fac90e2bb83b3",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 86,
"avg_line_length": 17.807407407407407,
"alnum_prop": 0.6722129783693843,
"repo_name": "Seba7159/myHaum",
"id": "4922d8eab30030dca51952058ae7b27ea0b60dc1",
"size": "2404",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "web/form/css/demo.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Arduino",
"bytes": "18615"
},
{
"name": "CSS",
"bytes": "85010"
},
{
"name": "HTML",
"bytes": "45242"
},
{
"name": "JavaScript",
"bytes": "58049"
},
{
"name": "PHP",
"bytes": "115485"
}
],
"symlink_target": ""
} |
Parâmetros de entrada:
- value
Valor de saída:
- Boolean
Definição:
A função só deve retornar `true` caso o valor passado seja diferente de `undefined` ou `null`
Função:
```js
'use strict';
module.exports = (value) => {
if (value === null || value === undefined) return false;
return true;
};
```
Uso:
Algoritmo:
Primeiramente iniciamos criando a função retornando `true`:
```js
'use strict';
module.exports = (value) => {
return true;
};
```
Ok! Agora precisamos definir quais são as regras para que essa função não retorne `true`, ou seja, caso o valor seja vazio não podemos retornar `true`, mas sim `false`.
```js
'use strict';
module.exports = (value) => {
if (value === null || value === undefined) return false;
return true;
};
```
| {
"content_hash": "de52f433450a2064a6b79bd168c1f526",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 168,
"avg_line_length": 15.653061224489797,
"alnum_prop": 0.6649282920469362,
"repo_name": "Webschool-io/Node-Atomic-Design_QUARKS",
"id": "8b6cb72dc089ce278795ddeca54a1ee97f916ce0",
"size": "795",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "testes/notEmptyBoson/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "48488"
}
],
"symlink_target": ""
} |
package com.sketchpunk.shared;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public abstract class ViewBindHolder extends RecyclerView.ViewHolder{
public ViewBindHolder(View itemView){ super(itemView); }
public abstract void bindData(int pos);
}//func
| {
"content_hash": "8e650e2be492053c781a5cb9251a31f2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 69,
"avg_line_length": 31.444444444444443,
"alnum_prop": 0.8127208480565371,
"repo_name": "sketchpunk/android3dblendermouse",
"id": "18b7eddd0e6244831b8da1ebd6d02ba453ab5fcc",
"size": "283",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/sketchpunk/shared/ViewBindHolder.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "57521"
},
{
"name": "Python",
"bytes": "280100"
}
],
"symlink_target": ""
} |
double carg(double complex z)
{
return atan2(cimag(z), creal(z));
}
| {
"content_hash": "e318704869af4b7eee75b165a6107b2f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 34,
"avg_line_length": 17.25,
"alnum_prop": 0.6811594202898551,
"repo_name": "tenpoku1000/UEFI_Ver_CPUID",
"id": "d2d1b4623a7fc77b2d413c363fd2ccef8d892939",
"size": "88",
"binary": false,
"copies": "32",
"ref": "refs/heads/master",
"path": "src/lib/external/MIT/musl/src/complex/carg.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "13584"
}
],
"symlink_target": ""
} |
* <img src='https://avatars1.githubusercontent.com/u/5435782?v=3&s=40' height='20' width='20'>[
Ramotion
/
navigation-stack
](https://github.com/Ramotion/navigation-stack):
NavigationStack is a stack-modeled navigation controller
* <img src='https://avatars0.githubusercontent.com/u/41431?v=3&s=40' height='20' width='20'>[
storehouse
/
Advance
](https://github.com/storehouse/Advance):
A powerful animation framework for iOS and OS X.
* <img src='https://avatars0.githubusercontent.com/u/570797?v=3&s=40' height='20' width='20'>[
andreamazz
/
SubtleVolume
](https://github.com/andreamazz/SubtleVolume):
Replace the system volume popup with a more subtle indicator.
* <img src='https://avatars2.githubusercontent.com/u/698982?v=3&s=40' height='20' width='20'>[
allenwong
/
30DaysofSwift
](https://github.com/allenwong/30DaysofSwift):
A self-taught project to learn Swift.
* <img src='https://avatars0.githubusercontent.com/u/2891970?v=3&s=40' height='20' width='20'>[
delba
/
Log
](https://github.com/delba/Log):
A Swift logger with customizable themes and formatters
* <img src='https://avatars0.githubusercontent.com/u/1812953?v=3&s=40' height='20' width='20'>[
s4cha
/
Stevia
](https://github.com/s4cha/Stevia):
Elegant view layout for iOS
* <img src='https://avatars0.githubusercontent.com/u/346853?v=3&s=40' height='20' width='20'>[
hollance
/
swift-algorithm-club
](https://github.com/hollance/swift-algorithm-club):
Algorithms and data structures in Swift, with explanations!
* <img src='https://avatars2.githubusercontent.com/u/6511079?v=3&s=40' height='20' width='20'>[
vsouza
/
awesome-ios
](https://github.com/vsouza/awesome-ios):
A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects
* <img src='https://avatars3.githubusercontent.com/u/335174?v=3&s=40' height='20' width='20'>[
Ramotion
/
reel-search
](https://github.com/Ramotion/reel-search):
RAMReel is a controller that allows you to choose options from a list
* <img src='https://avatars3.githubusercontent.com/u/1755579?v=3&s=40' height='20' width='20'>[
PerfectlySoft
/
Perfect
](https://github.com/PerfectlySoft/Perfect):
Server-side Swift. The Perfect library, application server, connectors and example apps. (For mobile back-end development, website and web app development, and more...)
* <img src='https://avatars1.githubusercontent.com/u/366926?v=3&s=40' height='20' width='20'>[
danielgindi
/
ios-charts
](https://github.com/danielgindi/ios-charts):
An iOS port of the beautiful MPAndroidChart. - Beautiful charts for iOS apps!
* <img src='https://avatars2.githubusercontent.com/u/1463444?v=3&s=40' height='20' width='20'>[
crossroadlabs
/
Express
](https://github.com/crossroadlabs/Express):
Swift Express is a simple, yet unopinionated web application server written in Swift
* <img src='https://avatars1.githubusercontent.com/u/1205894?v=3&s=40' height='20' width='20'>[
CosmicMind
/
Material
](https://github.com/CosmicMind/Material):
Express your creativity with Material, an animation and graphics framework for Google's Material Design and Apple's Flat UI in Swift.
* <img src='https://avatars1.githubusercontent.com/u/169110?v=3&s=40' height='20' width='20'>[
Alamofire
/
Alamofire
](https://github.com/Alamofire/Alamofire):
Elegant HTTP Networking in Swift
* <img src='https://avatars2.githubusercontent.com/u/1342803?v=3&s=40' height='20' width='20'>[
qutheory
/
vapor
](https://github.com/qutheory/vapor):
Elegant web framework for Swift that works on iOS, OS X, and Ubuntu.
* <img src='https://avatars0.githubusercontent.com/u/435208?v=3&s=40' height='20' width='20'>[
CatchChat
/
Yep
](https://github.com/CatchChat/Yep):
Meet Genius
* <img src='https://avatars2.githubusercontent.com/u/11816788?v=3&s=40' height='20' width='20'>[
eonist
/
swift-utils
](https://github.com/eonist/swift-utils):
Generic swift utilities
* <img src='https://avatars1.githubusercontent.com/u/58962?v=3&s=40' height='20' width='20'>[
apple
/
swift-package-manager
](https://github.com/apple/swift-package-manager):
The Package Manager for the Swift Programming Language
* <img src='https://avatars2.githubusercontent.com/u/573856?v=3&s=40' height='20' width='20'>[
JakeLin
/
IBAnimatable
](https://github.com/JakeLin/IBAnimatable):
Design and prototype UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.
* <img src='https://avatars2.githubusercontent.com/u/4723115?v=3&s=40' height='20' width='20'>[
matteocrippa
/
awesome-swift
](https://github.com/matteocrippa/awesome-swift):
A collaborative list of awesome swift resources. Feel free to contribute!
* <img src='https://avatars0.githubusercontent.com/u/373016?v=3&s=40' height='20' width='20'>[
ipader
/
SwiftGuide
](https://github.com/ipader/SwiftGuide):
这份指南汇集了Swift语言主流学习资源,并以开发者的视角整理编排。http://dev.swiftguide.cn
* <img src='https://avatars1.githubusercontent.com/u/5435782?v=3&s=40' height='20' width='20'>[
Ramotion
/
animated-tab-bar
](https://github.com/Ramotion/animated-tab-bar):
RAMAnimatedTabBarController is a Swift module for adding animation to tabbar items.
* <img src='https://avatars0.githubusercontent.com/u/3382607?v=3&s=40' height='20' width='20'>[
macoscope
/
GrandCentralBoard
](https://github.com/macoscope/GrandCentralBoard):
Hang a TV in your open space or team room to show everyone what's up and get them up to speed.
* <img src='https://avatars1.githubusercontent.com/u/2245840?v=3&s=40' height='20' width='20'>[
hilen
/
TSWeChat
](https://github.com/hilen/TSWeChat):
A WeChat alternative. Written in Swift.
* <img src='https://avatars1.githubusercontent.com/u/22857?v=3&s=40' height='20' width='20'>[
dealforest
/
Cichlid
](https://github.com/dealforest/Cichlid):
automatically delete the current project's DerivedData directories
#### objective-c
* <img src='https://avatars1.githubusercontent.com/u/1786033?v=3&s=40' height='20' width='20'>[
johnno1962
/
injectionforxcode
](https://github.com/johnno1962/injectionforxcode):
Runtime Code Injection for Objective-C & Swift
* <img src='https://avatars2.githubusercontent.com/u/9247748?v=3&s=40' height='20' width='20'>[
lfb-cd
/
UDPTrans-OC
](https://github.com/lfb-cd/UDPTrans-OC):
基于UDP协议的数据传输 OC版本
* <img src='https://avatars1.githubusercontent.com/u/10378703?v=3&s=40' height='20' width='20'>[
raozhizhen
/
JMRoundedCorner
](https://github.com/raozhizhen/JMRoundedCorner):
UIView settings without triggering off-screen rendering fillet /UIView设置不触发离屏渲染的圆角
* <img src='https://avatars3.githubusercontent.com/u/7659?v=3&s=40' height='20' width='20'>[
AFNetworking
/
AFNetworking
](https://github.com/AFNetworking/AFNetworking):
A delightful networking framework for iOS, OS X, watchOS, and tvOS.
* <img src='https://avatars2.githubusercontent.com/u/10377362?v=3&s=40' height='20' width='20'>[
renzifeng
/
ZFPlayer
](https://github.com/renzifeng/ZFPlayer):
基于AVPlayer,支持横屏、竖屏(全屏播放还可锁定屏幕方向),上下滑动调节音量、屏幕亮度,左右滑动调节播放进度
* <img src='https://avatars2.githubusercontent.com/u/1275640?v=3&s=40' height='20' width='20'>[
syedhali
/
EZAudio
](https://github.com/syedhali/EZAudio):
An iOS and OSX audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
* <img src='https://avatars2.githubusercontent.com/u/10412193?v=3&s=40' height='20' width='20'>[
gsdios
/
GSD_WeiXin
](https://github.com/gsdios/GSD_WeiXin):
高仿微信
* <img src='https://avatars1.githubusercontent.com/u/839283?v=3&s=40' height='20' width='20'>[
ibireme
/
YYKit
](https://github.com/ibireme/YYKit):
A collection of iOS components.
* <img src='https://avatars1.githubusercontent.com/u/474794?v=3&s=40' height='20' width='20'>[
realm
/
realm-cocoa
](https://github.com/realm/realm-cocoa):
Realm is a mobile database: a replacement for Core Data & SQLite
* <img src='https://avatars2.githubusercontent.com/u/68232?v=3&s=40' height='20' width='20'>[
rs
/
SDWebImage
](https://github.com/rs/SDWebImage):
Asynchronous image downloader with cache support as a UIImageView category
* <img src='https://avatars1.githubusercontent.com/u/2301114?v=3&s=40' height='20' width='20'>[
jessesquires
/
JSQMessagesViewController
](https://github.com/jessesquires/JSQMessagesViewController):
An elegant messages UI library for iOS
* <img src='https://avatars1.githubusercontent.com/u/101659?v=3&s=40' height='20' width='20'>[
matryer
/
bitbar
](https://github.com/matryer/bitbar):
Put the output from any script or program in your Mac OS X Menu Bar
* <img src='https://avatars1.githubusercontent.com/u/432536?v=3&s=40' height='20' width='20'>[
Mantle
/
Mantle
](https://github.com/Mantle/Mantle):
Model framework for Cocoa and Cocoa Touch
* <img src='https://avatars1.githubusercontent.com/u/5310542?v=3&s=40' height='20' width='20'>[
Aufree
/
trip-to-iOS
](https://github.com/Aufree/trip-to-iOS):
A curated list of delightful iOS resources.
* <img src='https://avatars0.githubusercontent.com/u/3817366?v=3&s=40' height='20' width='20'>[
CoderMJLee
/
MJRefresh
](https://github.com/CoderMJLee/MJRefresh):
An easy way to use pull-to-refresh.
* <img src='https://avatars0.githubusercontent.com/u/444217?v=3&s=40' height='20' width='20'>[
wikimedia
/
wikipedia-ios
](https://github.com/wikimedia/wikipedia-ios):
The official Wikipedia iOS app.
* <img src='https://avatars1.githubusercontent.com/u/304604?v=3&s=40' height='20' width='20'>[
robbiehanson
/
CocoaAsyncSocket
](https://github.com/robbiehanson/CocoaAsyncSocket):
Asynchronous socket networking library for Mac and iOS
* <img src='https://avatars0.githubusercontent.com/u/3817366?v=3&s=40' height='20' width='20'>[
CoderMJLee
/
MJExtension
](https://github.com/CoderMJLee/MJExtension):
A fast, convenient and nonintrusive conversion between JSON and model. Your model class don't need to extend another base class. You don't need to modify any model file.
* <img src='https://avatars3.githubusercontent.com/u/28012?v=3&s=40' height='20' width='20'>[
eczarny
/
spectacle
](https://github.com/eczarny/spectacle):
Spectacle allows you to organize your windows without using a mouse.
* <img src='https://avatars2.githubusercontent.com/u/627915?v=3&s=40' height='20' width='20'>[
git-up
/
GitUp
](https://github.com/git-up/GitUp):
The Git interface you've been missing all your life has finally arrived.
* <img src='https://avatars2.githubusercontent.com/u/10412193?v=3&s=40' height='20' width='20'>[
gsdios
/
SDAutoLayout
](https://github.com/gsdios/SDAutoLayout):
One line of code to implement automatic layout. 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于做最简单易用的AutoLayout库。The most easy way for autoLayout. Based Runtime.Auto Layout .
* <img src='https://avatars2.githubusercontent.com/u/10412193?v=3&s=40' height='20' width='20'>[
gsdios
/
SDCycleScrollView
](https://github.com/gsdios/SDCycleScrollView):
Autoscroll Banner. “iOS第一图片轮播器” 无限循环图片轮播器。
* <img src='https://avatars1.githubusercontent.com/u/14878214?v=3&s=40' height='20' width='20'>[
google
/
EarlGrey
](https://github.com/google/EarlGrey):
iOS UI Automation Test Framework
* <img src='https://avatars1.githubusercontent.com/u/606991?v=3&s=40' height='20' width='20'>[
ParsePlatform
/
Parse-SDK-iOS-OSX
](https://github.com/ParsePlatform/Parse-SDK-iOS-OSX):
Parse SDK for iOS/OS X/watchOS/tvOS
* <img src='https://avatars2.githubusercontent.com/u/590579?v=3&s=40' height='20' width='20'>[
dzenbot
/
DZNEmptyDataSet
](https://github.com/dzenbot/DZNEmptyDataSet):
A drop-in UITableView/UICollectionView superclass category for showing empty datasets whenever the view has no content to display.
#### go
* <img src='https://avatars1.githubusercontent.com/u/992248?v=3&s=40' height='20' width='20'>[
zachlatta
/
sshtron
](https://github.com/zachlatta/sshtron):
Play Tron over SSH
* <img src='https://avatars1.githubusercontent.com/u/5000654?v=3&s=40' height='20' width='20'>[
getlantern
/
lantern
](https://github.com/getlantern/lantern):
Open Internet for everyone. Lantern is a free desktop application that delivers fast, reliable and secure access to the open Internet for users in censored regions. It uses a variety of techniques to stay unblocked, including P2P and domain fronting. Lantern relies on users in uncensored regions acting as access points to the open Internet.
* <img src='https://avatars3.githubusercontent.com/u/31996?v=3&s=40' height='20' width='20'>[
avelino
/
awesome-go
](https://github.com/avelino/awesome-go):
A curated list of awesome Go frameworks, libraries and software
* <img src='https://avatars3.githubusercontent.com/u/104030?v=3&s=40' height='20' width='20'>[
golang
/
go
](https://github.com/golang/go):
The Go programming language
* <img src='https://avatars1.githubusercontent.com/u/749551?v=3&s=40' height='20' width='20'>[
docker
/
docker
](https://github.com/docker/docker):
Docker - the open-source application container engine
* <img src='https://avatars0.githubusercontent.com/u/210141?v=3&s=40' height='20' width='20'>[
uber-common
/
cpustat
](https://github.com/uber-common/cpustat):
high frequency performance measurements for Linux
* <img src='https://avatars0.githubusercontent.com/u/1128849?v=3&s=40' height='20' width='20'>[
mholt
/
caddy
](https://github.com/mholt/caddy):
Fast, cross-platform HTTP/2 web server with automatic HTTPS
* <img src='https://avatars0.githubusercontent.com/u/139342?v=3&s=40' height='20' width='20'>[
pressly
/
sup
](https://github.com/pressly/sup):
Super simple deployment tool - just Unix - think of it like 'make' for a network of servers
* <img src='https://avatars2.githubusercontent.com/u/628322?v=3&s=40' height='20' width='20'>[
alioygur
/
godash
](https://github.com/alioygur/godash):
A utility library in Go inspired by lodash
* <img src='https://avatars3.githubusercontent.com/u/13653959?v=3&s=40' height='20' width='20'>[
kubernetes
/
kubernetes
](https://github.com/kubernetes/kubernetes):
Container Cluster Manager from Google
* <img src='https://avatars1.githubusercontent.com/u/137756?v=3&s=40' height='20' width='20'>[
sideshow
/
apns2
](https://github.com/sideshow/apns2):
⚡HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, and OSX apps, using the new APNs HTTP/2 protocol.
* <img src='https://avatars0.githubusercontent.com/u/2946214?v=3&s=40' height='20' width='20'>[
gogits
/
gogs
](https://github.com/gogits/gogs):
Gogs (Go Git Service) is a painless self-hosted Git service.
* <img src='https://avatars3.githubusercontent.com/u/622699?v=3&s=40' height='20' width='20'>[
minio
/
minio
](https://github.com/minio/minio):
Minio is an object storage server compatible with Amazon S3 and licensed under Apache 2.0 License
* <img src='https://avatars2.githubusercontent.com/u/4014393?v=3&s=40' height='20' width='20'>[
redspread
/
spread
](https://github.com/redspread/spread):
Docker to production in one command
* <img src='https://avatars3.githubusercontent.com/u/394382?v=3&s=40' height='20' width='20'>[
spf13
/
hugo
](https://github.com/spf13/hugo):
A Fast and Flexible Static Site Generator built with love in GoLang
* <img src='https://avatars2.githubusercontent.com/u/114509?v=3&s=40' height='20' width='20'>[
go-kit
/
kit
](https://github.com/go-kit/kit):
A standard library for microservices.
* <img src='https://avatars2.githubusercontent.com/u/10999?v=3&s=40' height='20' width='20'>[
grafana
/
grafana
](https://github.com/grafana/grafana):
Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB
* <img src='https://avatars0.githubusercontent.com/u/770753?v=3&s=40' height='20' width='20'>[
agrison
/
harpoon
](https://github.com/agrison/harpoon):
GitHub WebHook server written in Go
* <img src='https://avatars2.githubusercontent.com/u/2470398?v=3&s=40' height='20' width='20'>[
ovh
/
svfs
](https://github.com/ovh/svfs):
The Swift Virtual File System
* <img src='https://avatars2.githubusercontent.com/u/98356?v=3&s=40' height='20' width='20'>[
google
/
cayley
](https://github.com/google/cayley):
An open-source graph database
* <img src='https://avatars3.githubusercontent.com/u/125426?v=3&s=40' height='20' width='20'>[
syncthing
/
syncthing
](https://github.com/syncthing/syncthing):
Open Source Continuous File Synchronization
* <img src='https://avatars0.githubusercontent.com/u/592032?v=3&s=40' height='20' width='20'>[
hashicorp
/
consul
](https://github.com/hashicorp/consul):
Consul is a tool for service discovery, monitoring and configuration.
* <img src='https://avatars2.githubusercontent.com/u/3322424?v=3&s=40' height='20' width='20'>[
spance
/
suft
](https://github.com/spance/suft):
Small-scale UDP Fast Transmission Protocol
* <img src='https://avatars1.githubusercontent.com/u/232784?v=3&s=40' height='20' width='20'>[
square
/
metrics
](https://github.com/square/metrics):
Metrics Query Engine
* <img src='https://avatars0.githubusercontent.com/u/536312?v=3&s=40' height='20' width='20'>[
influxdata
/
influxdb
](https://github.com/influxdata/influxdb):
Scalable datastore for metrics, events, and real-time analytics
#### javascript
* <img src='https://avatars3.githubusercontent.com/u/854542?v=3&s=40' height='20' width='20'>[
Rochester-NRT
/
AlphaGo
](https://github.com/Rochester-NRT/AlphaGo):
A replication of DeepMind's 2016 Nature publication, "Mastering the game of Go with deep neural networks and tree search," details of which can be found on their website.
* <img src='https://avatars1.githubusercontent.com/u/985197?v=3&s=40' height='20' width='20'>[
FreeCodeCamp
/
FreeCodeCamp
](https://github.com/FreeCodeCamp/FreeCodeCamp):
The http://FreeCodeCamp.com open source codebase and curriculum. Learn to code and help nonprofits.
* <img src='https://avatars1.githubusercontent.com/u/3537278?v=3&s=40' height='20' width='20'>[
vasanthk
/
js-bits
](https://github.com/vasanthk/js-bits):
JavaScript concepts with code!
* <img src='https://avatars1.githubusercontent.com/u/339208?v=3&s=40' height='20' width='20'>[
airbnb
/
javascript
](https://github.com/airbnb/javascript):
JavaScript Style Guide
* <img src='https://avatars3.githubusercontent.com/u/15702338?v=3&s=40' height='20' width='20'>[
brian-armstrong
/
quiet-js
](https://github.com/brian-armstrong/quiet-js):
Transmit data at 44.1khz using Web Audio -- Javascript binding for libquiet
* <img src='https://avatars3.githubusercontent.com/u/100200?v=3&s=40' height='20' width='20'>[
ryanflorence
/
react-project
](https://github.com/ryanflorence/react-project):
State of the art web development with React.js.
* <img src='https://avatars2.githubusercontent.com/u/3382565?v=3&s=40' height='20' width='20'>[
chentsulin
/
electron-react-boilerplate
](https://github.com/chentsulin/electron-react-boilerplate):
Live editing development on desktop app
* <img src='https://avatars2.githubusercontent.com/u/249413?v=3&s=40' height='20' width='20'>[
OAI
/
OpenAPI-Specification
](https://github.com/OAI/OpenAPI-Specification):
The OpenAPI Specification Repository
* <img src='https://avatars3.githubusercontent.com/u/810438?v=3&s=40' height='20' width='20'>[
reactjs
/
redux
](https://github.com/reactjs/redux):
Predictable state container for JavaScript apps
* <img src='https://avatars0.githubusercontent.com/u/3782604?v=3&s=40' height='20' width='20'>[
eanplatter
/
enclave
](https://github.com/eanplatter/enclave):
A simpler way to compile React applications
* <img src='https://avatars3.githubusercontent.com/u/8445?v=3&s=40' height='20' width='20'>[
facebook
/
react
](https://github.com/facebook/react):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
* <img src='https://avatars2.githubusercontent.com/u/853712?v=3&s=40' height='20' width='20'>[
babel
/
babylon
](https://github.com/babel/babylon):
A JavaScript parser
* <img src='https://avatars0.githubusercontent.com/u/170270?v=3&s=40' height='20' width='20'>[
sindresorhus
/
ora
](https://github.com/sindresorhus/ora):
Elegant terminal spinner
* <img src='https://avatars0.githubusercontent.com/u/150330?v=3&s=40' height='20' width='20'>[
getify
/
You-Dont-Know-JS
](https://github.com/getify/You-Dont-Know-JS):
A book series on JavaScript. @YDKJS on twitter.
* <img src='https://avatars2.githubusercontent.com/u/230541?v=3&s=40' height='20' width='20'>[
mbostock
/
d3
](https://github.com/mbostock/d3):
A JavaScript visualization library for HTML and SVG.
* <img src='https://avatars3.githubusercontent.com/u/6182543?v=3&s=40' height='20' width='20'>[
miguelespinoza
/
react-goku
](https://github.com/miguelespinoza/react-goku):
* <img src='https://avatars3.githubusercontent.com/u/121766?v=3&s=40' height='20' width='20'>[
feross
/
webtorrent-app
](https://github.com/feross/webtorrent-app):
WebTorrent, the streaming torrent client. For OS X, Windows, and Linux.
* <img src='https://avatars3.githubusercontent.com/u/216296?v=3&s=40' height='20' width='20'>[
angular
/
angular.js
](https://github.com/angular/angular.js):
HTML enhanced for web apps
* <img src='https://avatars3.githubusercontent.com/u/4442541?v=3&s=40' height='20' width='20'>[
moarwick
/
react-mt-svg-lines
](https://github.com/moarwick/react-mt-svg-lines):
A React.js wrapper component to animate the line stroke in SVGs
* <img src='https://avatars1.githubusercontent.com/u/606991?v=3&s=40' height='20' width='20'>[
ParsePlatform
/
parse-server
](https://github.com/ParsePlatform/parse-server):
Parse-compatible API server module for Node/Express
* <img src='https://avatars1.githubusercontent.com/u/199035?v=3&s=40' height='20' width='20'>[
mzabriskie
/
axios
](https://github.com/mzabriskie/axios):
Promise based HTTP client for the browser and node.js
* <img src='https://avatars1.githubusercontent.com/u/80?v=3&s=40' height='20' width='20'>[
nodejs
/
node
](https://github.com/nodejs/node):
Node.js JavaScript runtime
* <img src='https://avatars0.githubusercontent.com/u/197597?v=3&s=40' height='20' width='20'>[
facebook
/
react-native
](https://github.com/facebook/react-native):
A framework for building native apps with React.
* <img src='https://avatars1.githubusercontent.com/u/1976330?v=3&s=40' height='20' width='20'>[
tripit
/
slate
](https://github.com/tripit/slate):
Beautiful static documentation for your API
* <img src='https://avatars1.githubusercontent.com/u/6018379?v=3&s=40' height='20' width='20'>[
reactjs
/
reselect
](https://github.com/reactjs/reselect):
Selector library for Redux
#### ruby
* <img src='https://avatars3.githubusercontent.com/u/4248610?v=3&s=40' height='20' width='20'>[
devanhurst
/
ktane_voice
](https://github.com/devanhurst/ktane_voice):
A bomb-defusing robot for people without friends.
* <img src='https://avatars3.githubusercontent.com/u/9477868?v=3&s=40' height='20' width='20'>[
iridakos
/
duckrails
](https://github.com/iridakos/duckrails):
A development tool to quickly & dynamically mock API endpoints
* <img src='https://avatars3.githubusercontent.com/u/40650?v=3&s=40' height='20' width='20'>[
mroth
/
lolcommits
](https://github.com/mroth/lolcommits):
git-based selfies for software developers
* <img src='https://avatars1.githubusercontent.com/u/1589480?v=3&s=40' height='20' width='20'>[
Homebrew
/
homebrew
](https://github.com/Homebrew/homebrew):
The missing package manager for OS X.
* <img src='https://avatars3.githubusercontent.com/u/173910?v=3&s=40' height='20' width='20'>[
ruby-concurrency
/
concurrent-ruby
](https://github.com/ruby-concurrency/concurrent-ruby):
Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
* <img src='https://avatars1.githubusercontent.com/u/47848?v=3&s=40' height='20' width='20'>[
rails
/
rails
](https://github.com/rails/rails):
Ruby on Rails
* <img src='https://avatars2.githubusercontent.com/u/869950?v=3&s=40' height='20' width='20'>[
fastlane
/
fastlane
](https://github.com/fastlane/fastlane):
Connect all iOS and Android deployment tools into one streamlined workflow
* <img src='https://avatars2.githubusercontent.com/u/1299?v=3&s=40' height='20' width='20'>[
mitchellh
/
vagrant
](https://github.com/mitchellh/vagrant):
Vagrant is a tool for building and distributing development environments.
* <img src='https://avatars0.githubusercontent.com/u/5213?v=3&s=40' height='20' width='20'>[
discourse
/
discourse
](https://github.com/discourse/discourse):
A platform for community discussion. Free, open, simple.
* <img src='https://avatars1.githubusercontent.com/u/83835?v=3&s=40' height='20' width='20'>[
cantino
/
huginn
](https://github.com/cantino/huginn):
Build agents that monitor and act on your behalf. Your agents are standing by!
* <img src='https://avatars3.githubusercontent.com/u/83390?v=3&s=40' height='20' width='20'>[
jondot
/
awesome-react-native
](https://github.com/jondot/awesome-react-native):
An "awesome" type curated list of React Native components, news, tools, and learning material
* <img src='https://avatars2.githubusercontent.com/u/237985?v=3&s=40' height='20' width='20'>[
jekyll
/
jekyll
](https://github.com/jekyll/jekyll):
Jekyll is a blog-aware, static site generator in Ruby
* <img src='https://avatars0.githubusercontent.com/u/727482?v=3&s=40' height='20' width='20'>[
caskroom
/
homebrew-cask
](https://github.com/caskroom/homebrew-cask):
A CLI workflow for the administration of Mac applications distributed as binaries
* <img src='https://avatars2.githubusercontent.com/u/1118459?v=3&s=40' height='20' width='20'>[
shakacode
/
react_on_rails
](https://github.com/shakacode/react_on_rails):
Integration of React + Webpack + Rails to build Universal (Isomorphic) Apps
* <img src='https://avatars1.githubusercontent.com/u/188?v=3&s=40' height='20' width='20'>[
sass
/
sass
](https://github.com/sass/sass):
Sass makes CSS fun again.
* <img src='https://avatars1.githubusercontent.com/u/17579?v=3&s=40' height='20' width='20'>[
Thibaut
/
devdocs
](https://github.com/Thibaut/devdocs):
API Documentation Browser
* <img src='https://avatars1.githubusercontent.com/u/903327?v=3&s=40' height='20' width='20'>[
thoughtbot
/
bourbon
](https://github.com/thoughtbot/bourbon):
A lightweight Sass tool set.
* <img src='https://avatars0.githubusercontent.com/u/3414795?v=3&s=40' height='20' width='20'>[
westonganger
/
spreadsheet_architect
](https://github.com/westonganger/spreadsheet_architect):
SpreadsheetArchitect lets you turn any activerecord relation or ruby object collection into a XLSX, ODS, or CSV spreadsheet
* <img src='https://avatars1.githubusercontent.com/u/161?v=3&s=40' height='20' width='20'>[
CanCanCommunity
/
cancancan
](https://github.com/CanCanCommunity/cancancan):
Continuation of CanCan, the authorization Gem for Ruby on Rails.
* <img src='https://avatars1.githubusercontent.com/u/52172?v=3&s=40' height='20' width='20'>[
codekitchen
/
dinghy
](https://github.com/codekitchen/dinghy):
faster, friendlier Docker on OS X
* <img src='https://avatars2.githubusercontent.com/u/16700?v=3&s=40' height='20' width='20'>[
ruby
/
ruby
](https://github.com/ruby/ruby):
The Ruby Programming Language
* <img src='https://avatars1.githubusercontent.com/u/1175434?v=3&s=40' height='20' width='20'>[
rapid7
/
metasploit-framework
](https://github.com/rapid7/metasploit-framework):
Metasploit Framework
* <img src='https://avatars3.githubusercontent.com/u/1048705?v=3&s=40' height='20' width='20'>[
CocoaPods
/
CocoaPods
](https://github.com/CocoaPods/CocoaPods):
The Cocoa Dependency Manager.
* <img src='https://avatars1.githubusercontent.com/u/1589480?v=3&s=40' height='20' width='20'>[
Linuxbrew
/
linuxbrew
](https://github.com/Linuxbrew/linuxbrew):
The Homebrew package manager for Linux
* <img src='https://avatars2.githubusercontent.com/u/1356007?v=3&s=40' height='20' width='20'>[
kilimchoi
/
engineering-blogs
](https://github.com/kilimchoi/engineering-blogs):
A curated list of engineering blogs
| {
"content_hash": "012c13fe98abb93e23d1becbdc579091",
"timestamp": "",
"source": "github",
"line_count": 889,
"max_line_length": 343,
"avg_line_length": 35.47019122609674,
"alnum_prop": 0.6583896235689595,
"repo_name": "josephyzhou/github-trending",
"id": "5a5bdda46b4f98b244451aeef323dd63d7e5ef5e",
"size": "31890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2016/2016-03-12.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "3251"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headerbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/header_bg" >
<ImageButton
android:id="@+id/img_main_menu_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_margin="0dp"
android:background="#00000000"
android:gravity="center_vertical"
android:onClick="onFinish"
android:padding="0dp"
android:src="@drawable/back_style" />
<TextView
android:id="@+id/title"
style="@style/headerTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="逛街" />
</RelativeLayout> | {
"content_hash": "c00b563c233d1f9d42b6d2c0f43049a7",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 36.41935483870968,
"alnum_prop": 0.6421612046058459,
"repo_name": "emop/EmopAndroid",
"id": "f82a9723921fc43c614d3d4b028abbd5a027d26c",
"size": "1133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/view_head_bar.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "723893"
},
{
"name": "Shell",
"bytes": "234"
}
],
"symlink_target": ""
} |
package org.zstack.sdk;
public class QueryAccessControlRuleResult {
public java.util.List inventories;
public void setInventories(java.util.List inventories) {
this.inventories = inventories;
}
public java.util.List getInventories() {
return this.inventories;
}
public java.lang.Long total;
public void setTotal(java.lang.Long total) {
this.total = total;
}
public java.lang.Long getTotal() {
return this.total;
}
}
| {
"content_hash": "fd220abf472ecb0a65eb08c9b490f31a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 60,
"avg_line_length": 22.40909090909091,
"alnum_prop": 0.6612576064908722,
"repo_name": "MatheMatrix/zstack",
"id": "347e05d48b53b543044ad34af263ca921120a78b",
"size": "493",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "sdk/src/main/java/org/zstack/sdk/QueryAccessControlRuleResult.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4616"
},
{
"name": "AspectJ",
"bytes": "74321"
},
{
"name": "Batchfile",
"bytes": "2932"
},
{
"name": "Groovy",
"bytes": "6674413"
},
{
"name": "Java",
"bytes": "25924839"
},
{
"name": "Python",
"bytes": "1062162"
},
{
"name": "Shell",
"bytes": "176428"
}
],
"symlink_target": ""
} |
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<link rel="stylesheet" type="text/css" href="jspm_packages/npm/[email protected]/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="styles/styles.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="animation-main">
<div class="splash">
<div class="message">Triple Play</div>
<i class="fa fa-spinner fa-spin"></i>
</div>
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
System.config({
"paths": {
"*": "dist/*.js"
}
});
</script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
| {
"content_hash": "9d5ea6740da30125ea0bbe5e79b050c9",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 112,
"avg_line_length": 27.75,
"alnum_prop": 0.592020592020592,
"repo_name": "Revya/TriplePlay",
"id": "4ea35213f8a7f8eae2b76b2a8c48335e4536fbde",
"size": "777",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3519"
},
{
"name": "HTML",
"bytes": "6802"
},
{
"name": "JavaScript",
"bytes": "25558"
},
{
"name": "Python",
"bytes": "9075"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="fa_500px">fa-500px</string>
<string name="fa_adjust">fa-adjust</string>
<string name="fa_adn">fa-adn</string>
<string name="fa_align_center">fa-align-center</string>
<string name="fa_align_justify">fa-align-justify</string>
<string name="fa_align_left">fa-align-left</string>
<string name="fa_align_right">fa-align-right</string>
<string name="fa_amazon">fa-amazon</string>
<string name="fa_ambulance">fa-ambulance</string>
<string name="fa_american_sign_language_interpreting">fa-american-sign-language-interpreting</string>
<string name="fa_anchor">fa-anchor</string>
<string name="fa_android">fa-android</string>
<string name="fa_angellist">fa-angellist</string>
<string name="fa_angle_double_down">fa-angle-double-down</string>
<string name="fa_angle_double_left">fa-angle-double-left</string>
<string name="fa_angle_double_right">fa-angle-double-right</string>
<string name="fa_angle_double_up">fa-angle-double-up</string>
<string name="fa_angle_down">fa-angle-down</string>
<string name="fa_angle_left">fa-angle-left</string>
<string name="fa_angle_right">fa-angle-right</string>
<string name="fa_angle_up">fa-angle-up</string>
<string name="fa_apple">fa-apple</string>
<string name="fa_archive">fa-archive</string>
<string name="fa_area_chart">fa-area-chart</string>
<string name="fa_arrow_circle_down">fa-arrow-circle-down</string>
<string name="fa_arrow_circle_left">fa-arrow-circle-left</string>
<string name="fa_arrow_circle_o_down">fa-arrow-circle-o-down</string>
<string name="fa_arrow_circle_o_left">fa-arrow-circle-o-left</string>
<string name="fa_arrow_circle_o_right">fa-arrow-circle-o-right</string>
<string name="fa_arrow_circle_o_up">fa-arrow-circle-o-up</string>
<string name="fa_arrow_circle_right">fa-arrow-circle-right</string>
<string name="fa_arrow_circle_up">fa-arrow-circle-up</string>
<string name="fa_arrow_down">fa-arrow-down</string>
<string name="fa_arrow_left">fa-arrow-left</string>
<string name="fa_arrow_right">fa-arrow-right</string>
<string name="fa_arrow_up">fa-arrow-up</string>
<string name="fa_arrows">fa-arrows</string>
<string name="fa_arrows_alt">fa-arrows-alt</string>
<string name="fa_arrows_h">fa-arrows-h</string>
<string name="fa_arrows_v">fa-arrows-v</string>
<string name="fa_asl_interpreting">fa-asl-interpreting</string>
<string name="fa_assistive_listening_systems">fa-assistive-listening-systems</string>
<string name="fa_asterisk">fa-asterisk</string>
<string name="fa_at">fa-at</string>
<string name="fa_audio_description">fa-audio-description</string>
<string name="fa_automobile">fa-automobile</string>
<string name="fa_backward">fa-backward</string>
<string name="fa_balance_scale">fa-balance-scale</string>
<string name="fa_ban">fa-ban</string>
<string name="fa_bank">fa-bank</string>
<string name="fa_bar_chart">fa-bar-chart</string>
<string name="fa_bar_chart_o">fa-bar-chart-o</string>
<string name="fa_barcode">fa-barcode</string>
<string name="fa_bars">fa-bars</string>
<string name="fa_battery_0">fa-battery-0</string>
<string name="fa_battery_1">fa-battery-1</string>
<string name="fa_battery_2">fa-battery-2</string>
<string name="fa_battery_3">fa-battery-3</string>
<string name="fa_battery_4">fa-battery-4</string>
<string name="fa_battery_empty">fa-battery-empty</string>
<string name="fa_battery_full">fa-battery-full</string>
<string name="fa_battery_half">fa-battery-half</string>
<string name="fa_battery_quarter">fa-battery-quarter</string>
<string name="fa_battery_three_quarters">fa-battery-three-quarters</string>
<string name="fa_bed">fa-bed</string>
<string name="fa_beer">fa-beer</string>
<string name="fa_behance">fa-behance</string>
<string name="fa_behance_square">fa-behance-square</string>
<string name="fa_bell">fa-bell</string>
<string name="fa_bell_o">fa-bell-o</string>
<string name="fa_bell_slash">fa-bell-slash</string>
<string name="fa_bell_slash_o">fa-bell-slash-o</string>
<string name="fa_bicycle">fa-bicycle</string>
<string name="fa_binoculars">fa-binoculars</string>
<string name="fa_birthday_cake">fa-birthday-cake</string>
<string name="fa_bitbucket">fa-bitbucket</string>
<string name="fa_bitbucket_square">fa-bitbucket-square</string>
<string name="fa_bitcoin">fa-bitcoin</string>
<string name="fa_black_tie">fa-black-tie</string>
<string name="fa_blind">fa-blind</string>
<string name="fa_bluetooth">fa-bluetooth</string>
<string name="fa_bluetooth_b">fa-bluetooth-b</string>
<string name="fa_bold">fa-bold</string>
<string name="fa_bolt">fa-bolt</string>
<string name="fa_bomb">fa-bomb</string>
<string name="fa_book">fa-book</string>
<string name="fa_bookmark">fa-bookmark</string>
<string name="fa_bookmark_o">fa-bookmark-o</string>
<string name="fa_braille">fa-braille</string>
<string name="fa_briefcase">fa-briefcase</string>
<string name="fa_btc">fa-btc</string>
<string name="fa_bug">fa-bug</string>
<string name="fa_building">fa-building</string>
<string name="fa_building_o">fa-building-o</string>
<string name="fa_bullhorn">fa-bullhorn</string>
<string name="fa_bullseye">fa-bullseye</string>
<string name="fa_bus">fa-bus</string>
<string name="fa_buysellads">fa-buysellads</string>
<string name="fa_cab">fa-cab</string>
<string name="fa_calculator">fa-calculator</string>
<string name="fa_calendar">fa-calendar</string>
<string name="fa_calendar_check_o">fa-calendar-check-o</string>
<string name="fa_calendar_minus_o">fa-calendar-minus-o</string>
<string name="fa_calendar_o">fa-calendar-o</string>
<string name="fa_calendar_plus_o">fa-calendar-plus-o</string>
<string name="fa_calendar_times_o">fa-calendar-times-o</string>
<string name="fa_camera">fa-camera</string>
<string name="fa_camera_retro">fa-camera-retro</string>
<string name="fa_car">fa-car</string>
<string name="fa_caret_down">fa-caret-down</string>
<string name="fa_caret_left">fa-caret-left</string>
<string name="fa_caret_right">fa-caret-right</string>
<string name="fa_caret_square_o_down">fa-caret-square-o-down</string>
<string name="fa_caret_square_o_left">fa-caret-square-o-left</string>
<string name="fa_caret_square_o_right">fa-caret-square-o-right</string>
<string name="fa_caret_square_o_up">fa-caret-square-o-up</string>
<string name="fa_caret_up">fa-caret-up</string>
<string name="fa_cart_arrow_down">fa-cart-arrow-down</string>
<string name="fa_cart_plus">fa-cart-plus</string>
<string name="fa_cc">fa-cc</string>
<string name="fa_cc_amex">fa-cc-amex</string>
<string name="fa_cc_diners_club">fa-cc-diners-club</string>
<string name="fa_cc_discover">fa-cc-discover</string>
<string name="fa_cc_jcb">fa-cc-jcb</string>
<string name="fa_cc_mastercard">fa-cc-mastercard</string>
<string name="fa_cc_paypal">fa-cc-paypal</string>
<string name="fa_cc_stripe">fa-cc-stripe</string>
<string name="fa_cc_visa">fa-cc-visa</string>
<string name="fa_certificate">fa-certificate</string>
<string name="fa_chain">fa-chain</string>
<string name="fa_chain_broken">fa-chain-broken</string>
<string name="fa_check">fa-check</string>
<string name="fa_check_circle">fa-check-circle</string>
<string name="fa_check_circle_o">fa-check-circle-o</string>
<string name="fa_check_square">fa-check-square</string>
<string name="fa_check_square_o">fa-check-square-o</string>
<string name="fa_chevron_circle_down">fa-chevron-circle-down</string>
<string name="fa_chevron_circle_left">fa-chevron-circle-left</string>
<string name="fa_chevron_circle_right">fa-chevron-circle-right</string>
<string name="fa_chevron_circle_up">fa-chevron-circle-up</string>
<string name="fa_chevron_down">fa-chevron-down</string>
<string name="fa_chevron_left">fa-chevron-left</string>
<string name="fa_chevron_right">fa-chevron-right</string>
<string name="fa_chevron_up">fa-chevron-up</string>
<string name="fa_child">fa-child</string>
<string name="fa_chrome">fa-chrome</string>
<string name="fa_circle">fa-circle</string>
<string name="fa_circle_o">fa-circle-o</string>
<string name="fa_circle_o_notch">fa-circle-o-notch</string>
<string name="fa_circle_thin">fa-circle-thin</string>
<string name="fa_clipboard">fa-clipboard</string>
<string name="fa_clock_o">fa-clock-o</string>
<string name="fa_clone">fa-clone</string>
<string name="fa_close">fa-close</string>
<string name="fa_cloud">fa-cloud</string>
<string name="fa_cloud_download">fa-cloud-download</string>
<string name="fa_cloud_upload">fa-cloud-upload</string>
<string name="fa_cny">fa-cny</string>
<string name="fa_code">fa-code</string>
<string name="fa_code_fork">fa-code-fork</string>
<string name="fa_codepen">fa-codepen</string>
<string name="fa_codiepie">fa-codiepie</string>
<string name="fa_coffee">fa-coffee</string>
<string name="fa_cog">fa-cog</string>
<string name="fa_cogs">fa-cogs</string>
<string name="fa_columns">fa-columns</string>
<string name="fa_comment">fa-comment</string>
<string name="fa_comment_o">fa-comment-o</string>
<string name="fa_commenting">fa-commenting</string>
<string name="fa_commenting_o">fa-commenting-o</string>
<string name="fa_comments">fa-comments</string>
<string name="fa_comments_o">fa-comments-o</string>
<string name="fa_compass">fa-compass</string>
<string name="fa_compress">fa-compress</string>
<string name="fa_connectdevelop">fa-connectdevelop</string>
<string name="fa_contao">fa-contao</string>
<string name="fa_copy">fa-copy</string>
<string name="fa_copyright">fa-copyright</string>
<string name="fa_creative_commons">fa-creative-commons</string>
<string name="fa_credit_card">fa-credit-card</string>
<string name="fa_credit_card_alt">fa-credit-card-alt</string>
<string name="fa_crop">fa-crop</string>
<string name="fa_crosshairs">fa-crosshairs</string>
<string name="fa_css3">fa-css3</string>
<string name="fa_cube">fa-cube</string>
<string name="fa_cubes">fa-cubes</string>
<string name="fa_cut">fa-cut</string>
<string name="fa_cutlery">fa-cutlery</string>
<string name="fa_dashboard">fa-dashboard</string>
<string name="fa_dashcube">fa-dashcube</string>
<string name="fa_database">fa-database</string>
<string name="fa_deaf">fa-deaf</string>
<string name="fa_deafness">fa-deafness</string>
<string name="fa_dedent">fa-dedent</string>
<string name="fa_delicious">fa-delicious</string>
<string name="fa_desktop">fa-desktop</string>
<string name="fa_deviantart">fa-deviantart</string>
<string name="fa_diamond">fa-diamond</string>
<string name="fa_digg">fa-digg</string>
<string name="fa_dollar">fa-dollar</string>
<string name="fa_dot_circle_o">fa-dot-circle-o</string>
<string name="fa_download">fa-download</string>
<string name="fa_dribbble">fa-dribbble</string>
<string name="fa_dropbox">fa-dropbox</string>
<string name="fa_drupal">fa-drupal</string>
<string name="fa_edge">fa-edge</string>
<string name="fa_edit">fa-edit</string>
<string name="fa_eject">fa-eject</string>
<string name="fa_ellipsis_h">fa-ellipsis-h</string>
<string name="fa_ellipsis_v">fa-ellipsis-v</string>
<string name="fa_empire">fa-empire</string>
<string name="fa_envelope">fa-envelope</string>
<string name="fa_envelope_o">fa-envelope-o</string>
<string name="fa_envelope_square">fa-envelope-square</string>
<string name="fa_envira">fa-envira</string>
<string name="fa_eraser">fa-eraser</string>
<string name="fa_eur">fa-eur</string>
<string name="fa_euro">fa-euro</string>
<string name="fa_exchange">fa-exchange</string>
<string name="fa_exclamation">fa-exclamation</string>
<string name="fa_exclamation_circle">fa-exclamation-circle</string>
<string name="fa_exclamation_triangle">fa-exclamation-triangle</string>
<string name="fa_expand">fa-expand</string>
<string name="fa_expeditedssl">fa-expeditedssl</string>
<string name="fa_external_link">fa-external-link</string>
<string name="fa_external_link_square">fa-external-link-square</string>
<string name="fa_eye">fa-eye</string>
<string name="fa_eye_slash">fa-eye-slash</string>
<string name="fa_eyedropper">fa-eyedropper</string>
<string name="fa_fa">fa-fa</string>
<string name="fa_facebook">fa-facebook</string>
<string name="fa_facebook_f">fa-facebook-f</string>
<string name="fa_facebook_official">fa-facebook-official</string>
<string name="fa_facebook_square">fa-facebook-square</string>
<string name="fa_fast_backward">fa-fast-backward</string>
<string name="fa_fast_forward">fa-fast-forward</string>
<string name="fa_fax">fa-fax</string>
<string name="fa_feed">fa-feed</string>
<string name="fa_female">fa-female</string>
<string name="fa_fighter_jet">fa-fighter-jet</string>
<string name="fa_file">fa-file</string>
<string name="fa_file_archive_o">fa-file-archive-o</string>
<string name="fa_file_audio_o">fa-file-audio-o</string>
<string name="fa_file_code_o">fa-file-code-o</string>
<string name="fa_file_excel_o">fa-file-excel-o</string>
<string name="fa_file_image_o">fa-file-image-o</string>
<string name="fa_file_movie_o">fa-file-movie-o</string>
<string name="fa_file_o">fa-file-o</string>
<string name="fa_file_pdf_o">fa-file-pdf-o</string>
<string name="fa_file_photo_o">fa-file-photo-o</string>
<string name="fa_file_picture_o">fa-file-picture-o</string>
<string name="fa_file_powerpoint_o">fa-file-powerpoint-o</string>
<string name="fa_file_sound_o">fa-file-sound-o</string>
<string name="fa_file_text">fa-file-text</string>
<string name="fa_file_text_o">fa-file-text-o</string>
<string name="fa_file_video_o">fa-file-video-o</string>
<string name="fa_file_word_o">fa-file-word-o</string>
<string name="fa_file_zip_o">fa-file-zip-o</string>
<string name="fa_files_o">fa-files-o</string>
<string name="fa_film">fa-film</string>
<string name="fa_filter">fa-filter</string>
<string name="fa_fire">fa-fire</string>
<string name="fa_fire_extinguisher">fa-fire-extinguisher</string>
<string name="fa_firefox">fa-firefox</string>
<string name="fa_first_order">fa-first-order</string>
<string name="fa_flag">fa-flag</string>
<string name="fa_flag_checkered">fa-flag-checkered</string>
<string name="fa_flag_o">fa-flag-o</string>
<string name="fa_flash">fa-flash</string>
<string name="fa_flask">fa-flask</string>
<string name="fa_flickr">fa-flickr</string>
<string name="fa_floppy_o">fa-floppy-o</string>
<string name="fa_folder">fa-folder</string>
<string name="fa_folder_o">fa-folder-o</string>
<string name="fa_folder_open">fa-folder-open</string>
<string name="fa_folder_open_o">fa-folder-open-o</string>
<string name="fa_font">fa-font</string>
<string name="fa_font_awesome">fa-font-awesome</string>
<string name="fa_fonticons">fa-fonticons</string>
<string name="fa_fort_awesome">fa-fort-awesome</string>
<string name="fa_forumbee">fa-forumbee</string>
<string name="fa_forward">fa-forward</string>
<string name="fa_foursquare">fa-foursquare</string>
<string name="fa_frown_o">fa-frown-o</string>
<string name="fa_futbol_o">fa-futbol-o</string>
<string name="fa_gamepad">fa-gamepad</string>
<string name="fa_gavel">fa-gavel</string>
<string name="fa_gbp">fa-gbp</string>
<string name="fa_ge">fa-ge</string>
<string name="fa_gear">fa-gear</string>
<string name="fa_gears">fa-gears</string>
<string name="fa_genderless">fa-genderless</string>
<string name="fa_get_pocket">fa-get-pocket</string>
<string name="fa_gg">fa-gg</string>
<string name="fa_gg_circle">fa-gg-circle</string>
<string name="fa_gift">fa-gift</string>
<string name="fa_git">fa-git</string>
<string name="fa_git_square">fa-git-square</string>
<string name="fa_github">fa-github</string>
<string name="fa_github_alt">fa-github-alt</string>
<string name="fa_github_square">fa-github-square</string>
<string name="fa_gitlab">fa-gitlab</string>
<string name="fa_gittip">fa-gittip</string>
<string name="fa_glass">fa-glass</string>
<string name="fa_glide">fa-glide</string>
<string name="fa_glide_g">fa-glide-g</string>
<string name="fa_globe">fa-globe</string>
<string name="fa_google">fa-google</string>
<string name="fa_google_plus">fa-google-plus</string>
<string name="fa_google_plus_circle">fa-google-plus-circle</string>
<string name="fa_google_plus_official">fa-google-plus-official</string>
<string name="fa_google_plus_square">fa-google-plus-square</string>
<string name="fa_google_wallet">fa-google-wallet</string>
<string name="fa_graduation_cap">fa-graduation-cap</string>
<string name="fa_gratipay">fa-gratipay</string>
<string name="fa_group">fa-group</string>
<string name="fa_h_square">fa-h-square</string>
<string name="fa_hacker_news">fa-hacker-news</string>
<string name="fa_hand_grab_o">fa-hand-grab-o</string>
<string name="fa_hand_lizard_o">fa-hand-lizard-o</string>
<string name="fa_hand_o_down">fa-hand-o-down</string>
<string name="fa_hand_o_left">fa-hand-o-left</string>
<string name="fa_hand_o_right">fa-hand-o-right</string>
<string name="fa_hand_o_up">fa-hand-o-up</string>
<string name="fa_hand_paper_o">fa-hand-paper-o</string>
<string name="fa_hand_peace_o">fa-hand-peace-o</string>
<string name="fa_hand_pointer_o">fa-hand-pointer-o</string>
<string name="fa_hand_rock_o">fa-hand-rock-o</string>
<string name="fa_hand_scissors_o">fa-hand-scissors-o</string>
<string name="fa_hand_spock_o">fa-hand-spock-o</string>
<string name="fa_hand_stop_o">fa-hand-stop-o</string>
<string name="fa_hard_of_hearing">fa-hard-of-hearing</string>
<string name="fa_hashtag">fa-hashtag</string>
<string name="fa_hdd_o">fa-hdd-o</string>
<string name="fa_header">fa-header</string>
<string name="fa_headphones">fa-headphones</string>
<string name="fa_heart">fa-heart</string>
<string name="fa_heart_o">fa-heart-o</string>
<string name="fa_heartbeat">fa-heartbeat</string>
<string name="fa_history">fa-history</string>
<string name="fa_home">fa-home</string>
<string name="fa_hospital_o">fa-hospital-o</string>
<string name="fa_hotel">fa-hotel</string>
<string name="fa_hourglass">fa-hourglass</string>
<string name="fa_hourglass_1">fa-hourglass-1</string>
<string name="fa_hourglass_2">fa-hourglass-2</string>
<string name="fa_hourglass_3">fa-hourglass-3</string>
<string name="fa_hourglass_end">fa-hourglass-end</string>
<string name="fa_hourglass_half">fa-hourglass-half</string>
<string name="fa_hourglass_o">fa-hourglass-o</string>
<string name="fa_hourglass_start">fa-hourglass-start</string>
<string name="fa_houzz">fa-houzz</string>
<string name="fa_html5">fa-html5</string>
<string name="fa_i_cursor">fa-i-cursor</string>
<string name="fa_ils">fa-ils</string>
<string name="fa_image">fa-image</string>
<string name="fa_inbox">fa-inbox</string>
<string name="fa_indent">fa-indent</string>
<string name="fa_industry">fa-industry</string>
<string name="fa_info">fa-info</string>
<string name="fa_info_circle">fa-info-circle</string>
<string name="fa_inr">fa-inr</string>
<string name="fa_instagram">fa-instagram</string>
<string name="fa_institution">fa-institution</string>
<string name="fa_internet_explorer">fa-internet-explorer</string>
<string name="fa_intersex">fa-intersex</string>
<string name="fa_ioxhost">fa-ioxhost</string>
<string name="fa_italic">fa-italic</string>
<string name="fa_joomla">fa-joomla</string>
<string name="fa_jpy">fa-jpy</string>
<string name="fa_jsfiddle">fa-jsfiddle</string>
<string name="fa_key">fa-key</string>
<string name="fa_keyboard_o">fa-keyboard-o</string>
<string name="fa_krw">fa-krw</string>
<string name="fa_language">fa-language</string>
<string name="fa_laptop">fa-laptop</string>
<string name="fa_lastfm">fa-lastfm</string>
<string name="fa_lastfm_square">fa-lastfm-square</string>
<string name="fa_leaf">fa-leaf</string>
<string name="fa_leanpub">fa-leanpub</string>
<string name="fa_legal">fa-legal</string>
<string name="fa_lemon_o">fa-lemon-o</string>
<string name="fa_level_down">fa-level-down</string>
<string name="fa_level_up">fa-level-up</string>
<string name="fa_life_bouy">fa-life-bouy</string>
<string name="fa_life_buoy">fa-life-buoy</string>
<string name="fa_life_ring">fa-life-ring</string>
<string name="fa_life_saver">fa-life-saver</string>
<string name="fa_lightbulb_o">fa-lightbulb-o</string>
<string name="fa_line_chart">fa-line-chart</string>
<string name="fa_link">fa-link</string>
<string name="fa_linkedin">fa-linkedin</string>
<string name="fa_linkedin_square">fa-linkedin-square</string>
<string name="fa_linux">fa-linux</string>
<string name="fa_list">fa-list</string>
<string name="fa_list_alt">fa-list-alt</string>
<string name="fa_list_ol">fa-list-ol</string>
<string name="fa_list_ul">fa-list-ul</string>
<string name="fa_location_arrow">fa-location-arrow</string>
<string name="fa_lock">fa-lock</string>
<string name="fa_long_arrow_down">fa-long-arrow-down</string>
<string name="fa_long_arrow_left">fa-long-arrow-left</string>
<string name="fa_long_arrow_right">fa-long-arrow-right</string>
<string name="fa_long_arrow_up">fa-long-arrow-up</string>
<string name="fa_low_vision">fa-low-vision</string>
<string name="fa_magic">fa-magic</string>
<string name="fa_magnet">fa-magnet</string>
<string name="fa_mail_forward">fa-mail-forward</string>
<string name="fa_mail_reply">fa-mail-reply</string>
<string name="fa_mail_reply_all">fa-mail-reply-all</string>
<string name="fa_male">fa-male</string>
<string name="fa_map">fa-map</string>
<string name="fa_map_marker">fa-map-marker</string>
<string name="fa_map_o">fa-map-o</string>
<string name="fa_map_pin">fa-map-pin</string>
<string name="fa_map_signs">fa-map-signs</string>
<string name="fa_mars">fa-mars</string>
<string name="fa_mars_double">fa-mars-double</string>
<string name="fa_mars_stroke">fa-mars-stroke</string>
<string name="fa_mars_stroke_h">fa-mars-stroke-h</string>
<string name="fa_mars_stroke_v">fa-mars-stroke-v</string>
<string name="fa_maxcdn">fa-maxcdn</string>
<string name="fa_meanpath">fa-meanpath</string>
<string name="fa_medium">fa-medium</string>
<string name="fa_medkit">fa-medkit</string>
<string name="fa_meh_o">fa-meh-o</string>
<string name="fa_mercury">fa-mercury</string>
<string name="fa_microphone">fa-microphone</string>
<string name="fa_microphone_slash">fa-microphone-slash</string>
<string name="fa_minus">fa-minus</string>
<string name="fa_minus_circle">fa-minus-circle</string>
<string name="fa_minus_square">fa-minus-square</string>
<string name="fa_minus_square_o">fa-minus-square-o</string>
<string name="fa_mixcloud">fa-mixcloud</string>
<string name="fa_mobile">fa-mobile</string>
<string name="fa_mobile_phone">fa-mobile-phone</string>
<string name="fa_modx">fa-modx</string>
<string name="fa_money">fa-money</string>
<string name="fa_moon_o">fa-moon-o</string>
<string name="fa_mortar_board">fa-mortar-board</string>
<string name="fa_motorcycle">fa-motorcycle</string>
<string name="fa_mouse_pointer">fa-mouse-pointer</string>
<string name="fa_music">fa-music</string>
<string name="fa_navicon">fa-navicon</string>
<string name="fa_neuter">fa-neuter</string>
<string name="fa_newspaper_o">fa-newspaper-o</string>
<string name="fa_object_group">fa-object-group</string>
<string name="fa_object_ungroup">fa-object-ungroup</string>
<string name="fa_odnoklassniki">fa-odnoklassniki</string>
<string name="fa_odnoklassniki_square">fa-odnoklassniki-square</string>
<string name="fa_opencart">fa-opencart</string>
<string name="fa_openid">fa-openid</string>
<string name="fa_opera">fa-opera</string>
<string name="fa_optin_monster">fa-optin-monster</string>
<string name="fa_outdent">fa-outdent</string>
<string name="fa_pagelines">fa-pagelines</string>
<string name="fa_paint_brush">fa-paint-brush</string>
<string name="fa_paper_plane">fa-paper-plane</string>
<string name="fa_paper_plane_o">fa-paper-plane-o</string>
<string name="fa_paperclip">fa-paperclip</string>
<string name="fa_paragraph">fa-paragraph</string>
<string name="fa_paste">fa-paste</string>
<string name="fa_pause">fa-pause</string>
<string name="fa_pause_circle">fa-pause-circle</string>
<string name="fa_pause_circle_o">fa-pause-circle-o</string>
<string name="fa_paw">fa-paw</string>
<string name="fa_paypal">fa-paypal</string>
<string name="fa_pencil">fa-pencil</string>
<string name="fa_pencil_square">fa-pencil-square</string>
<string name="fa_pencil_square_o">fa-pencil-square-o</string>
<string name="fa_percent">fa-percent</string>
<string name="fa_phone">fa-phone</string>
<string name="fa_phone_square">fa-phone-square</string>
<string name="fa_photo">fa-photo</string>
<string name="fa_picture_o">fa-picture-o</string>
<string name="fa_pie_chart">fa-pie-chart</string>
<string name="fa_pied_piper">fa-pied-piper</string>
<string name="fa_pied_piper_alt">fa-pied-piper-alt</string>
<string name="fa_pied_piper_pp">fa-pied-piper-pp</string>
<string name="fa_pinterest">fa-pinterest</string>
<string name="fa_pinterest_p">fa-pinterest-p</string>
<string name="fa_pinterest_square">fa-pinterest-square</string>
<string name="fa_plane">fa-plane</string>
<string name="fa_play">fa-play</string>
<string name="fa_play_circle">fa-play-circle</string>
<string name="fa_play_circle_o">fa-play-circle-o</string>
<string name="fa_plug">fa-plug</string>
<string name="fa_plus">fa-plus</string>
<string name="fa_plus_circle">fa-plus-circle</string>
<string name="fa_plus_square">fa-plus-square</string>
<string name="fa_plus_square_o">fa-plus-square-o</string>
<string name="fa_power_off">fa-power-off</string>
<string name="fa_print">fa-print</string>
<string name="fa_product_hunt">fa-product-hunt</string>
<string name="fa_puzzle_piece">fa-puzzle-piece</string>
<string name="fa_qq">fa-qq</string>
<string name="fa_qrcode">fa-qrcode</string>
<string name="fa_question">fa-question</string>
<string name="fa_question_circle">fa-question-circle</string>
<string name="fa_question_circle_o">fa-question-circle-o</string>
<string name="fa_quote_left">fa-quote-left</string>
<string name="fa_quote_right">fa-quote-right</string>
<string name="fa_ra">fa-ra</string>
<string name="fa_random">fa-random</string>
<string name="fa_rebel">fa-rebel</string>
<string name="fa_recycle">fa-recycle</string>
<string name="fa_reddit">fa-reddit</string>
<string name="fa_reddit_alien">fa-reddit-alien</string>
<string name="fa_reddit_square">fa-reddit-square</string>
<string name="fa_refresh">fa-refresh</string>
<string name="fa_registered">fa-registered</string>
<string name="fa_remove">fa-remove</string>
<string name="fa_renren">fa-renren</string>
<string name="fa_reorder">fa-reorder</string>
<string name="fa_repeat">fa-repeat</string>
<string name="fa_reply">fa-reply</string>
<string name="fa_reply_all">fa-reply-all</string>
<string name="fa_resistance">fa-resistance</string>
<string name="fa_retweet">fa-retweet</string>
<string name="fa_rmb">fa-rmb</string>
<string name="fa_road">fa-road</string>
<string name="fa_rocket">fa-rocket</string>
<string name="fa_rotate_left">fa-rotate-left</string>
<string name="fa_rotate_right">fa-rotate-right</string>
<string name="fa_rouble">fa-rouble</string>
<string name="fa_rss">fa-rss</string>
<string name="fa_rss_square">fa-rss-square</string>
<string name="fa_rub">fa-rub</string>
<string name="fa_ruble">fa-ruble</string>
<string name="fa_rupee">fa-rupee</string>
<string name="fa_safari">fa-safari</string>
<string name="fa_save">fa-save</string>
<string name="fa_scissors">fa-scissors</string>
<string name="fa_scribd">fa-scribd</string>
<string name="fa_search">fa-search</string>
<string name="fa_search_minus">fa-search-minus</string>
<string name="fa_search_plus">fa-search-plus</string>
<string name="fa_sellsy">fa-sellsy</string>
<string name="fa_send">fa-send</string>
<string name="fa_send_o">fa-send-o</string>
<string name="fa_server">fa-server</string>
<string name="fa_share">fa-share</string>
<string name="fa_share_alt">fa-share-alt</string>
<string name="fa_share_alt_square">fa-share-alt-square</string>
<string name="fa_share_square">fa-share-square</string>
<string name="fa_share_square_o">fa-share-square-o</string>
<string name="fa_shekel">fa-shekel</string>
<string name="fa_sheqel">fa-sheqel</string>
<string name="fa_shield">fa-shield</string>
<string name="fa_ship">fa-ship</string>
<string name="fa_shirtsinbulk">fa-shirtsinbulk</string>
<string name="fa_shopping_bag">fa-shopping-bag</string>
<string name="fa_shopping_basket">fa-shopping-basket</string>
<string name="fa_shopping_cart">fa-shopping-cart</string>
<string name="fa_sign_in">fa-sign-in</string>
<string name="fa_sign_language">fa-sign-language</string>
<string name="fa_sign_out">fa-sign-out</string>
<string name="fa_signal">fa-signal</string>
<string name="fa_signing">fa-signing</string>
<string name="fa_simplybuilt">fa-simplybuilt</string>
<string name="fa_sitemap">fa-sitemap</string>
<string name="fa_skyatlas">fa-skyatlas</string>
<string name="fa_skype">fa-skype</string>
<string name="fa_slack">fa-slack</string>
<string name="fa_sliders">fa-sliders</string>
<string name="fa_slideshare">fa-slideshare</string>
<string name="fa_smile_o">fa-smile-o</string>
<string name="fa_snapchat">fa-snapchat</string>
<string name="fa_snapchat_ghost">fa-snapchat-ghost</string>
<string name="fa_snapchat_square">fa-snapchat-square</string>
<string name="fa_soccer_ball_o">fa-soccer-ball-o</string>
<string name="fa_sort">fa-sort</string>
<string name="fa_sort_alpha_asc">fa-sort-alpha-asc</string>
<string name="fa_sort_alpha_desc">fa-sort-alpha-desc</string>
<string name="fa_sort_amount_asc">fa-sort-amount-asc</string>
<string name="fa_sort_amount_desc">fa-sort-amount-desc</string>
<string name="fa_sort_asc">fa-sort-asc</string>
<string name="fa_sort_desc">fa-sort-desc</string>
<string name="fa_sort_down">fa-sort-down</string>
<string name="fa_sort_numeric_asc">fa-sort-numeric-asc</string>
<string name="fa_sort_numeric_desc">fa-sort-numeric-desc</string>
<string name="fa_sort_up">fa-sort-up</string>
<string name="fa_soundcloud">fa-soundcloud</string>
<string name="fa_space_shuttle">fa-space-shuttle</string>
<string name="fa_spinner">fa-spinner</string>
<string name="fa_spoon">fa-spoon</string>
<string name="fa_spotify">fa-spotify</string>
<string name="fa_square">fa-square</string>
<string name="fa_square_o">fa-square-o</string>
<string name="fa_stack_exchange">fa-stack-exchange</string>
<string name="fa_stack_overflow">fa-stack-overflow</string>
<string name="fa_star">fa-star</string>
<string name="fa_star_half">fa-star-half</string>
<string name="fa_star_half_empty">fa-star-half-empty</string>
<string name="fa_star_half_full">fa-star-half-full</string>
<string name="fa_star_half_o">fa-star-half-o</string>
<string name="fa_star_o">fa-star-o</string>
<string name="fa_steam">fa-steam</string>
<string name="fa_steam_square">fa-steam-square</string>
<string name="fa_step_backward">fa-step-backward</string>
<string name="fa_step_forward">fa-step-forward</string>
<string name="fa_stethoscope">fa-stethoscope</string>
<string name="fa_sticky_note">fa-sticky-note</string>
<string name="fa_sticky_note_o">fa-sticky-note-o</string>
<string name="fa_stop">fa-stop</string>
<string name="fa_stop_circle">fa-stop-circle</string>
<string name="fa_stop_circle_o">fa-stop-circle-o</string>
<string name="fa_street_view">fa-street-view</string>
<string name="fa_strikethrough">fa-strikethrough</string>
<string name="fa_stumbleupon">fa-stumbleupon</string>
<string name="fa_stumbleupon_circle">fa-stumbleupon-circle</string>
<string name="fa_subscript">fa-subscript</string>
<string name="fa_subway">fa-subway</string>
<string name="fa_suitcase">fa-suitcase</string>
<string name="fa_sun_o">fa-sun-o</string>
<string name="fa_superscript">fa-superscript</string>
<string name="fa_support">fa-support</string>
<string name="fa_table">fa-table</string>
<string name="fa_tablet">fa-tablet</string>
<string name="fa_tachometer">fa-tachometer</string>
<string name="fa_tag">fa-tag</string>
<string name="fa_tags">fa-tags</string>
<string name="fa_tasks">fa-tasks</string>
<string name="fa_taxi">fa-taxi</string>
<string name="fa_television">fa-television</string>
<string name="fa_tencent_weibo">fa-tencent-weibo</string>
<string name="fa_terminal">fa-terminal</string>
<string name="fa_text_height">fa-text-height</string>
<string name="fa_text_width">fa-text-width</string>
<string name="fa_th">fa-th</string>
<string name="fa_th_large">fa-th-large</string>
<string name="fa_th_list">fa-th-list</string>
<string name="fa_themeisle">fa-themeisle</string>
<string name="fa_thumb_tack">fa-thumb-tack</string>
<string name="fa_thumbs_down">fa-thumbs-down</string>
<string name="fa_thumbs_o_down">fa-thumbs-o-down</string>
<string name="fa_thumbs_o_up">fa-thumbs-o-up</string>
<string name="fa_thumbs_up">fa-thumbs-up</string>
<string name="fa_ticket">fa-ticket</string>
<string name="fa_times">fa-times</string>
<string name="fa_times_circle">fa-times-circle</string>
<string name="fa_times_circle_o">fa-times-circle-o</string>
<string name="fa_tint">fa-tint</string>
<string name="fa_toggle_down">fa-toggle-down</string>
<string name="fa_toggle_left">fa-toggle-left</string>
<string name="fa_toggle_off">fa-toggle-off</string>
<string name="fa_toggle_on">fa-toggle-on</string>
<string name="fa_toggle_right">fa-toggle-right</string>
<string name="fa_toggle_up">fa-toggle-up</string>
<string name="fa_trademark">fa-trademark</string>
<string name="fa_train">fa-train</string>
<string name="fa_transgender">fa-transgender</string>
<string name="fa_transgender_alt">fa-transgender-alt</string>
<string name="fa_trash">fa-trash</string>
<string name="fa_trash_o">fa-trash-o</string>
<string name="fa_tree">fa-tree</string>
<string name="fa_trello">fa-trello</string>
<string name="fa_tripadvisor">fa-tripadvisor</string>
<string name="fa_trophy">fa-trophy</string>
<string name="fa_truck">fa-truck</string>
<string name="fa_try">fa-try</string>
<string name="fa_tty">fa-tty</string>
<string name="fa_tumblr">fa-tumblr</string>
<string name="fa_tumblr_square">fa-tumblr-square</string>
<string name="fa_turkish_lira">fa-turkish-lira</string>
<string name="fa_tv">fa-tv</string>
<string name="fa_twitch">fa-twitch</string>
<string name="fa_twitter">fa-twitter</string>
<string name="fa_twitter_square">fa-twitter-square</string>
<string name="fa_umbrella">fa-umbrella</string>
<string name="fa_underline">fa-underline</string>
<string name="fa_undo">fa-undo</string>
<string name="fa_universal_access">fa-universal-access</string>
<string name="fa_university">fa-university</string>
<string name="fa_unlink">fa-unlink</string>
<string name="fa_unlock">fa-unlock</string>
<string name="fa_unlock_alt">fa-unlock-alt</string>
<string name="fa_unsorted">fa-unsorted</string>
<string name="fa_upload">fa-upload</string>
<string name="fa_usb">fa-usb</string>
<string name="fa_usd">fa-usd</string>
<string name="fa_user">fa-user</string>
<string name="fa_user_md">fa-user-md</string>
<string name="fa_user_plus">fa-user-plus</string>
<string name="fa_user_secret">fa-user-secret</string>
<string name="fa_user_times">fa-user-times</string>
<string name="fa_users">fa-users</string>
<string name="fa_venus">fa-venus</string>
<string name="fa_venus_double">fa-venus-double</string>
<string name="fa_venus_mars">fa-venus-mars</string>
<string name="fa_viacoin">fa-viacoin</string>
<string name="fa_viadeo">fa-viadeo</string>
<string name="fa_viadeo_square">fa-viadeo-square</string>
<string name="fa_video_camera">fa-video-camera</string>
<string name="fa_vimeo">fa-vimeo</string>
<string name="fa_vimeo_square">fa-vimeo-square</string>
<string name="fa_vine">fa-vine</string>
<string name="fa_vk">fa-vk</string>
<string name="fa_volume_control_phone">fa-volume-control-phone</string>
<string name="fa_volume_down">fa-volume-down</string>
<string name="fa_volume_off">fa-volume-off</string>
<string name="fa_volume_up">fa-volume-up</string>
<string name="fa_warning">fa-warning</string>
<string name="fa_wechat">fa-wechat</string>
<string name="fa_weibo">fa-weibo</string>
<string name="fa_weixin">fa-weixin</string>
<string name="fa_whatsapp">fa-whatsapp</string>
<string name="fa_wheelchair">fa-wheelchair</string>
<string name="fa_wheelchair_alt">fa-wheelchair-alt</string>
<string name="fa_wifi">fa-wifi</string>
<string name="fa_wikipedia_w">fa-wikipedia-w</string>
<string name="fa_windows">fa-windows</string>
<string name="fa_won">fa-won</string>
<string name="fa_wordpress">fa-wordpress</string>
<string name="fa_wpbeginner">fa-wpbeginner</string>
<string name="fa_wpforms">fa-wpforms</string>
<string name="fa_wrench">fa-wrench</string>
<string name="fa_xing">fa-xing</string>
<string name="fa_xing_square">fa-xing-square</string>
<string name="fa_y_combinator">fa-y-combinator</string>
<string name="fa_y_combinator_square">fa-y-combinator-square</string>
<string name="fa_yahoo">fa-yahoo</string>
<string name="fa_yc">fa-yc</string>
<string name="fa_yc_square">fa-yc-square</string>
<string name="fa_yelp">fa-yelp</string>
<string name="fa_yen">fa-yen</string>
<string name="fa_yoast">fa-yoast</string>
<string name="fa_youtube">fa-youtube</string>
<string name="fa_youtube_play">fa-youtube-play</string>
<string name="fa_youtube_square">fa-youtube-square</string>
</resources> | {
"content_hash": "f1f80d0b4023972e1a7d723ad38c39c7",
"timestamp": "",
"source": "github",
"line_count": 733,
"max_line_length": 103,
"avg_line_length": 51.98090040927694,
"alnum_prop": 0.7061046664217101,
"repo_name": "shifarshifz/FACG",
"id": "f8d64eb9d8f0620b20f7114763e3382912aa1f01",
"size": "38102",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "string.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "44593"
}
],
"symlink_target": ""
} |
#import "BackRow-Structs.h"
#import "BRControl.h"
__attribute__((visibility("hidden")))
@interface BRMetadataDetailChunkControl : BRControl {
}
- (void)dealloc; // 0x315a6971
- (void)layoutSubcontrols; // 0x315e4f65
- (void)setDetails:(id)details withLabel:(id)label; // 0x315a36e9
- (CGSize)sizeThatFits:(CGSize)fits; // 0x315e512d
@end
| {
"content_hash": "daf23f2259e809752a6416b4b42fa74e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 65,
"avg_line_length": 22.866666666666667,
"alnum_prop": 0.7288629737609329,
"repo_name": "tandrup/eyetv4atv",
"id": "8acb30dc62d5a4edd14f9d4572b5b5e42f56b6d4",
"size": "547",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "eyetv4atv/include/BackRow/BRMetadataDetailChunkControl.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1157"
},
{
"name": "C++",
"bytes": "1195"
},
{
"name": "Objective-C",
"bytes": "741647"
}
],
"symlink_target": ""
} |
using System;
namespace ModernMoleculeViewer.Model
{
/// <summary>
/// <see cref="Atom "/> subclass for alpha carbon protein backbone atoms.
/// </summary>
/// <remarks>
/// Adds functionality to manage the atom's backbone 3D model.
/// </remarks>
internal class CAlpha : ChainAtom
{
private CAlpha _previousCAlpha;
private CAlpha _nextCAlpha;
/// <summary>
/// Gets and sets a reference to the previous <see cref="CAlpha" /> in the backbone.
/// </summary>
internal CAlpha PreviousCAlpha
{
get { return _previousCAlpha; }
set { _previousCAlpha = value; }
}
/// <summary>
/// Gets and sets a reference to the next <see cref="CAlpha" /> in the backbone.
/// </summary>
internal CAlpha NextCAlpha
{
get { return _nextCAlpha; }
set { _nextCAlpha = value; }
}
/// <summary>
/// Attaches an event handedler to <see cref="Molecule.ShowBackboneChanged" />.
/// </summary>
internal override void Initialize()
{
base.Initialize();
Molecule.ShowBackboneChanged += MoleculeShowBackboneChanged;
}
/* /// <summary>
/// Performs hit testing for the backbone 3D model.
/// </summary>
/// <param name="rayHitTestResult">A 3D mesh hit test result from the WPF visual tree hit
/// testing framework</param>
/// <returns>True if the mesh hit belongs to the backbone, otherwise false.</returns>
internal override bool HoverHitTest(RayMeshGeometry3DHitTestResult rayHitTestResult)
{
return (this._backboneModel != null &&
this._backboneModel.Children.Contains(rayHitTestResult.ModelHit)) ||
base.HoverHitTest(rayHitTestResult);
}*/
/// <summary>
/// Toggles visibility based on the <see cref="Molecule.ShowBackbone" /> property.
/// </summary>
/// <param name="sender">The molecule.</param>
/// <param name="e">Empty event args.</param>
private void MoleculeShowBackboneChanged(object sender, EventArgs e)
{
}
}
} | {
"content_hash": "6c0168a7883390a4ced64a3630daf8d3",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 97,
"avg_line_length": 32.72463768115942,
"alnum_prop": 0.5748449955713021,
"repo_name": "kobush/ModernMoleculeViewer",
"id": "f3cf7f49a94a830561a97d25b42024efdae9589b",
"size": "2258",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "win81/src/ModernMoleculeViewer.Shared/Model/CAlpha.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "438056"
},
{
"name": "FLUX",
"bytes": "7912"
}
],
"symlink_target": ""
} |
"""Grow.dev setup."""
import re
from setuptools import find_packages
from setuptools import setup
DEP_RE = re.compile(r'([\S]*)\s?=\s? [\"\']?([^\'\"]*)[\"\']?', re.IGNORECASE)
INSTALL_REQ = []
with open('Pipfile') as pipfile:
in_dep_section = False
for line in pipfile.readlines():
line = line.strip()
if not line or line.startswith('#'):
continue
if in_dep_section:
if line.startswith('['):
in_dep_section = False
continue
line_match = DEP_RE.match(line)
if line_match:
INSTALL_REQ.append(
'{}{}'.format(line_match.group(1).strip('"'), line_match.group(2)))
elif line == '[packages]':
in_dep_section = True
setup(
name='grow',
version='2.2.3',
description=(
'Develop everywhere and deploy anywhere: a declarative '
'site generator for rapid, high-quality web site production.'
),
long_description=open('description.txt').read().strip(),
url='https://grow.dev',
zip_safe=False,
license='MIT',
author='Grow.dev Authors',
author_email='[email protected]',
include_package_data=True,
packages=find_packages(exclude=[
'lib*',
'node_modules',
]),
install_requires=INSTALL_REQ,
python_requires='>=3.3',
entry_points="""
[console_scripts]
grow=grow.cli:main
""",
keywords=[
'grow',
'cms',
'static site generator',
'content management'
],
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
])
| {
"content_hash": "c32c63a0aef3df61c495c7e43b7de964",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 87,
"avg_line_length": 29.191176470588236,
"alnum_prop": 0.5546599496221662,
"repo_name": "grow/grow",
"id": "199e2ed5543d4da0c60d840c75a44290666b7aba",
"size": "1985",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "setup.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "377"
},
{
"name": "Dockerfile",
"bytes": "2301"
},
{
"name": "HTML",
"bytes": "12074"
},
{
"name": "JavaScript",
"bytes": "5183"
},
{
"name": "Makefile",
"bytes": "2962"
},
{
"name": "Python",
"bytes": "1102607"
},
{
"name": "Sass",
"bytes": "7080"
},
{
"name": "Shell",
"bytes": "1835"
}
],
"symlink_target": ""
} |
package com.rethinkdb.gen.ast;
import com.rethinkdb.gen.proto.TermType;
import com.rethinkdb.gen.exc.ReqlDriverError;
import com.rethinkdb.model.Arguments;
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.ast.ReqlAst;
public class Ceil extends ReqlExpr {
public Ceil(Object arg) {
this(new Arguments(arg), null);
}
public Ceil(Arguments args){
this(args, null);
}
public Ceil(Arguments args, OptArgs optargs) {
super(TermType.CEIL, args, optargs);
}
}
| {
"content_hash": "85bdc043d7481b4c4bfd983717256121",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 50,
"avg_line_length": 21.458333333333332,
"alnum_prop": 0.6990291262135923,
"repo_name": "JackieXie168/rethinkdb",
"id": "53afd64a0dc18ea16b529023442aaad62c8023ce",
"size": "683",
"binary": false,
"copies": "11",
"ref": "refs/heads/next",
"path": "drivers/java/src/main/java/com/rethinkdb/gen/ast/Ceil.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AppleScript",
"bytes": "2597"
},
{
"name": "C",
"bytes": "76090"
},
{
"name": "C++",
"bytes": "17498962"
},
{
"name": "CSS",
"bytes": "403688"
},
{
"name": "CoffeeScript",
"bytes": "540635"
},
{
"name": "HTML",
"bytes": "72953"
},
{
"name": "Haskell",
"bytes": "13234"
},
{
"name": "Java",
"bytes": "1988751"
},
{
"name": "JavaScript",
"bytes": "675173"
},
{
"name": "Makefile",
"bytes": "63841"
},
{
"name": "Perl",
"bytes": "5623"
},
{
"name": "Python",
"bytes": "4413867"
},
{
"name": "Roff",
"bytes": "572"
},
{
"name": "Ruby",
"bytes": "144592"
},
{
"name": "Shell",
"bytes": "62610"
},
{
"name": "XSLT",
"bytes": "11791"
}
],
"symlink_target": ""
} |
<?php
namespace Gentor\BnpPF\Facades;
use Illuminate\Support\Facades\Facade;
/**
* Class Bnp
*
* @package Gentor\BnpPF\Facades
*/
class Bnp extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'bnp';
}
}
| {
"content_hash": "402c989d78cd881c1a7613d90535a0fd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 49,
"avg_line_length": 14.956521739130435,
"alnum_prop": 0.6162790697674418,
"repo_name": "gentor/bnp-paribas-pf",
"id": "897e684b458fd36fb8512c61b4214636a4720d0b",
"size": "344",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Facades/Bnp.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "9203"
}
],
"symlink_target": ""
} |
import json
import os
import pstats
import shutil
import sys
import tempfile
import unittest
from io import StringIO
from subprocess import Popen, PIPE
from scrapy.utils.test import get_testenv
class CmdlineTest(unittest.TestCase):
def setUp(self):
self.env = get_testenv()
self.env['SCRAPY_SETTINGS_MODULE'] = 'tests.test_cmdline.settings'
def _execute(self, *new_args, **kwargs):
encoding = getattr(sys.stdout, 'encoding') or 'utf-8'
args = (sys.executable, '-m', 'scrapy.cmdline') + new_args
proc = Popen(args, stdout=PIPE, stderr=PIPE, env=self.env, **kwargs)
comm = proc.communicate()[0].strip()
return comm.decode(encoding)
def test_default_settings(self):
self.assertEqual(self._execute('settings', '--get', 'TEST1'), 'default')
def test_override_settings_using_set_arg(self):
self.assertEqual(self._execute('settings', '--get', 'TEST1', '-s',
'TEST1=override'), 'override')
def test_override_settings_using_envvar(self):
self.env['SCRAPY_TEST1'] = 'override'
self.assertEqual(self._execute('settings', '--get', 'TEST1'), 'override')
def test_profiling(self):
path = tempfile.mkdtemp()
filename = os.path.join(path, 'res.prof')
try:
self._execute('version', '--profile', filename)
self.assertTrue(os.path.exists(filename))
out = StringIO()
stats = pstats.Stats(filename, stream=out)
stats.print_stats()
out.seek(0)
stats = out.read()
self.assertIn(os.path.join('scrapy', 'commands', 'version.py'),
stats)
self.assertIn('tottime', stats)
finally:
shutil.rmtree(path)
def test_override_dict_settings(self):
EXT_PATH = "tests.test_cmdline.extensions.DummyExtension"
EXTENSIONS = {EXT_PATH: 200}
settingsstr = self._execute('settings', '--get', 'EXTENSIONS', '-s',
'EXTENSIONS=' + json.dumps(EXTENSIONS))
# XXX: There's gotta be a smarter way to do this...
self.assertNotIn("...", settingsstr)
for char in ("'", "<", ">", 'u"'):
settingsstr = settingsstr.replace(char, '"')
settingsdict = json.loads(settingsstr)
self.assertCountEqual(settingsdict.keys(), EXTENSIONS.keys())
self.assertEqual(200, settingsdict[EXT_PATH])
| {
"content_hash": "0ad22808ff5ce08a57ce405cb91362b4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 81,
"avg_line_length": 37.68181818181818,
"alnum_prop": 0.5930840369923602,
"repo_name": "eLRuLL/scrapy",
"id": "da99a6be8289471b0ae8337d0795263ae633fa05",
"size": "2487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_cmdline/__init__.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "2800"
},
{
"name": "Python",
"bytes": "1518287"
},
{
"name": "Roff",
"bytes": "2010"
},
{
"name": "Shell",
"bytes": "259"
}
],
"symlink_target": ""
} |
Copies files from a filesystem location and mass-copies them to all available flash drives
| {
"content_hash": "06014501a8092e1ddc23d85ee9e274da",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 90,
"avg_line_length": 91,
"alnum_prop": 0.8351648351648352,
"repo_name": "jpsenior/usb-copy-tool",
"id": "4e3ce8e630734ca578d6fb89a500567a10ea4ac2",
"size": "107",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "3222"
}
],
"symlink_target": ""
} |
#pragma once
#include <cstdint>
#include <type_traits>
#include "Export.hpp"
namespace acid {
template<typename T>
class Vector3;
/**
* @brief Holds a 2-tuple vector.
* @tparam T The value type.
*/
template<typename T>
class Vector2 {
public:
/**
* Constructor for Vector2.
*/
constexpr Vector2() = default;
/**
* Constructor for Vector2.
* @param a The value to set all components to.
*/
constexpr explicit Vector2(const T &a);
/**
* Constructor for Vector2.
* @param x Start x.
* @param y Start y.
*/
constexpr Vector2(const T &x, const T &y);
/**
* Constructor for Vector2.
* @tparam K The x type.
* @tparam J The y type.
* @param x Start x.
* @param y Start y.
*/
template<typename K, typename J>
constexpr Vector2(const K &x, const J &y);
/**
* Constructor for Vector2.
* @tparam K The sources type.
* @param source Creates this vector out of a existing vector.
*/
template<typename K>
constexpr Vector2(const Vector2<K> &source);
/**
* Constructor for Vector3.
* @tparam K The sources type.
* @param source Creates this vector out of a existing vector.
*/
template<typename K>
constexpr Vector2(const Vector3<K> &source);
/**
* Adds this vector to another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The resultant vector.
*/
template<typename K>
constexpr auto Add(const Vector2<K> &other) const;
/**
* Subtracts this vector to another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The resultant vector.
*/
template<typename K>
constexpr auto Subtract(const Vector2<K> &other) const;
/**
* Multiplies this vector with another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The resultant vector.
*/
template<typename K>
constexpr auto Multiply(const Vector2<K> &other) const;
/**
* Divides this vector by another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The resultant vector.
*/
template<typename K>
constexpr auto Divide(const Vector2<K> &other) const;
/**
* Calculates the angle between this vector and another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The angle, in radians.
*/
template<typename K>
constexpr auto Angle(const Vector2<K> &other) const;
/**
* Calculates the dot product of the this vector and another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The dot product.
*/
template<typename K>
constexpr auto Dot(const Vector2<K> &other) const;
/**
* Calculates the linear interpolation between this vector and another vector.
* @tparam K The others type.
* @tparam J The progression type.
* @param other The other quaternion.
* @param progression The progression.
* @return Left lerp right.
*/
template<typename K, typename J = float>
constexpr auto Lerp(const Vector2<K> &other, const J &progression) const;
/**
* Scales this vector by a scalar.
* @tparam K The scalar type.
* @param scalar The scalar value.
* @return The scaled vector.
*/
template<typename K = float>
constexpr auto Scale(const K &scalar) const;
/**
* Rotates this vector by a angle around the origin.
* @tparam K The angle type.
* @param angle The angle to rotate by, in radians.
* @return The rotated vector.
*/
template<typename K = float>
auto Rotate(const K &angle) const;
/**
* Rotates this vector by a angle around a rotation axis.
* @tparam K The angle type.
* @tparam J The rotation axis type.
* @param angle The angle to rotate by, in radians.
* @param rotationAxis The point to rotate the vector around.
* @return The rotated vector.
*/
template<typename K = float, typename J>
auto Rotate(const K &angle, const Vector2<J> &rotationAxis) const;
/**
* Normalizes this vector.
* @return The normalized vector.
*/
auto Normalize() const;
/**
* Gets the length squared of this vector.
* @return The length squared.
*/
constexpr auto LengthSquared() const;
/**
* Gets the length of this vector.
* @return The length.
*/
auto Length() const;
/**
* Gets the absolute value of every component in this vector.
* @return The absolute value of this vector.
*/
auto Abs() const;
/**
* Gets the minimal value in this vector.
* @return The minimal components.
*/
constexpr auto Min() const;
/**
* Gets the maximal value in this vector.
* @return The maximal components.
*/
constexpr auto Max() const;
/**
* Gets the minimal and maximal values in the vector.
* @return The minimal and maximal components.
*/
constexpr auto MinMax() const;
/**
* Gets the lowest vector size between this vector and other.
* @tparam K The others type.
* @param other The other vector to get values from.
* @return The lowest vector.
*/
template<typename K>
constexpr auto Min(const Vector2<K> &other);
/**
* Gets the maximum vector size between this vector and other.
* @tparam K The others type.
* @param other The other vector to get values from.
* @return The maximum vector.
*/
template<typename K>
constexpr auto Max(const Vector2<K> &other);
/**
* Gets the distance between this vector and another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The squared distance.
*/
template<typename K>
constexpr auto DistanceSquared(const Vector2<K> &other) const;
/**
* Gets the between this vector and another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The distance.
*/
template<typename K>
auto Distance(const Vector2<K> &other) const;
/**
* Gets the vector distance between this vector and another vector.
* @tparam K The others type.
* @param other The other vector.
* @return The vector distance.
*/
template<typename K>
constexpr auto DistanceVector(const Vector2<K> &other) const;
/**
* Gets if this vector is in a triangle.
* @tparam K The types.
* @param v1 The first triangle vertex.
* @param v2 The second triangle vertex.
* @param v3 The third triangle vertex.
* @return If this vector is in a triangle.
*/
template<typename K>
constexpr bool InTriangle(const Vector2<K> &v1, const Vector2<K> &v2, const Vector2<K> &v3) const;
/**
* Gradually changes this vector to a target.
* @param target The target vector.
* @param rate The rate to go from current to the target.
* @return The changed vector.
*/
template<typename K, typename J>
constexpr auto SmoothDamp(const Vector2<K> &target, const Vector2<J> &rate) const;
/**
* Converts from rectangular to spherical coordinates, this vector is in cartesian (x, y).
* @return The polar coordinates (radius, theta).
*/
auto CartesianToPolar() const;
/**
* Converts from spherical to rectangular coordinates, this vector is in polar (radius, theta).
* @return The cartesian coordinates (x, y).
*/
auto PolarToCartesian() const;
constexpr const T &operator[](uint32_t index) const;
constexpr T &operator[](uint32_t index);
template<typename K>
constexpr bool operator==(const Vector2<K> &other) const;
template<typename K>
constexpr bool operator!=(const Vector2<K> &other) const;
template<typename U = T>
constexpr std::enable_if_t<std::is_signed_v<U>, Vector2> operator-() const;
template<typename U = T>
constexpr std::enable_if_t<std::is_integral_v<U>, Vector2> operator~() const;
template<typename K>
constexpr Vector2 &operator+=(const Vector2<K> &other);
template<typename K>
constexpr Vector2 &operator-=(const Vector2<K> &other);
template<typename K>
constexpr Vector2 &operator*=(const Vector2<K> &other);
template<typename K>
constexpr Vector2 &operator/=(const Vector2<K> &other);
constexpr Vector2 &operator+=(const T &other);
constexpr Vector2 &operator-=(const T &other);
constexpr Vector2 &operator*=(const T &other);
constexpr Vector2 &operator/=(const T &other);
ACID_EXPORT static const Vector2 Zero;
ACID_EXPORT static const Vector2 One;
ACID_EXPORT static const Vector2 Infinity;
ACID_EXPORT static const Vector2 Left;
ACID_EXPORT static const Vector2 Right;
ACID_EXPORT static const Vector2 Up;
ACID_EXPORT static const Vector2 Down;
T x = 0, y = 0;
};
using Vector2f = Vector2<float>;
using Vector2d = Vector2<double>;
using Vector2i = Vector2<int32_t>;
using Vector2ui = Vector2<uint32_t>;
using Vector2us = Vector2<uint16_t>;
}
#include "Vector2.inl"
| {
"content_hash": "4914e32a3375756454c7b8c7ffc32ba5",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 99,
"avg_line_length": 26.615625,
"alnum_prop": 0.6947281906774686,
"repo_name": "Equilibrium-Games/Flounder",
"id": "199fc55ca095d43cd4c4987a6a0c9ad41d903cda",
"size": "8517",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sources/Maths/Vector2.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "662"
},
{
"name": "C",
"bytes": "1107542"
},
{
"name": "C++",
"bytes": "2927004"
},
{
"name": "CMake",
"bytes": "31731"
},
{
"name": "GLSL",
"bytes": "47138"
},
{
"name": "Shell",
"bytes": "924"
}
],
"symlink_target": ""
} |
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel;
using PapillonEditor.Document;
namespace PapillonEditor.Rendering
{
/// <summary>
/// Represents a collapsed line section.
/// Use the Uncollapse() method to uncollapse the section.
/// </summary>
public sealed class CollapsedLineSection
{
DocumentLine start, end;
HeightTree heightTree;
#if DEBUG
internal string ID;
static int nextId;
#else
const string ID = "";
#endif
internal CollapsedLineSection(HeightTree heightTree, DocumentLine start, DocumentLine end)
{
this.heightTree = heightTree;
this.start = start;
this.end = end;
#if DEBUG
unchecked {
this.ID = " #" + (nextId++);
}
#endif
}
/// <summary>
/// Gets if the document line is collapsed.
/// This property initially is true and turns to false when uncollapsing the section.
/// </summary>
public bool IsCollapsed {
get { return start != null; }
}
/// <summary>
/// Gets the start line of the section.
/// When the section is uncollapsed or the text containing it is deleted,
/// this property returns null.
/// </summary>
public DocumentLine Start {
get { return start; }
internal set { start = value; }
}
/// <summary>
/// Gets the end line of the section.
/// When the section is uncollapsed or the text containing it is deleted,
/// this property returns null.
/// </summary>
public DocumentLine End {
get { return end; }
internal set { end = value; }
}
/// <summary>
/// Uncollapses the section.
/// This causes the Start and End properties to be set to null!
/// Does nothing if the section is already uncollapsed.
/// </summary>
public void Uncollapse()
{
if (start == null)
return;
heightTree.Uncollapse(this);
#if DEBUG
heightTree.CheckProperties();
#endif
start = null;
end = null;
}
/// <summary>
/// Gets a string representation of the collapsed section.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.Int32.ToString")]
public override string ToString()
{
return "[CollapsedSection" + ID + " Start=" + (start != null ? start.LineNumber.ToString() : "null")
+ " End=" + (end != null ? end.LineNumber.ToString() : "null") + "]";
}
}
}
| {
"content_hash": "21422de3f498618316476562d7b16195",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 148,
"avg_line_length": 31.69090909090909,
"alnum_prop": 0.6921973608720596,
"repo_name": "trnglina/Papillon",
"id": "440b06e1c994117ed1cce1b85d3c570ffd84673b",
"size": "3488",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PapillonEditor/Rendering/CollapsedLineSection.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1509111"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "4a63b95c96b28a7811eac36c7aec76f9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "f5074b34fe02c3ca21c8070e0dfa25e6a7aeb146",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fagales/Fagaceae/Quercus/Quercus ithaburensis/ Syn. Quercus hypoleuca/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OmniSharp.Eventing;
using OmniSharp.Options;
using OmniSharp.Utilities;
namespace OmniSharp.Services
{
internal class DotNetCliService : IDotNetCliService
{
const string DOTNET_CLI_UI_LANGUAGE = nameof(DOTNET_CLI_UI_LANGUAGE);
private readonly ILogger _logger;
private readonly IEventEmitter _eventEmitter;
private readonly ConcurrentDictionary<string, object> _locks;
private readonly SemaphoreSlim _semaphore;
public string DotNetPath { get; }
public DotNetCliService(ILoggerFactory loggerFactory, IEventEmitter eventEmitter, IOptions<DotNetCliOptions> dotNetCliOptions, IOmniSharpEnvironment environment)
{
_logger = loggerFactory.CreateLogger<DotNetCliService>();
_eventEmitter = eventEmitter;
_locks = new ConcurrentDictionary<string, object>();
_semaphore = new SemaphoreSlim(Environment.ProcessorCount / 2);
// Check if any of the provided paths have a dotnet executable.
string executableExtension = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty;
foreach (var path in dotNetCliOptions.Value.GetNormalizedLocationPaths(environment))
{
if (File.Exists(Path.Combine(path, $"dotnet{executableExtension}")))
{
// We'll take the first path that has a dotnet executable.
DotNetPath = Path.Combine(path, "dotnet");
break;
}
else
{
_logger.LogInformation($"Provided dotnet CLI path does not contain the dotnet executable: '{path}'.");
}
}
// If we still haven't found a dotnet CLI, check the DOTNET_ROOT environment variable.
if (DotNetPath is null)
{
_logger.LogInformation("Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK");
string dotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
if (!string.IsNullOrEmpty(dotnetRoot) && File.Exists(Path.Combine(dotnetRoot, $"dotnet{executableExtension}")))
{
DotNetPath = Path.Combine(dotnetRoot, "dotnet");
}
}
// If we still haven't found the CLI, use the one on the PATH.
if (DotNetPath is null)
{
_logger.LogInformation("Using the 'dotnet' on the PATH.");
DotNetPath = "dotnet";
}
_logger.LogInformation($"DotNetPath set to {DotNetPath}");
}
private static void RemoveMSBuildEnvironmentVariables(IDictionary<string, string> environment)
{
// Remove various MSBuild environment variables set by OmniSharp to ensure that
// the .NET CLI is not launched with the wrong values.
environment.Remove("MSBUILD_EXE_PATH");
environment.Remove("MSBuildExtensionsPath");
}
public Task RestoreAsync(string workingDirectory, string arguments = null, Action onFailure = null)
{
return Task.Factory.StartNew(() =>
{
_logger.LogInformation($"Begin dotnet restore in '{workingDirectory}'");
var restoreLock = _locks.GetOrAdd(workingDirectory, new object());
lock (restoreLock)
{
var exitStatus = new ProcessExitStatus(-1);
_eventEmitter.RestoreStarted(workingDirectory);
_semaphore.Wait();
try
{
// A successful restore will update the project lock file which is monitored
// by the dotnet project system which eventually update the Roslyn model
exitStatus = ProcessHelper.Run(DotNetPath, $"restore {arguments}", workingDirectory, updateEnvironment: RemoveMSBuildEnvironmentVariables);
}
finally
{
_semaphore.Release();
_locks.TryRemove(workingDirectory, out _);
_eventEmitter.RestoreFinished(workingDirectory, exitStatus.Succeeded);
if (exitStatus.Failed && onFailure != null)
{
onFailure();
}
_logger.LogInformation($"Finish restoring project {workingDirectory}. Exit code {exitStatus}");
}
}
});
}
public Process Start(string arguments, string workingDirectory)
{
var startInfo = new ProcessStartInfo(DotNetPath, arguments)
{
WorkingDirectory = workingDirectory,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
};
RemoveMSBuildEnvironmentVariables(startInfo.Environment);
return Process.Start(startInfo);
}
public DotNetVersion GetVersion(string workingDirectory = null)
{
// Ensure that we set the DOTNET_CLI_UI_LANGUAGE environment variable to "en-US" before
// running 'dotnet --version'. Otherwise, we may get localized results.
var originalValue = Environment.GetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE);
Environment.SetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE, "en-US");
try
{
Process process;
try
{
process = Start("--version", workingDirectory);
}
catch
{
return DotNetVersion.FailedToStartError;
}
if (process.HasExited)
{
return DotNetVersion.FailedToStartError;
}
var lines = new List<string>();
process.OutputDataReceived += (_, e) =>
{
if (!string.IsNullOrWhiteSpace(e.Data))
{
lines.Add(e.Data);
}
};
process.ErrorDataReceived += (_, e) =>
{
if (!string.IsNullOrWhiteSpace(e.Data))
{
lines.Add(e.Data);
}
};
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
return DotNetVersion.Parse(lines);
}
finally
{
Environment.SetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE, originalValue);
}
}
public DotNetInfo GetInfo(string workingDirectory = null)
{
// Ensure that we set the DOTNET_CLI_UI_LANGUAGE environment variable to "en-US" before
// running 'dotnet --info'. Otherwise, we may get localized results.
var originalValue = Environment.GetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE);
Environment.SetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE, "en-US");
try
{
Process process;
try
{
process = Start("--info", workingDirectory);
}
catch
{
return DotNetInfo.Empty;
}
if (process.HasExited)
{
return DotNetInfo.Empty;
}
var lines = new List<string>();
process.OutputDataReceived += (_, e) =>
{
if (!string.IsNullOrWhiteSpace(e.Data))
{
lines.Add(e.Data);
}
};
process.BeginOutputReadLine();
process.WaitForExit();
return DotNetInfo.Parse(lines);
}
finally
{
Environment.SetEnvironmentVariable(DOTNET_CLI_UI_LANGUAGE, originalValue);
}
}
/// <summary>
/// Checks to see if this is a "legacy" .NET CLI. If true, this .NET CLI supports project.json
/// development; otherwise, it supports .csproj development.
/// </summary>
public bool IsLegacy(string workingDirectory = null)
{
var version = GetVersion(workingDirectory);
return IsLegacy(version);
}
/// <summary>
/// Determines whether the specified version is from a "legacy" .NET CLI.
/// If true, this .NET CLI supports project.json development; otherwise, it supports .csproj development.
/// </summary>
public bool IsLegacy(DotNetVersion dotnetVersion)
{
if (dotnetVersion.HasError)
{
return false;
}
var version = dotnetVersion.Version;
if (version.Major < 1)
{
return true;
}
if (version.Major == 1 &&
version.Minor == 0 &&
version.Patch == 0)
{
if (version.PreReleaseLabel.StartsWith("preview1") ||
version.PreReleaseLabel.StartsWith("preview2"))
{
return true;
}
}
return false;
}
}
}
| {
"content_hash": "162d57639bf3c6d97d0185b187f59203",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 169,
"avg_line_length": 36.47636363636364,
"alnum_prop": 0.5283620775595653,
"repo_name": "OmniSharp/omnisharp-roslyn",
"id": "ebd527b0b29c6acf6d74c9898d02e2fdfcfaed94",
"size": "10033",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/OmniSharp.Host/Services/DotNetCliService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "27"
},
{
"name": "Batchfile",
"bytes": "80"
},
{
"name": "C#",
"bytes": "2708104"
},
{
"name": "F#",
"bytes": "81"
},
{
"name": "PowerShell",
"bytes": "7629"
},
{
"name": "Shell",
"bytes": "3930"
}
],
"symlink_target": ""
} |
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import dilate
from plantcv.plantcv import params
from plantcv.plantcv import fatal_error
from skimage import feature
import numpy as np
import cv2
import os
def canny_edge_detect(img, mask=None, sigma=1.0, low_thresh=None, high_thresh=None, thickness=1,
mask_color=None, use_quantiles=False):
"""
Edge filter an image using the Canny algorithm.
Inputs:
img = RGB or grayscale image data
mask = Mask to limit the application of Canny to a certain area, takes a binary img. (OPTIONAL)
sigma = Standard deviation of the Gaussian filter
low_thresh = Lower bound for hysteresis thresholding (linking edges). If None (default) then low_thresh is set to
10% of the image's max (OPTIONAL)
high_thresh = Upper bound for hysteresis thresholding (linking edges). If None (default) then high_thresh is set
to 20% of the image's max (OPTIONAL)
thickness = How thick the edges should appear, default thickness=1 (OPTIONAL)
mask_color = Color of the mask provided; either None (default), 'white', or 'black'
use_quantiles = Default is False, if True then treat low_thresh and high_thresh as quantiles of the edge magnitude
image, rather than the absolute edge magnitude values. If True then thresholds range is [0,1].
(OPTIONAL)
Returns:
bin_img = Thresholded, binary image
:param img: numpy.ndarray
:param mask: numpy.ndarray
:param sigma = float
:param low_thresh: float
:param high_thresh: float
:param thickness: int
:param mask_color: str
:param use_quantiles: bool
:return bin_img: numpy.ndarray
Reference: Canny, J., A Computational Approach To Edge Detection, IEEE Trans.
Pattern Analysis and Machine Intelligence, 8:679-714, 1986
Originally part of CellProfiler, code licensed under both GPL and BSD licenses.
Website: http://www.cellprofiler.org
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
All rights reserved.
Original author: Lee Kamentsky
"""
# Check if the image is grayscale; if color img then make it grayscale
dimensions = np.shape(img)
if len(dimensions) == 3:
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# skimage needs a bool mask
if mask is not None:
if mask_color.upper() == 'WHITE':
mask = np.array(mask, bool)
elif mask_color.upper() == 'BLACK':
mask = cv2.bitwise_not(mask)
mask = np.array(mask, bool)
else:
fatal_error('Mask was provided but mask_color ' + str(mask_color) + ' is not "white" or "black"!')
# Run Canny edge detection on the grayscale image
bool_img = feature.canny(img, sigma, low_thresh, high_thresh, mask, use_quantiles)
# Skimage returns a bool image so convert it
bin_img = np.copy(bool_img.astype(np.uint8) * 255)
# Adjust line thickness
if thickness != 1:
debug = params.debug
params.debug = None
bin_img = dilate(bin_img, thickness, 1)
params.debug = debug
# Print or plot the binary image
_debug(visual=bin_img,
filename=os.path.join(params.debug_outdir, (str(params.device) + '_canny_edge_detect.png')),
cmap='gray')
return bin_img
| {
"content_hash": "120b978c95e45612f5c2423de97473e3",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 120,
"avg_line_length": 40.71764705882353,
"alnum_prop": 0.6579023403640566,
"repo_name": "danforthcenter/plantcv",
"id": "753dab985d5ba58e2b82411c42ec95d611a6388e",
"size": "3485",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "plantcv/plantcv/canny_edge_detect.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "1112"
},
{
"name": "Python",
"bytes": "898011"
},
{
"name": "R",
"bytes": "1327"
},
{
"name": "Shell",
"bytes": "3348"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace MiniHttp.RequestHandlers.Processing
{
public class StreamLineSource : LineSource
{
private readonly Stream _stream;
public StreamLineSource(Stream stream, ISourceResolver resolver)
: base(resolver)
{
_stream = stream;
}
protected override void Dispose(bool disposing)
{
if (disposing)
_stream.Dispose();
}
/// <remarks>
/// Obviously, getting an enumerator while there is still another enumerator of this instance
/// in use, is not a good idea and would result in very 'interesting' behavior - since the
/// underlying stream itself cannot be in two places at once.
/// </remarks>
public override IEnumerator<Line> GetEnumerator()
{
var reader = new StreamReader(_stream);
string line;
while ((line = reader.ReadLine()) != null)
{
yield return new Line(this, line);
}
if (_stream.CanSeek)
_stream.Seek(0, SeekOrigin.Begin);
}
}
}
| {
"content_hash": "054ef8fae36331cb51cc4f38c501211e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 101,
"avg_line_length": 28.790697674418606,
"alnum_prop": 0.5767366720516963,
"repo_name": "lord-executor/MiniHttp",
"id": "0d7f67839bdaa1f0773d034257ef3c2046e7cde9",
"size": "1240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/MiniHttp/RequestHandlers/Processing/StreamLineSource.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "138770"
},
{
"name": "PowerShell",
"bytes": "3741"
},
{
"name": "XML",
"bytes": "3330"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.hbase.procedure;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
/**
* Provides the common setup framework and runtime services for globally
* barriered procedure invocation from HBase services.
* @param <E> the specific procedure management extension that a concrete
* implementation provides
*/
@InterfaceAudience.Private
@InterfaceStability.Evolving
public abstract class ProcedureManagerHost<E extends ProcedureManager> {
public static final String REGIONSERVER_PROCEDURE_CONF_KEY =
"hbase.procedure.regionserver.classes";
public static final String MASTER_PROCEUDRE_CONF_KEY =
"hbase.procedure.master.classes";
private static final Log LOG = LogFactory.getLog(ProcedureManagerHost.class);
protected Set<E> procedures = new HashSet<E>();
/**
* Load system procedures. Read the class names from configuration.
* Called by constructor.
*/
protected void loadUserProcedures(Configuration conf, String confKey) {
Class<?> implClass = null;
// load default procedures from configure file
String[] defaultProcClasses = conf.getStrings(confKey);
if (defaultProcClasses == null || defaultProcClasses.length == 0)
return;
List<E> configured = new ArrayList<E>();
for (String className : defaultProcClasses) {
className = className.trim();
ClassLoader cl = this.getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(cl);
try {
implClass = cl.loadClass(className);
configured.add(loadInstance(implClass));
LOG.info("User procedure " + className + " was loaded successfully.");
} catch (ClassNotFoundException e) {
LOG.warn("Class " + className + " cannot be found. " +
e.getMessage());
} catch (IOException e) {
LOG.warn("Load procedure " + className + " failed. " +
e.getMessage());
}
}
// add entire set to the collection
procedures.addAll(configured);
}
@SuppressWarnings("unchecked")
public E loadInstance(Class<?> implClass) throws IOException {
// create the instance
E impl;
Object o = null;
try {
o = implClass.newInstance();
impl = (E)o;
} catch (InstantiationException e) {
throw new IOException(e);
} catch (IllegalAccessException e) {
throw new IOException(e);
}
return impl;
}
// Register a procedure manager object
public void register(E obj) {
procedures.add(obj);
}
public Set<E> getProcedureManagers() {
Set<E> returnValue = new HashSet<E>();
for (E e: procedures) {
returnValue.add(e);
}
return returnValue;
}
public abstract void loadProcedures(Configuration conf);
}
| {
"content_hash": "3a8f14fa14ecefff5254b5846687d00a",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 79,
"avg_line_length": 30.58,
"alnum_prop": 0.697187704381949,
"repo_name": "intel-hadoop/hbase-rhino",
"id": "bcd87bbd7291cd3dc91b0aefc8d197266728614d",
"size": "3864",
"binary": false,
"copies": "6",
"ref": "refs/heads/tokenauth",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ProcedureManagerHost.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "23023"
},
{
"name": "C",
"bytes": "28617"
},
{
"name": "C++",
"bytes": "56137"
},
{
"name": "CMake",
"bytes": "10933"
},
{
"name": "CSS",
"bytes": "9389"
},
{
"name": "HTML",
"bytes": "71250"
},
{
"name": "Java",
"bytes": "19126293"
},
{
"name": "JavaScript",
"bytes": "2694"
},
{
"name": "Makefile",
"bytes": "1409"
},
{
"name": "PHP",
"bytes": "413443"
},
{
"name": "Perl",
"bytes": "383793"
},
{
"name": "Protocol Buffer",
"bytes": "123189"
},
{
"name": "Python",
"bytes": "32758"
},
{
"name": "Ruby",
"bytes": "319136"
},
{
"name": "Shell",
"bytes": "155845"
},
{
"name": "Thrift",
"bytes": "39018"
},
{
"name": "XSLT",
"bytes": "4370"
}
],
"symlink_target": ""
} |
use discrete::{DiscreteDist32};
use env::{Env, DiscreteEnv, EnvInputRepr, EnvRepr, EnvConvert, Action, DiscreteAction, Response, Value, Episode, EpisodeStep};
use opt::pg_new::{BasePolicyGrad};
use densearray::prelude::*;
use operator::prelude::*;
use operator::rw::{ReadBuffer, ReadAccumulateBuffer, WriteBuffer, AccumulateBuffer};
use rng::xorshift::{Xorshiftplus128Rng};
use sharedmem::{RwSlice, SharedMem, SharedSlice};
use sharedmem::sync::{SpinBarrier};
use rand::{Rng, thread_rng};
use std::cell::{RefCell};
use std::cmp::{max, min};
use std::intrinsics::{volatile_copy_memory};
use std::marker::{PhantomData};
use std::ops::{Deref};
use std::rc::{Rc};
use std::sync::{Arc, Mutex};
use std::sync::atomic::{AtomicUsize, Ordering};
#[derive(RustcEncodable)]
pub struct A3CTraceRecord {
pub iter: usize,
pub step_count: usize,
pub avg_value: f32,
pub value_fn_avg_loss: f32,
pub elapsed: f64,
}
#[derive(Clone, Copy, Debug)]
//pub struct AdamA3CConfig<E, V, EvalV> where E: 'static + Env, V: Value<Res=E::Response>, EvalV: Value<Res=E::Response> {
pub struct AdamA3CConfig<Init, VCfg, EvalVCfg> {
pub batch_sz: usize,
pub minibatch_sz: usize,
pub step_size: f32,
pub grad_clip: Option<f32>,
pub v_step_size: f32,
pub v_grad_clip: Option<f32>,
pub gamma1: f32,
pub gamma2: f32,
pub epsilon: f32,
pub max_horizon: usize,
pub update_steps: Option<usize>,
pub impute_final: bool,
pub normal_adv: bool,
pub init_cfg: Init,
pub value_cfg: VCfg,
pub eval_cfg: EvalVCfg,
}
#[derive(Clone)]
pub struct AdamA3CBuilder
/*pub struct AdamA3CBuilder<E, V, EvalV>
where E: 'static + Env + EnvInputRepr<[f32]> + SampleExtractInput<[f32]> + Clone,
E::Init: Clone,
E::Action: DiscreteAction,
V: Value<Res=E::Response>,
EvalV: Value<Res=E::Response>,*/
{
//cfg: AdamA3CConfig<E, V, EvalV>,
num_workers: usize,
step_count: Arc<AtomicUsize>,
shared_iters: Arc<AtomicUsize>,
shared_bar: Arc<SpinBarrier>,
async_param: Arc<Mutex<Option<SharedMem<f32>>>>,
async_gmean: Arc<Mutex<Option<SharedMem<f32>>>>,
async_gvar: Arc<Mutex<Option<SharedMem<f32>>>>,
async_vparam: Arc<Mutex<Option<SharedMem<f32>>>>,
async_vgmean: Arc<Mutex<Option<SharedMem<f32>>>>,
async_vgvar: Arc<Mutex<Option<SharedMem<f32>>>>,
}
impl AdamA3CBuilder
/*impl<E, V, EvalV> AdamA3CBuilder<E, V, EvalV>
where E: 'static + Env + EnvInputRepr<[f32]> + SampleExtractInput<[f32]> + Clone,
E::Init: Clone,
E::Action: DiscreteAction,
V: Value<Res=E::Response>,
EvalV: Value<Res=E::Response>,*/
{
pub fn new(num_workers: usize) -> Self {
//pub fn new(cfg: AdamA3CConfig<E, V, EvalV>, num_workers: usize) -> Self {
//assert!(cfg.epsilon * cfg.epsilon > 0.0);
AdamA3CBuilder{
//cfg: cfg,
num_workers: num_workers,
step_count: Arc::new(AtomicUsize::new(0)),
shared_iters: Arc::new(AtomicUsize::new(0)),
shared_bar: Arc::new(SpinBarrier::new(num_workers)),
async_param: Arc::new(Mutex::new(None)),
async_gmean: Arc::new(Mutex::new(None)),
async_gvar: Arc::new(Mutex::new(None)),
async_vparam: Arc::new(Mutex::new(None)),
async_vgmean: Arc::new(Mutex::new(None)),
async_vgvar: Arc::new(Mutex::new(None)),
}
}
//pub fn into_worker<E, V, EvalV, Policy, ValueFn>(self, cfg: AdamA3CConfig<E, V, EvalV>, worker_rank: usize, policy: Rc<RefCell<Policy>>, value_fn: Rc<RefCell<ValueFn>>) -> AdamA3CWorker<E, V, EvalV, Policy, ValueFn>
pub fn into_worker<E, V, EvalV, Policy, ValueFn>(self, cfg: AdamA3CConfig<E::Init, V::Cfg, EvalV::Cfg>, worker_rank: usize, policy: Rc<RefCell<Policy>>, value_fn: Rc<RefCell<ValueFn>>) -> AdamA3CWorker<E, V, EvalV, Policy, ValueFn>
where E: 'static + Env + EnvInputRepr<[f32]> + SampleExtractInput<[f32]> + Clone,
E::Action: DiscreteAction,
V: Value<Res=E::Response>,
EvalV: Value<Res=E::Response>,
Policy: DiffLoss<SampleItem, IoBuf=[f32]>,
ValueFn: DiffLoss<SampleItem, IoBuf=[f32]>,
{
let batch_sz = cfg.batch_sz;
let minibatch_sz = cfg.minibatch_sz;
let max_horizon = cfg.max_horizon;
let mut rng = Xorshiftplus128Rng::new(&mut thread_rng());
let base_pg = BasePolicyGrad::new(minibatch_sz, &cfg.init_cfg, &mut rng);
let eval_pg = BasePolicyGrad::new(minibatch_sz, &cfg.init_cfg, &mut rng);
let pgrad_sz = policy.borrow_mut().diff_param_sz();
let vgrad_sz = value_fn.borrow_mut().diff_param_sz();
let mut param = Vec::with_capacity(pgrad_sz);
param.resize(pgrad_sz, 0.0);
let mut grad = Vec::with_capacity(pgrad_sz);
grad.resize(pgrad_sz, 0.0);
let mut gmean = Vec::with_capacity(pgrad_sz);
gmean.resize(pgrad_sz, 0.0);
let mut gvar = Vec::with_capacity(pgrad_sz);
gvar.resize(pgrad_sz, 0.0);
let mut vparam = Vec::with_capacity(vgrad_sz);
vparam.resize(vgrad_sz, 0.0);
let mut vgrad = Vec::with_capacity(vgrad_sz);
vgrad.resize(vgrad_sz, 0.0);
let mut vgmean = Vec::with_capacity(vgrad_sz);
vgmean.resize(vgrad_sz, 0.0);
let mut vgvar = Vec::with_capacity(vgrad_sz);
vgvar.resize(vgrad_sz, 0.0);
let mut tmp_buf = Vec::with_capacity(max(pgrad_sz, vgrad_sz));
tmp_buf.resize(max(pgrad_sz, vgrad_sz), 0.0);
if worker_rank == 0 {
let mut param = Vec::with_capacity(pgrad_sz);
param.resize(pgrad_sz, 0.0);
let mut gmean = Vec::with_capacity(pgrad_sz);
gmean.resize(pgrad_sz, 0.0);
let mut gvar = Vec::with_capacity(pgrad_sz);
gvar.resize(pgrad_sz, 0.0);
let mut vparam = Vec::with_capacity(vgrad_sz);
vparam.resize(vgrad_sz, 0.0);
let mut vgmean = Vec::with_capacity(vgrad_sz);
vgmean.resize(vgrad_sz, 0.0);
let mut vgvar = Vec::with_capacity(vgrad_sz);
vgvar.resize(vgrad_sz, 0.0);
let mut async_param = self.async_param.lock().unwrap();
let mut async_gmean = self.async_gmean.lock().unwrap();
let mut async_gvar = self.async_gvar.lock().unwrap();
let mut async_vparam = self.async_vparam.lock().unwrap();
let mut async_vgmean = self.async_vgmean.lock().unwrap();
let mut async_vgvar = self.async_vgvar.lock().unwrap();
*async_param = Some(SharedMem::new(param));
*async_gmean = Some(SharedMem::new(gmean));
*async_gvar = Some(SharedMem::new(gvar));
*async_vparam = Some(SharedMem::new(vparam));
*async_vgmean = Some(SharedMem::new(vgmean));
*async_vgvar = Some(SharedMem::new(vgvar));
}
self.shared_bar.wait();
let worker = AdamA3CWorker{
cfg: cfg,
worker_rank: worker_rank,
num_workers: self.num_workers,
grad_sz: pgrad_sz,
vgrad_sz: vgrad_sz,
step_count: self.step_count,
shared_iters: self.shared_iters,
shared_bar: self.shared_bar,
iter_counter: 0,
rng: rng,
base_pg: base_pg,
eval_pg: eval_pg,
policy: policy,
value_fn: value_fn,
cache: Vec::with_capacity(batch_sz),
vcache: Vec::with_capacity(batch_sz),
async_param: self.async_param.lock().unwrap().as_ref().unwrap().as_slice(),
async_gmean: self.async_gmean.lock().unwrap().as_ref().unwrap().as_slice(),
async_gvar: self.async_gvar.lock().unwrap().as_ref().unwrap().as_slice(),
param: param,
grad: grad,
gmean: gmean,
gvar: gvar,
async_vparam: self.async_vparam.lock().unwrap().as_ref().unwrap().as_slice(),
async_vgmean: self.async_vgmean.lock().unwrap().as_ref().unwrap().as_slice(),
async_vgvar: self.async_vgvar.lock().unwrap().as_ref().unwrap().as_slice(),
vparam: vparam,
vgrad: vgrad,
vgmean: vgmean,
vgvar: vgvar,
tmp_buf: tmp_buf,
};
worker.shared_bar.wait();
worker
}
}
pub struct AdamA3CWorker<E, V, EvalV, Policy, ValueFn>
where E: 'static + Env + EnvInputRepr<[f32]> + SampleExtractInput<[f32]> + Clone,
E::Action: DiscreteAction,
V: Value<Res=E::Response>,
EvalV: Value<Res=E::Response>,
Policy: DiffLoss<SampleItem, IoBuf=[f32]>,
ValueFn: DiffLoss<SampleItem, IoBuf=[f32]>,
{
cfg: AdamA3CConfig<E::Init, V::Cfg, EvalV::Cfg>,
worker_rank: usize,
num_workers: usize,
grad_sz: usize,
vgrad_sz: usize,
step_count: Arc<AtomicUsize>,
shared_iters: Arc<AtomicUsize>,
shared_bar: Arc<SpinBarrier>,
iter_counter: usize,
rng: Xorshiftplus128Rng,
base_pg: BasePolicyGrad<E, V>,
eval_pg: BasePolicyGrad<E, EvalV>,
policy: Rc<RefCell<Policy>>,
value_fn: Rc<RefCell<ValueFn>>,
cache: Vec<SampleItem>,
vcache: Vec<SampleItem>,
async_param: SharedSlice<f32>,
async_gmean: SharedSlice<f32>,
async_gvar: SharedSlice<f32>,
param: Vec<f32>,
grad: Vec<f32>,
gmean: Vec<f32>,
gvar: Vec<f32>,
async_vparam: SharedSlice<f32>,
async_vgmean: SharedSlice<f32>,
async_vgvar: SharedSlice<f32>,
vparam: Vec<f32>,
vgrad: Vec<f32>,
vgmean: Vec<f32>,
vgvar: Vec<f32>,
tmp_buf: Vec<f32>,
}
impl<E, V, EvalV, Policy, ValueFn> AdamA3CWorker<E, V, EvalV, Policy, ValueFn>
where E: 'static + Env + EnvInputRepr<[f32]> + SampleExtractInput<[f32]> + Clone,
E::Action: DiscreteAction,
V: Value<Res=E::Response>,
EvalV: Value<Res=E::Response>,
Policy: DiffLoss<SampleItem, IoBuf=[f32]>,
ValueFn: DiffLoss<SampleItem, IoBuf=[f32]>,
{
pub fn init_param(&mut self, rng: &mut Xorshiftplus128Rng) {
if self.worker_rank == 0 {
let mut policy = self.policy.borrow_mut();
policy.init_param(rng);
policy.store_diff_param(&mut self.param);
unsafe { volatile_copy_memory(self.async_param.as_ptr() as *mut _, self.param.as_ptr(), self.grad_sz) };
println!("DEBUG: |param|: {} {:.6e}", self.grad_sz, self.param.reshape(self.grad_sz).l2_norm());
let mut value_fn = self.value_fn.borrow_mut();
value_fn.init_param(rng);
value_fn.store_diff_param(&mut self.vparam);
unsafe { volatile_copy_memory(self.async_vparam.as_ptr() as *mut _, self.vparam.as_ptr(), self.vgrad_sz) };
println!("DEBUG: |vparam|: {} {:.6e}", self.vgrad_sz, self.vparam.reshape(self.vgrad_sz).l2_norm());
}
self.shared_bar.wait();
if self.worker_rank != 0 {
let mut policy = self.policy.borrow_mut();
//self.param.copy_from_slice(&self.async_param);
unsafe { volatile_copy_memory(self.param.as_mut_ptr(), self.async_param.as_ptr(), self.grad_sz) };
policy.load_diff_param(&mut self.param);
let mut value_fn = self.value_fn.borrow_mut();
//self.vparam.copy_from_slice(&self.async_vparam);
unsafe { volatile_copy_memory(self.vparam.as_mut_ptr(), self.async_vparam.as_ptr(), self.vgrad_sz) };
value_fn.load_diff_param(&mut self.vparam);
}
self.shared_bar.wait();
}
pub fn step_count(&self) -> usize {
self.step_count.load(Ordering::Acquire)
}
pub fn update(&mut self) -> (f32, f32, f32, f32) {
if self.num_workers > 1 {
unsafe {
volatile_copy_memory(self.param.as_mut_ptr(), self.async_param.as_ptr(), self.grad_sz);
if self.cfg.gamma1 < 1.0 {
volatile_copy_memory(self.gmean.as_mut_ptr(), self.async_gmean.as_ptr(), self.grad_sz);
}
if self.cfg.gamma2 < 1.0 {
volatile_copy_memory(self.gvar.as_mut_ptr(), self.async_gvar.as_ptr(), self.grad_sz);
}
volatile_copy_memory(self.vparam.as_mut_ptr(), self.async_vparam.as_ptr(), self.vgrad_sz);
if self.cfg.gamma1 < 1.0 {
volatile_copy_memory(self.vgmean.as_mut_ptr(), self.async_vgmean.as_ptr(), self.vgrad_sz);
}
if self.cfg.gamma2 < 1.0 {
volatile_copy_memory(self.vgvar.as_mut_ptr(), self.async_vgvar.as_ptr(), self.vgrad_sz);
}
}
}
let mut policy = self.policy.borrow_mut();
let mut value_fn = self.value_fn.borrow_mut();
policy.load_diff_param(&mut self.param);
value_fn.load_diff_param(&mut self.vparam);
self.base_pg.sample_steps(Some(self.cfg.max_horizon), self.cfg.update_steps, &self.cfg.init_cfg, &mut *policy, &mut self.rng);
self.base_pg.impute_baselines(self.cfg.update_steps, &mut *value_fn);
if self.cfg.impute_final {
self.base_pg.impute_final_values(&mut *value_fn);
}
self.base_pg.fill_step_values(&self.cfg.value_cfg);
if self.cfg.normal_adv {
// FIXME(20161024): normalize the per-episode advantages.
unimplemented!();
}
policy.reset_loss();
policy.reset_grad();
policy.next_iteration();
value_fn.reset_loss();
value_fn.reset_grad();
value_fn.next_iteration();
self.cache.clear();
self.vcache.clear();
let mut steps_count = 0;
//let mut tmp_baselines = vec![];
for (idx, episode) in self.base_pg.episodes.iter().enumerate() {
for k in self.base_pg.ep_k_offsets[idx] .. episode.horizon() {
let mut policy_item = SampleItem::new();
let mut value_fn_item = SampleItem::new();
let env = match k {
0 => episode.init_env.clone(),
k => episode.steps[k-1].next_env.clone(),
};
let env_repr_dim = env._shape3d();
let action_value = self.base_pg.raw_actvals[idx][k];
let smoothed_action_value = self.base_pg.smooth_avals[idx][k];
let baseline_value = self.base_pg.baseline_val[idx][k];
/*if k == 0 {
tmp_baselines.push(baseline_value);
}*/
policy_item.kvs.insert::<SampleExtractInputKey<[f32]>>(env.clone());
policy_item.kvs.insert::<SampleInputShape3dKey>(env_repr_dim);
policy_item.kvs.insert::<SampleClassLabelKey>(episode.steps[k].action.idx());
// FIXME(20161023): should use the normalized smoothed action values,
// as long as it is safe/stable to do so.
//policy_item.kvs.insert::<SampleWeightKey>(action_value - baseline_value);
policy_item.kvs.insert::<SampleWeightKey>(smoothed_action_value - baseline_value);
value_fn_item.kvs.insert::<SampleExtractInputKey<[f32]>>(env);
value_fn_item.kvs.insert::<SampleInputShape3dKey>(env_repr_dim);
value_fn_item.kvs.insert::<SampleRegressTargetKey>(action_value);
self.cache.push(policy_item);
self.vcache.push(value_fn_item);
steps_count += 1;
if self.cache.len() < self.cfg.batch_sz {
continue;
}
assert_eq!(self.cache.len(), self.vcache.len());
policy.load_batch(&self.cache);
policy.forward(OpPhase::Learning);
policy.backward();
value_fn.load_batch(&self.vcache);
value_fn.forward(OpPhase::Learning);
value_fn.backward();
self.cache.clear();
self.vcache.clear();
}
}
self.step_count.fetch_add(steps_count, Ordering::AcqRel);
//println!("DEBUG: baselines[0]: {:?}", &tmp_baselines);
//println!("DEBUG: baselines[H]: {:?}", &self.base_pg.final_values);
if !self.cache.is_empty() {
assert_eq!(self.cache.len(), self.vcache.len());
policy.load_batch(&self.cache);
policy.forward(OpPhase::Learning);
policy.backward();
value_fn.load_batch(&self.vcache);
value_fn.forward(OpPhase::Learning);
value_fn.backward();
self.cache.clear();
self.vcache.clear();
}
// FIXME(20161018): only normalize by minibatch size if all episodes in the
// minibatch are represented in the policy gradient.
policy.update_nondiff_param(self.iter_counter);
value_fn.update_nondiff_param(self.iter_counter);
let gamma1_scale = if self.cfg.gamma1 < 1.0 {
1.0 / (1.0 - (1.0 - self.cfg.gamma1).powi((self.iter_counter + 1) as i32))
} else {
1.0
};
let gamma2_scale = if self.cfg.gamma2 < 1.0 {
1.0 / (1.0 - (1.0 - self.cfg.gamma2).powi((self.iter_counter + 1) as i32))
} else {
1.0
};
let policy_loss = policy.store_loss() / self.cfg.minibatch_sz as f32;
policy.store_grad(&mut self.grad);
self.grad.reshape_mut(self.grad_sz).scale(1.0 / self.cfg.minibatch_sz as f32);
if let Some(grad_clip) = self.cfg.grad_clip {
let grad_norm = self.grad.reshape(self.grad_sz).l2_norm();
if grad_norm > grad_clip {
self.grad.reshape_mut(self.grad_sz).scale(grad_clip / grad_norm);
}
}
if self.cfg.gamma1 < 1.0 {
self.gmean.reshape_mut(self.grad_sz).average(self.cfg.gamma1, self.grad.reshape(self.grad_sz));
} else {
self.gmean.copy_from_slice(&self.grad);
}
self.tmp_buf[ .. self.grad_sz].copy_from_slice(&self.grad);
self.tmp_buf.reshape_mut(self.grad_sz).square();
if self.cfg.gamma2 < 1.0 {
self.gvar.reshape_mut(self.grad_sz).average(self.cfg.gamma2, self.tmp_buf.reshape(self.grad_sz));
} else {
self.gvar.copy_from_slice(&self.tmp_buf[ .. self.grad_sz]);
}
self.tmp_buf[ .. self.grad_sz].copy_from_slice(&self.gvar);
self.tmp_buf.reshape_mut(self.grad_sz).scale(gamma2_scale);
self.tmp_buf.reshape_mut(self.grad_sz).add_scalar(self.cfg.epsilon * self.cfg.epsilon);
self.tmp_buf.reshape_mut(self.grad_sz).sqrt();
self.tmp_buf.reshape_mut(self.grad_sz).reciprocal();
self.tmp_buf.reshape_mut(self.grad_sz).elem_mult(self.gmean.reshape(self.grad_sz));
self.param.reshape_mut(self.grad_sz).add(-self.cfg.step_size * gamma1_scale, self.tmp_buf.reshape(self.grad_sz));
let value_fn_loss = value_fn.store_loss() / steps_count as f32;
value_fn.store_grad(&mut self.vgrad);
self.vgrad.reshape_mut(self.vgrad_sz).scale(1.0 / steps_count as f32);
if let Some(vgrad_clip) = self.cfg.v_grad_clip {
let vgrad_norm = self.vgrad.reshape(self.vgrad_sz).l2_norm();
if vgrad_norm > vgrad_clip {
self.vgrad.reshape_mut(self.vgrad_sz).scale(vgrad_clip / vgrad_norm);
}
}
if self.cfg.gamma1 < 1.0 {
self.vgmean.reshape_mut(self.vgrad_sz).average(self.cfg.gamma1, self.vgrad.reshape(self.vgrad_sz));
} else {
self.vgmean.copy_from_slice(&self.vgrad);
}
self.tmp_buf[ .. self.vgrad_sz].copy_from_slice(&self.vgrad);
self.tmp_buf.reshape_mut(self.vgrad_sz).square();
if self.cfg.gamma2 < 1.0 {
self.vgvar.reshape_mut(self.vgrad_sz).average(self.cfg.gamma2, self.tmp_buf.reshape(self.vgrad_sz));
} else {
self.vgvar.copy_from_slice(&self.tmp_buf[ .. self.vgrad_sz]);
}
self.tmp_buf[ .. self.vgrad_sz].copy_from_slice(&self.vgvar);
self.tmp_buf.reshape_mut(self.vgrad_sz).scale(gamma2_scale);
self.tmp_buf.reshape_mut(self.vgrad_sz).add_scalar(self.cfg.epsilon * self.cfg.epsilon);
self.tmp_buf.reshape_mut(self.vgrad_sz).sqrt();
self.tmp_buf.reshape_mut(self.vgrad_sz).reciprocal();
self.tmp_buf.reshape_mut(self.vgrad_sz).elem_mult(self.vgmean.reshape(self.vgrad_sz));
self.vparam.reshape_mut(self.vgrad_sz).add(-self.cfg.v_step_size * gamma1_scale, self.tmp_buf.reshape(self.vgrad_sz));
if self.num_workers > 1 {
unsafe {
volatile_copy_memory(self.async_param.as_ptr() as *mut _, self.param.as_ptr(), self.grad_sz);
if self.cfg.gamma1 < 1.0 {
volatile_copy_memory(self.async_gmean.as_ptr() as *mut _, self.gmean.as_ptr(), self.grad_sz);
}
if self.cfg.gamma2 < 1.0 {
volatile_copy_memory(self.async_gvar.as_ptr() as *mut _, self.gvar.as_ptr(), self.grad_sz);
}
volatile_copy_memory(self.async_vparam.as_ptr() as *mut _, self.vparam.as_ptr(), self.vgrad_sz);
if self.cfg.gamma1 < 1.0 {
volatile_copy_memory(self.async_vgmean.as_ptr() as *mut _, self.vgmean.as_ptr(), self.vgrad_sz);
}
if self.cfg.gamma2 < 1.0 {
volatile_copy_memory(self.async_vgvar.as_ptr() as *mut _, self.vgvar.as_ptr(), self.vgrad_sz);
}
}
}
self.shared_iters.fetch_add(1, Ordering::SeqCst);
self.iter_counter += 1;
let mut avg_value = 0.0;
let mut avg_final_value = 0.0;
for idx in 0 .. self.cfg.minibatch_sz {
avg_value += self.base_pg.raw_actvals[idx][self.base_pg.ep_k_offsets[idx]];
avg_final_value += self.base_pg.final_values[idx].unwrap_or(0.0);
}
avg_value /= self.cfg.minibatch_sz as f32;
avg_final_value /= self.cfg.minibatch_sz as f32;
(avg_value, avg_final_value, policy_loss, value_fn_loss)
}
pub fn eval(&mut self, num_trials: usize) -> f32 {
let num_minibatches = (num_trials + self.cfg.minibatch_sz - 1) / self.cfg.minibatch_sz;
let mut policy = self.policy.borrow_mut();
/*if self.num_workers > 1 {
unsafe {
volatile_copy_memory(self.tmp_buf.as_mut_ptr(), self.async_param.as_ptr(), self.grad_sz);
}
} else {
self.tmp_buf.copy_from_slice(&self.param);
}*/
policy.load_diff_param(&mut self.param);
let mut avg_value = 0.0;
for minibatch in 0 .. num_minibatches {
self.eval_pg.reset(&self.cfg.init_cfg, &mut self.rng);
self.eval_pg.sample_steps(Some(self.cfg.max_horizon), None, &self.cfg.init_cfg, &mut *policy, &mut self.rng);
self.eval_pg.fill_step_values(&self.cfg.eval_cfg);
for idx in 0 .. self.cfg.minibatch_sz {
assert_eq!(0, self.eval_pg.ep_k_offsets[idx]);
avg_value += self.eval_pg.raw_actvals[idx][0];
}
}
avg_value /= (num_minibatches * self.cfg.minibatch_sz) as f32;
avg_value
}
}
| {
"content_hash": "fc185401b4b838768b06adc28cab3004",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 233,
"avg_line_length": 41.72568093385214,
"alnum_prop": 0.6257751666899799,
"repo_name": "peterhj/genrl",
"id": "6c7404f09f3db00d1df5e9aaea77319dfe9bc333",
"size": "21447",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/opt/a3c_old.rs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "344"
},
{
"name": "Makefile",
"bytes": "280"
},
{
"name": "Rust",
"bytes": "246623"
}
],
"symlink_target": ""
} |
DROP TABLE IF EXISTS format_scheme;
DROP TABLE IF EXISTS client_database;
DROP TABLE IF EXISTS database_owner;
CREATE TABLE format_scheme (
id INT NOT NULL,
name VARCHAR(8) NOT NULL,
description VARCHAR(4000) NOT NULL,
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX name_idx ON format_scheme(name);
CREATE TABLE database_owner (
db_name VARCHAR(16) NOT NULL,
description VARCHAR(4000) NOT NULL,
owner_id VARCHAR(64) NOT NULL,
owner_email VARCHAR(64) NOT NULL,
PRIMARY KEY (db_name)
);
CREATE TABLE client_database (
client_id VARCHAR(36) NOT NULL,
db_name VARCHAR(16) NOT NULL,
PRIMARY KEY (client_id),
FOREIGN KEY (db_name) REFERENCES database_owner(db_name)
);
INSERT INTO database_owner(db_name, description, owner_id, owner_email)
VALUES('vault000', 'The default vault database', 'admin', '[email protected]');
INSERT INTO client_database (client_id, db_name)
VALUES('f7d42348-c647-4efb-a52d-4c5787421e72', 'vault000');
INSERT INTO format_scheme (id, name, description)
VALUES (0, 'UUID', 'UUID Version 4 Universally Unique Identifier. This format requires no validation and will return a UUID as the token.');
INSERT INTO format_scheme (id, name, description)
VALUES (1, 'GUID', 'Globally Unique Identifier. This format requires no validation and will return a GUID as the token.');
INSERT INTO format_scheme (id, name, description)
VALUES (2, 'LN', 'LUHN Compliant Numeric. This format is used to tokenize a social insurance number or social security number.');
INSERT INTO format_scheme (id, name, description)
VALUES (3, 'N', 'Random Numeric. This format is used to tokenize a account number or any number without validation.');
INSERT INTO format_scheme (id, name, description)
VALUES (4, 'LN4', 'LUHN Compliant Numeric token retaining the original last 4 digits of the number. Can be used as credit card number.');
INSERT INTO format_scheme (id, name, description)
VALUES (5, 'AN', 'Alpha Numeric, length preserving token.');
INSERT INTO format_scheme (id, name, description)
VALUES (6, 'AN4', 'Alpha Numeric, length preserving token retaining the original last 4 characters.');
INSERT INTO format_scheme (id, name, description)
VALUES (7, 'CC', 'Credit Card Number, LUHN length preserving token retaining the original first character.');
INSERT INTO format_scheme (id, name, description)
VALUES (8, 'CC4', 'Credit Card Number, LUHN length preserving token retaining the original first digit and the last 4 digits.');
| {
"content_hash": "c9b31a7cfa00406eae30b0636c51ebca",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 140,
"avg_line_length": 46.35849056603774,
"alnum_prop": 0.7517297517297518,
"repo_name": "networknt/light-java",
"id": "4b084ad7af037c278bb3d9346c1ce108cad369af",
"size": "2457",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "data-source/src/test/resources/scripts/test-tokenization.sql",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1005444"
}
],
"symlink_target": ""
} |
import sys
import os
import bpy
from bpy_extras.io_utils import ExportHelper
bl_info = {
"name": "treeface exporter",
"author": "Xi Yang",
"location": "File > Export",
"description": "export scene to treeface JSON format",
"category": "Import-Export",
}
def format_matrix(mat):
result_list = []
for i in [0, 1, 2, 3]:
for j in [0, 1, 2, 3]:
result_list.append(mat[j][i])
return result_list
def is_identity_matrix(mat):
return (mat[0][0] == 1 and mat[0][1] == 0 and mat[0][2] == 0 and mat[0][3] == 0 and
mat[1][0] == 0 and mat[1][1] == 1 and mat[1][2] == 0 and mat[1][3] == 0 and
mat[2][0] == 0 and mat[2][1] == 0 and mat[2][2] == 1 and mat[2][3] == 0 and
mat[3][0] == 0 and mat[3][1] == 0 and mat[3][2] == 0 and mat[3][3] == 1)
def get_scene_toplevel_objects(scene):
toplevels = []
for object in scene.objects:
if not object.parent:
toplevels.append(object)
return toplevels
def collect_object_by_type(objects):
nodes = []
visuals = []
for obj in objects:
if obj.type == 'EMPTY' and obj.is_treeface_scene_node:
nodes.append(obj)
elif obj.type == 'MESH' and obj.is_treeface_visual_object:
visuals.append(obj)
return nodes, visuals
def export_geometry(mesh, dir):
# determine whether we have some attributes
normal_is_split = False
has_uv = False
has_tangent = False
if mesh.use_auto_smooth:
normal_is_split = True
if len(mesh.uv_layers.items()) > 0:
has_uv = True
if normal_is_split and has_uv:
has_tangent = True
# build-in-calculate some attributes
mesh.calc_normals()
if normal_is_split:
mesh.calc_normals_split(mesh.auto_smooth_angle)
if has_tangent:
mesh.calc_tangents()
file_out = os.path.join(dir, "mesh_" + mesh.name + ".json")
fh = open(file_out, 'w')
fh.write("{\n")
# write vertex attributes
fh.write(" \"primitive\": \"triangle_fans\",\n")
fh.write(" \"attributes\":\n")
fh.write(" [\n")
fh.write(" {\n")
fh.write(" \"name\": \"position\",\n")
fh.write(" \"n_elem\": 3,\n")
fh.write(" \"type\": float,\n")
fh.write(" },\n")
fh.write(" {\n")
fh.write(" \"name\": \"normal\",\n")
fh.write(" \"n_elem\": 3,\n")
fh.write(" \"type\": float,\n")
fh.write(" },\n")
if has_tangent:
fh.write(" {\n")
fh.write(" \"name\": \"tangent\",\n")
fh.write(" \"n_elem\": 3,\n")
fh.write(" \"type\": float,\n")
fh.write(" },\n")
if has_uv:
fh.write(" {\n")
fh.write(" \"name\": \"tex_coord\",\n")
fh.write(" \"n_elem\": 2,\n")
fh.write(" \"type\": float,\n")
fh.write(" },\n")
fh.write(" ],\n")
# gather vertices
vertices = []
indices = []
index_seed = 0
for poly in mesh.polygons:
for i_loop in range(poly.loop_start, poly.loop_start+poly.loop_total):
data = []
loop = mesh.loops[i_loop]
vtx = mesh.vertices[loop.vertex_index]
# position
data.extend(vtx.co)
# normal
if normal_is_split:
data.extend(loop.normal)
else:
data.extend(vtx.normal)
# tangent
if has_tangent:
data.extend(loop.tangent)
# uv
if has_uv:
data.extend(mesh.uv_layers.active.data[i_loop].uv)
indices.append(index_seed)
vertices.append(data)
index_seed += 1
indices.append(65535)
# write vertices
fh.write(" \"vertices\":\n");
fh.write(" [\n");
for vtx_data in vertices:
fh.write(" [ " + ', '.join(map(str,vtx_data)) + " ],\n");
fh.write(" ],\n");
# write indices
fh.write(" \"indices\":\n");
fh.write(" [\n");
for idx in indices:
fh.write(" " + str(idx) + ",\n");
fh.write(" ],\n");
# finalize
fh.write("}\n")
fh.close();
return True;
def write_visual_object(object, fh, indent):
fh.write(' ' * (indent) + "{\n")
fh.write(' ' * (indent + 4) + "\"geometry\": \"mesh_" + object.data.name + ".json\",\n")
if object.active_material > 0:
fh.write(' ' * (indent + 4) + "\"material\": \"material_" + object.active_material.name + ".json\",\n")
else:
fh.write(' ' * (indent + 4) + "\"material\": \"material_DEFAULT.json\",\n")
fh.write(' ' * (indent) + "},\n")
def write_node_recur(object, fh, indent):
# collect visual objects and child nodes
child_nodes, visuals = collect_object_by_type(object.children)
# write head
fh.write(' ' * indent + "{\n")
fh.write(' ' * (indent + 4) + "\"id\": \"" + object.name + "\",\n")
fh.write(' ' * (indent + 4) + "\"transform\": [ " + ', '.join(format_matrix(object.matrix_local)) + " ],\n")
# write visual items
fh.write(' ' * (indent + 4) + "\"visual\":\n")
fh.write(' ' * (indent + 4) + "[\n")
for visual_obj in visuals:
write_visual_object(visual_obj, fh, indent + 4)
fh.write(' ' * (indent + 4) + "],\n")
# write children
fh.write(' ' * (indent + 4) + "\"children\":\n")
fh.write(' ' * (indent + 4) + "[\n")
for child in child_nodes:
export_node_recur(child, fh, indent + 4)
fh.write(' ' * (indent + 4) + "],\n")
# finalize
fh.write(' ' * indent + "}\n")
def write_global_light(light, fh, indent):
fh.write(' ' * indent + "\"global_light_direction\": [" + + "],\n")
fh.write(' ' * indent + "\"global_light_position\": [" + + "],\n")
fh.write(' ' * indent + "\"global_light_intensity\": [" + + "],\n")
def write_widget_recur(object, fh, indent):
pos_x = object.matrix_local[0][3] - object.treeface_widget_width / 2
pos_y = object.matrix_local[1][3] - object.treeface_widget_height / 2
fh.write(' ' * indent + "{\n")
fh.write(' ' * (indent + 4) + "\"id\": \"" + object.name + "\",\n")
fh.write(' ' * (indent + 4) + "\"type\": \"" + object.treeface_widget_type + "\",\n")
fh.write(' ' * (indent + 4) + "\"position\": [ " + str(pos_x) + ', ' + str(pos_y) + " ],\n")
fh.write(' ' * (indent + 4) + "\"size\": [ " + str(object.treeface_widget_width) + ', ' + str(object.treeface_widget_height) + " ],\n")
fh.write(' ' * (indent + 4) + "\"node\": \"" + object.name + "\",\n")
# TODO object custom nodes
fh.write(' ' * indent + "},\n")
def export_scene(scene, dir):
scene_toplevel_objects = get_scene_toplevel_objects(scene)
nodes, visuals = collect_object_by_type(scene_toplevel_objects)
file_scene = os.path.join(dir, "scene_" + scene.name + ".json")
fh = open(file_scene, 'w')
fh.write("{\n")
write_global_light(bpy.data.lamps.get(scene.treeface_global_light), fh, 4)
fh.write(" \"node\":\n")
fh.write(" {\n")
fh.write(" \"transform\": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],\n")
# write visual objects at root
fh.write(" \"visual\":\n")
fh.write(" [\n")
for visual in visuals:
write_visual_object(visual, fh, 12)
fh.write(" ],\n")
# write nodes
fh.write(" \"children\":\n")
fh.write(" [\n")
for node in nodes:
write_node_recur(node, fh, 12)
fh.write(" ],\n")
fh.write(" },\n")
# finalize
fh.write("}\n")
fh.close()
def export_widget(scene, dir):
file_widget = os.path.join(dir, "scene_widget_" + scene.name + ".json")
fh = open(file_widget, 'w')
fh.write("{\n")
fh.write(" \"position\": [0, 0],")
fh.write("}\n")
fh.close()
class TreefaceExporter(bpy.types.Operator, ExportHelper):
"""Export the scene to treeface JSON file"""
bl_idname = "treeface.export"
bl_label = "Export as treeface to folder"
filename_ext = "."
use_filter_folder = True
def execute(self, context):
filepath = self.filepath
if not os.path.isdir(filepath):
self.report({'WARNING'}, "Path " + filepath + " is not a directory\n")
return {'CANCELLED'}
# validate scene
# get meshes and materials
project_ok, used_meshs, used_materials = validate_everything()
if not project_ok:
return {'CANCELLED'}
# do export
for mesh in used_meshes:
export_geometry(mesh, filepath)
for mat in used_materials:
export_material(mat, filepath)
export_scene(bpy.data.scenes[0], filepath)
export_widget(bpy.data.scenes[0], filepath)
def validate_everything(self):
all_valid = True
used_mesh_names = set()
used_material_names = set()
# we should have only one scene
if len(bpy.data.scenes) == 0:
self.report({'ERROR_INVALID_INPUT'}, "no scene in current project")
all_valid = False
if len(bpy.data.scenes) > 1:
self.report({'ERROR_INVALID_INPUT'}, "more than one scene in current project")
all_valid = False
# validate visual objects
# collect meshes
for object in bpy.data.scenes[0].objects:
if object.type == 'MESH' and object.is_treeface_visual_object:
if not is_identity_matrix(object.matrix_local):
self.report({'ERROR_INVALID_INPUT'}, "visual object " + object.name + " local matrix is not identity")
all_valid = False
if len(object.children) > 0:
self.report({'ERROR_INVALID_INPUT'}, "visual object " + object.name + " has child objects, which is not wanted")
all_valid = False
used_mesh_names.add(object.data.name)
if object.active_material:
used_material_names.add(object.active_material.name)
# visual object's parent must be a scene node, or has no parent
if object.parent:
if not object.parent.type == 'EMPTY' or not object.parent.is_treeface_scene_node:
self.report({'ERROR_INVALID_INPUT'}, "visual object " + object.name + "'s parent " + object.parent.name + " is not a scene node")
all_valid = False
elif object.type == 'EMPTY' and object.is_treeface_scene_node:
if object.parent:
if not object.parent.type == 'EMPTY' or not object.parent.is_treeface_scene_node:
self.report({'ERROR_INVALID_INPUT'}, "scene node object " + object.name + "'s parent " + object.parent.name + " is not a scene node")
all_valid = False
if object.is_treeface_widget:
if not object.parent.type == 'EMPTY' or not object.parent.is_treeface_scene_node or not object.parent.is_treeface_widget:
self.report({'ERROR_INVALID_INPUT'}, "widget object " + object.name + "'s parent " + object.parent.name + " is not a widget object")
all_valid = False
if object.is_treeface_widget:
if not object.is_treeface_scene_node:
self.report({'ERROR_INVALID_INPUT'}, "widget object " + object.name + " is not a scene node object")
all_valid = False
# validate meshes
used_meshes= []
for mesh in bpy.data.meshes:
if not mesh.name in used_mesh_names:
continue
if len(mesh.materials) > 1:
self.report({'ERROR_INVALID_INPUT'}, "mesh " + mesh.name + " has more than one materials")
all_valid = False
if len(mesh.uv_layers) > 1:
self.report({'ERROR_INVALID_INPUT'}, "mesh " + mesh.name + " has more than one UV layers")
all_valid = False
used_meshes.append(mesh)
# validate materials
used_materials = []
for mat in bpy.data.materials:
if not mat.name in used_material_names:
continue
used_materials.append(mat)
return all_valid, used_meshes, used_materials
def menu_func(self, context):
self.layout.operator(TreefaceExporter.bl_idname)
def register():
bpy.utils.register_class(TreefaceExporter)
bpy.types.INFO_MT_file_export.append(menu_func)
#bpy.types.VIEW3D_PT_tools_objectmode.prepend(menu_func)
def unregister():
bpy.utils.unregister_class(TreefaceExporter)
bpy.types.INFO_MT_file_export.remove(menu_func)
#bpy.types.VIEW3D_PT_tools_objectmode.remove(menu_func)
if __name__ == "__main__":
register()
| {
"content_hash": "0f4024c1dd29e7ba7dfec3a4eacd08e0",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 160,
"avg_line_length": 34.67624020887728,
"alnum_prop": 0.516301483322039,
"repo_name": "jiandingzhe/treeface",
"id": "5554b0f4f1e3a5312823aff9ca24aff30959ddd6",
"size": "13281",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "blender_plugins/treeface_export.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "755470"
},
{
"name": "CMake",
"bytes": "26107"
},
{
"name": "Perl",
"bytes": "1932"
},
{
"name": "Python",
"bytes": "28620"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main">
<LinearLayout
android:orientation= "vertical"
android:layout_width= "match_parent"
android:layout_height= "match_parent"
android:gravity="center"
android:layout_weight= "1" >
<Button
android:id="@+id/acqToken"
android:layout_width="360px"
android:layout_height="140px"
android:layout_centerInParent="false"
android:layout_gravity="center_horizontal"
android:text="Acquire Token"/>
<Button
android:id="@+id/signOut"
android:layout_width="360px"
android:layout_height="140px"
android:layout_centerInParent="false"
android:layout_gravity="center_horizontal"
android:text="Sign out"/>
</LinearLayout>
</RelativeLayout>
| {
"content_hash": "722b6d53d701766e92b645c9ff315665",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 44.32258064516129,
"alnum_prop": 0.5676855895196506,
"repo_name": "AzureAD/microsoft-authentication-library-for-dotnet",
"id": "da9a2cc1448ac30fd9614f822f32d5231cf50612",
"size": "1374",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "tests/devapps/Intune-xamarin-Android/Resources/layout/content_main.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "7926753"
},
{
"name": "Java",
"bytes": "6721"
},
{
"name": "JavaScript",
"bytes": "5436"
},
{
"name": "PowerShell",
"bytes": "76430"
},
{
"name": "Python",
"bytes": "4062"
},
{
"name": "Smalltalk",
"bytes": "8304"
}
],
"symlink_target": ""
} |
package org.michenux.yourappidea.home;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.KeyEvent;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import org.michenux.drodrolib.gms.gplus.GoogleApiClientDelegate;
import org.michenux.drodrolib.security.UserSessionCallback;
import org.michenux.drodrolib.ui.navdrawer.NavigationDrawerFragment;
import org.michenux.yourappidea.facebook.FbLoginDelegate;
import org.michenux.drodrolib.info.AppUsageUtils;
import org.michenux.drodrolib.security.SecurityUtils;
import org.michenux.drodrolib.security.UserHelper;
import org.michenux.yourappidea.BuildConfig;
import org.michenux.yourappidea.NavigationController;
import org.michenux.yourappidea.R;
import org.michenux.yourappidea.YourApplication;
import javax.inject.Inject;
public class YourAppMainActivity extends ActionBarActivity implements UserSessionCallback {
@Inject
NavigationController navController;
@Inject
UserHelper mUserHelper;
private AdView mAdView ;
private FbLoginDelegate mFbLoginDelegate;
private GoogleApiClientDelegate mGoogleApiClientDlg;
private Toolbar mToolBar;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((YourApplication) getApplication()).inject(this);
setContentView(R.layout.main);
// toolbar
mToolBar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolBar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
// For debug
if ( BuildConfig.DEBUG) {
Log.d(YourApplication.LOG_TAG, "HashKey: " + SecurityUtils.logHashKey(this));
}
// app usage
AppUsageUtils.updateLastUsedTimestamp(this);
// init fragment
if (savedInstanceState == null) {
this.navController.goHomeFragment(this);
this.navController.showWhatsNew(this);
}
// ads
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("1174B15820BDCDE357023377AAF1D72D")
.addTestDevice("FB73634EFAFEF29BE7973A97B5543A4D")
.addTestDevice("3C4438D5DE2E7086B63C92FC5846F662") //LG Nexus 5
.build();
mAdView.loadAd(adRequest);
// social networks
mFbLoginDelegate = new FbLoginDelegate(mUserHelper, this, savedInstanceState);
mFbLoginDelegate.setUserSessionCallback(this);
mGoogleApiClientDlg = new GoogleApiClientDelegate(this, mUserHelper, savedInstanceState);
mGoogleApiClientDlg.setUserSessionCallback(this);
}
@Override
public void onBackPressed() {
NavigationDrawerFragment navigationDrawerFragment = findNavDrawerFragment();
if ( navigationDrawerFragment == null || !navigationDrawerFragment.onBackPressed()) {
// See bug: http://stackoverflow.com/questions/13418436/android-4-2-back-stack-behaviour-with-nested-fragments/14030872#14030872
// If the fragment exists and has some back-stack entry
FragmentManager fm = getSupportFragmentManager();
Fragment currentFragment = fm.findFragmentById(R.id.content_frame);
if (currentFragment != null && currentFragment.getChildFragmentManager().getBackStackEntryCount() > 0) {
// Get the fragment fragment manager - and pop the backstack
currentFragment.getChildFragmentManager().popBackStack();
}
// Else, nothing in the direct fragment back stack
else {
if ( currentFragment != null && !NavigationController.HOME_FRAGMENT_TAG.equals(currentFragment.getTag())) {
this.navController.goHomeFragment(this);
}
else {
super.onBackPressed();
}
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mFbLoginDelegate.onActivityResult(requestCode, resultCode, data);
mGoogleApiClientDlg.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClientDlg.onStart();
}
@Override
protected void onStop() {
mGoogleApiClientDlg.onStop();
mFbLoginDelegate.onStop();
super.onStop();
}
@Override
public void onPause() {
super.onPause();
mAdView.pause();
mFbLoginDelegate.onPause();
}
@Override
public void onResume() {
super.onResume();
mAdView.resume();
mFbLoginDelegate.onResume();
}
@Override
public void onDestroy() {
mAdView.destroy();
super.onDestroy();
mFbLoginDelegate.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mFbLoginDelegate.onSaveInstanceState(outState);
mGoogleApiClientDlg.onSaveInstanceState(outState);
}
@Override
public void onLogin() {
NavigationDrawerFragment navigationDrawerFragment = findNavDrawerFragment();
navigationDrawerFragment.refreshMenu();
}
public YourAppNavigationFragment findNavDrawerFragment() {
return (YourAppNavigationFragment) getSupportFragmentManager().findFragmentByTag("navdrawer_fragment");
}
@Override
public void onLogout() {
YourAppNavigationFragment navigationDrawerFragment = findNavDrawerFragment();
navigationDrawerFragment.showPrimaryMenu();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
NavigationDrawerFragment navigationDrawerFragment = findNavDrawerFragment();
if ( navigationDrawerFragment.onKeyDown(keyCode, event)) {
return true;
}
else {
return super.onKeyDown(keyCode, event);
}
}
public FbLoginDelegate getFbLoginDelegate() {
return mFbLoginDelegate;
}
public GoogleApiClientDelegate getGoogleApiClientDlg() {
return mGoogleApiClientDlg;
}
}
| {
"content_hash": "06a636f3a0a224d321af20bf54a2dca6",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 140,
"avg_line_length": 33.85204081632653,
"alnum_prop": 0.6863602110022607,
"repo_name": "Stahlisen/YourAppIdea",
"id": "43dd55794411651cd07cef9c19b8ad5126877887",
"size": "6635",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "YourAppIdea/src/main/java/org/michenux/yourappidea/home/YourAppMainActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "371998"
}
],
"symlink_target": ""
} |
const request = require('request');
const promise = require('bluebird');
const logger = require('./logger');
const qs = require('querystring');
const config = require('config');
const moment = require('moment');
const fs = require('fs');
const path = require('path');
const uuid = require('uuid');
promise.promisifyAll(request);
promise.promisifyAll(fs);
const baiduURL = 'http://wmcrm.baidu.com';
const _ = require('underscore');
const FetchTask = require('./fetch_task');
const baiduUri = 'https://wmcrm.baidu.com';
const util = require('./util');
class BaiduFetchTask extends FetchTask {
constructor(account, option) {
super(account, option);
this.columns = {
order_id: '订单号',
paid_time_str: '下单时间',
user_real_name: '姓名',
user_phone: '电话',
user_address: '送餐地址',
product_details: '订购的产品',
distance: '距离',
user_note: '备注',
order_price: '原价',
send_price: '配送费',
discount_price_total: '折扣成本',
total_price: '实际收入'
};
}
login() {
logger.info(`Try to login ${this.account.name}`);
let getTokenJar = request.jar();
let getTokenOption = {
url: 'https://wmpass.baidu.com/wmpass/openservice/captchapair?protocal=https&callback=callbackFromBaidu&_=1466392887410',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36'
},
//proxy: 'http://127.0.0.1:8888',
jar: getTokenJar,
strictSSL: false
};
return request.getAsync(getTokenOption).then((res)=> {
let token = null;
function callbackFromBaidu(result) {
token = result.data.token;
}
eval(res.body);
logger.debug('Baidu imgcode token:' + token);
return token;
}).then((token)=> {
return new promise((resolve, reject)=> {
let getImgOption = {
url: 'https://wmpass.baidu.com/wmpass/openservice/imgcaptcha?token=' + token + '&&color=3c78d8',
//proxy: 'http://127.0.0.1:8888',
jar: getTokenJar,
strictSSL: false
};
let imgPath = path.resolve(__dirname, '../temp/', uuid.v4() + '.png');
request.get(getImgOption).on('error', reject).on('end', ()=> {
logger.debug('Baidu imgcode page:' + imgPath);
resolve({imgPath: imgPath, token: token})
})
.pipe(fs.createWriteStream(imgPath));
});
}).then((getImgResult)=> {
let imgCodeOption = {
url: 'http://op.juhe.cn/vercode/index',
formData: {
image: fs.createReadStream(getImgResult.imgPath),
key: config.get('imgCode.key'),
codeType: '1004'
},
timeout:100000,
//proxy: 'http://127.0.0.1:8888',
json: true
};
return request.postAsync(imgCodeOption).then((res)=> {
logger.info(`Image to string result: ${JSON.stringify(res.body)}`);
getImgResult.imgCode = res.body.result;
return getImgResult;
});
}).then((getImgResult)=> {
let loginOption = {
url: 'https://wmpass.baidu.com/api/login',
form: {
redirect_url: "http%3A%2F%2Fwmcrm.baidu.com%2F",
type: 1,
channel: 'pc',
account: this.account.username,
upass: util.encryptBaiduPwd(this.account.password),
captcha: getImgResult.imgCode,
token: getImgResult.token
},
//proxy: 'http://127.0.0.1:8888',
strictSSL: false,
jar: getTokenJar
};
return request.postAsync(loginOption).then((res)=> {
let token = {cookies: getTokenJar.getCookieString(baiduUri)};
this.setToken(token);
return;
});
});
}
fetchPageAmount() {
let orderJar = request.jar();
this.token.cookies.split(';').forEach((v)=> {
orderJar.setCookie(request.cookie(v), baiduURL);
});
var orderParam = {
qt: 'orderlist',
order_status: 0,
start_time: this.option.beginTime.format('YYYY-MM-DD'),
end_time: this.option.endTime.format('YYYY-MM-DD'),
pay_type: 2,
is_asap: 0
};
let orderOption = {
jar: orderJar,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36',
}
//proxy: 'http://127.0.0.1:8888'
};
var getOrderURL = 'http://wmcrm.baidu.com/crm?' + qs.stringify(orderParam);
return request.getAsync(getOrderURL + '&page=1', orderOption).then((res)=> {
let pageAmount = this.extractPageNumFromHtml(res.body) || 0;
return pageAmount;
});
}
fetchPage(pageNum) {
logger.info(`${this.account.name} fetch page ${pageNum}`);
let orderJar = request.jar();
this.token.cookies.split(';').forEach((v)=> {
orderJar.setCookie(request.cookie(v), baiduURL);
});
var orderParam = {
qt: 'orderlist',
order_status: 0,
start_time: this.option.beginTime.format('YYYY-MM-DD'),
end_time: this.option.endTime.format('YYYY-MM-DD'),
pay_type: 2,
is_asap: 0
};
let orderOption = {
jar: orderJar,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36',
}
//proxy: 'http://127.0.0.1:8888'
};
var getOrderURL = 'http://wmcrm.baidu.com/crm?' + qs.stringify(orderParam);
return request.getAsync(getOrderURL + '&page=' + pageNum, orderOption).then((res)=> {
return this.extractOrdersFromHtml(res.body);
});
}
convertToReport(orders) {
_.each(orders, (order)=> {
let details = [];
let products = order.content.products;
_.each(products, (v)=> {
details.push(v.name + ' * ' + v.number);
});
order.order_id = order.order_id + '_';
order.product_details = details.join(' | ');
order.paid_time_str = moment.unix(order.paid_time).format('YYYY/MM/DD HH:mm');
order.discount_price_total = order.content.discount_display.subsidy_total;
order.send_price = order.content.send_price;
});
return promise.resolve(orders);
}
extractOrdersFromHtml(html) {
try {
let lastPart = html.split("require('wand:widget/order/list/list.js').createWidget(")[1];
let jsonStr = lastPart.split(");")[0];
let json = JSON.parse(jsonStr);
let orders = json.content.order_list;
return orders;
} catch (e) {
logger.error('Can not extract orders from baidu page');
return [];
}
}
extractPageNumFromHtml(html) {
try {
let march = /共计---<span>(\d*)<\/span>/m.exec(html);
let orderAmount = parseInt(march[1]);
return Math.ceil(orderAmount / 20);
} catch (e) {
logger.error('Can not extract page num from baidu page');
return 0;
}
}
}
module.exports = BaiduFetchTask; | {
"content_hash": "fc7006518815e9d3c5d44adb8f336518",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 141,
"avg_line_length": 38.31730769230769,
"alnum_prop": 0.5125470514429109,
"repo_name": "mudiyouyou/waimai-crawler",
"id": "2b665d028708bfee439548d8beb7bf578abfdcd1",
"size": "8048",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/baidu_task.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1289422"
},
{
"name": "JavaScript",
"bytes": "34086"
},
{
"name": "Shell",
"bytes": "42"
}
],
"symlink_target": ""
} |
Package `scss` provides a Gonzo stage for compiling SCSS files to CSS.
| {
"content_hash": "ea17f0f117023c7f512b12cbd1643649",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 70,
"avg_line_length": 71,
"alnum_prop": 0.7887323943661971,
"repo_name": "go-gonzo/scss",
"id": "d0533a754f7fde76208aae4c278625639051f8f1",
"size": "205",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "29782"
},
{
"name": "C++",
"bytes": "1054412"
},
{
"name": "Go",
"bytes": "17054"
},
{
"name": "Makefile",
"bytes": "7593"
},
{
"name": "Perl",
"bytes": "675"
},
{
"name": "Ruby",
"bytes": "157"
},
{
"name": "Shell",
"bytes": "25356"
}
],
"symlink_target": ""
} |
class CleanExtraneousVisionPreferences < ActiveRecord::Migration
def up
execute "DELETE FROM preferences WHERE owner_type = 'Identification' and name = 'vision' and value is null"
end
def down
say "Can't be undone"
end
end
| {
"content_hash": "0f20605a94aa54ffd68ccf6d19dfa1b4",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 111,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.7375,
"repo_name": "calonso-conabio/inaturalist",
"id": "2cae7a4cbd0f5090764b379895b7734158a32c13",
"size": "240",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "db/migrate/20170630200341_clean_extraneous_vision_preferences.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "549577"
},
{
"name": "Gherkin",
"bytes": "3994"
},
{
"name": "HTML",
"bytes": "1727258"
},
{
"name": "JavaScript",
"bytes": "4916454"
},
{
"name": "PHP",
"bytes": "9941"
},
{
"name": "PLpgSQL",
"bytes": "226781"
},
{
"name": "Ruby",
"bytes": "3543615"
},
{
"name": "Shell",
"bytes": "1215"
},
{
"name": "XSLT",
"bytes": "7923"
}
],
"symlink_target": ""
} |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit', '0005_auto_20180726_2126'),
]
operations = [
migrations.AlterField(
model_name='post',
name='status',
field=models.CharField(choices=[('accepted', 'accepted'), ('pending', 'pending'), ('almost', 'almost'), ('rejected', 'rejected')], default='accepted', max_length=200),
),
]
| {
"content_hash": "003a439ca6428c2cbd4673405679442c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 179,
"avg_line_length": 28.9375,
"alnum_prop": 0.5831533477321814,
"repo_name": "vaniakosmos/memes-reposter",
"id": "105a198e3e7922ca84631193c5207200ed840353",
"size": "512",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "apps/reddit/migrations/0006_auto_20180729_2102.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1067"
},
{
"name": "Dockerfile",
"bytes": "203"
},
{
"name": "HTML",
"bytes": "11813"
},
{
"name": "JavaScript",
"bytes": "6442"
},
{
"name": "Makefile",
"bytes": "247"
},
{
"name": "Python",
"bytes": "81075"
},
{
"name": "Shell",
"bytes": "614"
}
],
"symlink_target": ""
} |
jQuery( document ).ready( function ($) {
//'use strict';
// Instantiates the variable that holds the media library frame.
var $wpmedia;
var $parent;
// Runs when the image button is clicked.
jQuery('.wallpaperbug-upload-image').click(function(e){
// Prevents the default action from occuring.
e.preventDefault();
$parent = $(this);
// If the frame already exists, re-open it.
if ( $wpmedia ) {
$wpmedia.open();
return;
}
// Sets up the media library frame
$wpmedia = wp.media.frames.$wpmedia = wp.media({
title: "Select Wallpaper",
button: { text: "Select" },
library: { type: 'image' }
});
// Runs when an image is selected.
$wpmedia.on('select', function(){
// Grabs the attachment selection and creates a JSON representation of the model.
var $attachment = $wpmedia.state().get('selection').first().toJSON();
// Sends the attachment URL to our custom image input field.
$($parent).siblings(".wallpaperbug_attachment_url").val($attachment.url);
$($parent).siblings(".wallpaperbug_attachment_id").val($attachment.id);
$($parent).siblings(".wallpaperbug_image").css({
"background-image" : "url(" + $attachment.url + ")"
});
});
// Opens the media library frame.
$wpmedia.open();
});
});
| {
"content_hash": "adf9e4b14672d9e52db260c4d0ab5c09",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 93,
"avg_line_length": 32.76086956521739,
"alnum_prop": 0.5500995355009953,
"repo_name": "ryanrphillips/wallpaperbug",
"id": "29aebbcfde4617b193525ea69e8d28815ef83884",
"size": "1507",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "admin/js/wallpaperbug-admin.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1865"
},
{
"name": "JavaScript",
"bytes": "2322"
},
{
"name": "PHP",
"bytes": "37025"
}
],
"symlink_target": ""
} |
package cmd
import (
"encoding/json"
"fmt"
"io"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/klog"
"sigs.k8s.io/yaml"
apimachineryversion "k8s.io/apimachinery/pkg/version"
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
"k8s.io/kubernetes/cmd/kubeadm/app/version"
)
// Version provides the version information of kubeadm.
type Version struct {
ClientVersion *apimachineryversion.Info `json:"clientVersion"`
}
// NewCmdVersion provides the version information of kubeadm.
func NewCmdVersion(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print the version of kubeadm",
Run: func(cmd *cobra.Command, args []string) {
err := RunVersion(out, cmd)
kubeadmutil.CheckErr(err)
},
}
cmd.Flags().StringP("output", "o", "", "Output format; available options are 'yaml', 'json' and 'short'")
return cmd
}
// RunVersion provides the version information of kubeadm in format depending on arguments
// specified in cobra.Command.
func RunVersion(out io.Writer, cmd *cobra.Command) error {
klog.V(1).Infoln("[version] retrieving version info")
clientVersion := version.Get()
v := Version{
ClientVersion: &clientVersion,
}
const flag = "output"
of, err := cmd.Flags().GetString(flag)
if err != nil {
return errors.Wrapf(err, "error accessing flag %s for command %s", flag, cmd.Name())
}
switch of {
case "":
fmt.Fprintf(out, "kubeadm version: %#v\n", v.ClientVersion)
case "short":
fmt.Fprintf(out, "%s\n", v.ClientVersion.GitVersion)
case "yaml":
y, err := yaml.Marshal(&v)
if err != nil {
return err
}
fmt.Fprintln(out, string(y))
case "json":
y, err := json.MarshalIndent(&v, "", " ")
if err != nil {
return err
}
fmt.Fprintln(out, string(y))
default:
return errors.Errorf("invalid output format: %s", of)
}
return nil
}
| {
"content_hash": "3bb33b11d418f9cd2581d121a06f7b6e",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 106,
"avg_line_length": 24.30263157894737,
"alnum_prop": 0.6859772604223064,
"repo_name": "Hui-Zhi/kubernetes",
"id": "e66f05af57a18c65aa3db660b74c2f259e15bd6e",
"size": "2416",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "cmd/kubeadm/app/cmd/version.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2840"
},
{
"name": "Dockerfile",
"bytes": "52103"
},
{
"name": "Go",
"bytes": "50565108"
},
{
"name": "HTML",
"bytes": "38"
},
{
"name": "Lua",
"bytes": "17200"
},
{
"name": "Makefile",
"bytes": "67444"
},
{
"name": "PowerShell",
"bytes": "101623"
},
{
"name": "Python",
"bytes": "3397066"
},
{
"name": "Ruby",
"bytes": "430"
},
{
"name": "Shell",
"bytes": "1579078"
},
{
"name": "sed",
"bytes": "12268"
}
],
"symlink_target": ""
} |
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Triple A Number")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("University of Hartford")>
<Assembly: AssemblyProduct("Triple A Number")>
<Assembly: AssemblyCopyright("Copyright © University of Hartford 2013")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("602e2fbf-9bea-4e66-9459-7f08f512a310")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
| {
"content_hash": "4703963e91a24217950f3b65d88063b4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 83,
"avg_line_length": 33.97142857142857,
"alnum_prop": 0.7502102607232969,
"repo_name": "patkub/visual-basic-intro",
"id": "d0974ec1c1073cf60318877f4cedff9e2290f156",
"size": "1192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Triple A Number/Triple A Number/My Project/AssemblyInfo.vb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Visual Basic",
"bytes": "373539"
}
],
"symlink_target": ""
} |
<?php
return [
/*
|--------------------------------------------------------------------------
| Standards Tree
|--------------------------------------------------------------------------
|
| Versioning an API with Dingo revolves around content negotiation and
| custom MIME types. A custom type will belong to one of three
| standards trees, the Vendor tree (vnd), the Personal tree
| (prs), and the Unregistered tree (x).
|
| By default the Unregistered tree (x) is used, however, should you wish
| to you can register your type with the IANA. For more details:
| https://tools.ietf.org/html/rfc6838
|
*/
'standardsTree' => env('API_STANDARDS_TREE', 'x'),
/*
|--------------------------------------------------------------------------
| API Subtype
|--------------------------------------------------------------------------
|
| Your subtype will follow the standards tree you use when used in the
| "Accept" header to negotiate the content type and version.
|
| For example: Accept: application/x.SUBTYPE.v1+json
|
*/
'subtype' => env('API_SUBTYPE', 'laravel'),
/*
|--------------------------------------------------------------------------
| Default API Version
|--------------------------------------------------------------------------
|
| This is the default version when strict mode is disabled and your API
| is accessed via a web browser. It's also used as the default version
| when generating your APIs documentation.
|
*/
'version' => env('API_VERSION', 'v1'),
/*
|--------------------------------------------------------------------------
| Default API Prefix
|--------------------------------------------------------------------------
|
| A default prefix to use for your API routes so you don't have to
| specify it for each group.
|
*/
'prefix' => env('API_PREFIX', null),
/*
|--------------------------------------------------------------------------
| Default API Domain
|--------------------------------------------------------------------------
|
| A default domain to use for your API routes so you don't have to
| specify it for each group.
|
*/
'domain' => env('API_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| Name
|--------------------------------------------------------------------------
|
| When documenting your API using the API Blueprint syntax you can
| configure a default name to avoid having to manually specify
| one when using the command.
|
*/
'name' => env('API_NAME', null),
/*
|--------------------------------------------------------------------------
| Conditional Requests
|--------------------------------------------------------------------------
|
| Globally enable conditional requests so that an ETag header is added to
| any successful response. Subsequent requests will perform a check and
| will return a 304 Not Modified. This can also be enabled or disabled
| on certain groups or routes.
|
*/
'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true),
/*
|--------------------------------------------------------------------------
| Strict Mode
|--------------------------------------------------------------------------
|
| Enabling strict mode will require clients to send a valid Accept header
| with every request. This also voids the default API version, meaning
| your API will not be browsable via a web browser.
|
*/
'strict' => env('API_STRICT', false),
/*
|--------------------------------------------------------------------------
| Debug Mode
|--------------------------------------------------------------------------
|
| Enabling debug mode will result in error responses caused by thrown
| exceptions to have a "debug" key that will be populated with
| more detailed information on the exception.
|
*/
'debug' => env('API_DEBUG', true),
/*
|--------------------------------------------------------------------------
| Generic Error Format
|--------------------------------------------------------------------------
|
| When some HTTP exceptions are not caught and dealt with the API will
| generate a generic error response in the format provided. Any
| keys that aren't replaced with corresponding values will be
| removed from the final response.
|
*/
'errorFormat' => [
'message' => ':message',
'errors' => ':errors',
'code' => ':code',
'status_code' => ':status_code',
'debug' => ':debug',
],
/*
|--------------------------------------------------------------------------
| Authentication Providers
|--------------------------------------------------------------------------
|
| The authentication providers that should be used when attempting to
| authenticate an incoming API request.
|
*/
'auth' => [
'jwt' => 'Dingo\Api\Auth\Provider\JWT',
],
/*
|--------------------------------------------------------------------------
| Throttling / Rate Limiting
|--------------------------------------------------------------------------
|
| Consumers of your API can be limited to the amount of requests they can
| make. You can create your own throttles or simply change the default
| throttles.
|
*/
'throttling' => [
],
/*
|--------------------------------------------------------------------------
| Response Transformer
|--------------------------------------------------------------------------
|
| Responses can be transformed so that they are easier to format. By
| default a Fractal transformer will be used to transform any
| responses prior to formatting. You can easily replace
| this with your own transformer.
|
*/
'transformer' => env('API_TRANSFORMER', Dingo\Api\Transformer\Adapter\Fractal::class),
/*
|--------------------------------------------------------------------------
| Response Formats
|--------------------------------------------------------------------------
|
| Responses can be returned in multiple formats by registering different
| response formatters. You can also customize an existing response
| formatter.
|
*/
'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'),
'formats' => [
'json' => Dingo\Api\Http\Response\Format\Json::class,
],
];
| {
"content_hash": "80037f3aefee7bd5964901affab2b189",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 90,
"avg_line_length": 32.30622009569378,
"alnum_prop": 0.41113744075829384,
"repo_name": "milvergithub/sqlgenerator",
"id": "eca4b60b8b5b1d1d348ef2f92316a72dacd72830",
"size": "6752",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/api.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "553"
},
{
"name": "CSS",
"bytes": "14974"
},
{
"name": "HTML",
"bytes": "26854"
},
{
"name": "JavaScript",
"bytes": "63998"
},
{
"name": "PHP",
"bytes": "153419"
}
],
"symlink_target": ""
} |
# freelint
[](https://travis-ci.org/zslucky/freelint)
a lint tool based on standard-engine and rules follow the [Airbnb javascript standard](https://github.com/airbnb/javascript).
We are followed [SamVer 2.0](http://semver.org/), this started from version 2.0.0, then we will try our best to avoide the dependency hell.
### Install (Global)
```bash
npm install -g freelint
```
or use `yarn`
```bash
yarn global add freelint
```
### Install (Local)
```bash
npm install freelint --save-dev
```
or use `yarn`
```bash
yarn add freelint --dev
```
```json
# ...
# Add npm task in package.json.
"script": {
"freelint": "freelint",
...
}
```
### Usage (Global)
In your project's directiry.
```bash
freelint
```
### Usage (Local)
```bash
npm run freelint
```
or use `yarn`
```bash
yarn run freelint
```
That's all.
## Know Issues
1. If you are using ES6 import/export feature, and webpack like build tool with a resolve setting, you should extract the resolve settings to a new file named `webpack.resolve.js`, and place it to `config` dir in root dir, we know it's a dirty code, if you have any good solution, don't hesitated to create a pull request.(e.g.[Demo](https://github.com/zslucky/react-redux-freetmp))
### How do I make the output all colorful and *pretty*?
[snazzy](https://www.npmjs.com/package/snazzy) is the default output format for cmd `freelint` now, you can also use any other
format library, just need to use the base cmd `freelint-base`, like:
```bash
$ freelint-base | customFormat
```
### How do I ignore files?
The paths `node_modules/**`, `*.min.js`, `bundle.js`, `coverage/**`, hidden files/folders
(beginning with `.`), and all patterns in a project's root `.gitignore` file are
automatically ignored.
Sometimes you need to ignore additional folders or specific minified files. To do that, add
a `freelint.ignore` property to `package.json`:
```json
"freelint-base": {
"ignore": [
"**/out/",
"/lib/select2/",
"/lib/ckeditor/",
"tmp.js"
]
}
```
### TODO
- [ ] Add reporter function by setting from cli
| {
"content_hash": "09bcf7566c4ed902eaae21255229a482",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 382,
"avg_line_length": 24.54022988505747,
"alnum_prop": 0.6908665105386417,
"repo_name": "zslucky/freelint",
"id": "bd1a43dd5d38a2258c020a296bcceaa6a0f2e410",
"size": "2135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1496"
}
],
"symlink_target": ""
} |
CFLAGS+= -Wall
PROG= tcpstream
MAN=
.include <bsd.prog.mk>
| {
"content_hash": "7695735d0c52ade2983ca4512c54ab55",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 22,
"avg_line_length": 12,
"alnum_prop": 0.7,
"repo_name": "jrobhoward/SCADAbase",
"id": "37cbcc030c8898c70f457fd3218fa0f9ffc1a6b2",
"size": "77",
"binary": false,
"copies": "6",
"ref": "refs/heads/SCADAbase",
"path": "tools/regression/netinet/tcpstream/Makefile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AGS Script",
"bytes": "62471"
},
{
"name": "Assembly",
"bytes": "4615704"
},
{
"name": "Awk",
"bytes": "273794"
},
{
"name": "Batchfile",
"bytes": "20333"
},
{
"name": "C",
"bytes": "457666547"
},
{
"name": "C++",
"bytes": "91495356"
},
{
"name": "CMake",
"bytes": "17632"
},
{
"name": "CSS",
"bytes": "104220"
},
{
"name": "ChucK",
"bytes": "39"
},
{
"name": "D",
"bytes": "6321"
},
{
"name": "DIGITAL Command Language",
"bytes": "10638"
},
{
"name": "DTrace",
"bytes": "1904158"
},
{
"name": "Emacs Lisp",
"bytes": "32010"
},
{
"name": "EmberScript",
"bytes": "286"
},
{
"name": "Forth",
"bytes": "204603"
},
{
"name": "GAP",
"bytes": "72078"
},
{
"name": "Groff",
"bytes": "32376243"
},
{
"name": "HTML",
"bytes": "5776268"
},
{
"name": "Haskell",
"bytes": "2458"
},
{
"name": "IGOR Pro",
"bytes": "6510"
},
{
"name": "Java",
"bytes": "112547"
},
{
"name": "KRL",
"bytes": "4950"
},
{
"name": "Lex",
"bytes": "425858"
},
{
"name": "Limbo",
"bytes": "4037"
},
{
"name": "Logos",
"bytes": "179088"
},
{
"name": "Makefile",
"bytes": "12750766"
},
{
"name": "Mathematica",
"bytes": "21782"
},
{
"name": "Max",
"bytes": "4105"
},
{
"name": "Module Management System",
"bytes": "816"
},
{
"name": "Objective-C",
"bytes": "1571960"
},
{
"name": "PHP",
"bytes": "2471"
},
{
"name": "PLSQL",
"bytes": "96552"
},
{
"name": "PLpgSQL",
"bytes": "2212"
},
{
"name": "Perl",
"bytes": "3947402"
},
{
"name": "Perl6",
"bytes": "122803"
},
{
"name": "PostScript",
"bytes": "152255"
},
{
"name": "Prolog",
"bytes": "42792"
},
{
"name": "Protocol Buffer",
"bytes": "54964"
},
{
"name": "Python",
"bytes": "381066"
},
{
"name": "R",
"bytes": "764"
},
{
"name": "Rebol",
"bytes": "738"
},
{
"name": "Ruby",
"bytes": "67015"
},
{
"name": "Scheme",
"bytes": "5087"
},
{
"name": "Scilab",
"bytes": "196"
},
{
"name": "Shell",
"bytes": "10963470"
},
{
"name": "SourcePawn",
"bytes": "2293"
},
{
"name": "SuperCollider",
"bytes": "80208"
},
{
"name": "Tcl",
"bytes": "7102"
},
{
"name": "TeX",
"bytes": "720582"
},
{
"name": "VimL",
"bytes": "19597"
},
{
"name": "XS",
"bytes": "17496"
},
{
"name": "XSLT",
"bytes": "4564"
},
{
"name": "Yacc",
"bytes": "1881915"
}
],
"symlink_target": ""
} |
package com.informatica.surf.sources.kinesis;
import com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor;
import com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory;
import com.lmax.disruptor.RingBuffer;
/**
*
* @author Informatica Corp
*/
public class RecordProcessorFactory implements IRecordProcessorFactory{
private final RingBuffer<KinesisEvent> _buffer;
public RecordProcessorFactory(RingBuffer<KinesisEvent> buffer){
_buffer = buffer;
}
@Override
public IRecordProcessor createProcessor() {
return new RecordProcessor(_buffer);
}
}
| {
"content_hash": "435debf53aecc2243713f2f242bc4c5a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 87,
"avg_line_length": 25.84,
"alnum_prop": 0.7616099071207431,
"repo_name": "InformaticaCorp/Surf",
"id": "6fed42b85cf0fdbeffa243761b86d600e6c6ef4a",
"size": "1248",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sources/kinesis/src/main/java/com/informatica/surf/sources/kinesis/RecordProcessorFactory.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "190702"
},
{
"name": "Shell",
"bytes": "3526"
}
],
"symlink_target": ""
} |
layout: post
title: Setup Common Lisp Development Environment by SLIME and Emacs
category: ComputerScience
tags: [CLisp]
---
<div class="message">
SLIME is the "Superior Lisp Interaction Mode for Emacs".SLIME extends Emacs with support for interactive programming in Common Lisp.The Features are centered around slime-mode,an Emacs minor-mode that complements the standard lisp-mode.
</div>
## Prerequisites
- **Install a Lisp implementation**
There are lots of Lisp implementations,such as Steel Bank Common Lisp,Clozure Common Lisp.We can get a binary package of CLISP easily by:
```bash
sudo apt-get install clisp
```
- **Install Emacs**
```bash
sudo apt-get install emacs24
```
- **Install SLIME**
Get a duplication of SLIME from <a href="http://common-lisp.net/project/slime/">here</a>,and put it in a location with whole permission.
## Configure the Emacs
Start Emacs and open ~/.emacs (if not exists,create one).Configure SLIME as below:
```elisp
(add-to-list 'load-path "/path/to/slime")
(require 'slime-autoloads)
(setq inferior-lisp-program "/usr/bin/clisp")
```
## Usage
Start Emacs,input M-x slime and just have fun with Common Lisp!
You can also binding a shortcut for SLIME,just adding:
```elisp
(global-set-key (kbd "C-x j") 'slime)
```
## Shortcuts binding in official documents
**Key bindings**
C-h k <key> describe-key “What does this key do?”
Describes current function bound to <key> for focus buffer.
C-h b describe-bindings “Exactly what bindings are available?”
Lists the current key-bindings for the focus buffer.
C-h m describe-mode “Tell me all about this mode”
Shows all the available major mode keys, then the minor mode keys, for the modes of the focus buffer.
C-h l view-lossage “Woah, what key chord did I just do?”
Shows you the literal sequence of keys you’ve pressed in order.
**Evaluation commands**
C-x C-e
M-x slime-eval-last-expression
Evaluate the expression before point and show the result in the echo area.
C-M-x
M-x slime-eval-defun
Evaluate the current toplevel form and show the result in the echo area. ‘C-M-x’treats ‘defvar’ expressions specially. Normally, evaluating a ‘defvar’ expressiondoes nothing if the variable it defines already has a value. But ‘C-M-x’ un-conditionally resets the variable to the initial value specified in the ‘defvar’expression. This special feature is convenient for debugging Lisp programs.If C-M-x or C-x C-e is given a numeric argument, it inserts the value into the currentbuffer, rather than displaying it in the echo area.
C-c :
M-x slime-interactive-eval
Evaluate an expression read from the minibuffer.
C-c C-r
M-x slime-eval-region
Evaluate the region.
C-c C-p
M-x slime-pprint-eval-last-expression
Evaluate the expression before point and pretty-print the result in a fresh buffer.
C-c E
M-x slime-edit-value
Edit the value of a setf-able form in a new buffer ‘*Edit <form>*’. The value isinserted into a temporary buffer for editing and then set in Lisp when committedwith C-c C-c.
C-x M-e
M-x slime-eval-last-expression-display-output
Display the output buffer and evaluate the expression preceding point. This is useful if the expression writes something to the output stream.
C-c C-u
M-x slime-undefine-function
Undefine the function, with fmakunbound, for the symbol at point.
**Compilation commands**
SLIME has fancy commands for compiling functions, files, and packages. The fancy part is
that notes and warnings offered by the Lisp compiler are intercepted and annotated directly
onto the corresponding expressions in the Lisp source buffer. (Give it a try to see what this
means.)
C-c C-c
M-x slime-compile-defun
Compile the top-level form at point. The region blinks shortly to give some
feedback which part was chosen.
With (positive) prefix argument the form is compiled with maximal debug set-
tings (C-u C-c C-c). With negative prefix argument it is compiled for speed
(M-- C-c C-c). If a numeric argument is passed set debug or speed settings to
it depending on its sign.
The code for the region is executed after compilation. In principle, the command
writes the region to a file, compiles that file, and loads the resulting code.
C-c C-k
M-x slime-compile-and-load-file
Compile and load the current buffer’s source file. If the compilation step fails,
the file is not loaded. It’s not always easy to tell whether the compilation failed:
occasionally you may end up in the debugger during the load step.
With (positive) prefix argument the file is compiled with maximal debug set-
tings (C-u C-c C-k). With negative prefix argument it is compiled for speed
(M-- C-c C-k). If a numeric argument is passed set debug or speed settings to
it depending on its sign.
C-c M-k
M-x slime-compile-file
Compile (but don’t load) the current buffer’s source file.
C-c C-l
M-x slime-load-file
Load a Lisp file. This command uses the Common Lisp LOAD function.
M-x slime-compile-region
Compile the selected region.
The annotations are indicated as underlining on source forms. The compiler message
associated with an annotation can be read either by placing the mouse over the text or with
the selection commands below.
M-n
M-x slime-next-note
Move the point to the next compiler note and displays the note.
M-p
M-x slime-previous-note
Move the point to the previous compiler note and displays the note.
C-c M-c
M-x slime-remove-notes
Remove all annotations from the buffer.
C-x ‘
M-x next-error
Visit the next-error message. This is not actually a SLIME command but SLIME
creates a hidden buffer so that most of the Compilation mode commands (See
Info file ‘emacs’, node ‘Compilation Mode’) work similarly for Lisp as for batch
compilers.
| {
"content_hash": "187e9a35a25fdd5c4b4f79709564b17b",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 529,
"avg_line_length": 28.97969543147208,
"alnum_prop": 0.765458048695043,
"repo_name": "akitsukikiritsugu/akitsukikiritsugu.github.io",
"id": "0c704ebca1ad9028aeefab9bb12d69070db2c0ec",
"size": "5773",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "_posts/2014-11-11-Slime.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "65686"
},
{
"name": "HTML",
"bytes": "78849"
},
{
"name": "JavaScript",
"bytes": "53349"
},
{
"name": "Ruby",
"bytes": "4098"
}
],
"symlink_target": ""
} |
<?php
final class LegalpadSignatureSearchConduitAPIMethod
extends PhabricatorSearchEngineAPIMethod {
public function getAPIMethodName() {
return 'legalpad.signature.search';
}
public function newSearchEngine() {
return new LegalpadDocumentSignatureSearchEngine();
}
public function getMethodSummary() {
return pht('Read information about legalpad signatures.');
}
}
| {
"content_hash": "14268fa463c22e36173ade5f3c1a9ff4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 62,
"avg_line_length": 23.294117647058822,
"alnum_prop": 0.7626262626262627,
"repo_name": "wikimedia/phabricator",
"id": "b96337e9cef7eb95f08a28ce2fbc4e863d58a845",
"size": "396",
"binary": false,
"copies": "1",
"ref": "refs/heads/wmf/stable",
"path": "src/applications/legalpad/conduit/LegalpadSignatureSearchConduitAPIMethod.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "106"
},
{
"name": "CSS",
"bytes": "430528"
},
{
"name": "JavaScript",
"bytes": "743397"
},
{
"name": "PHP",
"bytes": "17910973"
},
{
"name": "Shell",
"bytes": "2082"
}
],
"symlink_target": ""
} |
layout: atom
title: nil
---
{% for post in page.posts %}
<item>
<title>{{ post.title }}</title>
<link>{{ site.baseurl }}{{ post.url }}</link>
<author>{{ page.author }}</author>
<pubDate>{{ post.date | date_to_xmlschema }}</pubDate>
<guid>{{ site.baseurl }}{{ post.url }}</guid>
<description><![CDATA[
{{ post.content | expand_urls : site.url }}
]]></description>
</item>
{% endfor %}
| {
"content_hash": "2b151edab8e3656d107902d4c4fe63b2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 27.533333333333335,
"alnum_prop": 0.5690072639225182,
"repo_name": "chugly/chugly.github.io",
"id": "47e10718a71e25ec89c22d0e76b25b7cc711ea50",
"size": "417",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "_layouts/tag.xml",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "46747"
},
{
"name": "HTML",
"bytes": "31856"
},
{
"name": "JavaScript",
"bytes": "4424"
},
{
"name": "Ruby",
"bytes": "11498"
}
],
"symlink_target": ""
} |
package org.trvedata.crdt.operation;
import org.trvedata.crdt.ItemID;
public abstract class ChangingOperation implements Operation {
private ItemID operationID;
public ChangingOperation(ItemID operationID) {
this.operationID = operationID;
}
public abstract long logicalTs();
public ItemID getOperationID() {
return operationID;
}
public void setOperationID(ItemID operationID) {
this.operationID = operationID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((operationID == null) ? 0 : operationID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ChangingOperation other = (ChangingOperation) obj;
if (operationID == null) {
if (other.operationID != null)
return false;
} else if (!operationID.equals(other.operationID))
return false;
return true;
}
}
| {
"content_hash": "87d043306cfb71d53eabcddb0854bb70",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 81,
"avg_line_length": 22.02173913043478,
"alnum_prop": 0.7038499506416585,
"repo_name": "ept/op-crdt",
"id": "9d123bd1cf890bc90cfa266faa7a034743415e2b",
"size": "1013",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "java/src/main/java/org/trvedata/crdt/operation/ChangingOperation.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "722"
},
{
"name": "Java",
"bytes": "59573"
},
{
"name": "JavaScript",
"bytes": "158305"
},
{
"name": "Ruby",
"bytes": "136820"
}
],
"symlink_target": ""
} |
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
class BaseController extends AbstractActionController
{
protected $entityManager;
public function onDispatch(\Zend\Mvc\MvcEvent $e)
{
$this->setEntityManager($this->getServiceLocator()->get('Doctrine\ORM\EntityManager'));
return parent::onDispatch($e);
}
public function setEntityManager(\Doctrine\ORM\EntityManager $entityManager)
{
$this->entityManager = $entityManager;
}
public function getEntityManager()
{
return $this->entityManager;
}
}
| {
"content_hash": "0e8f4f69b278a2a4eeb534440a76c8d6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 95,
"avg_line_length": 22.77777777777778,
"alnum_prop": 0.6991869918699187,
"repo_name": "M1kefly/Myblog2Zend2.3.0_my_blog",
"id": "2fb2811bec529230f7d0a93d8e69662d00f1566b",
"size": "937",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "module/Application/src/Application/Controller/BaseController.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "711"
},
{
"name": "CSS",
"bytes": "1042"
},
{
"name": "HTML",
"bytes": "28950"
},
{
"name": "PHP",
"bytes": "51946"
}
],
"symlink_target": ""
} |
"""
Gateway for Binance Crypto Exchange.
"""
import urllib
import hashlib
import hmac
import time
from copy import copy
from datetime import datetime
from enum import Enum
from threading import Lock
from vnpy.api.rest import RestClient, Request
from vnpy.api.websocket import WebsocketClient
from vnpy.trader.constant import (
Direction,
Exchange,
Product,
Status,
OrderType
)
from vnpy.trader.gateway import BaseGateway
from vnpy.trader.object import (
TickData,
OrderData,
TradeData,
AccountData,
ContractData,
OrderRequest,
CancelRequest,
SubscribeRequest
)
from vnpy.trader.event import EVENT_TIMER
from vnpy.event import Event
REST_HOST = "https://www.binance.com"
WEBSOCKET_TRADE_HOST = "wss://stream.binance.com:9443/ws/"
WEBSOCKET_DATA_HOST = "wss://stream.binance.com:9443/stream?streams="
STATUS_BINANCE2VT = {
"NEW": Status.NOTTRADED,
"PARTIALLY_FILLED": Status.PARTTRADED,
"FILLED": Status.ALLTRADED,
"CANCELED": Status.CANCELLED,
"REJECTED": Status.REJECTED
}
ORDERTYPE_VT2BINANCE = {
OrderType.LIMIT: "LIMIT",
OrderType.MARKET: "MARKET"
}
ORDERTYPE_BINANCE2VT = {v: k for k, v in ORDERTYPE_VT2BINANCE.items()}
DIRECTION_VT2BINANCE = {
Direction.LONG: "BUY",
Direction.SHORT: "SELL"
}
DIRECTION_BINANCE2VT = {v: k for k, v in DIRECTION_VT2BINANCE.items()}
class Security(Enum):
NONE = 0
SIGNED = 1
API_KEY = 2
symbol_name_map = {}
class BinanceGateway(BaseGateway):
"""
VN Trader Gateway for Binance connection.
"""
default_setting = {
"key": "",
"secret": "",
"session_number": 3,
"proxy_host": "",
"proxy_port": 0,
}
exchanges = [Exchange.BINANCE]
def __init__(self, event_engine):
"""Constructor"""
super().__init__(event_engine, "BINANCE")
self.trade_ws_api = BinanceTradeWebsocketApi(self)
self.market_ws_api = BinanceDataWebsocketApi(self)
self.rest_api = BinanceRestApi(self)
self.event_engine.register(EVENT_TIMER, self.process_timer_event)
def connect(self, setting: dict):
""""""
key = setting["key"]
secret = setting["secret"]
session_number = setting["session_number"]
proxy_host = setting["proxy_host"]
proxy_port = setting["proxy_port"]
self.rest_api.connect(key, secret, session_number,
proxy_host, proxy_port)
self.market_ws_api.connect(proxy_host, proxy_port)
def subscribe(self, req: SubscribeRequest):
""""""
self.market_ws_api.subscribe(req)
def send_order(self, req: OrderRequest):
""""""
return self.rest_api.send_order(req)
def cancel_order(self, req: CancelRequest):
""""""
self.rest_api.cancel_order(req)
def query_account(self):
""""""
pass
def query_position(self):
""""""
pass
def close(self):
""""""
self.rest_api.stop()
self.trade_ws_api.stop()
self.market_ws_api.stop()
def process_timer_event(self, event: Event):
""""""
self.rest_api.keep_user_stream()
class BinanceRestApi(RestClient):
"""
BINANCE REST API
"""
def __init__(self, gateway: BinanceGateway):
""""""
super().__init__()
self.gateway = gateway
self.gateway_name = gateway.gateway_name
self.trade_ws_api = self.gateway.trade_ws_api
self.key = ""
self.secret = ""
self.user_stream_key = ""
self.keep_alive_count = 0
self.recv_window = 5000
self.time_offset = 0
self.order_count = 1_000_000
self.order_count_lock = Lock()
self.connect_time = 0
def sign(self, request):
"""
Generate BINANCE signature.
"""
if request.params:
path = request.path + "?" + urllib.parse.urlencode(request.params)
else:
request.params = dict()
path = request.path
security = request.data["security"]
if security == Security.SIGNED:
timestamp = int(time.time() * 1000)
if self.time_offset > 0:
timestamp -= abs(self.time_offset)
elif self.time_offset < 0:
timestamp += abs(self.time_offset)
request.params["timestamp"] = timestamp
# request.params["recv_window"] = self.recv_window
query = urllib.parse.urlencode(sorted(request.params.items()))
signature = hmac.new(self.secret, query.encode(
"utf-8"), hashlib.sha256).hexdigest()
query += "&signature={}".format(signature)
path = request.path + "?" + query
request.path = path
request.params = {}
request.data = {}
# Add headers
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
"X-MBX-APIKEY": self.key
}
if security == Security.SIGNED or security == Security.API_KEY:
request.headers = headers
return request
def connect(
self,
key: str,
secret: str,
session_number: int,
proxy_host: str,
proxy_port: int
):
"""
Initialize connection to REST server.
"""
self.key = key
self.secret = secret.encode()
self.proxy_port = proxy_port
self.proxy_host = proxy_host
self.connect_time = (
int(datetime.now().strftime("%y%m%d%H%M%S")) * self.order_count
)
self.init(REST_HOST, proxy_host, proxy_port)
self.start(session_number)
self.gateway.write_log("REST API启动成功")
self.query_time()
self.query_account()
self.query_order()
self.query_contract()
self.start_user_stream()
def query_time(self):
""""""
data = {
"security": Security.NONE
}
path = "/api/v1/time"
return self.add_request(
"GET",
path,
callback=self.on_query_time,
data=data
)
def query_account(self):
""""""
data = {"security": Security.SIGNED}
self.add_request(
method="GET",
path="/api/v3/account",
callback=self.on_query_account,
data=data
)
def query_order(self):
""""""
data = {"security": Security.SIGNED}
self.add_request(
method="GET",
path="/api/v3/openOrders",
callback=self.on_query_order,
data=data
)
def query_contract(self):
""""""
data = {
"security": Security.NONE
}
self.add_request(
method="GET",
path="/api/v1/exchangeInfo",
callback=self.on_query_contract,
data=data
)
def _new_order_id(self):
""""""
with self.order_count_lock:
self.order_count += 1
return self.order_count
def send_order(self, req: OrderRequest):
""""""
orderid = str(self.connect_time + self._new_order_id())
order = req.create_order_data(
orderid,
self.gateway_name
)
self.gateway.on_order(order)
data = {
"security": Security.SIGNED
}
params = {
"symbol": req.symbol,
"timeInForce": "GTC",
"side": DIRECTION_VT2BINANCE[req.direction],
"type": ORDERTYPE_VT2BINANCE[req.type],
"price": str(req.price),
"quantity": str(req.volume),
"newClientOrderId": orderid,
"newOrderRespType": "ACK"
}
self.add_request(
method="POST",
path="/api/v3/order",
callback=self.on_send_order,
data=data,
params=params,
extra=order,
on_error=self.on_send_order_error,
on_failed=self.on_send_order_failed
)
return order.vt_orderid
def cancel_order(self, req: CancelRequest):
""""""
data = {
"security": Security.SIGNED
}
params = {
"symbol": req.symbol,
"origClientOrderId": req.orderid
}
self.add_request(
method="DELETE",
path="/api/v3/order",
callback=self.on_cancel_order,
params=params,
data=data,
extra=req
)
def start_user_stream(self):
""""""
data = {
"security": Security.API_KEY
}
self.add_request(
method="POST",
path="/api/v1/userDataStream",
callback=self.on_start_user_stream,
data=data
)
def keep_user_stream(self):
""""""
self.keep_alive_count += 1
if self.keep_alive_count < 1800:
return
data = {
"security": Security.SIGNED
}
params = {
"listenKey": self.user_stream_key
}
self.add_request(
method="PUT",
path="/api/v1/userDataStream",
callback=self.on_keep_user_stream,
params=params,
data=data
)
def on_query_time(self, data, request):
""""""
local_time = int(time.time() * 1000)
server_time = int(data["serverTime"])
self.time_offset = local_time - server_time
def on_query_account(self, data, request):
""""""
for account_data in data["balances"]:
account = AccountData(
accountid=account_data["asset"],
balance=float(account_data["free"]) + float(account_data["locked"]),
frozen=float(account_data["locked"]),
gateway_name=self.gateway_name
)
if account.balance:
self.gateway.on_account(account)
self.gateway.write_log("账户资金查询成功")
def on_query_order(self, data, request):
""""""
for d in data:
dt = datetime.fromtimestamp(d["time"] / 1000)
time = dt.strftime("%Y-%m-%d %H:%M:%S")
order = OrderData(
orderid=d["clientOrderId"],
symbol=d["symbol"],
exchange=Exchange.BINANCE,
price=float(d["price"]),
volume=float(d["origQty"]),
type=ORDERTYPE_BINANCE2VT[d["type"]],
direction=DIRECTION_BINANCE2VT[d["side"]],
traded=float(d["executedQty"]),
status=STATUS_BINANCE2VT.get(d["status"], None),
time=time,
gateway_name=self.gateway_name,
)
self.gateway.on_order(order)
self.gateway.write_log("委托信息查询成功")
def on_query_contract(self, data, request):
""""""
for d in data["symbols"]:
base_currency = d["baseAsset"]
quote_currency = d["quoteAsset"]
name = f"{base_currency.upper()}/{quote_currency.upper()}"
pricetick = 0
min_volume = 0
for f in d["filters"]:
if f["filterType"] == "PRICE_FILTER":
pricetick = f["tickSize"]
elif f["filterType"] == "LOT_SIZE":
min_volume = f["stepSize"]
contract = ContractData(
symbol=d["symbol"],
exchange=Exchange.BINANCE,
name=name,
pricetick=pricetick,
size=1,
min_volume=min_volume,
product=Product.SPOT,
gateway_name=self.gateway_name,
)
self.gateway.on_contract(contract)
symbol_name_map[contract.symbol] = contract.name
self.gateway.write_log("合约信息查询成功")
def on_send_order(self, data, request):
""""""
pass
def on_send_order_failed(self, status_code: str, request: Request):
"""
Callback when sending order failed on server.
"""
order = request.extra
order.status = Status.REJECTED
self.gateway.on_order(order)
msg = f"委托失败,状态码:{status_code},信息:{request.response.text}"
self.gateway.write_log(msg)
def on_send_order_error(
self, exception_type: type, exception_value: Exception, tb, request: Request
):
"""
Callback when sending order caused exception.
"""
order = request.extra
order.status = Status.REJECTED
self.gateway.on_order(order)
# Record exception if not ConnectionError
if not issubclass(exception_type, ConnectionError):
self.on_error(exception_type, exception_value, tb, request)
def on_cancel_order(self, data, request):
""""""
pass
def on_start_user_stream(self, data, request):
""""""
self.user_stream_key = data["listenKey"]
self.keep_alive_count = 0
url = WEBSOCKET_TRADE_HOST + self.user_stream_key
self.trade_ws_api.connect(url, self.proxy_host, self.proxy_port)
def on_keep_user_stream(self, data, request):
""""""
pass
class BinanceTradeWebsocketApi(WebsocketClient):
""""""
def __init__(self, gateway):
""""""
super().__init__()
self.gateway = gateway
self.gateway_name = gateway.gateway_name
def connect(self, url, proxy_host, proxy_port):
""""""
self.init(url, proxy_host, proxy_port)
self.start()
def on_connected(self):
""""""
self.gateway.write_log("交易Websocket API连接成功")
def on_packet(self, packet: dict): # type: (dict)->None
""""""
if packet["e"] == "outboundAccountInfo":
self.on_account(packet)
else:
self.on_order(packet)
def on_account(self, packet):
""""""
for d in packet["B"]:
account = AccountData(
accountid=d["a"],
balance=float(d["f"]) + float(d["l"]),
frozen=float(d["l"]),
gateway_name=self.gateway_name
)
if account.balance:
self.gateway.on_account(account)
def on_order(self, packet: dict):
""""""
dt = datetime.fromtimestamp(packet["O"] / 1000)
time = dt.strftime("%Y-%m-%d %H:%M:%S")
if packet["C"] == "null":
orderid = packet["c"]
else:
orderid = packet["C"]
order = OrderData(
symbol=packet["s"],
exchange=Exchange.BINANCE,
orderid=orderid,
type=ORDERTYPE_BINANCE2VT[packet["o"]],
direction=DIRECTION_BINANCE2VT[packet["S"]],
price=float(packet["p"]),
volume=float(packet["q"]),
traded=float(packet["z"]),
status=STATUS_BINANCE2VT[packet["X"]],
time=time,
gateway_name=self.gateway_name
)
self.gateway.on_order(order)
# Push trade event
trade_volume = float(packet["l"])
if not trade_volume:
return
trade_dt = datetime.fromtimestamp(packet["T"] / 1000)
trade_time = trade_dt.strftime("%Y-%m-%d %H:%M:%S")
trade = TradeData(
symbol=order.symbol,
exchange=order.exchange,
orderid=order.orderid,
tradeid=packet["t"],
direction=order.direction,
price=float(packet["L"]),
volume=trade_volume,
time=trade_time,
gateway_name=self.gateway_name,
)
self.gateway.on_trade(trade)
class BinanceDataWebsocketApi(WebsocketClient):
""""""
def __init__(self, gateway):
""""""
super().__init__()
self.gateway = gateway
self.gateway_name = gateway.gateway_name
self.ticks = {}
def connect(self, proxy_host: str, proxy_port: int):
""""""
self.proxy_host = proxy_host
self.proxy_port = proxy_port
def on_connected(self):
""""""
self.gateway.write_log("行情Websocket API连接刷新")
def subscribe(self, req: SubscribeRequest):
""""""
if req.symbol not in symbol_name_map:
self.gateway.write_log(f"找不到该合约代码{req.symbol}")
return
# Create tick buf data
tick = TickData(
symbol=req.symbol,
name=symbol_name_map.get(req.symbol, ""),
exchange=Exchange.BINANCE,
datetime=datetime.now(),
gateway_name=self.gateway_name,
)
self.ticks[req.symbol.lower()] = tick
# Close previous connection
if self._active:
self.stop()
self.join()
# Create new connection
channels = []
for ws_symbol in self.ticks.keys():
channels.append(ws_symbol + "@ticker")
channels.append(ws_symbol + "@depth5")
url = WEBSOCKET_DATA_HOST + "/".join(channels)
self.init(url, self.proxy_host, self.proxy_port)
self.start()
def on_packet(self, packet):
""""""
stream = packet["stream"]
data = packet["data"]
symbol, channel = stream.split("@")
tick = self.ticks[symbol]
if channel == "ticker":
tick.volume = float(data['v'])
tick.open_price = float(data['o'])
tick.high_price = float(data['h'])
tick.low_price = float(data['l'])
tick.last_price = float(data['c'])
tick.datetime = datetime.fromtimestamp(float(data['E']) / 1000)
else:
bids = data["bids"]
for n in range(5):
price, volume = bids[n]
tick.__setattr__("bid_price_" + str(n + 1), float(price))
tick.__setattr__("bid_volume_" + str(n + 1), float(volume))
asks = data["asks"]
for n in range(5):
price, volume = asks[n]
tick.__setattr__("ask_price_" + str(n + 1), float(price))
tick.__setattr__("ask_volume_" + str(n + 1), float(volume))
if tick.last_price:
self.gateway.on_tick(copy(tick))
| {
"content_hash": "49a61d37fb5c47ffa15adf5c22686103",
"timestamp": "",
"source": "github",
"line_count": 679,
"max_line_length": 84,
"avg_line_length": 27.197349042709867,
"alnum_prop": 0.5262359885200628,
"repo_name": "andrewchenshx/vnpy",
"id": "b3454d711384882394cb2a7214c2804e588924e5",
"size": "18589",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vnpy/gateway/binance/binance_gateway.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3611917"
},
{
"name": "C++",
"bytes": "9732272"
},
{
"name": "CMake",
"bytes": "44488"
},
{
"name": "Jupyter Notebook",
"bytes": "43109"
},
{
"name": "Makefile",
"bytes": "99693"
},
{
"name": "Objective-C",
"bytes": "143589"
},
{
"name": "Python",
"bytes": "6568979"
},
{
"name": "R",
"bytes": "1354"
},
{
"name": "Shell",
"bytes": "5999"
}
],
"symlink_target": ""
} |
:man_page: bson_json_opts_new
bson_json_opts_new()
====================
Synopsis
--------
.. code-block:: c
bson_json_opts_t *
bson_json_opts_new (bson_json_mode_t mode, int32_t max_len);
Parameters
----------
* ``mode``: A bson_json_mode_t.
* ``max_len``: An int32_t.
Description
-----------
The :symbol:`bson_json_opts_new()` function shall create a new :symbol:`bson_json_opts_t` using the mode and length supplied. The ``mode`` member is a :symbol:`bson_json_mode_t` defining the encoding mode.
The ``max_len`` member holds a maximum length for the resulting JSON string. Encoding will stop once the serialised string has reached this length. To encode the full BSON document, ``BSON_MAX_LEN_UNLIMITED`` can be used.
Returns
-------
A newly allocated :symbol:`bson_json_opts_t`.
| {
"content_hash": "b89fb158d37e16fb168b3971b205050f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 221,
"avg_line_length": 25.806451612903224,
"alnum_prop": 0.665,
"repo_name": "rcsanchez97/mongo-c-driver",
"id": "a41cc59dac40791eec2fc8095161f37487898108",
"size": "800",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/libbson/doc/bson_json_opts_new.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "26295"
},
{
"name": "C",
"bytes": "9087818"
},
{
"name": "C++",
"bytes": "11382"
},
{
"name": "CMake",
"bytes": "194013"
},
{
"name": "CSS",
"bytes": "4293"
},
{
"name": "DIGITAL Command Language",
"bytes": "26402"
},
{
"name": "GDB",
"bytes": "4512"
},
{
"name": "HTML",
"bytes": "26538"
},
{
"name": "JavaScript",
"bytes": "62015"
},
{
"name": "Makefile",
"bytes": "13557"
},
{
"name": "Perl",
"bytes": "3895"
},
{
"name": "Python",
"bytes": "433894"
},
{
"name": "Roff",
"bytes": "4477"
},
{
"name": "Shell",
"bytes": "147989"
}
],
"symlink_target": ""
} |
==================================
How to extend django SHOP models
==================================
(Instead of the default ones)
Some people might feel like the django SHOP models are not suitable for their
project, or want to extend functionality for their specific needs.
This is a rather advanced use case, and most developers should hopefully be happy
with the default models. It is however relatively easy to do.
All models you can override have a corresponding setting, which should contain
the class path to the model you wish to use in its stead.
.. note:: While your models will be used, they will still be "called" by their
default django SHOP name.
Example
========
Extending the Product model in django SHOP works like this::
# In myproject.models
from shop.models_bases import BaseProduct
class MyProduct(BaseProduct):
def extra_method(self):
return 'Yay'
class Meta:
pass
# In your project's settings.py, add the following line:
SHOP_PRODUCT_MODEL = 'myproject.models.MyProduct'
.. important:: Your model replacement must define a :class:`Meta` class.
Otherwise, it will inherit its parent's :class:`Meta`, which will break
things. The :class:`Meta` class does not need to do anything important - it
just has to be there.
From a django interactive shell, you should now be able to do::
>>> from shop.models import Product
>>> p = Product.objects.all()[0] # I assume there is already at least one
>>> p.extra_method()
Yay
>>> p.__class__
<class object's class>
Settings
=========
All available settings to control model overrides are defined in :doc:`/settings`
| {
"content_hash": "5e074be225cc924e097f31ef16e07b5a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 82,
"avg_line_length": 32.37735849056604,
"alnum_prop": 0.6701631701631702,
"repo_name": "bmihelac/django-shop",
"id": "76d6c92a10123a77c806a566b38c03a4255f592a",
"size": "1716",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "docs/howto/how-to-extend-django-shop-models.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "386859"
},
{
"name": "Shell",
"bytes": "5030"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.