text
stringlengths 2
1.04M
| meta
dict |
---|---|
package com.alibaba.dubbo.remoting.exchange.support;
import com.alibaba.dubbo.remoting.Channel;
import com.alibaba.dubbo.remoting.ChannelHandler;
import com.alibaba.dubbo.remoting.RemotingException;
import com.alibaba.dubbo.remoting.exchange.ExchangeChannel;
import com.alibaba.dubbo.remoting.exchange.ExchangeHandler;
import com.alibaba.dubbo.remoting.telnet.TelnetHandler;
import com.alibaba.dubbo.remoting.telnet.support.TelnetHandlerAdapter;
import com.alibaba.dubbo.remoting.transport.ChannelHandlerDispatcher;
/**
* ExchangeHandlerDispatcher
*
* @author william.liangf
*/
public class ExchangeHandlerDispatcher implements ExchangeHandler {
private final ReplierDispatcher replierDispatcher;
private final ChannelHandlerDispatcher handlerDispatcher;
private final TelnetHandler telnetHandler;
public ExchangeHandlerDispatcher() {
replierDispatcher = new ReplierDispatcher();
handlerDispatcher = new ChannelHandlerDispatcher();
telnetHandler = new TelnetHandlerAdapter();
}
public ExchangeHandlerDispatcher(Replier<?> replier) {
replierDispatcher = new ReplierDispatcher(replier);
handlerDispatcher = new ChannelHandlerDispatcher();
telnetHandler = new TelnetHandlerAdapter();
}
public ExchangeHandlerDispatcher(ChannelHandler... handlers) {
replierDispatcher = new ReplierDispatcher();
handlerDispatcher = new ChannelHandlerDispatcher(handlers);
telnetHandler = new TelnetHandlerAdapter();
}
public ExchangeHandlerDispatcher(Replier<?> replier, ChannelHandler... handlers) {
replierDispatcher = new ReplierDispatcher(replier);
handlerDispatcher = new ChannelHandlerDispatcher(handlers);
telnetHandler = new TelnetHandlerAdapter();
}
public ExchangeHandlerDispatcher addChannelHandler(ChannelHandler handler) {
handlerDispatcher.addChannelHandler(handler);
return this;
}
public ExchangeHandlerDispatcher removeChannelHandler(ChannelHandler handler) {
handlerDispatcher.removeChannelHandler(handler);
return this;
}
public <T> ExchangeHandlerDispatcher addReplier(Class<T> type, Replier<T> replier) {
replierDispatcher.addReplier(type, replier);
return this;
}
public <T> ExchangeHandlerDispatcher removeReplier(Class<T> type) {
replierDispatcher.removeReplier(type);
return this;
}
@SuppressWarnings({"unchecked", "rawtypes"})
public Object reply(ExchangeChannel channel, Object request) throws RemotingException {
return ((Replier) replierDispatcher).reply(channel, request);
}
public void connected(Channel channel) {
handlerDispatcher.connected(channel);
}
public void disconnected(Channel channel) {
handlerDispatcher.disconnected(channel);
}
public void sent(Channel channel, Object message) {
handlerDispatcher.sent(channel, message);
}
public void received(Channel channel, Object message) {
handlerDispatcher.received(channel, message);
}
public void caught(Channel channel, Throwable exception) {
handlerDispatcher.caught(channel, exception);
}
public String telnet(Channel channel, String message) throws RemotingException {
return telnetHandler.telnet(channel, message);
}
} | {
"content_hash": "9a873b9999e0437ed43b60a38e2e876f",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 91,
"avg_line_length": 35.01010101010101,
"alnum_prop": 0.7186959030582805,
"repo_name": "mingbotang/dubbo",
"id": "c423b7a359f5fb38f007bf82a9913c9631372ad5",
"size": "4089",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/ExchangeHandlerDispatcher.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "8441"
},
{
"name": "CSS",
"bytes": "21097"
},
{
"name": "Java",
"bytes": "5730251"
},
{
"name": "JavaScript",
"bytes": "76109"
},
{
"name": "Lex",
"bytes": "2077"
},
{
"name": "Shell",
"bytes": "13751"
},
{
"name": "Thrift",
"bytes": "668"
}
],
"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_32) on Wed Jul 18 13:34:51 UTC 2012 -->
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
Uses of Interface org.apache.solr.search.DocSet (Solr 5.0-2012-07-18_13-07-53 API)
</TITLE>
<META NAME="date" CONTENT="2012-07-18">
<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 Interface org.apache.solr.search.DocSet (Solr 5.0-2012-07-18_13-07-53 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/solr/search/DocSet.html" title="interface in org.apache.solr.search"><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="../../../../../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/solr/search//class-useDocSet.html" target="_top"><B>FRAMES</B></A>
<A HREF="DocSet.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 Interface<br>org.apache.solr.search.DocSet</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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.solr.handler.clustering"><B>org.apache.solr.handler.clustering</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.solr.handler.component"><B>org.apache.solr.handler.component</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.solr.request"><B>org.apache.solr.request</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.solr.search"><B>org.apache.solr.search</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.solr.search.grouping.collector"><B>org.apache.solr.search.grouping.collector</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.solr.search.grouping.distributed.command"><B>org.apache.solr.search.grouping.distributed.command</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.solr.handler.clustering"><!-- --></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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/handler/clustering/package-summary.html">org.apache.solr.handler.clustering</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">Methods in <A HREF="../../../../../org/apache/solr/handler/clustering/package-summary.html">org.apache.solr.handler.clustering</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract <A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A></CODE></FONT></TD>
<TD><CODE><B>DocumentClusteringEngine.</B><B><A HREF="../../../../../org/apache/solr/handler/clustering/DocumentClusteringEngine.html#cluster(org.apache.solr.search.DocSet, org.apache.solr.common.params.SolrParams)">cluster</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="../../../../../org/apache/solr/common/params/SolrParams.html" title="class in org.apache.solr.common.params">SolrParams</A> solrParams)</CODE>
<BR>
Experimental.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.solr.handler.component"><!-- --></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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/handler/component/package-summary.html">org.apache.solr.handler.component</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">Methods in <A HREF="../../../../../org/apache/solr/handler/component/package-summary.html">org.apache.solr.handler.component</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>>></CODE></FONT></TD>
<TD><CODE><B>PivotFacetHelper.</B><B><A HREF="../../../../../org/apache/solr/handler/component/PivotFacetHelper.html#doPivots(org.apache.solr.common.util.NamedList, java.lang.String, java.lang.String, java.util.Deque, org.apache.solr.handler.component.ResponseBuilder, org.apache.solr.search.DocSet, int)">doPivots</A></B>(<A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</A>> superFacets,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> field,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> subField,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/util/Deque.html?is-external=true" title="class or interface in java.util">Deque</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>> fnames,
<A HREF="../../../../../org/apache/solr/handler/component/ResponseBuilder.html" title="class in org.apache.solr.handler.component">ResponseBuilder</A> rb,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
int minMatch)</CODE>
<BR>
Recursive function to do all the pivots</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../org/apache/solr/request/SimpleFacets.html" title="class in org.apache.solr.request">SimpleFacets</A></CODE></FONT></TD>
<TD><CODE><B>PivotFacetHelper.</B><B><A HREF="../../../../../org/apache/solr/handler/component/PivotFacetHelper.html#getFacetImplementation(org.apache.solr.request.SolrQueryRequest, org.apache.solr.search.DocSet, org.apache.solr.common.params.SolrParams)">getFacetImplementation</A></B>(<A HREF="../../../../../org/apache/solr/request/SolrQueryRequest.html" title="interface in org.apache.solr.request">SolrQueryRequest</A> req,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="../../../../../org/apache/solr/common/params/SolrParams.html" title="class in org.apache.solr.common.params">SolrParams</A> params)</CODE>
<BR>
Designed to be overridden by subclasses that provide different faceting implementations.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.solr.request"><!-- --></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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/request/package-summary.html">org.apache.solr.request</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">Fields in <A HREF="../../../../../org/apache/solr/request/package-summary.html">org.apache.solr.request</A> declared as <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SimpleFacets.</B><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#docs">docs</A></B></CODE>
<BR>
The main set of documents all facet counts should be relative to</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/solr/request/package-summary.html">org.apache.solr.request</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</A>></CODE></FONT></TD>
<TD><CODE><B>UnInvertedField.</B><B><A HREF="../../../../../org/apache/solr/request/UnInvertedField.html#getCounts(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, int, int, java.lang.Integer, boolean, java.lang.String, java.lang.String)">getCounts</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html" title="class in org.apache.solr.search">SolrIndexSearcher</A> searcher,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> baseDocs,
int offset,
int limit,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</A> mincount,
boolean missing,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sort,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> prefix)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</A>></CODE></FONT></TD>
<TD><CODE><B>SimpleFacets.</B><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#getFacetTermEnumCounts(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String, int, int, int, boolean, java.lang.String, java.lang.String)">getFacetTermEnumCounts</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html" title="class in org.apache.solr.search">SolrIndexSearcher</A> searcher,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> field,
int offset,
int limit,
int mincount,
boolean missing,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sort,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> prefix)</CODE>
<BR>
Returns a list of terms in the specified field along with the
corresponding count of documents in the set that match that constraint.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</A>></CODE></FONT></TD>
<TD><CODE><B>SimpleFacets.</B><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#getFieldCacheCounts(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String, int, int, int, boolean, java.lang.String, java.lang.String)">getFieldCacheCounts</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html" title="class in org.apache.solr.search">SolrIndexSearcher</A> searcher,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> fieldName,
int offset,
int limit,
int mincount,
boolean missing,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sort,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> prefix)</CODE>
<BR>
Use the Lucene FieldCache to get counts for each unique field value in <code>docs</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B>SimpleFacets.</B><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#getFieldMissingCount(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String)">getFieldMissingCount</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html" title="class in org.apache.solr.search">SolrIndexSearcher</A> searcher,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> fieldName)</CODE>
<BR>
Returns a count of the documents in the set which do not have any
terms for for the specified field.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/common/util/NamedList.html" title="class in org.apache.solr.common.util">NamedList</A><<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</A>></CODE></FONT></TD>
<TD><CODE><B>SimpleFacets.</B><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#getGroupedCounts(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String, boolean, int, int, int, boolean, java.lang.String, java.lang.String)">getGroupedCounts</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html" title="class in org.apache.solr.search">SolrIndexSearcher</A> searcher,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> base,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> field,
boolean multiToken,
int offset,
int limit,
int mincount,
boolean missing,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sort,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> prefix)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/handler/component/StatsValues.html" title="interface in org.apache.solr.handler.component">StatsValues</A></CODE></FONT></TD>
<TD><CODE><B>UnInvertedField.</B><B><A HREF="../../../../../org/apache/solr/request/UnInvertedField.html#getStats(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.search.DocSet, java.lang.String[])">getStats</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html" title="class in org.apache.solr.search">SolrIndexSearcher</A> searcher,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> baseDocs,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[] facet)</CODE>
<BR>
Collect statistics about the UninvertedField.</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/solr/request/package-summary.html">org.apache.solr.request</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#SimpleFacets(org.apache.solr.request.SolrQueryRequest, org.apache.solr.search.DocSet, org.apache.solr.common.params.SolrParams)">SimpleFacets</A></B>(<A HREF="../../../../../org/apache/solr/request/SolrQueryRequest.html" title="interface in org.apache.solr.request">SolrQueryRequest</A> req,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="../../../../../org/apache/solr/common/params/SolrParams.html" title="class in org.apache.solr.common.params">SolrParams</A> params)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/solr/request/SimpleFacets.html#SimpleFacets(org.apache.solr.request.SolrQueryRequest, org.apache.solr.search.DocSet, org.apache.solr.common.params.SolrParams, org.apache.solr.handler.component.ResponseBuilder)">SimpleFacets</A></B>(<A HREF="../../../../../org/apache/solr/request/SolrQueryRequest.html" title="interface in org.apache.solr.request">SolrQueryRequest</A> req,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docs,
<A HREF="../../../../../org/apache/solr/common/params/SolrParams.html" title="class in org.apache.solr.common.params">SolrParams</A> params,
<A HREF="../../../../../org/apache/solr/handler/component/ResponseBuilder.html" title="class in org.apache.solr.handler.component">ResponseBuilder</A> rb)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.solr.search"><!-- --></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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/search/package-summary.html">org.apache.solr.search</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">Subinterfaces of <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/search/package-summary.html">org.apache.solr.search</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> interface</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/solr/search/DocList.html" title="interface in org.apache.solr.search">DocList</A></B></CODE>
<BR>
<code>DocList</code> represents the result of a query: an ordered list of document ids with optional score.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Classes in <A HREF="../../../../../org/apache/solr/search/package-summary.html">org.apache.solr.search</A> that implement <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</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/solr/search/BitDocSet.html" title="class in org.apache.solr.search">BitDocSet</A></B></CODE>
<BR>
<code>BitDocSet</code> represents an unordered set of Lucene Document Ids
using a BitSet.</TD>
</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/solr/search/DocSlice.html" title="class in org.apache.solr.search">DocSlice</A></B></CODE>
<BR>
<code>DocSlice</code> implements DocList as an array of docids and optional scores.</TD>
</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/solr/search/HashDocSet.html" title="class in org.apache.solr.search">HashDocSet</A></B></CODE>
<BR>
<code>HashDocSet</code> represents an unordered set of Lucene Document Ids
using a primitive int hash table.</TD>
</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/solr/search/SortedIntDocSet.html" title="class in org.apache.solr.search">SortedIntDocSet</A></B></CODE>
<BR>
<code>SortedIntDocSet</code> represents a sorted set of Lucene Document Ids.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../../../org/apache/solr/search/package-summary.html">org.apache.solr.search</A> declared as <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.ProcessedFilter.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.ProcessedFilter.html#answer">answer</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocListAndSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocListAndSet.html#docSet">docSet</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#EMPTY">EMPTY</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/solr/search/package-summary.html">org.apache.solr.search</A> that return <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the documents in this set that are not in the other set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SortedIntDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/SortedIntDocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSetCollector.</B><B><A HREF="../../../../../org/apache/solr/search/DocSetCollector.html#getDocSet()">getDocSet</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.QueryResult.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.QueryResult.html#getDocSet()">getDocSet</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSetDelegateCollector.</B><B><A HREF="../../../../../org/apache/solr/search/DocSetDelegateCollector.html#getDocSet()">getDocSet</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSet(java.util.List)">getDocSet</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A>> queries)</CODE>
<BR>
Returns the set of document ids matching all queries.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSet(org.apache.lucene.search.Query)">getDocSet</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query)</CODE>
<BR>
Returns the set of document ids matching a query.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSet(org.apache.lucene.search.Query, org.apache.solr.search.DocSet)">getDocSet</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter)</CODE>
<BR>
Returns the set of document ids matching both the query and the filter.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSet(org.apache.solr.search.SolrIndexSearcher.DocsEnumState)">getDocSet</A></B>(<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.DocsEnumState.html" title="class in org.apache.solr.search">SolrIndexSearcher.DocsEnumState</A> deState)</CODE>
<BR>
lucene.internal</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSetNC(org.apache.lucene.search.Query, org.apache.solr.search.DocSet)">getDocSetNC</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.QueryCommand.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.QueryCommand.html#getFilter()">getFilter</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the intersection of this set with another set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSlice.</B><B><A HREF="../../../../../org/apache/solr/search/DocSlice.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SortedIntDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/SortedIntDocSet.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#union(org.apache.solr.search.DocSet)">union</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the union of this set with another set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#union(org.apache.solr.search.DocSet)">union</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#union(org.apache.solr.search.DocSet)">union</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/solr/search/package-summary.html">org.apache.solr.search</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the documents in this set that are not in the other set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SortedIntDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/SortedIntDocSet.html#andNot(org.apache.solr.search.DocSet)">andNot</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#andNotSize(org.apache.solr.search.DocSet)">andNotSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the number of documents in this set that are not in the other set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#andNotSize(org.apache.solr.search.DocSet)">andNotSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#cacheDocSet(org.apache.lucene.search.Query, org.apache.solr.search.DocSet, boolean)">cacheDocSet</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> optionalAnswer,
boolean mustCache)</CODE>
<BR>
Compute and cache the DocSet that matches a query.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocList.html" title="interface in org.apache.solr.search">DocList</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocList(org.apache.lucene.search.Query, org.apache.solr.search.DocSet, org.apache.lucene.search.Sort, int, int)">getDocList</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter,
<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Sort.html?is-external=true" title="class or interface in org.apache.lucene.search">Sort</A> lsort,
int offset,
int len)</CODE>
<BR>
Returns documents matching both <code>query</code> and <code>filter</code>
and sorted by <code>sort</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocListAndSet.html" title="class in org.apache.solr.search">DocListAndSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocListAndSet(org.apache.lucene.search.Query, org.apache.solr.search.DocSet, org.apache.lucene.search.Sort, int, int)">getDocListAndSet</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter,
<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Sort.html?is-external=true" title="class or interface in org.apache.lucene.search">Sort</A> lsort,
int offset,
int len)</CODE>
<BR>
Returns documents matching both <code>query</code> and <code>filter</code>
and sorted by <code>sort</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocListAndSet.html" title="class in org.apache.solr.search">DocListAndSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocListAndSet(org.apache.lucene.search.Query, org.apache.solr.search.DocSet, org.apache.lucene.search.Sort, int, int, int)">getDocListAndSet</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter,
<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Sort.html?is-external=true" title="class or interface in org.apache.lucene.search">Sort</A> lsort,
int offset,
int len,
int flags)</CODE>
<BR>
Returns documents matching both <code>query</code> and <code>filter</code>
and sorted by <code>sort</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSet(org.apache.lucene.search.Query, org.apache.solr.search.DocSet)">getDocSet</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter)</CODE>
<BR>
Returns the set of document ids matching both the query and the filter.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getDocSetNC(org.apache.lucene.search.Query, org.apache.solr.search.DocSet)">getDocSetNC</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> query,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.ProcessedFilter.html" title="class in org.apache.solr.search">SolrIndexSearcher.ProcessedFilter</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#getProcessedFilter(org.apache.solr.search.DocSet, java.util.List)">getProcessedFilter</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> setFilter,
<A HREF="http://download.oracle.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A>> queries)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the intersection of this set with another set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSlice.</B><B><A HREF="../../../../../org/apache/solr/search/DocSlice.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>SortedIntDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/SortedIntDocSet.html#intersection(org.apache.solr.search.DocSet)">intersection</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#intersectionSize(org.apache.solr.search.DocSet)">intersectionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the number of documents of the intersection of this set with another set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>DocSlice.</B><B><A HREF="../../../../../org/apache/solr/search/DocSlice.html#intersectionSize(org.apache.solr.search.DocSet)">intersectionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#intersectionSize(org.apache.solr.search.DocSet)">intersectionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#intersectionSize(org.apache.solr.search.DocSet)">intersectionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>SortedIntDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/SortedIntDocSet.html#intersectionSize(org.apache.solr.search.DocSet)">intersectionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#intersects(org.apache.solr.search.DocSet)">intersects</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns true if these sets have any elements in common</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>DocSlice.</B><B><A HREF="../../../../../org/apache/solr/search/DocSlice.html#intersects(org.apache.solr.search.DocSet)">intersects</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#intersects(org.apache.solr.search.DocSet)">intersects</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#intersects(org.apache.solr.search.DocSet)">intersects</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>SortedIntDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/SortedIntDocSet.html#intersects(org.apache.solr.search.DocSet)">intersects</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#numDocs(org.apache.solr.search.DocSet, org.apache.solr.search.SolrIndexSearcher.DocsEnumState)">numDocs</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> a,
<A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.DocsEnumState.html" title="class in org.apache.solr.search">SolrIndexSearcher.DocsEnumState</A> deState)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#numDocs(org.apache.lucene.search.Query, org.apache.solr.search.DocSet)">numDocs</A></B>(<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Query.html?is-external=true" title="class or interface in org.apache.lucene.search">Query</A> a,
<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> b)</CODE>
<BR>
Returns the number of documents that match both <code>a</code> and <code>b</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.QueryResult.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.QueryResult.html#setDocSet(org.apache.solr.search.DocSet)">setDocSet</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> set)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.QueryCommand.html" title="class in org.apache.solr.search">SolrIndexSearcher.QueryCommand</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.QueryCommand.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.QueryCommand.html#setFilter(org.apache.solr.search.DocSet)">setFilter</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../org/apache/solr/search/DocList.html" title="interface in org.apache.solr.search">DocList</A></CODE></FONT></TD>
<TD><CODE><B>SolrIndexSearcher.</B><B><A HREF="../../../../../org/apache/solr/search/SolrIndexSearcher.html#sortDocSet(org.apache.solr.search.DocSet, org.apache.lucene.search.Sort, int)">sortDocSet</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> set,
<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Sort.html?is-external=true" title="class or interface in org.apache.lucene.search">Sort</A> sort,
int nDocs)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#union(org.apache.solr.search.DocSet)">union</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the union of this set with another set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>HashDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/HashDocSet.html#union(org.apache.solr.search.DocSet)">union</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#union(org.apache.solr.search.DocSet)">union</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>DocSet.</B><B><A HREF="../../../../../org/apache/solr/search/DocSet.html#unionSize(org.apache.solr.search.DocSet)">unionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
Returns the number of documents of the union of this set with another set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>BitDocSet.</B><B><A HREF="../../../../../org/apache/solr/search/BitDocSet.html#unionSize(org.apache.solr.search.DocSet)">unionSize</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> other)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.solr.search.grouping.collector"><!-- --></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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/search/grouping/collector/package-summary.html">org.apache.solr.search.grouping.collector</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">Constructors in <A HREF="../../../../../org/apache/solr/search/grouping/collector/package-summary.html">org.apache.solr.search.grouping.collector</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/solr/search/grouping/collector/FilterCollector.html#FilterCollector(org.apache.solr.search.DocSet, org.apache.lucene.search.Collector)">FilterCollector</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> filter,
<A HREF="https://builds.apache.org/job/Lucene-trunk/javadoc/core/org/apache/lucene/search/Collector.html?is-external=true" title="class or interface in org.apache.lucene.search">Collector</A> delegate)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.solr.search.grouping.distributed.command"><!-- --></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/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> in <A HREF="../../../../../org/apache/solr/search/grouping/distributed/command/package-summary.html">org.apache.solr.search.grouping.distributed.command</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">Methods in <A HREF="../../../../../org/apache/solr/search/grouping/distributed/command/package-summary.html">org.apache.solr.search.grouping.distributed.command</A> with parameters of type <A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/solr/search/grouping/distributed/command/QueryCommand.Builder.html" title="class in org.apache.solr.search.grouping.distributed.command">QueryCommand.Builder</A></CODE></FONT></TD>
<TD><CODE><B>QueryCommand.Builder.</B><B><A HREF="../../../../../org/apache/solr/search/grouping/distributed/command/QueryCommand.Builder.html#setDocSet(org.apache.solr.search.DocSet)">setDocSet</A></B>(<A HREF="../../../../../org/apache/solr/search/DocSet.html" title="interface in org.apache.solr.search">DocSet</A> docSet)</CODE>
<BR>
</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/solr/search/DocSet.html" title="interface in org.apache.solr.search"><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="../../../../../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/solr/search//class-useDocSet.html" target="_top"><B>FRAMES</B></A>
<A HREF="DocSet.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>
<address>Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.</address>
<script src='../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</BODY>
</HTML>
| {
"content_hash": "d07274cc89fa97d0559f6bb8b287b5e2",
"timestamp": "",
"source": "github",
"line_count": 1048,
"max_line_length": 621,
"avg_line_length": 73.83587786259542,
"alnum_prop": 0.6559834582579478,
"repo_name": "normann/apache-solr",
"id": "afd690c173eb3ce7a0bbf929c9006606bb72ad2e",
"size": "77380",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/api/org/apache/solr/search/class-use/DocSet.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
namespace remoting {
namespace {
class ContinueWindowWin : public ContinueWindow {
public:
ContinueWindowWin();
~ContinueWindowWin() override;
protected:
// ContinueWindow overrides.
void ShowUi() override;
void HideUi() override;
private:
static BOOL CALLBACK DialogProc(HWND hwmd, UINT msg, WPARAM wParam,
LPARAM lParam);
BOOL OnDialogMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void EndDialog();
HWND hwnd_;
DISALLOW_COPY_AND_ASSIGN(ContinueWindowWin);
};
ContinueWindowWin::ContinueWindowWin()
: hwnd_(nullptr) {
}
ContinueWindowWin::~ContinueWindowWin() {
EndDialog();
}
void ContinueWindowWin::ShowUi() {
DCHECK(CalledOnValidThread());
DCHECK(!hwnd_);
HMODULE instance = base::GetModuleFromAddress(&DialogProc);
hwnd_ = CreateDialogParam(instance, MAKEINTRESOURCE(IDD_CONTINUE), nullptr,
(DLGPROC)DialogProc, (LPARAM)this);
if (!hwnd_) {
LOG(ERROR) << "Unable to create Disconnect dialog for remoting.";
return;
}
ShowWindow(hwnd_, SW_SHOW);
}
void ContinueWindowWin::HideUi() {
DCHECK(CalledOnValidThread());
EndDialog();
}
BOOL CALLBACK ContinueWindowWin::DialogProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam) {
ContinueWindowWin* win = nullptr;
if (msg == WM_INITDIALOG) {
win = reinterpret_cast<ContinueWindowWin*>(lParam);
CHECK(win);
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)win);
} else {
LONG_PTR lp = GetWindowLongPtr(hwnd, DWLP_USER);
win = reinterpret_cast<ContinueWindowWin*>(lp);
}
if (win == nullptr)
return FALSE;
return win->OnDialogMessage(hwnd, msg, wParam, lParam);
}
BOOL ContinueWindowWin::OnDialogMessage(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam) {
DCHECK(CalledOnValidThread());
switch (msg) {
case WM_CLOSE:
// Ignore close messages.
return TRUE;
case WM_DESTROY:
// Ensure we don't try to use the HWND anymore.
hwnd_ = nullptr;
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_CONTINUE_DEFAULT:
ContinueSession();
::EndDialog(hwnd, LOWORD(wParam));
hwnd_ = nullptr;
return TRUE;
case IDC_CONTINUE_CANCEL:
DisconnectSession();
::EndDialog(hwnd, LOWORD(wParam));
hwnd_ = nullptr;
return TRUE;
}
}
return FALSE;
}
void ContinueWindowWin::EndDialog() {
DCHECK(CalledOnValidThread());
if (hwnd_) {
::DestroyWindow(hwnd_);
hwnd_ = nullptr;
}
}
} // namespace
// static
scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
return make_scoped_ptr(new ContinueWindowWin());
}
} // namespace remoting
| {
"content_hash": "b829087ca10c4f3e94a29daf5f615095",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 77,
"avg_line_length": 23.872881355932204,
"alnum_prop": 0.6364927227547036,
"repo_name": "joone/chromium-crosswalk",
"id": "548d9280fce26bdce39604dc587eb089614dd3d1",
"size": "3388",
"binary": false,
"copies": "9",
"ref": "refs/heads/2016.04.css-round-display-edtior-draft-1",
"path": "remoting/host/continue_window_win.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<?php
namespace Cercanias\Provider;
/**
* @author Rober Martín H <[email protected]>
*/
interface TimetableParserInterface
{
/**
* @return \DateTime
*/
public function getDate();
/**
* @return string
*/
public function getDepartureName();
/**
* @return string
*/
public function getDestinationName();
/**
* @param int $transferLinkNumer
* @return string
*/
public function getTransferName($transferLinkNumer = 0);
/**
* @return \ArrayIterator
*/
public function getTrips();
}
| {
"content_hash": "e690b6ee6bedd27432f875f09a3770b6",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 60,
"avg_line_length": 15.702702702702704,
"alnum_prop": 0.5851979345955249,
"repo_name": "rmhdev/cercanias",
"id": "0438af93eb53e873251b7604c56289219c371b35",
"size": "790",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Cercanias/Provider/TimetableParserInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "282005"
},
{
"name": "Makefile",
"bytes": "2295"
},
{
"name": "PHP",
"bytes": "164143"
}
],
"symlink_target": ""
} |
<HTML><HEAD><TITLE>Xilinx Design Summary</TITLE></HEAD>
<BODY TEXT='#000000' BGCOLOR='#FFFFFF' LINK='#0000EE' VLINK='#551A8B' ALINK='#FF0000'>
<TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'>
<TD ALIGN=CENTER COLSPAN='4'><B>MAC4 Project Status (02/11/2016 - 00:12:10)</B></TD></TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Project File:</B></TD>
<TD>MAC4.xise</TD>
<TD BGCOLOR='#FFFF99'><b>Parser Errors:</b></TD>
<TD> No Errors </TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Module Name:</B></TD>
<TD>MAC4</TD>
<TD BGCOLOR='#FFFF99'><B>Implementation State:</B></TD>
<TD>Placed and Routed</TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Target Device:</B></TD>
<TD>xc3s400-4tq144</TD>
<TD BGCOLOR='#FFFF99'><UL><LI><B>Errors:</B></LI></UL></TD>
<TD>
No Errors</TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Product Version:</B></TD><TD>ISE 14.7</TD>
<TD BGCOLOR='#FFFF99'><UL><LI><B>Warnings:</B></LI></UL></TD>
<TD ALIGN=LEFT><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\_xmsgs/*.xmsgs?&DataKey=Warning'>2 Warnings (0 new)</A></TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Design Goal:</B></dif></TD>
<TD>Balanced</TD>
<TD BGCOLOR='#FFFF99'><UL><LI><B>Routing Results:</B></LI></UL></TD>
<TD>
<A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.unroutes'>All Signals Completely Routed</A></TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Design Strategy:</B></dif></TD>
<TD><A HREF_DISABLED='Xilinx Default (unlocked)?&DataKey=Strategy'>Xilinx Default (unlocked)</A></TD>
<TD BGCOLOR='#FFFF99'><UL><LI><B>Timing Constraints:</B></LI></UL></TD>
<TD> </TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Environment:</B></dif></TD>
<TD>
<A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4_envsettings.html'>
System Settings</A>
</TD>
<TD BGCOLOR='#FFFF99'><UL><LI><B>Final Timing Score:</B></LI></UL></TD>
<TD>0 <A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.twx?&DataKey=XmlTimingReport'>(Timing Report)</A></TD>
</TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='2'><B>Current Errors</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=CurrentErrors"><B>[-]</B></a></TD></TR>
<TR ALIGN=LEFT BGCOLOR='#FFFF99'><TD COLSPAN='3'><B>No Errors Found</B></TD></TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='2'><B>Current Warnings</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=CurrentWarnings"><B>[-]</B></a></TD></TR>
<TR ALIGN=LEFT BGCOLOR='#FFFF99'><TD><B>Synthesis Warnings</B></TD><TD COLSPAN='2'><B>New</B></TD></TR>
<TR ALIGN=LEFT><TD>WARNING:Xst:753: - "E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4/MAC4.vhd" line 49: Unconnected output port 'Cout' of component 'HA'.</TD><TD COLSPAN='2'> </TD></TR>
<TR ALIGN=LEFT><TD>WARNING:Xst:1780: - Signal <C4<3>> is never used or assigned. This unconnected signal will be trimmed during the optimization process.</TD><TD COLSPAN='2'> </TD></TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='5'><B>Device Utilization Summary</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=DeviceUtilizationSummary"><B>[-]</B></a></TD></TR>
<TR ALIGN=CENTER BGCOLOR='#FFFF99'>
<TD ALIGN=LEFT><B>Logic Utilization</B></TD><TD><B>Used</B></TD><TD><B>Available</B></TD><TD><B>Utilization</B></TD><TD COLSPAN='2'><B>Note(s)</B></TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT>Number of 4 input LUTs</TD>
<TD ALIGN=RIGHT>27</TD>
<TD ALIGN=RIGHT>7,168</TD>
<TD ALIGN=RIGHT>1%</TD>
<TD COLSPAN='2'> </TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT>Number of occupied Slices</TD>
<TD ALIGN=RIGHT>14</TD>
<TD ALIGN=RIGHT>3,584</TD>
<TD ALIGN=RIGHT>1%</TD>
<TD COLSPAN='2'> </TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT> Number of Slices containing only related logic</TD>
<TD ALIGN=RIGHT>14</TD>
<TD ALIGN=RIGHT>14</TD>
<TD ALIGN=RIGHT>100%</TD>
<TD COLSPAN='2'> </TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT> Number of Slices containing unrelated logic</TD>
<TD ALIGN=RIGHT>0</TD>
<TD ALIGN=RIGHT>14</TD>
<TD ALIGN=RIGHT>0%</TD>
<TD COLSPAN='2'> </TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT>Total Number of 4 input LUTs</TD>
<TD ALIGN=RIGHT>27</TD>
<TD ALIGN=RIGHT>7,168</TD>
<TD ALIGN=RIGHT>1%</TD>
<TD COLSPAN='2'> </TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT>Number of bonded <A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4_map.xrpt?&DataKey=IOBProperties'>IOBs</A></TD>
<TD ALIGN=RIGHT>16</TD>
<TD ALIGN=RIGHT>97</TD>
<TD ALIGN=RIGHT>16%</TD>
<TD COLSPAN='2'> </TD>
</TR>
<TR ALIGN=RIGHT><TD ALIGN=LEFT>Average Fanout of Non-Clock Nets</TD>
<TD ALIGN=RIGHT>3.03</TD>
<TD> </TD>
<TD> </TD>
<TD COLSPAN='2'> </TD>
</TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='4'><B>Performance Summary</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=PerformanceSummary"><B>[-]</B></a></TD></TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Final Timing Score:</B></TD>
<TD>0 (Setup: 0, Hold: 0)</TD>
<TD BGCOLOR='#FFFF99'><B>Pinout Data:</B></TD>
<TD COLSPAN='2'><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4_par.xrpt?&DataKey=PinoutData'>Pinout Report</A></TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Routing Results:</B></TD><TD>
<A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.unroutes'>All Signals Completely Routed</A></TD>
<TD BGCOLOR='#FFFF99'><B>Clock Data:</B></TD>
<TD COLSPAN='2'><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4_par.xrpt?&DataKey=ClocksData'>Clock Report</A></TD>
</TR>
<TR ALIGN=LEFT>
<TD BGCOLOR='#FFFF99'><B>Timing Constraints:</B></TD>
<TD> </TD>
<TD BGCOLOR='#FFFF99'><B> </B></TD>
<TD COLSPAN='2'> </TD>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='1'><B>Failing Constraints</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=FailingConstraints"><B>[-]</B></a></TD></TR>
<TR ALIGN=LEFT BGCOLOR='#FFFF99'><TD COLSPAN='2'><B>All Constraints Were Met</B></TD></TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='1'><B>Clock Report</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=ClockReport"><B>[-]</B></a></TD></TR>
<TR ALIGN=LEFT BGCOLOR='#FFFF99'><TD COLSPAN='2'><B>Data Not Yet Available</B></TD></TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='6'><B>Detailed Reports</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=DetailedReports"><B>[-]</B></a></TD></TR>
<TR BGCOLOR='#FFFF99'><TD><B>Report Name</B></TD><TD><B>Status</B></TD><TD><B>Generated</B></TD>
<TD ALIGN=LEFT><B>Errors</B></TD><TD ALIGN=LEFT><B>Warnings</B></TD><TD ALIGN=LEFT COLSPAN='2'><B>Infos</B></TD></TR>
<TR ALIGN=LEFT><TD><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.syr'>Synthesis Report</A></TD><TD>Current</TD><TD>Fri 15. Apr 14:31:07 2016</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\_xmsgs/xst.xmsgs?&DataKey=Warning'>2 Warnings (0 new)</A></TD><TD ALIGN=LEFT COLSPAN='2'>0</TD></TR>
<TR ALIGN=LEFT><TD><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.bld'>Translation Report</A></TD><TD>Current</TD><TD>Fri 15. Apr 14:31:15 2016</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT COLSPAN='2'>0</TD></TR>
<TR ALIGN=LEFT><TD><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4_map.mrp'>Map Report</A></TD><TD>Current</TD><TD>Fri 15. Apr 14:31:24 2016</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT COLSPAN='2'><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\_xmsgs/map.xmsgs?&DataKey=Info'>2 Infos (0 new)</A></TD></TR>
<TR ALIGN=LEFT><TD><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.par'>Place and Route Report</A></TD><TD>Current</TD><TD>Fri 15. Apr 14:31:33 2016</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT COLSPAN='2'><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\_xmsgs/par.xmsgs?&DataKey=Info'>1 Info (0 new)</A></TD></TR>
<TR ALIGN=LEFT><TD>Power Report</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD COLSPAN='2'> </TD></TR>
<TR ALIGN=LEFT><TD><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\MAC4.twr'>Post-PAR Static Timing Report</A></TD><TD>Current</TD><TD>Fri 15. Apr 14:31:36 2016</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT>0</TD><TD ALIGN=LEFT COLSPAN='2'><A HREF_DISABLED='E:/Works/GitHub/Systolic-Processor-On-FPGA/ISE Design Files/MAC4\_xmsgs/trce.xmsgs?&DataKey=Info'>6 Infos (0 new)</A></TD></TR>
<TR ALIGN=LEFT><TD>Bitgen Report</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD COLSPAN='2'> </TD></TR>
</TABLE>
<BR><TABLE BORDER CELLSPACING=0 CELLPADDING=3 WIDTH='100%'>
<TR ALIGN=CENTER BGCOLOR='#99CCFF'><TD ALIGN=CENTER COLSPAN='3'><B>Secondary Reports</B></TD><TD ALIGN=RIGHT WIDTH='10%'COLSPAN=1> <A HREF_DISABLED="?&ExpandedTable=SecondaryReports"><B>[-]</B></a></TD></TR>
<TR BGCOLOR='#FFFF99'><TD><B>Report Name</B></TD><TD><B>Status</B></TD><TD COLSPAN='2'><B>Generated</B></TD></TR>
</TABLE>
<br><center><b>Date Generated:</b> 04/15/2016 - 14:33:02</center>
</BODY></HTML> | {
"content_hash": "07dfb9588f3a09f2e11f0471b93cf73e",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 414,
"avg_line_length": 59.26011560693642,
"alnum_prop": 0.6823058915333593,
"repo_name": "Main-Project-MEC/Systolic-Processor-On-FPGA",
"id": "298600560631c8aec359f5946a8d8df5f6eef9c0",
"size": "10252",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ISE Design Files/MAC4/MAC4_summary.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
using BEPUphysics.Entities;
using BEPUphysics.Entities.Prefabs;
using BEPUphysics.PositionUpdating;
using BEPUutilities;
namespace BEPUphysicsDemos.Demos
{
/// <summary>
/// A set of jenga blocks.
/// </summary>
public class JengaDemo : StandardDemo
{
/// <summary>
/// Constructs a new demo.
/// </summary>
/// <param name="game">Game owning this demo.</param>
public JengaDemo(DemosGame game)
: base(game)
{
Space.Remove(kapow);
//Have to shrink the ball a little to make it fit between jenga tower blocks.
kapow = new Sphere(new Vector3(-11000, 0, 0), .2f, 20);
kapow.PositionUpdateMode = PositionUpdateMode.Continuous; //The ball's really tiny! It will work better if it's handled continuously.
Space.Add(kapow);
int numBlocksTall = 18; //How many 'stories' tall.
float blockWidth = 3f; //Total width/length of the tower.
float blockHeight = 1 / 2f;
Entity toAdd;
for (int i = 0; i < numBlocksTall; i++)
{
if (i % 2 == 0)
{
for (int j = 0; j < 3; j++)
{
toAdd = new Box(new Vector3(
j * (blockWidth / 3) - blockWidth / 3f,
blockHeight / 2 + i * (blockHeight),
0),
blockWidth / 3, blockHeight, blockWidth, 10);
Space.Add(toAdd);
}
}
else
{
for (int j = 0; j < 3; j++)
{
toAdd = new Box(new Vector3(
0,
blockHeight / 2 + (i) * (blockHeight),
j * (blockWidth / 3) - blockWidth / 3f),
blockWidth, blockHeight, blockWidth / 3, 10);
Space.Add(toAdd);
}
}
}
Space.Add(new Box(new Vector3(0, -.5f, 0), 40, 1, 40));
game.Camera.Position = new Vector3(0, 5, 15);
}
/// <summary>
/// Gets the name of the simulation.
/// </summary>
public override string Name
{
get { return "Jenga"; }
}
}
} | {
"content_hash": "9d87264b37efc288076b77e6d2d21162",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 145,
"avg_line_length": 36.16438356164384,
"alnum_prop": 0.4071969696969697,
"repo_name": "Anomalous-Software/BEPUPhysics",
"id": "665e4038a267c9271f642174ffeaa8ebf9f77682",
"size": "2642",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BEPUphysicsDemos/BEPUphysicsDemos/Demos/JengaDemo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "4829018"
},
{
"name": "FLUX",
"bytes": "2216"
}
],
"symlink_target": ""
} |
<?php
namespace Surfnet\YubikeyApiClientBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @codeCoverageIgnore
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('surfnet_yubikey_api_client');
$rootNode
->children()
->arrayNode('credentials')
->info('YubiKey API Credentials')
->children()
->scalarNode('client_id')
->info('Client ID for the YubiKey API')
->isRequired()
->validate()
->ifTrue(function ($value) {
return (!is_string($value) && !is_int($value)) || trim($value) === '';
})
->thenInvalid('Invalid YubiKey API Client ID specified: "%s"')
->end()
->end()
->scalarNode('client_secret')
->info('Secret for the YubiKey API')
->isRequired()
->validate()
->ifTrue(function ($value) {
return (!is_string($value) || trim($value) === '');
})
->thenInvalid('Invalid YubiKey API secret specified: "%s"')
->end()
->end()
->end()
->end()
->end();
return $treeBuilder;
}
}
| {
"content_hash": "e1fa19b0e50353155b3b70f046859177",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 106,
"avg_line_length": 36.19607843137255,
"alnum_prop": 0.419284940411701,
"repo_name": "SURFnet/yubikey-api-client-bundle",
"id": "38b1713062a11779e549d51583729abd946dfc3e",
"size": "2440",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/DependencyInjection/Configuration.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "13757"
}
],
"symlink_target": ""
} |
<?php
namespace Imhonet\Connection\DataFormat\Bool\PDO;
use Imhonet\Connection\DataFormat\IBool;
class Set implements IBool
{
/**
* @var \PDOStatement|bool
*/
protected $data;
/**
* @inheritdoc
*/
public function setData($data)
{
$this->data = $data;
return $this;
}
/**
* @inheritdoc
*/
public function formatData()
{
return array();
}
/**
* @inheritdoc
*/
public function formatValue()
{
return $this->data && $this->data->rowCount();
}
}
| {
"content_hash": "e47c65028774cf6c4949c70891fc649b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 54,
"avg_line_length": 14.76923076923077,
"alnum_prop": 0.5260416666666666,
"repo_name": "Serjick/Connection",
"id": "66210e98e74884d2a6bebba054599cc354dc8e54",
"size": "576",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/DataFormat/Bool/PDO/Set.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "244537"
}
],
"symlink_target": ""
} |
namespace boost
{
namespace lexer
{
namespace detail
{
class iteration_node : public node
{
public:
iteration_node (node *next_, const bool greedy_) :
node (true),
_next (next_),
_greedy (greedy_)
{
node_vector::iterator iter_;
node_vector::iterator end_;
_next->append_firstpos (_firstpos);
_next->append_lastpos (_lastpos);
for (iter_ = _lastpos.begin (), end_ = _lastpos.end ();
iter_ != end_; ++iter_)
{
(*iter_)->append_followpos (_firstpos);
}
for (iter_ = _firstpos.begin (), end_ = _firstpos.end ();
iter_ != end_; ++iter_)
{
(*iter_)->greedy (greedy_);
}
}
virtual ~iteration_node ()
{
}
virtual type what_type () const
{
return ITERATION;
}
virtual bool traverse (const_node_stack &node_stack_,
bool_stack &perform_op_stack_) const
{
perform_op_stack_.push (true);
node_stack_.push (_next);
return true;
}
private:
// Not owner of this pointer...
node *_next;
bool _greedy;
virtual void copy_node (node_ptr_vector &node_ptr_vector_,
node_stack &new_node_stack_, bool_stack &perform_op_stack_,
bool &down_) const
{
if (perform_op_stack_.top ())
{
node *ptr_ = new_node_stack_.top ();
node_ptr_vector_->push_back (static_cast<iteration_node *>(0));
node_ptr_vector_->back () = new iteration_node (ptr_, _greedy);
new_node_stack_.top () = node_ptr_vector_->back ();
}
else
{
down_ = true;
}
perform_op_stack_.pop ();
}
};
}
}
}
#endif
| {
"content_hash": "eed09eb5eb97c7e663bd2b50ef60aa8f",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 75,
"avg_line_length": 21.8625,
"alnum_prop": 0.5060034305317325,
"repo_name": "stan-dev/math",
"id": "aee7531b980f4348462a82737411d1785b2d0c60",
"size": "2161",
"binary": false,
"copies": "13",
"ref": "refs/heads/develop",
"path": "lib/boost_1.78.0/boost/spirit/home/support/detail/lexer/parser/tree/iteration_node.hpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Ada",
"bytes": "89079"
},
{
"name": "Assembly",
"bytes": "566183"
},
{
"name": "Batchfile",
"bytes": "33076"
},
{
"name": "C",
"bytes": "7093229"
},
{
"name": "C#",
"bytes": "54013"
},
{
"name": "C++",
"bytes": "166268432"
},
{
"name": "CMake",
"bytes": "820167"
},
{
"name": "CSS",
"bytes": "11283"
},
{
"name": "Cuda",
"bytes": "342187"
},
{
"name": "DIGITAL Command Language",
"bytes": "32438"
},
{
"name": "Dockerfile",
"bytes": "118"
},
{
"name": "Fortran",
"bytes": "2299405"
},
{
"name": "HTML",
"bytes": "8320473"
},
{
"name": "JavaScript",
"bytes": "38507"
},
{
"name": "M4",
"bytes": "10525"
},
{
"name": "Makefile",
"bytes": "74538"
},
{
"name": "Meson",
"bytes": "4233"
},
{
"name": "Module Management System",
"bytes": "1545"
},
{
"name": "NASL",
"bytes": "106079"
},
{
"name": "Objective-C",
"bytes": "420"
},
{
"name": "Objective-C++",
"bytes": "420"
},
{
"name": "Pascal",
"bytes": "75208"
},
{
"name": "Perl",
"bytes": "47080"
},
{
"name": "Python",
"bytes": "1958975"
},
{
"name": "QMake",
"bytes": "18714"
},
{
"name": "Roff",
"bytes": "30570"
},
{
"name": "Ruby",
"bytes": "5532"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "SWIG",
"bytes": "5501"
},
{
"name": "Shell",
"bytes": "187001"
},
{
"name": "Starlark",
"bytes": "29435"
},
{
"name": "XSLT",
"bytes": "567938"
},
{
"name": "Yacc",
"bytes": "22343"
}
],
"symlink_target": ""
} |
package com.citrix.netscaler.nitro.resource.config.ns;
import com.citrix.netscaler.nitro.resource.base.*;
import com.citrix.netscaler.nitro.service.nitro_service;
import com.citrix.netscaler.nitro.service.options;
import com.citrix.netscaler.nitro.util.*;
import com.citrix.netscaler.nitro.exception.nitro_exception;
class nsevents_response extends base_response
{
public nsevents[] nsevents;
}
/**
* Configuration for events resource.
*/
public class nsevents extends base_resource
{
private Long eventno;
//------- Read only Parameter ---------;
private Long time;
private Long eventcode;
private Long devid;
private String devname;
private String text;
private Long data0;
private Long data1;
private Long data2;
private Long data3;
private Long __count;
/**
* <pre>
* Event number starting from which events must be shown.
* </pre>
*/
public void set_eventno(long eventno) throws Exception {
this.eventno = new Long(eventno);
}
/**
* <pre>
* Event number starting from which events must be shown.
* </pre>
*/
public void set_eventno(Long eventno) throws Exception{
this.eventno = eventno;
}
/**
* <pre>
* Event number starting from which events must be shown.
* </pre>
*/
public Long get_eventno() throws Exception {
return this.eventno;
}
/**
* <pre>
* Event no.
* </pre>
*/
public Long get_time() throws Exception {
return this.time;
}
/**
* <pre>
* event Code.
* </pre>
*/
public Long get_eventcode() throws Exception {
return this.eventcode;
}
/**
* <pre>
* Device Name.
* </pre>
*/
public Long get_devid() throws Exception {
return this.devid;
}
/**
* <pre>
* Device Name.
* </pre>
*/
public String get_devname() throws Exception {
return this.devname;
}
/**
* <pre>
* Event no.
* </pre>
*/
public String get_text() throws Exception {
return this.text;
}
/**
* <pre>
* additional event information.
* </pre>
*/
public Long get_data0() throws Exception {
return this.data0;
}
/**
* <pre>
* additional event information.
* </pre>
*/
public Long get_data1() throws Exception {
return this.data1;
}
/**
* <pre>
* additional event information.
* </pre>
*/
public Long get_data2() throws Exception {
return this.data2;
}
/**
* <pre>
* additional event information.
* </pre>
*/
public Long get_data3() throws Exception {
return this.data3;
}
/**
* <pre>
* converts nitro response into object and returns the object array in case of get request.
* </pre>
*/
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception{
nsevents_response result = (nsevents_response) service.get_payload_formatter().string_to_resource(nsevents_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
return result.nsevents;
}
/**
* <pre>
* Returns the value of object identifier argument
* </pre>
*/
protected String get_object_name() {
return null;
}
/**
* Use this API to fetch all the nsevents resources that are configured on netscaler.
*/
public static nsevents[] get(nitro_service service) throws Exception{
nsevents obj = new nsevents();
nsevents[] response = (nsevents[])obj.get_resources(service);
return response;
}
/**
* Use this API to fetch all the nsevents resources that are configured on netscaler.
*/
public static nsevents[] get(nitro_service service, options option) throws Exception{
nsevents obj = new nsevents();
nsevents[] response = (nsevents[])obj.get_resources(service,option);
return response;
}
/**
* Use this API to fetch all the nsevents resources that are configured on netscaler.
* This uses nsevents_args which is a way to provide additional arguments while fetching the resources.
*/
public static nsevents[] get(nitro_service service, nsevents_args args) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
nsevents[] response = (nsevents[])obj.get_resources(service, option);
return response;
}
/**
* Use this API to fetch filtered set of nsevents resources.
* filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
*/
public static nsevents[] get_filtered(nitro_service service, String filter) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_filter(filter);
nsevents[] response = (nsevents[]) obj.getfiltered(service, option);
return response;
}
/**
* Use this API to fetch filtered set of nsevents resources.
* set the filter parameter values in filtervalue object.
*/
public static nsevents[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_filter(filter);
nsevents[] response = (nsevents[]) obj.getfiltered(service, option);
return response;
}
/**
* Use this API to count the nsevents resources configured on NetScaler.
*/
public static long count(nitro_service service) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_count(true);
nsevents[] response = (nsevents[])obj.get_resources(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
}
/**
* Use this API to count filtered the set of nsevents resources.
* filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
*/
public static long count_filtered(nitro_service service, String filter) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_count(true);
option.set_filter(filter);
nsevents[] response = (nsevents[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
}
/**
* Use this API to count the filtered set of nsevents resources.
* set the filter parameter values in filtervalue object.
*/
public static long count_filtered(nitro_service service, filtervalue[] filter) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_count(true);
option.set_filter(filter);
nsevents[] response = (nsevents[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
}
}
| {
"content_hash": "1c68e75e28817c1d86f117f09ecb656d",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 135,
"avg_line_length": 23.93840579710145,
"alnum_prop": 0.6935068866353867,
"repo_name": "netscaler/nitro",
"id": "ed382564a74805958df7b4205f3720417eb103bf",
"size": "7222",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsevents.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "11489470"
}
],
"symlink_target": ""
} |
var BlankonUiFeatureGridStack = function () {
return {
// =========================================================================
// CONSTRUCTOR APP
// =========================================================================
init: function () {
BlankonUiFeatureGridStack.handleGridStack();
},
// =========================================================================
// HANDLE GRID STACK
// =========================================================================
handleGridStack: function () {
var options = {
cell_height: 80,
vertical_margin: 20
};
$('.grid-stack').gridstack(options);
}
};
}();
// Call main app init
BlankonUiFeatureGridStack.init(); | {
"content_hash": "9999cdcfc336e5b632a431dcf84a9d7b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 84,
"avg_line_length": 29.785714285714285,
"alnum_prop": 0.30335731414868106,
"repo_name": "minhquang520/sach",
"id": "6bf7b59b7d6cd0d84efbc2564d533061077ff7b6",
"size": "834",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "assets/admin/js/pages/blankon.ui.feature.grid.stack.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "819"
},
{
"name": "CSS",
"bytes": "3490617"
},
{
"name": "HTML",
"bytes": "11373186"
},
{
"name": "JavaScript",
"bytes": "2760535"
},
{
"name": "PHP",
"bytes": "5176405"
},
{
"name": "Ruby",
"bytes": "2849"
}
],
"symlink_target": ""
} |
package org.keycloak.subsystem.adapter.saml.extension;
import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.dmr.ModelNode;
/**
* @author <a href="mailto:[email protected]">Marko Strukelj</a>
*/
class KeyAddHandler extends AbstractAddStepHandler {
KeyAddHandler() {
super(KeyDefinition.ALL_ATTRIBUTES);
}
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
Configuration.INSTANCE.updateModel(operation, model);
}
}
| {
"content_hash": "1aab2abd8a6b6eb8799aa6f314bc8203",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 131,
"avg_line_length": 30.454545454545453,
"alnum_prop": 0.7731343283582089,
"repo_name": "gregjones60/keycloak",
"id": "1799290cca838b37a70a31d62bcac7e7cacddacf",
"size": "1364",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "saml/client-adapter/wildfly/wildfly-subsystem/src/main/java/org/keycloak/subsystem/adapter/saml/extension/KeyAddHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "328"
},
{
"name": "ApacheConf",
"bytes": "22819"
},
{
"name": "Batchfile",
"bytes": "2114"
},
{
"name": "CSS",
"bytes": "345677"
},
{
"name": "FreeMarker",
"bytes": "59645"
},
{
"name": "HTML",
"bytes": "405846"
},
{
"name": "Java",
"bytes": "9388566"
},
{
"name": "JavaScript",
"bytes": "695860"
},
{
"name": "Shell",
"bytes": "11085"
},
{
"name": "XSLT",
"bytes": "82496"
}
],
"symlink_target": ""
} |
namespace Google.Cloud.Dialogflow.V2.Snippets
{
// [START dialogflow_v2_generated_Conversations_ListConversations_sync_flattened_resourceNames2]
using Google.Api.Gax;
using Google.Api.Gax.ResourceNames;
using Google.Cloud.Dialogflow.V2;
using System;
public sealed partial class GeneratedConversationsClientSnippets
{
/// <summary>Snippet for ListConversations</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public void ListConversationsResourceNames2()
{
// Create client
ConversationsClient conversationsClient = ConversationsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListConversationsResponse, Conversation> response = conversationsClient.ListConversations(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Conversation item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConversationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
}
}
// [END dialogflow_v2_generated_Conversations_ListConversations_sync_flattened_resourceNames2]
}
| {
"content_hash": "e5bbad0d7822a9b27026fbcd1ad14fe7",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 126,
"avg_line_length": 44.610169491525426,
"alnum_prop": 0.6177811550151976,
"repo_name": "jskeet/google-cloud-dotnet",
"id": "4fc93554d76e63967b9c6fab6d07cbc56f4e0783",
"size": "3254",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "apis/Google.Cloud.Dialogflow.V2/Google.Cloud.Dialogflow.V2.GeneratedSnippets/ConversationsClient.ListConversationsResourceNames2Snippet.g.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "767"
},
{
"name": "C#",
"bytes": "268415427"
},
{
"name": "CSS",
"bytes": "1346"
},
{
"name": "Dockerfile",
"bytes": "3173"
},
{
"name": "HTML",
"bytes": "3823"
},
{
"name": "JavaScript",
"bytes": "226"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Python",
"bytes": "2744"
},
{
"name": "Shell",
"bytes": "65260"
},
{
"name": "sed",
"bytes": "1030"
}
],
"symlink_target": ""
} |
const $ = require('jquery')
const getFormDataUploader = function (form,file,url,cb) {
try {
const formData =new FormData()
formData.append('file',file)
const xhr = new XMLHttpRequest()
xhr.open('POST',$(form).attr('action'))
xhr.onload = function () {
if(xhr.status === 200){
cb(xhr.response)
}
}
xhr.send(formData)
} catch (e) {
return false
}
}
const getIframeUploader = function (form,file,url,cb) {
try {
const seed = Math.floor(Math.random() * 1000);
const id = "uploader-frame-" + seed;
const callback = "uploader-cb-" + seed;
const iframe = $('<iframe id="' + id + '" name="' + id + '" style="display:none;">');
form.attr('target', id).append(iframe).attr('action', url + '?iframe=' + callback);
}catch (e){
return false
}
}
const getUploadIterator = (...uploaders)=>{
for(let upload of uploaders){
console.log(upload)
if(upload()!==false){
return upload
}
}
return 'no support upload'
}
module.exports = function () {
return getUploadIterator(getFormDataUploader,getIframeUploader)
}
| {
"content_hash": "7b8e1b406ce62789f7479a4af6c7f80f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 93,
"avg_line_length": 30.095238095238095,
"alnum_prop": 0.5363924050632911,
"repo_name": "ljwrer/js-design-pattern",
"id": "6b675ece3daf4f5fb2887c92ba8ab8469e43a651",
"size": "1264",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/iterator/file-upload.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "239"
},
{
"name": "HTML",
"bytes": "4801"
},
{
"name": "JavaScript",
"bytes": "61072"
}
],
"symlink_target": ""
} |
"""Stand-alone fitting utilities"""
import numpy as np
from scipy.special import gamma, psi
from ..misc import easylsq
from ..misc.errorvalue import ErrorValue
__all__ = ['fit_shullroess']
def fit_shullroess(q, Intensity, Error, R0=None, r=None):
"""Do a Shull-Roess fitting on the scattering data.
Inputs:
q: np.ndarray[ndim=1]
vector of the q values (4*pi*sin(theta)/lambda)
Intensity: np.ndarray[ndim=1]
Intensity vector
Error: np.ndarray[ndim=1]
Error of the intensity (absolute uncertainty, 1sigma)
R0: scalar
first guess for the mean radius (None to autodetermine, default)
r: np.ndarray[ndim=1]
vector of the abscissa of the resulting size distribution (None to
autodetermine, default)
Output:
A: ErrorValue
the fitted value of the intensity scaling factor
r0: the r0 parameter of the maxwellian size distribution
n: the n parameter of the maxwellian size distribution
r: the abscissa of the fitted size distribution
maxw: the size distribution
stat: the statistics dictionary, returned by nlsq_fit()
Note: This first searches for r0, which best linearizes the
log(Intensity) vs. log(q**2+3/r0**2) relation.
After this is found, the parameters of the fitted line give the
parameters of a Maxwellian-like particle size distribution function.
After it a proper least squares fitting is carried out, using the
obtained values as initial parameters.
"""
q = np.array(q)
Intensity = np.array(Intensity)
Error = np.array(Error)
if R0 is None:
r0s = np.linspace(1, 2 * np.pi / q.min(), 1000)
def naive_fit_chi2(q, Intensity, r0):
p = np.polyfit(np.log(q ** 2 + 3 / r0 ** 2), np.log(Intensity), 1)
return ((np.polyval(p, q) - Intensity) ** 2).sum() / (len(q) - 3)
chi2 = np.array([naive_fit_chi2(q, Intensity, r0) for r0 in r0s.tolist()])
R0 = r0s[chi2 == chi2.min()][0]
def naive_fit(q, Intensity, r0):
p = np.polyfit(np.log(q ** 2 + 3 / r0 ** 2), np.log(Intensity), 1)
return np.exp(p[1]), -2 * p[0] - 4
K, n = naive_fit(q, Intensity, R0)
def SR_function(q, A, r0, n):
return A * (q ** 2 + 3 / r0 ** 2) ** (-(n + 4.) * 0.5)
p, dp, statdict = easylsq.nlsq_fit(q, Intensity, Error, SR_function, (K, R0, n))
n = ErrorValue(p[2], dp[2])
r0 = ErrorValue(p[1], dp[1])
A = ErrorValue(p[0], dp[0])
if r is None:
r = np.linspace(np.pi / q.max(), np.pi / q.min(), 1000)
return A, r0, n, r, maxwellian(r, r0, n), statdict
def maxwellian(r, r0, n):
"""Maxwellian-like distribution of spherical particles
Inputs:
-------
r: np.ndarray or scalar
radii
r0: positive scalar or ErrorValue
mean radius
n: positive scalar or ErrorValue
"n" parameter
Output:
-------
the distribution function and its uncertainty as an ErrorValue containing arrays.
The uncertainty of 'r0' and 'n' is taken into account.
Notes:
------
M(r)=2*r^n/r0^(n+1)*exp(-r^2/r0^2) / gamma((n+1)/2)
"""
r0 = ErrorValue(r0)
n = ErrorValue(n)
expterm = np.exp(-r ** 2 / r0.val ** 2)
dmaxdr0 = -2 * r ** n.val * r0.val ** (-n.val - 4) * ((n.val + 1) * r0.val ** 2 - 2 * r ** 2) * expterm / gamma((n.val + 1) * 0.5)
dmaxdn = -r ** n.val * r0.val ** (-n.val - 1) * expterm * (2 * np.log(r0.val) - 2 * np.log(r) + psi((n.val + 1) * 0.5)) / gamma((n.val + 1) * 0.5)
maxwellian = 2 * r ** n.val * r0.val ** (-n.val - 1) * expterm / gamma((n.val + 1) * 0.5)
dmaxwellian = (dmaxdn ** 2 * n.err ** 2 + dmaxdr0 ** 2 * r0.err ** 2) ** 0.5
return ErrorValue(maxwellian, dmaxwellian)
| {
"content_hash": "4766270198123825011eada946eb8169",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 150,
"avg_line_length": 40.103092783505154,
"alnum_prop": 0.5727506426735218,
"repo_name": "awacha/sastool",
"id": "1f5e84a87c760529817ee49c1d1c9839f285a0b2",
"size": "3890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sastool/fitting/standalone.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "51"
},
{
"name": "Python",
"bytes": "468672"
},
{
"name": "Shell",
"bytes": "47"
}
],
"symlink_target": ""
} |
title: Meet the php-build core team
layout: post
emailsignup: false
tags:
- Programming
---
Over the past half year I've noticed that issues and pull requests start
piling up and are taking often even weeks to resolve on the
[php-build][] project. Due to this I've decided to form the php-build
Core Team.
Let's welcome [Loïc Frering](https://github.com/loicfrering) and [Rogerio Prado de Jesus](https://github.com/rogeriopradoj) with a warm hug as the two new members of the core team!
__Loïc Frering__ was _the_ first contributor to php-build, and it
wouldn't power the PHP support of Travis CI without him! He is the glue between
php-build and Travis CI.
__Rogerio Prado de Jesus__ practically contributed nearly every single one of the definitions
for PHP versions of the last year and the necessary pieces to test
php-build on Travis CI.
I want also to take this chance to thank all past [contributors](https://github.com/CHH/php-build/graphs/contributors) who donate their time to php-build! __You are awesome!__
## What about me?
I will still try to be involved in the big decisions in the project, but
from now on Loïc and Rogerio have the major say in the development.
This hopefully means that new PHP versions will be available much faster in php-build, because they
can be released without a need for me. This should also mean that the quality of
[php-build][] will increase, and on
[other](https://github.com/CHH/pipe) [projects](https://github.com/CHH/heroku-buildpack-php) as well.
[php-build]: https://CHH.github.io/php-build
| {
"content_hash": "c2a329a17b8552142b238eb22946d527",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 180,
"avg_line_length": 45.705882352941174,
"alnum_prop": 0.7644787644787645,
"repo_name": "CHH/CHH.github.io",
"id": "cd1543844880a5d6ffc029cf250c9efda3cbac53",
"size": "1561",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2014-02-09-meet-the-php-build-core-team.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "54210"
},
{
"name": "JavaScript",
"bytes": "38"
},
{
"name": "Less",
"bytes": "34395"
},
{
"name": "Ruby",
"bytes": "31788"
},
{
"name": "Shell",
"bytes": "151"
}
],
"symlink_target": ""
} |
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Formatting;
namespace RefactoringEssentials.CSharp.CodeRefactorings
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = "Convert 'return' to 'if'")]
public class ConvertTernaryExpressionToIfStatementCodeRefactoringProvider : CodeRefactoringProvider
{
public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
var document = context.Document;
if (document.Project.Solution.Workspace.Kind == WorkspaceKind.MiscellaneousFiles)
return;
var span = context.Span;
if (!span.IsEmpty)
return;
var cancellationToken = context.CancellationToken;
if (cancellationToken.IsCancellationRequested)
return;
var model = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);
if (model.IsFromGeneratedCode(cancellationToken))
return;
var root = await model.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
var syntaxNode = root.FindNode(span);
var returnStatement = syntaxNode as ReturnStatementSyntax;
if (returnStatement != null)
{
if (!(returnStatement.Expression is ConditionalExpressionSyntax) && !(returnStatement.Expression is BinaryExpressionSyntax))
return;
if (returnStatement.Expression is BinaryExpressionSyntax && !returnStatement.Expression.IsKind(SyntaxKind.CoalesceExpression))
return;
context.RegisterRefactoring(
CodeActionFactory.Create(
span,
DiagnosticSeverity.Info,
GettextCatalog.GetString("Replace with 'if' statement"),
t2 =>
{
StatementSyntax statement = null;
ReturnStatementSyntax returnAfter = null;
if (returnStatement.Expression is ConditionalExpressionSyntax)
{
var condition = (ConditionalExpressionSyntax)returnStatement.Expression;
statement = SyntaxFactory.IfStatement(condition.Condition, SyntaxFactory.ReturnStatement(condition.WhenTrue));
returnAfter = SyntaxFactory.ReturnStatement(condition.WhenFalse);
}
else
{
var bOp = returnStatement.Expression as BinaryExpressionSyntax;
if (bOp != null && bOp.IsKind(SyntaxKind.CoalesceExpression))
{
statement = SyntaxFactory.IfStatement(SyntaxFactory.BinaryExpression(SyntaxKind.NotEqualsExpression, bOp.Left, SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression)), SyntaxFactory.ReturnStatement(bOp.Left));
returnAfter = SyntaxFactory.ReturnStatement(bOp.Right);
}
}
var newRoot = root.ReplaceNode((SyntaxNode)returnStatement, new SyntaxNode[] {
statement.WithAdditionalAnnotations(Formatter.Annotation).WithLeadingTrivia(returnStatement.GetLeadingTrivia()),
returnAfter.WithAdditionalAnnotations(Formatter.Annotation)
});
return Task.FromResult(document.WithSyntaxRoot(newRoot));
}
)
);
}
var assignExpr = syntaxNode as AssignmentExpressionSyntax;
if (assignExpr != null)
{
if (assignExpr.Right.IsKind(SyntaxKind.ConditionalExpression))
{
context.RegisterRefactoring(
CodeActionFactory.Create(
span,
DiagnosticSeverity.Info,
GettextCatalog.GetString("Replace with 'if' statement"),
t2 =>
{
var ifStatement = CreateForConditionalExpression(assignExpr, (ConditionalExpressionSyntax)assignExpr.Right);
return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode((SyntaxNode)assignExpr.Parent, ifStatement.WithAdditionalAnnotations(Formatter.Annotation))));
}
)
);
}
if (assignExpr.Right.IsKind(SyntaxKind.CoalesceExpression))
{
context.RegisterRefactoring(
CodeActionFactory.Create(
span,
DiagnosticSeverity.Info,
GettextCatalog.GetString("Replace with 'if' statement"),
t2 =>
{
var ifStatement = CreateForNullCoalescingExpression(assignExpr, (BinaryExpressionSyntax)assignExpr.Right);
return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode((SyntaxNode)assignExpr.Parent, ifStatement.WithAdditionalAnnotations(Formatter.Annotation))));
}
)
);
}
}
}
static IfStatementSyntax CreateForConditionalExpression(AssignmentExpressionSyntax expr, ConditionalExpressionSyntax conditional)
{
return SyntaxFactory.IfStatement(
conditional.Condition,
SyntaxFactory.ExpressionStatement(
SyntaxFactory.AssignmentExpression(expr.Kind(), expr.Left, conditional.WhenTrue)
),
SyntaxFactory.ElseClause(
SyntaxFactory.ExpressionStatement(
SyntaxFactory.AssignmentExpression(expr.Kind(), expr.Left, conditional.WhenFalse)
)
)
);
}
static IfStatementSyntax CreateForNullCoalescingExpression(AssignmentExpressionSyntax expr, BinaryExpressionSyntax bOp)
{
return SyntaxFactory.IfStatement(SyntaxFactory.BinaryExpression(SyntaxKind.NotEqualsExpression, bOp.Left, SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression)),
SyntaxFactory.ExpressionStatement(SyntaxFactory.AssignmentExpression(expr.Kind(), expr.Left, bOp.Left)),
SyntaxFactory.ElseClause(SyntaxFactory.ExpressionStatement(SyntaxFactory.AssignmentExpression(expr.Kind(), expr.Left, bOp.Right))));
}
}
}
| {
"content_hash": "362a8795b7ff2b8db36be21319d2caf0",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 256,
"avg_line_length": 53.63157894736842,
"alnum_prop": 0.5701668302257115,
"repo_name": "SSkovboiSS/RefactoringEssentials",
"id": "0cf863096f5c8203e41e865e578f165a6fa1599e",
"size": "7133",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "RefactoringEssentials/CSharp/CodeRefactorings/Synced/ConvertTernaryExpressionToIfStatementCodeRefactoringProvider.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "Batchfile",
"bytes": "754"
},
{
"name": "C#",
"bytes": "4896265"
},
{
"name": "CSS",
"bytes": "1267"
},
{
"name": "HTML",
"bytes": "57295"
},
{
"name": "PowerShell",
"bytes": "995"
},
{
"name": "Visual Basic",
"bytes": "8195"
}
],
"symlink_target": ""
} |
var Zipato = require('./lib/zipato')
var zipato = new Zipato()
module.exports = zipato | {
"content_hash": "7745b698d7e51a1706ab23d37ebd19c1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 36,
"avg_line_length": 17.6,
"alnum_prop": 0.7045454545454546,
"repo_name": "espenmjos/zipato",
"id": "40c04f3551dcdceaca33cc8b40dcc77cf2f62847",
"size": "88",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "121379"
}
],
"symlink_target": ""
} |
require_relative '../lib/pudl/context'
describe Pudl::Context do
subject { Pudl::Context.new }
it "raises an error if key is not a symbol" do
expect {
subject.set "not a symbol", "value"
}.to raise_error(ArgumentError)
end
it "has no values" do
expect(subject.values).to eq({})
end
describe "#get and #set" do
it "returns nil for a missing value" do
expect(subject.get :notthere).to eq(nil)
end
it "returns a set value" do
subject.set :testkey, "here it is"
expect(subject.get :testkey).to eq("here it is")
expect(subject.values).to eq({
testkey: "here it is"
})
end
it "overwrites an existing value" do
subject.set :testkey, "here it is"
subject.set :testkey, "overridden"
expect(subject.get :testkey).to eq("overridden")
expect(subject.values).to eq({
testkey: "overridden"
})
end
it "passes nil to a block if value does not exist" do
subject.set :testkey do |x|
x.class.name
end
expect(subject.get :testkey).to eq("NilClass")
end
it "passed current value to a block if value does exist" do
subject.set :testkey, "here it is"
subject.set :testkey do |x|
x + " - yes"
end
expect(subject.get :testkey).to eq("here it is - yes")
end
it "sets the result to the value of a block" do
subject.set :testkey do
"something"
end
expect(subject.get :testkey).to eq("something")
end
it "closes over local variables" do
x = "result"
subject.set :testkey do
x
end
expect(subject.get :testkey).to eq("result")
end
it "raises an error if a value and a block is provided" do
expect {
subject.set :testkey, :wrong do
end
}
end
it "does not raise an error if another context method is called in the block" do
subject.set :value, "one"
subject.set :final do
get :value
end
end
it "allows calls to get inside set blocks" do
expect {
subject.set :thing do
get :thing
end
}.not_to raise_error
end
it "allows calls to set inside set blocks" do
expect {
subject.set :thing do
set :thing, "value"
end
}.not_to raise_error
end
it "allows nested set blocks" do
expect {
subject.set :thing do
set :another do
get :thing
end
end
}.not_to raise_error
end
it "allows calls to #abort inside set blocks" do
expect {
subject.set :thing do
abort
end
}.not_to raise_error
end
it "allows calls to #abort? inside set blocks" do
expect {
subject.set :thing do
abort?
end
}.not_to raise_error
end
it "allows called to #exit_code inside set blocks" do
expect {
subject.set :thing do
exit_code
end
}.not_to raise_error
end
end
describe "#abort, #abort? and #exit_code" do
context "not aborted" do
it "#abort? returns false" do
expect(subject.abort?).to eq(false)
end
it "sets exit_code to 0" do
expect(subject.exit_code).to eq(0)
end
end
context "aborted with no exit code" do
before do
subject.abort
end
it "#abort? returns true" do
expect(subject.abort?).to eq(true)
end
it "sets exit code to 1" do
expect(subject.exit_code).to eq(1)
end
end
context "aborted with exit code" do
before do
subject.abort 123
end
it "#abort? returns true" do
expect(subject.abort?).to eq(true)
end
it "sets exit code to provided value" do
expect(subject.exit_code).to eq(123)
end
end
end
end
| {
"content_hash": "ca90f76be8800911c6209cd9734253db",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 84,
"avg_line_length": 21.910112359550563,
"alnum_prop": 0.5715384615384616,
"repo_name": "doozr/Pudl",
"id": "7ace43e237d5a9a8191e4edbd6f3db422ff8ae24",
"size": "3900",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/context_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "72722"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>qcert: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.13.1 / qcert - 2.1.1</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
qcert
<small>
2.1.1
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-11 10:42:07 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-11 10:42:07 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.13.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.10.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.2 Official release 4.10.2
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
synopsis: "Verified compiler for data-centric languages"
description: """
This is the Coq library for Q*cert, a platform for implementing and verifying data languages and compilers. It includes abstract syntax and semantics for several source query languages (OQL, SQL), for intermediate database representations (nested relational algebra and calculus), and correctness proofs for part of the compilation to JavaScript and Java.
"""
maintainer: "Jerome Simeon <[email protected]>"
authors: [ "Josh Auerbach <>" "Martin Hirzel <>" "Louis Mandel <>" "Avi Shinnar <>" "Jerome Simeon <>" ]
license: "Apache-2.0"
homepage: "https://querycert.github.io"
bug-reports: "https://github.com/querycert/qcert/issues"
dev-repo: "git+https://github.com/querycert/qcert"
build: [
[make "configure"]
[make "-j" jobs name]
["dune" "build" "-j" jobs "-p" name]
]
install: [
[make "install-coqdev"]
]
depends: [
"ocaml" {>= "4.09.1"}
"ocamlfind"
"dune"
"coq" {>= "8.11.0" & < "8.13~"}
"coq-jsast" {>= "2.0.0"}
"menhir"
"base64"
"uri"
"calendar"
]
tags: [ "keyword:databases" "keyword:queries" "keyword:relational" "keyword:compiler" "date:2022-03-08" "logpath:Qcert" ]
url {
src: "https://github.com/querycert/qcert/archive/v2.1.1.tar.gz"
checksum: "351f5ae9b1380e6a0f673a21b483e6b2"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-qcert.2.1.1 coq.8.13.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.13.1).
The following dependencies couldn't be met:
- coq-qcert -> coq < 8.13~ -> ocaml < 4.10
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-qcert.2.1.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "c1aeaac710fdd3502b48ceb7cf88a89d",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 355,
"avg_line_length": 42.983050847457626,
"alnum_prop": 0.5569137749737119,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "15b47f93d9b912c32f64982f3a189d8b0ea644d5",
"size": "7633",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.10.2-2.0.6/released/8.13.1/qcert/2.1.1.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.0-rc4-master-3e15998
*/
goog.provide('ng.material.components.subheader');
goog.require('ng.material.components.sticky');
goog.require('ng.material.core');
/**
* @ngdoc module
* @name material.components.subheader
* @description
* SubHeader module
*
* Subheaders are special list tiles that delineate distinct sections of a
* list or grid list and are typically related to the current filtering or
* sorting criteria. Subheader tiles are either displayed inline with tiles or
* can be associated with content, for example, in an adjacent column.
*
* Upon scrolling, subheaders remain pinned to the top of the screen and remain
* pinned until pushed on or off screen by the next subheader. @see [Material
* Design Specifications](https://www.google.com/design/spec/components/subheaders.html)
*
* > To improve the visual grouping of content, use the system color for your subheaders.
*
*/
angular
.module('material.components.subheader', [
'material.core',
'material.components.sticky'
])
.directive('mdSubheader', MdSubheaderDirective);
/**
* @ngdoc directive
* @name mdSubheader
* @module material.components.subheader
*
* @restrict E
*
* @description
* The `<md-subheader>` directive is a subheader for a section. By default it is sticky.
* You can make it not sticky by applying the `md-no-sticky` class to the subheader.
*
*
* @usage
* <hljs lang="html">
* <md-subheader>Online Friends</md-subheader>
* </hljs>
*/
function MdSubheaderDirective($mdSticky, $compile, $mdTheming, $mdUtil) {
return {
restrict: 'E',
replace: true,
transclude: true,
template: (
'<div class="md-subheader _md">' +
' <div class="_md-subheader-inner">' +
' <div class="_md-subheader-content"></div>' +
' </div>' +
'</div>'
),
link: function postLink(scope, element, attr, controllers, transclude) {
$mdTheming(element);
element.addClass('_md');
var outerHTML = element[0].outerHTML;
function getContent(el) {
return angular.element(el[0].querySelector('._md-subheader-content'));
}
// Transclude the user-given contents of the subheader
// the conventional way.
transclude(scope, function(clone) {
getContent(element).append(clone);
});
// Create another clone, that uses the outer and inner contents
// of the element, that will be 'stickied' as the user scrolls.
if (!element.hasClass('md-no-sticky')) {
transclude(scope, function(clone) {
// If the user adds an ng-if or ng-repeat directly to the md-subheader element, the
// compiled clone below will only be a comment tag (since they replace their elements with
// a comment) which cannot be properly passed to the $mdSticky; so we wrap it in our own
// DIV to ensure we have something $mdSticky can use
var wrapperHtml = '<div class="_md-subheader-wrapper">' + outerHTML + '</div>';
var stickyClone = $compile(wrapperHtml)(scope);
// Append the sticky
$mdSticky(scope, element, stickyClone);
// Delay initialization until after any `ng-if`/`ng-repeat`/etc has finished before
// attempting to create the clone
$mdUtil.nextTick(function() {
getContent(stickyClone).append(clone);
});
});
}
}
}
}
MdSubheaderDirective.$inject = ["$mdSticky", "$compile", "$mdTheming", "$mdUtil"];
ng.material.components.subheader = angular.module("material.components.subheader"); | {
"content_hash": "ccca772123867bec2e5b076b03b6da40",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 100,
"avg_line_length": 34.205607476635514,
"alnum_prop": 0.662568306010929,
"repo_name": "maximeBuguel/mirror",
"id": "a6f940cbf0c0369bc58915d059b6ea3c97365b79",
"size": "3660",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/bower_components/angular-material/modules/closure/subheader/subheader.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package org.assertj.core.api.bytearray;
import static org.assertj.core.util.Lists.newArrayList;
import static org.mockito.Mockito.verify;
import java.util.List;
import org.assertj.core.api.ByteArrayAssert;
import org.assertj.core.api.ByteArrayAssertBaseTest;
/**
* Tests for <code>{@link ByteArrayAssert#hasSameSizeAs(Iterable)}</code>.
*
* @author Nicolas François
*/
public class ByteArrayAssert_hasSameSizeAs_with_Iterable_Test extends ByteArrayAssertBaseTest {
private final List<String> other = newArrayList("Yoda", "Luke");
@Override
protected ByteArrayAssert invoke_api_method() {
return assertions.hasSameSizeAs(other);
}
@Override
protected void verify_internal_effects() {
verify(arrays).assertHasSameSizeAs(getInfo(assertions), getActual(assertions), other);
}
}
| {
"content_hash": "22c07337e018152bfaae6431f2dfec64",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 95,
"avg_line_length": 26.129032258064516,
"alnum_prop": 0.7666666666666667,
"repo_name": "xasx/assertj-core",
"id": "2b3c1982a504c320d39744f893392046bbef2dda",
"size": "1417",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/java/org/assertj/core/api/bytearray/ByteArrayAssert_hasSameSizeAs_with_Iterable_Test.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "13307657"
},
{
"name": "Shell",
"bytes": "37294"
}
],
"symlink_target": ""
} |
'''
This script parses uni-math symbols from
http://milde.users.sourceforge.net/LUCR/Math/data/unimathsymbols.txt
and save the result as a json file.
The result is used to generate command intellisense for LaTeX Workshop.
'''
import json
def remove_relation_character(description):
"""
From unimathsymbols.txt
8. descriptive _`comments`
The descriptive comments provide more information about the
character, or its specific appearance or use.
Some descriptions contain references to related commands,
marked by a character describing the relation
:=: equals (alias commands),
:#: approx (compat mapping, different character with same glyph),
:x: → cross reference/see also (related, false friends, and name clashes),
:t: text (text mode command),
followed by requirements in parantheses, and
delimited by commas.
"""
tokens = description.split(',')
sanitized_description_items = []
for tok in tokens:
t = tok.strip()
if t[0] in ('x', '#', '=', 't') and t[1] == ' ':
t = t[2:]
sanitized_description_items.append(t)
return ', '.join(sanitized_description_items)
def generate_unimathsymbols_intel(infile, json_out):
"""
Generate intellisense data in json format for the unicode math symbols
:param infile: unimathsymbols.txt
:param json_out: the path to the unimathsymbols.json file
"""
data = {}
with open(infile, encoding='utf-8') as f:
for line in f:
if line[0] == '#':
continue
segments = line.split('^')
if segments[3] == '':
continue
if segments[3][0] == '\\':
segments[3] = segments[3][1:]
data[segments[3]] = {
'command': segments[3],
'detail': segments[1],
# 'documentation': segments[7].strip().capitalize()
'documentation': remove_relation_character(segments[7]).capitalize()
}
if segments[6] != '' and segments[6][0] != '-':
data[segments[3]]['detail'] += f' ("{segments[6]}" command)'
json.dump(data, open(json_out, 'w', encoding='utf-8'),
indent=2, separators=(',', ': '), sort_keys=True, ensure_ascii=False)
| {
"content_hash": "81183f7401fddca552db7eff82d60abc",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 84,
"avg_line_length": 35.1044776119403,
"alnum_prop": 0.5846088435374149,
"repo_name": "James-Yu/LaTeX-Workshop",
"id": "665d69c353a7847bd949ce50aa11d14eb4e6efb3",
"size": "2354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dev/pyintel/uni.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "345"
},
{
"name": "CSS",
"bytes": "77447"
},
{
"name": "Common Workflow Language",
"bytes": "61821"
},
{
"name": "Dockerfile",
"bytes": "3278"
},
{
"name": "HTML",
"bytes": "49281"
},
{
"name": "JavaScript",
"bytes": "456224"
},
{
"name": "Python",
"bytes": "45291"
},
{
"name": "Shell",
"bytes": "453"
},
{
"name": "TypeScript",
"bytes": "813442"
}
],
"symlink_target": ""
} |
__author__ = 'frank'
import zstacklib.utils.daemon as daemon
import zstacklib.utils.http as http
import zstacklib.utils.log as log
import zstacklib.utils.shell as shell
import zstacklib.utils.iptables as iptables
import zstacklib.utils.jsonobject as jsonobject
import zstacklib.utils.lock as lock
import zstacklib.utils.linux as linux
from zstacklib.utils import plugin
import os
import functools
import traceback
import pprint
import threading
logger = log.get_logger(__name__)
class AgentResponse(object):
def __init__(self, success=True, error=None):
self.success = success
self.error = error if error else ''
def replyerror(func):
@functools.wraps(func)
def wrap(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as e:
content = traceback.format_exc()
err = '%s\n%s\nargs:%s' % (str(e), content, pprint.pformat([args, kwargs]))
rsp = AgentResponse()
rsp.success = False
rsp.error = str(e)
logger.warn(err)
return jsonobject.dumps(rsp)
return wrap
class IscsiAgent(object):
http_server = http.HttpServer(port=7760)
http_server.logfile_path = log.get_logfile_path()
def __init__(self):
self.plugin_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'plugins')
self.plugin_rgty = plugin.PluginRegistry(self.plugin_path)
def start(self, in_thread=True):
self.plugin_rgty.configure_plugins(self)
self.plugin_rgty.start_plugins()
if in_thread:
self.http_server.start_in_thread()
else:
self.http_server.start()
def stop(self):
self.plugin_rgty.stop_plugins()
self.http_server.stop()
class IscsiDaemon(daemon.Daemon):
def __init__(self, pidfile):
super(IscsiDaemon, self).__init__(pidfile)
def run(self):
self.agent = IscsiAgent()
self.agent.start(in_thread=False)
| {
"content_hash": "9c66addb10ee0977463663e4876a9435",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 95,
"avg_line_length": 28.457142857142856,
"alnum_prop": 0.6470883534136547,
"repo_name": "live4thee/zstack-utility",
"id": "531074f1e2809cb45dac4f18383a45cc594ef0b0",
"size": "1992",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "iscsifilesystemagent/iscsifilesystemagent/iscsiagent.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "AGS Script",
"bytes": "1147"
},
{
"name": "HTML",
"bytes": "4445"
},
{
"name": "Pascal",
"bytes": "187"
},
{
"name": "Puppet",
"bytes": "10417"
},
{
"name": "Python",
"bytes": "2346166"
},
{
"name": "Shell",
"bytes": "241290"
}
],
"symlink_target": ""
} |
import pygame
class Message(pygame.sprite.Sprite):
"""A class som simplify message writing."""
align_left = 'left';
align_right = 'right';
align_center = 'center';
def __init__(self, msglist, title=None, rect=None, vector=(0,0), align=align_left, linepadding=0.1,
padding=0.1, fontsize=20, fontname=None, center=None,
fgcolor=pygame.Color(255,255,255,255), bgcolor=pygame.Color(0,0,0,255)):
"""rect: pygame.Rect
msglist: tuple or list of strings
vector: tuple, coordinates added for each msg
align: alignet on the surface
padding: space aroung the text
fontsize:
fontname:
center:
fgcolor: pygame.Color
bgcolor: pygame.Color"""
pygame.sprite.Sprite.__init__(self);
if(rect != None and not isinstance(rect, pygame.Rect) and not isinstance(rect, tuple)):
raise TypeError('Rect is neither a pygame.Rect nor a tuple');
if(not isinstance(fgcolor, pygame.Color) and not isinstance(bgcolor, pygame.Color)):
raise TypeError('fg/bgcolor is not a pygame.Color');
if(not isinstance(fontsize, int)):
raise TypeError('font is not an int');
if(not isinstance(msglist, tuple) and not isinstance(msglist, list)):
raise TypeError('msglist is neither a list nor a tuple');
if(not isinstance(vector, tuple)):
raise TypeError('vector is not a tuple');
self.rect = pygame.Rect(rect) if(rect != None) else pygame.Rect(((1,1),(1,1)));
if(center == None and rect == None):
scR = pygame.display.get_surface().get_rect();
self.center = (scR.centerx, scR.centery -scR.centery*0.3);
else:
self.center = center;
self.msglist = msglist;
self.vector = vector;
self.image = pygame.Surface(self.rect.topleft);
self.align = align;
self.font = pygame.font.Font(fontname, fontsize);
self.fgcolor = fgcolor;
self.bgcolor = bgcolor;
self.padding = padding;
self.title = title;
self.linepadding = linepadding;
self.update();
def update(self):
"""Create a surface with the actual text."""
self.image.fill(self.bgcolor);
textList = [];
if(self.title != None):
self.font.set_underline(True);
self.font.set_bold(True);
textList.append(self.font.render(self.title, True, self.fgcolor));
self.font.set_underline(False);
self.font.set_bold(False);
for msg in self.msglist:
# Create text
textList.append(self.font.render(msg, True, self.fgcolor));
## Find the widest one
width = 0;
height = 0;
for txt in textList:
if(txt.get_rect().width > width): width = txt.get_rect().width;
if(self.vector[1] == 0): height += txt.get_rect().height;
width += self.vector[0]*len(textList);
height += self.vector[1]*len(textList);
## Rescale the surface to fit the whole text
self.image = pygame.transform.scale(self.image, (width+int(width*self.padding*2), height+int(height*self.padding*2)));
self.rect.size = self.image.get_rect().size;
## Set rect as left aligned. We might change it later.
tmpRect = pygame.Rect(((int(width*self.padding),int(height*self.padding)),(0,0)));
imgRect = self.image.get_rect();
for txt in textList:
## Make the text aligned right
if(self.align == self.align_right):
print(str.format("--- tmpRect {0} {1} {2}", tmpRect, tmpRect.left, tmpRect.right));
tmpRect.left = int(imgRect.width - txt.get_rect().width - imgRect.width*self.padding);
print(str.format("=== tmpRect {0} {1} {2}", tmpRect, tmpRect.left, tmpRect.right));
## Make the text aligned center
if(self.align == self.align_center):
tmpRect.left = int(self.image.get_rect().width/2 - txt.get_rect().width/2);
self.image.blit(txt, tmpRect.topleft);
if(self.vector[1] == 0):
self.vector = (self.vector[0],int(txt.get_rect().height*(1+self.linepadding)));
tmpRect = tmpRect.move(self.vector);
## Set the whole sprite to requested center
if(self.center != None):
self.rect.center = self.center;
| {
"content_hash": "3d7810b2bb3ae72ac48f1e467b99f3c8",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 126,
"avg_line_length": 44.15533980582524,
"alnum_prop": 0.5756376429199648,
"repo_name": "khan-git/pialarmclock",
"id": "3d217d6ce3ee6b2e8b1705c42de820b057cbf361",
"size": "4548",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "utils/message.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "20566"
}
],
"symlink_target": ""
} |
package co.cask.cdap.cli;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import co.cask.cdap.cli.command.system.HelpCommand;
import co.cask.cdap.cli.command.system.SearchCommandsCommand;
import co.cask.cdap.cli.commandset.DefaultCommands;
import co.cask.cdap.cli.completer.supplier.EndpointSupplier;
import co.cask.cdap.cli.util.FilePathResolver;
import co.cask.cdap.cli.util.InstanceURIParser;
import co.cask.cdap.cli.util.table.AltStyleTableRenderer;
import co.cask.cdap.cli.util.table.TableRenderer;
import co.cask.cdap.client.config.ClientConfig;
import co.cask.cdap.client.config.ConnectionConfig;
import co.cask.cdap.client.exception.DisconnectedException;
import co.cask.cdap.common.conf.CConfiguration;
import co.cask.common.cli.CLI;
import co.cask.common.cli.Command;
import co.cask.common.cli.CommandSet;
import co.cask.common.cli.exception.CLIExceptionHandler;
import co.cask.common.cli.exception.InvalidCommandException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.io.Files;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import jline.console.completer.Completer;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ConnectException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import javax.net.ssl.SSLHandshakeException;
/**
* Main class for the CDAP CLI.
*/
public class CLIMain {
private static final boolean DEFAULT_VERIFY_SSL = true;
private static final boolean DEFAULT_AUTOCONNECT = true;
@VisibleForTesting
public static final Option HELP_OPTION = new Option(
"h", "help", false, "Print the usage message.");
@VisibleForTesting
public static final Option URI_OPTION = new Option(
"u", "uri", true, "CDAP instance URI to interact with in" +
" the format \"[http[s]://]<hostname>[:<port>[/<namespace>]]\"." +
" Defaults to \"" + getDefaultURI().toString() + "\".");
@VisibleForTesting
public static final Option VERIFY_SSL_OPTION = new Option(
"v", "verify-ssl", true, "If \"true\", verify SSL certificate when making requests." +
" Defaults to \"" + DEFAULT_VERIFY_SSL + "\".");
@VisibleForTesting
public static final Option AUTOCONNECT_OPTION = new Option(
"a", "autoconnect", true, "If \"true\", try provided connection" +
" (from " + URI_OPTION.getLongOpt() + ")" +
" upon launch or try default connection if none provided." +
" Defaults to \"" + DEFAULT_AUTOCONNECT + "\".");
@VisibleForTesting
public static final Option DEBUG_OPTION = new Option(
"d", "debug", false, "Print exception stack traces.");
private static final Option SCRIPT_OPTION = new Option(
"s", "script", true, "Execute a file containing a series of CLI commands, line-by-line.");
private final CLI cli;
private final Iterable<CommandSet<Command>> commands;
private final CLIConfig cliConfig;
private final Injector injector;
private final LaunchOptions options;
private final FilePathResolver filePathResolver;
public CLIMain(final LaunchOptions options,
final CLIConfig cliConfig) throws URISyntaxException, IOException {
this.options = options;
this.cliConfig = cliConfig;
injector = Guice.createInjector(
new AbstractModule() {
@Override
protected void configure() {
bind(LaunchOptions.class).toInstance(options);
bind(CConfiguration.class).toInstance(CConfiguration.create());
bind(PrintStream.class).toInstance(cliConfig.getOutput());
bind(CLIConfig.class).toInstance(cliConfig);
bind(ClientConfig.class).toInstance(cliConfig.getClientConfig());
}
}
);
this.commands = ImmutableList.of(
injector.getInstance(DefaultCommands.class),
new CommandSet<>(ImmutableList.<Command>of(
new HelpCommand(getCommandsSupplier(), cliConfig),
new SearchCommandsCommand(getCommandsSupplier(), cliConfig)
)));
filePathResolver = injector.getInstance(FilePathResolver.class);
Map<String, Completer> completers = injector.getInstance(DefaultCompleters.class).get();
cli = new CLI<>(Iterables.concat(commands), completers);
cli.setExceptionHandler(new CLIExceptionHandler<Exception>() {
@Override
public boolean handleException(PrintStream output, Exception e, int timesRetried) {
if (e instanceof SSLHandshakeException) {
output.printf("To ignore this error, set \"--%s false\" when starting the CLI\n",
VERIFY_SSL_OPTION.getLongOpt());
} else if (e instanceof InvalidCommandException) {
InvalidCommandException ex = (InvalidCommandException) e;
output.printf("Invalid command '%s'. Enter 'help' for a list of commands\n", ex.getInput());
} else if (e instanceof DisconnectedException || e instanceof ConnectException) {
cli.getReader().setPrompt("cdap (DISCONNECTED)> ");
} else {
output.println("Error: " + e.getMessage());
}
if (options.isDebug()) {
e.printStackTrace(output);
}
return false;
}
});
cli.addCompleterSupplier(injector.getInstance(EndpointSupplier.class));
cli.getReader().setExpandEvents(false);
cliConfig.addHostnameChangeListener(new CLIConfig.ConnectionChangeListener() {
@Override
public void onConnectionChanged(CLIConnectionConfig config) {
updateCLIPrompt(config);
}
});
}
/**
* Tries to autoconnect to the provided URI in options.
*/
public boolean tryAutoconnect(CommandLine command) {
if (!options.isAutoconnect()) {
return true;
}
InstanceURIParser instanceURIParser = injector.getInstance(InstanceURIParser.class);
try {
CLIConnectionConfig connection = instanceURIParser.parse(options.getUri());
cliConfig.tryConnect(connection, options.isVerifySSL(), cliConfig.getOutput(), options.isDebug());
return true;
} catch (Exception e) {
if (options.isDebug()) {
e.printStackTrace(cliConfig.getOutput());
} else {
cliConfig.getOutput().println(e.getMessage());
}
if (!command.hasOption(URI_OPTION.getOpt())) {
cliConfig.getOutput().printf("Specify the CDAP instance URI with the -u command line argument.\n");
}
return false;
}
}
public static URI getDefaultURI() {
return ConnectionConfig.DEFAULT.getURI();
}
public FilePathResolver getFilePathResolver() {
return filePathResolver;
}
private void updateCLIPrompt(CLIConnectionConfig config) {
cli.getReader().setPrompt(getPrompt(config));
}
public String getPrompt(CLIConnectionConfig config) {
try {
return "cdap (" + config.getURI().resolve("/" + config.getNamespace()) + ")> ";
} catch (DisconnectedException e) {
return "cdap (DISCONNECTED)> ";
}
}
public TableRenderer getTableRenderer() {
return cliConfig.getTableRenderer();
}
public CLI getCLI() {
return this.cli;
}
public Supplier<Iterable<CommandSet<Command>>> getCommandsSupplier() {
return new Supplier<Iterable<CommandSet<Command>>>() {
@Override
public Iterable<CommandSet<Command>> get() {
return commands;
}
};
}
public static void main(String[] args) {
// disable logback logging
Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.OFF);
final PrintStream output = System.out;
Options options = getOptions();
CLIMainArgs cliMainArgs = CLIMainArgs.parse(args, options);
CommandLineParser parser = new BasicParser();
try {
CommandLine command = parser.parse(options, cliMainArgs.getOptionTokens());
if (command.hasOption(HELP_OPTION.getOpt())) {
usage();
System.exit(0);
}
LaunchOptions launchOptions = LaunchOptions.builder()
.setUri(command.getOptionValue(URI_OPTION.getOpt(), getDefaultURI().toString()))
.setDebug(command.hasOption(DEBUG_OPTION.getOpt()))
.setVerifySSL(parseBooleanOption(command, VERIFY_SSL_OPTION, DEFAULT_VERIFY_SSL))
.setAutoconnect(parseBooleanOption(command, AUTOCONNECT_OPTION, DEFAULT_AUTOCONNECT))
.build();
String scriptFile = command.getOptionValue(SCRIPT_OPTION.getOpt(), "");
boolean hasScriptFile = command.hasOption(SCRIPT_OPTION.getOpt());
String[] commandArgs = cliMainArgs.getCommandTokens();
try {
ClientConfig clientConfig = ClientConfig.builder()
.setConnectionConfig(null)
.setDefaultReadTimeout(60 * 1000)
.build();
final CLIConfig cliConfig = new CLIConfig(clientConfig, output, new AltStyleTableRenderer());
CLIMain cliMain = new CLIMain(launchOptions, cliConfig);
CLI cli = cliMain.getCLI();
if (!cliMain.tryAutoconnect(command)) {
System.exit(0);
}
CLIConnectionConfig connectionConfig = new CLIConnectionConfig(
cliConfig.getClientConfig().getConnectionConfig(),
cliConfig.getCurrentNamespace(), null);
cliMain.updateCLIPrompt(connectionConfig);
if (hasScriptFile) {
File script = cliMain.getFilePathResolver().resolvePathToFile(scriptFile);
if (!script.exists()) {
output.println("ERROR: Script file '" + script.getAbsolutePath() + "' does not exist");
System.exit(1);
}
List<String> scriptLines = Files.readLines(script, Charsets.UTF_8);
for (String scriptLine : scriptLines) {
output.print(cliMain.getPrompt(connectionConfig));
output.println(scriptLine);
cli.execute(scriptLine, output);
output.println();
}
} else if (commandArgs.length == 0) {
cli.startInteractiveMode(output);
} else {
cli.execute(Joiner.on(" ").join(commandArgs), output);
}
} catch (DisconnectedException e) {
output.printf("Couldn't reach the CDAP instance at '%s'.", e.getConnectionConfig().getURI().toString());
} catch (Exception e) {
e.printStackTrace(output);
}
} catch (ParseException e) {
output.println(e.getMessage());
usage();
}
}
private static boolean parseBooleanOption(CommandLine command, Option option, boolean defaultValue) {
String value = command.getOptionValue(option.getOpt(), Boolean.toString(defaultValue));
return "true".equals(value);
}
@VisibleForTesting
public static Options getOptions() {
Options options = new Options();
addOptionalOption(options, HELP_OPTION);
addOptionalOption(options, URI_OPTION);
addOptionalOption(options, VERIFY_SSL_OPTION);
addOptionalOption(options, AUTOCONNECT_OPTION);
addOptionalOption(options, DEBUG_OPTION);
addOptionalOption(options, SCRIPT_OPTION);
return options;
}
private static void addOptionalOption(Options options, Option option) {
OptionGroup optionalGroup = new OptionGroup();
optionalGroup.setRequired(false);
optionalGroup.addOption(option);
options.addOptionGroup(optionalGroup);
}
private static void usage() {
HelpFormatter formatter = new HelpFormatter();
String args =
"[--autoconnect <true|false>] " +
"[--debug] " +
"[--help] " +
"[--verify-ssl <true|false>] " +
"[--uri <uri>]" +
"[--script <script-file>]";
formatter.printHelp("cdap-cli.sh " + args, getOptions());
System.exit(0);
}
}
| {
"content_hash": "437ea90de0d7a2493627caca1d3db518",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 112,
"avg_line_length": 36.44047619047619,
"alnum_prop": 0.6908689970597843,
"repo_name": "mpouttuclarke/cdap",
"id": "4038db324449e5afee1f7fd1f96e5389c555b340",
"size": "12846",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "cdap-cli/src/main/java/co/cask/cdap/cli/CLIMain.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "13173"
},
{
"name": "CSS",
"bytes": "206745"
},
{
"name": "HTML",
"bytes": "436495"
},
{
"name": "Java",
"bytes": "16032874"
},
{
"name": "JavaScript",
"bytes": "1119446"
},
{
"name": "Python",
"bytes": "90731"
},
{
"name": "Scala",
"bytes": "30287"
},
{
"name": "Shell",
"bytes": "177663"
}
],
"symlink_target": ""
} |
package org.labkey.wnprc_ehr.service.dataentry;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import org.labkey.api.data.CompareType;
import org.labkey.api.data.Container;
import org.labkey.api.ehr.EHRService;
import org.labkey.api.ehr.security.EHRSecurityEscalator;
import org.labkey.api.query.BatchValidationException;
import org.labkey.api.query.DuplicateKeyException;
import org.labkey.api.query.InvalidKeyException;
import org.labkey.api.security.User;
import org.labkey.dbutils.api.SimpleQueryFactory;
import org.labkey.dbutils.api.SimplerFilter;
import org.labkey.dbutils.api.exception.MissingPermissionsException;
import org.labkey.api.study.security.SecurityEscalator;
import org.labkey.api.study.security.StudySecurityEscalator;
import org.labkey.dbutils.api.service.SecurityEscalatedService;
import org.labkey.wnprc_ehr.dataentry.validators.AnimalVerifier;
import org.labkey.wnprc_ehr.dataentry.validators.ProjectVerifier;
import org.labkey.wnprc_ehr.dataentry.validators.exception.InvalidAnimalIdException;
import org.labkey.wnprc_ehr.dataentry.validators.exception.InvalidProjectException;
import org.labkey.wnprc_ehr.security.permissions.BehaviorAssignmentsPermission;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by jon on 10/28/16.
*/
public class BehaviorDataEntryService extends SecurityEscalatedService
{
public static Set<String> BEHAVIOR_PROJECT_CODES = new HashSet<>(Arrays.asList(
"a1",
"a2",
"a3",
"a4",
"ip",
"ai"
));
public BehaviorDataEntryService(User user, Container container) throws MissingPermissionsException
{
super(user, container, BehaviorAssignmentsPermission.class);
}
public static BehaviorDataEntryService get(User user, Container container) throws MissingPermissionsException
{
return new BehaviorDataEntryService(user, container);
}
public void addBehaviorAssignment(@NotNull String animalId, @NotNull String project, @NotNull Date assignDate, @Nullable Date estimatedRelease, @Nullable String remark) throws InvalidAnimalIdException, InvalidProjectException, DuplicateKeyException, BatchValidationException
{
assertAnimalExists(animalId);
assertValidAndAssignableProject(project, animalId, assignDate);
// Build our row map
Map<String, Object> rowMap = new HashMap<>();
rowMap.put("Id", animalId);
rowMap.put("project", project);
rowMap.put("date", assignDate);
rowMap.put("projectedRelease", estimatedRelease);
rowMap.put("remark", remark);
getUpdateService("study", "assignment").insertRow(rowMap, "Adding behavior assignment.");
}
public void addBehaviorAssignment(@NotNull String animalId, @NotNull String project, @NotNull Date assignDate) throws InvalidAnimalIdException, InvalidProjectException, DuplicateKeyException, BatchValidationException
{
addBehaviorAssignment(animalId, project, assignDate, null, null);
}
public void addBehaviorAssignment(@NotNull String animalId, @NotNull String project, @NotNull Date assignDate, @Nullable Date estimatedRelease) throws InvalidAnimalIdException, InvalidProjectException, DuplicateKeyException, BatchValidationException
{
addBehaviorAssignment(animalId, project, assignDate, estimatedRelease, null);
}
public void addBehaviorAssignment(@NotNull String animalId, @NotNull String project, @NotNull Date assignDate, @Nullable String remark) throws InvalidAnimalIdException, InvalidProjectException, DuplicateKeyException, BatchValidationException
{
addBehaviorAssignment(animalId, project, assignDate, null, remark);
}
public void releaseAnimalFromBehaviorProject(@NotNull String animalId, @NotNull String project, @NotNull Date releaseDate) throws InvalidAnimalIdException, BatchValidationException, InvalidProjectException, InvalidKeyException
{
assertAnimalExists(animalId);
new ProjectVerifier(project, getEscalationUser(), container).exists().isBehaviorProject().animalIsAssignedOn(animalId, releaseDate);
SimplerFilter idFilter = new SimplerFilter("Id", CompareType.EQUAL, animalId);
idFilter.addAllClauses(new SimplerFilter("project", CompareType.EQUAL, Integer.valueOf(project)));
SimpleQueryFactory queryFactory = new SimpleQueryFactory(getEscalationUser(), container);
List<Map<String, Object>> rowsToUpdate = new ArrayList<>();
for (JSONObject assignment : queryFactory.selectRows("study", "CurrentBehaviorAssignments", idFilter).toJSONObjectArray())
{
// Build our row map
Map<String, Object> rowMap = new HashMap<>();
rowMap.put("lsid", assignment.getString("lsid"));
rowMap.put("Id", assignment.getString("id"));
rowMap.put("project", assignment.getString("project"));
rowMap.put("endDate", releaseDate);
rowsToUpdate.add(rowMap);
}
getUpdateService("study", "assignment").updateRows(rowsToUpdate, "Releasing animal from behavior project.");
}
private void assertAnimalExists(@NotNull String animalId) throws InvalidAnimalIdException
{
// Check to make sure the animal exists.
(new AnimalVerifier(animalId, user, container)).exists().isAliveAndAtCenter();
}
public void releaseAnimalFromBehaviorProject(@NotNull String animalId, @NotNull String project) throws InvalidAnimalIdException, BatchValidationException, InvalidKeyException, InvalidProjectException
{
releaseAnimalFromBehaviorProject(animalId, project, new Date());
}
private void assertValidAndAssignableProject(@NotNull String project, @NotNull String animalId, @NotNull Date assignDate) throws InvalidProjectException
{
ProjectVerifier projectVerifier = new ProjectVerifier(project, getEscalationUser(), container);
projectVerifier
.exists()
.isBehaviorProject()
.animalIsNotAssignedOn(animalId, assignDate);
}
@Override
public User getEscalationUser()
{
return EHRService.get().getEHRUser(container);
}
@Override
public Set<SecurityEscalator> getEscalators(User user, Container container, String escalationComment)
{
Set<SecurityEscalator> escalators = new HashSet<>();
escalators.add(EHRSecurityEscalator.beginEscalation(user, container, escalationComment));
escalators.add(StudySecurityEscalator.beginEscalation(user, container, escalationComment));
return escalators;
}
}
| {
"content_hash": "b33ea11d1ab0c6a7740e96d43eb674e8",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 278,
"avg_line_length": 44.174193548387095,
"alnum_prop": 0.7460201548123265,
"repo_name": "WNPRC-EHR-Services/wnprc-modules",
"id": "f0a3703326e2a4c3440263cc7efc845e1a9de2b6",
"size": "6847",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "WNPRC_EHR/src/org/labkey/wnprc_ehr/service/dataentry/BehaviorDataEntryService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "82228"
},
{
"name": "Dockerfile",
"bytes": "10292"
},
{
"name": "HTML",
"bytes": "365171"
},
{
"name": "Java",
"bytes": "2064544"
},
{
"name": "JavaScript",
"bytes": "2319537"
},
{
"name": "Perl",
"bytes": "186990"
},
{
"name": "R",
"bytes": "22703"
},
{
"name": "SCSS",
"bytes": "2816"
},
{
"name": "Shell",
"bytes": "18316"
},
{
"name": "TSQL",
"bytes": "332"
},
{
"name": "Twig",
"bytes": "925"
},
{
"name": "TypeScript",
"bytes": "324237"
}
],
"symlink_target": ""
} |
import { MochaAdapter } from '../lib/adapter'
const errorHandlingSpecs = ['./test/fixtures/error.handling.spec.js']
const errorHandlingPromiseSpecs = ['./test/fixtures/error.handling.promise.spec.js']
const errorHandlingAsyncSpecs = ['./test/fixtures/error.handling.async.spec.js']
const errorHandlingPromiseAsyncSpecs = ['./test/fixtures/error.handling.promise.async.spec.js']
const NOOP = () => {}
const WebdriverIO = class {}
WebdriverIO.prototype = {
pause: (ms = 500) => new Promise((r) => setTimeout(() => r(), ms)),
command: (ms = 500) => new Promise((r) => setTimeout(() => r('foo'), ms)),
getPrototype: () => WebdriverIO.prototype
}
process.send = NOOP
describe('ignores service hook errors', () => {
it('should ignore directly thrown errors (sync mode)', async () => {
global.browser = new WebdriverIO()
global.browser.options = {}
const adapter = new MochaAdapter('0a', {
beforeSuite: () => { throw new Error('beforeSuite failed') },
beforeHook: () => { throw new Error('beforeHook failed') },
beforeTest: () => { throw new Error('beforeTest failed') },
beforeCommand: () => { throw new Error('beforeCommand failed') },
afterCommand: () => { throw new Error('beforeCommand failed') },
afterTest: () => { throw new Error('afterTest failed') },
afterHook: () => { throw new Error('afterHook failed') },
afterSuite: () => { throw new Error('afterSuite failed') }
}, errorHandlingSpecs, {});
(await adapter.run()).should.be.equal(0, 'actual test failed')
})
it('should ignore rejected promises (sync mode)', async () => {
global.browser = new WebdriverIO()
global.browser.options = {}
const adapter = new MochaAdapter('0a', {
beforeSuite: () => Promise.reject(new Error('beforeSuite failed')),
beforeHook: () => Promise.reject(new Error('beforeHook failed')),
beforeTest: () => Promise.reject(new Error('beforeTest failed')),
beforeCommand: () => Promise.reject(new Error('beforeCommand failed')),
afterCommand: () => Promise.reject(new Error('beforeCommand failed')),
afterTest: () => Promise.reject(new Error('afterTest failed')),
afterHook: () => Promise.reject(new Error('afterHook failed')),
afterSuite: () => Promise.reject(new Error('afterSuite failed'))
}, errorHandlingPromiseSpecs, {});
(await adapter.run()).should.be.equal(0, 'actual test failed')
})
it('should ignore directly thrown errors (async mode)', async () => {
global.browser = new WebdriverIO()
global.browser.options = { sync: false }
const adapter = new MochaAdapter('0a', {
beforeSuite: () => { throw new Error('beforeSuite failed') },
beforeHook: () => { throw new Error('beforeHook failed') },
beforeTest: () => { throw new Error('beforeTest failed') },
beforeCommand: () => { throw new Error('beforeCommand failed') },
afterCommand: () => { throw new Error('beforeCommand failed') },
afterTest: () => { throw new Error('afterTest failed') },
afterHook: () => { throw new Error('afterHook failed') },
afterSuite: () => { throw new Error('afterSuite failed') }
}, errorHandlingAsyncSpecs, {});
(await adapter.run()).should.be.equal(0, 'actual test failed')
})
it('should ignore rejected promises (sync mode)', async () => {
global.browser = new WebdriverIO()
global.browser.options = { sync: false }
const adapter = new MochaAdapter('0a', {
beforeSuite: () => Promise.reject(new Error('beforeSuite failed')),
beforeHook: () => Promise.reject(new Error('beforeHook failed')),
beforeTest: () => Promise.reject(new Error('beforeTest failed')),
beforeCommand: () => Promise.reject(new Error('beforeCommand failed')),
afterCommand: () => Promise.reject(new Error('beforeCommand failed')),
afterTest: () => Promise.reject(new Error('afterTest failed')),
afterHook: () => Promise.reject(new Error('afterHook failed')),
afterSuite: () => Promise.reject(new Error('afterSuite failed'))
}, errorHandlingPromiseAsyncSpecs, {});
(await adapter.run()).should.be.equal(0, 'actual test failed')
})
})
| {
"content_hash": "4e6682e0c0ac72061f5ee51dc0401570",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 95,
"avg_line_length": 54.451219512195124,
"alnum_prop": 0.6022396416573348,
"repo_name": "Capt-Slow/wdio-mocha-framework",
"id": "434ed17e57ad2ee665dd8b91476dd7c6769247e5",
"size": "4465",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/error.handling.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "65913"
}
],
"symlink_target": ""
} |
import yaml
from argparse import ArgumentParser
from constants import GOOGLE_CLOUD_TEST
from dict_util import deep_get
from yaml_util import load_resources_yaml
''' Remove all resources considered to be Kuberenetes Helm tests from
a given manifest file. '''
_HELM_HOOK_KEY = 'helm.sh/hook'
_HOOK_SUCCESS = 'test-success'
_HOOK_FAILURE = 'test-failure'
def main():
parser = ArgumentParser()
parser.add_argument("--manifest", help="the manifest file location to be cleared of tests")
parser.add_argument("--deploy_tests", action="store_true", help="indicates whether tests should be deployed")
args = parser.parse_args()
manifest = args.manifest
resources = load_resources_yaml(manifest)
filtered_resources = []
for resource in resources:
helm_hook = deep_get(resource, "metadata", "annotations", _HELM_HOOK_KEY)
if helm_hook is None:
filtered_resources.append(resource)
elif helm_hook == _HOOK_SUCCESS:
if args.deploy_tests:
annotations = deep_get(resource, "metadata", "annotations")
del annotations[_HELM_HOOK_KEY]
annotations[GOOGLE_CLOUD_TEST] = "test"
filtered_resources.append(resource)
elif helm_hook == _HOOK_FAILURE:
if args.deploy_tests:
raise Exception("Helm hook {} is not supported".format(helm_hook))
else:
raise Exception("Helm hook {} is not supported".format(helm_hook))
with open(manifest, "w") as out:
yaml.dump_all(filtered_resources, out,
default_flow_style=False, explicit_start=True)
if __name__ == "__main__":
main()
| {
"content_hash": "1a1471ebafa558326ea80ee6d6734d40",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 111,
"avg_line_length": 31.64,
"alnum_prop": 0.6877370417193426,
"repo_name": "cliveseldon/marketplace-k8s-app-tools",
"id": "9a6388fa6c5a069e62d5e2fa1fd80b29a7fb6ae2",
"size": "2183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "marketplace/deployer_util/process_helm_hooks.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "45111"
},
{
"name": "HTML",
"bytes": "13052"
},
{
"name": "Makefile",
"bytes": "1879"
},
{
"name": "Python",
"bytes": "106847"
},
{
"name": "Shell",
"bytes": "23662"
}
],
"symlink_target": ""
} |
<link rel="import" href="chrome://resources/polymer/polymer/polymer.html">
<link rel="import" href="chrome://resources/polymer/polymer/layout.html">
<link rel="import" href="chrome://resources/polymer/core-animated-pages/core-animated-pages.html">
<link rel="import" href="chrome://resources/polymer/core-animated-pages/transitions/cross-fade.html">
<!--
Password changed UI for the New Gaia flow.
Contains two cards with a fade transition between them:
1. Old password input form.
2. Warning about data loss
3. Spinner with notice "Please wait";
Example:
<gaia-password-changed id="gaia-password-changed" hidden>
</gaia-password-changed>
Attributes:
'email' - displayed email in header.
Events:
'passwordEnter' - fired when user enters password. Fires with an argument
|password|.
'proceedAnyway' - fired when user decides to skip old password and
lose all the data in cryptohome.
'cancel' - fired when user press X-button.
Methods:
'invalidate' - mark password input as invalid.
'reset' - reset element, sets in on the first screen and enables
buttons.
'focus' - if current card is the first one it focuses password input.
-->
<polymer-element name="gaia-password-changed" vertical layout
attributes="email">
<template>
<link rel="stylesheet" href="gaia_password_changed.css">
<core-animated-pages id="animatedPages" transitions="cross-fade-all" flex
on-core-animated-pages-transition-end="{{onTransitionEnd}}">
<section flex>
<gaia-card id="oldPasswordCard">
<gaia-header class="header" email="{{email}}">
</gaia-header>
<div horizontal layout center class="footer gaia-body-text">
<p i18n-content="passwordChangedTitle">
</p>
</div>
<gaia-input-form class="footer" id="oldPasswordInputForm"
i18n-values="buttonText:nextButtonText">
<gaia-input id="oldPasswordInput" type="password"
i18n-values="error:oldPasswordIncorrect;
label:oldPasswordHint">
</gaia-input>
<gaia-paper-button noink i18n-content="forgotOldPasswordButtonText"
class="link-button"
on-tap="{{onForgotPasswordClicked}}">
</gaia-paper-button>
</gaia-input-form>
</gaia-card>
</section>
<section flex>
<gaia-card>
<gaia-header class="header" email="{{email}}">
</gaia-header>
<div class="footer">
<div horizontal layout center class="gaia-body-text">
<core-icon icon="warning"></core-icon>
<p flex i18n-content="passwordChangedProceedAnywayTitle">
</p>
</div>
<div horizontal layout justified center>
<gaia-paper-button noink i18n-content="passwordChangedTryAgain"
class="link-button"
on-tap="{{onTryAgainClicked}}">
</gaia-paper-button>
<gaia-raised-on-focus-button id="proceedAnywayBtn"
class="blue-button" on-tap="{{onProceedClicked}}"
i18n-content="proceedAnywayButton">
</gaia-raised-on-focus-button>
</div>
</div>
</gaia-card>
</section>
<section flex vertical layout center-justified>
<throbber-notice i18n-values="text:gaiaLoadingNewGaia" self-center>
</throbber-notice>
</section>
</core-animated-pages>
<button id="closeButton" is="gaia-icon-button" icon="close"
i18n-values="aria-label:closeButton" on-click="{{onClose}}">
</button>
</template>
</polymer-element>
| {
"content_hash": "94db9fe83a22b5807640d852bc863b3e",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 101,
"avg_line_length": 40.81720430107527,
"alnum_prop": 0.6090621707060063,
"repo_name": "PeterWangIntel/chromium-crosswalk",
"id": "be137ac0eb95c0d39264bea0a3b72f1b181660bb",
"size": "3796",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "chrome/browser/resources/chromeos/login/gaia_password_changed.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "34367"
},
{
"name": "Batchfile",
"bytes": "8451"
},
{
"name": "C",
"bytes": "9385814"
},
{
"name": "C++",
"bytes": "234925784"
},
{
"name": "CSS",
"bytes": "951745"
},
{
"name": "DM",
"bytes": "60"
},
{
"name": "Emacs Lisp",
"bytes": "988"
},
{
"name": "Groff",
"bytes": "2494"
},
{
"name": "HTML",
"bytes": "29070071"
},
{
"name": "Java",
"bytes": "10107231"
},
{
"name": "JavaScript",
"bytes": "20170506"
},
{
"name": "Makefile",
"bytes": "68234"
},
{
"name": "Objective-C",
"bytes": "1845625"
},
{
"name": "Objective-C++",
"bytes": "9478782"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "PLpgSQL",
"bytes": "178732"
},
{
"name": "Perl",
"bytes": "63937"
},
{
"name": "Protocol Buffer",
"bytes": "465313"
},
{
"name": "Python",
"bytes": "8153532"
},
{
"name": "Shell",
"bytes": "473684"
},
{
"name": "Standard ML",
"bytes": "5034"
},
{
"name": "XSLT",
"bytes": "418"
},
{
"name": "nesC",
"bytes": "18347"
}
],
"symlink_target": ""
} |
working_directory "/path/to/machiavelli"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/path/to/machiavelli/tmp/pids/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/path/to/machiavelli/log/unicorn.log"
stdout_path "/path/to/machiavelli/log/unicorn.log"
# Unicorn socket
listen "/path/to/machiavelli/tmp/sockets/unicorn.machiavelli.sock"
# Number of processes
# worker_processes 4
worker_processes 2
# Time-out
timeout 30
| {
"content_hash": "e2d601bd96db5a275a11fbb8821e5e91",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 24.904761904761905,
"alnum_prop": 0.7571701720841301,
"repo_name": "glasnt/machiavelli",
"id": "5d957ef53e5d3d611bc80486fa6b6fcedf29a986",
"size": "603",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sample_configs/unicorn.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "643"
},
{
"name": "CSS",
"bytes": "4764"
},
{
"name": "HTML",
"bytes": "29421"
},
{
"name": "JavaScript",
"bytes": "30424"
},
{
"name": "Ruby",
"bytes": "88664"
},
{
"name": "Shell",
"bytes": "2152"
}
],
"symlink_target": ""
} |
<#######################################################################################
# xDNSServerAddress : DSC Resource that will set/test/get the current DNS Server
# Address, by accepting values among those given in xDNSServerAddress.schema.mof
#######################################################################################>
######################################################################################
# The Get-TargetResource cmdlet.
# This function will get the present list of DNS ServerAddress DSC Resource schema variables on the system
######################################################################################
function Get-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String[]]$Address,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$InterfaceAlias,
[ValidateSet("IPv4", "IPv6")]
[String]$AddressFamily = "IPv4"
)
$returnValue = @{
Address = (Get-DnsClientServerAddress -InterfaceAlias $InterfaceAlias -AddressFamily $AddressFamily).ServerAddresses
AddressFamily = $AddressFamily
InterfaceAlias = $InterfaceAlias
}
$returnValue
}
######################################################################################
# The Set-TargetResource cmdlet.
# This function will set a new Server Address in the current node
######################################################################################
function Set-TargetResource
{
param
(
#IP Address that has to be set
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String[]]$Address,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$InterfaceAlias,
[ValidateSet("IPv4", "IPv6")]
[String]$AddressFamily = "IPv4"
)
ValidateProperties @PSBoundParameters -Apply
}
######################################################################################
# The Test-TargetResource cmdlet.
# This will test if the given Server Address is among the current node's Server Address collection
######################################################################################
function Test-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String[]]$Address,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$InterfaceAlias,
[ValidateSet("IPv4", "IPv6")]
[String]$AddressFamily = "IPv4"
)
ValidateProperties @PSBoundParameters
}
#######################################################################################
# Helper function that validates the Server Address properties. If the switch parameter
# "Apply" is set, then it will set the properties after a test
#######################################################################################
function ValidateProperties
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String[]]$Address,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$InterfaceAlias,
[ValidateSet("IPv4", "IPv6")]
[String]$AddressFamily,
[Switch]$Apply
)
$sa =$Address
$sa | %{
if(!([System.Net.Ipaddress]::TryParse($_, [ref]0)))
{
throw "Server Address *$_* is not in the correct format. Please correct the Address in the configuration and try again"
}
if (([System.Net.IPAddress]$_).AddressFamily.ToString() -eq [System.Net.Sockets.AddressFamily]::InterNetwork.ToString())
{
if ($AddressFamily -ne "IPv4")
{
throw "Server address $Address is in IPv4 format, which does not match server address family $AddressFamily. Please correct either of them in the configuration and try again"
}
}
else
{
if ($AddressFamily -ne "IPv6")
{
throw "Server address $Address is in IPv6 format, which does not match server address family $AddressFamily. Please correct either of them in the configuration and try again"
}
}
}
try
{
Write-Verbose -Message "Checking the DNS Server Address ..."
#Get the current IP Address based on the parameters given.
$currentAddress = (Get-DnsClientServerAddress -InterfaceAlias $InterfaceAlias -AddressFamily $AddressFamily -ErrorAction Stop).ServerAddresses
#Check if the Server addresses are the same as the desired addresses.
if(@(Compare-Object -ReferenceObject $currentAddress -DifferenceObject $Address -SyncWindow 0).Length -gt 0)
{
Write-Verbose -Message "DNS Servers are not correct. Expected $Address, actual $currentAddress"
if($Apply)
{
# Set the DNS settings as well
Set-DnsClientServerAddress -InterfaceAlias $InterfaceAlias -ServerAddresses $Address
Write-Verbose -Message "DNS Servers have been set correctly."
}
else
{
return $false
}
}
else
{
#Test will return true in this case
Write-Verbose -Message "DNS Servers are set correctly."
return $true
}
}
catch
{
Write-Verbose -Message $_
throw "Can not set or find valid DNS Server addresses using InterfaceAlias $InterfaceAlias and AddressFamily $AddressFamily"
}
}
# FUNCTIONS TO BE EXPORTED
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
| {
"content_hash": "ab7154da7409dc41483a6049947a1f4e",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 194,
"avg_line_length": 36.1566265060241,
"alnum_prop": 0.5088303898700434,
"repo_name": "cyberious/puppetlabs-dsc",
"id": "e3795a25f69fb6ac73159b9166e4eac5eac4b1c3",
"size": "6002",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "916"
},
{
"name": "HTML",
"bytes": "286532"
},
{
"name": "PowerShell",
"bytes": "1306624"
},
{
"name": "Puppet",
"bytes": "446"
},
{
"name": "Ruby",
"bytes": "1271959"
},
{
"name": "Shell",
"bytes": "2778"
}
],
"symlink_target": ""
} |
set -e
# In a mutable host scenario, Capistrano would handle symlinking ./public/system to a persistent
# directory on the host. We'll have to recreate this pattern by providing a mount target (/mnt/system)
# that we'll mount a persistent volume to later and symlink ./public/system to that mount point.
# Note: We can create the mount point as part of the build, but we'll have to symlink it in
# rails_entry.sh since Docker does not allow symlinking outside of the context
ln -s /mnt/system /project_root/public/
### Wait for dependencies
if ! docker/wait-for-it.sh -t 120 ${DB_HOSTNAME}:5432; then exit 1; fi
if ! docker/wait-for-it.sh -t 120 ${SOLR_HOST}:8983; then exit 1; fi
echo Running container in "$PWD" with the following command: "$@"
exec "$@" | {
"content_hash": "7c7460b10e1ec7c873fcc3c8c3957947",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 103,
"avg_line_length": 50.8,
"alnum_prop": 0.7375328083989501,
"repo_name": "ndlib/honeycomb",
"id": "7d00b0c93e9918b04910c16c73367dfdb6af9f71",
"size": "841",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docker/rails_entry.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "26134"
},
{
"name": "CoffeeScript",
"bytes": "4612"
},
{
"name": "HTML",
"bytes": "52949"
},
{
"name": "JavaScript",
"bytes": "1337566"
},
{
"name": "NewLisp",
"bytes": "227"
},
{
"name": "Python",
"bytes": "1940"
},
{
"name": "Ruby",
"bytes": "955249"
},
{
"name": "SCSS",
"bytes": "32720"
},
{
"name": "Sass",
"bytes": "1202"
},
{
"name": "Shell",
"bytes": "6925"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<head>
<script src="build/react.js"></script>
<script src="build/react-dom.js"></script>
<script src="build/browser.min.js"></script>
</head>
<body>
<!--八、this.state-->
<div id="example">
</div>
<script type="text/babel">
var LikeButton = React.createClass({
getInitialState: function () {
return {liked: false};
},
handleClick: function (event) {
this.setState({liked: !this.state.liked});
},
render: function () {
var text = this.state.liked ? 'like' : 'haven\'t liked';
return (
<p onClick={this.handleClick}>
You {text} this. Click to toggle.
</p>
);
}
});
ReactDOM.render(
<LikeButton/>,
document.getElementById('example')
);
</script>
</body>
</html>
| {
"content_hash": "c36d5b15c0c375f7446eb172db8c4a97",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 68,
"avg_line_length": 24.86111111111111,
"alnum_prop": 0.5027932960893855,
"repo_name": "yxwandroid/front-end-development",
"id": "c654b5bd1a8632600277c23083e789a6b333f5e1",
"size": "899",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "react/reactDemo2.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "447"
},
{
"name": "HTML",
"bytes": "36803"
},
{
"name": "JavaScript",
"bytes": "1733332"
}
],
"symlink_target": ""
} |
test_description='test git fast-import utility'
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
# Print $1 bytes from stdin to stdout.
#
# This could be written as "head -c $1", but IRIX "head" does not
# support the -c option.
head_c () {
"$PERL_PATH" -e '
my $len = $ARGV[1];
while ($len > 0) {
my $s;
my $nread = sysread(STDIN, $s, $len);
die "cannot read: $!" unless defined($nread);
print $s;
$len -= $nread;
}
' - "$1"
}
verify_packs () {
for p in .git/objects/pack/*.pack
do
git verify-pack "$@" "$p" || return
done
}
file2_data='file2
second line of EOF'
file3_data='EOF
in 3rd file
END'
file4_data=abcd
file4_len=4
file5_data='an inline file.
we should see it later.'
file6_data='#!/bin/sh
echo "$@"'
>empty
###
### series A
###
test_tick
test_expect_success 'empty stream succeeds' '
git fast-import </dev/null
'
cat >input <<INPUT_END
blob
mark :2
data <<EOF
$file2_data
EOF
blob
mark :3
data <<END
$file3_data
END
blob
mark :4
data $file4_len
$file4_data
commit refs/heads/master
mark :5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
initial
COMMIT
M 644 :2 file2
M 644 :3 file3
M 755 :4 file4
tag series-A
from :5
data <<EOF
An annotated tag without a tagger
EOF
tag series-A-blob
from :3
data <<EOF
An annotated tag that annotates a blob.
EOF
INPUT_END
test_expect_success \
'A: create pack from stdin' \
'git fast-import --export-marks=marks.out <input &&
git whatchanged master'
test_expect_success 'A: verify pack' '
verify_packs
'
cat >expect <<EOF
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
initial
EOF
test_expect_success \
'A: verify commit' \
'git cat-file commit master | sed 1d >actual &&
test_cmp expect actual'
cat >expect <<EOF
100644 blob file2
100644 blob file3
100755 blob file4
EOF
test_expect_success \
'A: verify tree' \
'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual'
echo "$file2_data" >expect
test_expect_success \
'A: verify file2' \
'git cat-file blob master:file2 >actual && test_cmp expect actual'
echo "$file3_data" >expect
test_expect_success \
'A: verify file3' \
'git cat-file blob master:file3 >actual && test_cmp expect actual'
printf "$file4_data" >expect
test_expect_success \
'A: verify file4' \
'git cat-file blob master:file4 >actual && test_cmp expect actual'
cat >expect <<EOF
object $(git rev-parse refs/heads/master)
type commit
tag series-A
An annotated tag without a tagger
EOF
test_expect_success 'A: verify tag/series-A' '
git cat-file tag tags/series-A >actual &&
test_cmp expect actual
'
cat >expect <<EOF
object $(git rev-parse refs/heads/master:file3)
type blob
tag series-A-blob
An annotated tag that annotates a blob.
EOF
test_expect_success 'A: verify tag/series-A-blob' '
git cat-file tag tags/series-A-blob >actual &&
test_cmp expect actual
'
cat >expect <<EOF
:2 `git rev-parse --verify master:file2`
:3 `git rev-parse --verify master:file3`
:4 `git rev-parse --verify master:file4`
:5 `git rev-parse --verify master^0`
EOF
test_expect_success \
'A: verify marks output' \
'test_cmp expect marks.out'
test_expect_success \
'A: verify marks import' \
'git fast-import \
--import-marks=marks.out \
--export-marks=marks.new \
</dev/null &&
test_cmp expect marks.new'
test_tick
new_blob=$(echo testing | git hash-object --stdin)
cat >input <<INPUT_END
tag series-A-blob-2
from $(git rev-parse refs/heads/master:file3)
data <<EOF
Tag blob by sha1.
EOF
blob
mark :6
data <<EOF
testing
EOF
commit refs/heads/new_blob
committer <> 0 +0000
data 0
M 644 :6 new_blob
#pretend we got sha1 from fast-import
ls "new_blob"
tag series-A-blob-3
from $new_blob
data <<EOF
Tag new_blob.
EOF
INPUT_END
cat >expect <<EOF
object $(git rev-parse refs/heads/master:file3)
type blob
tag series-A-blob-2
Tag blob by sha1.
object $new_blob
type blob
tag series-A-blob-3
Tag new_blob.
EOF
test_expect_success \
'A: tag blob by sha1' \
'git fast-import <input &&
git cat-file tag tags/series-A-blob-2 >actual &&
git cat-file tag tags/series-A-blob-3 >>actual &&
test_cmp expect actual'
test_tick
cat >input <<INPUT_END
commit refs/heads/verify--import-marks
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
recreate from :5
COMMIT
from :5
M 755 :2 copy-of-file2
INPUT_END
test_expect_success \
'A: verify marks import does not crash' \
'git fast-import --import-marks=marks.out <input &&
git whatchanged verify--import-marks'
test_expect_success 'A: verify pack' '
verify_packs
'
cat >expect <<EOF
:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A copy-of-file2
EOF
git diff-tree -M -r master verify--import-marks >actual
test_expect_success \
'A: verify diff' \
'compare_diff_raw expect actual &&
test `git rev-parse --verify master:file2` \
= `git rev-parse --verify verify--import-marks:copy-of-file2`'
test_tick
mt=$(git hash-object --stdin < /dev/null)
: >input.blob
: >marks.exp
: >tree.exp
cat >input.commit <<EOF
commit refs/heads/verify--dump-marks
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
test the sparse array dumping routines with exponentially growing marks
COMMIT
EOF
i=0
l=4
m=6
n=7
while test "$i" -lt 27; do
cat >>input.blob <<EOF
blob
mark :$l
data 0
blob
mark :$m
data 0
blob
mark :$n
data 0
EOF
echo "M 100644 :$l l$i" >>input.commit
echo "M 100644 :$m m$i" >>input.commit
echo "M 100644 :$n n$i" >>input.commit
echo ":$l $mt" >>marks.exp
echo ":$m $mt" >>marks.exp
echo ":$n $mt" >>marks.exp
printf "100644 blob $mt\tl$i\n" >>tree.exp
printf "100644 blob $mt\tm$i\n" >>tree.exp
printf "100644 blob $mt\tn$i\n" >>tree.exp
l=$(($l + $l))
m=$(($m + $m))
n=$(($l + $n))
i=$((1 + $i))
done
sort tree.exp > tree.exp_s
test_expect_success 'A: export marks with large values' '
cat input.blob input.commit | git fast-import --export-marks=marks.large &&
git ls-tree refs/heads/verify--dump-marks >tree.out &&
test_cmp tree.exp_s tree.out &&
test_cmp marks.exp marks.large'
###
### series B
###
test_tick
cat >input <<INPUT_END
commit refs/heads/branch
mark :1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
corrupt
COMMIT
from refs/heads/master
M 755 0000000000000000000000000000000000000001 zero1
INPUT_END
test_expect_success 'B: fail on invalid blob sha1' '
test_must_fail git fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
commit .badbranchname
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
corrupt
COMMIT
from refs/heads/master
INPUT_END
test_expect_success 'B: fail on invalid branch name ".badbranchname"' '
test_must_fail git fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
commit bad[branch]name
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
corrupt
COMMIT
from refs/heads/master
INPUT_END
test_expect_success 'B: fail on invalid branch name "bad[branch]name"' '
test_must_fail git fast-import <input
'
rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
commit TEMP_TAG
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
tag base
COMMIT
from refs/heads/master
INPUT_END
test_expect_success \
'B: accept branch name "TEMP_TAG"' \
'git fast-import <input &&
test -f .git/TEMP_TAG &&
test `git rev-parse master` = `git rev-parse TEMP_TAG^`'
rm -f .git/TEMP_TAG
git gc 2>/dev/null >/dev/null
git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/empty-committer-1
committer <> $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: accept empty committer' '
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
git update-ref -d refs/heads/empty-committer-1 || true
git gc 2>/dev/null >/dev/null
git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/empty-committer-2
committer <[email protected]> $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: accept and fixup committer with no name' '
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
test -z "$out"
'
git update-ref -d refs/heads/empty-committer-2 || true
git gc 2>/dev/null >/dev/null
git prune 2>/dev/null >/dev/null
cat >input <<INPUT_END
commit refs/heads/invalid-committer
committer Name email> $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (1)' '
test_must_fail git fast-import <input
'
git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
committer Name <e<mail> $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (2)' '
test_must_fail git fast-import <input
'
git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
committer Name <email>> $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (3)' '
test_must_fail git fast-import <input
'
git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
committer Name <email $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (4)' '
test_must_fail git fast-import <input
'
git update-ref -d refs/heads/invalid-committer || true
cat >input <<INPUT_END
commit refs/heads/invalid-committer
committer Name<email> $GIT_COMMITTER_DATE
data <<COMMIT
empty commit
COMMIT
INPUT_END
test_expect_success 'B: fail on invalid committer (5)' '
test_must_fail git fast-import <input
'
git update-ref -d refs/heads/invalid-committer || true
###
### series C
###
newf=`echo hi newf | git hash-object -w --stdin`
oldf=`git rev-parse --verify master:file2`
test_tick
cat >input <<INPUT_END
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
second
COMMIT
from refs/heads/master
M 644 $oldf file2/oldf
M 755 $newf file2/newf
D file3
INPUT_END
test_expect_success \
'C: incremental import create pack from stdin' \
'git fast-import <input &&
git whatchanged branch'
test_expect_success 'C: verify pack' '
verify_packs
'
test_expect_success \
'C: validate reuse existing blob' \
'test $newf = `git rev-parse --verify branch:file2/newf` &&
test $oldf = `git rev-parse --verify branch:file2/oldf`'
cat >expect <<EOF
parent `git rev-parse --verify master^0`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
second
EOF
test_expect_success \
'C: verify commit' \
'git cat-file commit branch | sed 1d >actual &&
test_cmp expect actual'
cat >expect <<EOF
:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf
:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3
EOF
git diff-tree -M -r master branch >actual
test_expect_success \
'C: validate rename result' \
'compare_diff_raw expect actual'
###
### series D
###
test_tick
cat >input <<INPUT_END
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
third
COMMIT
from refs/heads/branch^0
M 644 inline newdir/interesting
data <<EOF
$file5_data
EOF
M 755 inline newdir/exec.sh
data <<EOF
$file6_data
EOF
INPUT_END
test_expect_success \
'D: inline data in commit' \
'git fast-import <input &&
git whatchanged branch'
test_expect_success 'D: verify pack' '
verify_packs
'
cat >expect <<EOF
:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh
:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting
EOF
git diff-tree -M -r branch^ branch >actual
test_expect_success \
'D: validate new files added' \
'compare_diff_raw expect actual'
echo "$file5_data" >expect
test_expect_success \
'D: verify file5' \
'git cat-file blob branch:newdir/interesting >actual &&
test_cmp expect actual'
echo "$file6_data" >expect
test_expect_success \
'D: verify file6' \
'git cat-file blob branch:newdir/exec.sh >actual &&
test_cmp expect actual'
###
### series E
###
cat >input <<INPUT_END
commit refs/heads/branch
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500
data <<COMMIT
RFC 2822 type date
COMMIT
from refs/heads/branch^0
INPUT_END
test_expect_success 'E: rfc2822 date, --date-format=raw' '
test_must_fail git fast-import --date-format=raw <input
'
test_expect_success \
'E: rfc2822 date, --date-format=rfc2822' \
'git fast-import --date-format=rfc2822 <input'
test_expect_success 'E: verify pack' '
verify_packs
'
cat >expect <<EOF
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500
RFC 2822 type date
EOF
test_expect_success \
'E: verify commit' \
'git cat-file commit branch | sed 1,2d >actual &&
test_cmp expect actual'
###
### series F
###
old_branch=`git rev-parse --verify branch^0`
test_tick
cat >input <<INPUT_END
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
losing things already?
COMMIT
from refs/heads/branch~1
reset refs/heads/other
from refs/heads/branch
INPUT_END
test_expect_success \
'F: non-fast-forward update skips' \
'if git fast-import <input
then
echo BAD gfi did not fail
return 1
else
if test $old_branch = `git rev-parse --verify branch^0`
then
: branch unaffected and failure returned
return 0
else
echo BAD gfi changed branch $old_branch
return 1
fi
fi
'
test_expect_success 'F: verify pack' '
verify_packs
'
cat >expect <<EOF
tree `git rev-parse branch~1^{tree}`
parent `git rev-parse branch~1`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
losing things already?
EOF
test_expect_success \
'F: verify other commit' \
'git cat-file commit other >actual &&
test_cmp expect actual'
###
### series G
###
old_branch=`git rev-parse --verify branch^0`
test_tick
cat >input <<INPUT_END
commit refs/heads/branch
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
losing things already?
COMMIT
from refs/heads/branch~1
INPUT_END
test_expect_success \
'G: non-fast-forward update forced' \
'git fast-import --force <input'
test_expect_success 'G: verify pack' '
verify_packs
'
test_expect_success \
'G: branch changed, but logged' \
'test $old_branch != `git rev-parse --verify branch^0` &&
test $old_branch = `git rev-parse --verify branch@{1}`'
###
### series H
###
test_tick
cat >input <<INPUT_END
commit refs/heads/H
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
third
COMMIT
from refs/heads/branch^0
M 644 inline i-will-die
data <<EOF
this file will never exist.
EOF
deleteall
M 644 inline h/e/l/lo
data <<EOF
$file5_data
EOF
INPUT_END
test_expect_success \
'H: deletall, add 1' \
'git fast-import <input &&
git whatchanged H'
test_expect_success 'H: verify pack' '
verify_packs
'
cat >expect <<EOF
:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf
:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf
:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo
:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh
EOF
git diff-tree -M -r H^ H >actual
test_expect_success \
'H: validate old files removed, new files added' \
'compare_diff_raw expect actual'
echo "$file5_data" >expect
test_expect_success \
'H: verify file' \
'git cat-file blob H:h/e/l/lo >actual &&
test_cmp expect actual'
###
### series I
###
cat >input <<INPUT_END
commit refs/heads/export-boundary
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
we have a border. its only 40 characters wide.
COMMIT
from refs/heads/branch
INPUT_END
test_expect_success \
'I: export-pack-edges' \
'git fast-import --export-pack-edges=edges.list <input'
cat >expect <<EOF
.git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary`
EOF
test_expect_success \
'I: verify edge list' \
'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&
test_cmp expect actual'
###
### series J
###
cat >input <<INPUT_END
commit refs/heads/J
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
create J
COMMIT
from refs/heads/branch
reset refs/heads/J
commit refs/heads/J
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
initialize J
COMMIT
INPUT_END
test_expect_success \
'J: reset existing branch creates empty commit' \
'git fast-import <input'
test_expect_success \
'J: branch has 1 commit, empty tree' \
'test 1 = `git rev-list J | wc -l` &&
test 0 = `git ls-tree J | wc -l`'
cat >input <<INPUT_END
reset refs/heads/J2
tag wrong_tag
from refs/heads/J2
data <<EOF
Tag branch that was reset.
EOF
INPUT_END
test_expect_success \
'J: tag must fail on empty branch' \
'test_must_fail git fast-import <input'
###
### series K
###
cat >input <<INPUT_END
commit refs/heads/K
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
create K
COMMIT
from refs/heads/branch
commit refs/heads/K
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
redo K
COMMIT
from refs/heads/branch^1
INPUT_END
test_expect_success \
'K: reinit branch with from' \
'git fast-import <input'
test_expect_success \
'K: verify K^1 = branch^1' \
'test `git rev-parse --verify branch^1` \
= `git rev-parse --verify K^1`'
###
### series L
###
cat >input <<INPUT_END
blob
mark :1
data <<EOF
some data
EOF
blob
mark :2
data <<EOF
other data
EOF
commit refs/heads/L
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
create L
COMMIT
M 644 :1 b.
M 644 :1 b/other
M 644 :1 ba
commit refs/heads/L
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
update L
COMMIT
M 644 :2 b.
M 644 :2 b/other
M 644 :2 ba
INPUT_END
cat >expect <<EXPECT_END
:100644 100644 4268632... 55d3a52... M b.
:040000 040000 0ae5cac... 443c768... M b
:100644 100644 4268632... 55d3a52... M ba
EXPECT_END
test_expect_success \
'L: verify internal tree sorting' \
'git fast-import <input &&
git diff-tree --abbrev --raw L^ L >output &&
test_cmp expect output'
cat >input <<INPUT_END
blob
mark :1
data <<EOF
the data
EOF
commit refs/heads/L2
committer C O Mitter <[email protected]> 1112912473 -0700
data <<COMMIT
init L2
COMMIT
M 644 :1 a/b/c
M 644 :1 a/b/d
M 644 :1 a/e/f
commit refs/heads/L2
committer C O Mitter <[email protected]> 1112912473 -0700
data <<COMMIT
update L2
COMMIT
C a g
C a/e g/b
M 644 :1 g/b/h
INPUT_END
cat <<EOF >expect
g/b/f
g/b/h
EOF
test_expect_success \
'L: nested tree copy does not corrupt deltas' \
'git fast-import <input &&
git ls-tree L2 g/b/ >tmp &&
cat tmp | cut -f 2 >actual &&
test_cmp expect actual &&
git fsck `git rev-parse L2`'
git update-ref -d refs/heads/L2
###
### series M
###
test_tick
cat >input <<INPUT_END
commit refs/heads/M1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
file rename
COMMIT
from refs/heads/branch^0
R file2/newf file2/n.e.w.f
INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf file2/n.e.w.f
EOF
test_expect_success \
'M: rename file in same subdirectory' \
'git fast-import <input &&
git diff-tree -M -r M1^ M1 >actual &&
compare_diff_raw expect actual'
cat >input <<INPUT_END
commit refs/heads/M2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
file rename
COMMIT
from refs/heads/branch^0
R file2/newf i/am/new/to/you
INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 file2/newf i/am/new/to/you
EOF
test_expect_success \
'M: rename file to new subdirectory' \
'git fast-import <input &&
git diff-tree -M -r M2^ M2 >actual &&
compare_diff_raw expect actual'
cat >input <<INPUT_END
commit refs/heads/M3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
file rename
COMMIT
from refs/heads/M2^0
R i other/sub
INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100 i/am/new/to/you other/sub/am/new/to/you
EOF
test_expect_success \
'M: rename subdirectory to new subdirectory' \
'git fast-import <input &&
git diff-tree -M -r M3^ M3 >actual &&
compare_diff_raw expect actual'
###
### series N
###
test_tick
cat >input <<INPUT_END
commit refs/heads/N1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
file copy
COMMIT
from refs/heads/branch^0
C file2/newf file2/n.e.w.f
INPUT_END
cat >expect <<EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file2/n.e.w.f
EOF
test_expect_success \
'N: copy file in same subdirectory' \
'git fast-import <input &&
git diff-tree -C --find-copies-harder -r N1^ N1 >actual &&
compare_diff_raw expect actual'
cat >input <<INPUT_END
commit refs/heads/N2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
clean directory copy
COMMIT
from refs/heads/branch^0
C file2 file3
commit refs/heads/N2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
modify directory copy
COMMIT
M 644 inline file3/file5
data <<EOF
$file5_data
EOF
INPUT_END
cat >expect <<EOF
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
test_expect_success \
'N: copy then modify subdirectory' \
'git fast-import <input &&
git diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&
compare_diff_raw expect actual'
cat >input <<INPUT_END
commit refs/heads/N3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
dirty directory copy
COMMIT
from refs/heads/branch^0
M 644 inline file2/file5
data <<EOF
$file5_data
EOF
C file2 file3
D file2/file5
INPUT_END
test_expect_success \
'N: copy dirty subdirectory' \
'git fast-import <input &&
test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
test_expect_success \
'N: copy directory by id' \
'cat >expect <<-\EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
subdir=$(git rev-parse refs/heads/branch^0:file2) &&
cat >input <<-INPUT_END &&
commit refs/heads/N4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy by tree hash
COMMIT
from refs/heads/branch^0
M 040000 $subdir file3
INPUT_END
git fast-import <input &&
git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
compare_diff_raw expect actual'
test_expect_success PIPE 'N: read and copy directory' '
cat >expect <<-\EOF
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
git update-ref -d refs/heads/N4 &&
rm -f backflow &&
mkfifo backflow &&
(
exec <backflow &&
cat <<-EOF &&
commit refs/heads/N4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy by tree hash, part 2
COMMIT
from refs/heads/branch^0
ls "file2"
EOF
read mode type tree filename &&
echo "M 040000 $tree file3"
) |
git fast-import --cat-blob-fd=3 3>backflow &&
git diff-tree -C --find-copies-harder -r N4^ N4 >actual &&
compare_diff_raw expect actual
'
test_expect_success PIPE 'N: empty directory reads as missing' '
cat <<-\EOF >expect &&
OBJNAME
:000000 100644 OBJNAME OBJNAME A unrelated
EOF
echo "missing src" >expect.response &&
git update-ref -d refs/heads/read-empty &&
rm -f backflow &&
mkfifo backflow &&
(
exec <backflow &&
cat <<-EOF &&
commit refs/heads/read-empty
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
read "empty" (missing) directory
COMMIT
M 100644 inline src/greeting
data <<BLOB
hello
BLOB
C src/greeting dst1/non-greeting
C src/greeting unrelated
# leave behind "empty" src directory
D src/greeting
ls "src"
EOF
read -r line &&
printf "%s\n" "$line" >response &&
cat <<-\EOF
D dst1
D dst2
EOF
) |
git fast-import --cat-blob-fd=3 3>backflow &&
test_cmp expect.response response &&
git rev-list read-empty |
git diff-tree -r --root --stdin |
sed "s/$_x40/OBJNAME/g" >actual &&
test_cmp expect actual
'
test_expect_success \
'N: copy root directory by tree hash' \
'cat >expect <<-\EOF &&
:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file3/newf
:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file3/oldf
EOF
root=$(git rev-parse refs/heads/branch^0^{tree}) &&
cat >input <<-INPUT_END &&
commit refs/heads/N6
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy root directory by tree hash
COMMIT
from refs/heads/branch^0
M 040000 $root ""
INPUT_END
git fast-import <input &&
git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
compare_diff_raw expect actual'
test_expect_success \
'N: delete directory by copying' \
'cat >expect <<-\EOF &&
OBJID
:100644 000000 OBJID OBJID D foo/bar/qux
OBJID
:000000 100644 OBJID OBJID A foo/bar/baz
:000000 100644 OBJID OBJID A foo/bar/qux
EOF
empty_tree=$(git mktree </dev/null) &&
cat >input <<-INPUT_END &&
commit refs/heads/N-delete
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
collect data to be deleted
COMMIT
deleteall
M 100644 inline foo/bar/baz
data <<DATA_END
hello
DATA_END
C "foo/bar/baz" "foo/bar/qux"
C "foo/bar/baz" "foo/bar/quux/1"
C "foo/bar/baz" "foo/bar/quuux"
M 040000 $empty_tree foo/bar/quux
M 040000 $empty_tree foo/bar/quuux
commit refs/heads/N-delete
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
delete subdirectory
COMMIT
M 040000 $empty_tree foo/bar/qux
INPUT_END
git fast-import <input &&
git rev-list N-delete |
git diff-tree -r --stdin --root --always |
sed -e "s/$_x40/OBJID/g" >actual &&
test_cmp expect actual'
test_expect_success \
'N: modify copied tree' \
'cat >expect <<-\EOF &&
:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF
subdir=$(git rev-parse refs/heads/branch^0:file2) &&
cat >input <<-INPUT_END &&
commit refs/heads/N5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy by tree hash
COMMIT
from refs/heads/branch^0
M 040000 $subdir file3
commit refs/heads/N5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
modify directory copy
COMMIT
M 644 inline file3/file5
data <<EOF
$file5_data
EOF
INPUT_END
git fast-import <input &&
git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
compare_diff_raw expect actual'
test_expect_success \
'N: reject foo/ syntax' \
'subdir=$(git rev-parse refs/heads/branch^0:file2) &&
test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5B
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy with invalid syntax
COMMIT
from refs/heads/branch^0
M 040000 $subdir file3/
INPUT_END'
test_expect_success \
'N: reject foo/ syntax in copy source' \
'test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5C
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy with invalid syntax
COMMIT
from refs/heads/branch^0
C file2/ file3
INPUT_END'
test_expect_success \
'N: reject foo/ syntax in rename source' \
'test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5D
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
rename with invalid syntax
COMMIT
from refs/heads/branch^0
R file2/ file3
INPUT_END'
test_expect_success \
'N: reject foo/ syntax in ls argument' \
'test_must_fail git fast-import <<-INPUT_END
commit refs/heads/N5E
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy with invalid syntax
COMMIT
from refs/heads/branch^0
ls "file2/"
INPUT_END'
test_expect_success \
'N: copy to root by id and modify' \
'echo "hello, world" >expect.foo &&
echo hello >expect.bar &&
git fast-import <<-SETUP_END &&
commit refs/heads/N7
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
hello, tree
COMMIT
deleteall
M 644 inline foo/bar
data <<EOF
hello
EOF
SETUP_END
tree=$(git rev-parse --verify N7:) &&
git fast-import <<-INPUT_END &&
commit refs/heads/N8
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy to root by id and modify
COMMIT
M 040000 $tree ""
M 644 inline foo/foo
data <<EOF
hello, world
EOF
INPUT_END
git show N8:foo/foo >actual.foo &&
git show N8:foo/bar >actual.bar &&
test_cmp expect.foo actual.foo &&
test_cmp expect.bar actual.bar'
test_expect_success \
'N: extract subtree' \
'branch=$(git rev-parse --verify refs/heads/branch^{tree}) &&
cat >input <<-INPUT_END &&
commit refs/heads/N9
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
extract subtree branch:newdir
COMMIT
M 040000 $branch ""
C "newdir" ""
INPUT_END
git fast-import <input &&
git diff --exit-code branch:newdir N9'
test_expect_success \
'N: modify subtree, extract it, and modify again' \
'echo hello >expect.baz &&
echo hello, world >expect.qux &&
git fast-import <<-SETUP_END &&
commit refs/heads/N10
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
hello, tree
COMMIT
deleteall
M 644 inline foo/bar/baz
data <<EOF
hello
EOF
SETUP_END
tree=$(git rev-parse --verify N10:) &&
git fast-import <<-INPUT_END &&
commit refs/heads/N11
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy to root by id and modify
COMMIT
M 040000 $tree ""
M 100644 inline foo/bar/qux
data <<EOF
hello, world
EOF
R "foo" ""
C "bar/qux" "bar/quux"
INPUT_END
git show N11:bar/baz >actual.baz &&
git show N11:bar/qux >actual.qux &&
git show N11:bar/quux >actual.quux &&
test_cmp expect.baz actual.baz &&
test_cmp expect.qux actual.qux &&
test_cmp expect.qux actual.quux'
###
### series O
###
cat >input <<INPUT_END
#we will
commit refs/heads/O1
# -- ignore all of this text
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
# $GIT_COMMITTER_NAME has inserted here for his benefit.
data <<COMMIT
dirty directory copy
COMMIT
# don't forget the import blank line!
#
# yes, we started from our usual base of branch^0.
# i like branch^0.
from refs/heads/branch^0
# and we need to reuse file2/file5 from N3 above.
M 644 inline file2/file5
# otherwise the tree will be different
data <<EOF
$file5_data
EOF
# don't forget to copy file2 to file3
C file2 file3
#
# or to delete file5 from file2.
D file2/file5
# are we done yet?
INPUT_END
test_expect_success \
'O: comments are all skipped' \
'git fast-import <input &&
test `git rev-parse N3` = `git rev-parse O1`'
cat >input <<INPUT_END
commit refs/heads/O2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
dirty directory copy
COMMIT
from refs/heads/branch^0
M 644 inline file2/file5
data <<EOF
$file5_data
EOF
C file2 file3
D file2/file5
INPUT_END
test_expect_success \
'O: blank lines not necessary after data commands' \
'git fast-import <input &&
test `git rev-parse N3` = `git rev-parse O2`'
test_expect_success \
'O: repack before next test' \
'git repack -a -d'
cat >input <<INPUT_END
commit refs/heads/O3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zstring
COMMIT
commit refs/heads/O3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zof
COMMIT
checkpoint
commit refs/heads/O3
mark :5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zempty
COMMIT
checkpoint
commit refs/heads/O3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zcommits
COMMIT
reset refs/tags/O3-2nd
from :5
reset refs/tags/O3-3rd
from :5
INPUT_END
cat >expect <<INPUT_END
string
of
empty
commits
INPUT_END
test_expect_success \
'O: blank lines not necessary after other commands' \
'git fast-import <input &&
test 8 = `find .git/objects/pack -type f | wc -l` &&
test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` &&
git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&
test_cmp expect actual'
cat >input <<INPUT_END
commit refs/heads/O4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zstring
COMMIT
commit refs/heads/O4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zof
COMMIT
progress Two commits down, 2 to go!
commit refs/heads/O4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zempty
COMMIT
progress Three commits down, 1 to go!
commit refs/heads/O4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
zcommits
COMMIT
progress I'm done!
INPUT_END
test_expect_success \
'O: progress outputs as requested by input' \
'git fast-import <input >actual &&
grep "progress " <input >expect &&
test_cmp expect actual'
###
### series P (gitlinks)
###
cat >input <<INPUT_END
blob
mark :1
data 10
test file
reset refs/heads/sub
commit refs/heads/sub
mark :2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data 12
sub_initial
M 100644 :1 file
blob
mark :3
data <<DATAEND
[submodule "sub"]
path = sub
url = "`pwd`/sub"
DATAEND
commit refs/heads/subuse1
mark :4
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data 8
initial
from refs/heads/master
M 100644 :3 .gitmodules
M 160000 :2 sub
blob
mark :5
data 20
test file
more data
commit refs/heads/sub
mark :6
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data 11
sub_second
from :2
M 100644 :5 file
commit refs/heads/subuse1
mark :7
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data 7
second
from :4
M 160000 :6 sub
INPUT_END
test_expect_success \
'P: superproject & submodule mix' \
'git fast-import <input &&
git checkout subuse1 &&
rm -rf sub && mkdir sub && (cd sub &&
git init &&
git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
git checkout master) &&
git submodule init &&
git submodule update'
SUBLAST=$(git rev-parse --verify sub)
SUBPREV=$(git rev-parse --verify sub^)
cat >input <<INPUT_END
blob
mark :1
data <<DATAEND
[submodule "sub"]
path = sub
url = "`pwd`/sub"
DATAEND
commit refs/heads/subuse2
mark :2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data 8
initial
from refs/heads/master
M 100644 :1 .gitmodules
M 160000 $SUBPREV sub
commit refs/heads/subuse2
mark :3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data 7
second
from :2
M 160000 $SUBLAST sub
INPUT_END
test_expect_success \
'P: verbatim SHA gitlinks' \
'git branch -D sub &&
git gc && git prune &&
git fast-import <input &&
test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)'
test_tick
cat >input <<INPUT_END
commit refs/heads/subuse3
mark :1
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
corrupt
COMMIT
from refs/heads/subuse2
M 160000 inline sub
data <<DATA
$SUBPREV
DATA
INPUT_END
test_expect_success 'P: fail on inline gitlink' '
test_must_fail git fast-import <input'
test_tick
cat >input <<INPUT_END
blob
mark :1
data <<DATA
$SUBPREV
DATA
commit refs/heads/subuse3
mark :2
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
corrupt
COMMIT
from refs/heads/subuse2
M 160000 :1 sub
INPUT_END
test_expect_success 'P: fail on blob mark in gitlink' '
test_must_fail git fast-import <input'
###
### series Q (notes)
###
note1_data="The first note for the first commit"
note2_data="The first note for the second commit"
note3_data="The first note for the third commit"
note1b_data="The second note for the first commit"
note1c_data="The third note for the first commit"
note2b_data="The second note for the second commit"
test_tick
cat >input <<INPUT_END
blob
mark :2
data <<EOF
$file2_data
EOF
commit refs/heads/notes-test
mark :3
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
first (:3)
COMMIT
M 644 :2 file2
blob
mark :4
data $file4_len
$file4_data
commit refs/heads/notes-test
mark :5
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
second (:5)
COMMIT
M 644 :4 file4
commit refs/heads/notes-test
mark :6
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
third (:6)
COMMIT
M 644 inline file5
data <<EOF
$file5_data
EOF
M 755 inline file6
data <<EOF
$file6_data
EOF
blob
mark :7
data <<EOF
$note1_data
EOF
blob
mark :8
data <<EOF
$note2_data
EOF
commit refs/notes/foobar
mark :9
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
notes (:9)
COMMIT
N :7 :3
N :8 :5
N inline :6
data <<EOF
$note3_data
EOF
commit refs/notes/foobar
mark :10
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
notes (:10)
COMMIT
N inline :3
data <<EOF
$note1b_data
EOF
commit refs/notes/foobar2
mark :11
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
notes (:11)
COMMIT
N inline :3
data <<EOF
$note1c_data
EOF
commit refs/notes/foobar
mark :12
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
notes (:12)
COMMIT
deleteall
N inline :5
data <<EOF
$note2b_data
EOF
INPUT_END
test_expect_success \
'Q: commit notes' \
'git fast-import <input &&
git whatchanged notes-test'
test_expect_success 'Q: verify pack' '
verify_packs
'
commit1=$(git rev-parse notes-test~2)
commit2=$(git rev-parse notes-test^)
commit3=$(git rev-parse notes-test)
cat >expect <<EOF
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
first (:3)
EOF
test_expect_success \
'Q: verify first commit' \
'git cat-file commit notes-test~2 | sed 1d >actual &&
test_cmp expect actual'
cat >expect <<EOF
parent $commit1
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
second (:5)
EOF
test_expect_success \
'Q: verify second commit' \
'git cat-file commit notes-test^ | sed 1d >actual &&
test_cmp expect actual'
cat >expect <<EOF
parent $commit2
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
third (:6)
EOF
test_expect_success \
'Q: verify third commit' \
'git cat-file commit notes-test | sed 1d >actual &&
test_cmp expect actual'
cat >expect <<EOF
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:9)
EOF
test_expect_success \
'Q: verify first notes commit' \
'git cat-file commit refs/notes/foobar~2 | sed 1d >actual &&
test_cmp expect actual'
cat >expect.unsorted <<EOF
100644 blob $commit1
100644 blob $commit2
100644 blob $commit3
EOF
cat expect.unsorted | sort >expect
test_expect_success \
'Q: verify first notes tree' \
'git cat-file -p refs/notes/foobar~2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual'
echo "$note1_data" >expect
test_expect_success \
'Q: verify first note for first commit' \
'git cat-file blob refs/notes/foobar~2:$commit1 >actual && test_cmp expect actual'
echo "$note2_data" >expect
test_expect_success \
'Q: verify first note for second commit' \
'git cat-file blob refs/notes/foobar~2:$commit2 >actual && test_cmp expect actual'
echo "$note3_data" >expect
test_expect_success \
'Q: verify first note for third commit' \
'git cat-file blob refs/notes/foobar~2:$commit3 >actual && test_cmp expect actual'
cat >expect <<EOF
parent `git rev-parse --verify refs/notes/foobar~2`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:10)
EOF
test_expect_success \
'Q: verify second notes commit' \
'git cat-file commit refs/notes/foobar^ | sed 1d >actual &&
test_cmp expect actual'
cat >expect.unsorted <<EOF
100644 blob $commit1
100644 blob $commit2
100644 blob $commit3
EOF
cat expect.unsorted | sort >expect
test_expect_success \
'Q: verify second notes tree' \
'git cat-file -p refs/notes/foobar^^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual'
echo "$note1b_data" >expect
test_expect_success \
'Q: verify second note for first commit' \
'git cat-file blob refs/notes/foobar^:$commit1 >actual && test_cmp expect actual'
echo "$note2_data" >expect
test_expect_success \
'Q: verify first note for second commit' \
'git cat-file blob refs/notes/foobar^:$commit2 >actual && test_cmp expect actual'
echo "$note3_data" >expect
test_expect_success \
'Q: verify first note for third commit' \
'git cat-file blob refs/notes/foobar^:$commit3 >actual && test_cmp expect actual'
cat >expect <<EOF
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:11)
EOF
test_expect_success \
'Q: verify third notes commit' \
'git cat-file commit refs/notes/foobar2 | sed 1d >actual &&
test_cmp expect actual'
cat >expect.unsorted <<EOF
100644 blob $commit1
EOF
cat expect.unsorted | sort >expect
test_expect_success \
'Q: verify third notes tree' \
'git cat-file -p refs/notes/foobar2^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual'
echo "$note1c_data" >expect
test_expect_success \
'Q: verify third note for first commit' \
'git cat-file blob refs/notes/foobar2:$commit1 >actual && test_cmp expect actual'
cat >expect <<EOF
parent `git rev-parse --verify refs/notes/foobar^`
author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
notes (:12)
EOF
test_expect_success \
'Q: verify fourth notes commit' \
'git cat-file commit refs/notes/foobar | sed 1d >actual &&
test_cmp expect actual'
cat >expect.unsorted <<EOF
100644 blob $commit2
EOF
cat expect.unsorted | sort >expect
test_expect_success \
'Q: verify fourth notes tree' \
'git cat-file -p refs/notes/foobar^{tree} | sed "s/ [0-9a-f]* / /" >actual &&
test_cmp expect actual'
echo "$note2b_data" >expect
test_expect_success \
'Q: verify second note for second commit' \
'git cat-file blob refs/notes/foobar:$commit2 >actual && test_cmp expect actual'
cat >input <<EOF
reset refs/heads/Q0
commit refs/heads/note-Q0
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
Note for an empty branch.
COMMIT
N inline refs/heads/Q0
data <<NOTE
some note
NOTE
EOF
test_expect_success \
'Q: deny note on empty branch' \
'test_must_fail git fast-import <input'
###
### series R (feature and option)
###
cat >input <<EOF
feature no-such-feature-exists
EOF
test_expect_success 'R: abort on unsupported feature' '
test_must_fail git fast-import <input
'
cat >input <<EOF
feature date-format=now
EOF
test_expect_success 'R: supported feature is accepted' '
git fast-import <input
'
cat >input << EOF
blob
data 3
hi
feature date-format=now
EOF
test_expect_success 'R: abort on receiving feature after data command' '
test_must_fail git fast-import <input
'
cat >input << EOF
feature import-marks=git.marks
feature import-marks=git2.marks
EOF
test_expect_success 'R: only one import-marks feature allowed per stream' '
test_must_fail git fast-import <input
'
cat >input << EOF
feature export-marks=git.marks
blob
mark :1
data 3
hi
EOF
test_expect_success \
'R: export-marks feature results in a marks file being created' \
'cat input | git fast-import &&
grep :1 git.marks'
test_expect_success \
'R: export-marks options can be overridden by commandline options' \
'cat input | git fast-import --export-marks=other.marks &&
grep :1 other.marks'
test_expect_success 'R: catch typo in marks file name' '
test_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&
echo "feature import-marks=nonexistent.marks" |
test_must_fail git fast-import
'
test_expect_success 'R: import and output marks can be the same file' '
rm -f io.marks &&
blob=$(echo hi | git hash-object --stdin) &&
cat >expect <<-EOF &&
:1 $blob
:2 $blob
EOF
git fast-import --export-marks=io.marks <<-\EOF &&
blob
mark :1
data 3
hi
EOF
git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF &&
blob
mark :2
data 3
hi
EOF
test_cmp expect io.marks
'
test_expect_success 'R: --import-marks=foo --output-marks=foo to create foo fails' '
rm -f io.marks &&
test_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\EOF
blob
mark :1
data 3
hi
EOF
'
test_expect_success 'R: --import-marks-if-exists' '
rm -f io.marks &&
blob=$(echo hi | git hash-object --stdin) &&
echo ":1 $blob" >expect &&
git fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\EOF &&
blob
mark :1
data 3
hi
EOF
test_cmp expect io.marks
'
test_expect_success 'R: feature import-marks-if-exists' '
rm -f io.marks &&
>expect &&
git fast-import --export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=not_io.marks
EOF
test_cmp expect io.marks &&
blob=$(echo hi | git hash-object --stdin) &&
echo ":1 $blob" >io.marks &&
echo ":1 $blob" >expect &&
echo ":2 $blob" >>expect &&
git fast-import --export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=io.marks
blob
mark :2
data 3
hi
EOF
test_cmp expect io.marks &&
echo ":3 $blob" >>expect &&
git fast-import --import-marks=io.marks \
--export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=not_io.marks
blob
mark :3
data 3
hi
EOF
test_cmp expect io.marks &&
>expect &&
git fast-import --import-marks-if-exists=not_io.marks \
--export-marks=io.marks <<-\EOF
feature import-marks-if-exists=io.marks
EOF
test_cmp expect io.marks
'
cat >input << EOF
feature import-marks=marks.out
feature export-marks=marks.new
EOF
test_expect_success \
'R: import to output marks works without any content' \
'cat input | git fast-import &&
test_cmp marks.out marks.new'
cat >input <<EOF
feature import-marks=nonexistent.marks
feature export-marks=marks.new
EOF
test_expect_success \
'R: import marks prefers commandline marks file over the stream' \
'cat input | git fast-import --import-marks=marks.out &&
test_cmp marks.out marks.new'
cat >input <<EOF
feature import-marks=nonexistent.marks
feature export-marks=combined.marks
EOF
test_expect_success 'R: multiple --import-marks= should be honoured' '
head -n2 marks.out > one.marks &&
tail -n +3 marks.out > two.marks &&
git fast-import --import-marks=one.marks --import-marks=two.marks <input &&
test_cmp marks.out combined.marks
'
cat >input <<EOF
feature relative-marks
feature import-marks=relative.in
feature export-marks=relative.out
EOF
test_expect_success 'R: feature relative-marks should be honoured' '
mkdir -p .git/info/fast-import/ &&
cp marks.new .git/info/fast-import/relative.in &&
git fast-import <input &&
test_cmp marks.new .git/info/fast-import/relative.out
'
cat >input <<EOF
feature relative-marks
feature import-marks=relative.in
feature no-relative-marks
feature export-marks=non-relative.out
EOF
test_expect_success 'R: feature no-relative-marks should be honoured' '
git fast-import <input &&
test_cmp marks.new non-relative.out
'
test_expect_success 'R: feature ls supported' '
echo "feature ls" |
git fast-import
'
test_expect_success 'R: feature cat-blob supported' '
echo "feature cat-blob" |
git fast-import
'
test_expect_success 'R: cat-blob-fd must be a nonnegative integer' '
test_must_fail git fast-import --cat-blob-fd=-1 </dev/null
'
test_expect_success NOT_MINGW 'R: print old blob' '
blob=$(echo "yes it can" | git hash-object -w --stdin) &&
cat >expect <<-EOF &&
${blob} blob 11
yes it can
EOF
echo "cat-blob $blob" |
git fast-import --cat-blob-fd=6 6>actual &&
test_cmp expect actual
'
test_expect_success NOT_MINGW 'R: in-stream cat-blob-fd not respected' '
echo hello >greeting &&
blob=$(git hash-object -w greeting) &&
cat >expect <<-EOF &&
${blob} blob 6
hello
EOF
git fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&
cat-blob $blob
EOF
test_cmp expect actual.3 &&
test_cmp empty actual.1 &&
git fast-import 3>actual.3 >actual.1 <<-EOF &&
option cat-blob-fd=3
cat-blob $blob
EOF
test_cmp empty actual.3 &&
test_cmp expect actual.1
'
test_expect_success NOT_MINGW 'R: print new blob' '
blob=$(echo "yep yep yep" | git hash-object --stdin) &&
cat >expect <<-EOF &&
${blob} blob 12
yep yep yep
EOF
git fast-import --cat-blob-fd=6 6>actual <<-\EOF &&
blob
mark :1
data <<BLOB_END
yep yep yep
BLOB_END
cat-blob :1
EOF
test_cmp expect actual
'
test_expect_success NOT_MINGW 'R: print new blob by sha1' '
blob=$(echo "a new blob named by sha1" | git hash-object --stdin) &&
cat >expect <<-EOF &&
${blob} blob 25
a new blob named by sha1
EOF
git fast-import --cat-blob-fd=6 6>actual <<-EOF &&
blob
data <<BLOB_END
a new blob named by sha1
BLOB_END
cat-blob $blob
EOF
test_cmp expect actual
'
test_expect_success 'setup: big file' '
(
echo "the quick brown fox jumps over the lazy dog" >big &&
for i in 1 2 3
do
cat big big big big >bigger &&
cat bigger bigger bigger bigger >big ||
exit
done
)
'
test_expect_success 'R: print two blobs to stdout' '
blob1=$(git hash-object big) &&
blob1_len=$(wc -c <big) &&
blob2=$(echo hello | git hash-object --stdin) &&
{
echo ${blob1} blob $blob1_len &&
cat big &&
cat <<-EOF
${blob2} blob 6
hello
EOF
} >expect &&
{
cat <<-\END_PART1 &&
blob
mark :1
data <<data_end
END_PART1
cat big &&
cat <<-\EOF
data_end
blob
mark :2
data <<data_end
hello
data_end
cat-blob :1
cat-blob :2
EOF
} |
git fast-import >actual &&
test_cmp expect actual
'
test_expect_success PIPE 'R: copy using cat-file' '
expect_id=$(git hash-object big) &&
expect_len=$(wc -c <big) &&
echo $expect_id blob $expect_len >expect.response &&
rm -f blobs &&
cat >frontend <<-\FRONTEND_END &&
#!/bin/sh
FRONTEND_END
mkfifo blobs &&
(
export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&
cat <<-\EOF &&
feature cat-blob
blob
mark :1
data <<BLOB
EOF
cat big &&
cat <<-\EOF &&
BLOB
cat-blob :1
EOF
read blob_id type size <&3 &&
echo "$blob_id $type $size" >response &&
head_c $size >blob <&3 &&
read newline <&3 &&
cat <<-EOF &&
commit refs/heads/copied
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
copy big file as file3
COMMIT
M 644 inline file3
data <<BLOB
EOF
cat blob &&
echo BLOB
) 3<blobs |
git fast-import --cat-blob-fd=3 3>blobs &&
git show copied:file3 >actual &&
test_cmp expect.response response &&
test_cmp big actual
'
test_expect_success PIPE 'R: print blob mid-commit' '
rm -f blobs &&
echo "A blob from _before_ the commit." >expect &&
mkfifo blobs &&
(
exec 3<blobs &&
cat <<-EOF &&
feature cat-blob
blob
mark :1
data <<BLOB
A blob from _before_ the commit.
BLOB
commit refs/heads/temporary
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
Empty commit
COMMIT
cat-blob :1
EOF
read blob_id type size <&3 &&
head_c $size >actual <&3 &&
read newline <&3 &&
echo
) |
git fast-import --cat-blob-fd=3 3>blobs &&
test_cmp expect actual
'
test_expect_success PIPE 'R: print staged blob within commit' '
rm -f blobs &&
echo "A blob from _within_ the commit." >expect &&
mkfifo blobs &&
(
exec 3<blobs &&
cat <<-EOF &&
feature cat-blob
commit refs/heads/within
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
Empty commit
COMMIT
M 644 inline within
data <<BLOB
A blob from _within_ the commit.
BLOB
EOF
to_get=$(
echo "A blob from _within_ the commit." |
git hash-object --stdin
) &&
echo "cat-blob $to_get" &&
read blob_id type size <&3 &&
head_c $size >actual <&3 &&
read newline <&3 &&
echo deleteall
) |
git fast-import --cat-blob-fd=3 3>blobs &&
test_cmp expect actual
'
cat >input << EOF
option git quiet
blob
data 3
hi
EOF
test_expect_success 'R: quiet option results in no stats being output' '
cat input | git fast-import 2> output &&
test_cmp empty output
'
test_expect_success 'R: feature done means terminating "done" is mandatory' '
echo feature done | test_must_fail git fast-import &&
test_must_fail git fast-import --done </dev/null
'
test_expect_success 'R: terminating "done" with trailing gibberish is ok' '
git fast-import <<-\EOF &&
feature done
done
trailing gibberish
EOF
git fast-import <<-\EOF
done
more trailing gibberish
EOF
'
test_expect_success 'R: terminating "done" within commit' '
cat >expect <<-\EOF &&
OBJID
:000000 100644 OBJID OBJID A hello.c
:000000 100644 OBJID OBJID A hello2.c
EOF
git fast-import <<-EOF &&
commit refs/heads/done-ends
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<EOT
Commit terminated by "done" command
EOT
M 100644 inline hello.c
data <<EOT
Hello, world.
EOT
C hello.c hello2.c
done
EOF
git rev-list done-ends |
git diff-tree -r --stdin --root --always |
sed -e "s/$_x40/OBJID/g" >actual &&
test_cmp expect actual
'
cat >input <<EOF
option git non-existing-option
EOF
test_expect_success 'R: die on unknown option' '
test_must_fail git fast-import <input
'
test_expect_success 'R: unknown commandline options are rejected' '\
test_must_fail git fast-import --non-existing-option < /dev/null
'
test_expect_success 'R: die on invalid option argument' '
echo "option git active-branches=-5" |
test_must_fail git fast-import &&
echo "option git depth=" |
test_must_fail git fast-import &&
test_must_fail git fast-import --depth="5 elephants" </dev/null
'
cat >input <<EOF
option non-existing-vcs non-existing-option
EOF
test_expect_success 'R: ignore non-git options' '
git fast-import <input
'
##
## R: very large blobs
##
blobsize=$((2*1024*1024 + 53))
test-genrandom bar $blobsize >expect
cat >input <<INPUT_END
commit refs/heads/big-file
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
R - big file
COMMIT
M 644 inline big1
data $blobsize
INPUT_END
cat expect >>input
cat >>input <<INPUT_END
M 644 inline big2
data $blobsize
INPUT_END
cat expect >>input
echo >>input
test_expect_success \
'R: blob bigger than threshold' \
'test_create_repo R &&
git --git-dir=R/.git fast-import --big-file-threshold=1 <input'
test_expect_success 'R: verify created pack' '
(
cd R &&
verify_packs -v > ../verify
)
'
test_expect_success \
'R: verify written objects' \
'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&
test_cmp expect actual &&
a=$(git --git-dir=R/.git rev-parse big-file:big1) &&
b=$(git --git-dir=R/.git rev-parse big-file:big2) &&
test $a = $b'
test_expect_success \
'R: blob appears only once' \
'n=$(grep $a verify | wc -l) &&
test 1 = $n'
###
### series S
###
#
# Make sure missing spaces and EOLs after mark references
# cause errors.
#
# Setup:
#
# 1--2--4
# \ /
# -3-
#
# commit marks: 301, 302, 303, 304
# blob marks: 403, 404, resp.
# note mark: 202
#
# The error message when a space is missing not at the
# end of the line is:
#
# Missing space after ..
#
# or when extra characters come after the mark at the end
# of the line:
#
# Garbage after ..
#
# or when the dataref is neither "inline " or a known SHA1,
#
# Invalid dataref ..
#
test_tick
cat >input <<INPUT_END
commit refs/heads/S
mark :301
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit 1
COMMIT
M 100644 inline hello.c
data <<BLOB
blob 1
BLOB
commit refs/heads/S
mark :302
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit 2
COMMIT
from :301
M 100644 inline hello.c
data <<BLOB
blob 2
BLOB
blob
mark :403
data <<BLOB
blob 3
BLOB
blob
mark :202
data <<BLOB
note 2
BLOB
INPUT_END
test_expect_success 'S: initialize for S tests' '
git fast-import --export-marks=marks <input
'
#
# filemodify, three datarefs
#
test_expect_success 'S: filemodify with garbage after mark must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit N
COMMIT
M 100644 :403x hello.c
EOF
cat err &&
test_i18ngrep "space after mark" err
'
# inline is misspelled; fast-import thinks it is some unknown dataref
test_expect_success 'S: filemodify with garbage after inline must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit N
COMMIT
M 100644 inlineX hello.c
data <<BLOB
inline
BLOB
EOF
cat err &&
test_i18ngrep "nvalid dataref" err
'
test_expect_success 'S: filemodify with garbage after sha1 must fail' '
sha1=$(grep :403 marks | cut -d\ -f2) &&
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit N
COMMIT
M 100644 ${sha1}x hello.c
EOF
cat err &&
test_i18ngrep "space after SHA1" err
'
#
# notemodify, three ways to say dataref
#
test_expect_success 'S: notemodify with garabge after mark dataref must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit S note dataref markref
COMMIT
N :202x :302
EOF
cat err &&
test_i18ngrep "space after mark" err
'
test_expect_success 'S: notemodify with garbage after inline dataref must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit S note dataref inline
COMMIT
N inlineX :302
data <<BLOB
note blob
BLOB
EOF
cat err &&
test_i18ngrep "nvalid dataref" err
'
test_expect_success 'S: notemodify with garbage after sha1 dataref must fail' '
sha1=$(grep :202 marks | cut -d\ -f2) &&
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit S note dataref sha1
COMMIT
N ${sha1}x :302
EOF
cat err &&
test_i18ngrep "space after SHA1" err
'
#
# notemodify, mark in committish
#
test_expect_success 'S: notemodify with garbarge after mark committish must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/Snotes
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit S note committish
COMMIT
N :202 :302x
EOF
cat err &&
test_i18ngrep "after mark" err
'
#
# from
#
test_expect_success 'S: from with garbage after mark must fail' '
# no &&
git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err
commit refs/heads/S2
mark :303
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit 3
COMMIT
from :301x
M 100644 :403 hello.c
EOF
ret=$? &&
echo returned $ret &&
test $ret -ne 0 && # failed, but it created the commit
# go create the commit, need it for merge test
git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
commit refs/heads/S2
mark :303
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
commit 3
COMMIT
from :301
M 100644 :403 hello.c
EOF
# now evaluate the error
cat err &&
test_i18ngrep "after mark" err
'
#
# merge
#
test_expect_success 'S: merge with garbage after mark must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
commit refs/heads/S
mark :304
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<COMMIT
merge 4
COMMIT
from :302
merge :303x
M 100644 :403 hello.c
EOF
cat err &&
test_i18ngrep "after mark" err
'
#
# tag, from markref
#
test_expect_success 'S: tag with garbage after mark must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
tag refs/tags/Stag
from :302x
tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
data <<TAG
tag S
TAG
EOF
cat err &&
test_i18ngrep "after mark" err
'
#
# cat-blob markref
#
test_expect_success 'S: cat-blob with garbage after mark must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
cat-blob :403x
EOF
cat err &&
test_i18ngrep "after mark" err
'
#
# ls markref
#
test_expect_success 'S: ls with garbage after mark must fail' '
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
ls :302x hello.c
EOF
cat err &&
test_i18ngrep "space after mark" err
'
test_expect_success 'S: ls with garbage after sha1 must fail' '
sha1=$(grep :302 marks | cut -d\ -f2) &&
test_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&
ls ${sha1}x hello.c
EOF
cat err &&
test_i18ngrep "space after tree-ish" err
'
test_done
| {
"content_hash": "80cf4e1a05dca6a4aecdf148af467f28",
"timestamp": "",
"source": "github",
"line_count": 2932,
"max_line_length": 141,
"avg_line_length": 22.023533424283766,
"alnum_prop": 0.7150821550802967,
"repo_name": "pniebla/test-repo-console",
"id": "ac6f3b6af25c67ae3a2c0748c34f99b4cd0d4b32",
"size": "64622",
"binary": false,
"copies": "15",
"ref": "refs/heads/master",
"path": "svn/git-1.8.3.3.tar/git-1.8.3.3/git-1.8.3.3/t/t9300-fast-import.sh",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "2095"
},
{
"name": "C",
"bytes": "4638094"
},
{
"name": "C++",
"bytes": "225573"
},
{
"name": "CSS",
"bytes": "810198"
},
{
"name": "Emacs Lisp",
"bytes": "86984"
},
{
"name": "Go",
"bytes": "15064"
},
{
"name": "Groff",
"bytes": "26859"
},
{
"name": "HTML",
"bytes": "5436579"
},
{
"name": "JavaScript",
"bytes": "1533072"
},
{
"name": "Makefile",
"bytes": "112078"
},
{
"name": "Objective-C",
"bytes": "504"
},
{
"name": "PHP",
"bytes": "2152692"
},
{
"name": "Perl",
"bytes": "1099544"
},
{
"name": "Python",
"bytes": "297820"
},
{
"name": "Shell",
"bytes": "3606350"
},
{
"name": "Tcl",
"bytes": "751684"
}
],
"symlink_target": ""
} |
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.roots.libraries.ui.impl;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBoxTableRenderer;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.TitlePanel;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.*;
import com.intellij.ui.treeStructure.treetable.TreeColumnInfo;
import com.intellij.util.PlatformIcons;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ComboBoxCellEditor;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.xml.util.XmlStringUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.*;
import java.io.File;
import java.util.*;
import java.util.List;
/**
* This dialog allows selecting paths inside selected archives or directories.
* The tree is three-level:
* <ul>
* <li>The root is a fake node that just holds child nodes.</li>
* <li>The second level is archives or directories selected on the previous selection step.</li>
* <li>The third level are detected roots inside previous selection.</li>
* </ul>
*
* @author max
* @author Constantine.Plotnikov
*/
public class DetectedRootsChooserDialog extends DialogWrapper {
private static final ColumnInfo ROOT_COLUMN = new TreeColumnInfo("");
private static final ColumnInfo<VirtualFileCheckedTreeNode, String> ROOT_TYPE_COLUMN = new ColumnInfo<VirtualFileCheckedTreeNode, String>("") {
@Override
public String valueOf(VirtualFileCheckedTreeNode node) {
final SuggestedChildRootInfo rootInfo = node.getRootInfo();
return rootInfo != null ? rootInfo.getRootTypeName(rootInfo.getSelectedRootType()) : "";
}
@Override
public TableCellRenderer getRenderer(VirtualFileCheckedTreeNode node) {
final SuggestedChildRootInfo rootInfo = node.getRootInfo();
if (rootInfo != null && isCellEditable(node)) {
return new ComboBoxTableRenderer<>(rootInfo.getRootTypeNames());
}
return new DefaultTableCellRenderer();
}
@Override
public TableCellEditor getEditor(VirtualFileCheckedTreeNode o) {
final SuggestedChildRootInfo rootInfo = o.getRootInfo();
if (rootInfo == null) return null;
final ComboBoxCellEditor editor = new ComboBoxCellEditor() {
@Override
protected List<String> getComboBoxItems() {
return Arrays.asList(rootInfo.getRootTypeNames());
}
};
editor.setClickCountToStart(1);
return editor;
}
@Override
public boolean isCellEditable(VirtualFileCheckedTreeNode node) {
final SuggestedChildRootInfo rootInfo = node.getRootInfo();
return rootInfo != null && rootInfo.getDetectedRoot().getTypes().size() > 1;
}
@Override
public void setValue(VirtualFileCheckedTreeNode node, String value) {
final SuggestedChildRootInfo rootInfo = node.getRootInfo();
if (rootInfo != null) {
rootInfo.setSelectedRootType(value);
}
}
};
private CheckboxTreeTable myTreeTable;
private JScrollPane myPane;
private String myDescription;
public DetectedRootsChooserDialog(Component component, Collection<SuggestedChildRootInfo> suggestedRoots) {
super(component, true);
init(suggestedRoots);
}
public DetectedRootsChooserDialog(Project project, Collection<SuggestedChildRootInfo> suggestedRoots) {
super(project, true);
init(suggestedRoots);
}
private void init(Collection<SuggestedChildRootInfo> suggestedRoots) {
myDescription = XmlStringUtil.wrapInHtml(ApplicationNamesInfo.getInstance().getFullProductName() +
" just scanned files and detected the following " + StringUtil.pluralize("root", suggestedRoots.size()) + ".<br>" +
"Select items in the tree below or press Cancel to cancel operation.");
myTreeTable = createTreeTable(suggestedRoots);
myPane = ScrollPaneFactory.createScrollPane(myTreeTable);
setTitle("Detected Roots");
init();
}
private static CheckboxTreeTable createTreeTable(Collection<SuggestedChildRootInfo> suggestedRoots) {
final CheckedTreeNode root = createRoot(suggestedRoots);
CheckboxTreeTable treeTable = new CheckboxTreeTable(root, new CheckboxTree.CheckboxTreeCellRenderer(true) {
@Override
public void customizeRenderer(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
if (!(value instanceof VirtualFileCheckedTreeNode)) return;
VirtualFileCheckedTreeNode node = (VirtualFileCheckedTreeNode)value;
VirtualFile file = node.getFile();
String text;
SimpleTextAttributes attributes;
Icon icon;
boolean isValid = true;
if (leaf) {
VirtualFile ancestor = ((VirtualFileCheckedTreeNode)node.getParent()).getFile();
if (ancestor != null) {
text = VfsUtilCore.getRelativePath(file, ancestor, File.separatorChar);
if (StringUtil.isEmpty(text)) {
text = File.separator;
}
}
else {
text = file.getPresentableUrl();
}
if (text == null) {
isValid = false;
text = file.getPresentableUrl();
}
attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
icon = PlatformIcons.FOLDER_ICON;
}
else {
text = file.getPresentableUrl();
attributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
icon = PlatformIcons.FOLDER_ICON;
}
final ColoredTreeCellRenderer textRenderer = getTextRenderer();
textRenderer.setIcon(icon);
if (!isValid) {
textRenderer.append("[INVALID] ", SimpleTextAttributes.ERROR_ATTRIBUTES);
}
textRenderer.append(text, attributes);
}
}, new ColumnInfo[]{ROOT_COLUMN, ROOT_TYPE_COLUMN});
int max = 0;
for (SuggestedChildRootInfo info : suggestedRoots) {
for (String s : info.getRootTypeNames()) {
max = Math.max(max, treeTable.getFontMetrics(treeTable.getFont()).stringWidth(s));
}
}
final TableColumn column = treeTable.getColumnModel().getColumn(1);
int width = max + 20;//add space for combobox button
column.setPreferredWidth(width);
column.setMaxWidth(width);
treeTable.setRootVisible(false);
new TreeTableSpeedSearch(treeTable, o -> {
Object node = o.getLastPathComponent();
if (!(node instanceof VirtualFileCheckedTreeNode)) return "";
return ((VirtualFileCheckedTreeNode)node).getFile().getPresentableUrl();
});
TreeUtil.expandAll(treeTable.getTree());
return treeTable;
}
private static CheckedTreeNode createRoot(Collection<SuggestedChildRootInfo> suggestedRoots) {
SuggestedChildRootInfo[] sortedRoots = suggestedRoots.toArray(new SuggestedChildRootInfo[0]);
Arrays.sort(sortedRoots,
(o1, o2) -> o1.getDetectedRoot().getFile().getPresentableUrl().compareTo(o2.getDetectedRoot().getFile().getPresentableUrl()));
CheckedTreeNode root = new CheckedTreeNode(null);
Map<VirtualFile, CheckedTreeNode> rootCandidateNodes = new HashMap<>();
for (SuggestedChildRootInfo rootInfo : sortedRoots) {
final VirtualFile rootCandidate = rootInfo.getRootCandidate();
CheckedTreeNode parent = rootCandidateNodes.get(rootCandidate);
if (parent == null) {
parent = new VirtualFileCheckedTreeNode(rootCandidate);
rootCandidateNodes.put(rootCandidate, parent);
root.add(parent);
}
parent.add(new VirtualFileCheckedTreeNode(rootInfo));
}
return root;
}
@Override
protected JComponent createTitlePane() {
return new TitlePanel("Choose Roots", myDescription);
}
@Nullable
@Override
protected JComponent createCenterPanel() {
return myPane;
}
public SuggestedChildRootInfo[] getChosenRoots() {
return myTreeTable.getCheckedNodes(SuggestedChildRootInfo.class);
}
@NonNls
@Override
protected String getDimensionServiceKey() {
return "DetectedRootsChooserDialog";
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
return myTreeTable;
}
private static class VirtualFileCheckedTreeNode extends CheckedTreeNode {
private final VirtualFile myFile;
private VirtualFileCheckedTreeNode(VirtualFile file) {
super(file);
myFile = file;
}
VirtualFileCheckedTreeNode(SuggestedChildRootInfo rootInfo) {
super(rootInfo);
myFile = rootInfo.getDetectedRoot().getFile();
}
public VirtualFile getFile() {
return myFile;
}
@Nullable
private SuggestedChildRootInfo getRootInfo() {
return userObject instanceof SuggestedChildRootInfo ? (SuggestedChildRootInfo)userObject : null;
}
}
}
| {
"content_hash": "b6d3743cad1d37d3b92ea8e93bb329a4",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 145,
"avg_line_length": 37.63779527559055,
"alnum_prop": 0.6962343096234309,
"repo_name": "msebire/intellij-community",
"id": "6ba910128bfb1d74a503d81ec6bd9755214e3499",
"size": "9560",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "platform/lang-impl/src/com/intellij/openapi/roots/libraries/ui/impl/DetectedRootsChooserDialog.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
module PhusionPassenger
class << self
# Set during spawning, and set back to nil when spawning is done.
attr_accessor :_spawn_options
@@event_starting_worker_process = []
@@event_stopping_worker_process = []
@@event_credentials = []
@@event_after_installing_signal_handlers = []
def on_event(name, &block)
callback_list_for_event(name) << block
end
def call_event(name, *args)
callback_list_for_event(name).each do |callback|
callback.call(*args)
end
end
def install_framework_extensions!(*args)
require 'rails/version' if defined?(::Rails) && !defined?(::Rails::VERSION)
if defined?(::Rails) && ::Rails::VERSION::MAJOR == 3
require 'phusion_passenger/rails3_extensions/init'
Rails3Extensions.init!(_spawn_options, *args)
end
end
def benchmark(env = nil, title = "Benchmarking")
log = lookup_analytics_log(env)
if log
log.measure("BENCHMARK: #{title}") do
yield
end
else
yield
end
end
def log_cache_hit(env, name)
log = lookup_analytics_log(env)
if log
log.message("Cache hit: #{name}")
return true
else
return false
end
end
def log_cache_miss(env, name, generation_time = nil)
log = lookup_analytics_log(env)
if log
if generation_time
log.message("Cache miss (#{generation_time.to_i}): #{name}")
else
log.message("Cache miss: #{name}")
end
return true
else
return false
end
end
private
def callback_list_for_event(name)
return case name
when :starting_worker_process
@@event_starting_worker_process
when :stopping_worker_process
@@event_stopping_worker_process
when :credentials
@@event_credentials
when :after_installing_signal_handlers
@@event_after_installing_signal_handlers
else
raise ArgumentError, "Unknown event name '#{name}'"
end
end
def lookup_analytics_log(env)
if env
return env[PASSENGER_ANALYTICS_WEB_LOG]
else
return Thread.current[PASSENGER_ANALYTICS_WEB_LOG]
end
end
end
end # module PhusionPassenger
| {
"content_hash": "fd5fa1d50e13c43c192ce336348513b8",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 22.370786516853933,
"alnum_prop": 0.6931190356604722,
"repo_name": "schubi2/rubygem-passenger",
"id": "75b1123c156e27010c56b0ab23f70665d402213b",
"size": "3208",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "lib/phusion_passenger/public_api.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "524294"
},
{
"name": "C++",
"bytes": "5029495"
},
{
"name": "CSS",
"bytes": "1329"
},
{
"name": "HTML",
"bytes": "56694"
},
{
"name": "JavaScript",
"bytes": "148"
},
{
"name": "Python",
"bytes": "6301"
},
{
"name": "Ruby",
"bytes": "870048"
},
{
"name": "Shell",
"bytes": "216160"
}
],
"symlink_target": ""
} |
<style>
.btn-default {
background-color: #ffffff;
border-color: #f2f2f2;
color: #5d5c5c;
}
.btn-group, .btn-group-vertical {
width: 100%;
}
.btn-check-main {
font-size: 1.1em;
padding: 10px 2px;
width: 12.5%;
}
.btn-check-main2 {
font-size: 1.1em;
padding: 20px 0;
width: 20%;
text-align: center;
}
.btn-check-main3 {
font-size: 1.1em;
padding: 10px 2px;
width: 18%;
}
.btn-check-main50 {
font-size: 1em;
padding: 20px;
text-align: left;
width: 100%;
border-radius: 3px !important;
}
.btn-check-main25 {
font-size: 1.1em;
padding: 10px 2px;
width: 25%;
}
.btn span.glyphicon {
opacity: 0;
}
.btn.active span.glyphicon {
color: #FF9800;
font-size: 24px;
opacity: 1;
position: absolute;
right: 15px;
top: 10px;
}
.btn-default.active, .btn-default:active, .open>.dropdown-toggle.btn-default {
color: #333;
background-color: #f4f4f4;
border-color: #cecece;
}
.btn-poll-checked {
-webkit-box-shadow: 2px 6px 18px -12px rgba(176,176,176,1);
-moz-box-shadow: 2px 6px 18px -12px rgba(176,176,176,1);
box-shadow: 2px 6px 18px -12px rgba(176,176,176,1);
margin-top: 5px;
outline: none;
}
</style>
<!-- Main content -->
<section class="content">
<div class="box box-danger">
<div class="box-header">
<h3 class="box-title">Registrar Encuesta</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<?php echo form_open('consumers/poll/'.$this->uri->segment(3), 'id="form-poll"') ?>
<div class="row">
<div class="col-xs-12">
<label>¿Cuál de los siguientes aspectos es actualmente más importante para mejorar su bienestar?</label>
</div>
</div>
<p></p>
<!-- /.box-header -->
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked" style="margin-top: 0">Salud Física
<input type="checkbox" name="health" id="health" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('health') ?>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Belleza
<input type="checkbox" name="beauty" id="beauty" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('beauty') ?>
</div>
</div>
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked">Cuidado Cuerpo
<input type="checkbox" name="body" id="body" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('body') ?>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Cuidado Facial
<input type="checkbox" name="facial" id="facial" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('facial') ?>
</div>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked">Cuidado Capilar
<input type="checkbox" name="capillary" id="capillary" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('capillary') ?>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Nutrición
<input type="checkbox" name="nutrition" id="nutrition" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('nutrition') ?>
</div>
</div>
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked">Salud Sexual
<input type="checkbox" name="sexuality" id="sexuality" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('sexuality') ?>
<label for="all_aspect" class="btn btn-default btn-check-main50 btn-poll-checked">Todos
<input type="checkbox" name="all_aspect" id="all_aspect" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('all_aspect') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Sufre de alguna de estas enfermedades?</label>
</div>
</div>
<p></p>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked">Diabetes
<input type="checkbox" name="diabetes" id="diabetes" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('diabetes') ?>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Hipoglicemia
<input type="checkbox" name="hypoglycemia" id="hypoglycemia" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('hypoglycemia') ?>
</div>
</div>
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked">Hipertensión
<input type="checkbox" name="hypertension" id="hypertension" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('hypertension') ?>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Colesterol
<input type="checkbox" name="cholesterol" id="cholesterol" autocomplete="off">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('cholesterol') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Cuántas veces come al día?</label>
</div>
</div>
<p></p>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px;">Depende de los días
<input type="radio" name="foods" value="depende" <?php echo set_radio('foods','depende'); ?> id="noteat1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">3 => Desayuno, almuerzo y cena
<input type="radio" name="foods" value="3" <?php echo set_radio('foods','3'); ?> id="noteat2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">5 => 3 Principales y 2 meriendas
<input type="radio" name="foods" value="5" <?php echo set_radio('foods','5'); ?> id="noteat3" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">6 o más comidas
<input type="radio" name="foods" value="6" <?php echo set_radio('foods','6'); ?> id="noteat4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('foods') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">Con respecto a su salud digestiva, ¿Cuántas veces va al baño al día?</label>
</div>
</div>
<p></p>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px;">1 vez al día
<input type="radio" name="defecation" value="1 al dia" <?php echo set_radio('defecation','1 al dia'); ?> id="defecation1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">3 veces al día o más
<input type="radio" name="defecation" value="mas 3 al dia" <?php echo set_radio('defecation','mas 3 al dia'); ?> id="defecation3" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">No todos los días
<input type="radio" name="defecation" value="no todos dias" <?php echo set_radio('defecation','no todos dias'); ?> id="defecation4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Cada 5 días
<input type="radio" name="defecation" value="cada 5 dia" <?php echo set_radio('defecation','cada 5 dia'); ?> id="defecation4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('defecation') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Cada cuánto hace actividad física a la semana?</label>
</div>
</div>
<p></p>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px;">No hace
<input type="radio" name="activity" value="no hace" <?php echo set_radio('activity','No hace'); ?> id="activity1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">1 vez
<input type="radio" name="activity" value="1" <?php echo set_radio('activity','1'); ?> id="activity2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Entre 2 - 3 veces
<input type="radio" name="activity" value="2-3" <?php echo set_radio('activity','2-3'); ?> id="activity3" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Más de 4 veces
<input type="radio" name="activity" value="mas 4" <?php echo set_radio('activity','mas 4'); ?> id="activity4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('activity') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿De 1 a 10 cómo califica su nivel de estrés diario?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main2 btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px;">1
<input type="radio" name="stress" value="1" <?php echo set_radio('stress','1'); ?> id="stress2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">2
<input type="radio" name="stress" value="2" <?php echo set_radio('stress','2'); ?> id="stress3" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">3
<input type="radio" name="stress" value="3" <?php echo set_radio('stress','3'); ?> id="stress4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">4
<input type="radio" name="stress" value="4" <?php echo set_radio('stress','4'); ?> id="stress5" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">5
<input type="radio" name="stress" value="5" <?php echo set_radio('stress','5'); ?> id="stress6" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked" style="margin-left: 0px;">6
<input type="radio" name="stress" value="6" <?php echo set_radio('stress','6'); ?> id="stress7" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">7
<input type="radio" name="stress" value="7" <?php echo set_radio('stress','7'); ?> id="stress8" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">8
<input type="radio" name="stress" value="8" <?php echo set_radio('stress','8'); ?> id="stress8" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">9
<input type="radio" name="stress" value="9" <?php echo set_radio('stress','9'); ?> id="stress8" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">10
<input type="radio" name="stress" value="10" <?php echo set_radio('stress','10'); ?> id="stress8" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('stress') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿En promedio cuantas horas duerme por día?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main2 btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px;">1
<input type="radio" name="sleep" value="1" <?php echo set_radio('sleep','1'); ?> id="sleep2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">2
<input type="radio" name="sleep" value="2" <?php echo set_radio('sleep','2'); ?> id="sleep3" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">3
<input type="radio" name="sleep" value="3" <?php echo set_radio('sleep','3'); ?> id="sleep4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">4
<input type="radio" name="sleep" value="4" <?php echo set_radio('sleep','4'); ?> id="sleep5" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">5
<input type="radio" name="sleep" value="5" <?php echo set_radio('sleep','5'); ?> id="sleep6" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">6
<input type="radio" name="sleep" value="6" <?php echo set_radio('sleep','6'); ?> id="sleep7" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">7
<input type="radio" name="sleep" value="7" <?php echo set_radio('sleep','7'); ?> id="sleep8" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">8
<input type="radio" name="sleep" value="8" <?php echo set_radio('sleep','8'); ?> id="sleep9" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">9
<input type="radio" name="sleep" value="9" <?php echo set_radio('sleep','9'); ?> id="sleep10" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main2 btn-poll-checked">10+
<input type="radio" name="sleep" value="10" <?php echo set_radio('sleep','10'); ?> id="sleep11" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('sleep') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Durante la noche se despierta a menudo, no puede conciliar el sueño, o se levanta cansado?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px; width: 50%">Si
<input type="radio" name="wake" value="si" <?php echo set_radio('wake','si'); ?> id="wake1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main btn-poll-checked" style="width: 50%">No
<input type="radio" name="wake" value="no" <?php echo set_radio('wake','no'); ?> id="wake2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('wake') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Cómo define su deseo sexual?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main50 btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px;">Muy alto
<input type="radio" name="libido" value="muy alto" <?php echo set_radio('libido','muy alto'); ?> id="libido1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Alto
<input type="radio" name="libido" value="alto" <?php echo set_radio('libido','alto'); ?> id="libido2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Medio
<input type="radio" name="libido" value="medio" <?php echo set_radio('libido','medio'); ?> id="libido3" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main50 btn-poll-checked">Bajo
<input type="radio" name="libido" value="bajo" <?php echo set_radio('libido','bajo'); ?> id="libido4" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('libido') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Le gustaría conocer el estado actual de su piel?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px; width: 50%">Si
<input type="radio" name="state_skin" value="si" <?php echo set_radio('state_skin', 'si'); ?> id="state_skin1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main btn-poll-checked" style="width: 50%">No
<input type="radio" name="state_skin" value="no" <?php echo set_radio('state_skin', 'no'); ?> id="state_skin2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('state_skin') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Le gustaría mejorar su sistema inmune?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px; width: 50%">Si
<input type="radio" name="immune" value="si" <?php echo set_radio('immune', 'si'); ?> id="immune1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main btn-poll-checked" style="width: 50%">No
<input type="radio" name="immune" value="no" <?php echo set_radio('immune', 'no'); ?> id="immune2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('immune') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-xs-12">
<label for="disease">¿Le gustaría cambiar sus hábitos alimenticios para mantener un peso adecuado?</label>
</div>
</div>
<div class="row no-padding">
<div class="col-xs-12">
<div class="btn-group add-check" data-toggle="buttons">
<label class="btn btn-default btn-check-main btn-poll-checked" style="border-top-left-radius: 2px; border-bottom-left-radius: 2px; width: 50%">Si
<input type="radio" name="alimentary" value="si" <?php echo set_radio('alimentary', 'si'); ?> id="alimentary1" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<label class="btn btn-default btn-check-main btn-poll-checked" style="width: 50%">No
<input type="radio" name="alimentary" value="no" <?php echo set_radio('alimentary', 'no'); ?> id="alimentary2" autocomplete="off" required="">
<span class="glyphicon glyphicon-ok"></span>
</label>
<?php echo form_error('alimentary') ?>
</div>
</div>
</div>
<p></p>
<div class="row">
<div class="col-sm-12">
<div class="btn-group btn-group-justified">
<div class="btn-group">
<button type="reset" class="btn btn-default">Cancelar</button>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-primary">Enviar</button>
</div>
</div>
</div>
</div>
</div>
<?php echo form_close() ?>
</div>
</section>
<!-- /.content --> | {
"content_hash": "6626458f4633309f8a830899ac2e8de6",
"timestamp": "",
"source": "github",
"line_count": 502,
"max_line_length": 191,
"avg_line_length": 61.310756972111555,
"alnum_prop": 0.47595685229709533,
"repo_name": "Pwex/comunity",
"id": "15c4b1f5d79673e1553ba8404ffaf5a00d38d37c",
"size": "30819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/consumers/poll.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "421886"
},
{
"name": "HTML",
"bytes": "595862"
},
{
"name": "JavaScript",
"bytes": "1940812"
},
{
"name": "PHP",
"bytes": "2907274"
},
{
"name": "Shell",
"bytes": "291"
}
],
"symlink_target": ""
} |
/*global define*/
'use strict';
// Dependecies
define([
'jquery',
'jquery-ui',
'pubsub',
'underscore'
], function(
jQuery,
jQuery_ui,
PubSub,
_
)
{
/* This module is used in order to get the current value/state of an HTML element. */
// Variables //
var $selector = undefined;
var html = undefined;
// Modules References //
var $stringEditor = undefined;
// Contructor //
function getUIValue(argument) {
// Acquire Module References //
if (!(_.isUndefined(argument.stringEditor))) $stringEditor = argument.stringEditor;
else return false;
if (!(_.isUndefined(argument.html))) html = argument.html;
else return false;
};
// Retrieve value using the combination of ID + selector //
function retrieveValue(index,selector){
switch(index){
case 'planeVisibility':{
if (html.pnd.tables.planes.find('#'+selector).find('.planeButton').hasClass('visible')) return true;
else return false;
}
case 'parallel':{
if (html.pnd.tables.planes.find('#'+selector).find('.parallel').hasClass('active')) return true;
else return false;
}
case 'interception':{
if (html.pnd.tables.planes.find('#'+selector).find('.interception').hasClass('active')) return true;
else return false;
}
};
};
// Retrieve value based on the ID only //
function retrieveValueFromID(index){
switch(index){
case 'activeTab':{
if (html.menu.tabs.latticeTab.hasClass('active')) return 'latticeTab';
else if (html.menu.tabs.motifTab.hasClass('active')) return 'motifTab';
else if (html.menu.tabs.visualTab.hasClass('active')) return 'visualTab';
else if (html.menu.tabs.pndTab.hasClass('active')) return 'pndTab';
else if (html.menu.tabs.notesTab.hasClass('active')) return 'notesTab';
else if (html.menu.tabs.publicTab.hasClass('active')) return 'publicTab';
}
case 'tabDisable':{
var result = {};
if (html.menu.tabs.latticeTab.hasClass('disabled')) result.latticeTab = true;
else result.latticeTab = false;
if (html.menu.tabs.motifTab.hasClass('disabled')) result.motifTab = true;
else result.motifTab = false;
if (html.menu.tabs.visualTab.hasClass('disabled')) result.visualTab = true;
else result.visualTab = false;
if (html.menu.tabs.pndTab.hasClass('disabled')) result.pndTab = true;
else result.pndTab = false;
if (html.menu.tabs.notesTab.hasClass('disabled')) result.notesTab = true;
else result.notesTab = false;
if (html.menu.tabs.publicTab.hasClass('disabled')) result.publicTab = true;
else result.publicTab = false;
return result;
}
case 'toggleButtons':{
var result = {};
if (html.menu.toggles.latticePoints.parent().hasClass('lightThemeActive')) result.latticePoints = true;
else result.latticePoints = false;
if (html.menu.toggles.edges.parent().hasClass('lightThemeActive')) result.edges = true;
else result.edges = false;
if (html.menu.toggles.faces.parent().hasClass('lightThemeActive')) result.faces = true;
else result.faces = false;
if (html.menu.toggles.xyzAxes.parent().hasClass('lightThemeActive')) result.xyzAxes = true;
else result.xyzAxes = false;
if (html.menu.toggles.abcAxes.parent().hasClass('lightThemeActive')) result.abcAxes = true;
else result.abcAxes = false;
if (html.menu.toggles.unitCellViewport.parent().hasClass('lightThemeActive')) result.unitCellViewport = true;
else result.unitCellViewport = false;
if (html.menu.toggles.planes.parent().hasClass('lightThemeActive')) result.planes = true;
else result.planes = false;
if (html.menu.toggles.directions.parent().hasClass('lightThemeActive')) result.directions = true;
else result.directions = false;
if (html.menu.toggles.atomRadius.parent().hasClass('lightThemeActive')) result.atomRadius = true;
else result.atomRadius = false;
if (html.menu.toggles.atomToggle.parent().hasClass('lightThemeActive')) result.atomToggle = true;
else result.atomToggle = false;
if (html.menu.toggles.labelToggle.parent().hasClass('lightThemeActive')) result.labelToggle = true;
else result.labelToggle = false;
if (html.menu.toggles.highlightTangency.parent().hasClass('lightThemeActive')) result.highlightTangency = true;
else result.highlightTangency = false;
if (html.menu.toggles.fullScreen.parent().hasClass('lightThemeActive')) result.fullScreen = true;
else result.fullScreen = false;
result.atomRadiusSlider = html.menu.other.atomRadiusSlider.slider('value');
return result;
}
// Motif Tab
case 'tangency':{
if (html.motif.panel.tangency.parent().hasClass('purpleThemeActive')) return true;
else return false;
}
case 'lockCameras':{
if (html.motif.other.lockCameras.hasClass('active')) return true;
else return false;
}
case 'atomOpacity':{
return $stringEditor.inputIsNumber(html.motif.atomParameters.atomOpacity.val());
}
case 'atomColor':{
return html.motif.panel.color.spectrum('get').toHex();
}
case 'atomPosX':{
return $stringEditor.inputIsNumber(html.motif.motifInputs.atomPosX.val());
}
case 'atomPosY':{
return $stringEditor.inputIsNumber(html.motif.motifInputs.atomPosY.val());
}
case 'atomPosZ':{
return $stringEditor.inputIsNumber(html.motif.motifInputs.atomPosZ.val());
}
case 'rotAngleTheta':{
return html.motif.rotatingAngles.rotAngleTheta.val();
}
case 'rotAnglePhi':{
return html.motif.rotatingAngles.rotAnglePhi.val();
}
case 'tangentR':{
return html.motif.panel.tangentR.val();
}
case 'rotAngleX':{
return html.motif.rotatingAngles.x.text();
}
case 'rotAngleY':{
return html.motif.rotatingAngles.y.text();
}
case 'rotAngleZ':{
return html.motif.rotatingAngles.z.text();
}
case 'cellVolume':{
return $stringEditor.inputIsNumber(html.motif.other.cellVolume.val());
}
case 'atomPositioningABC':{
if (html.motif.panel.atomPositioningABC.hasClass('buttonPressed')) return true;
else return false;
}
case 'atomPositioningXYZ':{
if (html.motif.panel.atomPositioningXYZ.hasClass('buttonPressed')) return true;
else return false;
}
case 'atomName':{
return html.motif.other.name.html();
}
case 'motifLabels':{
var result = {};
result.a = html.motif.latticeLabels.scaleX.html();
result.b = html.motif.latticeLabels.scaleY.html();
result.c = html.motif.latticeLabels.scaleZ.html();
result.alpha = html.motif.latticeLabels.alpha.html();
result.beta = html.motif.latticeLabels.beta.html();
result.gamma = html.motif.latticeLabels.gamma.html();
return result;
}
// Lattice Tab
case 'repeatX':{
return $stringEditor.inputIsInteger(html.lattice.parameters.repeatX.val());
}
case 'repeatY':{
return $stringEditor.inputIsInteger(html.lattice.parameters.repeatY.val());
}
case 'repeatZ':{
return $stringEditor.inputIsInteger(html.lattice.parameters.repeatZ.val());
}
case 'scaleX':{
return $stringEditor.inputIsNumber(html.lattice.parameters.scaleX.val());
}
case 'scaleY':{
return $stringEditor.inputIsNumber(html.lattice.parameters.scaleY.val());
}
case 'scaleZ':{
return $stringEditor.inputIsNumber(html.lattice.parameters.scaleZ.val());
}
case 'alpha':{
return $stringEditor.inputIsNumber(html.lattice.parameters.alpha.val());
}
case 'beta':{
return $stringEditor.inputIsNumber(html.lattice.parameters.beta.val());
}
case 'gamma':{
return $stringEditor.inputIsNumber(html.lattice.parameters.gamma.val());
}
case 'selectedLattice':{
return html.lattice.other.selected.html();
}
case 'latticePadlock':{
if (html.lattice.padlocks.lattice.children().hasClass('active')) return true;
else return false;
}
case 'motifPadlock':{
if (html.lattice.padlocks.motif.children().hasClass('active')) return true;
else return false;
}
case 'borderColor':{
return '#'+html.lattice.visual.edgeColorPicker.spectrum('get').toHex();
}
case 'filledColor':{
return '#'+html.lattice.visual.faceColorPicker.spectrum('get').toHex();
}
case 'radius':{
return $stringEditor.inputIsInteger(html.lattice.visual.radius.val());
}
case 'opacity':{
return $stringEditor.inputIsInteger(html.lattice.visual.opacity.val());
}
// PnD Tab
case 'planeColor':{
return '#'+html.pnd.planeParameters.planeColor.spectrum('get').toHex();
}
case 'planeName':{
return html.pnd.planeParameters.planeName.val();
}
case 'planeOpacity':{
return $stringEditor.inputIsNumber(html.pnd.planeParameters.planeOpacity.val());
}
case 'millerH':{
return $stringEditor.inputIsInteger(html.pnd.planeParameters.millerH.val());
}
case 'millerK':{
return $stringEditor.inputIsInteger(html.pnd.planeParameters.millerK.val());
}
case 'millerL':{
return $stringEditor.inputIsInteger(html.pnd.planeParameters.millerL.val());
}
case 'millerI':{
return $stringEditor.inputIsInteger(html.pnd.planeParameters.millerI.val());
}
case 'directionColor':{
return html.pnd.directionParameters.directionColor.spectrum('get').toHex();
}
case 'directionName':{
return html.pnd.directionParameters.directionName.val();
}
case 'dirRadius':{
return $stringEditor.divide10(html.pnd.directionParameters.dirRadius.val()).toString();
}
case 'millerU':{
return $stringEditor.inputIsInteger(html.pnd.directionParameters.millerU.val());
}
case 'millerV':{
return $stringEditor.inputIsInteger(html.pnd.directionParameters.millerV.val());
}
case 'millerW':{
return $stringEditor.inputIsInteger(html.pnd.directionParameters.millerW.val());
}
case 'millerT':{
return $stringEditor.inputIsInteger(html.pnd.directionParameters.millerT.val());
}
// Visual Tab
case 'lod':{
return $stringEditor.inputIsNumber(html.visual.lod.lod.val());
}
case 'autoQuality':{
if (html.visual.parameters.renderizationQuality.autoQuality.hasClass('active')) return true;
else return false;
}
case 'lowQuality':{
if (html.visual.parameters.renderizationQuality.lowQuality.hasClass('active')) return true;
else return false;
}
case 'mediumQuality':{
if (html.visual.parameters.renderizationQuality.mediumQuality.hasClass('active')) return true;
else return false;
}
case 'highQuality':{
if (html.visual.parameters.renderizationQuality.highQuality.hasClass('active')) return true;
else return false;
}
case 'wireframe':{
if (html.visual.parameters.renderizationMode.wireframe.hasClass('active')) return true;
else return false;
}
case 'toon':{
if (html.visual.parameters.renderizationMode.toon.hasClass('active')) return true;
else return false;
}
case 'flat':{
if (html.visual.parameters.renderizationMode.flat.hasClass('active')) return true;
else return false;
}
case 'realistic':{
if (html.visual.parameters.renderizationMode.realistic.hasClass('active')) return true;
else return false;
}
case 'lights':{
if (html.visual.parameters.lights.hasClass('active')) return true;
else return false;
}
case 'ssao':{
if (html.visual.parameters.ssao.hasClass('active')) return true;
else return false;
}
case 'shadows':{
if (html.visual.parameters.shadows.hasClass('active')) return true;
else return false;
}
case 'distortionOn':{
if (html.visual.parameters.distortionOn.hasClass('active')) return true;
else return false;
}
case 'distortionOff':{
if (html.visual.parameters.distortionOff.hasClass('active')) return true;
else return false;
}
case 'anaglyph':{
if (html.visual.parameters.anaglyph.hasClass('active')) return true;
else return false;
}
case 'oculus':{
if (html.visual.parameters.oculus.hasClass('active')) return true;
else return false;
}
case 'sideBySide3D':{
if (html.visual.parameters.sideBySide3D.hasClass('active')) return true;
else return false;
}
case 'onTop3D':{
if (html.visual.parameters.onTop3D.hasClass('active')) return true;
else return false;
}
case 'anaglyphCell':{
if (html.visual.stereoscopicCell.anaglyphCell.hasClass('active')) return true;
else return false;
}
case 'oculusCell':{ return false;
if (html.visual.stereoscopicCell.oculusCell.hasClass('active')) return true;
else return false;
}
case 'sideBySide3DCell':{
if (html.visual.stereoscopicCell.sideBySide3DCell.hasClass('active')) return true;
else return false;
}
case 'onTop3DCell':{
if (html.visual.stereoscopicCell.onTop3DCell.hasClass('active')) return true;
else return false;
}
case 'crystalCamTargetOn':{
if (html.visual.parameters.crystalCamTargetOn.hasClass('active')) return true;
else return false;
}
case 'crystalCamTargetOff':{
if (html.visual.parameters.crystalCamTargetOff.hasClass('active')) return true;
else return false;
}
case 'leapMotion':{
if (html.visual.parameters.leapMotion.hasClass('active')) return true;
else return false;
}
case 'crystalClassic':{
if (html.visual.parameters.crystalMode.crystalClassic.hasClass('active')) return true;
else return false;
}
case 'crystalSubstracted':{
if (html.visual.parameters.crystalMode.crystalSubstracted.hasClass('active')) return true;
else return false;
}
case 'crystalSolidVoid':{
if (html.visual.parameters.crystalMode.crystalSolidVoid.hasClass('active')) return true;
else return false;
}
case 'crystalGradeLimited':{
if (html.visual.parameters.crystalMode.crystalGradeLimited.hasClass('active')) return true;
else return false;
}
case 'cellClassic':{
if (html.visual.parameters.unitCellMode.cellClassic.hasClass('active')) return true;
else return false;
}
case 'cellSubstracted':{
if (html.visual.parameters.unitCellMode.cellSubstracted.hasClass('active')) return true;
else return false;
}
case 'cellSolidVoid':{
if (html.visual.parameters.unitCellMode.cellSolidVoid.hasClass('active')) return true;
else return false;
}
case 'cellGradeLimited':{
if (html.visual.parameters.unitCellMode.cellGradeLimited.hasClass('active')) return true;
else return false;
}
case 'zoom100':{
if (html.visual.tools.zoomOptions.zoom100.hasClass('active')) return true;
else return false;
}
case 'zoom90':{
if (html.visual.tools.zoomOptions.zoom90.hasClass('active')) return true;
else return false;
}
case 'zoom80':{
if (html.visual.tools.zoomOptions.zoom80.hasClass('active')) return true;
else return false;
}
case 'zoom70':{
if (html.visual.tools.zoomOptions.zoom70.hasClass('active')) return true;
else return false;
}
case 'autoZoom':{
if (html.visual.tools.zoomOptions.autoZoom.hasClass('active')) return true;
else return false;
}
case 'fog':{
if (html.visual.fog.checkbox.hasClass('active')) return true;
else return false;
}
case 'fogColor':{
return '#'+html.visual.fog.color.spectrum('get').toHex();
}
case 'fogDensity':{
return html.visual.fog.density.val();
}
case 'sounds':{
if (html.visual.sound.sounds.hasClass('active')) return true;
else return false;
}
case 'soundVolume':{
return html.visual.sound.soundSlider.slider('value');
}
case 'crystalScreenColor':{
return '#'+html.visual.tools.colorPickers.crystalScreen.spectrum('get').toHex();
}
case 'cellScreenColor':{
return '#'+html.visual.tools.colorPickers.cellScreen.spectrum('get').toHex();
}
case 'motifXScreenColor':{
return '#'+html.visual.tools.colorPickers.motifXScreen.spectrum('get').toHex();
}
case 'motifYScreenColor':{
return '#'+html.visual.tools.colorPickers.motifYScreen.spectrum('get').toHex();
}
case 'motifZScreenColor':{
return '#'+html.visual.tools.colorPickers.motifZScreen.spectrum('get').toHex();
}
// Library //
case 'frameIT':{
if (html.library.png.frameIT.hasClass('active')) return true;
else return false;
}
case 'qrCode':{
if (html.library.png.qrCode.hasClass('active')) return true;
else return false;
}
case 'printMode':{
if (html.library.png.printMode.hasClass('active')) return true;
else return false;
}
};
};
// Determine whether an element is accessible by the app user (enabled/disabled) //
function retrieveAccessibility(index){
switch(index){
case 'latticePadlockDisable':{
if (html.lattice.padlocks.lattice.hasClass('disabled')) return true;
else return false;
}
case 'motifPadlockDisable':{
if (html.lattice.padlocks.motif.hasClass('disabled')) return true;
else return false;
}
case 'selectedLattice':{
if (html.lattice.other.selected.hasClass('disabled')) return true;
else return false;
}
};
};
// Module Interface //
/* This functions collects all values/states of every HTML element. Returns the following object:
{
activeTab: value,
tabDisable: value,
...
}
*/
getUIValue.prototype.getAppState = function(){
var app = {};
// Retrieve Menu Ribbon Values //
app.activeTab = retrieveValueFromID('activeTab');
app.tabDisable = retrieveValueFromID('tabDisable');
app.toggleButtons = retrieveValueFromID('toggleButtons');
// Retrieve Lattice Tab Values //
app.selectedLattice = retrieveValueFromID('selectedLattice');
app.selectedLatticeDisable = retrieveAccessibility('selectedLattice');
app.latticePadlockDisable = retrieveAccessibility('latticePadlockDisable');
app.latticePadlock = retrieveValueFromID('latticePadlock');
app.repeatX = retrieveValueFromID('repeatX');
app.repeatY = retrieveValueFromID('repeatY');
app.repeatZ = retrieveValueFromID('repeatZ');
app.motifPadlockDisable = retrieveAccessibility('motifPadlockDisable');
app.motifPadlock = retrieveValueFromID('motifPadlock');
app.scaleX = retrieveValueFromID('scaleX');
app.scaleY = retrieveValueFromID('scaleY');
app.scaleZ = retrieveValueFromID('scaleZ');
app.alpha = retrieveValueFromID('alpha');
app.beta = retrieveValueFromID('beta');
app.gamma = retrieveValueFromID('gamma');
app.borderColor = retrieveValueFromID('borderColor');
app.filledColor = retrieveValueFromID('filledColor');
app.radius = retrieveValueFromID('radius');
app.opacity = retrieveValueFromID('opacity');
// Retrieve Motif Tab Values //
app.tangency = retrieveValueFromID('tangency');
app.cellVolume = retrieveValueFromID('cellVolume');
app.motifLabels = retrieveValueFromID('motifLabels');
app.lockCameras = retrieveValueFromID('lockCameras');
// Retrieve Visual Tab Values //
app.lod = retrieveValueFromID('lod');
app.autoQuality = retrieveValueFromID('autoQuality');
app.lowQuality = retrieveValueFromID('lowQuality');
app.mediumQuality = retrieveValueFromID('mediumQuality');
app.highQuality = retrieveValueFromID('highQuality');
app.wireframe = retrieveValueFromID('wireframe');
app.toon = retrieveValueFromID('toon');
app.flat = retrieveValueFromID('flat');
app.realistic = retrieveValueFromID('realistic');
app.lights = retrieveValueFromID('lights');
app.ssao = retrieveValueFromID('ssao');
app.shadows = retrieveValueFromID('shadows');
app.distortionOn = retrieveValueFromID('distortionOn');
app.distortionOff = retrieveValueFromID('distortionOff');
app.anaglyph = retrieveValueFromID('anaglyph');
app.oculus = retrieveValueFromID('oculus');
app.sideBySide3D = retrieveValueFromID('sideBySide3D');
app.onTop3D = retrieveValueFromID('onTop3D');
app.anaglyphCell = retrieveValueFromID('anaglyphCell');
app.oculusCell = retrieveValueFromID('oculusCell');
app.sideBySide3DCell = retrieveValueFromID('sideBySide3DCell');
app.onTop3DCell = retrieveValueFromID('onTop3DCell');
app.crystalCamTargetOn = retrieveValueFromID('crystalCamTargetOn');
app.crystalCamTargetOff = retrieveValueFromID('crystalCamTargetOff');
app.leapMotion = retrieveValueFromID('leapMotion');
app.crystalClassic = retrieveValueFromID('crystalClassic');
app.crystalSubstracted = retrieveValueFromID('crystalSubstracted');
app.crystalSolidVoid = retrieveValueFromID('crystalSolidVoid');
app.crystalGradeLimited = retrieveValueFromID('crystalGradeLimited');
app.cellClassic = retrieveValueFromID('cellClassic');
app.cellSubstracted = retrieveValueFromID('cellSubstracted');
app.cellSolidVoid = retrieveValueFromID('cellSolidVoid');
app.cellGradeLimited = retrieveValueFromID('cellGradeLimited');
app.autoZoom = retrieveValueFromID('autoZoom');
app.zoom100 = retrieveValueFromID('zoom100');
app.zoom90 = retrieveValueFromID('zoom90');
app.zoom80 = retrieveValueFromID('zoom80');
app.zoom70 = retrieveValueFromID('zoom70');
app.fog = retrieveValueFromID('fog');
app.fogColor = retrieveValueFromID('fogColor');
app.fogDensity = retrieveValueFromID('fogDensity');
app.sounds = retrieveValueFromID('sounds');
app.soundVolume = retrieveValueFromID('soundVolume');
app.crystalScreenColor = retrieveValueFromID('crystalScreenColor');
app.cellScreenColor = retrieveValueFromID('cellScreenColor');
app.motifXScreenColor = retrieveValueFromID('motifXScreenColor');
app.motifYScreenColor = retrieveValueFromID('motifYScreenColor');
app.motifZScreenColor = retrieveValueFromID('motifZScreenColor');
// Retrieve PNG options //
app.frameIT = retrieveValueFromID('frameIT');
app.qrCode = retrieveValueFromID('qrCode');
app.printMode = retrieveValueFromID('printMode');
return app;
};
/* This functions is called by passing multiple objects, like:
{
element#1: {
id: elementID,
selector: HTML Selector [This is optional]
},
element#2: {
...
}
}
and returns the following object:
{
element#1: value,
element#2: value,
...
}
*/
getUIValue.prototype.getValue = function(argument){
var returnObject = {};
if (Object.keys(argument).length <= 0) return false;
else {
_.each(argument,function($parameter, k){
// Retrieve value
if (!(_.isUndefined($parameter.selector))) returnObject[k] = retrieveValue($parameter.id,$parameter.selector);
else returnObject[k] = retrieveValueFromID($parameter.id);
});
}
return returnObject;
};
return getUIValue;
}); | {
"content_hash": "1b883a9ab865ec579375eeb918e3bec9",
"timestamp": "",
"source": "github",
"line_count": 628,
"max_line_length": 127,
"avg_line_length": 44.68471337579618,
"alnum_prop": 0.5622193713919179,
"repo_name": "gvcm/CWAPP",
"id": "9b9c0202f9ba78d857473050720353b4b6730182",
"size": "28062",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "scripts/menu_modules/getUIValue.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "404"
},
{
"name": "CSS",
"bytes": "193390"
},
{
"name": "HTML",
"bytes": "187811"
},
{
"name": "JavaScript",
"bytes": "1544461"
},
{
"name": "Ruby",
"bytes": "338"
}
],
"symlink_target": ""
} |
@interface NUILabelRendererTests : XCTestCase
@property (strong, nonatomic) UILabel *sut;
@end
@implementation NUILabelRendererTests
- (void)setUp
{
[super setUp];
[NUISettings initWithStylesheet:@"TestTheme.NUI"];
_sut = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 12, 12)];
_sut.text = @"label";
// Shouldn't need to set this. Relates to issue #260
_sut.nuiClass = @"Label";
[_sut applyNUI];
}
- (void)tearDown
{
self.sut = nil;
[super tearDown];
}
// background-color (Color)
- (void)testSetBackgroundColor
{
XCTAssertEqualObjects(_sut.backgroundColor, [UIColor redColor], @"NUI should set label background color");
}
// border-color (Color)
- (void)testSetBorderColor
{
UIColor *borderColor = [UIColor colorWithCGColor:_sut.layer.borderColor];
XCTAssertEqualObjects(borderColor, [UIColor greenColor], @"NUI should set label border color");
}
// border-width (Number)
- (void)testSetBorderWidth
{
XCTAssertEqualObjects(@(_sut.layer.borderWidth), @2, @"NUI should set label border width");
}
// corner-radius (Number)
- (void)testSetCornerRadius
{
XCTAssertEqualObjects(@(_sut.layer.cornerRadius), @2, @"NUI should set label border width");
}
// font-color (Color)
- (void)testSetFontColor
{
XCTAssertEqualObjects(_sut.textColor, [UIColor blueColor], @"NUI should set label font color");
}
// font-color-highlighted (Color)
- (void)testSetFontColorHighlighted
{
XCTAssertEqualObjects(_sut.highlightedTextColor, [UIColor yellowColor], @"NUI should set label font color when highlighted");
}
// font-name (FontName)
- (void)testSetFontName
{
XCTAssertEqualObjects(_sut.font.familyName, @"Avenir", @"NUI should set label font name");
}
// font-size (Number)
- (void)testSetFontSize
{
XCTAssertEqual(_sut.font.pointSize, 15, @"NUI should set label font size");
}
// height (Number)
- (void)testSetHeight
{
XCTAssertEqual(CGRectGetHeight(_sut.frame), 50, @"NUI should set label height");
}
// shadow-color (Color)
- (void)testSetShadowColor
{
UIColor *shadowColor = [UIColor colorWithCGColor:_sut.layer.shadowColor];
XCTAssertEqualObjects(shadowColor, [UIColor blackColor], @"NUI should set label shadow color");
}
// shadow-offset (Offset)
- (void)testSetShadowOffset
{
CGSize offset = CGSizeMake(1, 2);
XCTAssertTrue(CGSizeEqualToSize(_sut.layer.shadowOffset, offset), @"NUI should set label shadow offset");
}
// shadow-opacity (Number)
- (void)testSetShadowOpacity
{
XCTAssertEqualWithAccuracy(_sut.layer.shadowOpacity, 0.5, 0.0001, @"NUI should set label shadow opacity");
}
// shadow-radius (Number)
- (void)testSetShadowRadius
{
XCTAssertEqualWithAccuracy(_sut.layer.shadowRadius, 2.0, 0.0001, @"NUI should set label shadow radius");
}
// text-align (TextAlign)
- (void)testSetTextAlign
{
XCTAssertEqual(_sut.textAlignment, NSTextAlignmentCenter, @"NUI should set label text align");
}
// text-alpha (Number)
- (void)testSetTextAlpha
{
XCTAssertEqualWithAccuracy(_sut.alpha, 0.9, 0.0001, @"NUI should set label alpha");
}
// text-auto-fit (Boolean)
- (void)testSetTextAutoFit
{
XCTAssertTrue(_sut.adjustsFontSizeToFitWidth, @"NUI should set label text auto fit");
}
// text-shadow-color (Color)
- (void)testTextShadowColor
{
XCTAssertEqualObjects(_sut.shadowColor, [UIColor blackColor], @"NUI should set label text shadow color");
}
// text-shadow-offset (Offset)
- (void)testTextShadowOffset
{
CGSize offset = CGSizeMake(1, 2);
XCTAssertTrue(CGSizeEqualToSize(_sut.shadowOffset, offset), @"NUI should set label text shadow offset");
}
// text-transform (TextTransform)
- (void)testTextTransform
{
XCTAssertEqualObjects(_sut.text, @"LABEL", @"NUI should set label text transform");
}
// width (Number)
- (void)testSetWidth
{
XCTAssertEqual(CGRectGetWidth(_sut.frame), 100, @"NUI should set label width");
}
@end
| {
"content_hash": "11f5e4190dee6d72f7d0a6b3c73d180f",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 129,
"avg_line_length": 25.63157894736842,
"alnum_prop": 0.714835728952772,
"repo_name": "tutoru/nui",
"id": "9da185d5481c65b56a941bf5d4775217df5a705c",
"size": "4100",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "Demo/NUITests/UIKitTests/UILabel/NUILabelRendererTests.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1123"
},
{
"name": "Objective-C",
"bytes": "611465"
},
{
"name": "Ruby",
"bytes": "1079"
},
{
"name": "Shell",
"bytes": "8894"
}
],
"symlink_target": ""
} |
ARG IMAGE_TYPE
ARG PY_VERSION
# Currenly all of our dev images are GPU capable but at a cost of being quite large.
# See https://github.com/tensorflow/build/pull/47
FROM tensorflow/build:latest-python$PY_VERSION as dev_container
ARG TF_PACKAGE
ARG TF_VERSION
ARG PY_VERSION
RUN pip uninstall $TF_PACKAGE -y
RUN pip install --default-timeout=1000 $TF_PACKAGE==$TF_VERSION
RUN rm -rf /usr/lib/python3
RUN rm -rf /usr/lib/python
RUN ln -sf /usr/lib/python$PY_VERSION /usr/lib/python
RUN ln -sf /usr/lib/python$PY_VERSION /usr/lib/python3
RUN python -m pip install --upgrade pip
COPY tools/install_deps /install_deps
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /install_deps/yapf.txt \
-r /install_deps/pytest.txt \
-r /install_deps/typedapi.txt \
-r /tmp/requirements.txt
RUN pip install setuptools
RUN bash /install_deps/buildifier.sh
RUN bash /install_deps/clang-format.sh
COPY tools/docker/install/install_bazel.sh /install/
RUN /install/install_bazel.sh "5.1.1"
ENV ADDONS_DEV_CONTAINER="1"
RUN apt-get update && apt-get install -y \
openssh-client \
cmake
RUN apt-get update && apt-get remove -y python3-apt \
&& apt-get install -y python3-apt
COPY tools/docker/install/install_openmpi.sh /install/
RUN /install/install_openmpi.sh "4.1.1"
COPY tools/docker/install/install_nccl.sh /install/
RUN /install/install_nccl.sh "2.8.4-1+cuda11.2"
COPY tools/docker/install/install_horovod.sh /install/
RUN /install/install_horovod.sh "0.23.0"
# write default env for user
RUN echo "export TF_VERSION=$TF_VERSION" >> ~/.bashrc
RUN echo "export PY_VERSION=$PY_VERSION" >> ~/.bashrc
RUN echo "export TF_NEED_CUDA=1" >> ~/.bashrc
RUN echo "export TF_CUDA_VERSION=11.2" >> ~/.bashrc
RUN echo "export TF_CUDNN_VERSION=8.1" >> ~/.bashrc
RUN echo "export CUDA_TOOLKIT_PATH='/usr/local/cuda'" >> ~/.bashrc
RUN echo "export CUDNN_INSTALL_PATH='/usr/lib/x86_64-linux-gnu'" >> ~/.bashrc
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* | {
"content_hash": "0835712984515330372f20301e3212fd",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 84,
"avg_line_length": 30.803030303030305,
"alnum_prop": 0.721593703885883,
"repo_name": "tensorflow/recommenders-addons",
"id": "9da63d453d9178eb5c51569297af9828dde55059",
"size": "2078",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/docker/dev_container.Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "168930"
},
{
"name": "C++",
"bytes": "650354"
},
{
"name": "Cuda",
"bytes": "2042749"
},
{
"name": "Dockerfile",
"bytes": "21751"
},
{
"name": "Python",
"bytes": "824960"
},
{
"name": "Shell",
"bytes": "45743"
},
{
"name": "Smarty",
"bytes": "99765"
},
{
"name": "Starlark",
"bytes": "80175"
}
],
"symlink_target": ""
} |
var testRoundNumber = 0;
// The test pattern cycles as a color fill of red, then green, then blue.
var colors = [ [ 255, 0, 0 ], [ 0, 255, 0 ], [ 0, 0, 255 ] ];
var curIdx = 0;
// Capture parameters.
var width = 64;
var height = 48;
var frameRate = 15;
// The stream to playback in the video element.
var receiveStream = null;
// waitForExpectedColors() removes elements from this array as each is observed.
// When it becomes empty, the test succeeds.
var expectedColors = [ [ 255, 0, 0 ], [ 0, 255, 0 ], [ 0, 0, 255 ] ];
function updateTestPattern() {
if (!this.canvas) {
this.canvas = document.createElement("canvas");
this.canvas.width = 320;
this.canvas.height = 200;
this.canvas.style.position = "absolute";
this.canvas.style.top = "0px";
this.canvas.style.left = "0px";
this.canvas.style.width = "100%";
this.canvas.style.height = "100%";
document.body.appendChild(this.canvas);
}
var context = this.canvas.getContext("2d");
// Fill with solid color.
context.fillStyle = "rgb(" + colors[curIdx] + ")";
context.fillRect(0, 0, this.canvas.width, this.canvas.height);
// Draw the circle that moves around the page.
context.fillStyle = "rgb(" + colors[(curIdx + 1) % colors.length] + ")";
context.beginPath();
if (!this.frameNumber) {
this.frameNumber = 1;
} else {
++this.frameNumber;
}
var i = this.frameNumber % 200;
var t = (this.frameNumber + 3000) * (0.01 + i / 8000.0);
var x = (Math.sin(t) * 0.45 + 0.5) * this.canvas.width;
var y = (Math.cos(t * 0.9) * 0.45 + 0.5) * this.canvas.height;
context.arc(x, y, 16, 0, 2 * Math.PI, false);
context.closePath();
context.fill();
}
function renderTestPatternLoop() {
requestAnimationFrame(renderTestPatternLoop);
updateTestPattern();
if (!this.stepTimeMillis) {
this.stepTimeMillis = 100;
}
var now = new Date().getTime();
if (!this.nextSteppingAt) {
this.nextSteppingAt = now + this.stepTimeMillis;
} else if (now >= this.nextSteppingAt) {
++curIdx;
if (curIdx >= colors.length) { // Completed a cycle.
curIdx = 0;
// Increase the wait time between switching test patterns for overloaded
// bots that aren't capturing all the frames of video. Only do this for
// the first test phase, since increases shouldn't be needed after that.
if (testRoundNumber == 0) {
this.stepTimeMillis *= 1.25;
}
}
this.nextSteppingAt = now + this.stepTimeMillis;
}
}
function waitForExpectedColors(colorDeviation) {
// At the start of a round of testing, create the video and canvas elements,
// but no need to append them to the DOM.
if (!this.video) {
this.video = document.createElement("video");
this.video.width = width;
this.video.height = height;
this.video.addEventListener("error", chrome.test.fail);
this.video.srcObject = receiveStream;
this.video.play();
this.readbackCanvas = document.createElement("canvas");
this.readbackCanvas.width = width;
this.readbackCanvas.height = height;
}
// Only bother examining a video frame if the video timestamp has advanced.
var currentVideoTimestamp = this.video.currentTime;
if (!this.lastVideoTimestamp ||
this.lastVideoTimestamp < currentVideoTimestamp) {
this.lastVideoTimestamp = currentVideoTimestamp;
// Grab a snapshot of the center pixel of the video.
var ctx = this.readbackCanvas.getContext("2d");
ctx.drawImage(video, 0, 0, width, height);
var imageData = ctx.getImageData(width / 2, height / 2, 1, 1);
var pixel = [ imageData.data[0], imageData.data[1], imageData.data[2] ];
// Does the pixel match one of the expected colors?
for (var i = 0; i < expectedColors.length; ++i) {
var curColor = expectedColors[i];
if (Math.abs(pixel[0] - curColor[0]) <= colorDeviation &&
Math.abs(pixel[1] - curColor[1]) <= colorDeviation &&
Math.abs(pixel[2] - curColor[2]) <= colorDeviation) {
console.debug(`${testRoundNumber == 0 ? 'First' : 'Second'} round: ` +
`Observed expected color RGB(${curColor}) in the video as ` +
`RGB(${pixel})`);
expectedColors.splice(i, 1);
}
}
}
if (expectedColors.length == 0) {
// Successful end of the current test round. If the first round, sleep, then
// execute the second round. If the second round, then the whole test has
// succeeded.
if (testRoundNumber == 0) {
// Destroy the video, which will disconnect the consumer of the
// MediaStream.
this.video.removeEventListener("error", chrome.test.fail);
this.video.srcObject = null;
this.video = null;
// Wait one second, then execute the second round of testing. This tests
// the suspend/resume functionality of tab capture (w.r.t. a MediaStream
// having no consumers, and then being re-used with a new consumer).
console.debug('First round succeeded! Now testing suspend/resume...');
setTimeout(function() {
++testRoundNumber;
for (const color of colors) {
expectedColors.push(color);
}
waitForExpectedColors(colorDeviation);
}, 1000);
} else {
chrome.test.succeed();
}
} else {
setTimeout(function () { waitForExpectedColors(colorDeviation); },
1000 / frameRate);
}
}
chrome.test.runTests([
function endToEndTest() {
// The receive port changes between browser_test invocations, and is passed
// as an query parameter in the URL.
var transportMethod; // Should be: local or webrtc.
var colorDeviation; // How far from the expected intensity ([0,255] scale)?
try {
transportMethod = window.location.search.match(/(\?|&)method=(\w+)/)[2];
chrome.test.assertTrue(transportMethod == 'local' ||
transportMethod == 'webrtc');
colorDeviation = parseInt(
window.location.search.match(/(\?|&)colorDeviation=(\d+)/)[2]);
chrome.test.assertTrue(colorDeviation >= 0 && colorDeviation <= 255);
} catch (err) {
chrome.test.fail("Error parsing query params -- " + err.message);
return;
}
// Start rendering test patterns.
renderTestPatternLoop();
chrome.tabCapture.capture(
{ video: true,
audio: true,
videoConstraints: {
mandatory: {
minWidth: width,
minHeight: height,
maxWidth: width,
maxHeight: height,
maxFrameRate: frameRate,
}
}
},
function remoteTheStream(captureStream) {
chrome.test.assertTrue(!!captureStream);
if (transportMethod == 'local') {
receiveStream = captureStream;
waitForExpectedColors(colorDeviation);
} else if (transportMethod == 'webrtc') {
var sender = new RTCPeerConnection();
var receiver = new RTCPeerConnection();
sender.onicecandidate = function (event) {
if (event.candidate) {
receiver.addIceCandidate(new RTCIceCandidate(event.candidate));
}
};
receiver.onicecandidate = function (event) {
if (event.candidate) {
sender.addIceCandidate(new RTCIceCandidate(event.candidate));
}
};
receiver.onaddstream = function (event) {
receiveStream = event.stream;
waitForExpectedColors(colorDeviation);
};
sender.addStream(captureStream);
sender.createOffer(function (sender_description) {
sender.setLocalDescription(sender_description);
receiver.setRemoteDescription(sender_description);
receiver.createAnswer(function (receiver_description) {
receiver.setLocalDescription(receiver_description);
sender.setRemoteDescription(receiver_description);
}, function (error) {
});
}, function (error) {
});
} else {
chrome.test.fail("Unknown transport method: " + transportMethod);
}
});
}
]);
// TODO(miu): Once the WebAudio API is finalized, we should add a test to emit a
// tone from the sender page, and have the receiver page check for the audio
// tone.
| {
"content_hash": "e6be49e01411f8a5d2147f4871805157",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 80,
"avg_line_length": 37.0929203539823,
"alnum_prop": 0.6200644160801623,
"repo_name": "ric2b/Vivaldi-browser",
"id": "283796670d362fcb28f78b28312637a74ec06c6f",
"size": "9522",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chromium/chrome/test/data/extensions/api_test/tab_capture/end_to_end/end_to_end.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
import {Request, Response} from 'express';
import * as _ from 'lodash';
import {onError} from '../../api/responses/errorHandler';
import {onSuccess} from '../../api/responses/successHandler';
import {dbErrorHandler} from '../../config/dbErrorHandler';
import {User} from './service';
export default class UserController {
public UserService;
constructor() {
this.UserService = new User();
}
getAll(req: Request, res: Response) {
this.UserService.getAll()
.then(_.partial(onSuccess, res))
.catch(_.partial(onError, res, 'Find all users failed'));
}
createUser(req: Request, res: Response) {
this.UserService.create(req.body)
.then(_.partial(onSuccess, res))
.catch(_.partial(dbErrorHandler, res))
.catch(_.partial(onError, res, `Could not create user`));
}
getById(req: Request, res: Response) {
const userId = parseInt(req.params.id);
this.UserService.getById(userId)
.then(_.partial(onSuccess, res))
.catch(_.partial(onError, res, 'Not found'));
}
updateUser(req: Request, res: Response){
const userId = parseInt(req.params.id);
const props = req.body;
this.UserService.update(userId, props)
.then(_.partial(onSuccess, res))
.catch(_.partial(onError, res, 'Update User failed'));
}
deleteUser(req: Request, res: Response){
const userId = req.params.id;
this.UserService.delete(userId)
.then(_.partial(onSuccess, res))
.catch(_.partial(onError, res, 'An error ocurred to delete an User'));
}
}
| {
"content_hash": "4630d2f9e89265507de064c4e1330039",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 76,
"avg_line_length": 30.68,
"alnum_prop": 0.6571056062581486,
"repo_name": "raphaellima8/typescript-api",
"id": "b4edb9772fd2001a2a446e033404b22b87426356",
"size": "1534",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/modules/User/controller.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "43432"
},
{
"name": "TypeScript",
"bytes": "18425"
}
],
"symlink_target": ""
} |
FactoryGirl.define do
factory :user do
email Faker::Internet.email
user Faker::Internet.user_name
phone Faker::PhoneNumber.phone_number
first_name Faker::Name.first_name
last_name Faker::Name.first_name
groups "#{Faker::Company.name},#{Faker::Company.name},#{Faker::Company.name}"
role User.roles[:user]
association :agency, factory: :agency
end
factory :super_user, parent: :user do
role User.roles[:super_user]
end
factory :admin_user, parent: :user do
role User.roles[:admin]
end
factory :banned_user, parent: :user do
role User.roles[:banned]
end
end
| {
"content_hash": "ab472eb8e55b1ec1edc999b775ae977d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 81,
"avg_line_length": 25.791666666666668,
"alnum_prop": 0.6865912762520194,
"repo_name": "GSA/social-media-registry",
"id": "b375995ac36f86112828dc0f77e2d8e5fb8bda09",
"size": "1859",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/factories/users.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "393419"
},
{
"name": "HTML",
"bytes": "319711"
},
{
"name": "JavaScript",
"bytes": "208050"
},
{
"name": "Ruby",
"bytes": "384002"
},
{
"name": "SCSS",
"bytes": "648096"
},
{
"name": "Shell",
"bytes": "6179"
}
],
"symlink_target": ""
} |
module GoodData
module Environment
module ConnectionHelper
set_const :DEFAULT_SERVER, 'https://staging2.getgooddata.com'
set_const :DEFAULT_USER_URL, '/gdc/account/profile/d8b356b30c0c12d1b4b97f56d6706ef2'
end
module ProjectHelper
set_const :PROJECT_ID, 'i640il7dyatqmvak24zzr09ypt3ghqu2'
set_const :PROJECT_URL, "/gdc/projects/#{PROJECT_ID}"
set_const :PROJECT_TITLE, 'GoodTravis'
set_const :PROJECT_SUMMARY, 'No summary'
end
end
end
| {
"content_hash": "93aeaf94519f3b59724aed5f93102ead",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 90,
"avg_line_length": 32.8,
"alnum_prop": 0.7134146341463414,
"repo_name": "mankerious/lcmdemo",
"id": "cc1f292ebada01a8c2311e174dfb18e21b346f16",
"size": "712",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "scripts/1.0.0/basic/load/vendor/gooddata-ruby/spec/environment/release.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2997"
},
{
"name": "HTML",
"bytes": "9390"
},
{
"name": "Ruby",
"bytes": "46243"
}
],
"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_151) on Thu Feb 08 09:04:03 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.wildfly.swarm.config.management (BOM: * : All 2018.2.0 API)</title>
<meta name="date" content="2018-02-08">
<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="org.wildfly.swarm.config.management (BOM: * : All 2018.2.0 API)";
}
}
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 class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.2.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/wildfly/swarm/config/mail/mail_session/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../org/wildfly/swarm/config/management/access/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/config/management/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.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">
<h1 title="Package" class="title">Package org.wildfly.swarm.config.management</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuditAccessConsumer.html" title="interface in org.wildfly.swarm.config.management">AuditAccessConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/AuditAccess.html" title="class in org.wildfly.swarm.config.management">AuditAccess</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuditAccessSupplier.html" title="interface in org.wildfly.swarm.config.management">AuditAccessSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/AuditAccess.html" title="class in org.wildfly.swarm.config.management">AuditAccess</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccessConsumer.html" title="interface in org.wildfly.swarm.config.management">AuthorizationAccessConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.html" title="class in org.wildfly.swarm.config.management">AuthorizationAccess</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccessSupplier.html" title="interface in org.wildfly.swarm.config.management">AuthorizationAccessSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.html" title="class in org.wildfly.swarm.config.management">AuthorizationAccess</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ConfigurationChangesServiceConsumer.html" title="interface in org.wildfly.swarm.config.management">ConfigurationChangesServiceConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/ConfigurationChangesService.html" title="class in org.wildfly.swarm.config.management">ConfigurationChangesService</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ConfigurationChangesServiceSupplier.html" title="interface in org.wildfly.swarm.config.management">ConfigurationChangesServiceSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/ConfigurationChangesService.html" title="class in org.wildfly.swarm.config.management">ConfigurationChangesService</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/HTTPInterfaceManagementInterfaceConsumer.html" title="interface in org.wildfly.swarm.config.management">HTTPInterfaceManagementInterfaceConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/HTTPInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">HTTPInterfaceManagementInterface</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/HTTPInterfaceManagementInterfaceSupplier.html" title="interface in org.wildfly.swarm.config.management">HTTPInterfaceManagementInterfaceSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/HTTPInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">HTTPInterfaceManagementInterface</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/IdentityAccessConsumer.html" title="interface in org.wildfly.swarm.config.management">IdentityAccessConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/IdentityAccess.html" title="class in org.wildfly.swarm.config.management">IdentityAccess</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/IdentityAccessSupplier.html" title="interface in org.wildfly.swarm.config.management">IdentityAccessSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/IdentityAccess.html" title="class in org.wildfly.swarm.config.management">IdentityAccess</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/LdapConnectionConsumer.html" title="interface in org.wildfly.swarm.config.management">LdapConnectionConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/LdapConnection.html" title="class in org.wildfly.swarm.config.management">LdapConnection</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/LdapConnectionSupplier.html" title="interface in org.wildfly.swarm.config.management">LdapConnectionSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/LdapConnection.html" title="class in org.wildfly.swarm.config.management">LdapConnection</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsServiceConsumer.html" title="interface in org.wildfly.swarm.config.management">ManagementOperationsServiceConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsService.html" title="class in org.wildfly.swarm.config.management">ManagementOperationsService</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsServiceSupplier.html" title="interface in org.wildfly.swarm.config.management">ManagementOperationsServiceSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsService.html" title="class in org.wildfly.swarm.config.management">ManagementOperationsService</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/NativeInterfaceManagementInterfaceConsumer.html" title="interface in org.wildfly.swarm.config.management">NativeInterfaceManagementInterfaceConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/NativeInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeInterfaceManagementInterface</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/NativeInterfaceManagementInterfaceSupplier.html" title="interface in org.wildfly.swarm.config.management">NativeInterfaceManagementInterfaceSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/NativeInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeInterfaceManagementInterface</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/NativeRemotingInterfaceManagementInterfaceConsumer.html" title="interface in org.wildfly.swarm.config.management">NativeRemotingInterfaceManagementInterfaceConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/NativeRemotingInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeRemotingInterfaceManagementInterface</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/NativeRemotingInterfaceManagementInterfaceSupplier.html" title="interface in org.wildfly.swarm.config.management">NativeRemotingInterfaceManagementInterfaceSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/NativeRemotingInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeRemotingInterfaceManagementInterface</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/PropertyConsumer.html" title="interface in org.wildfly.swarm.config.management">PropertyConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/Property.html" title="class in org.wildfly.swarm.config.management">Property</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/PropertySupplier.html" title="interface in org.wildfly.swarm.config.management">PropertySupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/Property.html" title="class in org.wildfly.swarm.config.management">Property</a>></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/SecurityRealmConsumer.html" title="interface in org.wildfly.swarm.config.management">SecurityRealmConsumer</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/SecurityRealm.html" title="class in org.wildfly.swarm.config.management">SecurityRealm</a><T>></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/SecurityRealmSupplier.html" title="interface in org.wildfly.swarm.config.management">SecurityRealmSupplier</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/SecurityRealm.html" title="class in org.wildfly.swarm.config.management">SecurityRealm</a>></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuditAccess.html" title="class in org.wildfly.swarm.config.management">AuditAccess</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/AuditAccess.html" title="class in org.wildfly.swarm.config.management">AuditAccess</a><T>></td>
<td class="colLast">
<div class="block">The management audit logging top-level resource.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuditAccess.AuditAccessResources.html" title="class in org.wildfly.swarm.config.management">AuditAccess.AuditAccessResources</a></td>
<td class="colLast">
<div class="block">Child mutators for AuditAccess</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.html" title="class in org.wildfly.swarm.config.management">AuthorizationAccess</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.html" title="class in org.wildfly.swarm.config.management">AuthorizationAccess</a><T>></td>
<td class="colLast">
<div class="block">The access control definitions defining the access management restrictions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.AuthorizationAccessResources.html" title="class in org.wildfly.swarm.config.management">AuthorizationAccess.AuthorizationAccessResources</a></td>
<td class="colLast">
<div class="block">Child mutators for AuthorizationAccess</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ConfigurationChangesService.html" title="class in org.wildfly.swarm.config.management">ConfigurationChangesService</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/ConfigurationChangesService.html" title="class in org.wildfly.swarm.config.management">ConfigurationChangesService</a><T>></td>
<td class="colLast">
<div class="block">Service to store and list configuration changes.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/HTTPInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">HTTPInterfaceManagementInterface</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/HTTPInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">HTTPInterfaceManagementInterface</a><T>></td>
<td class="colLast">
<div class="block">Configuration of the server's HTTP management interface</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/IdentityAccess.html" title="class in org.wildfly.swarm.config.management">IdentityAccess</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/IdentityAccess.html" title="class in org.wildfly.swarm.config.management">IdentityAccess</a><T>></td>
<td class="colLast">
<div class="block">Identity definition for management actions.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/LdapConnection.html" title="class in org.wildfly.swarm.config.management">LdapConnection</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/LdapConnection.html" title="class in org.wildfly.swarm.config.management">LdapConnection</a><T>></td>
<td class="colLast">
<div class="block">A connection factory that can be used by a security realm to access an LDAP
server as a source of authentication and authorization information.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/LdapConnection.LdapConnectionResources.html" title="class in org.wildfly.swarm.config.management">LdapConnection.LdapConnectionResources</a></td>
<td class="colLast">
<div class="block">Child mutators for LdapConnection</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsService.html" title="class in org.wildfly.swarm.config.management">ManagementOperationsService</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsService.html" title="class in org.wildfly.swarm.config.management">ManagementOperationsService</a><T>></td>
<td class="colLast">
<div class="block">Execution of management operations.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/ManagementOperationsService.ManagementOperationsServiceResources.html" title="class in org.wildfly.swarm.config.management">ManagementOperationsService.ManagementOperationsServiceResources</a></td>
<td class="colLast">
<div class="block">Child mutators for ManagementOperationsService</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/NativeInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeInterfaceManagementInterface</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/NativeInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeInterfaceManagementInterface</a><T>></td>
<td class="colLast">
<div class="block">Configuration of the server's native management interface</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/NativeRemotingInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeRemotingInterfaceManagementInterface</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/NativeRemotingInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management">NativeRemotingInterfaceManagementInterface</a><T>></td>
<td class="colLast">
<div class="block">Configuration of the server's native management interface using a connector
from the remoting subsystem.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/Property.html" title="class in org.wildfly.swarm.config.management">Property</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/Property.html" title="class in org.wildfly.swarm.config.management">Property</a><T>></td>
<td class="colLast">
<div class="block">A property within a security realm resource.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/SecurityRealm.html" title="class in org.wildfly.swarm.config.management">SecurityRealm</a><T extends <a href="../../../../../org/wildfly/swarm/config/management/SecurityRealm.html" title="class in org.wildfly.swarm.config.management">SecurityRealm</a><T>></td>
<td class="colLast">
<div class="block">A security realm that can be associated with a management interface and used
to control access to the management services.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/SecurityRealm.SecurityRealmResources.html" title="class in org.wildfly.swarm.config.management">SecurityRealm.SecurityRealmResources</a></td>
<td class="colLast">
<div class="block">Child mutators for SecurityRealm</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Summary table, listing enums, and an explanation">
<caption><span>Enum Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Enum</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.PermissionCombinationPolicy.html" title="enum in org.wildfly.swarm.config.management">AuthorizationAccess.PermissionCombinationPolicy</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/AuthorizationAccess.Provider.html" title="enum in org.wildfly.swarm.config.management">AuthorizationAccess.Provider</a></td>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/wildfly/swarm/config/management/LdapConnection.Referrals.html" title="enum in org.wildfly.swarm.config.management">LdapConnection.Referrals</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</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 class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.2.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/wildfly/swarm/config/mail/mail_session/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../org/wildfly/swarm/config/management/access/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/config/management/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.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 ======= -->
<p class="legalCopy"><small>Copyright © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "c14766324d0897c9f920ddb4b6421edf",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 489,
"avg_line_length": 68.2396694214876,
"alnum_prop": 0.7136974688143394,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "f2cd8a38cc9a3e54bf4c7ebba55faad3cd0a5758",
"size": "24771",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "2018.2.0/apidocs/org/wildfly/swarm/config/management/package-summary.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Mac OS X songcoind build instructions
====================================
Authors
-------
* Laszlo Hanyecz <[email protected]>
* Douglas Huff <[email protected]>
* Colin Dean <[email protected]>
* Gavin Andresen <[email protected]>
License
-------
Copyright (c) 2009-2012 Bitcoin Developers
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/).
This product includes cryptographic software written by
Eric Young ([email protected]) and UPnP software written by Thomas Bernard.
Notes
-----
See `doc/readme-qt.rst` for instructions on building Songcoin-Qt, the
graphical user interface.
Tested on OS X 10.5 through 10.8 on Intel processors only. PPC is not
supported because it is big-endian.
All of the commands should be executed in a Terminal application. The
built-in one is located in `/Applications/Utilities`.
Preparation
-----------
You need to install XCode with all the options checked so that the compiler
and everything is available in /usr not just /Developer. XCode should be
available on your OS X installation media, but if not, you can get the
current version from https://developer.apple.com/xcode/. If you install
Xcode 4.3 or later, you'll need to install its command line tools. This can
be done in `Xcode > Preferences > Downloads > Components` and generally must
be re-done or updated every time Xcode is updated.
There's an assumption that you already have `git` installed, as well. If
not, it's the path of least resistance to install [Github for Mac](https://mac.github.com/)
(OS X 10.7+) or
[Git for OS X](https://code.google.com/p/git-osx-installer/). It is also
available via Homebrew or MacPorts.
You will also need to install [Homebrew](http://mxcl.github.io/homebrew/)
or [MacPorts](https://www.macports.org/) in order to install library
dependencies. It's largely a religious decision which to choose, but, as of
December 2012, MacPorts is a little easier because you can just install the
dependencies immediately - no other work required. If you're unsure, read
the instructions through first in order to assess what you want to do.
Homebrew is a little more popular among those newer to OS X.
The installation of the actual dependencies is covered in the Instructions
sections below.
Instructions: MacPorts
----------------------
### Install dependencies
Installing the dependencies using MacPorts is very straightforward.
sudo port install boost db48@+no_java openssl miniupnpc
### Building `songcoind`
1. Clone the github tree to get the source code and go into the directory.
git clone [email protected]:litecoin-project/litecoin.git litecoin
cd litecoin
2. Build songcoind:
cd src
make -f makefile.osx
3. It is a good idea to build and run the unit tests, too:
make -f makefile.osx test
Instructions: HomeBrew
----------------------
#### Install dependencies using Homebrew
brew install boost miniupnpc openssl berkeley-db4
Note: After you have installed the dependencies, you should check that the Brew installed version of OpenSSL is the one available for compilation. You can check this by typing
openssl version
into Terminal. You should see OpenSSL 1.0.1e 11 Feb 2013.
If not, you can ensure that the Brew OpenSSL is correctly linked by running
brew link openssl --force
Rerunning "openssl version" should now return the correct version.
### Building `songcoind`
1. Clone the github tree to get the source code and go into the directory.
git clone https://github.com/litecoin-project/litecoin.git
cd litecoin
2. Modify source in order to pick up the `openssl` library.
Edit `makefile.osx` to account for library location differences. There's a
diff in `contrib/homebrew/makefile.osx.patch` that shows what you need to
change, or you can just patch by doing
patch -p1 < contrib/homebrew/makefile.osx.patch
3. Build songcoind:
cd src
make -f makefile.osx
4. It is a good idea to build and run the unit tests, too:
make -f makefile.osx test
Creating a release build
------------------------
A songcoind binary is not included in the Songcoin-Qt.app bundle. You can ignore
this section if you are building `songcoind` for your own use.
If you are building `litecond` for others, your build machine should be set up
as follows for maximum compatibility:
All dependencies should be compiled with these flags:
-mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk
For MacPorts, that means editing your macports.conf and setting
`macosx_deployment_target` and `build_arch`:
macosx_deployment_target=10.5
build_arch=i386
... and then uninstalling and re-installing, or simply rebuilding, all ports.
As of December 2012, the `boost` port does not obey `macosx_deployment_target`.
Download `http://gavinandresen-bitcoin.s3.amazonaws.com/boost_macports_fix.zip`
for a fix. Some ports also seem to obey either `build_arch` or
`macosx_deployment_target`, but not both at the same time. For example, building
on an OS X 10.6 64-bit machine fails. Official release builds of Songcoin-Qt are
compiled on an OS X 10.6 32-bit machine to workaround that problem.
Once dependencies are compiled, creating `Songcoin-Qt.app` is easy:
make -f Makefile.osx RELEASE=1
Running
-------
It's now available at `./songcoind`, provided that you are still in the `src`
directory. We have to first create the RPC configuration file, though.
Run `./songcoind` to get the filename where it should be put, or just try these
commands:
echo -e "rpcuser=songcoinrpc\nrpcpassword=$(xxd -l 16 -p /dev/urandom)" > "/Users/${USER}/Library/Application Support/Songcoin/songcoin.conf"
chmod 600 "/Users/${USER}/Library/Application Support/Songcoin/songcoin.conf"
When next you run it, it will start downloading the blockchain, but it won't
output anything while it's doing this. This process may take several hours.
Other commands:
./songcoind --help # for a list of command-line options.
./songcoind -daemon # to start the songcoin daemon.
./songcoind help # When the daemon is running, to get a list of RPC commands
| {
"content_hash": "a15f3bd41acc48edef41aa06cc88363c",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 175,
"avg_line_length": 34.49189189189189,
"alnum_prop": 0.7384422504309669,
"repo_name": "Songcoin/Songcoin",
"id": "d7fe1074031b6f3e05a588e3083dd80c1e20e074",
"size": "6381",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "doc/build-osx.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "32009"
},
{
"name": "C++",
"bytes": "2616864"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18284"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "13384"
},
{
"name": "NSIS",
"bytes": "5944"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69714"
},
{
"name": "QMake",
"bytes": "14690"
},
{
"name": "Shell",
"bytes": "13173"
}
],
"symlink_target": ""
} |
#ifndef vtkDICOMFileSorter_h
#define vtkDICOMFileSorter_h
#include <vtkObject.h>
#include "vtkDICOMModule.h" // For export macro
class vtkStringArray;
class vtkIntArray;
class vtkDICOMMetaData;
//! Sort DICOM files and group them by study and series.
/*!
* If a list of input files is provided via SetInputFileNames(), then
* the files will be grouped by study and series, and each series will
* be sorted by InstanceNumber. If a single input file is provided via
* SetInputFileName(), then other files in the same series will be found,
* and the series will be sorted by InstanceNumber.
*/
class VTKDICOM_EXPORT vtkDICOMFileSorter : public vtkObject
{
public:
vtkTypeMacro(vtkDICOMFileSorter,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkDICOMFileSorter *New();
//@{
//! Set one file from the desired series.
/*!
* When Update() is called, all files that belong to the
* same series as the specified file will be identified
* and can be retrieved by calling GetOutputFileNames().
*/
void SetInputFileName(const char *name);
const char *GetInputFileName() { return this->InputFileName; }
//@}
//@{
//! Set a list of file names to group and sort.
/*!
* This method is mutually exclusive with SetInputFileName().
* If you call ths method, then InputFileName will be set to NULL
* and vice versa.
*/
void SetInputFileNames(vtkStringArray *input);
vtkStringArray *GetInputFileNames() { return this->InputFileNames; }
//@}
//@{
//! Update the information about the files.
/*!
* This method must be called before any of the Get methods.
*/
virtual void Update();
//@}
//@{
//! Get the total number of series that were found.
int GetNumberOfSeries();
//! Get the number of studies that were found.
int GetNumberOfStudies();
//! Get the first series for a particular study.
int GetFirstSeriesForStudy(int study);
//! Get the last series (inclusive) for a particular study.
int GetLastSeriesForStudy(int study);
//@}
//@{
//! Get the full list of sorted filenames.
vtkStringArray *GetOutputFileNames() { return this->OutputFileNames; }
//! Get the file names for a specific series.
vtkStringArray *GetFileNamesForSeries(int i);
//@}
//@{
//! Get the error code.
unsigned long GetErrorCode() { return this->ErrorCode; }
//! Get the filename associated with the error code.
const char *GetInternalFileName() { return this->InternalFileName; }
//@}
//@{
//! If this is On, files with no pixel data will be skipped.
/*!
* This is On by default. Some files, such as dicom directory files,
* have metadata but have no images. Usually we want to skip these.
*/
vtkSetMacro(RequirePixelData, int);
vtkBooleanMacro(RequirePixelData, int);
int GetRequirePixelData() { return this->RequirePixelData; }
//@}
protected:
vtkDICOMFileSorter();
~vtkDICOMFileSorter();
const char *InputFileName;
vtkStringArray *InputFileNames;
vtkStringArray *OutputFileNames;
int RequirePixelData;
vtkTimeStamp UpdateTime;
unsigned long ErrorCode;
char *InternalFileName;
//! Fill the output filename array.
virtual void Execute();
//! Sort the input string array
virtual void SortFiles(vtkStringArray *input);
//! Add a sorted series to output.
/*!
* This method is called from SortFiles to provide the files
* that make up one series. The study that the files belong
* to must also be provided, as a number that starts at zero
* and monotonically increases.
*/
void AddSeriesFileNames(int study, vtkStringArray *files);
//! Description:
// Convert parser errors into sorter errors.
void RelayError(vtkObject *o, unsigned long e, void *data);
//! Description:
// Set the name of the file currently being operated on.
void SetInternalFileName(const char *fname);
//! Set the error code.
void SetErrorCode(unsigned long e) { this->ErrorCode = e; }
private:
vtkDICOMFileSorter(const vtkDICOMFileSorter&); // Not implemented.
void operator=(const vtkDICOMFileSorter&); // Not implemented.
class StringArrayVector;
struct FileInfo;
class FileInfoVectorList;
StringArrayVector *Series;
vtkIntArray *Studies;
//! Compare FileInfo entries by instance number
static bool CompareInstance(const FileInfo &fi1, const FileInfo &fi2);
};
#endif
| {
"content_hash": "f4fba7bf6971e55874b9c744ee004b48",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 74,
"avg_line_length": 28.888157894736842,
"alnum_prop": 0.7107720337053063,
"repo_name": "Atamai/tactics",
"id": "e88d7e9d7762b4010f9a4d111d28d262341a42e9",
"size": "4911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/dicom/vtkDICOMFileSorter.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "26380"
},
{
"name": "C++",
"bytes": "4242285"
},
{
"name": "CMake",
"bytes": "19612"
},
{
"name": "Makefile",
"bytes": "994"
},
{
"name": "Objective-C",
"bytes": "3109"
}
],
"symlink_target": ""
} |
'use strict';
angular.module('yamaApp').factory('Users', function (Restangular) {
return Restangular.service('users');
});
| {
"content_hash": "2218fbbbc52470a9d28fd1dcae2de62c",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 67,
"avg_line_length": 25,
"alnum_prop": 0.712,
"repo_name": "fthamura/yamajs",
"id": "5da223908b739ca75be2203d7eec307dd302cd74",
"size": "125",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/backend/admin/user/user.service.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "144"
},
{
"name": "HTML",
"bytes": "47996"
},
{
"name": "JavaScript",
"bytes": "45462"
}
],
"symlink_target": ""
} |
<?php
$object = ($_GET[1] != 0) ? new Content($_GET[1]) : new Content();
$level_name = ($_GET[1] != 0) ? $object->__get('content_varchar_1') : $module->__get('module_title');
$system_name = $module->__get('module_system_name');
//permissions
$level = ($object->__get('content_level') != '') ? ($object->__get('content_level') + 1) : 1;
$levelParent = ($object->__get('content_level') != '') ? $object->__get('content_level') : 1;
$create = ((PermissionHelper::checkPermission($system_name.'_create', $level) !== false) && ($module->__get('module_levels') > $object->__get('content_level'))) ? "<a href=\"index.php?control_content.controller/create/".$content_type."/".$_GET[1]."\" class=\"cont_administrar2\">Adicionar Hijo</a>" : '';
$update = PermissionHelper::checkPermission($system_name.'_update', $levelParent);
$update_button = (($update !== false) && ($_GET[1] != 0)) ? "<a href=\"index.php?content_expand.control/".$content_type."/".$_GET[1]."\" class=\"cont_administrar2\">Editar</a>" : '';
$order = PermissionHelper::checkPermission($system_name.'_order', $level);
$order_button = ($order != false) ? "<a href=\"javascript:void(0)\" onclick=\"ParamsAJAXCall('index.php?order_popup.control/".$_GET[1]."/" . $module->__get('module_id') . "', createSortablePopup, 'GET', 'window2', 'orderContents');\" class=\"cont_administrar2\">Ordenar</a>" : "";
$delete = PermissionHelper::checkPermission($system_name.'_delete', $level);
?>
<div id="mainContent">
<div id="alertBox">
<?php
$alert = (isset($alert)) ? $alert : array();
AlertHelper::placeAlerts($alert);
?>
</div>
<?=$create?>
<?=$order_button?>
<?=$update_button?>
<h3><?=$level_name?></h3>
<div class="ruta"><br />
<?php ContentHelper::dumpBreadCrum($module, $_GET[2]); ?>
</div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<th> </th>
<th><a href="#">Nombre</a></th>
<th class="width50px"><a href="#">Hijos</a></th>
<th class="width80px"><a href="#">Estado</a></th>
<th class="width50px"><a href="#">Última Actualización</a></th>
<th class="widthacciones">Acciones</th>
</tr>
<?php
foreach ($contents as $content)
{
//sons
$filter = " AND content_parent = " . $content->__get('content_id');
$sons = ContentHelper::retrieveContents($filter);
//permissions
$state = ($content->__get('content_state') == 'A') ? 'Activo' : 'Inactivo';
$state_action = "SimpleAJAXCall('index.php?control_content.controller/changeState/".$content->__get('content_id')."', updateAlert, 'GET', 'u_state_".$content->__get('content_id')."');";
$state_display = ($order !== false) ? '<a href="javascript:void(0)" onClick="'.$state_action.'">'.$state.'</a>' : $state;
$edit_url = 'index.php?content_list.control/'.$content_type.'/'.$content->__get('content_id');
$edit_display = ($update !== false) ? '<a href="'.$edit_url.'" class="edit2" title="Editar"><span>Editar</span></a>' : "";
$delete_display= (($delete !== false) && ($content->__get('content_options') != 'noDelete')) ? '<a href="index.php?control_content.controller/delete/'.$content_type.'/'.$content->__get('content_id').'" class="itemdel2" onClick="return confirm(\'Esta seguro que desea borrar este contenido?\')" title="Borrar"><span>Eliminar</span></a>' : "";
?>
<tr>
<td class="table03"><img src="imgcontrol/ico_tree2.gif" width="12" height="12" /></td>
<td><a href="<?=$edit_url?>"><?=str_replace("\\", "" ,$content->__get('content_varchar_1'))?></a></td>
<td class="table01 width50px"><?=count($sons)?></td>
<td class="table01 width80px"><div id="u_state_<?=$content->__get('content_id')?>"><?=$state_display?></div></td>
<td class="table01 width50px"><? echo formatDate('%d/%m/%Y', $content->__get('content_datetime_update'));?></td>
<td class="widthacciones"><?=$delete_display?><?=$edit_display?></td>
</tr>
<?php
}
?>
</table>
</div> | {
"content_hash": "4662f7b78c46680e5fc5aa935340e7b2",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 346,
"avg_line_length": 64,
"alnum_prop": 0.5771484375,
"repo_name": "hugomarin/artBO",
"id": "9ed81d6183a27791a69a5bcd3955d7ece321301d",
"size": "4096",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "en/control/content_list_level.control.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "124248"
},
{
"name": "ColdFusion",
"bytes": "333388"
},
{
"name": "JavaScript",
"bytes": "4044652"
},
{
"name": "Lasso",
"bytes": "66388"
},
{
"name": "PHP",
"bytes": "1512402"
},
{
"name": "Perl",
"bytes": "74380"
},
{
"name": "Python",
"bytes": "83098"
},
{
"name": "Ruby",
"bytes": "887"
},
{
"name": "Shell",
"bytes": "3304"
}
],
"symlink_target": ""
} |
<?php
namespace Welhott\Vatlidator\Provider;
use Welhott\Vatlidator\VatProvider;
/**
* Class VatFinland
* @package Welhott\Vatlidator\Provider
*/
class VatFinland extends VatProvider
{
/**
* The ISO 3166-1 alpha-2 code that represents this country
* @var string
*/
private $country = 'FI';
/**
* The abbreviation of the VAT number according the the country's language.
* @var string
*/
private $abbreviation = 'ALV nro';
/**
* @var array
*/
private $multipliers = [7, 9, 10, 5, 8, 4, 2];
/**
* @var string
*/
private $pattern = '\d{8}';
/**
*
* @return bool True if the number is valid, false if it's not.
*/
public function validate() : bool
{
if(!$this->matchesPattern($this->pattern)) {
return false;
}
$checksum = 0;
for($i = 0; $i < 7; $i++) {
$checksum += $this->cleanNumber[$i] * $this->multipliers[$i];
}
$checksum = 11 - ($checksum % 11);
if($checksum > 9) {
$checksum = 0;
}
return $checksum === $this->getCheckDigit();
}
/**
* Obtain the country code that represents this country.
* @return string An ISO 3166-1 alpha-2 code that represents this country.
*/
public function getCountry() : string
{
return $this->country;
}
/**
* @return string
*/
public function getAbbreviation() : string
{
return $this->abbreviation;
}
}
| {
"content_hash": "67f284fc198c9ee497fe88e29b1621fe",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 79,
"avg_line_length": 20.342105263157894,
"alnum_prop": 0.53751617076326,
"repo_name": "rvelhote/libvat",
"id": "9a004d262c29c5bd944d3a1515f0f58e12b22ba3",
"size": "2652",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Provider/VatFinland.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "243510"
}
],
"symlink_target": ""
} |
package usbong.android.builder.fragments.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
/**
* A simple {@link android.support.v4.app.Fragment} subclass.
* Use the {@link AddingChildToItselfWarningDialogFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class AddingChildToItselfWarningDialogFragment extends DialogFragment {
public static final String TAG = AddingChildToItselfWarningDialogFragment.class.getSimpleName();
private Callback callback;
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @return A new instance of fragment AddingChildToItselfWarningDialogFragment.
*/
public static AddingChildToItselfWarningDialogFragment newInstance() {
AddingChildToItselfWarningDialogFragment fragment = new AddingChildToItselfWarningDialogFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
public AddingChildToItselfWarningDialogFragment() {
// Required empty public constructor
}
public void setCallback(Callback callback) {
this.callback = callback;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
.setMessage("Note: You are connecting a node to itself. Proceed?")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.onYes();
}
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (callback != null) {
callback.onNo();
}
}
})
.create();
}
public interface Callback {
void onYes();
void onNo();
}
}
| {
"content_hash": "629cdd54083d1dec7157e3faa7dec1ed",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 107,
"avg_line_length": 34.78260869565217,
"alnum_prop": 0.6233333333333333,
"repo_name": "linusmotu/usbong-builder",
"id": "48eaaf5f3ec7c0241512b0d7411adb3b5955d46c",
"size": "2400",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/main/java/usbong/android/builder/fragments/dialogs/AddingChildToItselfWarningDialogFragment.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "358685"
}
],
"symlink_target": ""
} |
//
// GTLAdSenseAdUnits.h
//
// ----------------------------------------------------------------------------
// NOTE: This file is generated from Google APIs Discovery Service.
// Service:
// AdSense Management API (adsense/v1.3)
// Description:
// Gives AdSense publishers access to their inventory and the ability to
// generate reports
// Documentation:
// https://developers.google.com/adsense/management/
// Classes:
// GTLAdSenseAdUnits (0 custom class methods, 4 custom properties)
#if GTL_BUILT_AS_FRAMEWORK
#import "GTL/GTLObject.h"
#else
#import "GTLObject.h"
#endif
@class GTLAdSenseAdUnit;
// ----------------------------------------------------------------------------
//
// GTLAdSenseAdUnits
//
// This class supports NSFastEnumeration over its "items" property. It also
// supports -itemAtIndex: to retrieve individual objects from "items".
@interface GTLAdSenseAdUnits : GTLCollectionObject
// ETag of this response for caching purposes.
@property (copy) NSString *ETag;
// The ad units returned in this list response.
@property (retain) NSArray *items; // of GTLAdSenseAdUnit
// Kind of list this is, in this case adsense#adUnits.
@property (copy) NSString *kind;
// Continuation token used to page through ad units. To retrieve the next page
// of results, set the next request's "pageToken" value to this.
@property (copy) NSString *nextPageToken;
@end
| {
"content_hash": "dc01b39300560c96d94b856b95c6f1d5",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 28.06,
"alnum_prop": 0.6550249465431219,
"repo_name": "buidinhnguyen/GoogleAPI",
"id": "360d53b0045ba45cd501189624c8dfb04f397a64",
"size": "1998",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Services/AdSense/Generated/GTLAdSenseAdUnits.h",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package runtime_test
import (
"bytes"
"encoding/json"
"reflect"
"strings"
"testing"
"github.com/gengo/grpc-gateway/examples/examplepb"
"github.com/gengo/grpc-gateway/runtime"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/golang/protobuf/ptypes/wrappers"
)
func TestJSONBuiltinMarshal(t *testing.T) {
var m runtime.JSONBuiltin
msg := examplepb.SimpleMessage{
Id: "foo",
}
buf, err := m.Marshal(&msg)
if err != nil {
t.Errorf("m.Marshal(%v) failed with %v; want success", &msg, err)
}
var got examplepb.SimpleMessage
if err := json.Unmarshal(buf, &got); err != nil {
t.Errorf("json.Unmarshal(%q, &got) failed with %v; want success", buf, err)
}
if want := msg; !reflect.DeepEqual(got, want) {
t.Errorf("got = %v; want %v", &got, &want)
}
}
func TestJSONBuiltinMarshalField(t *testing.T) {
var m runtime.JSONBuiltin
for _, fixt := range builtinFieldFixtures {
buf, err := m.Marshal(fixt.data)
if err != nil {
t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err)
}
if got, want := string(buf), fixt.json; got != want {
t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data)
}
}
}
func TestJSONBuiltinMarshalFieldKnownErrors(t *testing.T) {
var m runtime.JSONBuiltin
for _, fixt := range builtinKnownErrors {
buf, err := m.Marshal(fixt.data)
if err != nil {
t.Errorf("m.Marshal(%v) failed with %v; want success", fixt.data, err)
}
if got, want := string(buf), fixt.json; got == want {
t.Errorf("surprisingly got = %q; as want %q; data = %#v", got, want, fixt.data)
}
}
}
func TestJSONBuiltinsnmarshal(t *testing.T) {
var (
m runtime.JSONBuiltin
got examplepb.SimpleMessage
data = []byte(`{"id": "foo"}`)
)
if err := m.Unmarshal(data, &got); err != nil {
t.Errorf("m.Unmarshal(%q, &got) failed with %v; want success", data, err)
}
want := examplepb.SimpleMessage{
Id: "foo",
}
if !reflect.DeepEqual(got, want) {
t.Errorf("got = %v; want = %v", &got, &want)
}
}
func TestJSONBuiltinUnmarshalField(t *testing.T) {
var m runtime.JSONBuiltin
for _, fixt := range builtinFieldFixtures {
dest := reflect.New(reflect.TypeOf(fixt.data))
if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err != nil {
t.Errorf("m.Unmarshal(%q, dest) failed with %v; want success", fixt.json, err)
}
if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) {
t.Errorf("got = %#v; want = %#v; input = %q", got, want, fixt.json)
}
}
}
func TestJSONBuiltinUnmarshalFieldKnownErrors(t *testing.T) {
var m runtime.JSONBuiltin
for _, fixt := range builtinKnownErrors {
dest := reflect.New(reflect.TypeOf(fixt.data))
if err := m.Unmarshal([]byte(fixt.json), dest.Interface()); err == nil {
t.Errorf("m.Unmarshal(%q, dest) succeeded; want ane error", fixt.json)
}
}
}
func TestJSONBuiltinEncoder(t *testing.T) {
var m runtime.JSONBuiltin
msg := examplepb.SimpleMessage{
Id: "foo",
}
var buf bytes.Buffer
enc := m.NewEncoder(&buf)
if err := enc.Encode(&msg); err != nil {
t.Errorf("enc.Encode(%v) failed with %v; want success", &msg, err)
}
var got examplepb.SimpleMessage
if err := json.Unmarshal(buf.Bytes(), &got); err != nil {
t.Errorf("json.Unmarshal(%q, &got) failed with %v; want success", buf.String(), err)
}
if want := msg; !reflect.DeepEqual(got, want) {
t.Errorf("got = %v; want %v", &got, &want)
}
}
func TestJSONBuiltinEncoderFields(t *testing.T) {
var m runtime.JSONBuiltin
for _, fixt := range builtinFieldFixtures {
var buf bytes.Buffer
enc := m.NewEncoder(&buf)
if err := enc.Encode(fixt.data); err != nil {
t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err)
}
if got, want := buf.String(), fixt.json+"\n"; got != want {
t.Errorf("got = %q; want %q; data = %#v", got, want, fixt.data)
}
}
}
func TestJSONBuiltinDecoder(t *testing.T) {
var (
m runtime.JSONBuiltin
got examplepb.SimpleMessage
data = `{"id": "foo"}`
)
r := strings.NewReader(data)
dec := m.NewDecoder(r)
if err := dec.Decode(&got); err != nil {
t.Errorf("m.Unmarshal(&got) failed with %v; want success", err)
}
want := examplepb.SimpleMessage{
Id: "foo",
}
if !reflect.DeepEqual(got, want) {
t.Errorf("got = %v; want = %v", &got, &want)
}
}
func TestJSONBuiltinDecoderFields(t *testing.T) {
var m runtime.JSONBuiltin
for _, fixt := range builtinFieldFixtures {
r := strings.NewReader(fixt.json)
dec := m.NewDecoder(r)
dest := reflect.New(reflect.TypeOf(fixt.data))
if err := dec.Decode(dest.Interface()); err != nil {
t.Errorf("dec.Decode(dest) failed with %v; want success; data = %q", err, fixt.json)
}
if got, want := dest.Elem().Interface(), fixt.data; !reflect.DeepEqual(got, want) {
t.Errorf("got = %v; want = %v; input = %q", got, want, fixt.json)
}
}
}
var (
builtinFieldFixtures = []struct {
data interface{}
json string
}{
{data: "", json: `""`},
{data: proto.String(""), json: `""`},
{data: "foo", json: `"foo"`},
{data: proto.String("foo"), json: `"foo"`},
{data: int32(-1), json: "-1"},
{data: proto.Int32(-1), json: "-1"},
{data: int64(-1), json: "-1"},
{data: proto.Int64(-1), json: "-1"},
{data: uint32(123), json: "123"},
{data: proto.Uint32(123), json: "123"},
{data: uint64(123), json: "123"},
{data: proto.Uint64(123), json: "123"},
{data: float32(-1.5), json: "-1.5"},
{data: proto.Float32(-1.5), json: "-1.5"},
{data: float64(-1.5), json: "-1.5"},
{data: proto.Float64(-1.5), json: "-1.5"},
{data: true, json: "true"},
{data: proto.Bool(true), json: "true"},
{data: (*string)(nil), json: "null"},
{data: new(empty.Empty), json: "{}"},
{data: examplepb.NumericEnum_ONE, json: "1"},
{
data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))),
json: "1",
},
}
builtinKnownErrors = []struct {
data interface{}
json string
}{
{data: examplepb.NumericEnum_ONE, json: "ONE"},
{
data: (*examplepb.NumericEnum)(proto.Int32(int32(examplepb.NumericEnum_ONE))),
json: "ONE",
},
{
data: &examplepb.ABitOfEverything_OneofString{OneofString: "abc"},
json: `"abc"`,
},
{
data: ×tamp.Timestamp{
Seconds: 1462875553,
Nanos: 123000000,
},
json: `"2016-05-10T10:19:13.123Z"`,
},
{
data: &wrappers.Int32Value{Value: 123},
json: "123",
},
{
data: &structpb.Value{
Kind: &structpb.Value_StringValue{
StringValue: "abc",
},
},
json: `"abc"`,
},
}
)
| {
"content_hash": "136fcf2e83e764dc0aeb07863ef3dafd",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 87,
"avg_line_length": 27.016326530612243,
"alnum_prop": 0.6297023719595105,
"repo_name": "digitalfishpond/dashboard",
"id": "e476db588d58126b0b5508e3f00e8668776a3d78",
"size": "6619",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "vendor/github.com/gengo/grpc-gateway/runtime/marshal_json_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "50487"
},
{
"name": "Go",
"bytes": "687273"
},
{
"name": "HTML",
"bytes": "349304"
},
{
"name": "JavaScript",
"bytes": "1250945"
},
{
"name": "Shell",
"bytes": "5736"
},
{
"name": "XSLT",
"bytes": "1119"
}
],
"symlink_target": ""
} |
<h1>Contacts</h1>
<a href="https://github.com/alxzoomer" target="_blank">My code on GitHub</a> | {
"content_hash": "2209bf5dcf5f43017ca8834cd3a6f092",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 76,
"avg_line_length": 32,
"alnum_prop": 0.6875,
"repo_name": "alxzoomer/WebAPI-AngularJS-Seed",
"id": "5230e1cfae6b879913226072c55e14b74a806bdc",
"size": "98",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Views/contact.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "C#",
"bytes": "14715"
},
{
"name": "HTML",
"bytes": "4565"
},
{
"name": "JavaScript",
"bytes": "6042"
}
],
"symlink_target": ""
} |
package com.linkedin.pinot.core.data.readers;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.io.Files;
import com.linkedin.pinot.common.data.DimensionFieldSpec;
import com.linkedin.pinot.common.data.FieldSpec;
import com.linkedin.pinot.common.data.FieldSpec.DataType;
import com.linkedin.pinot.common.data.MetricFieldSpec;
import com.linkedin.pinot.common.data.Schema;
import com.linkedin.pinot.common.data.TimeFieldSpec;
import com.linkedin.pinot.common.data.TimeGranularitySpec;
import com.linkedin.pinot.core.data.GenericRow;
import com.linkedin.pinot.core.indexsegment.generator.SegmentGeneratorConfig;
import com.linkedin.pinot.core.segment.creator.impl.SegmentIndexCreationDriverImpl;
/**
* Tests the PinotSegmentRecordReader to check that the records being generated
* are the same as the records used to create the segment
*/
public class PinotSegmentRecordReaderTest {
private String segmentName;
private Schema schema;
private String segmentOutputDir;
private File segmentIndexDir;
private List<GenericRow> rows;
private TestRecordReader recordReader;
private static String D_SV_1 = "d_sv_1";
private static String D_MV_1 = "d_mv_1";
private static String M1 = "m1";
private static String M2 = "m2";
private static String TIME = "t";
@BeforeClass
public void setup() throws Exception {
segmentName = "pinotSegmentRecordReaderTest";
schema = createPinotSchema();
segmentOutputDir = Files.createTempDir().toString();
segmentIndexDir = new File(segmentOutputDir, segmentName);
rows = createTestData();
recordReader = new TestRecordReader(rows, schema);
createSegment();
}
private List<GenericRow> createTestData() {
List<GenericRow> rows = new ArrayList<>();
Random random = new Random();
Map<String, Object> fields;
for (int i = 0; i < 10000; i++) {
fields = new HashMap<>();
fields.put(D_SV_1, D_SV_1 + "_" + RandomStringUtils.randomAlphabetic(2));
Object[] d2Array = new Object[5];
for (int j = 0; j < 5; j++) {
d2Array[j] = D_MV_1 + "_" + j + "_" + RandomStringUtils.randomAlphabetic(2);
}
fields.put(D_MV_1, d2Array);
fields.put(M1, Math.abs(random.nextInt()));
fields.put(M2, Math.abs(random.nextFloat()));
fields.put(TIME, Math.abs(random.nextLong()));
GenericRow row = new GenericRow();
row.init(fields);
rows.add(row);
}
return rows;
}
private Schema createPinotSchema() {
Schema testSchema = new Schema();
testSchema.setSchemaName("schema");
FieldSpec spec;
spec = new DimensionFieldSpec(D_SV_1, DataType.STRING, true);
testSchema.addField(D_SV_1, spec);
spec = new DimensionFieldSpec(D_MV_1, DataType.STRING, false, ",");
testSchema.addField(D_MV_1, spec);
spec = new MetricFieldSpec(M1, DataType.INT);
testSchema.addField(M1, spec);
spec = new MetricFieldSpec(M2, DataType.FLOAT);
testSchema.addField(M2, spec);
spec = new TimeFieldSpec(new TimeGranularitySpec(DataType.LONG, TimeUnit.HOURS, TIME));
testSchema.addField(TIME, spec);
return testSchema;
}
private void createSegment() throws Exception {
SegmentGeneratorConfig segmentGeneratorConfig = new SegmentGeneratorConfig(schema);
segmentGeneratorConfig.setTableName(segmentName);
segmentGeneratorConfig.setOutDir(segmentOutputDir);
segmentGeneratorConfig.setSegmentName(segmentName);
SegmentIndexCreationDriverImpl driver = new SegmentIndexCreationDriverImpl();
driver.init(segmentGeneratorConfig, recordReader);
driver.build();
if (!segmentIndexDir.exists()) {
throw new IllegalStateException("Segment generation failed");
}
}
@Test
public void testPinotSegmentRecordReader() throws Exception {
List<GenericRow> outputRows = new ArrayList<>();
PinotSegmentRecordReader pinotSegmentRecordReader = new PinotSegmentRecordReader(segmentIndexDir);
pinotSegmentRecordReader.init();
while (pinotSegmentRecordReader.hasNext()) {
outputRows.add(pinotSegmentRecordReader.next());
}
pinotSegmentRecordReader.close();
Assert.assertEquals(outputRows.size(), rows.size(), "Number of rows returned by PinotSegmentRecordReader is incorrect");
for (int i = 0; i < outputRows.size(); i++) {
GenericRow outputRow = outputRows.get(i);
GenericRow row = rows.get(i);
Assert.assertEquals(outputRow.getValue(D_SV_1), row.getValue(D_SV_1));
Assert.assertEquals(outputRow.getValue(D_MV_1), row.getValue(D_MV_1));
Assert.assertEquals(outputRow.getValue(M1), row.getValue(M1));
Assert.assertEquals(outputRow.getValue(M2), row.getValue(M2));
Assert.assertEquals(outputRow.getValue(TIME), row.getValue(TIME));
}
}
@AfterClass
public void cleanup() {
FileUtils.deleteQuietly(new File(segmentOutputDir));
}
}
| {
"content_hash": "39eb055df1c6cfae368422ffa7409dc1",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 124,
"avg_line_length": 35.93150684931507,
"alnum_prop": 0.7277926038886771,
"repo_name": "tkao1000/pinot",
"id": "849f909bb8fe0487c148715da82c8f45e96b155a",
"size": "5883",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pinot-core/src/test/java/com/linkedin/pinot/core/data/readers/PinotSegmentRecordReaderTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4272"
},
{
"name": "CSS",
"bytes": "742276"
},
{
"name": "FreeMarker",
"bytes": "62887"
},
{
"name": "GAP",
"bytes": "121494"
},
{
"name": "HTML",
"bytes": "26969"
},
{
"name": "Java",
"bytes": "6293112"
},
{
"name": "JavaScript",
"bytes": "2458911"
},
{
"name": "Python",
"bytes": "75273"
},
{
"name": "Shell",
"bytes": "19887"
},
{
"name": "Thrift",
"bytes": "6055"
}
],
"symlink_target": ""
} |
---
layout: post
title: "Markdown Tips & Tricks - Part 2"
categories: [jekyll, github, tutorials in English]
tags: [markdown, kramdown, jekyll, github, github pages, git]
meta_keywords: markdown, kramdown, jekyll, github, github pages, git, tips and tricks, dicas e truques
author: Marcia Ramos
fb_section: Tutorials - Jekyll
description: Part 2 - Embedding videos.
image: http://goo.gl/zcwqIN
imageUrl: https://goo.gl/Kb7R0N
image_schema: 'http://farm1.staticflickr.com//636//22456839236_a446a2ef25_o.png'
fb_title: Markdown Tips & Tricks - Part 2
fb_type: article
author_fb: marciaramosmdr
author_twitter: xmdramos
date: 2015-10-25 23:36:10 UTC
comments: true
published: true
authorUrl: https://plus.google.com/+MarciaDiasRamosMD/
language: [en_US, en_GB]
date_update: 2016-03-30 20:47:30 UTC
copy: true # copy button with javascript
codingbox: true # code type on the top-right of code block boxes
---
# **<mkp-blue>Embedding Videos in Markdown</mkp-blue>**
This is the second article of the series **"Markdown Tips & Tricks - Thinking Outside the Box"**. On the [previous article][], it was explained how to deal with `html` **elements** and **classes** when writing markdown files. Now we are going to show you how to embed videos.
On the first part of this article, treated like **["Case A"](#i-classfa-fa-youtubeinbspnbspcase-a-iframe-tags---embedding-youtube-videos)**, we will have covered the steps for embedding videos via `iframe`, like you would do with YouTube videos. On the next, **["Case B"](#i-classfa-fa-youtube-playinbspnbspcase-b-video-tags)**, we will show you how to do that via `<video>` `html 5` tag, used when you need to display a video from your site root files.
As we have explained on the [previous article][], there's only a thing you need to worry abaout when adding `html elements` to you markdown:
<p class="bkggreen"><i class="fa fa-exclamation" style="color: red;"></i> You need to leave a <strong>blank line</strong> between some regular markdown text and a <strong>html tag</strong>, otherwise you might face errors during files compilation!</p>
<hr>
### **<i class="fa fa-youtube"></i> Case A: `<iframe>` Tags** - Embedding YouTube Videos
All right. Let's begin by showing you how to embed **YouTube videos**, as found in our post **[How to publish your website on GitHub][]**. Doing this can be a little tricky, as there are some steps to have covered up to make it be rendered correctly. Let's see a live example, with a video we have used on the post we just mentioned. Here it is, down below. You will notice that you can resize your browser's window and it will maintain its responsiveness.
<figure class="iframe_container">
<iframe width="853" height="480" src="http://www.youtube.com/embed/E-ONNjFoOx0" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>
</figure>
<p class="bkggreen"><i class="fa fa-exclamation" style="color: red;"></i> We'll need to copy the code given by <strong>YouTube</strong> and paste it onto your markdown file, and from that we'll need to <strong>make a few corrections</strong> in order to make it work properly, according to step-by-step section below.</p>
### **Step-by-Step**
**First:** open in a web browser the YouTube video that you want to embed to your post and copy the `iframe`. If you don't know how to do that, learn from this 15 seconds video:
<figure id="iframe-video" class="video_container">
<video controls="controls" allowfullscreen="true" poster="{{ site.baseurl }}/assets/media/embed-youtube-poster.png">
<source src="{{ site.baseurl }}/assets/media/embed-youtube.mp4" type="video/mp4">
</video>
</figure>
**Second:** paste the `<iframe>` into a `<div>` tag:
{% highlight markdown %}
.... <!-- post content -->
<div class="iframe_container">
<iframe width="560" height="315" src="http://www.youtube.com/embed/E-ONNjFoOx0" frameborder="0" allowfullscreen></iframe>
</div>
.... <!-- post content -->
{% endhighlight %}
**Third:** instead of leaving the atribute `allowfullscreen` with no value, give it a value of "allowfullscreen": `allowfullscreen="allowfullscreen"`.
**Fourth:** Add a space in between opening and closing `<iframe>` tags: instead of `<iframe></iframe>`, make sure it looks like that:
`<iframe> </iframe>`.
**Fifth:** You can remove the proprieties of `width` and `hight` given by **YouTube** iframe, as they will be replaced by the `<div>` tag styles. But you can leave it there as well, it won't make any difference.
Now your code will look like that:
<div name="clipboard-text" id="clipboard-text-1">
{% highlight markdown %}
.... <!-- post content -->
<div class="iframe_container">
<iframe src="http://www.youtube.com/embed/E-ONNjFoOx0" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>
</div>
.... <!-- post content -->
{% endhighlight %}
</div>
<p id="btn1" class="clipb"><button onclick="fDisplay()" id="target-to-copy" data-clipboard-target="clipboard-text-1" class="target-to-copy copy btn btn-lg" title="Click to copy the code above and paste it into your doc."><i class="fa fa-files-o"></i> Click to copy</button></p>
<p id="ok0" class="clipb"></p>
<script>
function fDisplay() {
document.getElementById("ok0").innerHTML = "<button class='btn btn-success'> <i class='fa fa-check'> </button>";
}
</script>
<br>
We wrapped the `<iframe>` tag within a `<div>`, in order to provide full responsiveness to our embed videos. For making this happen, we have applied the following styles:
<div name="clipboard-text" id="clipboard-text-2">
{% highlight css %}
.iframe_container {
position: relative;
padding-bottom: 56.25%; /* 16:9 - this is responsive by adjusting the hight according to the width! */
padding-top: 25px;
height: 0;
}
.iframe_container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
{% endhighlight %}
</div>
<p id="btn2" class="clipb"><button onclick="Display()" id="target-to-copy" data-clipboard-target="clipboard-text-2" class="target-to-copy copy btn btn-lg" title="Click to copy the code above and paste it into your doc."><i class="fa fa-files-o"></i>
Click to copy</button></p>
<p id="ok1" class="clipb"></p>
<script>
function Display() {
document.getElementById("ok1").innerHTML = "<button class='btn btn-success'> <i class='fa fa-check'> </button>";
}
</script>
<br>
**That's it!** Now you can use the code block we provided whenever you want to embed a YouTube video. Actually, the only thing you will need to change is the **video id**, given by the last part after the last forward slash. On this video `http://www.youtube.com/embed/E-ONNjFoOx0`, its **id** is `E-ONNjFoOx0`.
<hr>
### **<i class="fa fa-youtube-play"></i> Case B: `<video>` Tags**
Now, if you have videos that you don't want to publish on YouTube and want them to be part of your media files, you will need a `html 5` `<video>` tag.
Adding a `<video>` tag is very straight forward, exactly as we did for `<div>` or `<hr>` tags on the [previous article][]. Just add a `<video>` tag to your markdown text and you are good to go!
<div name="clipboard-text" id="clipboard-text-3">
{% highlight markdown %}
.... <!-- post content -->
<div class="video_container">
<video controls="controls" allowfullscreen="true" poster="path/to/poster_image.png">
<source src="path/to/video.mp4" type="video/mp4">
</video>
</div>
.... <!-- post content -->
{% endhighlight %}
</div>
<p id="btn2" class="clipb"><button onclick="nDisplay()" id="target-to-copy" data-clipboard-target="clipboard-text-3" class="target-to-copy copy btn btn-lg" title="Click to copy the code above and paste it into your doc."><i class="fa fa-files-o"></i>
Click to copy</button></p>
<p id="ok2" class="clipb"></p>
<script>
function nDisplay() {
document.getElementById("ok2").innerHTML = "<button class='btn btn-success'> <i class='fa fa-check'> </button>";
}
</script>
<br>
Let's see a live example with the code above, using a video we have in our blog assets:
<figure id="iframe-video" class="video_container">
<video controls="controls" allowfullscreen="true" poster="{{ site.baseurl }}/assets/media/blog_poster.png">
<source src="{{ site.baseurl }}/assets/media/blog.mp4" type="video/mp4">
</video>
</figure>
As we did for the `<iframe>`, we wrapped the `<video>` tag within a `<div>`, in order to provide full responsiveness to our videos, and we have applied exactly the same styles:
{% highlight css %}
.video_container {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.video_container video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
{% endhighlight %}
**That's it!** Now you can use your `<video>` tags whenever you want! Just replace the path and you're done! The supported formats are: `.mp4`, `.ogg` and `.webm`. If you want to check other **methods and attributes** that can be used with `<video>` tags, go ahead and find them in **W3Schools**: a [basic usage][] or a [complete reference][].
If you are thinking about `flash` videos, it's not a good idea using them anymore. As little as you use flash, better for you. It's promised to be deprecated soon. iPhones, iPads and lots of other devices do not support flash anymore.
### **<mkp-blue>Well done!</mkp-blue>**
After covering all the content of this and the [previous article][], we can see that when working on markdown files, if we want to do something that is not by the books, we just need give it a try! As a matter of fact, most of them will work!
Enjoy! :dancers: :smiley: :thumbsup:
### **<mkp-blue>That's all folks!</mkp-blue>**
We hope to have been helpfull! Please, if you enjoyed this article, leave a comment to let us know!
If you have any questions or suggestions, please feel free to get in touch with us by filling our [contact form]({{ site.data.url.virtua.git-contact }}).
Thanks for reading! Stay tuned for the next article: follow us on [Twitter]({{ site.data.url.virtua.twitter }}), [Google+]({{ site.data.url.virtua.googleplus }}) or subscribe to our [YouTube Channel]({{ site.data.url.virtua.youtube }})
### **Related Articles**
<ul>
{% for art in site.data.articles.github %}
<li>
<a href="{{ art.url }}">⇢ {{ art.title }}</a>
</li>
{% endfor %}
{% for art in site.data.articles.markdown %}
<li>
<a href="{{ art.url }}">⇢ {{ art.title }}</a>
</li>
{% endfor %}
<!--
NEW WAY
Related articles (by Jekyll itself) -->
<!-- {% for post in site.related_posts limit:3 %}
{% if post.language contains 'en_US' and post.categories contains 'github' %}
<li>
<a href="{{ site.baseurl }}{{ post.url }}">- {{ post.title }}</a>
</li>
{% endif %}
{% endfor %} -->
</ul>
### **References**
- ☆ [GitHub][]
- ☆ [GitHub Pages][]
- ☆ [Jekyll][]
- ☆ [GitHub Flavored Markdown][]
- ☆ [Jekyll Documentation][]
- ☆ [Markdown][]
- ☆ [Kramdown][]
<hr>
### **Image Credits**
- ★ Art work: [Virtua Creative](https://goo.gl/Kb7R0N)
- ★ Illustrations: we have downloaded from Freepik the original [box](http://www.freepik.com/free-vector/vectors_785241.htm) and the original [bulb](http://www.freepik.com/free-vector/vectors_810569.htm).
[How to publish your website on GitHub]: http://virtuacreative.github.io/blog/free-hosting-website-github.html
[another article]: http://virtuacreative.github.io/blog/free-hosting-website-github.html
[recommended by GitHub]: https://help.github.com/articles/using-jekyll-with-pages/#running-jekyll
[avoiding building errors]: https://help.github.com/articles/troubleshooting-github-pages-build-failures/#viewing-jekyll-build-error-messages-locally
[Blog]: {{ site.data.url.virtua.blog }}
[GitHub]: {{ site.data.url.git.home }}
[GitHub Pages]: {{ site.data.url.git.pages }}
[Jekyll]: {{ site.data.url.jekyll.home }}
[Kramdown]: {{ site.data.url.markdown.kramdown }}
[GitHub Flavored Markdown]: {{ site.data.url.git.gfm }}
[Jekyll Documentation]: {{ site.data.url.jekyll.docs }}
[Markdown]: {{ site.data.url.markdown.all }}
[previous article]: {{ site.data.url.articles.tipsntricks }}
[basic usage]: http://www.w3schools.com/html/html5_video.asp
[complete reference]: http://www.w3schools.com/tags/ref_av_dom.asp
| {
"content_hash": "65cced419c4061560673322db9094935",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 456,
"avg_line_length": 42.153583617747444,
"alnum_prop": 0.6997004291150514,
"repo_name": "VirtuaCreative/blog",
"id": "981c0e52be0b26c8806630f8ab9c59780a108b64",
"size": "12351",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "_posts/2015-10-25-markdown-tips-tricks-part2.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "22913"
},
{
"name": "HTML",
"bytes": "43353"
},
{
"name": "JavaScript",
"bytes": "86495"
},
{
"name": "Ruby",
"bytes": "3300"
}
],
"symlink_target": ""
} |
var Promise = require('bluebird');
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var csv = Promise.promisifyAll(require('csv'));
var OUTPUT_DIR = '../data/';
var gtfsPath = path.resolve(__dirname, '../tampere_gtfs_latest');
// Format:
// shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence
var shapesText = fs.readFileSync(path.join(gtfsPath, 'shapes.txt'));
// Format:
// route_id,service_id,trip_id,trip_headsign,direction_id,shape_id
var tripsText = fs.readFileSync(path.join(gtfsPath, 'trips.txt'));
function shapeToCoords(shape) {
return _.map(shape, function(item) {
return {
// Return as strings
lat: item[1],
lng: item[2]
}
});
}
function coordinateToNumber(coord) {
return {
lat: +coord.lat,
lng: +coord.lng
};
}
function groupTripsToShapes(trips, shapes) {
// Group trips based on route id
var groupedTrips = _.groupBy(trips, function(trip) {
return trip[0];
});
var groupedShapes = _.groupBy(shapes, function(shape) {
return shape[0];
});
var uniqTrips = _.uniq(trips, function(trip) {
return trip[0];
});
var routeIds = _.map(uniqTrips, function(trip) {
return trip[0];
});
var routes = {};
_.each(routeIds, function(routeId) {
var shapeIds = _.map(groupedTrips[routeId], function(trip) {
return trip[5];
});
var shapes = _.map(shapeIds, function(shapeId) {
return groupedShapes[shapeId];
});
var coordinates = _.flatten(_.map(shapes, shapeToCoords));
var uniqCoordinates = _.uniq(coordinates, function(coord) {
return coord.lat + coord.lng;
});
var numberCoordinates = _.map(uniqCoordinates, coordinateToNumber);
routes[routeId] = {};
routes[routeId].coordinates = numberCoordinates;
});
return routes;
}
Promise.join(
csv.parseAsync(tripsText, {comment: '#', delimiter: ','}),
csv.parseAsync(shapesText, {comment: '#', delimiter: ','}),
function(tripsData, shapesData) {
var trips = _.tail(tripsData)
var shapes = _.tail(shapesData)
var routes = groupTripsToShapes(trips, shapes);
var routeIds = _.keys(routes);
// Sort first by string comparasion, then numerical
// This sorts correctly: 91, 92A, 92B
routeIds.sort();
routeIds.sort(function(a, b) {
return parseInt(a, 10) - parseInt(b, 10);
});
var outputPath = path.resolve(__dirname, OUTPUT_DIR, 'routes.json');
fs.writeFileSync(outputPath, JSON.stringify(routes));
var outputPath = path.resolve(__dirname, OUTPUT_DIR, 'general.json');
fs.writeFileSync(outputPath, JSON.stringify({routes: routeIds}));
}
);
| {
"content_hash": "c0791c27a4e1e3267b161d66e71112fb",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 77,
"avg_line_length": 27.384615384615383,
"alnum_prop": 0.6007724719101124,
"repo_name": "kimmobrunfeldt/googlemaps-demo",
"id": "65f718e3eabab831a9d9bc6cc87adc5be6682a00",
"size": "3288",
"binary": false,
"copies": "2",
"ref": "refs/heads/gh-pages",
"path": "tools/parse-gtfs.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8101"
},
{
"name": "JavaScript",
"bytes": "1550732"
}
],
"symlink_target": ""
} |
<?php
class Phoenix_Moneybookers_Model_Acc extends Phoenix_Moneybookers_Model_Abstract
{
/**
* unique internal payment method identifier
*/
protected $_code = 'moneybookers_acc';
protected $_paymentMethod = 'ACC';
}
| {
"content_hash": "1248692063fd3969696f8763e1952d6b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 80,
"avg_line_length": 25.1,
"alnum_prop": 0.6533864541832669,
"repo_name": "almadaocta/lordbike-production",
"id": "d5fd3e1355e1108c801d8617c44e2db49b4effd5",
"size": "1007",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/code/community/Phoenix/Moneybookers/Model/Acc.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "20744"
},
{
"name": "ApacheConf",
"bytes": "6510"
},
{
"name": "Batchfile",
"bytes": "1053"
},
{
"name": "C",
"bytes": "25531"
},
{
"name": "CSS",
"bytes": "2695575"
},
{
"name": "HTML",
"bytes": "7607119"
},
{
"name": "JavaScript",
"bytes": "4942446"
},
{
"name": "Makefile",
"bytes": "266"
},
{
"name": "PHP",
"bytes": "111927807"
},
{
"name": "Perl",
"bytes": "1124"
},
{
"name": "PowerShell",
"bytes": "1042"
},
{
"name": "Roff",
"bytes": "1009"
},
{
"name": "Ruby",
"bytes": "298"
},
{
"name": "Shell",
"bytes": "2118"
},
{
"name": "XSLT",
"bytes": "2135"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "e638ce4506d67f26ff1c6f10caf6c207",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "858d5e2b33ae5127d468f90f0f749dde175b1cf8",
"size": "185",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Cactaceae/Cereus/Cereus malletianus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
angular.module('settings', [])
.factory('AppSettingsService', AppSettingsService);
/**
* A service that exposes anything is present in the django configuration for the settings JS_CONFIG. This is
* usually a config dict
* Note: The {% js_config %} tag must be present somewhere in the HTML template
* @constructor
*/
function AppSettingsService($document) {
"use strict";
return JSON.parse(angular.element($document[0].querySelector('#js_config')).html());
}
AppSettingsService.$inject = ['$document']; | {
"content_hash": "e2a0fd01b811c9b4e158c00ef3c25bac",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 109,
"avg_line_length": 32.625,
"alnum_prop": 0.7203065134099617,
"repo_name": "h2020-westlife-eu/VRE",
"id": "fa1b5117811438407a1f5c4f7ada4cb39b025af5",
"size": "522",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ui/static/js/angular-app/settings/module.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "46730"
},
{
"name": "HTML",
"bytes": "167326"
},
{
"name": "JavaScript",
"bytes": "22031"
},
{
"name": "Python",
"bytes": "310068"
},
{
"name": "Shell",
"bytes": "863"
}
],
"symlink_target": ""
} |
package org.activiti.runtime.api.event.impl;
import org.activiti.api.task.runtime.events.TaskCandidateUserAddedEvent;
import org.activiti.engine.delegate.event.ActivitiEntityEvent;
import org.activiti.engine.task.IdentityLink;
import org.activiti.runtime.api.model.impl.APITaskCandidateUserConverter;
import java.util.Optional;
public class ToAPITaskCandidateUserAddedEventConverter implements EventConverter<TaskCandidateUserAddedEvent, ActivitiEntityEvent> {
private APITaskCandidateUserConverter converter;
private TaskCandidateEventConverterHelper taskCandidateEventConverterHelper = new TaskCandidateEventConverterHelper();
public ToAPITaskCandidateUserAddedEventConverter(APITaskCandidateUserConverter converter) {
this.converter = converter;
}
@Override
public Optional<TaskCandidateUserAddedEvent> from(ActivitiEntityEvent internalEvent) {
TaskCandidateUserAddedEventImpl event = null;
if (internalEvent.getEntity() instanceof IdentityLink) {
IdentityLink identityLink = (IdentityLink) internalEvent.getEntity();
if (taskCandidateEventConverterHelper.isTaskCandidateUserLink(identityLink)) {
event = new TaskCandidateUserAddedEventImpl(converter.from(identityLink));
}
}
return Optional.ofNullable(event);
}
}
| {
"content_hash": "337ea5ccfad69ee5972a0b34f9e4b6dc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 132,
"avg_line_length": 42.0625,
"alnum_prop": 0.7852897473997028,
"repo_name": "Activiti/Activiti",
"id": "feec13edf275f7fc32b01bea338fb4068ae4ccc4",
"size": "1957",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "activiti-core/activiti-api-impl/activiti-api-task-runtime-impl/src/main/java/org/activiti/runtime/api/event/impl/ToAPITaskCandidateUserAddedEventConverter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "21882"
},
{
"name": "Java",
"bytes": "11922067"
},
{
"name": "SQLPL",
"bytes": "7430"
}
],
"symlink_target": ""
} |
declare function ToLength(value: unknown): number;
export = ToLength;
| {
"content_hash": "06388f20b4a4577aa9412f185bed085d",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 50,
"avg_line_length": 35,
"alnum_prop": 0.7857142857142857,
"repo_name": "markogresak/DefinitelyTyped",
"id": "ebca699476ea0b5d7acf1315f4d3c31d798b34f0",
"size": "70",
"binary": false,
"copies": "33",
"ref": "refs/heads/master",
"path": "types/es-abstract/2015/ToLength.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "15"
},
{
"name": "Protocol Buffer",
"bytes": "678"
},
{
"name": "TypeScript",
"bytes": "17426898"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<x_storage_table_element xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<update_periods>
<update_period>DAILY</update_period>
</update_periods>
<storage_name>dim_local</storage_name>
<table_desc external="true" field_delimiter="," table_location="${project.build.directory}/metastore/examples/local">
<part_cols>
<column comment="Time column" name="dt" type="STRING"/>
</part_cols>
<time_part_cols>dt</time_part_cols>
</table_desc>
</x_storage_table_element>
| {
"content_hash": "fdd05bea602c89ec2b9eed748e3f6891",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 119,
"avg_line_length": 41.38235294117647,
"alnum_prop": 0.7356076759061834,
"repo_name": "guptapuneet/lens",
"id": "6503261f29150023a8f53bbd417a257cf07ca17d",
"size": "1407",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "lens-cli/src/test/resources/dim-local-storage-element.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "5818"
},
{
"name": "HTML",
"bytes": "13585"
},
{
"name": "Java",
"bytes": "4668895"
},
{
"name": "JavaScript",
"bytes": "433402"
},
{
"name": "Shell",
"bytes": "14016"
}
],
"symlink_target": ""
} |
/* { dg-do preprocess } */
/* Tests that #include does not allow the terminating '>' or '"' to be
escaped, as per the standard. */
/* Source: Neil Booth, 4 Nov 2000. */
#include "silly\"" /* { dg-error "extra tokens" "" } */
/* These error is No such file or directory, just once. However, this
message is locale-dependent, so don't test for it. */
/* { dg-error "silly" "silly" { target *-*-* } 0 } */
/* { dg-error "missing" "missing" { target *-*-* } 0 } */
/* { dg-message "terminated" "terminated" { target *-*-* } 0 } */
| {
"content_hash": "f0cc67d003ac11166079bdc765b46d45",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 70,
"avg_line_length": 34,
"alnum_prop": 0.5827205882352942,
"repo_name": "the-linix-project/linix-kernel-source",
"id": "9370d0944e6e664a4f535410089276a29ab2f902",
"size": "600",
"binary": false,
"copies": "138",
"ref": "refs/heads/master",
"path": "gccsrc/gcc-4.7.2/gcc/testsuite/gcc.dg/cpp/include2a.c",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ada",
"bytes": "38139979"
},
{
"name": "Assembly",
"bytes": "3723477"
},
{
"name": "Awk",
"bytes": "83739"
},
{
"name": "C",
"bytes": "103607293"
},
{
"name": "C#",
"bytes": "55726"
},
{
"name": "C++",
"bytes": "38577421"
},
{
"name": "CLIPS",
"bytes": "6933"
},
{
"name": "CSS",
"bytes": "32588"
},
{
"name": "Emacs Lisp",
"bytes": "13451"
},
{
"name": "FORTRAN",
"bytes": "4294984"
},
{
"name": "GAP",
"bytes": "13089"
},
{
"name": "Go",
"bytes": "11277335"
},
{
"name": "Haskell",
"bytes": "2415"
},
{
"name": "Java",
"bytes": "45298678"
},
{
"name": "JavaScript",
"bytes": "6265"
},
{
"name": "Matlab",
"bytes": "56"
},
{
"name": "OCaml",
"bytes": "148372"
},
{
"name": "Objective-C",
"bytes": "995127"
},
{
"name": "Objective-C++",
"bytes": "436045"
},
{
"name": "PHP",
"bytes": "12361"
},
{
"name": "Pascal",
"bytes": "40318"
},
{
"name": "Perl",
"bytes": "358808"
},
{
"name": "Python",
"bytes": "60178"
},
{
"name": "SAS",
"bytes": "1711"
},
{
"name": "Scilab",
"bytes": "258457"
},
{
"name": "Shell",
"bytes": "2610907"
},
{
"name": "Tcl",
"bytes": "17983"
},
{
"name": "TeX",
"bytes": "1455571"
},
{
"name": "XSLT",
"bytes": "156419"
}
],
"symlink_target": ""
} |
__author__ = 'scarroll'
from pygov.usda.enums import *
from pygov.usda.domain import Nutrient, Food, FoodReport
from pygov.base.client import DataGovClientBase, get_response_data
class UsdaClient(DataGovClientBase):
def __init__(self, api_gov_key):
super(UsdaClient, self).__init__('usda/', api_gov_key)
def list_nutrients(self, max, offset=0, sort='n'):
uri = super(UsdaClient, self).build_uri(UsdaApis.ndb.value, UsdaUriActions.list.value,
lt=UsdaNdbListType.all_nutrients.value, max=max, offset=offset, sort=sort)
response_data = get_response_data(uri)
nutrients = self.__build_nutrients_list(response_data)
return nutrients
def list_foods(self, max, offset=0, sort='n'):
uri = super(UsdaClient, self).build_uri(UsdaApis.ndb.value, UsdaUriActions.list.value,
lt=UsdaNdbListType.food.value, max=max, offset=offset, sort=sort)
response_data = get_response_data(uri)
foods = self.__build_foods_list(response_data)
return foods
def get_food_report(self, ndb_food_id, report_type=UsdaNdbReportType.basic):
uri = super(UsdaClient, self).build_uri(UsdaApis.ndb.value, UsdaUriActions.report.value, type=report_type.value, ndbno=ndb_food_id)
response_data = get_response_data(uri)
return FoodReport.from_response_data(response_data)
def get_nutrient_report(self, ndb_nutrient_id, report_type=UsdaNdbReportType.basic):
uri = super(UsdaClient, self).build_uri(UsdaApis.ndb.value, UsdaUriActions.report.value, type=report_type.value, ndbno=ndb_nutrient_id)
def __build_item_list(self, data, usda_class):
result = list()
data_list = data['list']['item']
for raw_data in data_list:
result.append(usda_class.from_response_data(raw_data))
return result
def __build_nutrients_list(self, response_data):
return self.__build_item_list(response_data, Nutrient)
def __build_foods_list(self, response_data):
return self.__build_item_list(response_data, Food)
def __build_food_report(self, response_data):
return FoodReport(response_data) | {
"content_hash": "4d789f0ef18c4cf7e46313341fe6cd17",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 143,
"avg_line_length": 44.734693877551024,
"alnum_prop": 0.6747262773722628,
"repo_name": "skeryl/pygov",
"id": "4fe20b2f87185031a7a73ca455ee954a8f6e9774",
"size": "2192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pygov/usda/client.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "9662"
}
],
"symlink_target": ""
} |
package com.hoho.android.usbserial.examples;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.TwoLineListItem;
import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialProber;
import com.hoho.android.usbserial.util.HexDump;
import java.util.ArrayList;
import java.util.List;
/**
* Shows a {@link ListView} of available USB devices.
*
* @author mike wakerly ([email protected])
*/
public class DeviceListActivity extends Activity {
private final String TAG = DeviceListActivity.class.getSimpleName();
private UsbManager mUsbManager;
private ListView mListView;
private TextView mProgressBarTitle;
private ProgressBar mProgressBar;
private static final int MESSAGE_REFRESH = 101;
private static final long REFRESH_TIMEOUT_MILLIS = 5000;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_REFRESH:
refreshDeviceList();
mHandler.sendEmptyMessageDelayed(MESSAGE_REFRESH, REFRESH_TIMEOUT_MILLIS);
break;
default:
super.handleMessage(msg);
break;
}
}
};
/** Simple container for a UsbDevice and its driver. */
private static class DeviceEntry {
public UsbDevice device;
public UsbSerialDriver driver;
DeviceEntry(UsbDevice device, UsbSerialDriver driver) {
this.device = device;
this.driver = driver;
}
}
private List<DeviceEntry> mEntries = new ArrayList<DeviceEntry>();
private ArrayAdapter<DeviceEntry> mAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//sma add
/*Button btn = (Button)findViewById(R.id.btn_write);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent();
i.putExtra("mode", 1);
i.setClass(DeviceListActivity.this, SingleSerialService.class);
startService(i);
Toast.makeText(getApplicationContext(), "Write NFC", Toast.LENGTH_LONG).show();
}
});*/
//sam end
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
mListView = (ListView) findViewById(R.id.deviceList);
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
mProgressBarTitle = (TextView) findViewById(R.id.progressBarTitle);
mAdapter = new ArrayAdapter<DeviceEntry>(this, android.R.layout.simple_expandable_list_item_2, mEntries) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final TwoLineListItem row;
if (convertView == null){
final LayoutInflater inflater =
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = (TwoLineListItem) inflater.inflate(android.R.layout.simple_list_item_2, null);
} else {
row = (TwoLineListItem) convertView;
}
final DeviceEntry entry = mEntries.get(position);
final String title = String.format("Vendor %s Product %s",
HexDump.toHexString((short) entry.device.getVendorId()),
HexDump.toHexString((short) entry.device.getProductId()));
row.getText1().setText(title);
final String subtitle = entry.driver != null ?
entry.driver.getClass().getSimpleName() : "No Driver";
row.getText2().setText(subtitle);
return row;
}
};
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "Pressed item " + position);
if (position >= mEntries.size()) {
Log.w(TAG, "Illegal position.");
return;
}
final DeviceEntry entry = mEntries.get(position);
final UsbSerialDriver driver = entry.driver;
if (driver == null) {
Log.d(TAG, "No driver.");
return;
}
showConsoleActivity(driver);
}
});
}
@Override
protected void onResume() {
super.onResume();
mHandler.sendEmptyMessage(MESSAGE_REFRESH);
}
@Override
protected void onPause() {
super.onPause();
mHandler.removeMessages(MESSAGE_REFRESH);
}
private void refreshDeviceList() {
showProgressBar();
new AsyncTask<Void, Void, List<DeviceEntry>>() {
@Override
protected List<DeviceEntry> doInBackground(Void... params) {
Log.d(TAG, "Refreshing device list ...");
SystemClock.sleep(1000);
final List<DeviceEntry> result = new ArrayList<DeviceEntry>();
for (final UsbDevice device : mUsbManager.getDeviceList().values()) {
final List<UsbSerialDriver> drivers =
UsbSerialProber.probeSingleDevice(mUsbManager, device);
Log.d(TAG, "Found usb device: " + device);
if (drivers.isEmpty()) {
Log.d(TAG, " - No UsbSerialDriver available.");
result.add(new DeviceEntry(device, null));
} else {
for (UsbSerialDriver driver : drivers) {
Log.d(TAG, " + " + driver);
result.add(new DeviceEntry(device, driver));
}
}
}
return result;
}
@Override
protected void onPostExecute(List<DeviceEntry> result) {
mEntries.clear();
mEntries.addAll(result);
mAdapter.notifyDataSetChanged();
mProgressBarTitle.setText(
String.format("%s device(s) found",Integer.valueOf(mEntries.size())));
hideProgressBar();
Log.d(TAG, "Done refreshing, " + mEntries.size() + " entries found.");
}
}.execute((Void) null);
}
private void showProgressBar() {
mProgressBar.setVisibility(View.VISIBLE);
mProgressBarTitle.setText(R.string.refreshing);
}
private void hideProgressBar() {
mProgressBar.setVisibility(View.INVISIBLE);
}
private void showConsoleActivity(UsbSerialDriver driver) {
// SerialConsoleActivity.show(this, driver);
SingleSerialService.setUsbSerialDriver(driver);
Intent i = new Intent();
i.setClass(this, SingleSerialService.class);
startService(i);
Toast.makeText(getApplicationContext(), "Æô¶¯SerialService³É¹¦", Toast.LENGTH_LONG).show();
finish();
}
}
| {
"content_hash": "1f363465f67848d625c63d745405f568",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 114,
"avg_line_length": 35.6431718061674,
"alnum_prop": 0.5886787788901249,
"repo_name": "nfcwormhole/NFC_WIFI_Share",
"id": "df37418aff85bab278cfa0bf96c2c082590e9b75",
"size": "8946",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Android/UsbSerialExamples/src/com/hoho/android/usbserial/examples/DeviceListActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Arduino",
"bytes": "3196"
},
{
"name": "Java",
"bytes": "93626"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<script src="https://unpkg.com/[email protected]/konva.min.js"></script>
<script src="shape-stage.js"></script>
<meta charset="utf-8" />
<title>dusen n' dusen drawing</title>
<link rel="stylesheet" href="shape-style.css">
<link rel="shortcut icon" type="image/x-icon" href="../../images/favicon.ico"/>
</head>
<body>
<div id="container"></div>
<script>
stage1 = new ShapeStage(STAGE_1_ID);
stage1.showNextIcon(STAGE_2_ID);
stage2 = new ShapeStage(STAGE_2_ID, false);
stage2.showPrevIcon(STAGE_1_ID);
stage2.showNextIcon(STAGE_3_ID);
stage3 = new ShapeStage(STAGE_3_ID, false, false);
stage3.showPrevIcon(STAGE_2_ID);
stage3.showDownloadIcon();
</script>
</body>
</html>
| {
"content_hash": "27b500afbcbca40d82c57e87dd54d309",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 83,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.624113475177305,
"repo_name": "stephtzhang/stephtzhang.github.io",
"id": "4079054216d83c56e1e9b107c5590cc968d50e8b",
"size": "846",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "games/dusen-n-dusen/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4089"
},
{
"name": "HTML",
"bytes": "1840"
}
],
"symlink_target": ""
} |
/**
* Module dependencies.
*/
var EventEmitter = require('events').EventEmitter
, debug = require('debug')('runner')
, Test = require('./test')
, utils = require('./utils')
, noop = function(){};
/**
* Expose `Runner`.
*/
module.exports = Runner;
/**
* Initialize a `Runner` for the given `suite`.
*
* Events:
*
* - `start` execution started
* - `end` execution complete
* - `suite` (suite) test suite execution started
* - `suite end` (suite) all tests (and sub-suites) have finished
* - `test` (test) test execution started
* - `test end` (test) test completed
* - `hook` (hook) hook execution started
* - `hook end` (hook) hook complete
* - `pass` (test) test passed
* - `fail` (test, err) test failed
*
* @api public
*/
function Runner(suite) {
var self = this;
this._globals = [];
this.suite = suite;
this.total = suite.total();
this.failures = 0;
this.on('test end', function(test){ self.checkGlobals(test); });
this.on('hook end', function(hook){ self.checkGlobals(hook); });
this.grep(/.*/);
this.globals(utils.keys(global).concat(['errno']));
}
/**
* Inherit from `EventEmitter.prototype`.
*/
Runner.prototype.__proto__ = EventEmitter.prototype;
/**
* Run tests with full titles matching `re`.
*
* @param {RegExp} re
* @return {Runner} for chaining
* @api public
*/
Runner.prototype.grep = function(re){
debug('grep %s', re);
this._grep = re;
return this;
};
/**
* Allow the given `arr` of globals.
*
* @param {Array} arr
* @return {Runner} for chaining
* @api public
*/
Runner.prototype.globals = function(arr){
debug('globals %j', arr);
utils.forEach(arr, function(arr){
this._globals.push(arr);
}, this);
return this;
};
/**
* Check for global variable leaks.
*
* @api private
*/
Runner.prototype.checkGlobals = function(test){
if (this.ignoreLeaks) return;
var leaks = utils.filter(utils.keys(global), function(key){
return !~utils.indexOf(this._globals, key) && (!global.navigator || 'onerror' !== key);
}, this);
this._globals = this._globals.concat(leaks);
if (leaks.length > 1) {
this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
} else if (leaks.length) {
this.fail(test, new Error('global leak detected: ' + leaks[0]));
}
};
/**
* Fail the given `test`.
*
* @param {Test} test
* @param {Error} err
* @api private
*/
Runner.prototype.fail = function(test, err){
++this.failures;
test.failed = true;
this.emit('fail', test, err);
};
/**
* Fail the given `hook` with `err`.
*
* Hook failures (currently) hard-end due
* to that fact that a failing hook will
* surely cause subsequent tests to fail,
* causing jumbled reporting.
*
* @param {Hook} hook
* @param {Error} err
* @api private
*/
Runner.prototype.failHook = function(hook, err){
++this.failures;
this.fail(hook, err);
this.emit('end');
};
/**
* Run hook `name` callbacks and then invoke `fn()`.
*
* @param {String} name
* @param {Function} function
* @api private
*/
Runner.prototype.hook = function(name, fn){
var suite = this.suite
, hooks = suite['_' + name]
, ms = suite._timeout
, self = this
, timer;
function next(i) {
var hook = hooks[i];
if (!hook) return fn();
self.currentRunnable = hook;
hook.context = self.test;
self.emit('hook', hook);
hook.on('error', function(err){
self.failHook(hook, err);
});
hook.run(function(err){
hook.removeAllListeners('error');
if (err) return self.failHook(hook, err);
self.emit('hook end', hook);
next(++i);
});
}
process.nextTick(function(){
next(0);
});
};
/**
* Run hook `name` for the given array of `suites`
* in order, and callback `fn(err)`.
*
* @param {String} name
* @param {Array} suites
* @param {Function} fn
* @api private
*/
Runner.prototype.hooks = function(name, suites, fn){
var self = this
, orig = this.suite;
function next(suite) {
self.suite = suite;
if (!suite) {
self.suite = orig;
return fn();
}
self.hook(name, function(err){
if (err) {
self.suite = orig;
return fn(err);
}
next(suites.pop());
});
}
next(suites.pop());
};
/**
* Run hooks from the top level down.
*
* @param {String} name
* @param {Function} fn
* @api private
*/
Runner.prototype.hookUp = function(name, fn){
var suites = [this.suite].concat(this.parents()).reverse();
this.hooks(name, suites, fn);
};
/**
* Run hooks from the bottom up.
*
* @param {String} name
* @param {Function} fn
* @api private
*/
Runner.prototype.hookDown = function(name, fn){
var suites = [this.suite].concat(this.parents());
this.hooks(name, suites, fn);
};
/**
* Return an array of parent Suites from
* closest to furthest.
*
* @return {Array}
* @api private
*/
Runner.prototype.parents = function(){
var suite = this.suite
, suites = [];
while (suite = suite.parent) suites.push(suite);
return suites;
};
/**
* Run the current test and callback `fn(err)`.
*
* @param {Function} fn
* @api private
*/
Runner.prototype.runTest = function(fn){
var test = this.test
, self = this;
try {
test.on('error', function(err){
self.fail(test, err);
});
test.run(fn);
} catch (err) {
fn(err);
}
};
/**
* Run tests in the given `suite` and invoke
* the callback `fn()` when complete.
*
* @param {Suite} suite
* @param {Function} fn
* @api private
*/
Runner.prototype.runTests = function(suite, fn){
var self = this
, tests = suite.tests
, test;
function next(err) {
// if we bail after first err
if (self.failures && suite._bail) return fn();
// next test
test = tests.shift();
// all done
if (!test) return fn();
// grep
if (!self._grep.test(test.fullTitle())) return next();
// pending
if (test.pending) {
self.emit('pending', test);
self.emit('test end', test);
return next();
}
// execute test and hook(s)
self.emit('test', self.test = test);
self.hookDown('beforeEach', function(){
self.currentRunnable = self.test;
self.runTest(function(err){
test = self.test;
if (err) {
self.fail(test, err);
self.emit('test end', test);
return self.hookUp('afterEach', next);
}
test.passed = true;
self.emit('pass', test);
self.emit('test end', test);
self.hookUp('afterEach', next);
});
});
}
this.next = next;
next();
};
/**
* Run the given `suite` and invoke the
* callback `fn()` when complete.
*
* @param {Suite} suite
* @param {Function} fn
* @api private
*/
Runner.prototype.runSuite = function(suite, fn){
var self = this
, i = 0;
debug('run suite %s', suite.fullTitle());
this.emit('suite', this.suite = suite);
function next() {
var curr = suite.suites[i++];
if (!curr) return done();
self.runSuite(curr, next);
}
function done() {
self.suite = suite;
self.hook('afterAll', function(){
self.emit('suite end', suite);
fn();
});
}
this.hook('beforeAll', function(){
self.runTests(suite, next);
});
};
/**
* Run the root suite and invoke `fn(failures)`
* on completion.
*
* @param {Function} fn
* @return {Runner} for chaining
* @api public
*/
Runner.prototype.run = function(fn){
var self = this
, fn = fn || function(){};
debug('start');
// callback
self.on('end', function(){
debug('end');
process.removeListener('uncaughtException', uncaught);
fn(self.failures);
});
// run suites
this.emit('start');
this.runSuite(this.suite, function(){
debug('finished running');
self.emit('end');
});
// uncaught exception
function uncaught(err){
var runnable = self.currentRunnable;
debug('uncaught exception');
if (runnable.failed) return;
runnable.clearTimeout();
err.uncaught = true;
self.fail(runnable, err);
// recover from test
if ('test' == runnable.type) {
self.emit('test end', runnable);
self.hookUp('afterEach', self.next);
// bail on hooks
} else {
self.emit('end');
}
}
process.on('uncaughtException', uncaught);
return this;
};
| {
"content_hash": "90c46d2d169c0f5fa6ae192fecf73cc8",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 91,
"avg_line_length": 19.753554502369667,
"alnum_prop": 0.5927303262955854,
"repo_name": "dmohl/expectThat",
"id": "6132757ddc8c1279b2a2fd5b9571dfdf5a065fbd",
"size": "8336",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "npm/ExpectThat.Mocha/node_modules/mocha/lib/runner.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "529"
},
{
"name": "CSS",
"bytes": "2120"
},
{
"name": "CoffeeScript",
"bytes": "60923"
},
{
"name": "HTML",
"bytes": "13436"
},
{
"name": "JavaScript",
"bytes": "234304"
},
{
"name": "LiveScript",
"bytes": "2081"
},
{
"name": "Pascal",
"bytes": "161655"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Kinect_for_Windows_2._0_Demo
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new mainForm());
}
}
}
| {
"content_hash": "6cd2e4a8061e4df09920385dadbbc5f1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 65,
"avg_line_length": 24.09090909090909,
"alnum_prop": 0.6150943396226415,
"repo_name": "GEMISIS/Kinect-for-Windows-2.0-Demo",
"id": "a14438200fe55d23157a9cb6a7cfe216b208799f",
"size": "532",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Kinect for Windows 2.0 Demo/Kinect for Windows 2.0 Demo/Program.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "35210"
}
],
"symlink_target": ""
} |
<?php
namespace Neos\Flow\I18n\Cldr\Reader\Exception;
use Neos\Flow\I18n\Cldr\Exception\InvalidCldrDataException;
/**
* The "Invalid Plural Rule" exception
*
* Thrown when plural rule equation from CLDR is invalid (which probably means
* that CLDR repository is corrupted).
*
* @api
*/
class InvalidPluralRuleException extends InvalidCldrDataException
{
}
| {
"content_hash": "1dbec93413dcea47c93381f6a8e34d53",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 78,
"avg_line_length": 21.529411764705884,
"alnum_prop": 0.76775956284153,
"repo_name": "daniellienert/flow-development-collection",
"id": "9f75c9e20069b0689956ced87209921adfd3a9ac",
"size": "648",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "Neos.Flow/Classes/I18n/Cldr/Reader/Exception/InvalidPluralRuleException.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "775"
},
{
"name": "CSS",
"bytes": "4358"
},
{
"name": "Gherkin",
"bytes": "10531"
},
{
"name": "HTML",
"bytes": "38380"
},
{
"name": "PHP",
"bytes": "7858984"
},
{
"name": "PLpgSQL",
"bytes": "1935"
},
{
"name": "Shell",
"bytes": "4266"
}
],
"symlink_target": ""
} |
using System;
using Mina.Core.Session;
namespace Mina.Handler.Chain
{
/// <summary>
/// A <see cref="IoHandlerCommand"/> encapsulates a unit of processing work to be
/// performed, whose purpose is to examine and/or modify the state of a
/// transaction that is represented by custom attributes provided by
/// <see cref="IoSession"/>.
/// </summary>
public interface IoHandlerCommand
{
void Execute(INextCommand next, IoSession session, Object message);
}
}
| {
"content_hash": "a7e00b1014018be9f7fea46c44fc130c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 85,
"avg_line_length": 31.5625,
"alnum_prop": 0.6811881188118812,
"repo_name": "longshine/Mina.NET",
"id": "7818dcb2a51679d4ea8ea2645fdc166b097c2eae",
"size": "507",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Mina.NET/Handler/Chain/IoHandlerCommand.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "1209820"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/concepts/actions/drawing" xmlns:sem="http://marklogic.com/semantics">
<sem:triple>
<sem:subject>http://www.lds.org/vrl/concepts/actions/drawing</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
<sem:object datatype="xsd:string" xml:lang="eng">Drawing</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/vrl/concepts/actions/drawing</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/vrl/concepts/actions/drawing</sem:subject>
<sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/Topic</sem:object>
</sem:triple>
</sem:triples>
| {
"content_hash": "e83ba91c969606e92a5907f102f9089e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 110,
"avg_line_length": 53.27777777777778,
"alnum_prop": 0.7059436913451512,
"repo_name": "freshie/ml-taxonomies",
"id": "b058482a59494348cd8ab37b3fd3ab1e33b503a3",
"size": "959",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "roxy/data/gospel-topical-explorer-v2/taxonomies/vrl/concepts/actions/drawing.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4422"
},
{
"name": "CSS",
"bytes": "38665"
},
{
"name": "HTML",
"bytes": "356"
},
{
"name": "JavaScript",
"bytes": "411651"
},
{
"name": "Ruby",
"bytes": "259121"
},
{
"name": "Shell",
"bytes": "7329"
},
{
"name": "XQuery",
"bytes": "857170"
},
{
"name": "XSLT",
"bytes": "13753"
}
],
"symlink_target": ""
} |
package laika.directive.std
import laika.api.RenderPhaseRewrite
import laika.ast.Path.Root
import laika.ast.RelativePath.CurrentTree
import laika.ast.sample.ParagraphCompanionShortcuts
import laika.ast.{BlockSequence, Image, InternalTarget, LengthUnit, Options, RootElement, SpanSequence, Styles, Text}
import laika.format.HTML
import munit.FunSuite
class ImageDirectiveSpec extends FunSuite with ParagraphCompanionShortcuts with MarkupParserSetup with RenderPhaseRewrite {
val imgTarget = InternalTarget(CurrentTree / "picture.jpg")
val resolvedImageTarget = InternalTarget(CurrentTree / "picture.jpg").relativeTo(Root / "doc")
val defaultBlockStyle = Styles("default-image-block")
val defaultSpanStyle = Styles("default-image-span")
def blocks(directive: String): String =
s"""aaa
|
|$directive
|
|bbb""".stripMargin
def runBlocks (input: String, expected: Image, options: Options = defaultBlockStyle): Unit =
assertEquals(
parse(blocks(input)).flatMap(rewrite(markupParser, HTML)).map(_.content),
Right(RootElement(
p("aaa"),
BlockSequence(Seq(SpanSequence(expected)), options),
p("bbb")
))
)
def runSpans (input: String, expected: Image): Unit =
assertEquals(
parse(input).flatMap(rewrite(markupParser, HTML)).map(_.content),
Right(RootElement(p(Text("aaa "), expected, Text(" bbb"))))
)
test("block directive - without any HOCON attributes") {
runBlocks("@:image(picture.jpg)", Image(resolvedImageTarget))
}
test("block directive - alt and title attributes") {
val input = """@:image(picture.jpg) {
| alt = alt
| title = desc
|}""".stripMargin
runBlocks(input, Image(resolvedImageTarget, alt = Some("alt"), title = Some("desc")))
}
test("block directive - intrinsicWidth and intrinsicHeight attributes") {
val input = """@:image(picture.jpg) {
| intrinsicWidth = 320
| intrinsicHeight = 240
|}""".stripMargin
val result = Image(resolvedImageTarget, width = Some(LengthUnit.px(320)), height = Some(LengthUnit.px(240)))
runBlocks(input, result)
}
test("block directive - style attribute") {
val input = """@:image(picture.jpg) {
| style = small-image
|}""".stripMargin
runBlocks(input, Image(resolvedImageTarget), Styles("small-image"))
}
test("span directive - without any HOCON attributes") {
runSpans("aaa @:image(picture.jpg) bbb", Image(resolvedImageTarget, options = defaultSpanStyle))
}
test("span directive - alt and title attributes") {
val input = """aaa @:image(picture.jpg) {
| alt = alt
| title = desc
|} bbb""".stripMargin
val result = Image(resolvedImageTarget, alt = Some("alt"), title = Some("desc"), options = defaultSpanStyle)
runSpans(input, result)
}
test("span directive - intrinsicWidth and intrinsicHeight attributes") {
val input = """aaa @:image(picture.jpg) {
| intrinsicWidth = 320
| intrinsicHeight = 240
|} bbb""".stripMargin
val result = Image(resolvedImageTarget, width = Some(LengthUnit.px(320)), height = Some(LengthUnit.px(240)), options = defaultSpanStyle)
runSpans(input, result)
}
test("span directive - style attribute") {
val input = """aaa @:image(picture.jpg) {
| style = small-image
|} bbb""".stripMargin
val result = Image(resolvedImageTarget, options = Styles("small-image"))
runSpans(input, result)
}
}
| {
"content_hash": "7a784cac8a97512b016e5219b5565cbc",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 140,
"avg_line_length": 35.52884615384615,
"alnum_prop": 0.6365358592692828,
"repo_name": "planet42/Laika",
"id": "34b1bd35a98dc0924f6110d830ce50183b28cd04",
"size": "4315",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "core/shared/src/test/scala/laika/directive/std/ImageDirectiveSpec.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "30283"
},
{
"name": "HTML",
"bytes": "369038"
},
{
"name": "JavaScript",
"bytes": "6401"
},
{
"name": "Scala",
"bytes": "2885495"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
<version>2.19.0-SNAPSHOT</version>
</parent>
<artifactId>camel-chronicle</artifactId>
<name>Camel :: Chronicle</name>
<description>Camel Chronicle support</description>
<properties>
<camel.osgi.export.pkg>
org.apache.camel.component.chronicle.*
</camel.osgi.export.pkg>
<camel.osgi.export.service>
org.apache.camel.spi.ComponentResolver;component=chronicle-engine
</camel.osgi.export.service>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>net.openhft</groupId>
<artifactId>chronicle-engine</artifactId>
<version>${chronicle-engine-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
<version>${hamcrest-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>jdk9-build</id>
<activation>
<jdk>9</jdk>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.openhft</groupId>
<artifactId>chronicle-engine</artifactId>
<version>${chronicle-engine-version}</version>
<exclusions>
<exclusion>
<groupId>com.sun.java</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>
</project>
| {
"content_hash": "b0b6553f46bc24fbb539f69abe07717c",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 105,
"avg_line_length": 32.68695652173913,
"alnum_prop": 0.6525671721202447,
"repo_name": "lburgazzoli/camel",
"id": "30c708b70b977e428f005fdd178f495328672d7f",
"size": "3759",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "components/camel-chronicle/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "106"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Eagle",
"bytes": "2898"
},
{
"name": "Elm",
"bytes": "5970"
},
{
"name": "FreeMarker",
"bytes": "12394"
},
{
"name": "Groovy",
"bytes": "52623"
},
{
"name": "HTML",
"bytes": "176896"
},
{
"name": "Java",
"bytes": "50858275"
},
{
"name": "JavaScript",
"bytes": "90232"
},
{
"name": "Protocol Buffer",
"bytes": "578"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "321434"
},
{
"name": "Shell",
"bytes": "8776"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "289093"
}
],
"symlink_target": ""
} |
This folder includes materials covered during the 5th week of the course (2 lectures of 2.5 hour duration). Overview of the first 4 week material was provided followed by a midterm exam (exam paper available in this folder). During the 2nd lecture alternative libraries for scraping were covered (urllib2 as an alternative to requests, and lxml as an alternative to BeautifulSoup). Sublime text editor and Jupyter notebooks were used for executing the code. Topics covered include working with XML documents, scraping the web using XPath, differences between lxml and BeautifulSoup. Packages covered include LXML and urllib2.
**Homework**
```
The most trending YouTube videos (https://www.youtube.com/feed/trending) must be scraped (it is allowed,
according to robots.txt). You must get the following data on each movie:
- URL,
- title,
- duration,
- username,
- views.
1) Get the data using requests and BeautifulSoup (2 points),
2) Get the data using urllib2 and lxml (2 points),
3) Save the data into a CSV and a JSON file (1 point).
Please, provide Jupyter notebooks (or .py files) separately for point 1 (BeautifulSoup) and 2 (lxml).
Make sure to receive data on all trending movies. Anything additional (e.g. saving data also as a XML file
or calculating the average number of views) is highly welcomed.
```
| {
"content_hash": "0e694d3987a5e3b94f5afc60960b37a9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 625,
"avg_line_length": 60,
"alnum_prop": 0.7772727272727272,
"repo_name": "HrantDavtyan/Data_Scraping",
"id": "92a1ff27df8efcea458e6d6fbdd90f62675e38a9",
"size": "1335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Week 5/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1070"
},
{
"name": "HTML",
"bytes": "11062"
},
{
"name": "Jupyter Notebook",
"bytes": "2200355"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cbh_chembl_model_extension', '0019_auto_20150721_0515'),
]
operations = [
migrations.RemoveField(
model_name='skinningconfig',
name='created_by',
),
]
| {
"content_hash": "b81bb07e89dd0142bb8b7bdabbbc20e0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 66,
"avg_line_length": 21.11764705882353,
"alnum_prop": 0.6128133704735376,
"repo_name": "thesgc/cbh_chembl_model_extension",
"id": "cba303ffb7c08c7a7404e7e077d732d46c1f9256",
"size": "383",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "cbh_chembl_model_extension/migrations/0020_remove_skinningconfig_created_by.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "661"
},
{
"name": "Makefile",
"bytes": "1298"
},
{
"name": "Python",
"bytes": "138965"
}
],
"symlink_target": ""
} |
/*
# Method to create a list
# input: list of items separated by spaces (example: "carrots apples cereal pizza")
# steps:
# go through list
# set default quantity to 1
# print the list to the console [can you use one of your other methods here?]
# output: object container showing the items and it's quantities
# Method to add an item to a list
# input: object ontainer, item name and quantity (optinoal)
# steps:
if there is no quantity provided
quantity equals to 1
add item and quantity to the object container
# output: new object container with the added items and quantity
# Method to remove an item from the list
# input: object container and item
# steps: delete item from container
# output: new object container without the removed item
# Method to update the quantity of an item
# input: object container, item and quantity
# steps: change the item's quantity to new quantity
# output: new object container with the item's quantity updated
# Method to print a list and make it look pretty
# input: object container
# steps: beautify list and make it look pretty
# output: pretty looking list
*/
// Initial and Refactor Solution
function createList(items) {
items = items.split(' ');
for (var i = 0; i < items.length; i++) {
this[items[i]] = 1;
}
}
function addItem(list, item, quantity) {
quantity === undefined ? quantity = 1 : quantity = quantity;
list[item] = quantity;
}
function removeItem(list, item) {
delete list[item];
}
function updateQuantity(list, item, quantity) {
list[item] = quantity;
}
function prettyList(list) {
console.log("======================");
console.log(" Grocery List ");
console.log("======================");
console.log("Item: Qty");
console.log("----------");
for (var item in list) {
console.log(item + ": " + list[item]);
}
}
var groceryList = new createList("carrots apples cereal pizza");
addItem(groceryList, "Lemonade", 2);
addItem(groceryList, "Tomatoes", 3);
addItem(groceryList, "Onions", 1);
addItem(groceryList, "Ice Cream", 4);
removeItem(groceryList, "Lemonade");
updateQuantity(groceryList, "Ice Cream", 1);
prettyList(groceryList);
/*
Reflect
1. What concepts did you solidify in working on this challenge? (reviewing the passing of information, objects, constructors, etc.)
Object constructors, objects, and passing information.
2. What was the most difficult part of this challenge?
It took me a while to figure out how to create a new list using "this" and it also took me a while to figure out that I can't use
an optional quantity as the second parameter in function addItem.
3. Did an array or object make more sense to use and why?
An object made the best sense because we have to create many different items and each item comes with a quantity.
If we used an array, we would have many sub-arrays and we have to loop through the entire array each time to
find an item.
*/ | {
"content_hash": "ab845c23fb571877876104089ec3e5da",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 131,
"avg_line_length": 30.5,
"alnum_prop": 0.7096994535519126,
"repo_name": "billdevcode/phase-0",
"id": "6a950db3497ee1dc053a1a6964a30ce152e9ebf8",
"size": "2928",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "week-9/review.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3964"
},
{
"name": "HTML",
"bytes": "18269"
},
{
"name": "Ruby",
"bytes": "98260"
}
],
"symlink_target": ""
} |
"""
Python API for KB SRU
"""
import sys
import urllib
import requests
from lxml import etree
SRU_BASEURL = 'http://jsru.kb.nl/sru/sru'
SRU_BASEURL += '?version=1.2&maximumRecords=%i'
SRU_BASEURL += '&operation=searchRetrieve'
SRU_BASEURL += '&startRecord=%i'
SRU_BASEURL += '&recordSchema=%s'
SRU_BASEURL += '&x-collection=%s&query=%s'
SETS = {'ANP': {'collection': 'ANP',
'description_en': 'Radio Bulletins ANP Press Agency',
'description_nl': 'ANP Radiobulletins Digitaal',
'metadataPrefix': 'didl',
'recordschema': 'dcx',
'setname': 'anp',
'time_period': [1937, 1989]},
'DPO': {'collection': 'DPO_boekdeel',
'description_en': 'Early Dutch Books Online',
'description_nl': 'Early Dutch Books Online',
'metadataPrefix': 'didl',
'recordschema': 'ddd',
'setname': 'DPO',
'time_period': [1781, 1800]},
'BYVANCK': {'description_en': 'Medieval Illuminated Manuscripts',
'description_nl': 'Middeleeuwse Verluchte Handschriften',
'metadataPrefix': 'dcx',
'setname': 'BYVANCK',
'time_period': [500, 1500]},
'SGD': {'description_en': 'States General Digital',
'description_nl': 'Staten-Generaal Digitaal',
'metadataPrefix': 'dcx',
'setname': 'sgd:register',
'time_period': [1962, 1994]},
'GGC': {'collection': 'GGC',
'description_en': 'General Catalogue KB',
'description_nl': 'Algemene Catalogus KB',
'metadataPrefix': 'dcx',
'recordschema': 'dcx',
'setname': 'ggc',
'time_period': [1937, 2016]}} # No idea what to use here?
# Name spaces in GGC records
srw_ns = 'http://www.loc.gov/zing/srw/'
tel_ns = 'http://krait.kb.nl/coop/tel/handbook/telterms.html'
xsi_ns = 'http://www.w3.org/2001/XMLSchema-instance'
dc_ns = 'http://purl.org/dc/elements/1.1/'
dcterms_ns = 'http://purl.org/dc/terms/'
dcx_ns = 'http://krait.kb.nl/coop/tel/handbook/telterms.html'
NSMAPGGC = {"srw": srw_ns,
"tel": tel_ns,
"xsi": xsi_ns,
"dc": dc_ns,
"dcterms": dcterms_ns,
"dcx": dcx_ns}
class response():
def __init__(self, record_data, sru):
self.record_data = record_data
self.sru = sru
def getElementText(self, tagName, attributeName, attributeValue):
# Returns text content of all elements for which tag matches tagName,
# and attribute value equals attributeValue. Set attributeName to empty
# string to get all tagName matches.
textFields = []
for r in self.record_data.iter():
if r.tag == tagName:
if attributeName != '':
try:
if r.attrib[attributeName] == attributeValue:
textFields.append(r.text)
except KeyError:
pass
else:
textFields.append(r.text)
return textFields
@property
def records(self):
if self.sru.nr_of_records == 0:
record_data = "<xml></xml>"
else:
ns = {'zs': 'http://www.loc.gov/zing/srw/'}
record_data = self.record_data.xpath("zs:records/zs:record",
namespaces=ns)[0]
return record(record_data, self.sru)
# Below property functions all return a list with all instances that satisfy
# criteria
@property
def typesDutch(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}type',
'{http://www.w3.org/XML/1998/namespace}lang',
'nl'))
@property
def typesDCMI(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}type',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'DCMIType'))
@property
def identifiersISBN(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}identifier',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcterms:ISBN'))
@property
def identifiersBrinkman(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}identifier',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcx:Brinkman'))
@property
def identifiersURI(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}identifier',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcterms:URI'))
@property
def identifiersOCLC(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}identifier',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'OCLC'))
@property
def languagesDutch(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}language',
'{http://www.w3.org/XML/1998/namespace}lang',
'nl'))
@property
def languagesEnglish(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}language',
'{http://www.w3.org/XML/1998/namespace}lang',
'en'))
@property
def languagesFrench(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}language',
'{http://www.w3.org/XML/1998/namespace}lang',
'fr'))
@property
def languagesISO639(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}language',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcterms:ISO639-2'))
@property
def dates(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}date',
'',
''))
@property
def extents(self):
return(self.getElementText('{http://purl.org/dc/terms/}extent',
'',
''))
@property
def creators(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}creator',
'',
''))
@property
def contributors(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}contributor',
'',
''))
@property
def titles(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}title',
'',
''))
@property
def titlesMain(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}title',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcx:maintitle'))
@property
def titlesIntermediate(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}title',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcx:intermediatetitle'))
@property
def publishers(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}publisher',
'',
''))
@property
def countries(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}country',
'',
''))
@property
def subjectsBrinkman(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}subject',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcx:Brinkman'))
@property
def subjectsISO9707(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}subject',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'ISO_9707_[Brinkman]'))
@property
def subjectsUNESCO(self):
return(self.getElementText('{http://purl.org/dc/elements/1.1/}subject',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'UNESCO'))
@property
def collectionIdentifiers(self):
return(self.getElementText('{http://purl.org/dc/terms/}isPartOf',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcx:collectionIdentifier'))
@property
def recordIdentifiersURI(self):
return(self.getElementText('{http://krait.kb.nl/coop/tel/handbook/telterms.html}recordIdentifier',
'{http://www.w3.org/2001/XMLSchema-instance}type',
'dcterms:URI'))
@property
def annotations(self):
# Note that annotations sometimes contain language or itenID attibutes;
# ignored for now (collect everything).
return(self.getElementText('{http://krait.kb.nl/coop/tel/handbook/telterms.html}annotation',
'',
''))
class record():
def __init__(self, record_data, sru):
self.record_data = record_data
self.sru = sru
def __iter__(self):
return self
# This works under Python 2.7
def next(self):
if self.sru.nr_of_records == 0:
raise StopIteration
if self.sru.startrecord < self.sru.nr_of_records + 1:
record_data = self.sru.run_query()
self.sru.startrecord += 1
return response(record_data, self.sru)
else:
raise StopIteration
# This works under Python 3
def __next__(self):
if self.sru.nr_of_records == 0:
raise StopIteration
if self.sru.startrecord < self.sru.nr_of_records + 1:
record_data = self.sru.run_query()
self.sru.startrecord += 1
return response(record_data, self.sru)
else:
raise StopIteration
class sru():
DEBUG = False
collection = False
maximumrecords = 50
nr_of_records = 0
query = ""
recordschema = False
sru_collections = SETS
startrecord = 0
def search(self, query, collection=False,
startrecord=1, maximumrecords=1, recordschema=False):
self.maximumrecords = maximumrecords
if sys.version.startswith('3'):
self.query = urllib.parse.quote_plus(query)
elif sys.version.startswith('2'):
self.query = urllib.quote_plus(query)
self.startrecord = startrecord
if collection not in self.sru_collections:
raise Exception('Unknown collection')
self.collection = self.sru_collections[collection]['collection']
if not self.collection:
raise Exception('Error, no collection specified')
if not recordschema:
self.recordschema = self.sru_collections[collection]['recordschema']
else:
self.recordschema = recordschema
record_data = self.run_query()
nr_of_records = [i.text for i in record_data.iter() if
i.tag.endswith('numberOfRecords')][0]
self.nr_of_records = int(nr_of_records)
if self.nr_of_records > 0:
return response(record_data, self)
return False
def run_query(self):
url = SRU_BASEURL % (self.maximumrecords, self.startrecord,
self.recordschema, self.collection, self.query)
if self.DEBUG:
sys.stdout.write(url)
r = requests.get(url)
if not r.status_code == 200:
raise Exception('Error while getting data from %s' % url)
record_data = etree.fromstring(r.content)
return record_data
| {
"content_hash": "ac41b440b1d784cc69f13a1c0f788d1b",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 106,
"avg_line_length": 36.633720930232556,
"alnum_prop": 0.5153943818441518,
"repo_name": "KBNLresearch/omSipCreator",
"id": "4d986bc4e8b34e71f5af799c5a0cb6fff78aa276",
"size": "12625",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "omSipCreator/kbapi/sru.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "106535"
},
{
"name": "Shell",
"bytes": "849"
}
],
"symlink_target": ""
} |
<?php
namespace Oro\Bundle\EmailBundle\Tests\Unit\Manager;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManager;
use Gaufrette\Filesystem;
use Symfony\Component\HttpFoundation\File\File as ComponentFile;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Oro\Bundle\AttachmentBundle\Manager\FileManager;
use Oro\Bundle\AttachmentBundle\Validator\ConfigFileValidator;
use Oro\Bundle\EmailBundle\Cache\EmailCacheManager;
use Oro\Bundle\EmailBundle\Decoder\ContentDecoder;
use Oro\Bundle\EmailBundle\Entity\EmailAttachment;
use Oro\Bundle\EmailBundle\Manager\EmailAttachmentManager;
use Oro\Bundle\EmailBundle\Tests\Unit\Fixtures\Entity\SomeEntity;
use Oro\Bundle\EmailBundle\Tests\Unit\ReflectionUtil;
use Oro\Bundle\EmailBundle\Provider\EmailActivityListProvider;
use Oro\Bundle\AttachmentBundle\Entity\Attachment;
/**
* Class EmailAttachmentManagerTest
*
* @package Oro\Bundle\EmailBundle\Tests\Unit\Manager
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class EmailAttachmentManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var EmailAttachmentManager
*/
protected $emailAttachmentManager;
/**
* @var FileManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $fileManager;
/**
* @var EmailCacheManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $emailCacheManager;
/**
* @var Filesystem|\PHPUnit_Framework_MockObject_MockObject
*/
protected $filesystem;
/**
* @var Registry|\PHPUnit_Framework_MockObject_MockObject
*/
protected $registry;
/**
* @var ConfigFileValidator|\PHPUnit_Framework_MockObject_MockObject
*/
protected $configFileValidator;
/** @var \PHPUnit_Framework_MockObject_MockObject */
protected $router;
/**
* @var ObjectManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $om;
/**
* @var EmailActivityListProvider|\PHPUnit_Framework_MockObject_MockObject
*/
protected $activityListProvider;
/**
* @var EntityManager|\PHPUnit_Framework_MockObject_MockObject
*/
protected $em;
/**
* @var Attachment|\PHPUnit_Framework_MockObject_MockObject
*/
protected $attachment;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
protected $attachmentAssociationHelper;
protected function setUp()
{
$this->fileManager = $this->getMockBuilder('Oro\Bundle\AttachmentBundle\Manager\FileManager')
->disableOriginalConstructor()
->getMock();
$this->emailCacheManager = $this->getMockBuilder('Oro\Bundle\EmailBundle\Cache\EmailCacheManager')
->disableOriginalConstructor()
->getMock();
$this->registry = $this->getMockBuilder('Doctrine\Bundle\DoctrineBundle\Registry')
->disableOriginalConstructor()
->getMock();
$this->configFileValidator = $this->getMockBuilder('Oro\Bundle\AttachmentBundle\Validator\ConfigFileValidator')
->disableOriginalConstructor()
->getMock();
$this->router = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\Router')
->disableOriginalConstructor()
->getMock();
$this->om = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectManager')
->disableOriginalConstructor()
->getMock();
$this->registry->expects($this->any())
->method('getManager')
->will($this->returnValue($this->om));
$this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
->disableOriginalConstructor()
->getMock();
$this->attachment = $this->getMockBuilder('Oro\Bundle\AttachmentBundle\Entity\Attachment')
->setMethods(['supportTarget', 'setFile'])
->disableOriginalConstructor()
->getMock();
$this->attachmentAssociationHelper = $this
->getMockBuilder('Oro\Bundle\AttachmentBundle\Tools\AttachmentAssociationHelper')
->disableOriginalConstructor()
->getMock();
$this->emailAttachmentManager = new EmailAttachmentManager(
$this->fileManager,
$this->em,
$this->router,
$this->configFileValidator,
$this->attachmentAssociationHelper
);
}
public function testLinkEmailAttachmentToTargetEntity()
{
$emailAttachment = new EmailAttachment();
ReflectionUtil::setId($emailAttachment, 1);
$emailAttachment->setContent($this->getContentMock());
$file = new ComponentFile(__DIR__ . '/../Fixtures/attachment/test.txt');
$this->fileManager->expects($this->once())
->method('writeToTemporaryFile')
->with(
ContentDecoder::decode(
$emailAttachment->getContent()->getContent(),
$emailAttachment->getContent()->getContentTransferEncoding()
)
)
->willReturn($file);
$this->configFileValidator->expects($this->once())
->method('validate')
->willReturn($this->createMock('Countable'));
$this->emailAttachmentManager->linkEmailAttachmentToTargetEntity($emailAttachment, new SomeEntity());
$expectedFile = new UploadedFile(
$file->getPathname(),
$emailAttachment->getFileName(),
$emailAttachment->getContentType()
);
$this->assertEquals($expectedFile, $emailAttachment->getFile()->getFile());
}
public function testLinkEmailAttachmentToTargetEntityNotValid()
{
$file = $this->getMockBuilder('Oro\Bundle\AttachmentBundle\Entity\File')
->setMethods(['getFilename'])
->getMock();
$countable = $this->getMockBuilder('Countable')->getMock();
$countable->expects($this->never())
->method('count')
->will($this->returnValue(2));
$this->configFileValidator->expects($this->never())
->method('validate')
->will($this->returnValue($countable));
$emailAttachment = $this->getEmailAttachment();
$emailAttachment->expects($this->any())
->method('getFile')
->will($this->returnValue($file));
$this->emailAttachmentManager->linkEmailAttachmentToTargetEntity($emailAttachment, new SomeEntity());
}
public function testGetResizedImageUrl()
{
$emailAttachment = $this->getEmailAttachment();
$this->router->expects($this->once())
->method('generate')
->with(
'oro_resize_email_attachment',
[
'width' => 100,
'height' => 50,
'id' => 1,
]
);
$this->emailAttachmentManager->getResizedImageUrl($emailAttachment, 100, 50);
}
protected function getContentMock()
{
$content = $this->getMockBuilder('Oro\Bundle\EmailBundle\Entity\EmailAttachmentContent')
->getMock();
$content->expects($this->any())
->method('getContent')
->will($this->returnValue('content'));
$content->expects($this->any())
->method('getContentTransferEncoding')
->will($this->returnValue('base64'));
return $content;
}
protected function getEmailAttachment()
{
$emailAttachment = $this->getMockBuilder('Oro\Bundle\EmailBundle\Entity\EmailAttachment')
->setMethods(['getContent', 'setFile', 'getFile', 'getId'])
->disableOriginalConstructor()
->getMock();
$emailAttachment->expects($this->any())
->method('getContent')
->will($this->returnValue($this->getContentMock()));
$emailAttachment->expects($this->any())
->method('getId')
->will($this->returnValue(1));
return $emailAttachment;
}
/**
* @param EmailAttachment $emailAttachment
* @return \PHPUnit_Framework_MockObject_MockObject
*/
protected function getEmailMock(EmailAttachment $emailAttachment)
{
$email = $this->getMockBuilder('Oro\Bundle\EmailBundle\Entity\Email')
->setMethods(['getEmailBody', 'getAttachments'])
->disableOriginalConstructor()
->getMock();
$email->expects($this->any())
->method('getEmailBody')
->will($this->returnValue($email));
$email->expects($this->any())
->method('getAttachments')
->will($this->returnValue([$emailAttachment]));
return $email;
}
}
| {
"content_hash": "868e3411caa8e7f18facc77ee493aeb5",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 119,
"avg_line_length": 33.246212121212125,
"alnum_prop": 0.6248148570126467,
"repo_name": "geoffroycochard/platform",
"id": "6169ef31d9c4a045bb644c6a15280ef37eb406f1",
"size": "8777",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Oro/Bundle/EmailBundle/Tests/Unit/Manager/EmailAttachmentManagerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "583679"
},
{
"name": "Cucumber",
"bytes": "660"
},
{
"name": "HTML",
"bytes": "1342329"
},
{
"name": "JavaScript",
"bytes": "4589734"
},
{
"name": "PHP",
"bytes": "19492046"
}
],
"symlink_target": ""
} |
class FixNilDescriptions < ActiveRecord::Migration[4.2]
class DraftContentItem < ApplicationRecord; end
class LiveContentItem < ApplicationRecord; end
def up
models = [DraftContentItem, LiveContentItem]
models.each do |m|
m.find_each do |item|
description = item.description
if description.is_a?(Hash)
item.description = description.fetch(:value)
item.save!(validate: false)
end
end
end
end
def down
# noop
end
end
| {
"content_hash": "e97916be7a8173fb63b623a7fa3b78a9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 55,
"avg_line_length": 21.869565217391305,
"alnum_prop": 0.6540755467196819,
"repo_name": "alphagov/publishing-api",
"id": "70a464c0b8eaf4e1b91fcada960c37403d091e10",
"size": "603",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "db/migrate/20160111093455_fix_nil_descriptions.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "513"
},
{
"name": "HTML",
"bytes": "4697"
},
{
"name": "Jsonnet",
"bytes": "250674"
},
{
"name": "Procfile",
"bytes": "117"
},
{
"name": "Ruby",
"bytes": "1016335"
}
],
"symlink_target": ""
} |
require "spec_helper"
require "rubocop"
RSpec.describe 'CI' do
before(:all) do
drop_dummy_database
remove_project_directory
create_dummy_project
end
it "correctly bundles the config file" do
yml_path = "#{project_path}/.circleci/config.yml"
content = IO.read(yml_path)
expect(File.exist?(yml_path)).to be true
expect(content).to include('cimg/ruby', 'cache', 'rspec', 'reviewdog')
end
end
| {
"content_hash": "915c840710fabce5e345ea9e55f9fba9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 74,
"avg_line_length": 25.11764705882353,
"alnum_prop": 0.6838407494145199,
"repo_name": "platanus/potassium",
"id": "e0d3bde1b3406f26cf347caf2cc71c01d6edc924",
"size": "427",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/features/ci_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "11445"
},
{
"name": "JavaScript",
"bytes": "1476"
},
{
"name": "Procfile",
"bytes": "63"
},
{
"name": "Ruby",
"bytes": "163591"
},
{
"name": "Shell",
"bytes": "1780"
},
{
"name": "TypeScript",
"bytes": "2729"
},
{
"name": "Vue",
"bytes": "623"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><!-- NAME: 1 COLUMN -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EESoc - Imperial College London</title>
<!--[if gte mso 6]>
<style>
table.mcnFollowContent {width:100% !important;}
table.mcnShareContent {width:100% !important;}
</style>
<![endif]-->
<style type="text/css">
body,#bodyTable,#bodyCell{
font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
height:100% !important;
margin:0;
padding:0;
width:100% !important;
}
table{
border-collapse:collapse;
}
img,a img{
border:0;
outline:none;
text-decoration:none;
}
h1,h2,h3,h4,h5,h6{
margin:0;
padding:0;
}
p{
margin:1em 0;
}
a{
word-wrap:break-word;
}
.ReadMsgBody{
width:100%;
}
.ExternalClass{
width:100%;
}
.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{
line-height:100%;
}
table,td{
mso-table-lspace:0pt;
mso-table-rspace:0pt;
}
#outlook a{
padding:0;
}
img{
-ms-interpolation-mode:bicubic;
}
body,table,td,p,a,li,blockquote{
-ms-text-size-adjust:100%;
-webkit-text-size-adjust:100%;
}
#bodyCell{
padding:20px;
}
.mcnImage{
vertical-align:bottom;
}
.mcnTextContent img{
height:auto !important;
}
body,#bodyTable{
background-color:#F0F0FA;
}
#bodyCell{
border-top:0;
}
#templateContainer{
border:0;
}
h1{
color:#606060 !important;
display:block;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:40px;
font-style:normal;
font-weight:bold;
line-height:125%;
letter-spacing:-1px;
margin:0;
text-align:left;
}
h2{
color:#404040 !important;
display:block;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:26px;
font-style:normal;
font-weight:bold;
line-height:125%;
letter-spacing:-.75px;
margin:0;
text-align:left;
}
h3{
color:#606060 !important;
display:block;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:18px;
font-style:normal;
font-weight:bold;
line-height:125%;
letter-spacing:-.5px;
margin:0;
text-align:left;
}
h4{
color:#808080 !important;
display:block;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:16px;
font-style:normal;
font-weight:bold;
line-height:125%;
letter-spacing:normal;
margin:0;
text-align:left;
}
#templatePreheader{
background-color:#FFFFFF;
border-top:0;
border-bottom:0;
}
.preheaderContainer .mcnTextContent,.preheaderContainer .mcnTextContent p{
color:#606060;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:14px;
line-height:125%;
text-align:left;
}
.preheaderContainer .mcnTextContent a{
color:#606060;
font-weight:normal;
text-decoration:underline;
}
#templateHeader{
background-color:#FFFFFF;
border-top:0;
border-bottom:0;
}
.headerContainer .mcnTextContent,.headerContainer .mcnTextContent p{
color:#606060;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:14px;
line-height:150%;
text-align:left;
}
.headerContainer .mcnTextContent a{
color:#6DC6DD;
font-weight:normal;
text-decoration:underline;
}
#templateBody{
background-color:#FFFFFF;
border-top:0;
border-bottom:0;
}
.bodyContainer .mcnTextContent,.bodyContainer .mcnTextContent p{
color:#606060;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:14px;
line-height:150%;
text-align:left;
}
.bodyContainer .mcnTextContent a{
color:#6DC6DD;
font-weight:normal;
text-decoration:underline;
}
#templateFooter{
background-color:#FFFFFF;
border-top:0;
border-bottom:0;
}
.footerContainer .mcnTextContent,.footerContainer .mcnTextContent p{
color:#ffffff;
font-family:HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;
font-size:11px;
line-height:125%;
text-align:left;
}
.footerContainer .mcnTextContent a{
color:#ffffff;
font-weight:normal;
text-decoration:underline;
}
@media only screen and (max-width: 480px){
body,table,td,p,a,li,blockquote{
-webkit-text-size-adjust:none !important;
}
} @media only screen and (max-width: 480px){
body{
width:100% !important;
min-width:100% !important;
}
} @media only screen and (max-width: 480px){
td[id=bodyCell]{
padding:10px !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnTextContentContainer]{
width:100% !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnBoxedTextContentContainer]{
width:100% !important;
}
} @media only screen and (max-width: 480px){
table[class=mcpreview-image-uploader]{
width:100% !important;
display:none !important;
}
} @media only screen and (max-width: 480px){
img[class=mcnImage]{
width:100% !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnImageGroupContentContainer]{
width:100% !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageGroupContent]{
padding:9px !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageGroupBlockInner]{
padding-bottom:0 !important;
padding-top:0 !important;
}
} @media only screen and (max-width: 480px){
tbody[class=mcnImageGroupBlockOuter]{
padding-bottom:9px !important;
padding-top:9px !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnCaptionTopContent],table[class=mcnCaptionBottomContent]{
width:100% !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnCaptionLeftTextContentContainer],table[class=mcnCaptionRightTextContentContainer],table[class=mcnCaptionLeftImageContentContainer],table[class=mcnCaptionRightImageContentContainer],table[class=mcnImageCardLeftTextContentContainer],table[class=mcnImageCardRightTextContentContainer]{
width:100% !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageCardLeftImageContent],td[class=mcnImageCardRightImageContent]{
padding-right:18px !important;
padding-left:18px !important;
padding-bottom:0 !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageCardBottomImageContent]{
padding-bottom:9px !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageCardTopImageContent]{
padding-top:18px !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageCardLeftImageContent],td[class=mcnImageCardRightImageContent]{
padding-right:18px !important;
padding-left:18px !important;
padding-bottom:0 !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageCardBottomImageContent]{
padding-bottom:9px !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnImageCardTopImageContent]{
padding-top:18px !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnCaptionLeftContentOuter] td[class=mcnTextContent],table[class=mcnCaptionRightContentOuter] td[class=mcnTextContent]{
padding-top:14px !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnCaptionBlockInner] table[class=mcnCaptionTopContent]:last-child td[class=mcnTextContent]{
padding-top:18px !important;
}
} @media only screen and (max-width: 480px){
td[class=mcnBoxedTextContentColumn]{
padding-left:18px !important;
padding-right:18px !important;
}
} @media only screen and (max-width: 480px){
table[id=templateContainer],table[id=templatePreheader],table[id=templateHeader],table[id=templateBody],table[id=templateFooter]{
max-width:600px !important;
width:100% !important;
}
} @media only screen and (max-width: 480px){
h1{
font-size:38px !important;
line-height:125% !important;
}
} @media only screen and (max-width: 480px){
h2{
font-size:35px !important;
line-height:125% !important;
}
} @media only screen and (max-width: 480px){
h3{
font-size:32px !important;
line-height:125% !important;
}
} @media only screen and (max-width: 480px){
h4{
font-size:16px !important;
line-height:125% !important;
}
} @media only screen and (max-width: 480px){
table[class=mcnBoxedTextContentContainer] td[class=mcnTextContent]{
font-size:18px !important;
line-height:125% !important;
}
} @media only screen and (max-width: 480px){
table[id=templatePreheader]{
display:block !important;
}
} @media only screen and (max-width: 480px){
td[class=preheaderContainer] td[class=mcnTextContent]{
font-size:14px !important;
line-height:115% !important;
padding-right:18px !important;
padding-left:18px !important;
}
} @media only screen and (max-width: 480px){
td[class=headerContainer] td[class=mcnTextContent]{
font-size:22px !important;
line-height:125% !important;
padding-right:18px !important;
padding-left:18px !important;
}
} @media only screen and (max-width: 480px){
td[class=bodyContainer] td[class=mcnTextContent]{
font-size:22px !important;
line-height:125% !important;
padding-right:18px !important;
padding-left:18px !important;
}
} @media only screen and (max-width: 480px){
td[class=footerContainer] td[class=mcnTextContent]{
font-size:22px !important;
line-height:115% !important;
padding-right:18px !important;
padding-left:18px !important;
}
} @media only screen and (max-width: 480px){
td[class=footerContainer] a[class=utilityLink]{
display:block !important;
}
td[class=bodyContainer] td[class=mcnTextContent] p {
font-size: 22px !important;
}
}</style>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="margin: 0;padding: 0;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: #F0F0FA;height: 100% !important;width: 100% !important;">
<center>
<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin: 0;padding: 0;background-color: #123570;height: 100% !important;width: 100% !important; background-image: url('https://eesoc.com/assets/email/20141006/bg.png'); background-position: top right; background-repeat: no-repeat;">
<tbody><tr>
<td align="center" valign="top" id="bodyCell" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin: 0;padding: 30px 20px 20px;border-top: 0;height: 100% !important;width: 100% !important;">
<!-- BEGIN TEMPLATE // -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border: 0; border: thin solid #cccccc;">
<tbody><tr>
<td align="center" valign="top" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<!-- BEGIN PREHEADER // -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templatePreheader" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: #FFFFFF; border-top: 0;border-bottom: 0;">
<tbody><tr>
<td valign="top" class="preheaderContainer" style="padding-top: 9px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnTextBlockOuter">
<tr>
<td valign="top" class="mcnTextBlockInner" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="600" class="mcnTextContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td valign="top" class="mcnTextContent" style="padding-top: 9px;padding-left: 18px;padding-bottom: 9px;padding-right: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #606060;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 11px;line-height: 125%;text-align: left;">
EESoc, the Society for all students of the Department of Electrical & Electronic Engineering at Imperial College London
</td>
</tr>
</tbody></table>
<table align="right" border="0" cellpadding="0" cellspacing="0" width="197" class="mcnTextContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td valign="top" class="mcnTextContent" style="padding-top: 9px;padding-right: 18px;padding-bottom: 9px;padding-left: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #606060;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 11px;line-height: 125%;text-align: left;">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>
<!-- // END PREHEADER -->
</td>
</tr>
<tr>
<td align="center" valign="top" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<!-- BEGIN HEADER // -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: #FFFFFF;border-top: 0;border-bottom: 0;">
<tbody><tr>
<td valign="top" class="headerContainer" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnImageBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnImageBlockOuter">
<tr>
<td valign="top" style="padding: 9px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;" class="mcnImageBlockInner">
<table align="left" width="100%" border="0" cellpadding="0" cellspacing="0" class="mcnImageContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td class="mcnImageContent" align="center" valign="top" style="padding-right: 9px;padding-left: 9px;padding-top: 0;padding-bottom: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<a href="http://bit.ly/19yZzh9"><img align="center" alt="" src="https://eesoc.com/assets/email/20141006/logo.jpg" width="400" style="max-width: 400px;padding-bottom: 0;display: inline !important;vertical-align: bottom;border: 0;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;" class="mcnImage"></a>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>
<!-- // END HEADER -->
</td>
</tr>
<tr>
<td align="center" valign="top" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<!-- BEGIN BODY // -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: #FFFFFF;border-top: 0;border-bottom: 0;">
<tbody><tr>
<td valign="top" class="bodyContainer" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnTextBlockOuter">
<tr>
<td valign="top" class="mcnTextBlockInner" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="600" class="mcnTextContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td valign="top" class="mcnTextContent" style="padding-top: 9px;padding-right: 18px;padding-bottom: 9px;padding-left: 18px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #606060;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 15px;line-height: 150%;text-align: left;">
<?php
$html = \Michelf\Markdown::defaultTransform($body);
$html = str_replace('<p>', "<p style=\"margin: 1em 0;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #606060;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 14px;line-height: 150%;text-align: left;\">", $html);
$html = str_replace('<h1>', "<h1 style=\"margin: 0;padding: 0;display: block;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 35px;font-style: normal;font-weight: 300;line-height: 125%;letter-spacing: -.5px;text-align: left;color: #606060 !important;\">", $html);
$html = str_replace('<h2>', "<h2 style=\"margin: 0;padding: 0;display: block;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 35px;font-style: normal;font-weight: 300;line-height: 125%;letter-spacing: -.5px;text-align: left;color: #606060 !important;\">", $html);
$html = str_replace('<h3>', "<h3 style=\"margin: 0;padding: 0;display: block;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 35px;font-style: normal;font-weight: 300;line-height: 125%;letter-spacing: -.5px;text-align: left;color: #606060 !important;\">", $html);
echo $html;
?>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>
<!-- // END BODY -->
</td>
</tr>
<tr>
<td align="center" valign="top" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<!-- BEGIN FOOTER // -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="templateFooter" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;background-color: #FFFFFF;border-top: 0;border-bottom: 0;">
<tbody><tr>
<td valign="top" class="footerContainer" style="padding-bottom: 9px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnDividerBlockOuter">
<tr>
<td class="mcnDividerBlockInner" style="padding: 10px 18px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-top-width: 1px;border-top-style: solid;border-top-color: #CCCCCC;border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<span></span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnTextBlockOuter">
<tr>
<td valign="top" class="mcnTextBlockInner" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="600" class="mcnTextContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td valign="top" class="mcnTextContent" style="padding-top: 9px;padding-right: 18px;padding-bottom: 9px;padding-left: 18px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #606060;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 13px;line-height: 125%;text-align: left;">
<div style="text-align: center;">
Sponsored by<br><br>
<img src="https://eesoc.com/assets/email/201920/sponsors.png" width="500" height="123" style="width: 500px; height: 123px;">
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>
<!-- // END FOOTER -->
</td>
</tr>
</tbody></table>
<!-- // END TEMPLATE -->
</td>
</tr>
<tr>
<td align="center" valign="top" id="bodyCell" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;margin: 0;padding: 20px;border-top: 0;height: 100% !important;width: 100% !important;">
<table border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;border-top: 0;border-bottom: 0;">
<tbody><tr>
<td valign="top" class="footerContainer" style="padding-bottom: 9px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnTextBlockOuter">
<tr>
<td valign="top" class="mcnTextBlockInner" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="600" class="mcnTextContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td valign="top" class="mcnTextContent" style="padding-top: 9px;padding-right: 18px;padding-bottom: 9px;padding-left: 18px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #ffffff;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 11px;line-height: 125%;text-align: left;">
<div style="text-align: center;">
<i>Be social - stay in touch</i><br><br>
<a href="http://on.fb.me/1fhTYE3"><img width="30" style="width: 30px;" src="https://eesoc.com/assets/email/20141006/fb.png"></a>
<a href="http://bit.ly/16wDPG7"><img width="30" style="width: 30px;" src="https://eesoc.com/assets/email/20141006/tw.png"></a>
<a href="http://bit.ly/16QRRVn"><img width="30" style="width: 30px;" src="https://eesoc.com/assets/email/20141006/in.png"></a>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody class="mcnTextBlockOuter">
<tr>
<td valign="top" class="mcnTextBlockInner" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="600" class="mcnTextContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td valign="top" class="mcnTextContent" style="padding-top: 9px;padding-right: 18px;padding-bottom: 9px;padding-left: 18px;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;color: #ffffff;font-family: HelveticaNeue-Light, 'Helvetica Neue Light', 'Helvetica Neue', 'Trade Gothic W01 Light', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size: 11px;line-height: 125%;text-align: left;">
<div style="text-align: center;">
<span style="text-align: center;"><a href="http://bit.ly/1a9ETgL">eesoc.com</a></span><br>
<span style="text-align: center;"><a href="mailto:[email protected]">[email protected]</a></span></div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</center>
<tracking_pixel>
</body></html>
| {
"content_hash": "d1d3b8e3874cf4915b3a9f42da4d5dfd",
"timestamp": "",
"source": "github",
"line_count": 637,
"max_line_length": 485,
"avg_line_length": 50.19152276295134,
"alnum_prop": 0.6020267734267484,
"repo_name": "EESoc/eesoc-website",
"id": "35cd98abb24505f4b748719c88548c0e8cdb051b",
"size": "31972",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/views/email_layouts/newsletter.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "309140"
},
{
"name": "HTML",
"bytes": "1090470"
},
{
"name": "Hack",
"bytes": "398247"
},
{
"name": "JavaScript",
"bytes": "973591"
},
{
"name": "PHP",
"bytes": "466650"
}
],
"symlink_target": ""
} |
module RepoManager
# An abstract superclass for basic action functionality specific to an
# application implementation. Put application specific code here.
class AppAction < BaseAction
# Used by asset factory to create assets. Override in app_action.rb or a
# descendant to set the class to be instantiated by by the AssetManager.
#
# @return [Symbol] asset type
def asset_type
:repo_asset
end
# alias for items/assets
#
# @return [Array] of repos
def repos
items
end
end
end
| {
"content_hash": "daf2a9543509defdfbd24c3738e454dd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 23.73913043478261,
"alnum_prop": 0.6831501831501832,
"repo_name": "robertwahler/repo_manager",
"id": "8aeea286c2c8b6d10c8632e128ba34b2a9f1dfb0",
"size": "824",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/repo_manager/actions/app_action.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "676"
},
{
"name": "Gherkin",
"bytes": "76484"
},
{
"name": "HTML",
"bytes": "2117"
},
{
"name": "Ruby",
"bytes": "136063"
}
],
"symlink_target": ""
} |
from __future__ import print_function
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
import mock
import os
import subprocess
from helpers import unittest
from luigi import six
import luigi
import luigi.cmdline
from luigi.mock import MockTarget
class SomeTask(luigi.Task):
n = luigi.IntParameter()
def output(self):
return MockTarget('/tmp/test_%d' % self.n)
def run(self):
f = self.output().open('w')
f.write('done')
f.close()
class AmbiguousClass(luigi.Task):
pass
class AmbiguousClass(luigi.Task): # NOQA
pass
class TaskWithSameName(luigi.Task):
def run(self):
self.x = 42
class TaskWithSameName(luigi.Task): # NOQA
# there should be no ambiguity
def run(self):
self.x = 43
class WriteToFile(luigi.Task):
filename = luigi.Parameter()
def output(self):
return luigi.LocalTarget(self.filename)
def run(self):
f = self.output().open('w')
print('foo', file=f)
f.close()
class FooBaseClass(luigi.Task):
x = luigi.Parameter(default='foo_base_default')
class FooSubClass(FooBaseClass):
pass
class ATaskThatFails(luigi.Task):
def run(self):
raise ValueError()
class CmdlineTest(unittest.TestCase):
def setUp(self):
MockTarget.fs.clear()
@mock.patch("logging.getLogger")
def test_cmdline_main_task_cls(self, logger):
luigi.run(['--local-scheduler', '--no-lock', '--n', '100'], main_task_cls=SomeTask)
self.assertEqual(dict(MockTarget.fs.get_all_data()), {'/tmp/test_100': b'done'})
@mock.patch("logging.getLogger")
def test_cmdline_local_scheduler(self, logger):
luigi.run(['SomeTask', '--no-lock', '--n', '101'], local_scheduler=True)
self.assertEqual(dict(MockTarget.fs.get_all_data()), {'/tmp/test_101': b'done'})
@mock.patch("logging.getLogger")
def test_cmdline_other_task(self, logger):
luigi.run(['--local-scheduler', '--no-lock', 'SomeTask', '--n', '1000'])
self.assertEqual(dict(MockTarget.fs.get_all_data()), {'/tmp/test_1000': b'done'})
@mock.patch("logging.getLogger")
def test_cmdline_ambiguous_class(self, logger):
self.assertRaises(Exception, luigi.run, ['--local-scheduler', '--no-lock', 'AmbiguousClass'])
@mock.patch("logging.getLogger")
@mock.patch("logging.StreamHandler")
def test_setup_interface_logging(self, handler, logger):
handler.return_value = mock.Mock(name="stream_handler")
with mock.patch("luigi.interface.setup_interface_logging.has_run", new=False):
luigi.interface.setup_interface_logging()
self.assertEqual([mock.call(handler.return_value)], logger.return_value.addHandler.call_args_list)
with mock.patch("luigi.interface.setup_interface_logging.has_run", new=False):
if six.PY2:
error = ConfigParser.NoSectionError
else:
error = KeyError
self.assertRaises(error, luigi.interface.setup_interface_logging, '/blah')
@mock.patch("warnings.warn")
@mock.patch("luigi.interface.setup_interface_logging")
def test_cmdline_logger(self, setup_mock, warn):
with mock.patch("luigi.interface.core") as env_params:
env_params.return_value.logging_conf_file = ''
env_params.return_value.log_level = 'DEBUG'
env_params.return_value.parallel_scheduling_processes = 1
luigi.run(['SomeTask', '--n', '7', '--local-scheduler', '--no-lock'])
self.assertEqual([mock.call('', 'DEBUG')], setup_mock.call_args_list)
with mock.patch("luigi.configuration.get_config") as getconf:
getconf.return_value.get.side_effect = ConfigParser.NoOptionError(section='foo', option='bar')
getconf.return_value.getint.return_value = 0
luigi.interface.setup_interface_logging.call_args_list = []
luigi.run(['SomeTask', '--n', '42', '--local-scheduler', '--no-lock'])
self.assertEqual([], setup_mock.call_args_list)
@mock.patch('argparse.ArgumentParser.print_usage')
def test_non_existent_class(self, print_usage):
self.assertRaises(luigi.task_register.TaskClassNotFoundException,
luigi.run, ['--local-scheduler', '--no-lock', 'XYZ'])
@mock.patch('argparse.ArgumentParser.print_usage')
def test_no_task(self, print_usage):
self.assertRaises(SystemExit, luigi.run, ['--local-scheduler', '--no-lock'])
def test_luigid_logging_conf(self):
with mock.patch('luigi.server.run') as server_run, \
mock.patch('logging.config.fileConfig') as fileConfig:
luigi.cmdline.luigid([])
self.assertTrue(server_run.called)
# the default test configuration specifies a logging conf file
fileConfig.assert_called_with("test/testconfig/logging.cfg")
def test_luigid_no_configure_logging(self):
with mock.patch('luigi.server.run') as server_run, \
mock.patch('logging.basicConfig') as basicConfig, \
mock.patch('luigi.configuration.get_config') as get_config:
get_config.return_value.getboolean.return_value = True # no_configure_logging=True
luigi.cmdline.luigid([])
self.assertTrue(server_run.called)
self.assertTrue(basicConfig.called)
def test_luigid_no_logging_conf(self):
with mock.patch('luigi.server.run') as server_run, \
mock.patch('logging.basicConfig') as basicConfig, \
mock.patch('luigi.configuration.get_config') as get_config:
get_config.return_value.getboolean.return_value = False # no_configure_logging=False
get_config.return_value.get.return_value = None # logging_conf_file=None
luigi.cmdline.luigid([])
self.assertTrue(server_run.called)
self.assertTrue(basicConfig.called)
def test_luigid_missing_logging_conf(self):
with mock.patch('luigi.server.run') as server_run, \
mock.patch('logging.basicConfig') as basicConfig, \
mock.patch('luigi.configuration.get_config') as get_config:
get_config.return_value.getboolean.return_value = False # no_configure_logging=False
get_config.return_value.get.return_value = "nonexistent.cfg" # logging_conf_file=None
self.assertRaises(Exception, luigi.cmdline.luigid, [])
self.assertFalse(server_run.called)
self.assertFalse(basicConfig.called)
class InvokeOverCmdlineTest(unittest.TestCase):
def _run_cmdline(self, args):
env = os.environ.copy()
env['PYTHONPATH'] = env.get('PYTHONPATH', '') + ':.:test'
print('Running: ' + ' '.join(args)) # To simplify rerunning failing tests
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
stdout, stderr = p.communicate() # Unfortunately subprocess.check_output is 2.7+
return p.returncode, stdout, stderr
def test_bin_luigi(self):
t = luigi.LocalTarget(is_tmp=True)
args = ['./bin/luigi', '--module', 'cmdline_test', 'WriteToFile', '--filename', t.path, '--local-scheduler', '--no-lock']
self._run_cmdline(args)
self.assertTrue(t.exists())
def test_direct_python(self):
t = luigi.LocalTarget(is_tmp=True)
args = ['python', 'test/cmdline_test.py', 'WriteToFile', '--filename', t.path, '--local-scheduler', '--no-lock']
self._run_cmdline(args)
self.assertTrue(t.exists())
def test_python_module(self):
t = luigi.LocalTarget(is_tmp=True)
args = ['python', '-m', 'luigi', '--module', 'cmdline_test', 'WriteToFile', '--filename', t.path, '--local-scheduler', '--no-lock']
self._run_cmdline(args)
self.assertTrue(t.exists())
def test_direct_python_help(self):
returncode, stdout, stderr = self._run_cmdline(['python', 'test/cmdline_test.py', '--help-all'])
self.assertTrue(stdout.find(b'--FooBaseClass-x') != -1)
self.assertFalse(stdout.find(b'--x') != -1)
def test_direct_python_help_class(self):
returncode, stdout, stderr = self._run_cmdline(['python', 'test/cmdline_test.py', 'FooBaseClass', '--help'])
self.assertTrue(stdout.find(b'--FooBaseClass-x') != -1)
self.assertTrue(stdout.find(b'--x') != -1)
def test_bin_luigi_help(self):
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--module', 'cmdline_test', '--help-all'])
self.assertTrue(stdout.find(b'--FooBaseClass-x') != -1)
self.assertFalse(stdout.find(b'--x') != -1)
def test_python_module_luigi_help(self):
returncode, stdout, stderr = self._run_cmdline(['python', '-m', 'luigi', '--module', 'cmdline_test', '--help-all'])
self.assertTrue(stdout.find(b'--FooBaseClass-x') != -1)
self.assertFalse(stdout.find(b'--x') != -1)
def test_bin_luigi_help_no_module(self):
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--help'])
self.assertTrue(stdout.find(b'usage:') != -1)
def test_bin_luigi_help_not_spammy(self):
"""
Test that `luigi --help` fits on one screen
"""
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--help'])
self.assertLessEqual(len(stdout.splitlines()), 15)
def test_bin_luigi_all_help_spammy(self):
"""
Test that `luigi --help-all` doesn't fit on a screen
Naturally, I don't mind this test breaking, but it convinces me that
the "not spammy" test is actually testing what it claims too.
"""
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--help-all'])
self.assertGreater(len(stdout.splitlines()), 15)
def test_error_mesage_on_misspelled_task(self):
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', 'RangeDaili'])
self.assertTrue(stderr.find(b'RangeDaily') != -1)
def test_bin_luigi_no_parameters(self):
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi'])
self.assertTrue(stderr.find(b'No task specified') != -1)
def test_python_module_luigi_no_parameters(self):
returncode, stdout, stderr = self._run_cmdline(['python', '-m', 'luigi'])
self.assertTrue(stderr.find(b'No task specified') != -1)
def test_bin_luigi_help_class(self):
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--module', 'cmdline_test', 'FooBaseClass', '--help'])
self.assertTrue(stdout.find(b'--FooBaseClass-x') != -1)
self.assertTrue(stdout.find(b'--x') != -1)
def test_python_module_help_class(self):
returncode, stdout, stderr = self._run_cmdline(['python', '-m', 'luigi', '--module', 'cmdline_test', 'FooBaseClass', '--help'])
self.assertTrue(stdout.find(b'--FooBaseClass-x') != -1)
self.assertTrue(stdout.find(b'--x') != -1)
def test_bin_luigi_options_before_task(self):
args = ['./bin/luigi', '--module', 'cmdline_test', '--no-lock', '--local-scheduler', '--FooBaseClass-x', 'hello', 'FooBaseClass']
returncode, stdout, stderr = self._run_cmdline(args)
self.assertEqual(0, returncode)
def test_bin_fail_on_unrecognized_args(self):
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--no-lock', '--local-scheduler', 'Task', '--unknown-param', 'hiiii'])
self.assertNotEqual(0, returncode)
def test_deps_py_script(self):
"""
Test the deps.py script.
"""
args = 'python luigi/tools/deps.py --module examples.top_artists ArtistToplistToDatabase --date-interval 2015-W10'.split()
returncode, stdout, stderr = self._run_cmdline(args)
self.assertEqual(0, returncode)
self.assertTrue(stdout.find(b'[FileSystem] data/streams_2015_03_04_faked.tsv') != -1)
self.assertTrue(stdout.find(b'[DB] localhost') != -1)
def test_deps_tree_py_script(self):
"""
Test the deps_tree.py script.
"""
args = 'python luigi/tools/deps_tree.py --module examples.top_artists AggregateArtists --date-interval 2012-06'.split()
returncode, stdout, stderr = self._run_cmdline(args)
self.assertEqual(0, returncode)
for i in range(1, 30):
self.assertTrue(stdout.find(("-[Streams-{{'date': '2012-06-{0}'}}".format(str(i).zfill(2))).encode('utf-8')) != -1)
def test_bin_mentions_misspelled_task(self):
"""
Test that the error message is informative when a task is misspelled.
In particular it should say that the task is misspelled and not that
the local parameters do not exist.
"""
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--module', 'cmdline_test', 'HooBaseClass', '--x 5'])
self.assertTrue(stderr.find(b'FooBaseClass') != -1)
self.assertTrue(stderr.find(b'--x') != 0)
def test_stack_trace_has_no_inner(self):
"""
Test that the stack trace for failing tasks are short
The stack trace shouldn't contain unreasonably much implementation
details of luigi In particular it should say that the task is
misspelled and not that the local parameters do not exist.
"""
returncode, stdout, stderr = self._run_cmdline(['./bin/luigi', '--module', 'cmdline_test', 'ATaskThatFails', '--local-scheduler', '--no-lock'])
print(stdout)
self.assertFalse(stdout.find(b"run() got an unexpected keyword argument 'tracking_url_callback'") != -1)
self.assertFalse(stdout.find(b'During handling of the above exception, another exception occurred') != -1)
if __name__ == '__main__':
# Needed for one of the tests
luigi.run()
| {
"content_hash": "80325f63ca5f8cd302390e8437243021",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 151,
"avg_line_length": 42.209726443769,
"alnum_prop": 0.6297256426874055,
"repo_name": "edx/luigi",
"id": "feaea5db62b842f6b28e7205e960b246866341b0",
"size": "14490",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "test/cmdline_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "5051"
},
{
"name": "HTML",
"bytes": "39013"
},
{
"name": "JavaScript",
"bytes": "166869"
},
{
"name": "Python",
"bytes": "1800278"
},
{
"name": "Shell",
"bytes": "2627"
}
],
"symlink_target": ""
} |
"""
* Copyright 2007,2008,2009 John C. Gunther
* Copyright (C) 2009 Luke Kenneth Casson Leighton <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http:#www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
"""
from pyjamas import DOM
from pyjamas import Window
from pyjamas.ui import Event
from pyjamas.ui.AbsolutePanel import AbsolutePanel
from pyjamas.ui.Composite import Composite
from pyjamas.ui.Grid import Grid
from pyjamas.ui import HasHorizontalAlignment
from pyjamas.ui import HasVerticalAlignment
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Image import Image
from pyjamas.ui.SimplePanel import SimplePanel
from pyjamas.ui.UIObject import UIObject
from pyjamas.ui.Widget import Widget
from pyjamas.chart.GChartConsts import NAI, DEFAULT_X_CHARTSIZE, DEFAULT_Y_CHARTSIZE
from pyjamas.chart.GChartConsts import USE_CSS
from pyjamas.chart.GChartConsts import Y_AXIS
from pyjamas.chart.GChartConsts import DEFAULT_BLANK_IMAGE_URL_FULLPATH
from pyjamas.chart.GChartConsts import DEFAULT_SYMBOL_BORDER_COLORS
from pyjamas.chart.GChartConsts import DEFAULT_LEGEND_BACKGROUND_COLOR
from pyjamas.chart.GChartConsts import N_SYSTEM_CURVES
from pyjamas.chart.GChartConsts import DEFAULT_LEGEND_BORDER_COLOR
from pyjamas.chart.GChartConsts import DEFAULT_LEGEND_BORDER_WIDTH
from pyjamas.chart.GChartConsts import DEFAULT_LEGEND_BORDER_STYLE
from pyjamas.chart.GChartConsts import DEFAULT_FONT_COLOR
from pyjamas.chart.GChartConsts import DEFAULT_LEGEND_FONTSIZE
from pyjamas.chart.GChartConsts import DEFAULT_FONT_STYLE
from pyjamas.chart.GChartConsts import DEFAULT_FONT_WEIGHT
from pyjamas.chart.GChartConsts import DEFAULT_PLOTAREA_BACKGROUND_COLOR
from pyjamas.chart.GChartConsts import DEFAULT_PLOTAREA_BORDER_COLOR
from pyjamas.chart.GChartConsts import DEFAULT_PLOTAREA_BORDER_STYLE
from pyjamas.chart.GChartConsts import DEFAULT_PLOTAREA_BORDER_WIDTH
from pyjamas.chart.GChartConsts import PLOTAREA_ID
from pyjamas.chart.GChartConsts import TITLE_ID
from pyjamas.chart.GChartConsts import YAXIS_ID
from pyjamas.chart.GChartConsts import YTICKS_ID
from pyjamas.chart.GChartConsts import YGRIDLINES_ID
from pyjamas.chart.GChartConsts import YLABEL_ID
from pyjamas.chart.GChartConsts import Y2AXIS_ID
from pyjamas.chart.GChartConsts import Y2TICKS_ID
from pyjamas.chart.GChartConsts import Y2GRIDLINES_ID
from pyjamas.chart.GChartConsts import Y2LABEL_ID
from pyjamas.chart.GChartConsts import LEGEND_ID
from pyjamas.chart.GChartConsts import XAXIS_ID
from pyjamas.chart.GChartConsts import XTICKS_ID
from pyjamas.chart.GChartConsts import XGRIDLINES_ID
from pyjamas.chart.GChartConsts import XLABEL_ID
from pyjamas.chart.GChartConsts import FOOTNOTES_ID
from pyjamas.chart.GChartConsts import HOVER_CURSOR_ID
from pyjamas.chart.GChartConsts import HOVER_ANNOTATION_ID
from pyjamas.chart.GChartConsts import N_PRE_SYSTEM_CURVES
from pyjamas.chart.GChartConsts import N_POST_SYSTEM_CURVES
from pyjamas.chart.GChartConsts import DEFAULT_GRID_COLOR
from pyjamas.chart.GChartConsts import GRID_BORDER_STYLE
from pyjamas.chart.GChartConsts import GRID_BORDER_WIDTH
from pyjamas.chart.GChartConsts import DEFAULT_GRID_WIDTH
from pyjamas.chart.GChartConsts import DEFAULT_GRID_HEIGHT
from pyjamas.chart.GChartConsts import TICK_BORDER_STYLE
from pyjamas.chart.GChartConsts import TICK_BORDER_WIDTH
from pyjamas.chart.GChartConsts import Y2_AXIS
from pyjamas.chart.GChartConsts import DEFAULT_TITLE_THICKNESS
from pyjamas.chart.GChartConsts import DEFAULT_FOOTNOTES_THICKNESS
from pyjamas.chart.GChartConsts import TICK_CHARWIDTH_TO_FONTSIZE_LOWERBOUND
from pyjamas.chart.GChartConsts import TRANSPARENT_BORDER_COLOR
from pyjamas.chart.GChartConsts import YAxisId
from pyjamas.chart import Double
from pyjamas.chart import AnnotationLocation
from pyjamas.chart import SymbolType
from pyjamas.chart import TickLocation
from pyjamas.chart import TouchedPointUpdateOption
from pyjamas.chart.Curve import Curve
from pyjamas.chart import GChartUtil
from pyjamas.chart.GChartWidgets import PlotPanel
from pyjamas.chart import GChartWidgets
import pygwt
from pyjamas.chart.Axis import XAxis, YAxis, Y2Axis
global canvasFactory
canvasFactory = None
"""*
*
* Tells GChart how to create the canvas widgets it needs
* (specifically, widgets that implement GChart's
* <tt>GChartCanvasLite</tt> interface) to render your
* charts using an external vector graphics library. <p>
*
* You must define a class that implements
* <tt>GChartCanvasFactory</tt> and then pass an instance of that
* class to this method, if you want to have the fast, crisply drawn
* connecting lines, polygonal areas, and 2-D pie slices that only a
* vector graphics library can provide.
* <p>
*
* @see GChartCanvasFactory GChartCanvasFactory
* @see GChartCanvasLite GChartCanvasLite
* @see #getCanvasFactory getCanvasFactory
* @see GChart.Symbol#setFillSpacing setFillSpacing
* @see GChart.Symbol#setFillThickness setFillThickness
*
"""
def setCanvasFactory(factory):
global canvasFactory
canvasFactory = factory
"""*
* Returns the GChart class' canvas factory, or <tt>None</tt>
* if no canvas factory has been specified.
*
* @return the previously specified canvas factory
*
* @see #setCanvasFactory setCanvasFactory
*
"""
def getCanvasFactory():
global canvasFactory
return canvasFactory
# Is the symbol type one of the special ANCHOR_MOUSE types,
# whose position varies with the mouse cursor location?
def isMouseAnchored(symbolType):
return (SymbolType.ANCHOR_MOUSE == symbolType or
SymbolType.ANCHOR_MOUSE_SNAP_TO_X == symbolType or
SymbolType.ANCHOR_MOUSE_SNAP_TO_Y == symbolType)
from pyjamas.ui.ClickListener import ClickHandler
from pyjamas.ui.KeyboardListener import KeyboardHandler
from pyjamas.ui.FocusListener import FocusHandler
from pyjamas.ui.MouseListener import MouseHandler
class GChart (Composite, FocusHandler, KeyboardHandler,
MouseHandler, ClickHandler):
"""*
* Instantiates a GChart with a curve display region of
* the specified size.
*
*
* @param xChartSize the width of the curve display region, in pixels.
* @param yChartSize the height of the curve display region, in pixels.
*
* @see #setXChartSize setXChartSize
* @see #setYChartSize setYChartSize
* @see #setChartSize setChartSize
"""
def __init__(self,
**kwargs):
self.chartTitle = None
self.hoverParameterInterpreter = None
self.hoverTouchingEnabled = True
self.defaultSymbolBorderColors = DEFAULT_SYMBOL_BORDER_COLORS
# creates canvas Widgets GChart needs for *_CANVAS symbol types.
#self.canvasFactory = None
# outer container needed so CSS-defined paddings don't interfere with positioning
self.chartPanel = SimplePanel()
self.borderWidth = USE_CSS
self.borderStyle = USE_CSS
self.borderColor = USE_CSS
self.backgroundColor = USE_CSS
self.blankImageURL = None
self.chartDecorationsChanged = True
# collection of curves associated with this chart.
self.curves = []
self.fontFamily = USE_CSS
self.footnotesThickness = NAI
self.legendBackgroundColor = DEFAULT_LEGEND_BACKGROUND_COLOR
self.legendBorderColor = DEFAULT_LEGEND_BORDER_COLOR
self.legendBorderWidth = DEFAULT_LEGEND_BORDER_WIDTH
self.legendBorderStyle = DEFAULT_LEGEND_BORDER_STYLE
self.legendThickness = NAI
self.chartFootnotes = None
self.chartFootnotesLeftJustified = True
self.legendVisible = True
self.legendFontColor = DEFAULT_FONT_COLOR
self.legendFontSize = DEFAULT_LEGEND_FONTSIZE
self.legendFontStyle = DEFAULT_FONT_STYLE
self.legendFontWeight = DEFAULT_FONT_WEIGHT
self.initialPieSliceOrientation = 0.0
"""
* Contains the plotting region, as well as axes, ticks, and
* tick-labels associated with that region. Note that tickText
* must be centered on the ticks--placing them on the same
* AbsolutePanel as the ticks/plots facilitates self.
*
"""
self.plotPanel = PlotPanel(self)
self.padding = USE_CSS
self.optimizeForMemory = False
self.clipToPlotArea = False
self.clipToDecoratedChart = False
self.titleThickness = NAI
self.wasUnloaded = False
self.addSystemCurves(); # must come first: later lines use system curves
self.xAxis = XAxis(self)
self.yAxis = YAxis(self)
self.y2Axis = Y2Axis(self)
"""
* See the block comment at top of "class GChart" for a detailed
* discussion/rational for GChart's (very minimal support) of
* stylenames. Would like deeper support if I can ever figure out
* how to do it without hamstringing future versions by locking
* them into a particular implementation I might need to change
* later on. In particular, I don't know how to provide such "deep"
* stylenames that also work consistently with canvas-rendered
* curves.
"""
if not kwargs.has_key('StyleName'):
kwargs['StyleName'] = "gchart-GChart"
if not kwargs.has_key('XChartSize'):
kwargs['XChartSize'] = DEFAULT_X_CHARTSIZE
if not kwargs.has_key('YChartSize'):
kwargs['YChartSize'] = DEFAULT_Y_CHARTSIZE
# Note: plotPanel (where real chart resides) won't get
# added to chartPanel (top-level do-nothing container for
# padding and such) until AFTER first update; FF2 has some
# serious performance problems otherwise for common usage
# scenarios with large widget-count pages.
Composite.__init__(self, self.chartPanel, **kwargs)
FocusHandler.__init__(self)
KeyboardHandler.__init__(self)
ClickHandler.__init__(self)
MouseHandler.__init__(self)
def getCanvasFactory(self):
return getCanvasFactory()
def getLastPieSliceOrientation(self):
return self.lastPieSliceOrientation
def setLastPieSliceOrientation(self, lastOrientation):
self.lastPieSliceOrientation = lastOrientation%1.0
"""* Sets the default initial orientation for pie slices.
**
** The default initial orientation is used as the first pie
** slice's first edge's orientation setting only if the symbol associated
** with that pie slice has the default, undefined, orientation
** setting of <tt>Double.NaN</tt>.
** <p>
** The default value of this setting is 0, which corresponds
** to due south (6 o'clock). The value specifies the
** fraction of a complete clockwise rotation, beginning
** at due south required to reach the first edge of the
** pie slice.
**
** @see Symbol#setPieSliceOrientation setPieSliceOrientation
**
** @param orientation the orientation to use for the first
** edge of the first pie slice in this GChart, in cases
** in which that first pie slice's orientation is undefined
** (<tt>Double.NaN</tt>).
*"""
def setInitialPieSliceOrientation(self, orientation):
if orientation < 0 or orientation >=1:
raise IllegalArgumentException(
"orientation="+orientation+"; "+
"orientation must be >=0 and < 1.")
self.initialPieSliceOrientation = orientation
self.invalidateAllSlices()
"""*
** Returns a previously specified initial pie slice orientation.
**
** @return the fraction of a clockwise rotation, beginning
** from the 6 o'clock postion, needed to reach the default
** initial pie slice orientation.
**
** @see #setInitialPieSliceOrientation
** setInitialPieSliceOrientation
*"""
def getInitialPieSliceOrientation(self):
return self.initialPieSliceOrientation
# adds system curves GChart uses to render title, ticks, etc.
def addSystemCurves(self):
# Must be first: other methods assume sys curves exist
for i in range(N_SYSTEM_CURVES):
c = Curve(self, i)
self.curves.append(c)
# Required rendering panels are added lazily, later on
# define (or default) properties, points on, system curves
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setSymbolType(SymbolType.BOX_SOUTHEAST)
c.getSymbol().setBackgroundColor(DEFAULT_PLOTAREA_BACKGROUND_COLOR)
c.getSymbol().setBorderColor(DEFAULT_PLOTAREA_BORDER_COLOR)
c.getSymbol().setBorderStyle(DEFAULT_PLOTAREA_BORDER_STYLE)
c.getSymbol().setBorderWidth(DEFAULT_PLOTAREA_BORDER_WIDTH)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(-Double.MAX_VALUE,Double.MAX_VALUE)
c = self.getSystemCurve(TITLE_ID)
c.getSymbol().setSymbolType(SymbolType.ANCHOR_NORTHWEST)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(0,0)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(YAXIS_ID)
c.getSymbol().setSymbolType(SymbolType.XGRIDLINE)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(GRID_BORDER_STYLE)
c.getSymbol().setBorderWidth(GRID_BORDER_WIDTH)
c.getSymbol().setWidth(DEFAULT_GRID_WIDTH)
c.getSymbol().setHeight(DEFAULT_GRID_HEIGHT)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(-Double.MAX_VALUE,-Double.MAX_VALUE)
c = self.getSystemCurve(YTICKS_ID)
c.getSymbol().setSymbolType(SymbolType.BOX_WEST)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(TICK_BORDER_STYLE)
c.getSymbol().setBorderWidth(TICK_BORDER_WIDTH)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
# points, annotation locations added when ticks are
c = self.getSystemCurve(YGRIDLINES_ID)
c.getSymbol().setSymbolType(SymbolType.YGRIDLINE)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(GRID_BORDER_STYLE)
c.getSymbol().setBorderWidth(GRID_BORDER_WIDTH)
c.getSymbol().setWidth(DEFAULT_GRID_WIDTH)
c.getSymbol().setHeight(DEFAULT_GRID_HEIGHT)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c = self.getSystemCurve(YLABEL_ID)
c.getSymbol().setSymbolType(SymbolType.ANCHOR_WEST)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(0,0)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(Y2AXIS_ID)
c.setYAxis(Y2_AXIS)
c.getSymbol().setSymbolType(SymbolType.XGRIDLINE)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(GRID_BORDER_STYLE)
c.getSymbol().setBorderWidth(GRID_BORDER_WIDTH)
c.getSymbol().setWidth(DEFAULT_GRID_WIDTH)
c.getSymbol().setHeight(DEFAULT_GRID_HEIGHT)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(Double.MAX_VALUE,-Double.MAX_VALUE)
c = self.getSystemCurve(Y2TICKS_ID)
c.setYAxis(Y2_AXIS)
c.getSymbol().setSymbolType(SymbolType.BOX_EAST)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(TICK_BORDER_STYLE)
c.getSymbol().setBorderWidth(TICK_BORDER_WIDTH)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c = self.getSystemCurve(Y2GRIDLINES_ID)
c.setYAxis(Y2_AXIS)
c.getSymbol().setSymbolType(SymbolType.YGRIDLINE)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(GRID_BORDER_STYLE)
c.getSymbol().setBorderWidth(GRID_BORDER_WIDTH)
c.getSymbol().setWidth(DEFAULT_GRID_WIDTH)
c.getSymbol().setHeight(DEFAULT_GRID_HEIGHT)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c = self.getSystemCurve(Y2LABEL_ID)
c.getSymbol().setSymbolType(SymbolType.ANCHOR_EAST)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(0,0)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(LEGEND_ID)
c.getSymbol().setSymbolType(SymbolType.ANCHOR_EAST)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(0,0)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(XAXIS_ID)
c.getSymbol().setSymbolType(SymbolType.YGRIDLINE)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(GRID_BORDER_STYLE)
c.getSymbol().setBorderWidth(GRID_BORDER_WIDTH)
c.getSymbol().setWidth(DEFAULT_GRID_WIDTH)
c.getSymbol().setHeight(DEFAULT_GRID_HEIGHT)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(-Double.MAX_VALUE,-Double.MAX_VALUE)
# tick thickness and length get set in the axis constructors
c = self.getSystemCurve(XTICKS_ID)
c.getSymbol().setSymbolType(SymbolType.BOX_SOUTH)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(TICK_BORDER_STYLE)
c.getSymbol().setBorderWidth(TICK_BORDER_WIDTH)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c = self.getSystemCurve(XGRIDLINES_ID)
c.getSymbol().setSymbolType(SymbolType.XGRIDLINE)
c.getSymbol().setBackgroundColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderColor(DEFAULT_GRID_COLOR)
c.getSymbol().setBorderStyle(GRID_BORDER_STYLE)
c.getSymbol().setBorderWidth(GRID_BORDER_WIDTH)
c.getSymbol().setWidth(DEFAULT_GRID_WIDTH)
c.getSymbol().setHeight(DEFAULT_GRID_HEIGHT)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c = self.getSystemCurve(XLABEL_ID)
c.getSymbol().setSymbolType(SymbolType.ANCHOR_SOUTH)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(0,0)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(FOOTNOTES_ID)
c.getSymbol().setSymbolType(SymbolType.ANCHOR_SOUTHWEST)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(0,0)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(HOVER_ANNOTATION_ID)
c.setVisible(False); # initially no hover annotation
c.getSymbol().setSymbolType(SymbolType.NONE)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(Double.NaN,Double.NaN)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
c = self.getSystemCurve(HOVER_CURSOR_ID)
c.setVisible(False); # initially no hover selection
c.getSymbol().setSymbolType(SymbolType.NONE)
c.getSymbol().setHoverAnnotationEnabled(False)
c.getSymbol().setHoverSelectionEnabled(False)
c.addPoint(Double.NaN,Double.NaN)
c.getPoint().setAnnotationLocation(AnnotationLocation.CENTER)
# external "curve count" should now be 0 (system curves don't count)
if self.getNCurves() != 0:
raise IllegalStateException("self.getNCurves() != 0. Probably a GChart bug.")
"""
* Updates the system curves that represent chart
* decorations (axis labels, title, ticks, etc.).<p>
*
* Note that all x, y shifts are relative to the "anchoring"
* symbol type locations defined once and for all in the
* addSystemCurves method above.
*
"""
def updateDecorations(self, xChartSizeDecorated):
# x-axis label
self.getSystemCurve(XLABEL_ID).getPoint(0).setAnnotationWidget(
self.getXAxis().getAxisLabel(), self.getXChartSize(),
self.getXAxis().getAxisLabelThickness())
self.getSystemCurve(XLABEL_ID).getPoint(0).setAnnotationYShift(
- self.getXAxis().getTickLabelThickness(False)
- self.getXAxis().getTickSpace()
- self.getXAxis().getTickLabelPadding()
- self.getXAxis().getAxisLabelThickness()/2)
# y-axis label
self.getSystemCurve(YLABEL_ID).getPoint(0).setAnnotationWidget(
self.getYAxis().getAxisLabel(),
self.getYAxis().getAxisLabelThickness(),
self.getYChartSize())
self.getSystemCurve(YLABEL_ID).getPoint(0).setAnnotationXShift(
- self.getYAxis().getTickLabelThickness(False)
- self.getYAxis().getTickSpace()
- self.getYAxis().getTickLabelPadding()
- self.getYAxis().getAxisLabelThickness()/2)
# y2-axis label
self.getSystemCurve(Y2LABEL_ID).getPoint(0).setAnnotationWidget(
self.getY2Axis().getAxisLabel(),
self.getY2Axis().getAxisLabelThickness(),
self.getYChartSize())
self.getSystemCurve(Y2LABEL_ID).getPoint(0).setAnnotationXShift(
+ self.getY2Axis().getTickLabelThickness(False)
+ self.getY2Axis().getTickSpace()
+ self.getY2Axis().getTickLabelPadding()
+ self.getY2Axis().getAxisLabelThickness()/2)
# legend
legend = None
if self.isLegendVisible() and 0 < self.getNVisibleCurvesOnLegend():
legend = self.createLegend(self.plotPanel)
self.getSystemCurve(LEGEND_ID).getPoint(0).setAnnotationWidget(
legend, self.getLegendThickness(), self.getYChartSize())
self.getSystemCurve(LEGEND_ID).getPoint(0).setAnnotationXShift(
+ self.getY2Axis().getTickLabelThickness(False)
+ self.getY2Axis().getTickSpace()
+ self.getY2Axis().getTickLabelPadding()
+ self.getY2Axis().getAxisLabelThickness()
+ self.getLegendThickness()/2 )
# title
shiftToLeftEdge = (- self.getYAxis().getAxisLabelThickness()
- self.getYAxis().getTickLabelThickness(False)
- self.getYAxis().getTickSpace()
- self.getYAxis().getTickLabelPadding())
shiftToHorizontalMidpoint = shiftToLeftEdge + xChartSizeDecorated/2
self.getSystemCurve(TITLE_ID).getPoint(0).setAnnotationWidget(
self.getChartTitle(), xChartSizeDecorated,
self.getChartTitleThickness())
self.getSystemCurve(TITLE_ID).getPoint(0).setAnnotationYShift(
self.getChartTitleThickness()/2)
self.getSystemCurve(TITLE_ID).getPoint(0).setAnnotationXShift(
shiftToHorizontalMidpoint)
# footnotes
self.getSystemCurve(FOOTNOTES_ID).getPoint(0).setAnnotationWidget(
self.getChartFootnotes(), xChartSizeDecorated,
self.getChartFootnotesThickness())
self.getSystemCurve(FOOTNOTES_ID).getPoint(0).setAnnotationYShift(
- self.getXAxis().getTickLabelThickness(False)
- self.getXAxis().getTickSpace()
- self.getXAxis().getTickLabelPadding()
- self.getXAxis().getAxisLabelThickness()
- self.getChartFootnotesThickness()/2 )
if self.getChartFootnotesLeftJustified():
self.getSystemCurve(FOOTNOTES_ID).getPoint(0).setAnnotationXShift(
shiftToLeftEdge)
self.getSystemCurve(FOOTNOTES_ID).getPoint(0).setAnnotationLocation(
AnnotationLocation.EAST)
else:
# footnotes centered
self.getSystemCurve(FOOTNOTES_ID).getPoint(0).setAnnotationXShift(
shiftToHorizontalMidpoint)
self.getSystemCurve(FOOTNOTES_ID).getPoint(0).setAnnotationLocation(
AnnotationLocation.CENTER)
# add points to ticks and gridlines curves in accord with chart specs
# x & y axis can be present even if no curves mapped to them
self.getSystemCurve(XAXIS_ID).setVisible(self.getXAxis().getAxisVisible())
self.getXAxis().populateGridlines()
self.getSystemCurve(YAXIS_ID).setVisible(self.getYAxis().getAxisVisible())
self.getYAxis().populateGridlines()
# y2 axis is present only if at least 1 curve is on it.
if self.hasY2Axis():
self.getY2Axis().populateGridlines()
self.getSystemCurve(Y2AXIS_ID).setVisible(self.getY2Axis().getAxisVisible())
self.getSystemCurve(Y2TICKS_ID).setVisible(True)
self.getSystemCurve(Y2GRIDLINES_ID).setVisible(True)
else:
self.getSystemCurve(Y2AXIS_ID).setVisible(False)
self.getSystemCurve(Y2TICKS_ID).setVisible(False)
self.getSystemCurve(Y2GRIDLINES_ID).setVisible(False)
"""*
*
* Adds an object to handle click events on this chart, that
* is, an object whose <tt>ClickHandler.onClick</tt> method will be
* called whenever the user clicks on this chart.
*
* <p>
*
* When implementing a class that handles GChart click
* events, you'll need to know the following facts:
* <p>
*
* <ol>
*
* <li>You can use the <tt>getSource</tt> method of the
* <tt>ClickEvent</tt> passed into your <tt>onClick</tt> handler
* to retrieve the <tt>GChart</tt> that was
* clicked on. For example:
* <p>
*
* <pre>
* # Deletes the clicked-on curve
def onClick(self, event):
GChart theGChart = (GChart) event.getSource()
GChart.Curve c = theGChart.getTouchedCurve()
if None != c:
theGChart.removeCurve(c)
# what you see in browser won't change without an update
theGChart.update()
* </pre>
* <p>
*
* <li>The <tt>GChart</tt> methods <tt>getTouchedPoint</tt> and
* <tt>getTouchedCurve</tt> return either the point and
* curve that were clicked on, or <tt>None</tt> if the
* click didn't "touch" any points.
*
* <p>
*
*</ol>
* <p>
*
* The editable pie chart example on the GChart <a
* href="http:#gchart.googlecode.com/svn/trunk/live-demo/v2_6/com.googlecode.gchart.gchartdemoapp.GChartDemoApp/GChartDemoApp.html">
* live demo page</a>
* illustrates how to use this method to launch a popup modal
* <tt>DialogBox</tt> whenever the user clicks on a point, and how to
* change the selected point from within that dialog by using
* GChart's <tt>touch</tt> method.
* <p>
*
* For a much simpler example that lets the user
* delete points by clicking on them, see the Chart Gallery's
* <a href="package-summary.html#GChartExample18a">
* GChartExample18a</a>.
* <p>
*
* @param handler the click handler that will handle
* click events on this chart.
*
* @return the handler's registration object. You need to retain a
* reference to this registration object only if you may later need
* to remove the handler (via the registration's
* <tt>removeHandler</tt> method). Most applications don't remove
* handlers (handlers tend to be statically defined) and so can
* ignore the value returned from this method.
*
* @see #getTouchedPoint getTouchedPoint
* @see #getTouchedCurve getTouchedCurve
* @see #touch touch
* @see #isUpdateNeeded isUpdateNeeded
"""
def addClickHandler(self, handler):
result = addDomHandler(handler, ClickEvent.getType())
return result
def addDoubleClickHandler(self, handler):
result = addDomHandler(handler, DoubleClickEvent.getType())
return result
def addMouseDownHandler(self, handler):
result = addDomHandler(handler, MouseDownEvent.getType())
return result
def addMouseMoveHandler(self, handler):
result = addDomHandler(handler, MouseMoveEvent.getType())
return result
def addMouseOutHandler(self, handler):
result = addDomHandler(handler, MouseOutEvent.getType())
return result
def addMouseOverHandler(self, handler):
result = addDomHandler(handler, MouseOverEvent.getType())
return result
def addMouseUpHandler(self, handler):
result = addDomHandler(handler, MouseUpEvent.getType())
return result
def addMouseWheelHandler(self, handler):
result = addDomHandler(handler, MouseWheelEvent.getType())
return result
"""
* Given external, coded, index returns a curve's ArrayList index
*
* Basic order within the curves array is as follows:
*
* o 6 decorative curves that hold title, etc
* o "self.getNCurves()" user-created curves
* o 1 "Pop-up" hover annotation holding curve
* o 1 Selection cursor holding curve
*
* It's very important that the last two system curves come last, both
* for performance (at the end means GChart's algorithms are able to
* update only these curves when hover feedback changes) and to
* ensure these elements are always on top of all other chart
* elements, as required.
* <p>
*
* The "external" system curve indexes are in a continuous range of
* negative integers, which are mapped into the ArrayList
* positions above via this code.
*
"""
def internalCurveIndex(self, externalIndex):
if NAI == externalIndex:
# -1 is the "no such curve" index used by an ArrayList
result = -1
elif externalIndex < -N_POST_SYSTEM_CURVES:
# decoration related sys curves (before user's)
result = externalIndex + N_SYSTEM_CURVES
elif externalIndex < 0:
# hover feedback related, after user curves (at the end)
result = len(self.curves)+externalIndex
else:
# + indexes mapped to ordinary user-created curves
result = externalIndex + N_PRE_SYSTEM_CURVES
return result
""" Given a curves ArrayList index returns external, coded, index
*
* Companion/inverse of preceeding method.
*
"""
def externalCurveIndex(self, internalIndex):
if internalIndex < 0:
result = NAI
elif internalIndex < N_PRE_SYSTEM_CURVES:
# one of the sys curves that comes before user's curves
result = internalIndex - N_SYSTEM_CURVES
elif internalIndex >= len(self.curves)-N_POST_SYSTEM_CURVES:
# sys curves, like hover feedback, that come after user's
result = internalIndex - len(self.curves)
else:
# ordinary user created curve
result = internalIndex - N_PRE_SYSTEM_CURVES
return result
# does the external curve index represent a GChart-sys-defined curve?
def isSystemCurveIndex(self, externalIndex):
result = externalIndex < 0
return result
"""*
* Adds a curve to the chart, at the specified position
* in the curve sequence. Existing curves at postions at
* or greater than the specified position have their
* positional indexes increased by 1.
* <p>
*
* @see #getCurve getCurve
* @see #addCurve() addCurve()
* @see #removeCurve removeCurve
* @see #clearCurves clearCurves
* @see #getNCurves getNCurves
"""
def addCurve(self, iCurve=None):
if iCurve is None:
iCurve = self.getNCurves()
if iCurve > self.getNCurves():
raise IllegalArgumentException(
"iCurve = " + iCurve +"; iCurve may not exceed self.getNCurves() (" + self.getNCurves() + ")")
elif iCurve < 0:
raise IllegalArgumentException(
"iCurve = " + iCurve +"; iCurve may not be negative.")
internalIndex = self.internalCurveIndex(iCurve)
c = Curve(self, internalIndex)
self.curves.insert(internalIndex, c)
# curves are initially added to the x, y axes.
self.getXAxis().incrementCurves()
self.getYAxis().incrementCurves()
# adjust ArrayList indexes to account for newly added element
for i in range(internalIndex+1, len(self.curves)):
self.curves[i].incrementIndex()
if 0 != self.plotPanel.getRenderingPanelCount():
# other panels are already there
rpIndex = self.getRenderingPanelIndex(internalIndex)
self.plotPanel.addGraphicsRenderingPanel(rpIndex)
self.plotPanel.addAnnotationRenderingPanel(rpIndex)
# otherwise, before 1st update: lazy-add panels when they're 1st used
c.invalidate()
if self.getNCurves() > 0:
self.setDefaultBorderColor(c, self.getNCurves()-1)
"""*
* Removes every curve this chart contains.
*
* @see #getCurve getCurve
* @see #addCurve() addCurve()
* @see #addCurve(int) addCurve(int)
* @see #removeCurve removeCurve
* @see #getNCurves getNCurves
"""
def clearCurves(self):
for iCurve in range( self.getNCurves()-1, -1, -1):
self.removeCurve(iCurve)
"""*
** Returns the background color of the chart as a whole.
**
** @return the chart's background color, in a standard
** CSS color string format.
**
** @see #setBackgroundColor(String) setBackgroundColor
**
*"""
def getBackgroundColor(self):
return(self.backgroundColor)
"""*
** Returns the color of the border around the chart as
** a whole.
**
** @return the color of the chart's border, in a standard
** CSS color string format.
**
** @see #setBorderColor(String) setBorderColor
**
*"""
def getBorderColor(self):
return self.borderColor
"""*
** Returns the width of the border around the chart as a whole
**
** @return width of the border around the chart as a whole, as
** a CSS border width specification string (e.g. "1px").
**
** @see #setBorderWidth(String) setBorderWidth
**
*"""
def getBorderWidth(self):
return self.borderWidth
"""*
** Returns the style of the border around the chart as a whole
**
** @return cssStyle for the border around the chart as a whole
**
** @see #setBorderStyle(String) setBorderStyle
**
*"""
def getBorderStyle(self):
return self.borderStyle
"""* Returns the previously specified chart footnotes widget.
*
* @return widget representing chart's footnotes or <tt>None</tt> if none.
*
* @see #setChartFootnotes(Widget) setChartFootnotes(Widget)
* @see #setChartFootnotes(String) setChartFootnotes(String)
* @see #getChartTitle getChartTitle
"""
def getChartFootnotes(self):
return self.chartFootnotes
"""* Returns flag indicating if this chart's footnotes are
* left-justified or centered.
*
* @return True if footnotes are flush against the left edge
* of the chart, False if they are horizontally centered
* across the bottom edge of the chart.
*
* @see #setChartFootnotesLeftJustified setChartFootnotesLeftJustified
* @see #setChartFootnotes(String) setChartFootnotes(String)
* @see #setChartTitle setChartTitle
"""
def getChartFootnotesLeftJustified(self):
return self.chartFootnotesLeftJustified
"""* Returns the thickness (height) of the rectangular region
** at the bottom of the chart allocated for footnotes.
** <p>
**
** The width of this region always equals the width of
** the entire GChart (including legend and axis labels).
** <p>
**
** Your footnotes widget is always vertically centered
** in this region.
** <p>
**
**
** Your footnotes widget will either be horizontally
** centered in this region, or left justified in it,
** depending on the property defined by the
** <tt>setChartFootnotesLeftJustified</tt> method.
**
** <p>
**
**
** This method always returns 0 if the footnotes widget
** is <tt>None</tt> (the default); the rectangular
** footnotes region is entirely eliminated in that case.
** <p>
**
** @return the thickness (height) of the rectangular region
** at the bottom of the chart allocated for footnotes, in
** pixels.
**
** @see #setChartFootnotesThickness(int) setChartFootnotesThickness
** @see #setChartFootnotesLeftJustified setChartFootnotesLeftJustified
*"""
def getChartFootnotesThickness(self):
result = 0
EXTRA_HEIGHT = 3; # 1.5 lines padding above/below
DEF_HEIGHT = 1
if None == self.getChartFootnotes():
result = 0
elif NAI != self.footnotesThickness:
result = self.footnotesThickness
elif hasattr(self.getChartFootnotes(), 'getHTML'):
result = DEFAULT_FOOTNOTES_THICKNESS * (EXTRA_HEIGHT +
GChartUtil.htmlHeight( self.getChartFootnotes().getHTML()) )
else:
result = DEFAULT_FOOTNOTES_THICKNESS* (DEF_HEIGHT + EXTRA_HEIGHT)
return result
"""* Returns the previously specified widget representing the
* chart's title.
*
* @return widget representing chart's title or <tt>None</tt>
* if none
*
* @see #setChartTitle(Widget) setChartTitle(Widget)
* @see #setChartTitle(String) setChartTitle(String)
*
"""
def getChartTitle(self):
return self.chartTitle
"""*
** Returns the thickness (height) of the rectangular region at
** the top of the chart allocated for the title.
** <p>
**
** This method always returns 0 if the title widget
** is <tt>None</tt> (the default); the rectangular
** title region is entirely eliminated in that case.
** <p>
**
** Your title widget is always centered vertically and
** horizontally within this rectangular region.
**
**
** @return the thickness (height) of the rectangle
** that contains the chart's title, in pixels.
**
** @see #setChartTitleThickness setChartTitleThickness
**
*"""
def getChartTitleThickness(self):
result = 0
EXTRA_HEIGHT = 3; # 1.5 lines above & below title
DEF_HEIGHT = 1
if None == self.getChartTitle():
result = 0
elif NAI != self.titleThickness:
result = self.titleThickness
elif hasattr(self.getChartTitle(), 'getHTML'):
result = DEFAULT_TITLE_THICKNESS * (EXTRA_HEIGHT +
GChartUtil.htmlHeight( self.getChartTitle().getHTML() ))
else:
result = DEFAULT_TITLE_THICKNESS* (EXTRA_HEIGHT + DEF_HEIGHT)
return result
"""*
* Determines if this chart will clip any chart elements
* that extend beyond the bounds of the decorated chart.
* The decorated chart includes title, footnotes, etc.
* as well as the plot area proper.
*
* @return True if off-the-decorated-chart elements are
* clipped, False otherwise.
*
* @see #setClipToDecoratedChart setClipToDecoratedChart
* @see #setClipToPlotArea setClipToPlotArea
* @see #getXChartSizeDecorated getXChartSizeDecorated
* @see #getYChartSizeDecorated getYChartSizeDecorated
*
"""
def getClipToDecoratedChart(self):
return self.clipToDecoratedChart
"""*
* Returns True if graphical aspects of the
* chart that fall outside of the plot area are being clipped
* off, False otherwise.
*
* @return <tt>True</tt> if clipping to plot area, else
* <tt>False</tt>.
*
* @see #setClipToPlotArea setClipToPlotArea
"""
def getClipToPlotArea(self):
return self.clipToPlotArea
# returns point closest to given plot-panel pixel coordinates
def getClosestBrushTouchingPointNoCheck(self, x, y):
result = None
# NAI means mouse is at some unknown, off-the-chart, position
if x == NAI or y == NAI:
return result
dBest = Double.MAX_VALUE; # dist. to closest symbol
# fact that charts tend to have a small number of curves
# allows us to use simple sequential search across curves
nCurves = self.getNCurves()
for iCurve in range(nCurves):
c = self.getSystemCurve(iCurve)
if not c.isVisible():
continue
sym = c.getSymbol()
if not sym.getHoverAnnotationEnabled() and not sym.getHoverSelectionEnabled():
continue
symType = sym.getSymbolType()
onY2 = c.onY2()
iClosest = c.getClosestTouchingPoint(x, y)
if NAI == iClosest:
continue; # no hits on this curve
xPoint = symType.getCenterX(self.plotPanel, sym, iClosest)
yPoint = symType.getCenterY(self.plotPanel, sym, iClosest, onY2)
dx = sym.xScaleFactor*(x-xPoint)
dy = sym.yScaleFactor*(y-yPoint)
# distance, squared, of mouse from symbol's "center"
d = dx*dx+dy*dy
if d <= dBest:
# for ties, use later, "on top", point
dBest = d
result = c.getPoint(iClosest)
return result
"""*
*
* Returns the point that would be touched if the mouse were
* moved to the given x,y plot-area pixel coordinates, or
* <tt>None</tt> if the moving the mouse to these coordinates
* would not have touched any points.<p>
*
* This method only works if the chart rendering is
* up-to-date (if <tt>isUpdateNeeded</tt> returns
* <tt>False</tt>). Otherwise, <tt>None</tt> is returned.
* <p>
*
* <small> GChart's hit testing method works best if a
* chart's points are approximately evenly distributed across
* the plot area's x or y axis, across a small number of
* curves. In particular, charts that have many points
* bunched up into a small part of the plot area, or that
* have many points completely outside of the plot area, or
* that place each point into a separate curve, could
* experience significantly worse that usual hit testing
* performance. Though such cases are expected to be rare, in
* the worst case, GChart could be reduced to a simple linear
* search across all the chart's points during hit testing.
* </small>
*
* @param xPlotArea x-coordinate of trial mouse position, in
* GChart's plot area pixel coordinates.
* @param yPlotArea y-coordinate of trial mouse position, in
* GChart's plot area pixel coordinates.
*
* @return reference to the point that would have been "touched"
* by the mouse, or <tt>None</tt> if positioning the mouse
* to these coordinates would not have touched any point.
*
* @see Axis#getMouseCoordinate getMouseCoordinate
* @see Axis#modelToPlotAreaPixel modelToPlotAreaPixel
* @see #isUpdateNeeded isUpdateNeeded
* @see #touch touch
*
"""
def getClosestBrushTouchingPoint(self, xPlotArea, yPlotArea):
result = None
if not isUpdateNeeded():
result = getClosestBrushTouchingPointNoCheck(xPlotArea, yPlotArea)
return result
"""*
* Returns a reference to the curve at the specified
* positional index. Use the reference returned by this method to
* modify properties of a curve (the symbol, data points, etc.)
*
* When the positional index is None, it is equivalent to
* <tt>getCurve(self.getNCurves()-1)</tt>.
*
* <p>
* @param iCurve index of the curve to be retrieved.
* @return reference to the Curve at the specified position.
*
* @see #getCurve() getCurve()
* @see #addCurve() addCurve()
* @see #addCurve(int) addCurve(int)
* @see #removeCurve removeCurve
* @see #clearCurves clearCurves
* @see #getNCurves getNCurves
"""
def getCurve(self, iCurve=None):
if iCurve is None:
N = self.getNCurves()
if N < 1:
raise IllegalStateException(
"You must add at least 1 curve before invoking getCurve()")
return self.getSystemCurve(N-1)
if iCurve >= self.getNCurves():
raise IllegalArgumentException(
"iCurve = " + iCurve +"; iCurve may not exceed self.getNCurves()-1 (" + str(self.getNCurves()-1) + ")")
elif iCurve < 0:
raise IllegalArgumentException(
"iCurve = " + iCurve +"; iCurve may not be negative.")
result = self.getSystemCurve(iCurve)
return result
# Version of getCurve that allows sys curve (negative id) access
def getSystemCurve(self, iCurve):
internalIndex = self.internalCurveIndex(iCurve)
result = self.curves[internalIndex]
return result
"""*
* Returns the positional index (within this chart's list of
* curves) of the specified curve.
* <p>
*
* Returns <i>NAI</i> if the specified curve is not found on
* this GChart's curve list.
*
* <p>
* @param curve whose list position is to be retrieved
* @return position of curve in GChart's curve list, or
* <i>NAI</i> if not on this chart's curve list.
*
* @see #getCurve() getCurve()
* @see #getCurve(int) getCurve(int)
* @see #addCurve() addCurve()
* @see #addCurve(int) addCurve(int)
* @see #removeCurve removeCurve
* @see #clearCurves clearCurves
* @see #getNCurves getNCurves
"""
def getCurveIndex(self, curve):
internalIndex = curve.getIndexOf()
result = self.externalCurveIndex(internalIndex)
return result
def getInternalCurveIndex(self, curve):
result = curve.getIndexOf()
return result
# maps all background curve indexes into first rendering panel
def getRenderingPanelIndex(self, internalCurveIndex):
result = 0
if N_PRE_SYSTEM_CURVES <= internalCurveIndex:
result = internalCurveIndex - N_PRE_SYSTEM_CURVES + 1
return result
"""* Returns the font-family used in tick labels, point annotations,
** legends, and as the default in titles, footnotes, and
** axis labels.
**
** @see #setFontFamily(String) setFontFamily
**
**
*"""
def getFontFamily(self):
return self.fontFamily
"""*
** Returns CSS color specification for all gridlines, axes,
** and tickmarks.
**
** @see #setGridColor setGridColor
**
** @return the color, in CSS standard color format,
** used for all gridlines, axes, and tick marks.
**
*"""
def getGridColor(self):
cGridlines = self.getSystemCurve(XGRIDLINES_ID)
result = cGridlines.getSymbol().getBorderColor()
return result
"""*
** Returns the background color of the chart's legend.
**
** @return the legend's background color, in a standard
** CSS color string format.
**
** @see #setLegendBackgroundColor setLegendBackgroundColor
**
*"""
def getLegendBackgroundColor(self):
return self.legendBackgroundColor
"""*
** Returns the border color of the chart's legend.
**
** @return the color of the legend's border, in a standard
** CSS color string format, or else the special GChart keyword
** <tt>TRANSPARENT_BORDER_COLOR</tt>.
**
** @see #setLegendBorderColor setLegendBordergroundColor
** @see #TRANSPARENT_BORDER_COLOR TRANSPARENT_BORDER_COLOR
**
*"""
def getLegendBorderColor(self):
return self.legendBorderColor
"""*
** Returns the width of the chart's legend's border
**
** @return width of the legend's border, in pixels
**
** @see #setLegendBorderWidth setLegendBorderWidth
**
*"""
def getLegendBorderWidth(self):
return self.legendBorderWidth
"""*
** Returns the style of the chart's legend's border
**
** @return cssStyle of the legend's border
**
** @see #setLegendBorderStyle setLegendBorderStyle
**
*"""
def getLegendBorderStyle(self):
return self.legendBorderStyle
"""*
** Returns the color of the font used to display the labels
** within the legend (chart key)
**
** @return CSS color string defining the legend text's color
**
** @see #setLegendFontColor setLegendFontColor
*"""
def getLegendFontColor(self):
return self.legendFontColor
"""*
* Returns the CSS font size, in pixels, of text displayed
* in the chart's legend (also know as a chart's key).
*
* @return the (previously specified) font size of legend text
*
* @see #setLegendFontSize setLegendFontSize
"""
def getLegendFontSize(self):
return self.legendFontSize
"""*
** Returns the font-style in which this GChart's legend text
** will be rendered.
**
** @return font-style of legend text (italic, normal, etc.)
**
** @see #setLegendFontStyle setLegendFontStyle
*"""
def getLegendFontStyle(self):
return self.legendFontStyle
"""*
** Returns True if legend text will be rendered in a bold,
** or False if in normal, weight font.
**
** @return if the legend's text is in bold or not.
**
** @see #setLegendFontWeight setLegendFontWeight
*"""
def getLegendFontWeight(self):
return self.legendFontWeight
"""*
** Returns the thickness (width) of the rectangular region
** to the right of the y2-axis label allocated for the
** chart legend.<p>
**
** The region extends vertically in parallel with the
** right edge of the plot area. The legend is always
** centered vertically and horizontally within this
** rectangular region.
** <p>
**
** This method always returns 0 if the legend is not
** visible; the rectangular legend region is entirely
** eliminated in that case.
**
** @return thickness (width) of legend key holding region,
** in pixels.
**
** @see #setLegendThickness setLegendThickness
*"""
def getLegendThickness(self):
result = 0
if self.isLegendVisible() and 0 < self.getNVisibleCurvesOnLegend():
if NAI == self.legendThickness:
result = self.getDefaultLegendThickness()
else:
result = self.legendThickness
return result
"""*
* Returns the number of curves on this chart.
*
* @return the number of curves on this chart
*
* @see #getCurve getCurve
* @see #addCurve() addCurve()
* @see #addCurve(int) addCurve(int)
* @see #removeCurve removeCurve
* @see #clearCurves clearCurves
"""
def getNCurves(self):
return len(self.curves) - N_SYSTEM_CURVES
"""* Returns the CSS string that specifies the width of the
** padding between the chart and it's external border
** <p>
**
** @return the CSS string that defines the CSS padding property
** for the GChart as a whole.
**
** @see #setPadding(String) setPadding
**
*"""
def getPadding(self):
return self.padding
"""*
** Returns the background color of the area of the chart
** in which symbols representing curve data are displayed
**
** @return CSS color string defining the plot area's background
** color
**
** @see #setPlotAreaBackgroundColor setPlotAreaBackgroundColor
*"""
def getPlotAreaBackgroundColor(self):
c = self.getSystemCurve(PLOTAREA_ID)
result = c.getSymbol().getBackgroundColor()
return result
"""*
** Returns the border color of the area of the chart
** in which symbols representing curve data are displayed
**
** @return CSS color string defining the color of the plot
** area's border
**
** @see #setPlotAreaBorderColor setPlotAreaBorderColor
*"""
def getPlotAreaBorderColor(self):
c = self.getSystemCurve(PLOTAREA_ID)
result = c.getSymbol().getBorderColor()
return result
"""*
** Returns the width of the border around the area of the
** chart in which symbols representing curve data are
** displayed.
**
** @return width, in pixels, of the border around the plot area
**
** @see #setPlotAreaBorderWidth setPlotAreaBorderWidth
*"""
def getPlotAreaBorderWidth(self):
c = self.getSystemCurve(PLOTAREA_ID)
result = c.getSymbol().getBorderWidth()
return result
"""*
** Returns the style of the border around the area of the
** chart in which symbols representing curve data are
** displayed (the so-called plot area).
**
** @return CSS style of the border around the plot area
**
** @see #setPlotAreaBorderStyle setPlotAreaBorderStyle
*"""
def getPlotAreaBorderStyle(self):
c = self.getSystemCurve(PLOTAREA_ID)
result = c.getSymbol().getBorderStyle()
return result
"""*
*
* Returns the image URL that will be used to define the
* plot area's background the next time <tt>update</tt> is called.
* <p>
*
* @return url of image to be used as the background of the plot
* area the next time that <tt>update</tt> is called.
*
* @see #setPlotAreaImageURL setPlotAreaImageURL
* @see #update update
*
"""
def getPlotAreaImageURL(self):
c = self.getSystemCurve(PLOTAREA_ID)
result = c.getSymbol().getImageURL()
return result
"""*
*
* Returns a flag that tells if GChart is configured to
* perform updates so that the chart uses less memory.
*
* @return <tt>True</tt> if GChart optimizes updates to
* save memory, <tt>False</tt> (the default) if it optimizes
* them to save time.
*
* @see #setOptimizeForMemory setOptimizeForMemory
*
*"""
def getOptimizeForMemory(self):
return self.optimizeForMemory
"""*
* @deprecated
*
* Equivalent to <tt>!getClipToPlotArea()</tt>. Use that
* method instead.
*
* @see #getClipToPlotArea getClipToPlotArea
"""
def getShowOffChartPoints(self):
return not getClipToPlotArea()
"""* @deprecated
**
** Equivalent to <tt>!getClipToDecoratedChart()</tt>. Use
** that method instead.
**
** @see #getClipToDecoratedChart getClipToDecoratedChart
**
*"""
def getShowOffDecoratedChartGlyphs(self):
return not getClipToDecoratedChart()
"""*
** Returns a URL that points to a 1 x 1 pixel blank image
** file GChart requires to render its charts without
** producing missing image icons.
**
** <p>
**
** @return the URL of the file GChart needs to prevent
** missing image icons from appearing on your chart.
**
** @see #setBlankImageURL setBlankImageURL
**
*"""
def getBlankImageURL(self):
if self.blankImageURL:
return self.blankImageURL
return DEFAULT_BLANK_IMAGE_URL_FULLPATH
"""*
* Returns this GChart's hover parameter interpreter.
*
* @see #setHoverParameterInterpreter setHoverParameterInterpreter
*
* @return the hover parameter interpreter used by this
* GChart, or <tt>None</tt> if none.
*
"""
def getHoverParameterInterpreter(self):
return self.hoverParameterInterpreter
"""*
* Is it possible to select points and have their hover
* annotations pop up, merely by "touching" them with
* the mouse-attached "brush"?
*
* @return True (the default) if just hovering over a point can
* select it, False if you must click on a point to select it.
*
* @see #setHoverTouchingEnabled setHoverTouchingEnabled
*
"""
def getHoverTouchingEnabled(self):
return self.hoverTouchingEnabled
"""*
* Returns the x-axis associated with this chart. Use the
* returned reference to manipulate axis min and max,
* number of ticks, tick positions, tick label formats, etc.
* <p>
* @return object representing the x-axis of this chart.
*
* @see #getYAxis getYAxis
* @see #getY2Axis getY2Axis
"""
def getXAxis(self):
return self.xAxis
"""*
* Returns the number of x-pixels in the region of the chart
* used for curve display purposes.
*
* @return the number of x-pixels available for curve display.
*
* @see #setXChartSize setXChartSize
*
"""
def getXChartSize(self):
return self.xChartSize
"""*
* Returns the number of x-pixels reserved for the chart as a
* whole, including space reserved for decorations (title,
* footnotes, axis labels, ticks, tick labels, legend key,
* etc.).
* <p>
*
* The returned size does not include the border or padding
* around the chart as a whole. <p>
*
* You cannot directly set the decorated x chart size.
* Instead, you must set the width of the plot area, and the
* thicknesses of certain of the decoration-holding regions
* (using methods linked to below) that, summed together,
* define the total width of the chart.
*
* @return the width of the entire chart, in pixels.
*
* @see #setXChartSize setXChartSize
* @see #getYChartSizeDecorated getYChartSizeDecorated
* @see Axis#setAxisLabelThickness setAxisLabelThickness
* @see Axis#setTickLabelThickness setTickLabelThickness
* @see Axis#setTickLength setTickLength
* @see Axis#setTickLocation setTickLocation
* @see Axis#setTickLabelPadding setTickLabelPadding
* @see Axis#setLegendThickness setLegendThickness
*
"""
def getXChartSizeDecorated(self):
result = (self.getXChartSize() +
self.getYAxis().getAxisLabelThickness() +
self.getYAxis().getTickLabelThickness() +
self.getYAxis().getTickSpace() +
self.getYAxis().getTickLabelPadding() +
self.getY2Axis().getAxisLabelThickness() +
self.getY2Axis().getTickLabelThickness() +
self.getY2Axis().getTickSpace() +
self.getYAxis().getTickLabelPadding() +
self.getLegendThickness())
return result
"""*
* Returns the y2-axis (right y axis) associated with this
* chart. Use the returned reference to manipulate axis
* min and max, number of ticks, tick positions, tick
* label formats, etc.
*
* <p>
* @return object representing the y2-axis of this chart.
*
* @see #getYAxis getYAxis
* @see #getXAxis getXAxis
"""
def getY2Axis(self):
return self.y2Axis
"""*
* Returns the (left) y-axis associated with this chart. Use the
* returned reference to manipulate axis min and max,
* number of ticks, tick positions, tick label formats, etc.
* <p>
* @return object representing the y-axis of this chart.
*
* @see #getXAxis getXAxis
* @see #getY2Axis getY2Axis
"""
def getYAxis(self):
return self.yAxis
"""*
* Returns the number of y-pixels in the region of the chart
* used for curve display purposes.
*
* @return the number of y-pixels available for curve display.
*
* @see #setYChartSize setYChartSize
*
"""
def getYChartSize(self):
return self.yChartSize
"""*
* Returns the number of y-pixels reserved for the chart as a
* whole, including space reserved for decorations (title,
* footnotes, axis labels, ticks, tick labels, etc.). <p>
*
* The returned size does not include the border or padding
* around the chart as a whole. <p>
*
* You cannot directly set the decorated y chart size.
* Instead, you must set sizes and thicknesses of the
* plot area and certain of the decoration-holding regions
* (using the methods linked-to below) that, when summed
* together, define the height of the decorated chart.
*
* @return the height of the entire chart, in pixels.
*
* @see #setYChartSize setYChartSize
* @see #getXChartSizeDecorated getXChartSizeDecorated
* @see Axis#setAxisLabelThickness setAxisLabelThickness
* @see Axis#setTickLabelThickness setTickLabelThickness
* @see Axis#setTickLength setTickLength
* @see Axis#setTickLocation setTickLocation
* @see Axis#setTickLabelPadding setTickLabelPadding
* @see #setChartTitleThickness setChartTitleThickness
* @see #setChartFootnotesThickness setChartFootnotesThickness
*
"""
def getYChartSizeDecorated(self):
result = (self.getYChartSize() +
self.getXAxis().getAxisLabelThickness() +
self.getXAxis().getTickLabelThickness() +
self.getXAxis().getTickSpace() +
self.getXAxis().getTickLabelPadding() +
self.getChartTitleThickness() +
self.getChartFootnotesThickness())
return result
"""*
* Determines if this chart has a "y2" (right) y-axis.
* <p>
* Only charts that have at least one curve on the right
* y axis will have a y2-axis.
*
* @return True if the chart has a second y axis, False otherwise.
*
* @see Curve#setYAxis Curve.setYAxis
"""
def hasY2Axis(self):
result = self.getY2Axis().getNCurvesVisibleOnAxis() > 0
return result
"""*
* Determines if this chart has an ordinary, or left, y-axis.
* <p>
* Only charts that have at least one curve on the left
* y axis will have a y-axis.
*
* @return True if the chart has a left y axis, False otherwise
*
* @see Curve#setYAxis Curve.setYAxis
*
"""
def hasYAxis(self):
result = self.getYAxis().getNCurvesVisibleOnAxis() > 0
return result
"""*
* Determines if the legend of this chart is visible.
*
*
* @return True if the legend is visible, False otherwise.
*
* @see #setLegendVisible setLegendVisible
"""
def isLegendVisible(self):
return self.legendVisible
"""*
*
* Is the in-browser rendition of the chart inconsistent with
* the current chart specs? In other words, is a call to
* GChart's <tt>update</tt> method needed to bring the
* browser's display into agreement with current chart specs?
* <p>
*
* <i>Note:</i> Whenever this method returns
* <tt>True</tt>, GChart "freezes" hover feedback, and
* can no longer actively track the currently "touched"
* point. This is because GChart, to simplify its
* bookkeeping, assumes in-browser (DOM) rendering and
* current chart specs are in synch when determining the
* point selection consequences of mouse events over the
* chart.
*
* @return True if a call to <tt>update</tt> is needed to
* bring current chart specifications and browser-rendered
* representation into synch, False otherwise.
*
* @see #update update
* @see #getTouchedPoint getTouchedPoint
*
"""
def isUpdateNeeded(self):
result = self.chartDecorationsChanged or not self.plotPanel.isValidated()
return result
"""*
* Removes the curve at the specified positional index.
* <p>
*
* @param iCurve index of the curve to be removed
*
* @see #removeCurve(Curve) removeCurve(Curve)
* @see #getCurve getCurve
* @see #addCurve() addCurve()
* @see #addCurve(int) addCurve(int)
* @see #clearCurves clearCurves
* @see #getNCurves getNCurves
"""
def removeCurve(self, iCurve):
if iCurve >= self.getNCurves():
raise IllegalArgumentException(
"iCurve = " + iCurve +"; iCurve may not exceed self.getNCurves()-1 (" + (self.getNCurves()-1) + ")")
elif iCurve < 0:
raise IllegalArgumentException(
"iCurve = " + iCurve +"; iCurve may not be negative.")
self.invalidateDependentSlices(iCurve)
"""
* Simulate user moving away from point before it is deleted (this
* assures that any required hoverCleanup gets called, and clears
* the otherwise dangling reference to the touched point).
*
"""
if self.plotPanel.touchedPoint is not None and self.plotPanel.touchedPoint.getParent() == self.getSystemCurve(iCurve):
self.plotPanel.touch(None)
# remove the rendering panel that corresponds to this curve
# (must keep the two lists in synch or 1-to-1 mapping breaks)
internalIndex = self.internalCurveIndex(iCurve)
if 0 != self.plotPanel.getRenderingPanelCount():
rpIndex = getRenderingPanelIndex(internalIndex)
self.plotPanel.removeGraphicsRenderingPanel(rpIndex)
self.plotPanel.removeAnnotationRenderingPanel(rpIndex)
c = self.curves[internalIndex]
if c.isVisible():
getXAxis().decrementCurves()
if c.getYAxis() == Y_AXIS:
getYAxis().decrementCurves()
else:
getY2Axis().decrementCurves()
c.clearIndex()
# else before 1st update, no rendering panels created yet
self.curves.pop(internalIndex)
# adjust ArrayList indexes to account for newly removed element
for i in range(internalIndex, len(self.curves)):
self.curves[i].decrementIndex()
"""*
* Removes the given curve from this GChart.
* <p>
*
* If the given curve is <tt>None</tt> or is not a curve on this GChart,
* an exception is thrown.
*
* <p>
*
* @param curve the curve to be removed.
*
* @see #removeCurve(int) removeCurve(int)
*
"""
def removeCurve(self, curve):
if None == curve:
raise IllegalArgumentException("Curve cannot be None.")
index = getCurveIndex(curve)
if index == NAI:
raise IllegalArgumentException("Curve is not one of this GChart's curves.")
if index < 0:
raise IllegalArgumentException("System curves cannot be removed (this should be impossible; a GChart bug is likely.)")
else:
removeCurve(index)
"""*
** Specifies the background color of the chart as a whole.
**
** <p>
** The default background color is <tt>USE_CSS</tt>.
** <p>
**
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor the chart's background color, in a standard
** CSS color string format.
**
**
** @see #USE_CSS USE_CSS
**
*"""
def setBackgroundColor(self, cssColor):
self.chartDecorationsChanged = True
self.backgroundColor = cssColor
"""*
** Specifies a URL that points to the transparent, 1 x 1 pixel,
** "blank GIF" that GChart uses in order to render your
** chart without adding spurious "missing image" icons to it.
** <p>
**
** When GWT compiles an application that imports the GChart
** library, it automatically adds an appropriate blank
** image, <tt>gchart.gif</tt>, to the module base directory
** (this is the directory into which GWT also copies your
** compiled Javascript, all the files in your public
** directory, etc.). <p>
**
** By default, GChart uses the following blank image URL:
** <p>
**
** <pre>
** pygwt.getModuleBaseURL() + "gchart.gif"
** </pre>
** <p>
**
** <small> Earlier versions used "gchart.gif" as this default url.
** <a href="http:#groups.google.com/group/Google-Web-Toolkit/msg/4be3f19dc14f958a">
** This GWT forum post by Dean S. Jones</a> identified the
** need to add the <tt>pygwt.getModuleBaseURL()</tt> prefix.
** </small>
** <p>
**
** Note that this default adds a potentially very
** long URL to every <tt>img</tt> element added by GChart to
** render your chart, which can (in theory) more than double
** the memory required to represent your chart in the
** browser, because the absolute URLs can be of undetermined
** length. In practice, browser memory usage increases of
** 10% have been observed with the on-line demo GChart and a
** typicial, 60-odd character absolute URL. <p>
**
** You have several alternatives to the above default that can
** often reduce the length of the URL and thus save browser
** memory:
**
** <p>
**
** <ol> <li>Simply copy <tt>gchart.gif</tt> from the module
** base directory into your host page's base directory, and
** then use <tt>setBlankImageURL("gchart.gif")</tt> to access
** this URL relatively.
**
** <li>If the relative path from the host page base
** directory to the module base directory is
** reasonably short, pass that alternative
** relative URL to this method (note that all
** relative URLs are interpreted relative to the base
** directory of the host page containing your GChart).
**
** <li>Place a copy of <tt>gchart.gif</tt> into
** a directory whose absolute URL is very short,
** and then pass that short absolute URL to this method.
**
** </ol>
** <p>
**
** <small> <i>Special note to anyone reading
** this who designed HTML's <tt>image</tt> tag:</i> If you
** had provided a <tt>src=none</tt> option, this method
** would not have to exist.
** </small>
** <p>
**
** <i>Tip:</i> If you already have an appropriate blank
** gif on your site that is accessible from the host
** page via a reasonably short URL there is no need to
** copy <tt>gchart.gif</tt>. You can just pass that URL
** to this method.
**
** <p>
**
** <i>Note:</i> Though GChart uses this blank image by default,
** you can use the <tt>setImageURL</tt> method to specify a
** non-blank image for use in rendering a specific curve.
** <p>
**
**
** @param blankImageURL a URL that points to a 1 x 1 pixel
** transparent image that GChart needs to render your
** charts without adding a spurious "missing image" icon.
**
** @see #getBlankImageURL getBlankImageURL
** @see #DEFAULT_BLANK_IMAGE_URL DEFAULT_BLANK_IMAGE_URL
** @see Symbol#setImageURL setImageURL
**
*"""
def setBlankImageURL(self, _blankImageURL):
if _blankImageURL != self.blankImageURL:
self.blankImageURL = _blankImageURL
# Decided not to prefetch blank image URL because 1) pre-fetching
# doesn't improve performance noticably in tested browsers,
# 2) there are reports of possible memory leaks associated with
# its use in the GWT issue tracker, and 3) users can
# easily do the prefetch on their own if they want to, and that
# is really the right place to do a prefetch anyway.
# Image.prefetch(GChart.getBlankImageURL())
"""*
* Defines this GChart's hover parameter interpreter.
* <p>
*
* Hovertext template strings can include <tt>${</tt>...
* <tt>}</tt> bracketed
* references to built-in parameters such as <tt>${x}</tt>
* and <tt>${y}</tt> that get get replaced with appropriate
* string representations of the x or y values of the
* hovered-over point in displayed hovertext. You can add
* new, custom, named parameters, and/or redefine the
* meaning of built-in parameters, by passing a hover parameter
* interpreter to this method.
* <p>
*
* For sample code that shows you how to define a hover
* parameter interpreter, see <tt>HoverParameterInterpreter</tt>.
*
* @see HoverParameterInterpreter HoverParameterInterpreter
* @see Symbol#setHovertextTemplate setHovertextTemplate
*
* @param hpi the hover parameter interpreter to use with all
* hovertext templates on this GChart (this interpreter is
* responsible for replacing <tt>${</tt>...<tt>}</tt>
* bracketed embedded parameter names in the hover text
* template with appropriate HTML snippets representing the
* value of that parameter at the hovered-over point).
*
"""
def setHoverParameterInterpreter(self, hpi):
self.hoverParameterInterpreter = hpi
"""*
* Specifies if merely hovering over a point is sufficient to select
* it and display its hover annotation (<tt>True</tt>), or if an
* actual click is needed (<tt>False</tt>). <p>
*
* With the default of <tt>True</tt>, points are auto-selected as
* the user "touches" them with the mouse-attached "brush"--no
* clicking is required. <p>
*
* When hover touching is disabled, a GChart can be used in a manner
* analogous to a single-selection (sorry there's no multi-selection
* capability) listbox, with its click-selectable points playing the
* role of the selectable list items. Specifically, disabling hover
* touching lets you move the mouse freely without any danger of
* changing the selected point--the point even remains selected if
* the mouse moves entirely off the chart. This is helpful when your
* application follows the common pattern of "select the thing you
* want to operate on, then issue a command that operates on that
* thing". This option is also helpful if you use very
* compute-intensive hover widgets, or if you simply prefer
* explictly-clicked-open/closed pop-up annotations.<p>
*
* <small> <i>How to Stop Leaky Clicks:</i> In IE7 and the hosted
* mode browser, clicking ahead on a <tt>Button</tt> widget "leaks"
* clicks upwards to the enclosing parent, even if you call
* <tt>event.cancelBubble(True)</tt>. Such "leaky clicks" can
* inappropriately change the selected point, when you really just
* wanted to operate on it. This does not happen in Firefox 2, 3, or
* Chrome, whose buttons properly "eat" the clicks--even when they
* come in fast. To workaround the problem, you can place the
* buttons into a hover widget (as shown in
* <tt>GChartExample21.java</tt> in the chart gallery). This works
* because GChart applies checks that ignore any mouse events that
* occur within the rectangular region associated with the opened
* hover widget. </small> <p>
*
* For an example that uses <tt>setHoverTouchingEnabled(False)</tt>
* to allow the user to change the y-value of the selected point,
* see the Chart Gallery's <a
* href="package-summary.html#GChartExample21"> GChartExample21</a>.
*
*
* @param hoverTouchingEnabled <tt>True</tt> (the default) if you
* want users to be able to select points simply by hovering over
* them with their mouse, <tt>False</tt> if you want to
* require that they actually click on points to select them.
*
* @see #getHoverTouchingEnabled getHoverTouchingEnabled
* @see Symbol#setBrushHeight setBrushHeight
* @see #touch touch
* @see #update update
* @see HoverUpdateable HoverUpdateable
*
"""
def setHoverTouchingEnabled(self, hoverTouchingEnabled):
self.hoverTouchingEnabled = hoverTouchingEnabled
"""*
** Specifies the color of the border around the chart as
** a whole.
**
** <p>
** The default border color is <tt>USE_CSS</tt>.
**
** <p>
** <blockquote><small>
** <i>Tip:</i> No border will appear if either <tt>borderStyle</tt>
** is <tt>none</tt>, <tt>borderWidth</tt> is <tt>0px</tt> or
** <tt>borderColor</tt> is <tt>transparent</tt>. Since
** these will often be the "CSS inherited" values,
** generally, it's best to set all three properties
** whenever you set any one of them.
** </small></blockquote>
** <p>
**
**
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor the color of the chart's border, in a standard
** CSS color string format.
**
** @see #setBorderWidth(String) setBorderWidth
** @see #setBorderStyle(String) setBorderStyle
** @see #getBorderColor getBorderColor
** @see #USE_CSS USE_CSS
**
*"""
def setBorderColor(self, cssColor):
self.chartDecorationsChanged = True
if self.borderColor is None or self.borderColor == TRANSPARENT_BORDER_COLOR:
raise IllegalArgumentException(
"None and TRANSPARENT_BORDER_COLOR are not allowed. This method requires a valid CSS color specification String.")
self.borderColor = cssColor
"""*
** Sets style of the border around the chart as a whole.
**
** <p>
** The default border style is <tt>USE_CSS</tt>.
** <p>
**
** <p>
** <blockquote><small>
** <i>Tip:</i> No border will appear if either <tt>borderStyle</tt>
** is <tt>none</tt>, <tt>borderWidth</tt> is <tt>0px</tt> or
** <tt>borderColor</tt> is <tt>transparent</tt>. Since
** these will often be the "CSS inherited" values,
** generally, it's best to set all three properties
** whenever you set any one of them.
** </small></blockquote>
** <p>
**
**
** @param borderStyle a CSS border style such as
** "solid", "dotted", "dashed", etc.
**
** @see #getBorderStyle getBorderStyle
** @see #setBackgroundColor(String) setBackgroundColor
** @see #setBorderColor(String) setBorderColor
** @see #setBorderWidth(String) setBorderWidth
** @see #USE_CSS USE_CSS
**
**
*"""
def setBorderStyle(self, borderStyle):
self.chartDecorationsChanged = True
self.borderStyle = borderStyle
"""*
** Specifies the width of the border around the chart as a whole.
**
** <p>
** The default border width is <tt>USE_CSS</tt>.
**
** <p>
** <blockquote><small>
** <i>Tip:</i> No border will appear if either <tt>borderStyle</tt>
** is <tt>none</tt>, <tt>borderWidth</tt> is <tt>0px</tt> or
** <tt>borderColor</tt> is <tt>transparent</tt>. Since
** these will often be the "CSS inherited" values,
** generally, it's best to set all three properties
** whenever you set any one of them.
** </small></blockquote>
**
** @param cssWidth width of the border around the chart as a whole,
** expressed as a CSS border-width specification string, such
** as "1px".
**
** @see #getBorderWidth getBorderWidth
** @see #setBorderStyle(String) setBorderStyle
** @see #setBorderColor(String) setBorderColor
** @see #USE_CSS USE_CSS
*"""
def setBorderWidth(self, cssWidth):
self.chartDecorationsChanged = True
self.borderWidth = cssWidth
"""*
* Convenience method equivalent to
* <tt>setChartFootnotes(HTML(html))</tt>.
*
* @param html HTML text used to define the chart's title.
*
* @see #setChartFootnotes(Widget) setChartFootnotes(Widget)
"""
def setChartFootnotes(self, html):
setChartFootnotes(HTML(html))
"""* Sets widget that appears just below the chart.
* <p>
*
* The widget will vertically centered within a band just
* below the x axis label that stretches along the entire
* bottom edge of the chart, and whose height is defined by
* <tt>setChartFootnotesThickness</tt>.
*
* <p>
*
* The widget will either be left justified, or horizontally
* centered, within this band depending on the property
* defined by <tt>setChartFootnotesLeftJustified</tt>
*
*
* @param chartFootnotes widget representing the chart's footnotes
*
* @see #setChartFootnotes(String) setChartFootnotes(String)
* @see #setChartFootnotesThickness setChartFootnotesThickness
* @see #getChartFootnotes getChartFootnotes
* @see #setChartFootnotesLeftJustified
* setChartFootnotesLeftJustified
"""
def setChartFootnotes(self, chartFootnotes):
self.chartDecorationsChanged = True
self.chartFootnotes = chartFootnotes
"""* Defines if this chart's footnotes are left justified,
* or horizontally centered across the bottom edge of the
* chart.
* <p>
* Note that a chart's footnotes are always vertically
* centered within the band at the bottom of the chart
* reserved for chart footnotes. Use the
* <tt>setChartFootnotesThickness</tt> method to set the
* height of this band.
*
* @param footnotesLeftJustified True to position chart footnotes
* flush against the left edge of the chart, False (the default) to
* center them horizontally across the chart's bottom edge.
*
* @see #setChartFootnotes(String) setChartFootnotes(String)
* @see #getChartFootnotes getChartFootnotes
* @see #setChartFootnotesThickness
"""
def setChartFootnotesLeftJustified(self, footnotesLeftJustified):
self.chartDecorationsChanged = True
self.chartFootnotesLeftJustified = footnotesLeftJustified
"""*
** Sets the thickness (height) of the rectangular region at
** the bottom of the chart allocated for the footnotes.
** <p>
**
** The width of this region always equals the width of
** the entire GChart (including legend and axis labels).
** <p>
**
** Your footnotes widget is always vertically centered
** in this region.
** <p>
**
**
** Your footnotes widget will either be horizontally
** centered in this region, or left justified in it,
** depending on the property defined by the
** <tt>setChartFootnotesLeftJustified</tt> method.
** <p>
**
** This setting has no impact on chart layout if the
** footnotes widget is <tt>None</tt> (the default); the
** rectangular footnotes region is entirely eliminated, and
** in effect has a 0 thickness, in that case.
** <p>
**
** If you set the footnotes thickness to <tt>NAI</tt>
** (the default) GChart will use a thickness based on
** the estimated number of (<tt><br></tt> or
** <tt><li></tt>
** delimited) lines.
**
** @param thickness the thickness (height) of the rectangle
** that contains the footnotes, in pixels, or
** <tt>NAI</tt> to use the default thickness.
**
** @see #getChartFootnotesThickness getChartFootnotesThickness
** @see #setChartFootnotesLeftJustified setChartFootnotesLeftJustified
** @see NAI NAI
** @see #DEFAULT_FOOTNOTES_THICKNESS
** DEFAULT_FOOTNOTES_THICKNESS
**
*"""
def setChartFootnotesThickness(self, thickness):
self.chartDecorationsChanged = True
self.footnotesThickness = thickness
"""*
* Convenience method equivalent to
* <tt>setXChartSize(xChartSize); setYChartSize(yChartSize)</tt>.
*
* @param xChartSize number of x-pixels in the curve
* display area of the chart
* @param yChartSize number of y-pixels in the curve
* display area of the chart
*
* @see #setXChartSize setXChartSize
* @see #setYChartSize setYChartSize
*
"""
def setChartSize(self, xChartSize, yChartSize):
self.setXChartSize(xChartSize)
self.setYChartSize(yChartSize)
# returns x,y min/max over every plotted curve
"""*
* Specifies the widget that appears centered just above the chart.
*
* @param chartTitle the widget to be used as this chart's title.
*
* @see #setChartTitle(String) setChartTitle(String)
* @see #setChartTitleThickness setChartTitleThickness
* @see #getChartTitle getChartTitle
*
"""
def setChartTitle(self, chartTitle):
if isinstance(chartTitle, basestring):
chartTitle = HTML(chartTitle)
self.chartDecorationsChanged = True
self.chartTitle = chartTitle
"""*
** Sets the thickness (height) of the rectangular region at
** the top of the chart allocated for the title.
** <p>
**
** Your title widget is always centered vertically and
** horizontally within this rectangular region. <p>
**
** This setting has no impact on chart layout if the title
** widget is <tt>None</tt>, since the title-holding
** region is entirely eliminated in that case.
**
** If you set the title thickness to <tt>NAI</tt>
** (the default) GChart will use a thickness that is
** based on the the number of <tt><br></tt> or
** <tt><li></tt> delimited HTML lines if the title Widget
** implements <tt>HasHTML</tt>.
**
** @param thickness the thickness (height) of the rectangle
** that contains the title, in pixels, or
** <tt>NAI</tt> to use the default thickness.
**
** @see #getChartTitleThickness getChartTitleThickness
** @see NAI NAI
** @see #DEFAULT_TITLE_THICKNESS
** DEFAULT_TITLE_THICKNESS
**
*"""
def setChartTitleThickness(self, thickness):
self.chartDecorationsChanged = True
self.titleThickness = thickness
"""*
* Specifies if this chart will clip any rendered chart elements
* (including hover selection feedback and popup annotations)
* that extends beyond the bounds of the decorated chart.
* <p>
*
* The decorated chart includes not just the plot area, but
* space allocated for titles, footnotes, legend key, axis
* labels, tick marks, etc. The size of this decorated chart
* can be obtained via the <tt>getXChartSizeDecorated</tt>
* and <tt>getYChartSizeDecorated</tt> methods.
* <p>
*
* <small> Note that, in non-IE browsers, drawing a curve via
* <tt>GWTCanvas</tt> that falls outside the bounds of the
* decorated chart could occlude mouse events over elements
* on the enclosing page <i>that fall within the smallest
* bounding rectangle that contains the canvas-rendered
* curve</i>. HTML rendering (IE's element-based VML used by
* <tt>GWTCanvas</tt> is essentially HTML-like in this respect) only
* creates such occlusions at the positions where the curve
* is actually rendered. </small>
*
* @param clipToDecoratedChart use <tt>True</tt> to clip
* off-the-decorated-chart symbols, annotations, etc. or
* <tt>False</tt> (the default) to allow such chart elements to be
* drawn outside of the rectangular region allocated for the
* chart.
*
* @see #getClipToDecoratedChart getClipToDecoratedChart
* @see #setClipToPlotArea setClipToPlotArea
* @see #getXChartSizeDecorated getXChartSizeDecorated
* @see #getYChartSizeDecorated getYChartSizeDecorated
* @see #setCanvasFactory setCanvasFactory
*
"""
def setClipToDecoratedChart(self, clipToDecoratedChart):
self.chartDecorationsChanged = True
invalidateAccessibleCurves()
self.clipToDecoratedChart = clipToDecoratedChart
"""* Specifies if rendered graphics falling
** outside the plot area will be clipped off.
* <p>
*
* <i>Note:</i> This clipping does not apply to the hover selection
* feedback. In particular, points that fall outside the plot area,
* though not visible, will still display their selection feedback
* and pop-up hover annotations when the user mouses over them.
*
* @param clipToPlotArea <tt>False</tt> (the default) to display
* off-the-plot-area graphics,
* <tt>True</tt>
* to clip them off.
*
* @see #getClipToPlotArea getClipToPlotArea
* @see #setClipToDecoratedChart setClipToDecoratedChart
*
"""
def setClipToPlotArea(self, clipToPlotArea):
self.chartDecorationsChanged = True
self.invalidateAccessibleCurves()
self.clipToPlotArea = clipToPlotArea
"""*
* Sets the symbol border colors that are used by default for
* newly created curves. The
* array must contain one or more elements, each a standard
* CSS or RGBA color specification string (see the
* <tt>setBackgroundColor</tt> link below for more
* on CSS color specification strings) or the
* special GChart keyword <tt>TRANSPARENT_BORDER_COLOR</tt>.
* <p>
*
* GChart uses the first color in this array as the default border
* color of the first curve added (via <tt>addCurve</tt>), the
* second color for the second curve added, and so on. If more
* curves are added than the number of elements in the default
* border colors array, the sequence is repeated.
*
* <p>
* <small>
* Note that each curve/symbol's default color is "locked in" at the
* point when that curve/symbol is first added, based on the
* total number of curves at that time.
* </small>
*
* <p>
*
* Because, by default, GChart uses a transparent symbol background
* color, the default border color will usually, in effect, define
* the default color of each curve. The default border color
* also defines the
* default color of point-to-point connecting lines in a line
* chart.<p>
*
* If not explicitly specified via this method, GChart uses
* <tt>GChart.DEFAULT_SYMBOL_BORDER_COLORS</tt> by default.
* However, most people find the
* color sequence <a href=
* "http:#ui.openoffice.org/VisualDesign/OOoChart_colors_drafts.html#02">
* used by OpenOffice's Charts</a> more aesthetically pleasing.
* The <a
* href="package-summary.html#GChartExample22a">World's Simplest
* Line Chart Editor</a> example chart contains a line of
* code that makes GChart use the OpenOffice defaults.
* <p>
*
* <small>This feature was added in response to an email from
* <a href="http:#www.profilercorp.com">Joe Cole</a>
* and <a href="http:#gwt-ext.com/forum/viewtopic.php?f=13&t=3465&start=3">
this post</a> by Sanjiv Jivan.
* They both pointed out the importance of changing GChart's
* default colors.</small>
*
*
* @param defaultBorderColors array of CSS color strings
* whose successive elements define the initial symbol border colors
* for curves in the order that they are added.
*
* @see #DEFAULT_SYMBOL_BORDER_COLORS DEFAULT_SYMBOL_BORDER_COLORS
* @see #TRANSPARENT_BORDER_COLOR TRANSPARENT_BORDER_COLOR
* @see Symbol#setBackgroundColor setBackgroundColor
* @see Symbol#setBorderColor setBorderColor
* @see #addCurve addCurve
*
"""
def setDefaultSymbolBorderColors(self, defaultBorderColors):
if None == defaultBorderColors:
raise IllegalArgumentException(
"defaultBorderColors array cannot be None.")
elif defaultBorderColors.length < 1:
raise IllegalArgumentException(
"defaultBorderColors array must have at least 1 element.")
else:
self.defaultSymbolBorderColors = defaultBorderColors
"""* Sets the font-family used in tick labels, point annotations,
** legends, titles, footnotes, and
** axis labels.
** <p>
** If not specified, the default value is <tt>USE_CSS</tt>.
** <p>
**
** Note that titles, footnotes and axis labels are
** defined via externally created Widgets, which are free
** to override the font-family specified by this
** method.
**
** @param fontFamily a CSS font-family specification, such
** as "Arial, sans-serif"
**
** @see #getFontFamily getFontFamily
** @see #USE_CSS USE_CSS
**
*"""
def setFontFamily(self, fontFamily):
self.chartDecorationsChanged = True
self.fontFamily = fontFamily
"""*
** Specifies the single color used for all gridlines, axes
** lines, and tick marks.
**
**
** <p>
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor the color, in CSS standard color format,
** to be used for all gridlines, axes, and tick marks.
**
** @see #getGridColor getGridColor
** @see #DEFAULT_GRID_COLOR DEFAULT_GRID_COLOR
**
*"""
def setGridColor(self, cssColor):
#TODO: support line style for dotted/dashed gridlines lines,
# allow tick and grid colors to be specified separately, etc.
self.getSystemCurve(XGRIDLINES_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(YGRIDLINES_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(Y2GRIDLINES_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(XAXIS_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(YAXIS_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(Y2AXIS_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(XTICKS_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(YTICKS_ID).getSymbol().setBorderColor(cssColor)
self.getSystemCurve(Y2TICKS_ID).getSymbol().setBorderColor(cssColor)
"""*
** Sets the background color of the chart's legend.
**
**
** <p>
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor the legend's background color, in a standard
** CSS color string format.
**
** @see #getLegendBackgroundColor getLegendBackgroundColor
** @see #DEFAULT_LEGEND_BACKGROUND_COLOR
** DEFAULT_LEGEND_BACKGROUND_COLOR
*"""
def setLegendBackgroundColor(self, cssColor):
self.chartDecorationsChanged = True
self.legendBackgroundColor = cssColor
"""*
** Sets the border color of the chart's legend.
**
**
** <p>
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor the color of the legend's border, in a standard
** CSS color string format, of the special GChart keyword
** <tt>TRANSPARENT_BORDER_COLOR</tt> for a transparent border.
**
**
** @see #getLegendBorderColor getLegendBorderColor
** @see #DEFAULT_LEGEND_BORDER_COLOR DEFAULT_LEGEND_BORDER_COLOR
** @see #TRANSPARENT_BORDER_COLOR TRANSPARENT_BORDER_COLOR
**
*"""
def setLegendBorderColor(self, cssColor):
self.chartDecorationsChanged = True
self.legendBorderColor = cssColor
"""*
** Sets the width of the chart legend's border.
**
** @param width the width of the legend's border, in pixels
**
** @see #getLegendBorderWidth getLegendBorderWidth
** @see #DEFAULT_LEGEND_BORDER_WIDTH DEFAULT_LEGEND_BORDER_WIDTH
*"""
def setLegendBorderWidth(self, width):
self.chartDecorationsChanged = True
self.legendBorderWidth = width
"""*
** Sets style of the border around the chart's legend (key).
**
** <p>
**
** <p>
** @param borderStyle a CSS border style such as
** "solid", "dotted", "dashed", etc.
**
** @see #getLegendBorderStyle getLegendBorderStyle
** @see #setLegendBackgroundColor setLegendBackgroundColor
** @see #setLegendBorderColor setLegendBorderColor
** @see #DEFAULT_LEGEND_BORDER_STYLE DEFAULT_LEGEND_BORDER_STYLE
*"""
def setLegendBorderStyle(self, borderStyle):
self.chartDecorationsChanged = True
self.legendBorderStyle = borderStyle
"""*
** Specifies the color of the legend's font. Default is
** <tt>DEFAULT_FONT_COLOR</tt>.
**
**
** <p>
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor color of the font used to display the
** labels in the legend.
**
** @see #getLegendFontColor getLegendFontColor
** @see #DEFAULT_FONT_COLOR DEFAULT_FONT_COLOR
**
*"""
def setLegendFontColor(self, cssColor):
self.chartDecorationsChanged = True
self.legendFontColor = cssColor
"""*
* Specifies the CSS font size, in pixels, of text displayed
* in the chart's legend (also know as a chart's key).
* <p>
* This size also governs the size of the symbol icon
* displayed in the legend.
* <p>
* Default is <tt>DEFAULT_LEGEND_FONTSIZE</tt>.
*
* @param legendFontSize the font size of legend text
*
* @see #getLegendFontSize getLegendFontSize
* @see #DEFAULT_LEGEND_FONTSIZE DEFAULT_LEGEND_FONTSIZE
*
"""
def setLegendFontSize(self, legendFontSize):
self.chartDecorationsChanged = True
self.legendFontSize = legendFontSize
"""*
** Specifies the cssStyle of the font used to render the
** legend's labels. Default is <tt>DEFAULT_FONT_STYLE</tt>.
**
** @param cssStyle any valid CSS font-style, namely,
** normal, italic, oblique, or inherit.
**
** @see #getLegendFontStyle getLegendFontStyle
** @see #DEFAULT_FONT_STYLE DEFAULT_FONT_STYLE
*"""
def setLegendFontStyle(self, cssStyle):
self.chartDecorationsChanged = True
self.legendFontStyle = cssStyle
"""*
** Specifies the weight of the font used in the labels of the
** legend. Default is <tt>DEFAULT_FONT_WEIGHT</tt>.
**
** @param cssWeight a CSS font-weight specification, such as
** bold, bolder, normal, light, 100, 200, ... or 900.
**
** @see #getLegendFontWeight getLegendFontWeight
** @see #DEFAULT_FONT_WEIGHT DEFAULT_FONT_WEIGHT
*"""
def setLegendFontWeight(self, cssWeight):
self.chartDecorationsChanged = True
self.legendFontWeight = cssWeight
"""*
** Sets the thickness (width) of the rectangular region at
** the right of the chart allocated for the legend key.
** <p>
**
** This setting has no impact on chart layout if the
** legend key is not visible, since the legend key's
** rectangular region is entirely eliminated in that
** case.
**
** <p>
**
** If the legend thickness is set to <tt>NAI</tt>
** (the default) GChart uses an heuristic to set the legend
** thickness based on the number of characters in each
** curve's legend label.
**
**
** @param legendThickness the thickness (width) of the rectangle
** that contains the legend key, in pixels, or
** <tt>NAI</tt> to use a built-in heurstic
** to determine the legend width.
**
** @see #getLegendThickness getLegendThickness
** @see Curve#setLegendLabel setLegendLabel
** @see Y2Axis#setAxisLabelThickness Y2Axis.setAxisLabelThickness
**
*"""
def setLegendThickness(self, legendThickness):
self.chartDecorationsChanged = True
self.legendThickness = legendThickness
"""*
* Specifies if the legend is to be visible on this chart.
* Legends are visible by default. However, a legend is only
* generated if at least one curve's legend label has been
* specified.
*
* @param isLegendVisible True to display the legend, False to
* hide it.
*
* @see #isLegendVisible isLegendVisible
* @see Curve#setLegendLabel setLegendLabel
"""
def setLegendVisible(self, legendVisible):
self.chartDecorationsChanged = True
self.legendVisible = legendVisible
"""*
* By default, this property is <tt>False</tt>, which means
* that GChart will retain no-longer-needed Image and Grid
* widgets (plus any user object references associated with
* those widgets, such as those created via the
* <tt>setAnnotationText</tt> and
* <tt>setAnnotationWidget</tt> methods) between
* <tt>updates</tt> in the expectation that they may be
* needed by future updates. This strategy often makes
* updates faster, because building Image and Grid
* elements "from scratch" is very expensive. However,
* strictly speaking, GChart is holding onto memory it no
* longer needs to render the chart <i>right now</i>--which
* would normally be considered a memory leak if it were not
* being done deliberately. <p>
*
* If <tt>optimizeForMemory</tt> is set to <tt>True</tt>,
* GChart will (at the very next <tt>update()</tt> call) free
* up any Image or Grid elements that are no longer required
* to render the current chart. Should a chart's size grow back
* to a former size, the subsequent update would be slower,
* though.
*
* <p> Charts that use exactly the same number of Image and
* Grid elements for each update (for example a bar chart
* where the number of bars is fixed) will see no impact on
* either memory use or update speeds by setting this
* parameter. Charts that have a highly variable number of
* Image or Grid elements (for example, a chart whose number
* of points varies randomly between 5 and 500) may see a
* very large impact on speed (False is faster) or memory
* (True is more compact).
* <p>
*
* The setting of this parameter never has any impact on the
* speed or memory used on the <i>very first</i> chart
* update.
* <p>
*
* In one test using the future oil price simulation chart of
* GChart's live demo (which has only small changes in the
* number of elements required to render the chart between
* updates) setting this parameter to True made the updates,
* on average, around 10% slower, but also reduced the memory
* footprint by around 2%.
*
* @param optimizeForMemory <tt>True</tt> to optimize updates
* to use less memory, <tt>False</tt> (the default) to
* optimize them to use less time.
*
* @see #update update
*
"""
def setOptimizeForMemory(self, optimizeForMemory):
self.optimizeForMemory = optimizeForMemory
"""*
** Specifies the amount of padding to add just inside of the
** chart's border, as a CSS padding specification string.
** <p>
**
** <p>
** The default padding is <tt>USE_CSS</tt>.
**
** <p>
**
** @param cssPadding the width of the padding, as a CSS padding
** specification string
** (e.g. use "1px" to introduce a 1 pixel padding
** just between the chart' border and the chart itself)
**
** @see #getPadding getPadding
** @see #setBorderWidth setBorderWidth
** @see #setBorderStyle(String) setBorderStyle
** @see #setBorderColor(String) setBorderColor
** @see #USE_CSS USE_CSS
*"""
def setPadding(self, cssPadding):
self.chartDecorationsChanged = True
self.padding = cssPadding
"""*
** Specifies the background color of the area of the chart
** in which symbols representing curve data are displayed
**
**
** <p>
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor CSS color string defining the plot
** area's background color
**
** @see #getPlotAreaBackgroundColor getPlotAreaBackgroundColor
*"""
def setPlotAreaBackgroundColor(self, cssColor):
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setBackgroundColor(cssColor)
"""*
** Specifies the color of the border around the area of the
** chart in which symbols representing curve data are
** displayed.
**
**
** <p>
** For more information on standard CSS color
** specifications see the discussion in
** {@link Symbol#setBackgroundColor Symbol.setBackgroundColor}.
** <p>
**
** @param cssColor CSS color string defining the color of
** the plot area's border
**
** @see #getPlotAreaBorderColor getPlotAreaBorderColor
*"""
def setPlotAreaBorderColor(self, cssColor):
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setBorderColor(cssColor)
"""*
** Specifies the width of the border around the area of the
** chart in which symbols representing curve data are
** displayed.
**
** @param width the width, in pixels, of the border around
** the plot area
**
** @see #getPlotAreaBorderWidth getPlotAreaBorderWidth
*"""
def setPlotAreaBorderWidth(self, width):
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setBorderWidth(width)
"""*
** Sets style of the border around the chart's plot area
** (the rectangular area where the curves are drawn).
**
** <p>
**
** <p>
** @param borderStyle a CSS border style such as
** "solid", "dotted", "dashed", etc.
**
** @see #getPlotAreaBorderStyle getPlotAreaBorderStyle
** @see #setPlotAreaBackgroundColor setPlotAreaBackgroundColor
** @see #setPlotAreaBorderColor setPlotAreaBorderColor
*"""
def setPlotAreaBorderStyle(self, borderStyle):
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setBorderStyle(borderStyle)
"""*
* Sets the image URL that defines the background of
* the GChart plot area. The GChart plot area is the
* rectangular region defined by the x and y axes of
* the plot, but does not include those axes (or
* their ticks).
* <p>
* Note that by default, or if this URL is set to <tt>None</tt>,
* GChart will use the URL returned by
* <tt>getBlankImageURL</tt>.
* <p>
*
* <small><b>Ideas/tips for using the plot area background
* URL:</b>
* <blockquote>
* <ol>
* <li> It's often best to
* exactly match the width and height of the image
* with the GChart plot area width and height
* (defined via (via <tt>setChartSize</tt>). Otherwise,
* the image will be scaled up or down to fit the
* plot area, which usually doesn't look that great.
*
* <li>Note that since a Google Chart API url is just
* an image url to GChart, you can easily use a
* Google Chart API url to define the background of an
* otherwise client-side chart. For example, you
* might place a 3-D pie chart behind
* a rapidly changing client-side GChart bar chart.
*
* <li> Note that this method's image will appear <i>behind</i>
* every gridline and curve on the chart. To overlay
* images <i>on top of</i> the gridlines or other curves, or
* even to place them outside of the plot area, use a
* dedicated curve and its symbol's <tt>setImageURL</tt>
* method, or simply embed such images within HTML-defined
* point annotations.
* </ol>
*
* </blockquote></small>
*
* @see #getPlotAreaImageURL getPlotAreaImageURL
* @see #setBlankImageURL setBlankImageURL
* @see GChart.Symbol#setImageURL setImageURL
*
* @param imageURL URL of the image used as the background
* of the plot area.
*
"""
def setPlotAreaImageURL(self, imageURL):
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setImageURL(imageURL)
"""* @deprecated
**
** Equivalent to
** <tt>setClipToPlotArea(!showOffChartPoints)</tt>.
** Use that method instead.
** <p>
**
** <small>
** As of GChart 2.5, the clip-to-plot-area algorithm no
** longer drops the entire symbol if it's x,y coordinates
** are outside of the plot area; instead, it clips them
** off in the traditional "<tt>overflow: hidden</tt>" manner.
** Though unlikely you would need to, there is no easy way
** to recreate the previous behavior. <p>
**
** This change was made so that both rectangular HTML and
** continuous, canvas-rendered
** chart elements would be clipped in a consistent and
** sensible way.
** </small>
**
** @see #setClipToPlotArea setClipToPlotArea
**
*"""
def setShowOffChartPoints(self, showOffChartPoints):
self.setClipToPlotArea(not showOffChartPoints)
"""* @deprecated
**
** Equivalent to
** setClipToDecoratedChart(!showOffDecoratedChart), please
** use that method instead.
**
** @see #setClipToDecoratedChart setClipToDecoratedChart
*"""
def setShowOffDecoratedChartGlyphs(self, showOffDecoratedChartGlyphs):
self.setClipToDecoratedChart(not showOffDecoratedChartGlyphs)
"""*
* Returns the curve that the mouse "brush" is currently
* "touching" (the so-called "hovered over" point), or <tt>None</tt>
* if none.
* <p>
*
* Convenience method equivalent to (when the touched point is
* not <tt>None</tt>) <tt>getTouchedPoint().getParent()</tt>.
* See <tt>getTouchedPoint</tt> for full details.
* <p>
*
*
* See the <tt>setBrushHeight</tt> method for the rules
* GChart uses to determine the currently touched point.
* <p>
*
*
* @return a reference to the curve that the mouse "brush"
* is currently "touching".
*
* @see #getTouchedPoint getTouchedPoint
* @see Symbol#setBrushHeight setBrushHeight
* @see Symbol#setHoverSelectionSymbolType
* setHoverSelectionSymbolType
*
"""
def getTouchedCurve(self):
result = None
if None != self.getTouchedPoint():
result = self.getTouchedPoint().getParent()
return result
"""*
* Returns the point that the mouse "brush" is currently
* "touching" (the so-called "hovered over" point), or <tt>None</tt>
* if none.
*
* <p>
* <small> <i>Fine-print:</i> If the chart clicked on needs an
* update, this method returns the touched point <i>as
* of the last time the chart's in-browser (DOM) display was
* up-to-date</i>. If you don't assure that your chart's DOM display
* is up-to-date via other means (e.g. updating right after you
* change its specifications) a quick check with the
* <tt>isUpdateNeeded</tt> method and a subsequent <tt>update</tt>
* before accessing the touched point can be a good strategy.
* <p> </small>
*
*
* See the <tt>setBrushHeight</tt> method for the rules
* GChart uses to determine the currently touched point.
* <p>
*
* <small>
* <i>Warning:</i> The currently touched point, on FF2 (but not in
* IE7) can be changed (or set to <tt>None</tt>) by invoking
* <tt>Window.alert</tt>. Though I originally expected that such
* a modal alert box would "eat" all mouse events (and it does
* just that in IE7) in FF2 (and possibly other browsers)
* some mouse events on the alert box are also passed on up to
* the GChart. It's best for applications that need to "lock on"
* to the <i>initially</i> touched point to grab a
* reference to the touched point <i>before</i> performing any
* activity that allows the user to interact with the
* browser in ways that could possibly generate GChart-visible
* mouse events.
* </small>
* <p>
*
* @return a reference to the point that the mouse "brush"
* is currently "touching".
*
* @see #getTouchedCurve getTouchedCurve
* @see #touch touch
* @see Symbol#setBrushHeight setBrushHeight
* @see Symbol#setHoverSelectionSymbolType
* setHoverSelectionSymbolType
* @see #isUpdateNeeded isUpdateNeeded
* @see #update update
* @see Axis#getMouseCoordinate getMouseCoordinate
* @see Axis#clientToModel clientToModel
* @see Axis#modelToClient modelToClient
* @see Axis#pixelToModel pixelToModel
* @see Axis#modelToPixel modelToPixel
*
"""
def getTouchedPoint(self):
return self.plotPanel.touchedPoint
"""*
* Sets the number of pixels, in the horizontal
* dimension, available for curve display. Note that
* this curve display area does <i>not</i> include the
* axes themselves, their tick marks, their labels, etc.
*
* <p>
*
* <i>Note</i>: Most modern display devices use "square"
* pixels, that is, pixels whose width and height are
* the same. GChart tacitly assumes square pixels in
* many of its default settings.
*
*
* @param xChartSize the number of x-pixels in the chart region
* used for curve display.
*
* @see #getXChartSize getXChartSize
* @see #getXChartSizeDecorated getXChartSizeDecorated
* @see #setYChartSize setYChartSize
*
"""
def setXChartSize(self, xChartSize):
self.chartDecorationsChanged = True
self.xChartSize = xChartSize
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setWidth(xChartSize)
"""*
* Sets the number of pixels, in the vertical dimension,
* available for curve display. Note that this curve
* display region of the chart does <i>not</i> include
* the axes themselves, their tick marks, labels, etc.
*
* <p>
*
* <i>Note</i>: Most modern display devices use "square"
* pixels, that is, pixels whose width and height are
* the same. GChart tacitly assumes square pixels in
* many of its default settings.
*
* @param yChartSize the number of y-pixels in the chart region
* used for curve display.
*
* @see #getYChartSize getYChartSize
* @see #getYChartSizeDecorated getYChartSizeDecorated
* @see #setXChartSize setXChartSize
*
"""
def setYChartSize(self, yChartSize):
self.chartDecorationsChanged = True
self.yChartSize = yChartSize
c = self.getSystemCurve(PLOTAREA_ID)
c.getSymbol().setHeight(yChartSize)
"""*
* Simulates the user "touching" a point with the mouse, by
* performing those operations that occur when the user "hovers
* over" the specified point. In detail, this method does the
* following:<p>
*
* <ol>
*
* <li> The specified point is made the currently "touched point"
* (this is the reference returned by <tt>getTouchedPoint</tt>). <p>
*
* <li>If the previously touched point had a hover widget,
* that hover widget's <tt>hoverCleanup</tt> method is called.<p>
*
* <li>If the touched point has an associated hover widget, that
* widget's <tt>hoverUpdate</tt> method is called.<p>
*
* <li> Any hover selection feedback or hover annotation on
* any previously touched point is removed.<p>
*
* <li>Any hover annotation for the newly touched point is
* displayed as per the various hover annotation related
* specifications (e.g. <tt>setHoverLocation</tt>) associated with
* the symbol used to render the point.<p>
*
* <li> Any selection feedback for the newly touched point is
* displayed in accord with the hover selection feedback
* specificiations (e.g. <tt>setHoverSelectionBorderColor</tt>)
* associated with the symbol used to render the point.<p>
*
* </ol>
*
* Using <tt>None</tt> as the point to touch simulates
* the user moving the mouse into a region where it is not
* touching any point (for example, off the chart entirely).
* <p>
*
* Note that, as with all chart specification changes, you must
* invoke <tt>update</tt> before the point selection and other
* changes associated with this method will appear on the chart.
* <p>
*
* <i>Tip:</i> The touched point can sometimes be used in lieu of a
* point selection capability (which GChart lacks). For example, a
* dialog box that allowed users to choose data points by their
* names could "touch" the point associated with a user-selected
* name in order to highlight it on the chart.
*
* @param pointToTouch this method will perform appropriate
* operations (as described above) in order to simulate the user
* "touching" this point with their mouse.
*
* @see #getTouchedPoint getTouchedPoint
* @see #getTouchedCurve getTouchedCurve
* @see HoverUpdateable#hoverUpdate hoverUpdate
* @see HoverUpdateable#hoverCleanup hoverCleanup
* @see Symbol#setHoverWidget setHoverWidget
* @see Symbol#setHoverLocation setHoverLocation
* @see Symbol#setHoverSelectionBorderColor
* setHoverSelectionBorderColor
* @see Axis#getMouseCoordinate getMouseCoordinate
* @see Axis#clientToModel clientToModel
* @see Axis#modelToClient modelToClient
* @see Axis#pixelToModel pixelToModel
* @see Axis#modelToPixel modelToPixel
*
"""
def touch(self, pointToTouch):
self.plotPanel.touch(pointToTouch)
"""*
** Builds a chart that reflects current user-specified
** chart specs (curve data, symbol choices, etc.)
** <p>
**
** Before any of the chart specifications of the other
** methods of this class will actually be visible
** on the chart, you must call this method.
** <p>
**
** Typically, for efficiency, you would call this
** method only after you had made all of the desired
** chart specifications via the other methods.
**
** <p>
**
** By default, updates are optimized for speed, and this
** can end up wasting (usually not too much, though there
** are exceptions) memory. To optimize for memory
** instead, use the <tt>setOptimizeForMemory</tt> method.
** <p>
**
** For a discussion of Client-side GChart update times and
** how minimize them, see
** <a
** href="{@docRoot}/com/googlecode/gchart/client/doc-files/tipsformakingupdatesfaster.html">
** Tips for Making Client-side GChart Updates Faster</a>.
** <p>
**
** <i>Note</i> Hover feedback is disabled whenever the currently
** rendered chart does not match current chart specs, that is,
** whenever <tt>isUpdateNeeded</tt> returns <tt>True</tt>. Thus,
** to assure that hover feedback remains operational once your
** code returns control to the browser, be sure to call
** <tt>update()</tt> after making a series of changes to your
** chart's properties.
** <p>
**
** Understanding how <tt>update</tt> impacts visibility and size:
** <p>
** <blockquote>
** <small>
** Due to an implementation-related limitation,
** <tt>visibility: hidden</tt> won't hide a GChart
** (<tt>update</tt>
** commandeers the visibility attribute). Instead use
** <tt>display: none</tt> or, equivalently:
**
** <pre>
** myGChart.setVisible(False)
** </pre>
**
** If you need to avoid <tt>display: none</tt> (it can change
** page layout), you can also hide a GChart via lines such as:
**
** <pre>
** DOM.setStyleAttribute(myGChart.getElement(),"overflow","hidden")
** myGChart.setPixelSize(0, 0)
** </pre>
**
** This later approach gives you the option of leaving the top
** corner of the GChart visible, etc. Note that, with the next
** <tt>update</tt>, GChart will overwrite your size (based on the
** GChart properties that define the size of the the chart, such
** as <tt>setChartSize</tt> and <tt>set*Thickness</tt>)
** and your <tt>overflow:hidden</tt> (based on
** <tt>setClipToDecoratedChart</tt>) specifications. To preserve
** them (or in other special cases) you may need to apply such
** settings to an enclosing parent element.
**
** </small>
** </blockquote>
**
**
** @param option determines how the touched (or "hovered
** over") point changes as a result of this update. See
** <tt>TouchedPointUpdateOption</tt> for the available
** choices.
**
** @see TouchedPointUpdateOption TouchedPointUpdateOption
** @see #setOptimizeForMemory setOptimizeForMemory
** @see #isUpdateNeeded isUpdateNeeded
**
*"""
def update(self, option=None):
"""
* This method defines each curve's default pie slice
* orientations, and also separates each curve's points
* into the vertically or horizontally banded bins,
* that GChart needs to perform the hit testing
* that allows it to emulate "touching" points with
* the mouse.
* <p>
*
* Therefore, this line must come first.
*
"""
if option is None:
if self.getHoverTouchingEnabled():
option = TouchedPointUpdateOption.TOUCHED_POINT_UPDATED
else:
option = TouchedPointUpdateOption.TOUCHED_POINT_LOCKED
self.assembleChart()
if TouchedPointUpdateOption.TOUCHED_POINT_LOCKED == option:
# must re-touch (point position, hover-config can change)
self.plotPanel.touch(self.plotPanel.touchedPoint)
elif TouchedPointUpdateOption.TOUCHED_POINT_CLEARED == option:
# if needed, will clear out touched point & related feedback
self.plotPanel.touch(None)
elif TouchedPointUpdateOption.TOUCHED_POINT_UPDATED == option:
# re-determine which point is underneath the mouse now...
self.plotPanel.retouchObjectAtMousePosition()
"""
* Because hover feedback curves come at the end of the curve
* list, given how GChart's rendering process works, this
* second call only has to update these hover feedback curves
* (so it's not like we are really building the chart twice)
*
"""
self.assembleChart()
"""*
* Updates the chart, using an appropriate default touched point
* update option, depending on if hover touching is enabled or
* not.<p>
*
* A convenience method equivalent to:
* <p>
*
* <pre>
if getHoverTouchingEnabled():
update(TouchedPointUpdateOption.TOUCHED_POINT_UPDATED)
else:
update(TouchedPointUpdateOption.TOUCHED_POINT_LOCKED)
* </pre>
*
*
* @see #update(TouchedPointUpdateOption) update(TouchedPointUpdateOption)
* @see #setHoverTouchingEnabled setHoverTouchingEnabled
*
"""
# constructs the chart within the chart panel from current specs
def assembleChart(self):
if (self.chartDecorationsChanged or self.xAxis.limitsChanged() or
self.yAxis.limitsChanged() or self.y2Axis.limitsChanged()):
self.plotPanel.reset(self.xChartSize, self.yChartSize,
self.hasYAxis(), self.hasY2Axis(),
self.xAxis, self.yAxis, self.y2Axis)
GChartUtil.setFontFamily(self, self.getFontFamily())
GChartUtil.setBackgroundColor(self, self.getBackgroundColor())
GChartUtil.setBorderColor(self, self.getBorderColor())
GChartUtil.setBorderStyle(self,self.getBorderStyle())
GChartUtil.setBorderWidth(self, self.getBorderWidth())
GChartUtil.setPadding(self, self.getPadding())
GChartUtil.setOverflow(self, (self.getClipToDecoratedChart() and
"hidden" or "visible"))
self.setPixelSize(self.plotPanel.getXChartSizeDecoratedQuickly(),
self.plotPanel.getYChartSizeDecoratedQuickly())
self.updateDecorations(self.plotPanel.getXChartSizeDecoratedQuickly())
self.xAxis.rememberLimits()
self.yAxis.rememberLimits()
self.y2Axis.rememberLimits()
self.invalidateEveryCurve()
self.chartDecorationsChanged = False
# actually renders chart, including internal curves used
# to represent the decorations (title, axis labels, etc.)
self.realizePlotPanel()
# To avoid order-of-magnitude FF2 performance hit on busy pages,
# first time, must add plotPanel only AFTER building chart
if self.plotPanel != self.chartPanel.getWidget():
self.chartPanel.add(self.plotPanel)
"""
* Due to how GChart plays around with visible elements contained inside
* hidden elements to align it's labels properly, if we allowed top
* level <tt>visibility:hidden</tt> the result would be that everything
* <i>except</i> annotations would be invisible.
* <p>
*
* We can prevent such
* weird behavior by setting <tt>visibility:visible</tt> on the top
* level element; this setting effectively short-circuits any
* top level visibility setting the user may have made. <p>
*
* Users must either use <tt>display:none</tt> (as the Widget method
* <tt>setVisible</tt> does) or create an enclosing 0-sized div with
* <tt>overflow:hidden</tt>) to hide a GChart.
* <p>
*
"""
DOM.setStyleAttribute(self.getElement(), "visibility","visible")
else:
"""
* Without these 2 lines IE7 won't repaint GChart's annotations.
* The lines are not needed in FF2; an IE7 bug is suspected.<p>
*
* I got this workaround from <a href=
* "http:#examples.roughian.com">Ian Bambury</a> as part of <a
* href="http:#groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/4c54d8b4aea7f98b/6efd1ab4e5fc0e7b?#6efd1ab4e5fc0e7b">
* this discussion on the GWT forum</a>.
* <p>
*
* (Note comment regarding need for explicit visibility above).
*
"""
DOM.setStyleAttribute(self.getElement(), "visibility","hidden")
DOM.setStyleAttribute(self.getElement(), "visibility","visible")
# create a Grid representing the chart legend.
def createLegend(self, pp):
result = Grid(self.getNVisibleCurvesOnLegend(), 2)
iVisible = 0
"""
* Simply eliminating the border entirely is a valid transparency
* emulation for the legend (no positional shifting is needed as is
* needed for the images used to draw the main chart's curves) because
* the legend is always positioned by its center point, and the border
* extends around the entire legend key, so removing it does not result
* in any change to the legend key's center position. <p>
*
* If multiple legend locations (beyond the current "always centered in
* a band along the right edge" option) were ever supported, appropriate
* positional shifts would then have to be introduced to emulate
* transparent borders.
*
"""
if TRANSPARENT_BORDER_COLOR == self.getLegendBorderColor():
GChartUtil.setBorderWidth(result, 0)
GChartUtil.setBorderColor(result, "transparent")
else:
GChartUtil.setBorderWidth(result, abs(self.getLegendBorderWidth()))
GChartUtil.setBorderColor(result, self.getLegendBorderColor())
GChartUtil.setBorderStyle(result, self.getLegendBorderStyle())
GChartUtil.setBackgroundColor(result, self.getLegendBackgroundColor())
nCurves = self.getNCurves()
for i in range(nCurves):
c = self.getSystemCurve(i)
if c.isVisible() and c.getLegendLabel()!=None:
symBorderFraction = (c.getSymbol().getBorderWidth()/
max(
max(1.0,c.getSymbol().getFillThickness()),
max(c.getSymbol().getWidth(pp),
c.getSymbol().getHeight(pp, c.onY2()))))
icon = c.getSymbol().getSymbolType().createIconImage(
c.getSymbol(), self.getLegendFontSize(),
symBorderFraction)
result.setWidget(iVisible, 0, icon)
result.getCellFormatter().setAlignment(iVisible, 0,
HasHorizontalAlignment.ALIGN_CENTER,
HasVerticalAlignment.ALIGN_MIDDLE)
label = HTML(c.getLegendLabel())
GChartUtil.setFontWeight(label, self.getLegendFontWeight())
GChartUtil.setFontStyle(label, self.getLegendFontStyle())
GChartUtil.setColor(label, self.getLegendFontColor())
GChartUtil.setFontSize(label, self.getLegendFontSize())
result.setWidget(iVisible, 1, label)
result.getCellFormatter().setAlignment(iVisible, 1,
HasHorizontalAlignment.ALIGN_LEFT,
HasVerticalAlignment.ALIGN_MIDDLE)
iVisible += 1
return result
# returns char-width-based default legend thickness
def getDefaultLegendThickness(self):
EXTRA_WIDTH = 5; # allow for padding & symbol
maxLen = 0
nCurves = self.getNCurves()
for i in range(nCurves):
c = self.getSystemCurve(i)
if c.isVisible() and None != c.getLegendLabel():
maxLen = max(maxLen,
GChartUtil.htmlWidth(c.getLegendLabel()))
return int ( ((maxLen + EXTRA_WIDTH) *
self.getLegendFontSize() *
TICK_CHARWIDTH_TO_FONTSIZE_LOWERBOUND))
def getNVisibleCurvesOnLegend(self):
result = 0
nCurves = self.getNCurves()
for i in range(nCurves):
if self.getSystemCurve(i).isVisible() and self.getSystemCurve(i).getLegendLabel() is not None:
result += 1
return result
# Defines a default curve border color when curves first created
def setDefaultBorderColor(self, curve, index):
curve.getSymbol().setBorderColor(
self.defaultSymbolBorderColors[
index % len(self.defaultSymbolBorderColors)
])
# renders the curve in the plot panel
def realizeCurve(self, c):
if c.isValidated():
return
internalIndex = self.getInternalCurveIndex(c)
rpIndex = self.getRenderingPanelIndex(internalIndex)
grp = self.plotPanel.getGraphicsRenderingPanel(rpIndex)
arp = self.plotPanel.getAnnotationRenderingPanel(rpIndex)
if GChartWidgets.DECORATIVE_RENDERING_PANEL_INDEX == rpIndex:
# background panel only gets initialized for first curve
if 0 == internalIndex:
# background panel never uses canvas
grp.beginRendering(None)
arp.beginRendering()
c.setWasCanvasRendered(False)
# continuous fill# non-empty fill# canvas available
elif (0 == c.getSymbol().getFillSpacing() and
0 < c.getSymbol().getFillThickness() and
None != self.getCanvasFactory() and
c.isVisible()):
grp.maybeAddCanvas()
canvasRegion = c.getContainingRectangle(self.plotPanel)
grp.beginRendering(canvasRegion)
arp.beginRendering()
c.setWasCanvasRendered(True)
else:
# does not use canvas, or it is invisible
grp.beginRendering(None)
arp.beginRendering()
c.setWasCanvasRendered(False)
if c.isVisible():
# Separate points into vertical/horizontal band-bins provided
# 1) it is not a system curve and 2) it is not of a type whose
# position follows the mouse (and thus has no fixed location
# suitable for banding) and 3) at least one kind of hover feedback
# is being provided for the curve.
if self.getCurveIndex(c) >= 0 and not isMouseAnchored(c.getSymbol().getSymbolType()) and (c.getSymbol().getHoverSelectionEnabled() or c.getSymbol().getHoverAnnotationEnabled()):
c.bandSeparatePoints()
else:
# hit test banding calcs unneeded; skip them for speed.
c.clearBandList()
# Note: these lines must come AFTER band separation lines above
nPoints = c.getNPoints()
for j in range(nPoints):
c.realizePoint(self.plotPanel, grp, arp, j)
# only end background panel rendering w last background curve
if GChartWidgets.DECORATIVE_RENDERING_PANEL_INDEX != rpIndex or internalIndex == N_PRE_SYSTEM_CURVES-1:
grp.endRendering()
arp.endRendering()
# else it's a background panel curve, and not the last one
c.validated = True
# marks every curve, including system curves, as needing an update
def invalidateEveryCurve(self):
for i in range(len(self.curves)):
self.curves[i].invalidate()
# marks every developer-accessible curve as needing an update
def invalidateAccessibleCurves(self):
nCurves = self.getNCurves()
for i in range(nCurves):
self.getSystemCurve(i).invalidate()
# invalidates every curve that has a pie slice type
def invalidateAllSlices(self):
nCurves = self.getNCurves()
for i in range(nCurves):
c = self.getSystemCurve(i)
if isinstance(c.getSymbol().getSymbolType(),
SymbolType.PieSliceSymbolType):
c.invalidate()
# Invalidates every pie slice curve whose orientation could
# depend on the orientation of the given curve
def invalidateDependentSlices(self, iFirstCurve):
# only user defined curve can have slice dependency relationships
if self.isSystemCurveIndex(iFirstCurve):
return
nCurves = self.getNCurves()
for i in range(iFirstCurve, nCurves):
c = self.getSystemCurve(i)
if isinstance(c.getSymbol().getSymbolType(),
SymbolType.PieSliceSymbolType):
c.invalidate()
elif i == iFirstCurve:
# if first curve isn't a slice,
break; # there are no dependent slices
# Defines the default pie slice orientations for every pie-slice curve
def setDefaultPieSliceOrientations(self):
self.setLastPieSliceOrientation(self.getInitialPieSliceOrientation())
nCurves = self.getNCurves()
for i in range(nCurves):
c = self.getSystemCurve(i)
# keep track of default next orientation for pie slices
# (must do this even if we don't have to redraw slice)
if isinstance(c.getSymbol().getSymbolType(),
SymbolType.PieSliceSymbolType):
c.getSymbol().setDefaultPieSliceOrientation(
self.getLastPieSliceOrientation())
self.setLastPieSliceOrientation(
c.getSymbol().getDecodedPieSliceOrientation()
+ c.getSymbol().getPieSliceSize())
def realizePlotPanel(self):
self.setDefaultPieSliceOrientations()
"""
* Render both system curves (those with negative ids that
* are used to render title, ticks, etc.) and ordinary curves.
"""
nCurves = self.getNCurves()
for i in range(-N_SYSTEM_CURVES, nCurves):
c = self.getSystemCurve(i)
self.realizeCurve(c)
""" Returns True if the rendering panel index is associated
* with one of the internal, hover-feedback curves.
* <p>
*
* This method relies on the fact that rendering panels
* appear in this order:
* <p>
*
* <ol>
* <li> a single rp that renders all chart decorations
* <li> self.getNCurves() rps (1 for each developer-defined curve)
* <li> the two rendering panels associated with the two
* system-defined hover feedback curves
* </ol>
*
"""
def isHoverFeedbackRenderingPanel(self, rpIndex):
result = rpIndex > self.getNCurves()
return result
"""
* This code works around a bug in GWTCanvas that can cause
* (in IE) previously rendered VML elements to have their fill
* and stroke color, and stroke thickness properties revert to
* some sort of defaults (I saw white, black, and 1px in my
* tests) when the canvas is re-inserted into the DOM.
*
* See TestGChart55.java and TestGChart55a.java for more
* info on the GWTCanvas bug that makes this code neccessary.
*
* TODO: Implement technique of GWTCanvasIssue293.patch to
* override removeFromParent and store/restore innerHTML
* as a more efficient workaround for this problem. If
* a GWTCanvas is released, you could remove this
* workaround altogether.
*
"""
# avoids inefficiency of re-rendering in most common case
def onUnload(self):
Composite.onUnload(self)
self.wasUnloaded = True
def onLoad(self):
Composite.onLoad(self)
if self.wasUnloaded and self.plotPanel.getRenderingPanelCount() > 0:
isUpToDate = not isUpdateNeeded()
nCurves = self.getNCurves()
for i in range(nCurves):
c = getCurve(i)
if c.isCanvasRendered():
c.invalidate()
if isUpToDate:
self.realizeCurve(c)
# else since chart needs update, presume they will
# update later, no need to auto-patch things up
# (and simple patch-rerender won't work anyway).
# else never inserted/rendered; skip patchup-rerendering
# end of class GChart
| {
"content_hash": "7c5ba57c9539dbadfc48e115927524b1",
"timestamp": "",
"source": "github",
"line_count": 3865,
"max_line_length": 195,
"avg_line_length": 36.32833117723157,
"alnum_prop": 0.6478929413356693,
"repo_name": "Hasimir/pyjs",
"id": "60b4e299b9d0a77c767967130b569af448983d8b",
"size": "140409",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "pyjswidgets/pyjamas/chart/GChart.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4640"
},
{
"name": "Groff",
"bytes": "6633"
},
{
"name": "HTML",
"bytes": "10106"
},
{
"name": "JavaScript",
"bytes": "63385"
},
{
"name": "Makefile",
"bytes": "453"
},
{
"name": "Python",
"bytes": "5515375"
},
{
"name": "Shell",
"bytes": "4264"
}
],
"symlink_target": ""
} |
// Follow the instructions in uppercase/README.md for running these tests.
// Visit https://firebase.google.com/docs/functions/unit-testing to learn more
// about using the `firebase-functions-test` SDK.
// Chai is a commonly used library for creating unit test suites. It is easily extended with plugins.
const chai = require('chai');
const assert = chai.assert;
// Sinon is a library used for mocking or verifying function calls in JavaScript.
const sinon = require('sinon');
const admin = require('firebase-admin');
// Require and initialize firebase-functions-test in "online mode" with your project's
// credentials and service account key.
const projectConfig = {
projectId: 'my-project',
databaseURL: 'https://my-project.firebaseio.com'
};
const test = require('firebase-functions-test')(projectConfig, './service-account-key.json');
describe('Cloud Functions', () => {
let myFunctions;
before(() => {
// Require index.js and save the exports inside a namespace called myFunctions.
// This includes our cloud functions, which can now be accessed at myFunctions.makeUppercase
// and myFunctions.addMessage
myFunctions = require('../index');
});
after(() => {
// Do cleanup tasks.
test.cleanup();
// Reset the database.
admin.database().ref('messages').remove();
});
describe('makeUpperCase', () => {
// Test Case: setting messages/11111/original to 'input' should cause 'INPUT' to be written to
// messages/11111/uppercase
it('should upper case input and write it to /uppercase', () => {
// [START assertOnline]
// Create a DataSnapshot with the value 'input' and the reference path 'messages/11111/original'.
const snap = test.database.makeDataSnapshot('input', 'messages/11111/original');
// Wrap the makeUppercase function
const wrapped = test.wrap(myFunctions.makeUppercase);
// Call the wrapped function with the snapshot you constructed.
return wrapped(snap).then(() => {
// Read the value of the data at messages/11111/uppercase. Because `admin.initializeApp()` is
// called in functions/index.js, there's already a Firebase app initialized. Otherwise, add
// `admin.initializeApp()` before this line.
return admin.database().ref('messages/11111/uppercase').once('value').then((createdSnap) => {
// Assert that the value is the uppercased version of our input.
assert.equal(createdSnap.val(), 'INPUT');
});
});
// [END assertOnline]
})
});
describe('addMessage', () => {
it('should return a 303 redirect', (done) => {
// A fake request object, with req.query.text set to 'input'
const req = { query: {text: 'input'} };
// A fake response object, with a stubbed redirect function which does some assertions
const res = {
redirect: (code, url) => {
// Assert code is 303
assert.equal(code, 303);
// If the database push is successful, then the URL sent back will have the following format:
const expectedRef = new RegExp(projectConfig.databaseURL + '/messages/');
assert.isTrue(expectedRef.test(url));
done();
}
};
// Invoke addMessage with our fake request and response objects. This will cause the
// assertions in the response object to be evaluated.
myFunctions.addMessage(req, res);
});
});
})
| {
"content_hash": "df0ab4350e0a1e23825bd35e3e47c538",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 103,
"avg_line_length": 40.44705882352941,
"alnum_prop": 0.664630599185573,
"repo_name": "firebase/functions-samples",
"id": "fc49330347fedf403499e6dd19556a8a60e20544",
"size": "4055",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "quickstarts/uppercase/functions/test/test.online.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "20744"
},
{
"name": "HTML",
"bytes": "88957"
},
{
"name": "Handlebars",
"bytes": "2766"
},
{
"name": "JavaScript",
"bytes": "315580"
},
{
"name": "Shell",
"bytes": "164"
},
{
"name": "TypeScript",
"bytes": "2236"
}
],
"symlink_target": ""
} |
package org.elasticsearch.xpack.ml.dataframe.stats;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.ml.dataframe.stats.common.DataCounts;
import org.elasticsearch.xpack.core.ml.utils.PhaseProgress;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
public class StatsHolderTests extends ESTestCase {
public void testAdjustProgressTracker_GivenZeroProgress() {
List<PhaseProgress> phases = Collections.unmodifiableList(
Arrays.asList(
new PhaseProgress("reindexing", 0),
new PhaseProgress("loading_data", 0),
new PhaseProgress("a", 0),
new PhaseProgress("b", 0),
new PhaseProgress("writing_results", 0)
)
);
StatsHolder statsHolder = newStatsHolder(phases);
statsHolder.adjustProgressTracker(Arrays.asList("a", "b"), false);
List<PhaseProgress> phaseProgresses = statsHolder.getProgressTracker().report();
assertThat(phaseProgresses.size(), equalTo(5));
assertThat(
phaseProgresses.stream().map(PhaseProgress::getPhase).collect(Collectors.toList()),
contains("reindexing", "loading_data", "a", "b", "writing_results")
);
assertThat(phaseProgresses.get(0).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(1).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(2).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(3).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(4).getProgressPercent(), equalTo(0));
}
public void testAdjustProgressTracker_GivenSameAnalysisPhases() {
List<PhaseProgress> phases = Collections.unmodifiableList(
Arrays.asList(
new PhaseProgress("reindexing", 100),
new PhaseProgress("loading_data", 20),
new PhaseProgress("a", 30),
new PhaseProgress("b", 40),
new PhaseProgress("writing_results", 50)
)
);
StatsHolder statsHolder = newStatsHolder(phases);
statsHolder.adjustProgressTracker(Arrays.asList("a", "b"), false);
List<PhaseProgress> phaseProgresses = statsHolder.getProgressTracker().report();
assertThat(phaseProgresses.size(), equalTo(5));
assertThat(
phaseProgresses.stream().map(PhaseProgress::getPhase).collect(Collectors.toList()),
contains("reindexing", "loading_data", "a", "b", "writing_results")
);
assertThat(phaseProgresses.get(0).getProgressPercent(), equalTo(100));
assertThat(phaseProgresses.get(1).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(2).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(3).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(4).getProgressPercent(), equalTo(0));
}
public void testAdjustProgressTracker_GivenDifferentAnalysisPhases() {
List<PhaseProgress> phases = Collections.unmodifiableList(
Arrays.asList(
new PhaseProgress("reindexing", 100),
new PhaseProgress("loading_data", 20),
new PhaseProgress("a", 30),
new PhaseProgress("b", 40),
new PhaseProgress("writing_results", 50)
)
);
StatsHolder statsHolder = newStatsHolder(phases);
statsHolder.adjustProgressTracker(Arrays.asList("c", "d"), false);
List<PhaseProgress> phaseProgresses = statsHolder.getProgressTracker().report();
assertThat(phaseProgresses.size(), equalTo(5));
assertThat(
phaseProgresses.stream().map(PhaseProgress::getPhase).collect(Collectors.toList()),
contains("reindexing", "loading_data", "c", "d", "writing_results")
);
assertThat(phaseProgresses.get(0).getProgressPercent(), equalTo(100));
assertThat(phaseProgresses.get(1).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(2).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(3).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(4).getProgressPercent(), equalTo(0));
}
public void testAdjustProgressTracker_GivenReindexingProgressIncomplete() {
List<PhaseProgress> phases = Collections.unmodifiableList(
Arrays.asList(
new PhaseProgress("reindexing", 42),
new PhaseProgress("loading_data", 20),
new PhaseProgress("a", 30),
new PhaseProgress("b", 40),
new PhaseProgress("writing_results", 50)
)
);
StatsHolder statsHolder = newStatsHolder(phases);
statsHolder.adjustProgressTracker(Arrays.asList("a", "b"), false);
List<PhaseProgress> phaseProgresses = statsHolder.getProgressTracker().report();
assertThat(phaseProgresses.size(), equalTo(5));
assertThat(
phaseProgresses.stream().map(PhaseProgress::getPhase).collect(Collectors.toList()),
contains("reindexing", "loading_data", "a", "b", "writing_results")
);
assertThat(phaseProgresses.get(0).getProgressPercent(), equalTo(1));
assertThat(phaseProgresses.get(1).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(2).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(3).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(4).getProgressPercent(), equalTo(0));
}
public void testAdjustProgressTracker_GivenAllPhasesCompleteExceptInference() {
List<PhaseProgress> phases = Collections.unmodifiableList(
Arrays.asList(
new PhaseProgress("reindexing", 100),
new PhaseProgress("loading_data", 100),
new PhaseProgress("a", 100),
new PhaseProgress("writing_results", 100),
new PhaseProgress("inference", 20)
)
);
StatsHolder statsHolder = newStatsHolder(phases);
statsHolder.adjustProgressTracker(Arrays.asList("a", "b"), true);
List<PhaseProgress> phaseProgresses = statsHolder.getProgressTracker().report();
assertThat(
phaseProgresses,
contains(
new PhaseProgress("reindexing", 100),
new PhaseProgress("loading_data", 100),
new PhaseProgress("a", 100),
new PhaseProgress("b", 100),
new PhaseProgress("writing_results", 100),
new PhaseProgress("inference", 0)
)
);
}
public void testResetProgressTracker() {
List<PhaseProgress> phases = Collections.unmodifiableList(
Arrays.asList(
new PhaseProgress("reindexing", 100),
new PhaseProgress("loading_data", 20),
new PhaseProgress("a", 30),
new PhaseProgress("b", 40),
new PhaseProgress("writing_results", 50)
)
);
StatsHolder statsHolder = newStatsHolder(phases);
statsHolder.resetProgressTracker(Arrays.asList("a", "b"), false);
List<PhaseProgress> phaseProgresses = statsHolder.getProgressTracker().report();
assertThat(phaseProgresses.size(), equalTo(5));
assertThat(
phaseProgresses.stream().map(PhaseProgress::getPhase).collect(Collectors.toList()),
contains("reindexing", "loading_data", "a", "b", "writing_results")
);
assertThat(phaseProgresses.get(0).getProgressPercent(), equalTo(1));
assertThat(phaseProgresses.get(1).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(2).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(3).getProgressPercent(), equalTo(0));
assertThat(phaseProgresses.get(4).getProgressPercent(), equalTo(0));
}
private static StatsHolder newStatsHolder(List<PhaseProgress> progress) {
return new StatsHolder(progress, null, null, new DataCounts("test_job"));
}
}
| {
"content_hash": "98c63cddf67ef88d1fce6352e2e36d01",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 95,
"avg_line_length": 43.75916230366492,
"alnum_prop": 0.6396267049533381,
"repo_name": "GlenRSmith/elasticsearch",
"id": "dcde7dab0bd597905d3a22cb37ad40e85bc2e33f",
"size": "8610",
"binary": false,
"copies": "27",
"ref": "refs/heads/master",
"path": "x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/dataframe/stats/StatsHolderTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "11082"
},
{
"name": "Batchfile",
"bytes": "11057"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "337461"
},
{
"name": "HTML",
"bytes": "2186"
},
{
"name": "Java",
"bytes": "43224931"
},
{
"name": "Perl",
"bytes": "11756"
},
{
"name": "Python",
"bytes": "19852"
},
{
"name": "Shell",
"bytes": "99571"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/Users/Yonah/development/react/react-native-heading/android/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/res/values-sl/values-sl.xml -->
<eat-comment/>
<string msgid="4600421777120114993" name="abc_action_bar_home_description">"Krmarjenje domov"</string>
<string msgid="1397052879051804371" name="abc_action_bar_home_description_format">"%1$s, %2$s"</string>
<string msgid="6623331958280229229" name="abc_action_bar_home_subtitle_description_format">"%1$s, %2$s, %3$s"</string>
<string msgid="1594238315039666878" name="abc_action_bar_up_description">"Krmarjenje navzgor"</string>
<string msgid="3588849162933574182" name="abc_action_menu_overflow_description">"Več možnosti"</string>
<string msgid="4076576682505996667" name="abc_action_mode_done">"Končano"</string>
<string msgid="7468859129482906941" name="abc_activity_chooser_view_see_all">"Pokaži vse"</string>
<string msgid="2031811694353399454" name="abc_activitychooserview_choose_application">"Izbira aplikacije"</string>
<string msgid="121134116657445385" name="abc_capital_off">"IZKLOPLJENO"</string>
<string msgid="3405795526292276155" name="abc_capital_on">"VKLOPLJENO"</string>
<string msgid="7723749260725869598" name="abc_search_hint">"Iskanje …"</string>
<string msgid="3691816814315814921" name="abc_searchview_description_clear">"Izbris poizvedbe"</string>
<string msgid="2550479030709304392" name="abc_searchview_description_query">"Iskalna poizvedba"</string>
<string msgid="8264924765203268293" name="abc_searchview_description_search">"Iskanje"</string>
<string msgid="8928215447528550784" name="abc_searchview_description_submit">"Pošiljanje poizvedbe"</string>
<string msgid="893419373245838918" name="abc_searchview_description_voice">"Glasovno iskanje"</string>
<string msgid="3421042268587513524" name="abc_shareactionprovider_share_with">"Deljenje z"</string>
<string msgid="7165123711973476752" name="abc_shareactionprovider_share_with_application">"Deljenje z:"</string>
<string msgid="1603543279005712093" name="abc_toolbar_collapse_description">"Strni"</string>
<string msgid="2869576371154716097" name="status_bar_notification_info_overflow">"999+"</string>
</resources> | {
"content_hash": "378ec60ae7e2b9d124e2bc8d1003d279",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 184,
"avg_line_length": 93.52,
"alnum_prop": 0.7549187339606501,
"repo_name": "yonahforst/react-native-heading",
"id": "da09d3e45a45fee9fd151af43bfd4145ba80b91a",
"size": "2345",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "android/build/intermediates/res/androidTest/debug/values-sl/values-sl.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1203202"
},
{
"name": "JavaScript",
"bytes": "345"
},
{
"name": "Objective-C",
"bytes": "2145"
}
],
"symlink_target": ""
} |
package org.commonjava.indy.bind.jaxrs;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This WebApplicationException handler will check for a HTTP response status
* code (SC) in the exception and ensure the client will receive the corresponding SC code.
*
*/
public class UnhandledWebApplicationExceptionHandler
implements ExceptionMapper<WebApplicationException>
{
@Override
public Response toResponse( WebApplicationException exception )
{
Response response = null;
if ( exception.getResponse() != null && exception.getResponse().getStatusInfo() != null )
{
Logger logger = LoggerFactory.getLogger( getClass() );
logger.error( "Unhandled exception: " + exception.getMessage(), exception );
response = Response.status( exception.getResponse().getStatusInfo() )
.entity( ExceptionUtils.getStackTrace( exception ) )
.type( MediaType.TEXT_PLAIN )
.build();
}
else
{
response = new UnhandledThrowableHandler().toResponse( exception );
}
return response;
}
}
| {
"content_hash": "1974ce7a642df989d897b4eb1947a248",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 97,
"avg_line_length": 33.51219512195122,
"alnum_prop": 0.6790393013100436,
"repo_name": "ruhan1/indy",
"id": "8db8a9c04fa043e269f9ea6f60b0388d14c080c0",
"size": "2021",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "subsys/jaxrs/src/main/java/org/commonjava/indy/bind/jaxrs/UnhandledWebApplicationExceptionHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6390"
},
{
"name": "Dockerfile",
"bytes": "3740"
},
{
"name": "Groovy",
"bytes": "45401"
},
{
"name": "HTML",
"bytes": "72730"
},
{
"name": "Java",
"bytes": "5848803"
},
{
"name": "JavaScript",
"bytes": "75187"
},
{
"name": "Python",
"bytes": "78715"
},
{
"name": "Ruby",
"bytes": "13080"
},
{
"name": "Shell",
"bytes": "32345"
}
],
"symlink_target": ""
} |
Change log
==========
v4.6.0
------
* Improve support for alternative settings in SpaceGroup.
* Fix respect for user_incar_settings in MPNonSCFSet and MPSOCSet
* Support for argcomplete in pmg script.
* Speed ups to Ewald summation.
* Add functionality to parse frequency dependent dielectric function.
* Improvements to Bolztrap support.
v4.5.7
------
* PMG settings are now prefixed with PMG_ to ensure proper namespacing.
* Improve error output in command line bader caller.
* Add Py3.6 classifier.
* Misc bug fixes.
v4.5.6
------
* Minor bug fix.
* Fixed elastic energy density
v4.5.5
------
* Fix bad reading of pmgrc.
* Gaussian opt section added allowing for torsion constraints
* Update spglib.
v4.5.4
------
* BSDOSPlotter (Anubhav Jain)
* Fixes to defect analysis (Bharat)
* intrans as an input to BoltztrapAnalyzer. Allows for scissor operation.
* Pmg is now continuously tested on win-64/py35 using Appveyor!
v4.5.3
------
* Added an alternative interstitial finder that works with a grid-based structure-motif search. (Nils Zimmermann)
* Optionnal possibility to specify that the saddle_point in the NEB should have a zero slope. (David Waroquiers)
* Read intensity and normal modes for Gaussian. (Germain Salvato Vallverdu)
* Minor bug fixes.
v4.5.2
------
* Minor bug fix for POTCAR settings.
v4.5.1
------
* You can now specify a different default functional choice for pymatgen by
setting PMG_DEFAULT_FUNCTIONAL in .pmgrc.yaml. For use with newer
functional sets, you need to specify PBE_52 or PBE_54 for example.
* Swtich to ISYM 3 by default for HSE.
* Updates to FEFF>
* Misc bug fixes and startup speed improvements.
v4.5.0
------
* Major speed up of initial load.
* Collection of misc changes.
v4.4.12
-------
* Fix for dynamic numpy import.
v4.4.11
-------
* Update to new version of spglib.
v4.4.10
-------
* Minor fixes for proper gzipped structure file support and MVLSlabSet.
v4.4.9
------
* Dependency cleanup. Now, basic pymatgen requires on much fewer
packages.
* Fixed reading of POSCAR files when more than 20 types of atoms.
* Misc bug fixes.
v4.4.8
------
* Cleanup of entry points and dependencies.
v4.4.7
------
* Update to spglib 1.9.7.1
* Proper use of dependency markers for enum34.
v4.4.6
------
* Update to spglib 1.9.6, which fixes some bugs and is Windows compatible.
v4.4.5
------
* Bug fix for SubstitutionProb.
v4.4.4
------
* Bug fix for electronic structure plotter.
v4.4.3
------
* Bug fix for Diffusion Analyzer.
v4.4.2
------
* Bug fix for BS serialization.
* Cleanup dependencies.
v4.4.1
------
* Massive updates to FEFF support (Kiran Mathews).
* Bug fixes in band structure plotting.
v4.4.0
------
* Much more Pythonic API for modifying Structure/Molecule species. Now,
strings, slices, and sequences should magically work, in addition to the
previous API of simple int indices. Examples::
s[0] = "Fe"
s[0] = "Fe", [0.5, 0.5, 0.5] # Replaces site and fractional coordinates.
s[0] = "Fe", [0.5, 0.5, 0.5], {"spin": 2} # Replaces site and fractional coordinates and properties.
s[(0, 2, 3)] = "Fe" # Replaces sites 0, 2 and 3 with Fe.
s[0::2] = "Fe" # Replaces all even index sites with Fe.
s["Mn"] = "Fe" # Replaces all Mn in the structure with Fe.
s["Mn"] = "Fe0.5Co0.5" # Replaces all Mn in the structure with Fe: 0.5, Co: 0.5, i.e.,creates a disordered structure!
* Massive update to internal representation of Bandstructure objects for
memory and computational efficiency.
* Bug fixes to CIF parsing in some edge cases. (Will Richards).
v4.3.2
------
* Massive speedup of Bandstructure, especially projected band structures,
parsing.
* Massive update to pmg cli script, with new query functions as well as a
more rational command structure.
* Updates to ChemEnv.
* Misc bug fixes.
v4.3.1
------
* Upgrade monty and spglib requirements for bug fixes.
* Updates to feff support (Kiran).
v4.3.0
------
* Massive update to elastic module. (Joey Montaya)
* Pathfinder algorithm for NEB calculations. (Ziqing Rong)
* Wheels for Windows and Mac Py27 and Py35.
v4.2.5
------
* Bug fix for BSPlotter.
v4.2.4
------
* Bug fix for kpoint weight calculation for Monkhorst meshes.
v4.2.3
------
* Minor cleanup.
* Simplified installation. enumlib and bader can now be installed using pmg setup --install.
v4.2.2
------
* Global configuration variables such as VASP\_PSP\_DIR and MAPI\_KEY are now
stored in "~/.pmgrc.yaml". If you are setting these as environmental
variables right now, you can easily transition to the new system using::
pmg config --add VASP_PSP_DIR $VASP_PSP_DIR MAPI_KEY $MAPI_KEY
This new scheme will provide greater flexibility for user-defined
global behavior in pymatgen, e.g., tolerances, default input sets for
transmuters, etc., in future.
* Beta of k-point weight calculator.
* Use default MSONable as and from_dict for all transformations.
v4.2.1
------
* New DopingTransformation that implements an automated doping strategy.
* Updated MIC algorithm that is a lot more robust (Will Richards).
* Major update to chemenv package (David Waroquiers)
v4.2.0
------
* Fix important bug in minimum image distance computation for very skewed cells.
* Major refactoring of WulffShape code.
* Misc bug fixes for elastic tensor and other codes.
v4.1.1
------
* Major refactoring of WulffShape and lammps support.
v4.1.0
------
* Wulff shape generator and analysis.
* Minor bug fixes.
v4.0.2
--------
* Fix kpoint reciprocal density.
v4.0.1
------
* Minor bug fix release.
v4.0.0
------
* Massive update with many deprecated methods removed. Note that this
may break backwards incompatibility!
* Support for ABINIT 8.
* Improved sulfide compatibility.
v3.7.1
------
* Fix deprecation bug.
v3.7.0
------
* Last version before pymatgen 4.0, where deprecated modules will be removed!
* Massive update to LAMMPS (Kiran Matthews).
* New input sets with a different interface that replaces old input sets.
* Massive update to elastic properties.
v3.6.1
------
* Massive cleanup to Boltztrap interface (Anubhav Jain)
* Refactor of piezoelectric analysis to use tensor base class (Joey)
* More robust CIF parsing.
v3.6.0
------
* Pymatgen now uses spglib directly from Togo's website. Spglib is no longer
bundled as a dependency.
* Improved support for velocities in Poscar (Germaine Vallverdu)
* Backwards incompatible change in Born charge format in Outcar.
* Fixes for Lammps input serialization
v3.5.3
------
* Misc refactorings and bug fixes, especially for Outcar and Boltztrap classes.
v3.5.2
------
* Minor update to DerivedInputSet interface.
v3.5.1
------
* New derived input sets for generating inputs that depende on previuos
calculations. Old input sets deprecated.
v3.5.0
------
* Chemical environment analysis package (David Waroquiers).
* Piezoelectric property analysis (Shayam).
* Cythonize certain expensive core functions. 5-10x speedup in large structure matching (Will Richards).
* New NMR parsing functionality for Outcar (Xiaohui Qu).
* Improved io.lammps (Kiran Mathews).
* Update to spglib 1.9.2.
* Element properties now return unitized float where possible.
* Bug fix for get_primitive_standard affecting rhombohedral cells (important for band structures).
* Vasprun.final_energy now returns corrected energy with warning if it is different from final electronic step.
v3.4.0
------
* 10-100x speed up to Structure copying and Site init, which means many
functionality has seen signifcant speed improvement (e.g., structure
matching).
* Convenience method Structure.matches now perform similarity matching
for Structures.
* Bugfix for band gap determination.
v3.3.6
------
* Update to use enum.x instead of multienum.x.
* Minor robustness fixes to VaspInputSet serialization.
* Add a reciprocal density parameter to vasp sets.
* Minor bug fixes to Vasprun parsing.
v3.3.5
------
* StructureMatcher can now work with ignored species.
* Added interpolation failure warnings and smooth tolerance for
scipy.interpolate.splrep in bandstructures (Tess).
* Added DiffusionAnalyzer.get_framework_rms_plot.
* Complete rewrite of Procar class to use ND array access and zero-based
indexing.
* OrderParameters class for analysis of local structural features
(Nils Zimmermann).
* Bug fixes for Procar, MPRester and SpaceGroup 64.
* Added Github templates for contributing to pymatgen.
v3.3.4
------
* Procar now supports parsing of phase factors.
* Miscellaneous bug fixes.
v3.3.3
------
* Bug fixes for Poscar.
* Fix Kpoints pickling.
v3.3.2
------
* Bug fixes for pymatgen.io.abinit
* Other minor big fixes.
v3.3.1
------
* Minor bug fix release for pickle and elastic constants.
v3.3.0
------
* Updated and checked for Python 3.5.* compatibility.
* Element, Spin, Orbital and various other Enum-like classes are now actually
implemented using Enum (with enum34 dependency for Python < 3.4).
* Speed up Site creation by 20% for ordered sites, with cost in terms of
slightly slower non-ordered Sites. Since ordered Sites is the far more common
case, this gives significant boost for large scale manipulations of
structures.
* Alternative, more pythonic syntax for creating supercells via simply
Structure * 3 or Structure * (3, 1, 1).
* zeo++ fixes.
* More stable incar settings for MITMDVaspInputSet.
v3.2.10
-------
* Fix missing scripts
* Improvements to units module.
* Speed up EwaldSummation.
v3.2.9
------
* Major PD stability improvements, especially for very high dim hulls with lots
of entries.
* Improvements to Ewald summation to be close to GULP implementation.
* Deprecate physical constants module in favor of scipy's version.
* Remove many pyhull references to use scipy's ConvexHull implementation.
* Bug fix for sulfide correction.
v3.2.8
------
* Make pyhull optional.
* Sulfur correction added to MaterialsProjectCompatibility for more accurate
sulfide formation energies.
* ADF io support. (Xin Chen)
* Bug fixes for spacegroup subgroup testing.
v3.2.7
------
* Add warning for limited subgroup testing functionality in Spacegroup.
v3.2.6
------
* Extensive support for elasticity tensor analysis (Joseph Montoya).
* Misc bug fixes and performance improvements.
* Add support for QChem4.3 new format of Batch jobs
v3.2.5
------
* Improved potcar setup via "pmg setup", with MAPI setup.
* Support for new POTCARs issued by VASP.
* Improvements to ABINIT support.
* Improvement to Boltztrap support, e.g., scissor band gap, etc.
* Vasprun now issues warning when unconverged run is detected.
v3.2.4
------
* GaussianOutput can now parse frequencies, normal modes and cartesian forces
(Xin Chen).
* Support for Aiida<->pymatgen conversion by the Aiida development team (Andrius
Merkys).
* Specialized BSVasprun parser that is ~2-3x faster than Vasprun.
* Refactor the boltztrap package (merge a few methods together) and add several
new methods (power factor, seebeck...)
* Support of the new PCM format in QChem 4.3
* Local environment analysis to pmg script.
* Deprecate prettytable in favor of tabulate package.
* Improvements to MITNEBVaspInputSet.
* Misc bug fixes.
v3.2.3
------
* Massive update to abinit support. Note that pymatgen.io.abinitio has
been refactored to pymatgen.io.abinit. (Matteo, Setten)
* NwOutput now supports parsing of Hessian matrices (contributed by Xin
Chen)
* Gaussian support now has the ability to read potential energy surface
and electronic transitions computed with TD-DFT (Germain Salvato
Vallverdu)
* Bug fixes for CifWriter with symmetry.
* Bug fixes for surface generation and reactions.
* Monty requirement increased.
v3.2.1
------
* Fix wrong U value for Ce and Eu.
* Properly handle empty multiline strings in Cif
* Add ability to get specific data in MPRester.get_entries. Make all get_entry
methods consistent in kwargs.
v3.2.0
------
* Force conversion to an actual list in selective dynamics and velocities in
Poscar.
* fix small bug in BSPlotter (wrong ylim)
* Elastic tensor parsing in Outcar
v3.1.9
------
* Fix scripts.
v3.1.7
------
* Bug fixes for MPRester.
* Ensure correct monty version requirement in setup.py.
v3.1.6
------
* Rudimentary PWSCF output reading.
* Fix ASE support.
* Support for WAVEDERF and reading multiple dielectricfunctions in vasprun.xml.
(Miguel Dias Costa)
v3.1.5
------
* Move vasp.vasp*put to vasp.*puts. Also, maintain backwards compatibility with
vaspio.vasp_*put
v3.1.4
------
* Fix missing yaml files that have been moved.
v3.1.3
------
* Major refactoring of pymatgen.io. Now, the io suffix is dropped from all io
classes. i.e., it is just pymatgen.io.vasp, not pymatgen.io.vaspio. Also, all
input sets have been moved within the relevant package, e.g.,
pymatgen.io.vasp.sets. All changes are backwards compatible for now. But
deprecation messages have been included which states that the stubs will be
removed in pymatgen 4.0. Pls migrate code when you see the deprecation
messages.
* Make Composition.anonymized_formula truly chemistry independent (No A2B2
for peroxides or A2 for diatomic gasses)
* Allowing CIF data_* header to be prefixed with spaces and tabulations.
v3.1.2
------
* HHI Resource Analysis (by Anubhav Jain).
* Bug fixes for surfaces normalizatino.
* Bug fix for Vasprun parsing of response function keys.
* Dockerfile for generation of an image for pymatgen.
* Updated requirements.txt for latest requests, scipy, numpy.
v3.1.1
------
* Bug fixes for SpacegroupAnalyzer and SlabGenerator.
* Much faster normal vec search.
v3.1.0
------
* Much improved surface generation algorithm that provides for
orthogonality constraints.
* Transition state analysis tools! (beta)
* Massive improvements in Outcar parsing which provides a powerful grepping
syntax.
* PWSCFInput generation (beta).
* Reduce default SIGMA to 0.05 for MP input sets.
* Update spglib to 1.7.3 as per recommendation of Togo.
* Many bug fixes and efficiency improvements.
v3.0.13
-------
* Bug fix for parsing certain types of CIFs.
* MPRester now has get_materials_id_references helper method.
* Minor fix for Vasprun.final_energy.
* Added mp_decode option to MPRester.query to allow option to not decode into
pymatgen objects.
* New POTCAR hash scheme to more robustly identify unique POTCARs.
* Link to http://bit.ly/materialsapi for information on Materials API
document schema for use with MPRester.query method.
v3.0.11
-------
* Lots of abinitio improvements (Matteo).
* Added mp_decode option to MPRester.query to allow option to not decode into pymatgen objects.
v3.0.10
------
* Fix cartesian coord parsing in Poscar class.
* Vasprun now works with non-GGA PBE runs
* Misc bug fixes
v3.0.9
------
* Major bug fixes for CIF parsing (Will Richards).
* Support for {Li,Na} syntax in parse_criteria for MPRester.
* Additional example notebook for ordering and enumeration.
* More robust checking for oxidation states in EnumerateStructureTRansformation.
* Improvements to Slab polarity checking.
v3.0.8
------
* Massive update to abinitio (Matteo).
* Improvements to OUTCAR parsing (Ioannis Petousis).
v3.0.7
------
* Powerful Slab generation algorithms (beta!).
* Improvements to DiffusionAnalyzer with constant smoothing option.
* Significantly improve look of DOS plots using prettyplotlib.
v3.0.6
------
* Cost analysis module (Anubhav Jain)
* More Py3k fixes.
* Extensive abinitio updates (Matteo).
v3.0.5
------
* Completely revamped symmetry package. The finder.SymmetryFinder and
pointgroup and spacegroup modules are now deprecated. Instead,
all symmetry analysis is in the :module:`pymatgen.symmetry.analyzer`_
module. There is also a completely rewritten support for symmetry groups in
:module:`pymatgen.symmetry.groups`_. Structure now supports a static
constructor to generate a structure from a spacegroup (see examples).
* BatteryAnalyzer class (Anubhav Jain) to provide for some common analysis of
intercalation electrodes.
* Minor bug fixes for structure_matcher, lattice, abinitio.
* MOAB qadapter for abinit. (Liam Damewood)
v3.0.4
------
* Fix missing structures json data.
v3.0.3
------
* Updates to DiffusionAnalyzer for more fine-grained statistics.
* Bug fixes and tweaks to linear assignment
* Improved PymatgenTest class which provides a suite of test structures.
* Speedups to Phase Diagram
* Lots of improvements to Gaussian support (Nicolas Dardenne) and Abinit IO
(Matteo).
* Lots of Py3k minor updates.
* Updated doc for Diffusion anaylzer. Invert sq_disp_ions for more intuitive handling.
v3.0.2
------
1. Consistent use of unicode throughout pymatgen.
2. Minor bug fixes.
v3.0.1
------
1. Minor bug fixes for cifio.
2. Py3k updates for abinitio.
v3.0.0
------
* Pymatgen is now completely Python 2.7 and Python 3.x compatible!
* Spglib and pyhull have been updated to support Python 3.x.
* Completely rewritten pure python cifio module (courtesy of William Davidson
Richards) removed dependency on PyCIFRW, which has been causing many issues
with installation.
* Structure and Molecule now supports a very convenient to() and from_str and
from_file functionality. Instead of trying to load the appropriate parser,
you can output and read from the appropriate formats directly. See example
usage.
* ~50% speedup to LinearAssignment code.
* Continuous integration and contribution guidelines now include Python 3.
* **Backwards incompatible changes**
* matgenie.py has now been renamed simply "pmg" for brevity.
* All deprecated methods in pymatgen 2.x have been removed. E.g.,
pymatgen.core.structure_modifier is no longer available.
* Pymatgen classes now uses the as_dict() method protocol implemented in the
Monty package. The to_dict property is now deprecated and will be removed
in pymatgen v3.1.
* Update main docs page examples with the new Structure to, from formats.
v2.10.6
-------
* Bug fix for np1.9 incompatibility. Now works.
* Use wheel for pymatgen deployments.
* matgenie.py is now renamed to pmg for faster CLI usage.
* Improvements to KPOINTS automatic generation.
* Simpler and faster Structure.get_all_neighbors
v2.10.5
-------
* DiffusionAnalyzer now has non-smoothed option.
* Kpoints generation algorithm now guarantees minimum # of points.
* Compatibility now has a proper explanation dict.
* Vaspruns with NSW == 1 now checked properly for electronic conv.
* make_movie now supports kwargs.
v2.10.3
-------
* MPRester.query now supports a simple but powerful string criteria syntax
with support for wild cards.
* Improvements to Composition - support for negative compositions, sorting etc.
* Speed ups to StructureMatcher.
v2.10.2
-------
* Bug fix for Projected DOS parsing in new Vasprun.
* Compatibility now has a *explain* method which provides a detailed outline
of the changes that a Compatibility makes to an Entry.
v2.10.1
-------
* Minor fix for monty requirements in setup.py.
v2.10.0
-------
* Major update: MPRester now uses Materials API v2! Also major refactoring
of MPRester.
* Vastly improved Vasprun parser using cElementTree. Twice as fast,
half as much code and easier to maintain.
* Vast improvements to Qchem functionality (Xiaohui Qu).
* Improved handling of Structure manipulations for extremely large
structures (particularly in terms of memory consumption).
* Bug fix for XYZ parsing for scientific notation.
* Improve monty.serialization for transparent handling of JSON vs YAML.
Requirements updated to monty>=0.3.3.
* Update numpy requirements to 1.8+. Fixes memory leak.
* Other minor bug fixes.
v2.9.14
-------
* Implements Structure.sort method. Both Structure.sort and the
get_sorted_structure methods now supports all arguments supported by list
.sort().
* VaspInputSets configs, as well as several other configs now uses yaml. Note
the new dependency on pyyaml. It is highly recommended that you install
pyyaml with the libyaml C bindings.
* Fix missing spglib dependency.
* Use monty.serialization for transparent handling of JSON vs YAML.
Requirements updated to monty>=0.3.1.
v2.9.13
-------
* Urgent bug fix for missing compatibility yamls.
v2.9.12
-------
* Defect transformations (Bharat).
* Support for optical properties (Geoffroy Hautier and David Waroquiers).
* Improved support for some VASP output files (XDATCAR and OSZICAR).
* Refactored compatibilities now uses YAML for ease of reading.
v2.9.11
-------
* Bug fix for get_xrd_plot.
* Speed up XRD calculator by allowing specification of two theta ranges.
* Minor improvements to Gulp caller.
v2.9.10
-------
* Bug fix for unequal coefficients sizes in XRD.
* Support for Ag radiation in XRD calculator.
* Improved Procar class for extraction of information. (Germain Salvato
Vallverdu)
* Bug fix for extraction of GGA data from Materials API.
v2.9.9
------
* XRDCalculator now supports disordered structures.
* Minor speed ups and improvements.
v2.9.8
------
* Initial beta version of XRD pattern calculator.
* Pymatgen now uses spglib 1.6.0.
* Update to Vasprun to compute static deilectric constants with DFPT in VASP.
(Geoffroy Hautier)
v2.9.7
------
* Quick bug-fix release that provides a better solution to Structure handling
of properties instead of sanitizing MPRester structures.
v2.9.6
------
* Patch to allow 1D phase diagrams (essentially finding the lowest energy
phase).
* Better error checking for Bandstructure KPOINTs.
* Patch to sanitize structures obtained from MPRester.
v2.9.5
------
* Bug fix for linear assignment, which may sometimes affect Structure
Matcher results.
* Minor improvement to the way grand canonical PDs work.
v2.9.4
------
* Bug fix for Pourbaix Maker (Sai).
* Streamline use of scratch directories for various calls. Require monty >=
0.1.2.
* High accuracy mode for Zeo++ (Bharat Medasani).
v2.9.3
------
* Bug fix release for printing TransformedStructures from Substitutor (Will
Richards).
* Misc improvements in BVAnalyzer, coord_utils and defects (Will Richards,
David Waroquiers and Bharat Medasani).
v2.9.2
------
* Bug fix release for DummySpecie, which failed when deserializing from
json and had bad hash function.
v2.9.1
------
* Structure/Molecule now supports Pythonic list-like API for replacing and
removing sites. See :ref:`quick_start` for examples.
v2.9.0
------
* Updates to support ABINIT 7.6.1 (by Matteo Giantomassi).
* Vastly improved docs.
* Refactoring to move commonly used Python utility functions to `Monty
package <https://pypi.python.org/pypi/monty>`_, which is now a dependency
for pymatgen.
* Minor fixes and improvements to DiffusionAnalyzer.
* Many bug fixes and improvements.
v2.8.10
-------
* Refactoring of qchemio module (by Xiaohui Qu).
v2.8.9
------
* qchemio module (by Xiaohui Qu).
v2.8.8
------
* Minor bug fix release for Structure species substitution methods.
v2.8.7
------
* Massive update to pymatgen.io.abinitio package (by Matteo Giantomassi).
* Bug fixes for StructureMatcher's group_structure.
* Misc bug fixes and cleanup.
v2.8.6
------
* Bug fix for VASP io set introduced by the default to sorting of structure
sites when generating VASP input.
v2.8.4
------
* Completely revamped Compatibility/Correction system which improves
readability (Shyue Ping Ong/Anubhav Jain/Sai Jayaraman). This change is
backwards compatible for the most part.
v2.8.3
------
* Big fix release for json dumping for unitized floats.
v2.8.2
------
* Bug fix release to improve CIF parsing for more non-standard CIF files.
In particular, non-ascii characters are removed and _cgraph* fields are
removed prior to parsing for better support in PyCiFRW.
v2.8.1
------
* Bug fix release. Incorrect units assigned for ionic radii.
* Improved nwchemio supports COSMO and ESP calculations (Nav Rajput).
v2.8.0
------
* **Units**. Pymatgen now has a new system of managing units,
defined in pymatgen.core.units. Typical energy, length, time,
temperature and charge units are supported. Units subclass float,
which makes the usage transparent in all functions. The value that they
being are in terms of conversions between different units and addition and
subtraction of different units of the same type. Some basic quantities
like ionic radii and atomic masses are now returned in unitized forms for
easy conversion. Please see :mod:`pymatgen.core.units` and the
:doc:`examples </examples>` for a demonstration of house to use units in
pymatgen.
* **Minor backwards-incompatible change**. Structures are now sorted by
default when generating VASP input files using vaspio_set. Old behavior can
be obtained by setting sort_structure=False in the constructor. This is
typically the desired behavior and prevents the generation of large
POTCARs when atomic species are not grouped together.
* Bug fix for Molecule.substitute. Earlier algorithm was not detecting
terminal atoms properly.
* Additional conversion tools for ABINIT (by Matteo Giantomassi).
v2.7.9
------
* Minor bug fix release to fix pyhull dependencies to be more friendly.
* Improved structure matcher that allows for more flexible matching. New
matching between ordered and disordered comparator.
v2.7.7
-------
* Beta new Gulp Caller and Zeo++ interface classes (Bharat . Zeo++ is an open
source software for performing high-throughput geometry-based analysis of
porous materials and their voids. Please see
http://www.maciejharanczyk.info/Zeopp/about.html.
* Specify version of distribute to 0.6.34 for better compatibility.
v2.7.6
------
* Support for VTK 6.x in structure visualization.
* Updated install instructions for openbabel.
* Preliminary pourbaix analysis (Sai Jayaratnam).
v2.7.5
------
* Vastly improved Nwchem IO (by Shyue Ping Ong).
* Much improved ABINIT support (by Matteo Giantomassi).
v2.7.4
------
* Added basic Nwchem (http://www.nwchem-sw.org/) IO support. (by: Shyue Ping
Ong).
* New MoleculeMatcher class for comparing molecules by RMS. Requires
openbabel with python bindings. (by: Xiaohui Qu)
* New functional group substitution capability for molecules (by: Lei Cheng
and Shyue Ping Ong).
v2.7.2
------
* Minor bug fix release to fix some rare errors in very high dimensional
phase diagrams. **Requires new pyhull version (1.3.8).**
v2.7.1
------
* **Major backwards-incompatible change.** With effect from v2.7.1,
the default Structure and Molecule classes are now *mutable* objects. All
functionality in the :mod:`pymatgen.core.structure_modifier` has been
ported over to the new mutable classes. This change was implemented
because the immutability of Structure and Molecule has resulted in very
awkward code to make changes to them. The main cost of this change is that
Structure and Molecule can no longer be used as dict keys (__hash__ has
been set to None). However, we believe this is a minor cost given that we
have rarely seen the use of Structure or Molecule as dict keys in any case.
For the rare instances where such functionality is needed,
we have provided the IStructure and IMolecule classes (where I indicates
immutability) which will perform exactly the same way as the previous
classes. With this change, the :mod:`pymatgen.core.structure_modifier`
module is now deprecated and will be removed in a future version.
* read_structure and write_structure now supports pymatgen's json serialized
structures.
* read_mol and write_mol functions now available (analogues of
read_structure and write_structure for molecules)
v2.7.0
------
* Beta support for ABINIT input and output via pymatgen.io.abinitio
(courtesy of the excellent work of Matteo Giantomassi).
* Properties are now checked when comparing two Species for equality.
* MaterialsProjectVaspInputSet is now renamed to MPVaspInputSet for easier
typing. The old input sets have been deprecated.
* New VaspInputSets for MPStatic, MPNonSCF, MITMD which supports uniform
grid, bandstructure and molecular dynamics calculations. The MD input set
uses MIT parameters for speed.
* A beta DiffusionAnalysis class in the apps package.
* A revised KPOINT grid algorithm that generates more reasonable meshes.
* A guided install script is now provided for Mac and Linux users.
v2.6.6
------
* Updates to feffio (credit: Alan Dozier)
* Added detailed installation instructions for various platforms.
* Support for charge and spin multiplicity in Molecule. Expanded methods
available in Molecule.
* Added supercell matching capabilities to StructureMatcher.
* More robust creation of PhaseDiagrams to take into account potential qhull
precision errors.
v2.6.5
------
* Added a command_line caller to do Bader charge analysis using Henkelmann
et al.'s algorithm.
* Bug fix for POSCAR parsing when title line is an empty string.
* Added __rmul__ operator for Composition.
* Vastly expanded available aliases.
v2.6.4
------
* Bug fixes for selective dynamics in Poscar.
* Improved Procar parsing to support both simple and detailed PROCARs.
v2.6.3
------
* Added new MaterialsProject REST interfaces for submit/query/delete_snl
(currently open in beta for collaborators only).
* Added support for new MaterialsProject REST method get_stability.
* Added aliases for PhaseDiagram, GrandPotentialPhaseDiagram,
PDAnalyzer and PDPlotter in pymatgen.phasediagrams.
* Improvements to StructureMatcher: stol (site - tolerance) redefined as
a fraction of the average length per atom. Structures matched in fractional
space are now also matched in cartesian space and a rms displacement
normalized by length per atom can be returned using the rms_dist method.
v2.6.2
------
* Site and PeriodicSite now uses a Composition mapping type to represent
the species and occupancy, instead of a standard dict.
* Bug fix for reading and re-writing out of Potcars.
* VaspInputSet now supports MSONable framework.
* Strain cell option in StructureEditor.
* Miscellaneous bug fixes and speedups.
v2.6.1
------
* Use requests.Session in MPRester for connection pooling and code simplicity.
* Support for "with" context manager in MPRester.
* Updated periodic table data to correct errors in Ru, Tc and other elements.
* New methods in Lattice to obtain Wigner-Seitz cell and Brillouin Zone.
* Miscellaneous bug fixes and speedups.
v2.5.5
------
* Bug fix release for cifio for rhombohedral structures.
* Miscellaneous bug fixes and speedups.
v2.5.4
------
* Vastly improved Gaussian input file parsing that supports more varieties
of input specifications.
* StructureNL now supports molecules as well as structures.
* Updated atomic and vdw radius for Elements.
* Miscellaneous bug fixes and speedups.
v2.5.3
------
* Bug fix for StructureNotationalLanguage.
* Support for LDA US potential. matgenie.py script option to generate POTCARs.
* Beta version of StructureNotationLanguage, a markup format for Structure
data with metadata such as authors and references. (Anubhav Jain)
* Vasprun parsing now parses dielectric constant where available. (Geoffroy
Hautier)
* New custom ipython shell script for pymatgen.
* Miscellaneous bug fixes and speedups.
v2.5.1
------
* Bug fixes for primitive cell finder.
* Remove deprecated use_external_qhull option in PhaseDiagram classes.
* Miscellaneous bug fixes and speedups.
v2.5.0
------
* Added optimization package with linear assignment class.
* Improved robustness of StructureMatcher using linear assignment.
* Improved primitive cell search (faster and more robust).
* Cleanup of deprecated methods, including
pymatgen.alchemy.materials.TransformedMaterial.undo/redo_last_transformation,
pymatgen.core.site.Site.distance_and_image_old, Poscar.struct,
StructureFitter and tests.
* Miscellaneous bug fixes and speedups.
v2.4.3
------
* Bug fix for StructureMatcher.
* Miscellaneous speedups.
v2.4.0
------
* New StructureMatcher that effectively replaces StructureFitter. Orders of
magnitude faster and more robust. StructureFitter is now deprecated.
* Vastly improved PrimitiveCellTransformation.
* A lot of core methods have been rewritten to take advantage of vectorization
in numpy, resulting in orders of magnitude improvement in speed.
* Miscellaneous bug fixes and speedups.
v2.3.2
------
* More utilities for working with Periodic Boundary Conditions.
* Improved MPRester that supports more data and a new method of specifying
the API key for heavy users via a MAPI_KEY environment variable. Please
refer to the :doc:`usage pages </usage>` for more information.
* Vastly improved POTCAR setup script in scripts directly that is now
installed as part of a default pymatgen installation.
* Miscellaneous bug fixes and speedups.
v2.3.1
------
* Significant improvements to the high-level interface to the Materials API.
New interface provides more options to make it easier to get structures and
entries, better warnings and error handling. It uses the *requests*
library for a cleaner API.
* Bug fix for VolumetricData parsing and methods such as CHGCAR and LOCPOT.
Previously, the parsing was done incorrectly because VASP actually provides
data by running through the x-axis first, followed by y, then z.
* Bug fix for reverse_readline so that it works for gzipped and bzipped
strucutures (courtesy of Anubhav Jain).
* Fix "lossy" composition to_dict method. Now composition.to_dict properly
returns a correct species string as a key for compositions using species,
instead of just the element symbols.
* Miscellaneous bug fixes.
v2.3.0
------
* Remove usage of scipy and external qhull callers. Now uses pyhull package.
Please note that this change implies that the pyhull package is now a
required dependency. If you install pymatgen through the usual
easy_install or pip install methods, this should be taken care of
automatically for you. Otherwise, please look for the pyhull package on
PyPI to download and install it.
* Miscellaneous bug fixes.
v2.2.6
------
* Brand new *beta* bond valence analyzer based on a Maximum A Posteriori
algo using data-mined ICSD data.
* Speed up and improvements to core classes.
* Improved structure fitter (credits to Geoffroy Hautier).
* Brand new entry_tools module (pymatgen.entries.entry_tools).
* Vastly improved Outcar parser based on reverse parsing that speeds up
reading of OUTCAR files by orders of magnitude.
* Miscellaneous bug fixes.
v2.2.4
------
* Fixed bug in hexagonal cell KPOINTS file generation.
* New RelaxationAnalyzer to compare structures.
* New *beta* bond valence analyzer.
* Miscellaneous bug fixes.
v2.2.3
------
* New filter framework for filtering structures in pymatgen.alchemy.
* Updated feff io classes to support FEFF 9.6 and other code improvements.
* Miscellaneous bug fixes.
v2.2.2
------
* Bug fix release for REST interface.
* Improvements to unittests.
v2.2.1
------
* Improvements to feffio.
* Master matgenie.py script which replaces many analysis scripts.
* More memory efficient parsing of VolumetricData.
* Beta version of structure prediction classes.
* Changes to MPRester to work with v1 release of the Materials API.
* Miscellaneous bug fixes and speed improvements.
v2.2.0
------
* Beta modules (pymatgen.io.feffio) for io for FEFF, courtesy of Alan Dozier.
* New smartio module that intelligently reads structure input files based on
file extension.
* Spglib_adaptor module has been renamed to finder for brevity.
* Upgraded spglib to version 1.2.2. Improved handling of spglib install on
Mac OS X and Solaris.
* Major cleanup of code for PEP8 compliance.
* Cssr module now supports reading of input files.
* Miscellaneous bug fixes and speed improvements.
v2.1.2
------
* Brand new CompoundPD class that allows the plotting of phase diagrams that
do not have elements as their terminal points.
* Spglib is now completely integrated as part of the setup.py installation.
* Major (but completely backwards compatible) refactoring of sites and vaspio.
* Added a EnumerateStructureTransformation with optional dependency on the enum
library by Gus Hart. This provides a robust way to enumerate derivative
structures,
* Implemented LLL lattice reduction algorithm. Also added option to sanitize
a Structure on copy.
* Bug fix for missing Compatibility file in release distribution.
* Vastly improved StructureFitter which performs cell reduction where necessary
to speed up fitting.
* Miscellaneous bug fixes and speed improvements.
v2.0.0
------
* Brand new module (pymatgen.matproj.rest) for interfacing with the
MaterialsProject REST interface.
* Useful aliases for commonly used Objects, similar in style to numpy.
Supported objects include Element, Composition, Structure, Molecule, Spin
and Orbital. For example, the following will now work::
import pymatgen as mg
# Elemental Si
fe = mg.Element("Si")
# Composition of Fe2O3
comp = mg.Composition("Fe2O3")
# CsCl structure
structure = mg.Structure(mg.Lattice.cubic(4.2), ["Cs", "Cl"],
[[0, 0, 0], [0.5, 0.5, 0.5]])
* New PDAnalyzer method to generate chemical potential maps.
* Enhanced POSCAR class to support parsing of velocities and more formatting
options.
* Reorganization of Bandstructure module. Beta support for projected
bandstructure and eigenvalues in vaspio and electronic_structure.
* Miscellaneous bug fixes and speed improvements.
v1.9.0
------
* Completely new json encoder and decoder that support serialization of almost
all pymatgen objects.
* Simplification to Borg API utilizing the new json API.
* Bandstructure classes now support spin-polarized runs.
* Beta classes for battery (insertion and conversion) analysis.
v1.8.3
------
* spglib_adaptor now supports disordered structures.
* Update to support new spglib with angle_tolerance.
* Changes to Borg API to support both file and directory style paths.
* Speed up for COMPLETE_ORDERING algo for PartialRemoveSpecieTransformation.
v1.8.1
------
* Revamped transmuter classes for better readability and long term support.
* Much improved speed for PartialRemoveSpecieTransformations.
* Misc bug fixes.
v1.8.0
------
* Support for additional properties on Specie (Spin) and Site (magmom, charge).
* Molecule class to support molecules without periodicity.
* Beta io class for XYZ and GaussianInput.
v1.7.2
------
* Bug fixes for vaspio_set and compatibility classes.
v1.7.0
------
* Complete reorganization of modules for electronic structure.
* Beta of band structure classes.
* Misc improvements to vaspio classes.
* Bug fixes.
v1.6.0
------
* Beta of pymatgen.borg package implemented for high-throughput data assimilation.
* Added ComputedEntry classes for handling calculated data.
* New method of specifying VASP pseudopotential location using a VASP_PSP_DIR
environment variable.
* Bug fix for pymatgen.symmetry
* Ewald sum speed up by factor of 2 or more.
| {
"content_hash": "6da8dfc8d2320e8a2c7d2fc6a9a5ae8b",
"timestamp": "",
"source": "github",
"line_count": 1157,
"max_line_length": 122,
"avg_line_length": 33.54624027657736,
"alnum_prop": 0.7535619508927421,
"repo_name": "ndardenne/pymatgen",
"id": "974c9798496e6a32d8eb5315cfcbb3233b9105c9",
"size": "38813",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "docs/change_log.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "838"
},
{
"name": "Common Lisp",
"bytes": "3029065"
},
{
"name": "Perl",
"bytes": "229104"
},
{
"name": "Propeller Spin",
"bytes": "4026362"
},
{
"name": "Python",
"bytes": "5203893"
},
{
"name": "Roff",
"bytes": "868"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using System.Linq;
using Benchmarks.Enums;
using Benchmarks.Models;
using Benchmarks.ViewModels;
using Omu.ValueInjecter;
namespace Benchmarks.Mapping
{
public class ValueInjectorMappings
{
public static void Init()
{
Mapper.Reset();
Mapper.AddMap<Product, ProductViewModel>(src =>
{
var productViewModel = new ProductViewModel();
productViewModel.InjectFrom(src);
productViewModel.DefaultSharedOption =
Mapper.Map<ProductVariant, ProductVariantViewModel>(src.DefaultOption);
productViewModel.Options = new List<ProductVariantViewModel>();
foreach (var pv in src.Options)
{
productViewModel.Options.Add(Mapper.Map<ProductVariant, ProductVariantViewModel>(pv));
}
return productViewModel;
});
Mapper.AddMap<Test, TestViewModel>(src =>
{
var testViewModel = new TestViewModel(string.Format("{0} - {1}", src.Name, src.Id));
testViewModel.InjectFrom(src);
testViewModel.Name = string.Format("{0} - {1} - {2}", src.Name, src.Weight, src.Age);
testViewModel.Product = Mapper.Map<Product, ProductViewModel>(src.Product);
testViewModel.SpareTheProduct = Mapper.Map<Product, ProductViewModel>(src.SpareProduct);
testViewModel.Type = (Types) src.Type;
testViewModel.Weight = src.Weight*2;
testViewModel.Products = new List<ProductViewModel>();
foreach (var product in src.Products)
{
testViewModel.Products.Add(Mapper.Map<Product, ProductViewModel>(product));
}
return testViewModel;
});
Mapper.AddMap<User, UserViewModel>(src =>
{
var userViewModel = new UserViewModel();
userViewModel.InjectFrom(src);
userViewModel.BelongTo = Mapper.Map<Role, RoleViewModel>(src.Role);
return userViewModel;
});
Mapper.AddMap<Author, AuthorViewModel>(src =>
{
var articles = new ArticleViewModel[src.Articles.Count()];
var authorViewModel = new AuthorViewModel();
authorViewModel.InjectFrom(src);
for (var i = 0; i < articles.Length; i++)
{
articles[i] = Mapper.Map<Article, ArticleViewModel>(src.Articles.ElementAt(i));
}
authorViewModel.OwnedArticles = articles;
return authorViewModel;
});
}
}
}
| {
"content_hash": "9f40ee76dca7a4014472764141158da4",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 106,
"avg_line_length": 39.361111111111114,
"alnum_prop": 0.5532815808045166,
"repo_name": "modulexcite/ExpressMapper",
"id": "776eeecefcb4d18910279c9ee6b0e38a6a5595ed",
"size": "2836",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Benchmarks/Mapping/ValueInjectorMappings.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "282434"
}
],
"symlink_target": ""
} |
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => 'crwdns89:0crwdne89:0',
'next' => 'crwdns90:0crwdne90:0',
];
| {
"content_hash": "1c4f08e58ef5917915ae24da13835820",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 79,
"avg_line_length": 26.285714285714285,
"alnum_prop": 0.45471014492753625,
"repo_name": "gm-ah/Cachet",
"id": "ebece693eb1d841435341439c827a1fce50b03bc",
"size": "762",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/lang/en-UD/pagination.php",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "356"
},
{
"name": "CSS",
"bytes": "50120"
},
{
"name": "JavaScript",
"bytes": "11994"
},
{
"name": "PHP",
"bytes": "774437"
}
],
"symlink_target": ""
} |
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">{{ site.title }}</title>
<generator uri="https://github.com/mojombo/jekyll">Jekyll</generator>
<link rel="self" type="application/atom+xml" href="{{ site.url }}/feed.xml" />
<link rel="alternate" type="text/html" href="{{ site.url }}" />
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}/</id>
<author>
<name>{{ site.owner.name }}</name>
<uri>{{ site.url }}/</uri>
{% if site.owner.email %}<email>{{ site.owner.email }}</email>{% endif %}
</author>
{% for post in site.posts limit:20 %}
<entry>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link rel="alternate" type="text/html" href="{% if post.link %}{{ post.link }}{% else %}{{ site.url }}{{ post.url }}{% endif %}" />
<id>{{ site.url }}{{ post.id }}</id>
{% if post.modified %}<updated>{{ post.modified | to_xmlschema }}T00:00:00-00:00</updated>
<published>{{ post.date | date_to_xmlschema }}</published>
{% else %}<published>{{ post.date | date_to_xmlschema }}</published>
<updated>{{ post.date | date_to_xmlschema }}</updated>{% endif %}
<author>
<name>{{ author.name }}</name>
<uri>{{ site.url }}</uri>
<email>{{ author.email }}</email>
</author>
<content type="html">
{{ post.content | xml_escape }}
{% include feed-footer.html %}
</content>
</entry>
{% endfor %}
</feed>
| {
"content_hash": "cfc267d6da902f8f7e6fb48decd2fbf7",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 132,
"avg_line_length": 39.45945945945946,
"alnum_prop": 0.6006849315068493,
"repo_name": "savvyclutch/savvyclutch.github.io",
"id": "c1932d3a45bd97c275245bbd582a0870dcb877ea",
"size": "1464",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "feed.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "94933"
},
{
"name": "HTML",
"bytes": "31371"
},
{
"name": "JavaScript",
"bytes": "69242"
},
{
"name": "Ruby",
"bytes": "2749"
}
],
"symlink_target": ""
} |
/**
<p> Classes and interfaces to create and handle web services.</p>
*/
package javolution.xml.ws;
| {
"content_hash": "1e0cc09cbd5e2d38e7c3a6687920908c",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 65,
"avg_line_length": 20.4,
"alnum_prop": 0.7058823529411765,
"repo_name": "rPraml/org.openntf.domino",
"id": "0eef27c8501ceee738fc8eac62ed15f2f1a2e300",
"size": "102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "domino/externals/javolution-core-java/src/main/java/javolution/xml/ws/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2051"
},
{
"name": "CSS",
"bytes": "952"
},
{
"name": "HTML",
"bytes": "17439"
},
{
"name": "Java",
"bytes": "7812097"
},
{
"name": "JavaScript",
"bytes": "1950"
},
{
"name": "Ragel in Ruby Host",
"bytes": "2783"
},
{
"name": "Shell",
"bytes": "1080"
},
{
"name": "XPages",
"bytes": "105402"
},
{
"name": "XSLT",
"bytes": "15719"
}
],
"symlink_target": ""
} |
package weibo4j.examples.timeline;
import weibo4j.Timeline;
import weibo4j.examples.oauth2.Log;
import weibo4j.model.WeiboException;
import weibo4j.org.json.JSONArray;
public class GetRepostWeekly {
public static void main(String[] args) {
String access_token =args[0];
Timeline tm = new Timeline();
tm.client.setToken(access_token);
try {
JSONArray status = tm.getRepostWeekly();
Log.logInfo(status.toString());
} catch (WeiboException e) {
e.printStackTrace();
}
}
}
| {
"content_hash": "a5db5a32f5fa529e29f5b78622941ed5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 43,
"avg_line_length": 22.608695652173914,
"alnum_prop": 0.698076923076923,
"repo_name": "ManGroup/Demo",
"id": "d88ccddb09ac13c78fbc5ee24425c237d825c31c",
"size": "520",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Che/src/weibo4j/examples/timeline/GetRepostWeekly.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "630662"
},
{
"name": "Java",
"bytes": "2294818"
},
{
"name": "JavaScript",
"bytes": "875160"
},
{
"name": "PHP",
"bytes": "11295"
},
{
"name": "Perl",
"bytes": "11079"
}
],
"symlink_target": ""
} |
/**@jsx*/
var builder = require('focus').component.builder;
var Button = require('../../common/button/action').component;
var SelectAction = require('../../common/select-action').component;
var actionContextualMixin = {
/**
* Display name.
*/
displayName: 'list-action-contextual',
/**
* Init default props.
* @returns {object} Default props.
*/
getDefaultProps: function() {
return {
operationList: [],
operationParam: undefined
};
},
/**
* Init default state.
* @returns {oject} Initial state.
*/
getInitialState: function() {
return {
isSecondaryActionListExpanded: false // true if secondary actionList is expanded.
};
},
/**
* handle contextual action on click.
* @param {string} key Action key.
*/
_handleAction: function handleContextualAction(key){
return (event)=> {
event.preventDefault();
if (this.props.operationParam) {
this.props.operationList[key].action(this.props.operationParam);
} else {
this.props.operationList[key].action();
}
};
},
/**
* render the component.
* @returns {JSX} Html code.
*/
render: function renderContextualAction() {
var primaryActionList = [];
var secondaryActionList = [];
for (var key in this.props.operationList) {
var operation = this.props.operationList[key];
if (operation.priority === 1) {
primaryActionList.push( <Button key={key} style={operation.style} handleOnClick={this._handleAction(key)} shape={operation.style.shape || 'raised'} label={operation.label}/> );
} else {
secondaryActionList.push(operation);
}
}
return ( <div className = "list-action-contextual" >
<span> {primaryActionList}</span>
<SelectAction operationList={secondaryActionList} operationParam={this.props.operationParam} isExpanded={this.state.isSecondaryActionListExpanded} />
</div>);
}
};
module.exports = builder(actionContextualMixin);
| {
"content_hash": "fc39ca1633ad340facb07f2a2411631d",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 192,
"avg_line_length": 31.64788732394366,
"alnum_prop": 0.57543391188251,
"repo_name": "Bernardstanislas/focus-components",
"id": "bf90565db4395204f0ffb0788c3241df20530bb6",
"size": "2247",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "list/action-contextual/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "174459"
},
{
"name": "HTML",
"bytes": "173417"
},
{
"name": "JavaScript",
"bytes": "246760"
},
{
"name": "Shell",
"bytes": "232"
}
],
"symlink_target": ""
} |
package ca.uhn.fhir.jpa.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
//@formatter:off
@Entity
@Table(name = "HFJ_SPIDX_DATE" /*, indexes= {@Index(name="IDX_SP_DATE", columnList= "SP_VALUE_LOW,SP_VALUE_HIGH")}*/)
@org.hibernate.annotations.Table(appliesTo = "HFJ_SPIDX_DATE", indexes= {
@org.hibernate.annotations.Index(name="IDX_SP_DATE", columnNames= {"RES_TYPE", "SP_NAME", "SP_VALUE_LOW","SP_VALUE_HIGH"})
})
//@formatter:on
public class ResourceIndexedSearchParamDate extends BaseResourceIndexedSearchParam {
private static final long serialVersionUID = 1L;
@Column(name = "SP_VALUE_HIGH", nullable = true)
@Temporal(TemporalType.TIMESTAMP)
public Date myValueHigh;
@Column(name = "SP_VALUE_LOW", nullable = true)
@Temporal(TemporalType.TIMESTAMP)
public Date myValueLow;
public ResourceIndexedSearchParamDate() {
}
public ResourceIndexedSearchParamDate(String theName, Date theLow, Date theHigh) {
setParamName(theName);
setValueLow(theLow);
setValueHigh(theHigh);
}
public Date getValueHigh() {
return myValueHigh;
}
public Date getValueLow() {
return myValueLow;
}
public void setValueHigh(Date theValueHigh) {
myValueHigh = theValueHigh;
}
public void setValueLow(Date theValueLow) {
myValueLow = theValueLow;
}
}
| {
"content_hash": "5067c6b7cc8b54c3d63dd8d2bfcaed56",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 123,
"avg_line_length": 22.857142857142858,
"alnum_prop": 0.7465277777777778,
"repo_name": "gajen0981/FHIR-Server",
"id": "303a27970899f5aef4e1d40519bcbd60aab80893",
"size": "2109",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceIndexedSearchParamDate.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "227739"
},
{
"name": "Eagle",
"bytes": "4789404"
},
{
"name": "HTML",
"bytes": "149834"
},
{
"name": "Java",
"bytes": "11943289"
},
{
"name": "JavaScript",
"bytes": "24773"
},
{
"name": "KiCad",
"bytes": "12030"
},
{
"name": "Ruby",
"bytes": "208400"
},
{
"name": "Shell",
"bytes": "2096"
}
],
"symlink_target": ""
} |
package org.apache.myfaces.trinidad.convert;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import javax.faces.convert.ConverterException;
import javax.faces.convert.NumberConverter;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import org.apache.myfaces.trinidad.context.MockRequestContext;
import org.apache.myfaces.trinidadbuild.test.MockUIComponentWrapper;
import org.apache.shale.test.mock.MockFacesContext;
import org.jmock.Mock;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Test Trinidad NumberConverter
* @version $Name: $ ($version: $) $Date: 16-aug-2005.15:12:23 $
*/
public class TrinidadNumberConverterTest extends NumberConverterTestCase
{
public TrinidadNumberConverterTest(String name)
{
super(name);
}
@Override
protected NumberConverter getNumberConverter()
{
return new org.apache.myfaces.trinidad.convert.NumberConverter();
}
@Override
protected void setUp() throws Exception
{
super.setUp();
_mafct = new MockRequestContext();
_mafct.setDecimalSeparator('.');
_mafct.setNumberGroupingSeparator(',');
_mafct.setCurrencyCode(null);
}
@Override
protected void tearDown() throws Exception
{
// RequestContext uses a thread local variable to hold itself and has a
// check in it. So you need to release, since all instances for tests
// are created on the same thread by Junit.
_mafct.release();
_mafct = null;
super.tearDown();
}
public static Test suite()
{
return new TestSuite(TrinidadNumberConverterTest.class);
}
@Override
public void testCurrencyCodeIsHonoured()
{
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
_mafct.setDecimalSeparator(symbols.getMonetaryDecimalSeparator());
_mafct.setNumberGroupingSeparator(symbols.getGroupingSeparator());
super.testCurrencyCodeIsHonoured();
}
// @Override
// public void testFranceLocale()
// {
// DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.FRANCE);
// _mafct.setDecimalSeparator(symbols.getMonetaryDecimalSeparator());
// _mafct.setNumberGroupingSeparator(symbols.getGroupingSeparator());
//
// super.testFranceLocale();
// }
public void testValueSetInRequestContextIsHonoured()
{
//ugly ?
_mafct.release();
_mafct = null;
_mafct = new MockRequestContext();
_mafct.setDecimalSeparator('*');
_mafct.setNumberGroupingSeparator('!');
_mafct.setCurrencyCode(null);
Mock mock = mock(UIComponent.class);
UIComponent component = (UIComponent) mock.proxy();
NumberConverter conv = getNumberConverter();
conv.setLocale(Locale.US);
Number inputValue = new Double(8989.789);
String out = conv.getAsString(facesContext, component, inputValue);
assertEquals("8!989*789", out);
mock.verify();
}
@Override
protected void doTestStrictNess(
MockFacesContext context,
MockUIComponentWrapper wrapper,
Locale locale,
String inputValue)
{
NumberConverter converter = getNumberConverter();
converter.setLocale(locale);
context.getViewRoot().setLocale(locale);
try
{
// Trinidad Converter is not lenient.
converter.getAsObject(context, wrapper.getUIComponent(), inputValue);
fail("Expected converter exception");
}
catch (ConverterException ce)
{
; // We expected a exception to occur
}
}
public void testCustomMessageIsSet()
{
String[] failingValues = {"222.22.2", "3,", "23.3.3", "10e.04"};
String[] types = {"number", "percent", "currency", "pattern"};
String[] customMessage = {"number", "percent", "currency", "pattern"};
for (int i = 0; i < failingValues.length ; i++)
{
MockFacesContext context = new MockFacesContext();
Mock mock = buildMockUIComponent(3);
UIComponent component = (UIComponent) mock.proxy();
org.apache.myfaces.trinidad.convert.NumberConverter converter =
new org.apache.myfaces.trinidad.convert.NumberConverter();
UIViewRoot root = facesContext.getViewRoot();
root.setLocale(Locale.US);
for (int j = 0; j < 3; j++)
{
context.setViewRoot(root);
}
try
{
// Trinidad Converter is not lenient.
converter.setMessageDetailConvertNumber(customMessage[0]);
converter.setMessageDetailConvertPercent(customMessage[1]);
converter.setMessageDetailConvertCurrency(customMessage[2]);
converter.setMessageDetailConvertPattern(customMessage[3]);
if ("pattern".equals(types[i]))
converter.setPattern("##.000");
else
converter.setType(types[i]);
converter.getAsObject(context, component, failingValues[i]);
fail("Expected converter exception");
}
catch (ConverterException ce)
{
// We expected a exception to occur
assertEquals(ce.getFacesMessage().getDetail(), customMessage[i]);
}
}
}
private MockRequestContext _mafct;
//checkForSettingsInRequestContext - dec sep, currencyCode, NumGrpSptr
}
| {
"content_hash": "dc1ad062375b538e30825a44b0f26dbd",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 77,
"avg_line_length": 28.69060773480663,
"alnum_prop": 0.6886192952050838,
"repo_name": "adamrduffy/trinidad-1.0.x",
"id": "0f29f4fdd11deabb85c0aff2d5518f9d4098f2c6",
"size": "6014",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "trinidad-api/src/test/java/org/apache/myfaces/trinidad/convert/TrinidadNumberConverterTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "97216"
},
{
"name": "HTML",
"bytes": "92"
},
{
"name": "Java",
"bytes": "9255440"
},
{
"name": "JavaScript",
"bytes": "671775"
}
],
"symlink_target": ""
} |
function out = iszero(f)
%ISZERO True for zero CHEBTECH objects.
% ISZERO(F) returns logical TRUE is F.COEFFS has only zero entries and logical
% FALSE otherwise.
% Copyright 2016 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.
out = ~any(f.coeffs, 1);
if ( any(out) )
% We need this as any(NaN) = 0, which will pass the test above.
out = out & ~any(isnan(f.coeffs), 1);
return
end
end
| {
"content_hash": "ee3ace7f79702ce76cb41a0155ae3925",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 80,
"avg_line_length": 27.823529411764707,
"alnum_prop": 0.6892177589852009,
"repo_name": "alshedivat/chebfun",
"id": "55d6ef06261774663868ad204965e9b17e315e91",
"size": "473",
"binary": false,
"copies": "1",
"ref": "refs/heads/development",
"path": "@chebtech/iszero.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "M",
"bytes": "4938"
},
{
"name": "Matlab",
"bytes": "6012627"
},
{
"name": "Objective-C",
"bytes": "977"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.