text:
import React from 'react';
import { shallow } from 'enzyme';
import chai, { expect } from 'chai';
import { call, fork, take, select, put, cancel, takeLatest } from 'redux-saga/effects';
import agent from '../agent';
import {
  FETCH_BADGE_HISTORY_SUCCESS, FETCH_READY_BADGE_HISTORY,
  fetchBadgeHistory
} from './badges';

describe('BadgeSagas ', () => {
  it('should success fetchBadgeHistory', () => {
    const param = { badgeType: 1 };
    const gen = fetchBadgeHistory(param);

    expect(gen.next().value).to.deep.equal(put({ type: FETCH_READY_BADGE_HISTORY }));
    expect(gen.next().value).to.deep.equal(call(agent.Badge.byType, param.badgeType));
    expect(gen.next().value).to.deep.equal(put({
      type: FETCH_BADGE_HISTORY_SUCCESS,
      badgeItems: undefined,
      badgeType: param.badgeType
    }));
    expect(gen.next().done).to.equal(true);
  });
});


text:
package me.geso.jtt.tt;

import java.io.Closeable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

import me.geso.jtt.Source;
import me.geso.jtt.exception.ParserError;
import me.geso.jtt.lexer.Token;
import me.geso.jtt.lexer.TokenType;
import me.geso.jtt.parser.Node;
import me.geso.jtt.parser.NodeType;
import me.geso.jtt.parser.Parser;

import com.google.common.collect.Lists;

class TTParser implements Parser {
	private int pos = 0;
	private Source source;
	private List<Token> tokens;

	@Override
	public Source getSource() {
		return this.source;
	}

	@Override
	public int getLine() {
		return this.tokens.get(pos).getLineNumber();
	}

	public TTParser(Source source, List<Token> tokens) {
		this.source = source;
		this.tokens = tokens;
	}

	public Node parseTemplate() throws ParserError {
		Node n = parseTemplateBody();
		if (n == null) {
			throw new ParserError("Can't parse template", this);
		}
		if (this.pos != tokens.size()) {
			throw new ParserError("Can't parse template", this);
		}
		return n;
	}

	public Node parseTemplateBody() throws ParserError {
		List<Node> children = new ArrayList<>();
		while (pos < tokens.size()) {
			Node rawStringNode = parseRawString();
			if (rawStringNode != null) {
				children.add(rawStringNode);
				continue;
			}

			Node tagNode = parseTag();
			if (tagNode != null) {
				children.add(tagNode);
				continue;
			}

			break;
		}
		return new Node(NodeType.TEMPLATE, children, PREV_LINE_NUMBER());
	}

	Node parseRawString() {
		if (CURRENT_TYPE() == TokenType.RAW) {
			Node node = new Node(NodeType.RAW_STRING, CURRENT_STRING(),
					PREV_LINE_NUMBER());
			++pos;
			return node;
		} else {
			return null;
		}
	}

	// tag : '[%' expr '%]';
	public Node parseTag() throws ParserError {
		if (CURRENT_TYPE() != TokenType.OPEN) {
			return null;
		}
		if (!HAS_NEXT_TOKEN()) {
			throw new ParserError("Missing token after opening tag", this);
		}
		switch (NEXT_TYPE()) {
		// switch (tokens.get(pos).getType()) {
		case FOREACH: {
			return parseForEach();
		}
		case WHILE:
			return parseWhile();
		case LAST: {
			return parseLast();
		}
		case NEXT: {
			return parseNext();
		}
		case IF:
			return parseIf();
		case INCLUDE:
			return parseInclude();
		case SET:
			return parseSet();
		case SWITCH:
			return parseSwitch();
		case WRAPPER:
			return parseWrapper();
		case END:
		case ELSE:
		case ELSIF:
		case CASE:
			// Unexpected [% END %] etc... Backtracking is required.
			return null;
		default: {
			return this.parseTagExpr();
		}
		}
	}

	private Node parseForEach() {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.FOREACH)) {
			return null;
		}

		Node iterNode = parseIdent();
		if (iterNode == null) {
			throw new ParserError("No variable name after (FOR|FOREACH)", this);
		}

		if (!EAT(TokenType.IN)) {
			throw new ParserError("No 'IN' keyword after (FOR|FOREACH)", this);
		}

		Node expr = parseExpr();
		if (expr == null) {
			throw new ParserError("No expression after (FOR|FOREACH)", this);
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after (FOR|FOREACH)",
					this);
		}

		Node body = parseTemplateBody();
		if (body == null) {
			throw new ParserError("No template body after (FOR|FOREACH)", this);
		}

		if (!parseEnd()) {
			throw new ParserError("No `[% END %]` after (FOR|FOREACH)", this);
		}

		List<Node> children = new ArrayList<>();
		children.add(iterNode);
		children.add(expr);
		children.add(body);
		return new Node(NodeType.FOREACH, children, PREV_LINE_NUMBER());
	}

	private Node parseLast() {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.LAST)) {
			return null;
		}

		Node node = new Node(NodeType.LAST, PREV_LINE_NUMBER());

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after LAST", this);
		}

		return node;
	}

	private Node parseNext() {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.NEXT)) {
			return null;
		}

		Node node = new Node(NodeType.NEXT, PREV_LINE_NUMBER());

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after NEXT", this);
		}

		return node;
	}

	private Node parseTagExpr() {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}
		Node exprNode = parseExpr();
		if (exprNode == null) {
			throw new ParserError("No expression", this);
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after expression", this);
		}

		return new Node(NodeType.EXPRESSION, exprNode, PREV_LINE_NUMBER());
	}

	// [% WRAPPER "foo.tt" %]body[% END %]
	private Node parseWrapper() {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}
		if (!EAT(TokenType.WRAPPER)) {
			return null;
		}

		int lineNumber = CURRENT_LINE_NUMBER();

		Node fileName = parseExpr();
		if (fileName == null) {
			throw new ParserError("Missing file name after WRAPPER keyword.",
					this);
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after WRAPPER keyword.",
					this);
		}

		Node body = parseTemplateBody();

		if (!parseEnd()) {
			throw new ParserError("Missing END after WRAPPER keyword.", this);
		}

		return new Node(NodeType.WRAPPER, Lists.newArrayList(fileName, body),
				lineNumber);
	}

	private Node parseSwitch() throws ParserError {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}
		if (!EAT(TokenType.SWITCH)) {
			return null;
		}

		List<Node> list = new ArrayList<Node>();

		Node expr = parseExpr();
		if (expr == null) {
			throw new ParserError("Missing expression after SWITCH", this);
		}
		list.add(expr);

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after SWITCH", this);
		}

		while (true) {
			Node caseNode = parseCase();
			if (caseNode != null) {
				list.add(caseNode);
				continue;
			}

			break;
		}

		if (!parseEnd()) {
			throw new ParserError("Missing END tag after SWITCH", this);
		}

		return new Node(NodeType.SWITCH, list, PREV_LINE_NUMBER());
	}

	// [% CASE expr %]
	private Node parseCase() throws ParserError {
		try (PositionSaver saver = new PositionSaver(this)) {
			if (!EAT(TokenType.OPEN)) {
				return null;
			}
			if (!EAT(TokenType.CASE)) {
				return null;
			}

			// expr maybe null. `[% CASE %]` is valid.
			Node expr = parseExpr();

			if (!EAT(TokenType.CLOSE)) {
				throw new ParserError("Missing closing tag after CASE", this);
			}

			Node body = parseTemplateBody();
			if (body == null) {
				throw new ParserError("Missing templates after CASE", this);
			}

			saver.commit();
			return new Node(NodeType.CASE, Lists.newArrayList(expr, body),
					PREV_LINE_NUMBER());
		}
	}

	// [% INCLUDE "hello.tt" %]
	// [% INCLUDE "hello.tt" WITH foo %]
	private Node parseInclude() throws ParserError {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.INCLUDE)) {
			throw new ParserError("No 'INCLUDE'", this);
		}

		Node path = parseString();

		ArrayList<Node> args = new ArrayList<>();
		args.add(path);

		if (EAT(TokenType.WITH)) {
			while (CURRENT_TYPE() != TokenType.CLOSE) {
				Node ident = parseIdent();
				if (ident == null) {
					throw new ParserError("Missing ident after WITH", this);
				}
				args.add(ident);

				if (!EAT(TokenType.ASSIGN)) {
					throw new ParserError("Missing '=' after WITH", this);
				}

				Node expr = parseExpr();
				if (expr == null) {
					throw new ParserError("Missing expr after WITH: "
							+ CURRENT_TYPE(), this);
				}
				args.add(expr);

				if (EAT(TokenType.COMMA)) {
					continue;
				} else {
					break;
				}
			}
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after 'INCLUDE'", this);
		}

		return new Node(NodeType.INCLUDE, args, PREV_LINE_NUMBER());
	}

	private Node parseWhile() throws ParserError {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.WHILE)) {
			throw new ParserError("No 'WHILE'", this);
		}

		final Node expr = parseExpr();
		if (expr == null) {
			throw new ParserError("No expression after 'WHILE'", this);
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after 'WHILE'", this);
		}

		final Node body = parseTemplateBody();

		if (!parseEnd()) {
			throw new ParserError("No END tag after 'IF'", this);
		}

		return new Node(NodeType.WHILE, Lists.newArrayList(expr, body),
				PREV_LINE_NUMBER());
	}

	private Node parseSet() throws ParserError {
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.SET)) {
			throw new ParserError("No 'SET'", this);
		}

		final Node ident = parseIdent();
		if (!EAT(TokenType.ASSIGN)) {
			throw new ParserError("No = after 'SET'", this);
		}
		final Node expr = parseExpr();

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after 'SET'", this);
		}

		return new Node(NodeType.SET, Lists.newArrayList(ident, expr),
				PREV_LINE_NUMBER());
	}

	private Node parseIf() throws ParserError {
		// (if condition if-body else-body)
		if (!EAT(TokenType.OPEN)) {
			return null;
		}

		if (!EAT(TokenType.IF)) {
			throw new ParserError("No 'IF'", this);
		}

		final Node cond = parseExpr();
		if (cond == null) {
			throw new ParserError("No condition after 'IF'", this);
		}

		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag after 'IF'", this);
		}

		final Node body = parseTemplateBody();
		if (body == null) {
			throw new ParserError("No body after 'IF'", this);
		}

		Node elseBody = parseElsIf();
		if (elseBody == null) {
			elseBody = parseElse();
		}

		if (!parseEnd()) {
			throw new ParserError("No `[% END %]` after 'IF'", this);
		}

		List<Node> children = new ArrayList<>();
		children.add(cond);
		children.add(body);
		children.add(elseBody);

		return new Node(NodeType.IF, children, PREV_LINE_NUMBER());
	}

	private Node parseElsIf() throws ParserError {
		if (NEXT_TYPE() != TokenType.ELSIF) {
			return null;
		}

		if (!EAT(TokenType.OPEN)) {
			throw new ParserError("Missing open tag before 'ELSIF'", this);
		}
		if (!EAT(TokenType.ELSIF)) {
			throw new ParserError("Should not reach here", this);
		}

		final Node elsifCond = parseExpr();
		if (elsifCond == null) {
			throw new ParserError("No condition after 'ELSIF'", this);
		}
		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("No closing tag after 'ELSIF'", this);
		}

		Node elsifBody = parseTemplateBody();
		if (elsifBody == null) {
			throw new ParserError("No body after 'ELSIF'", this);
		}
		Arrays.asList(elsifCond, elsifBody);
		Node elseClause = parseElsIf();
		if (elseClause == null) {
			elseClause = parseElse();
		}

		List<Node> list = Arrays.asList(elsifCond, elsifBody, elseClause);
		return new Node(NodeType.IF, list, PREV_LINE_NUMBER());
	}

	private Node parseElse() throws ParserError {
		if (NEXT_TYPE() != TokenType.ELSE) {
			return null;
		}

		if (!EAT(TokenType.OPEN)) {
			throw new ParserError("Unknown parser error around ELSE keyword",
					this);
		}
		if (!EAT(TokenType.ELSE)) {
			throw new ParserError("Unknown parser error around ELSE keyword",
					this);
		}
		if (!EAT(TokenType.CLOSE)) {
			throw new ParserError("Missing closing tag around ELSE keyword",
					this);
		}

		Node elseBody = parseTemplateBody();
		if (elseBody == null) {
			throw new ParserError("No body after 'ELSE'", this);
		}
		return elseBody;
	}

	class PositionSaver implements Closeable {
		final TTParser parser;
		final int pos;
		boolean committed = false;

		public PositionSaver(TTParser parser) {
			this.parser = parser;
			this.pos = parser.getPos();
		}

		public void commit() {
			committed = true;
		}

		public void close() {
			if (!committed) {
				this.parser.setPos(this.pos);
			}
		}
	}

	private boolean parseEnd() {
		if (!EAT(TokenType.OPEN)) {
			return false;
		}

		if (!EAT(TokenType.END)) {
			return false;
		}

		if (!EAT(TokenType.CLOSE)) {
			return false;
		}

		return true;
	}

	int getPos() {
		return this.pos;
	}

	public String getFileName() {
		return CURRENT_FILENAME();
	}

	// expr = int;
	// expr = int '+' int;
	public Node parseExpr() throws ParserError {
		Node n = parsePipe();
		if (n != null) {
			return n;
		} else {
			return null;
		}
	}

	// pipe = assign '|' assign;
	public Node parsePipe() throws ParserError {
		Node n = parseLooseOr();
		while (EAT(TokenType.PIPE)) {
			Node lhs = parseLooseOr();
			if (lhs == null) {
				throw new ParserError("Missing expression after '|'", this);
			}
			if (lhs.getType() == NodeType.IDENT) {
				n = new Node(NodeType.FUNCALL, lhs, n, PREV_LINE_NUMBER());
			} else {
				throw new ParserError("left side of pipe must be ident", this);
			}
		}
		return n;
	}

	public Node parseLooseOr() throws ParserError {
		Node n = parseLooseAnd();
		if (n != null) {
			while (true) {
				if (EAT(TokenType.LOOSE_OR)) {
					Node rhs = parseLooseAnd();
					if (rhs == null) {
						throw new ParserError(
								"Missing expression after 'OR' : "
										+ CURRENT_TYPE(), this);
					}
					n = new Node(NodeType.OROR, n, rhs, PREV_LINE_NUMBER());
				} else {
					break;
				}
			}
		}
		return n;
	}

	// left AND
	public Node parseLooseAnd() throws ParserError {
		Node n = parseAssign();
		if (n != null) {
			while (true) {
				if (EAT(TokenType.LOOSE_AND)) {
					Node rhs = parseAssign();
					if (rhs == null) {
						throw new ParserError(
								"Missing expression after 'AND' : "
										+ CURRENT_TYPE(), this);
					}
					n = new Node(NodeType.ANDAND, n, rhs, PREV_LINE_NUMBER());
				} else {
					break;
				}
			}
		}
		return n;
	}

	public Node parseAssign() throws ParserError {
		Node n = parseConditionalOperator();
		if (n != null) {
			if (EAT(TokenType.ASSIGN)) {
				Node lhs = parseConditionalOperator();
				if (lhs == null) {
					throw new ParserError("Missing expression after '=' : "
							+ CURRENT_TYPE(), this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(lhs);
				n = new Node(NodeType.SET, children, PREV_LINE_NUMBER());
			}
			return n;
		} else {
			return null;
		}
	}

	public Node parseConditionalOperator() throws ParserError {
		Node n = parseRangeExpr();
		if (n != null) {
			if (EAT(TokenType.QUESTION)) {
				Node c = parseRangeExpr();
				if (c == null) {
					throw new ParserError("Missing expression after '?' : "
							+ CURRENT_TYPE(), this);
				}

				if (!EAT(TokenType.KOLON)) {
					throw new ParserError("Missing ':' after '?' : "
							+ CURRENT_TYPE(), this);
				}
				Node l = parseRangeExpr();
				if (l == null) {
					throw new ParserError("Missing expression after ':' : "
							+ CURRENT_TYPE(), this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(c);
				children.add(l);
				n = new Node(NodeType.IF, children, PREV_LINE_NUMBER());
			}
		}
		return n;
	}

	public Node parseRangeExpr() throws ParserError {
		Node n = parseOrOr();
		if (n != null) {
			if (EAT(TokenType.RANGE)) {
				Node l = parseOrOr();
				if (l == null) {
					throw new ParserError("Missing expression after ':' : "
							+ CURRENT_TYPE(), this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(l);
				n = new Node(NodeType.RANGE, children, PREV_LINE_NUMBER());
			}
		}
		return n;
	}

	public Node parseOrOr() throws ParserError {
		Node n = parseAndAnd();
		if (n != null) {
			while (true) {
				if (EAT(TokenType.OROR)) {
					Node rhs = parseAndAnd();
					if (rhs == null) {
						throw new ParserError("Missing expression after '||': "
								+ CURRENT_TYPE(), this);
					}
					n = new Node(NodeType.OROR, n, rhs, PREV_LINE_NUMBER());
				} else {
					break;
				}
			}
		}
		return n;
	}

	public Node parseAndAnd() throws ParserError {
		Node n = parseEqualityExpr();
		if (n != null) {
			while (true) {
				if (EAT(TokenType.ANDAND)) {
					Node rhs = parseEqualityExpr();
					if (rhs == null) {
						throw new ParserError("Missing expression after '&&': "
								+ CURRENT_TYPE(), this);
					}
					n = new Node(NodeType.ANDAND, n, rhs, PREV_LINE_NUMBER());
				} else {
					break;
				}
			}
		}
		return n;
	}

	public Node parseEqualityExpr() throws ParserError {
		Node n = parseComparationExpr();
		if (n != null) {
			while (true) {
				// ==
				if (EAT(TokenType.EQUALS)) {
					Node rhs = parseComparationExpr();
					if (rhs == null) {
						throw new ParserError(
								"Missing additive expression after '=='", this);
					}

					List<Node> children = new ArrayList<>();
					children.add(n);
					children.add(rhs);
					n = new Node(NodeType.EQUALS, children, PREV_LINE_NUMBER());
				} else if (EAT(TokenType.NE)) {
					Node rhs = parseComparationExpr();
					if (rhs == null) {
						throw new ParserError(
								"Missing additive expression after '!='", this);
					}
					n = new Node(NodeType.NE, n, rhs, PREV_LINE_NUMBER());
				}
				break;
			}
		}
		return n;
	}

	// comparationExpr : additive (
	// '==' additive
	// )*
	public Node parseComparationExpr() throws ParserError {
		Node n = parseAdditive();
		if (n == null) {
			return null;
		}

		while (true) {
			if (EAT(TokenType.GE)) {
				Node rhs = parseAdditive();
				if (rhs == null) {
					throw new ParserError(
							"Missing additive expression after '>='", this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.GE, children, PREV_LINE_NUMBER());
			} else if (EAT(TokenType.GT)) {
				Node rhs = parseAdditive();
				if (rhs == null) {
					throw new ParserError(
							"Missing additive expression after '>'", this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.GT, children, PREV_LINE_NUMBER());
			} else if (EAT(TokenType.LE)) {
				Node rhs = parseAdditive();
				if (rhs == null) {
					throw new ParserError(
							"Missing additive expression after '<='", this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.LE, children, PREV_LINE_NUMBER());
			} else if (EAT(TokenType.LT)) {
				Node rhs = parseAdditive();
				if (rhs == null) {
					throw new ParserError(
							"Missing additive expression after '<'", this);
				}

				List<Node> children = new ArrayList<>();
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.LT, children, PREV_LINE_NUMBER());
			} else {
				break;
			}
		}
		return n;
	}

	// additive: multitive ( '+' multitive )*
	// | multitive;
	public Node parseAdditive() throws ParserError {
		Node n = parseMultitive();

		while (true) {
			if (EAT(TokenType.PLUS)) {
				List<Node> children = new ArrayList<>();
				Node rhs = parseMultitive();
				if (rhs == null) {
					throw new ParserError(
							"Missing additive expression after '+'", this);
				}
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.ADD, children, PREV_LINE_NUMBER());
			} else if (EAT(TokenType.MINUS)) {
				List<Node> children = new ArrayList<>();
				Node rhs = parseMultitive();
				// TODO check rhs
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.SUBTRACT, children, PREV_LINE_NUMBER());
			} else if (EAT(TokenType.CONCAT)) {
				// '_' is the sring concatenation operator.
				List<Node> children = new ArrayList<>();
				Node rhs = parseMultitive();
				// TODO check rhs
				children.add(n);
				children.add(rhs);
				n = new Node(NodeType.CONCAT, children, PREV_LINE_NUMBER());
			} else {
				break;
			}
		}

		return n;
	}

	// multitive = atom '*' atom
	// | atom;
	private Node parseMultitive() throws ParserError {
		Node n = parseFuncall();

		while (true) {
			if (EAT(TokenType.MUL)) {
				n = MKBINOP(n, NodeType.MULTIPLY, this::parseMultitive);
			} else if (EAT(TokenType.DIVIDE)) {
				n = MKBINOP(n, NodeType.DIVIDE, this::parseMultitive);
			} else if (EAT(TokenType.MODULO)) {
				n = MKBINOP(n, NodeType.MODULO, this::parseMultitive);
			} else {
				break;
			}
		}

		return n;
	}

	private Node parseFuncall() throws ParserError {
		Node n = parseNot();
		if (EAT(TokenType.LPAREN)) {
			LinkedList<Node> args = parseArgs();
			args.addFirst(n);

			if (EAT(TokenType.RPAREN)) {
				n = new Node(NodeType.FUNCALL, args, PREV_LINE_NUMBER());
			} else {
				throw new ParserError("Missing closing paren after arguments",
						this);
			}
		}
		return n;
	}

	private LinkedList<Node> parseArgs() throws ParserError {
		LinkedList<Node> list = new LinkedList<>();

		if (CURRENT_TYPE() == TokenType.RPAREN) {
			return list;
		}

		while (pos < tokens.size()) {
			Node expr = parseExpr();
			if (expr == null) {
				throw new ParserError("Missing expression in arguments", this);
			}
			list.add(expr);

			if (EAT(TokenType.COMMA)) {
				continue;
			} else {
				return list;
			}
		}

		throw new ParserError("Missing closing paren after arguments", this);
	}

	private Node parseNot() throws ParserError {
		if (EAT(TokenType.NOT)) {
			Node n = parseAttr();
			if (n == null) {
				throw new ParserError("Missing expression after '!'", this);
			}
			return new Node(NodeType.NOT, n, PREV_LINE_NUMBER());
		} else {
			return parseAttr();
		}
	}

	private Node parseAttr() throws ParserError {
		Node n = parseAtom();
		if (n != null) {
			while (true) {
				if (EAT(TokenType.DOT)) {
					if (CURRENT_TYPE() == TokenType.IDENT) {
						Node rhs = parseIdent();
						if (rhs == null) {
							throw new ParserError("SHOULD NOT REACH HERE", this);
						}
						Node key = new Node(NodeType.STRING, rhs.getText(),
								PREV_LINE_NUMBER()); // Convert
						// to
						// STRING
						// from
						// IDENT.
						n = new Node(NodeType.ATTRIBUTE, n, key,
								PREV_LINE_NUMBER());
					} else if (CURRENT_TYPE() == TokenType.DOLLARVAR) {
						Node rhs = parseDollarVar();
						if (rhs == null) {
							throw new ParserError("SHOULD NOT REACH HERE", this);
						}
						n = new Node(NodeType.ATTRIBUTE, n, rhs,
								PREV_LINE_NUMBER());
					} else {
						throw new ParserError(
								"Missing (identifier|variable) after '.'.",
								this);
					}
				} else if (EAT(TokenType.LBRACKET)) { // ary[idx]
					Node key = parseExpr();
					if (key == null) {
						throw new ParserError("Missing expression after '['",
								this);
					}

					if (!EAT(TokenType.RBRACKET)) {
						throw new ParserError(
								"Missing closing bracket after '['.", this);
					}

					n = new Node(NodeType.ATTRIBUTE, n, key, PREV_LINE_NUMBER());
				} else {
					break;
				}
			}
		}
		return n;
	}

	private Node MKBINOP(Node lhs, NodeType type, ParserMethod method)
			throws ParserError {
		Node rhs = method.parse();
		if (rhs == null) {
			throw new ParserError("Missing " + method + ".", this);
		}
		return new Node(type, lhs, rhs, PREV_LINE_NUMBER());
	}

	// atom: double | int | ident | paren | ...;
	public Node parseAtom() throws ParserError {
		switch (CURRENT_TYPE()) {
		case DOUBLE:
			return parseDouble();
		case INTEGER:
			return parseInt();
		case LPAREN:
			return parseParen();
		case LBRACKET:
			return parseArray();
		case LBRACE:
			return parseMap();
		case STRING:
			return parseString();
		case FALSE:
			return parseFalse();
		case TRUE:
			return parseTrue();
		case NULL:
			return parseNull();
		case IDENT:
			return parseIdent();
		case DOLLARVAR:
			return parseDollarVar();
		case LOOP:
			return parseLoop();
		case FILE:
			return parseFile();
		case LINE:
			return parseLine();
		default:
			return null;
		}
	}

	private Node parseFile() {
		if (CURRENT_TYPE() == TokenType.FILE) {
			String fileName = CURRENT_FILENAME();
			if (fileName == null) {
				fileName = "-";
			}
			++pos;
			return new Node(NodeType.STRING, fileName, PREV_LINE_NUMBER());
		} else {
			return null;
		}
	}

	private Node parseLine() {
		if (CURRENT_TYPE() == TokenType.LINE) {
			int lineNumber = CURRENT_LINE_NUMBER();
			++pos;
			return new Node(NodeType.INTEGER, "" + lineNumber,
					PREV_LINE_NUMBER());
		} else {
			return null;
		}
	}

	private Node parseLoop() {
		if (EAT(TokenType.LOOP)) {
			Node node = null;
			try (PositionSaver p = new PositionSaver(this)) {
				if (EAT(TokenType.DOT)) {
					if (CURRENT_TYPE() == TokenType.IDENT) {
						if ("count".equals(CURRENT_STRING())) {
							++pos;
							p.commit();
							node = new Node(NodeType.LOOP_COUNT,
									PREV_LINE_NUMBER());
						} else if ("index".equals(CURRENT_STRING())) {
							++pos;
							p.commit();
							node = new Node(NodeType.LOOP_INDEX,
									PREV_LINE_NUMBER());
						} else if ("has_next".equals(CURRENT_STRING())) {
							++pos;
							p.commit();
							node = new Node(NodeType.LOOP_HAS_NEXT,
									PREV_LINE_NUMBER());
						}
					}
				}
			}
			if (node == null) {
				node = new Node(NodeType.LOOP_INDEX, PREV_LINE_NUMBER());
			}
			return node;
		} else {
			return null;
		}
	}

	private Node parseDollarVar() {
		if (CURRENT_TYPE() == TokenType.DOLLARVAR) {
			String name = CURRENT_STRING();
			++pos;
			return new Node(NodeType.DOLLARVAR, name, PREV_LINE_NUMBER());
		} else {
			return null;
		}
	}

	private Node parseNull() {
		++pos;
		return new Node(NodeType.NULL, PREV_LINE_NUMBER());
	}

	private Node parseTrue() {
		++pos;
		return new Node(NodeType.TRUE, PREV_LINE_NUMBER());
	}

	private Node parseFalse() {
		++pos;
		return new Node(NodeType.FALSE, PREV_LINE_NUMBER());
	}

	// map := '{' ( key '=>' value ',' )* '}'
	private Node parseMap() throws ParserError {
		if (!EAT(TokenType.LBRACE)) {
			return null;
		}

		List<Node> list = new ArrayList<>();

		while (pos < tokens.size()) {
			Node key = parseMapKey();
			if (key == null) {
				break;
			}

			if (!EAT(TokenType.ARROW)) {
				throw new ParserError("Missing => after map key", this);
			}

			Node value = parseExpr();
			if (value == null) {
				throw new ParserError("Missing expression after '=>'.", this);
			}

			list.add(key);
			list.add(value);

			if (!EAT(TokenType.COMMA)) {
				break;
			}
		}

		if (!EAT(TokenType.RBRACE)) {
			throw new ParserError("Missing '}' after map.", this);
		}

		return new Node(NodeType.MAP, list, PREV_LINE_NUMBER());
	}

	private Node parseMapKey() throws ParserError {
		Node retval = first(this::parseIdent, this::parseString);
		if (retval != null) {
			return retval;
		}
		return null;
	}

	@FunctionalInterface
	interface ParserMethod {
		Node parse() throws ParserError;
	}

	/**
	 * Utility method for parsing.
	 *
	 * @return
	 * @throws ParserError
	 */
	public Node first(ParserMethod... methods) throws ParserError {
		for (ParserMethod method : methods) {
			Node ret = method.parse();
			if (ret != null) {
				return ret;
			}
		}
		return null;
	}

	private Node parseString() throws ParserError {
		if (CURRENT_TYPE() == TokenType.STRING) {
			Node node = new Node(NodeType.STRING, CURRENT_STRING(),
					PREV_LINE_NUMBER());
			++pos;
			return node;
		} else {
			return null;
		}
	}

	private Node parseArray() throws ParserError {
		if (EAT(TokenType.LBRACKET)) {
			List<Node> children = new ArrayList<>();
			while (true) {
				Node expr = parseExpr();
				if (expr == null) {
					break;
				}
				children.add(expr);

				if (!EAT(TokenType.COMMA)) {
					break;
				}
			}
			if (!EAT(TokenType.RBRACKET)) {
				throw this
						.createError("Missing closing bracket after array ltieral");
			}

			return new Node(NodeType.ARRAY, children, PREV_LINE_NUMBER());
		} else {
			return null;
		}
	}

	// paren: '(' expr ')';
	public Node parseParen() throws ParserError {
		if (EAT(TokenType.LPAREN)) {
			Node expr = parseExpr();
			if (expr != null) {
				if (EAT(TokenType.RPAREN)) {
					return expr;
				} else {
					throw this.createError("Closing paren is expected but : "
							+ CURRENT_TYPE());
				}
			} else {
				throw this.createError("No expression after '('");
			}
		} else {
			return null;
		}
	}

	private ParserError createError(String message) {
		return new ParserError(message, this);
	}

	public Node parseInt() {
		if (CURRENT_TYPE() == TokenType.INTEGER) {
			Node node = new Node(NodeType.INTEGER, CURRENT_STRING(),
					PREV_LINE_NUMBER());
			pos++;
			return node;
		} else {
			return null;
		}
	}

	public Node parseDouble() {
		if (CURRENT_TYPE() == TokenType.DOUBLE) {
			Node node = new Node(NodeType.DOUBLE, CURRENT_STRING(),
					PREV_LINE_NUMBER());
			pos++;
			return node;
		} else {
			return null;
		}
	}

	private boolean EXPECT_(TokenType type) {
		if (pos < tokens.size()) {
			return tokens.get(pos).getType() == type;
		} else {
			return false;
		}
	}

	/**
	 * Increment pos if current token is `type`.
	 *
	 * @param type
	 * @return
	 */
	private boolean EAT(TokenType type) {
		if (EXPECT_(type)) {
			++pos;
			return true;
		} else {
			return false;
		}
	}

	private int CURRENT_LINE_NUMBER() {
		return tokens.get(pos).getLineNumber();
	}

	private String CURRENT_FILENAME() {
		if (pos < tokens.size()) {
			return tokens.get(pos).getFileName();
		} else {
			return null;
		}
	}

	private TokenType CURRENT_TYPE() {
		if (pos < tokens.size()) {
			return tokens.get(pos).getType();
		} else {
			return null;
		}
	}

	private boolean HAS_NEXT_TOKEN() {
		if (pos + 1 < tokens.size()) {
			return true;
		} else {
			return false;
		}
	}

	private TokenType NEXT_TYPE() {
		if (!HAS_NEXT_TOKEN()) {
			return null;
		}
		return tokens.get(pos + 1).getType();
	}

	private String CURRENT_STRING() {
		if (pos < tokens.size()) {
			return tokens.get(pos).getString();
		} else {
			return null;
		}
	}

	private int PREV_LINE_NUMBER() {
		if (pos == 0) {
			return tokens.get(0).getLineNumber();
		}
		return tokens.get(pos - 1).getLineNumber();
	}

	public Node parseIdent() {
		if (CURRENT_TYPE() == TokenType.IDENT) {
			Node node = new Node(NodeType.IDENT, CURRENT_STRING(),
					PREV_LINE_NUMBER());
			pos++;
			return node;
		} else {
			return null;
		}
	}

	void setPos(int pos) {
		this.pos = pos;
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace App\Http\Controllers;

use App\Domain\Auth\PasswordResetRepository;
use App\Domain\Users\UserRepository;
use App\Http\Requests\Auth\Login;
use Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

class AuthController extends Controller
{
    /**
     * Show the login form
     * @return Illuminate/View/View
     */
    public function index()
    {
        return view('login.index');
    }

    /**
     * Login the user
     *
     * @param  Login  $request
     * @return Illuminate/View/View
     */
    public function login(Login $request)
    {
        if (Auth::attempt([
            'email' => $request->email,
            'password' => $request->password
        ])) {
            return redirect()->route('dashboard.index');
        }

        return redirect()->back()
                ->withInput()
                ->withErrors(['email' => 'E-mail e/ou Senha incorretos.']);
    }

    /**
     * Logout the user
     *
     * @return Illuminate\Http\Response
     */
    public function logout()
    {
        Auth::logout();

        return redirect()->route('login.index');
    }

    /**
     * Show the forgot password form
     *
     * @return Illuminate\View\View
     */
    public function forgotPasswordForm()
    {
        return view('login.forgot-password');
    }

    /**
     * Send the reset link to the user email.
     *
     * @param  Request                 $request
     * @param  UserRepository          $repository
     * @param  PasswordResetRepository $passwordRepo
     *
     * @return Illuminate\Http\Response
     */
    public function forgotPassword(
        Request $request,
        UserRepository $repository,
        PasswordResetRepository $passwordRepo
    ) {
        $user = $repository->findBy('email', $request->email);

        if (!$user) {
            return redirect()->back()
                ->withErrors([
                    'email' => 'Não encontramos o email informado em nosso sistema.'
                ]);
        }

        $token = $passwordRepo->generateResetToken($user);

        Mail::send('emails.auth.password-reset', [
            'user' => $user,
            'token' => $token->token
        ], function ($m) use ($user) {
            $m->to($user->email)->subject(trans('emails.forgot-password.subject'));
        });

        return redirect()->back()
                ->with('success', 'Um link para redefinição de senha foi enviado para o seu e-mail.');
    }
}


text:
"""MySQL Connection Errors

Nearly all of these raise OperationalError. COMMANDS_OUT_OF_SYNC
raises ProgrammingError.

"""

MIN_ERROR = 2000
MAX_ERROR = 2999
UNKNOWN_ERROR = 2000
SOCKET_CREATE_ERROR = 2001
CONNECTION_ERROR = 2002
CONN_HOST_ERROR = 2003
IPSOCK_ERROR = 2004
UNKNOWN_HOST = 2005
SERVER_GONE_ERROR = 2006
VERSION_ERROR = 2007
OUT_OF_MEMORY = 2008
WRONG_HOST_INFO = 2009
LOCALHOST_CONNECTION = 2010
TCP_CONNECTION = 2011
SERVER_HANDSHAKE_ERR = 2012
SERVER_LOST = 2013
COMMANDS_OUT_OF_SYNC = 2014
NAMEDPIPE_CONNECTION = 2015
NAMEDPIPEWAIT_ERROR = 2016
NAMEDPIPEOPEN_ERROR = 2017
NAMEDPIPESETSTATE_ERROR = 2018
CANT_READ_CHARSET = 2019
NET_PACKET_TOO_LARGE = 2020


text:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.opencb.cellbase</groupId>
        <artifactId>cellbase</artifactId>
        <version>4.5.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>cellbase-client</artifactId>
    <version>${cellbase.version}</version>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.opencb.cellbase</groupId>
            <artifactId>cellbase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.opencb.cellbase</groupId>
            <artifactId>cellbase-server</artifactId>
            <version>${cellbase.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>


text:
@implementation NSMutableDictionary (TLSafeAccess)

- (void)setSafeObject:(id)object forKey:(NSString*)key
{
    if (object != nil) {
        self[key] = object;
    }
}

- (void)setString:(NSString *)string forKey:(NSString *)key
{
    [self setValue:string ? string : @"" forKey:key];
}

- (void)setBool:(BOOL)boolValue forKey:(NSString *)key
{
    self[key] = @(boolValue);
}

- (void)setInt:(int)intValue forKey:(NSString *)key
{
    self[key] = @(intValue);
}

- (void)setInteger:(NSInteger)integerValue forKey:(NSString *)key
{
    self[key] = @(integerValue);
}

- (void)setUnsignedInteger:(NSUInteger)unsignedIntegerValue forKey:(NSString *)key
{
    self[key] = @(unsignedIntegerValue);
}

- (void)setCGFloat:(CGFloat)floatValue forKey:(NSString *)key
{
    self[key] = @(floatValue);
}

- (void)setChar:(char)charValue forKey:(NSString *)key
{
    self[key] = @(charValue);
}

- (void)setFloat:(float)floatValue forKey:(NSString *)key
{
    self[key] = @(floatValue);
}

- (void)setDouble:(double)doubleValue forKey:(NSString *)key
{
    self[key] = @(doubleValue);
}

- (void)setLongLong:(long long)longlongValue forKey:(NSString *)key
{
    self[key] = @(longlongValue);
}

- (void)setPoint:(CGPoint)point forKey:(NSString *)key
{
    self[key] = NSStringFromCGPoint(point);
}

- (void)setSize:(CGSize)size forKey:(NSString *)key
{
    self[key] = NSStringFromCGSize(size);
}

- (void)setRect:(CGRect)rect forKey:(NSString *)key
{
    self[key] = NSStringFromCGRect(rect);
}

@end


text:
#import "Quota.h"

#import "NSTableViewDataSource.h"
#import "NSTableViewDelegate.h"

@class NSButton, NSMutableArray, NSMutableAttributedString, NSMutableDictionary, NSPopUpButton;

@interface POPQuota : Quota <NSTableViewDataSource, NSTableViewDelegate>
{
    NSPopUpButton *_showMessagesPopup;
    NSButton *_deleteButton;
    NSMutableAttributedString *_truncatedString;
    NSMutableDictionary *_truncatedParagraphStyle;
    struct QuotaSimpleSortDescriptor _simpleSortDescs[5];
    NSMutableArray *_messageIDs;
}

- (void)_deleteServerMessagesCompleted:(id)arg1;
- (void)_deleteServerMessagesStarted:(id)arg1;
- (BOOL)_updateMessage:(id)arg1;
- (long long)_addMessage:(id)arg1;
- (void)_resortMessages;
- (void)_syncSortDescriptors;
- (void)tableViewSelectionDidChange:(id)arg1;
- (void)tableView:(id)arg1 sortDescriptorsDidChange:(id)arg2;
- (void)tableView:(id)arg1 willDisplayCell:(id)arg2 forTableColumn:(id)arg3 row:(long long)arg4;
- (id)tableView:(id)arg1 objectValueForTableColumn:(id)arg2 row:(long long)arg3;
- (id)_truncatedAttributedStringForString:(id)arg1;
- (long long)numberOfRowsInTableView:(id)arg1;
- (const struct QuotaSimpleSortDescriptor *)sortDescriptorAtIndex:(unsigned long long)arg1;
- (unsigned long long)numberOfSortDescriptors;
- (void)engineUpdated:(id)arg1;
- (void)engineDidFinish;
- (void)engineDidStart;
- (id)_account;
- (void)showMessagesPopupChanged:(id)arg1;
- (void)_updateUsageField;
- (id)_filterMessages:(id)arg1 showMessageType:(long long)arg2;
- (BOOL)_shouldShowMessage:(id)arg1 showMessageType:(long long)arg2;
- (void)deleteFromServer:(id)arg1;
- (Class)engineClass;
- (void)dealloc;
- (void)awakeFromNib;
- (id)initWithAccount:(id)arg1;

@end


text:
<?xml version='1.0' encoding='UTF-8'?>
<plugin xmlns='http://apache.org/cordova/ns/plugins/1.0' id='com.cocoapods-cordova.B' version='0.0.1'>
  <name>
     B
  </name>
  <description>
     B Test Plugin
  </description>
  <license>
     MIT
  </license>
  <keywords>
     test
  </keywords>
  <js-module src='www/B.js' name='B'>
    <clobbers target='B'/>
  </js-module>
  <platform name='ios'>
    <config-file target='config.xml' parent='/*'>
      <feature name='B'>
        <param name='ios-package' value='B'/>
      </feature>
    </config-file>
    <header-file src='dist/include/B/B.h' pod='true'/>
    <source-file src='dist/libB.a' framework='true' pod='true'/>
  </platform>
</plugin>


text:
[Docker](https://docs.docker.com/engine/installation/)
### Get the run script
```bash
curl https://raw.githubusercontent.com/blengerich/GenAMap/master/Documentation/Installation/run_genamap.sh > run_genamap.sh
```
### Give executable permissions to the run script
```bash
chmod +x run_genamap.sh
```
### Run the run script
* When running the script for the first time, it may need to pull the images, which will take a while and require internet connection.
```bash
./run_genamap.sh
```
* Run  ```docker ps```, the output should indicate that three containers are running
    * genamap_production_server
    * genamap_mongo
    * genamap_postgres
* If this isn't true, run ```./run_genamap.sh``` again.

### Enjoy next generation GWAS
* Once the script has setup the server, visit __localhost__
    * The site will be ready a few minutes after run_genamap.sh completes. The server has to load SNP data which will take a couple of minutes.
* There is already a demo user setup with the following credentials
    * *email*: demo@demo.com
    * *password*: demo

# Stopping the GenAMap Server
### Get the stop script
```bash
curl https://raw.githubusercontent.com/blengerich/GenAMap/master/Documentation/Installation/stop_genamap.sh > stop_genamap.sh
```

### Give executable permissions to the stop script
```bash
chmod +x stop_genamap.sh
```

### Run the stop script
```bash
./stop_genamap.sh
```

# Updating the GenAMap Server
```bash
./run_genamap.sh -u
```


text:
package de.uni.freiburg.iig.telematik.sepia.petrinet.pt.properties.wfnet.soundness;

import de.invation.code.toval.thread.ExecutorListener;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.abstr.AbstractPTFlowRelation;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.abstr.AbstractPTMarking;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.abstr.AbstractPTPlace;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.abstr.AbstractPTTransition;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.properties.wfnet.WFNetException;
import de.uni.freiburg.iig.telematik.sepia.petrinet.pt.properties.wfnet.WFNetProperties;

public class WFNetSoundnessChecking {

	public static <P extends AbstractPTPlace<F>,
	 			   T extends AbstractPTTransition<F>,
	 			   F extends AbstractPTFlowRelation<P,T>,
	 			   M extends AbstractPTMarking>

	void initiateWFNetSoundnessCheck(WFNetSoundnessCheckingCallableGenerator<P,T,F,M> generator, ExecutorListener<WFNetProperties> listener)
			throws WFNetException {

		ThreadedWFNetSoundnessChecker<P,T,F,M> calculator = new ThreadedWFNetSoundnessChecker<P,T,F,M>(generator);
		calculator.addExecutorListener(listener);
		calculator.runCalculation();
	}

	public static <P extends AbstractPTPlace<F>,
	   			   T extends AbstractPTTransition<F>,
	   			   F extends AbstractPTFlowRelation<P,T>,
	   			   M extends AbstractPTMarking>

	WFNetProperties checkWFNetProperty(WFNetSoundnessCheckingCallableGenerator<P,T,F,M> generator)
			throws WFNetException {

		ThreadedWFNetSoundnessChecker<P,T,F,M> calculator = new ThreadedWFNetSoundnessChecker<P,T,F,M>(generator);
		calculator.runCalculation();
		return calculator.getResult();
	}

}


text:
    <?php foreach ($project['columns'] as $column): ?>

            <strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?>

            <?= $this->text->e($column['title']) ?>

    <?php endforeach ?>


text:
var _ = require("lodash");
var BookEvents = require("./events");

var store = function(pubsub, bookResource) {
  var bookList = [];

  var publishData = function() {
    pubsub.publish(BookEvents.DATA, bookList);
  };

  var findBookIndex = function(book) {
    return _.findIndex(bookList, {id: book.id});
  };

  var onReady = function() {
    bookResource.query().then(function(response) {
      bookList = response;
      publishData();
    });
  };
  pubsub.subscribe(BookEvents.READY, onReady);

  var onDelete = function(book) {
    bookResource.delete(book).then(function() {
      var index = findBookIndex(book);

      if (index >= 0 && index < bookList.length) {
        bookList.splice(index, 1);
        publishData();
      }
    });
  };
  pubsub.subscribe(BookEvents.DELETE, onDelete);

  var onSave = function(book) {
    bookResource.save(book).then(function(response) {
      var updatedBook = response;
      var index = findBookIndex(updatedBook);

      if (index >= 0) {
        bookList[index] = updatedBook;
      }
      else {
        bookList.push(updatedBook);
      }
      publishData();
    });
  };
  pubsub.subscribe(BookEvents.SAVE, onSave);
};

module.exports = store;


text:
__author__ = "Johannes Köster"
__copyright__ = "Copyright 2015, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"

from collections import defaultdict

from snakemake.io import _IOFile

class Node:
    __slots__ = ["rules", "children"]

    def __init__(self):
        self.rules = set()
        self.children = defaultdict(Node)

    def __repr__(self):
        return "({}) -> {}".format(list(map(str, self.rules)), dict(self.children))

class OutputIndex:
    def __init__(self, rules):
        self.root = Node()

        for rule in rules:
            output = list(rule.output)
            if rule.benchmark:
                output.append(rule.benchmark)
            for constant_prefix in sorted(map(_IOFile.constant_prefix,
                                              output)):
                self.add_output(rule, constant_prefix)

    def add_output(self, rule, constant_prefix):
        node = self.root
        for c in constant_prefix:
            node = node.children[c]
            if rule in node.rules:
                # a prefix of file f is already recorded for this rule
                # hence we can stop here
                return
        node.rules.add(rule)

    def match(self, f):
        node = self.root
        for c in f:
            for rule in node.rules:
                yield rule
            node = node.children.get(c, None)
            if node is None:
                return
        for rule in node.rules:
            yield rule


text:
#include <linux/cgroup.h>
#include <linux/fs.h>
#include <linux/log2.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/vmstat.h>
#include <linux/eventfd.h>
#include <linux/swap.h>
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/vmpressure.h>

/*
 * The window size (vmpressure_win) is the number of scanned pages before
 * we try to analyze scanned/reclaimed ratio. So the window is used as a
 * rate-limit tunable for the "low" level notification, and also for
 * averaging the ratio for medium/critical levels. Using small window
 * sizes can cause lot of false positives, but too big window size will
 * delay the notifications.
 *
 * As the vmscan reclaimer logic works with chunks which are multiple of
 * SWAP_CLUSTER_MAX, it makes sense to use it for the window size as well.
 *
 * TODO: Make the window size depend on machine size, as we do for vmstat
 * thresholds. Currently we set it to 512 pages (2MB for 4KB pages).
 */
static const unsigned long vmpressure_win = SWAP_CLUSTER_MAX * 16;

/*
 * These thresholds are used when we account memory pressure through
 * scanned/reclaimed ratio. The current values were chosen empirically. In
 * essence, they are percents: the higher the value, the more number
 * unsuccessful reclaims there were.
 */
static const unsigned int vmpressure_level_med = 60;
static const unsigned int vmpressure_level_critical = 95;

/*
 * When there are too little pages left to scan, vmpressure() may miss the
 * critical pressure as number of pages will be less than "window size".
 * However, in that case the vmscan priority will raise fast as the
 * reclaimer will try to scan LRUs more deeply.
 *
 * The vmscan logic considers these special priorities:
 *
 * prio == DEF_PRIORITY (12): reclaimer starts with that value
 * prio <= DEF_PRIORITY - 2 : kswapd becomes somewhat overwhelmed
 * prio == 0                : close to OOM, kernel scans every page in an lru
 *
 * Any value in this range is acceptable for this tunable (i.e. from 12 to
 * 0). Current value for the vmpressure_level_critical_prio is chosen
 * empirically, but the number, in essence, means that we consider
 * critical level when scanning depth is ~10% of the lru size (vmscan
 * scans 'lru_size >> prio' pages, so it is actually 12.5%, or one
 * eights).
 */
static const unsigned int vmpressure_level_critical_prio = ilog2(100 / 10);

static struct vmpressure *work_to_vmpressure(struct work_struct *work)
{
	return container_of(work, struct vmpressure, work);
}

static struct vmpressure *cg_to_vmpressure(struct cgroup *cg)
{
	return css_to_vmpressure(cgroup_subsys_state(cg, mem_cgroup_subsys_id));
}

static struct vmpressure *vmpressure_parent(struct vmpressure *vmpr)
{
	struct cgroup *cg = vmpressure_to_css(vmpr)->cgroup;
	struct mem_cgroup *memcg = mem_cgroup_from_cont(cg);

	memcg = parent_mem_cgroup(memcg);
	if (!memcg)
		return NULL;
	return memcg_to_vmpressure(memcg);
}

enum vmpressure_levels {
	VMPRESSURE_LOW = 0,
	VMPRESSURE_MEDIUM,
	VMPRESSURE_CRITICAL,
	VMPRESSURE_NUM_LEVELS,
};

static const char * const vmpressure_str_levels[] = {
	[VMPRESSURE_LOW] = "low",
	[VMPRESSURE_MEDIUM] = "medium",
	[VMPRESSURE_CRITICAL] = "critical",
};

static enum vmpressure_levels vmpressure_level(unsigned long pressure)
{
	if (pressure >= vmpressure_level_critical)
		return VMPRESSURE_CRITICAL;
	else if (pressure >= vmpressure_level_med)
		return VMPRESSURE_MEDIUM;
	return VMPRESSURE_LOW;
}

static enum vmpressure_levels vmpressure_calc_level(unsigned long scanned,
						    unsigned long reclaimed)
{
	unsigned long scale = scanned + reclaimed;
	unsigned long pressure;

	/*
	 * We calculate the ratio (in percents) of how many pages were
	 * scanned vs. reclaimed in a given time frame (window). Note that
	 * time is in VM reclaimer's "ticks", i.e. number of pages
	 * scanned. This makes it possible to set desired reaction time
	 * and serves as a ratelimit.
	 */
	pressure = scale - (reclaimed * scale / scanned);
	pressure = pressure * 100 / scale;

	pr_debug("%s: %3lu  (s: %lu  r: %lu)\n", __func__, pressure,
		 scanned, reclaimed);

	return vmpressure_level(pressure);
}

struct vmpressure_event {
	struct eventfd_ctx *efd;
	enum vmpressure_levels level;
	struct list_head node;
};

static bool vmpressure_event(struct vmpressure *vmpr,
			     unsigned long scanned, unsigned long reclaimed)
{
	struct vmpressure_event *ev;
	enum vmpressure_levels level;
	bool signalled = false;

	level = vmpressure_calc_level(scanned, reclaimed);

	mutex_lock(&vmpr->events_lock);

	list_for_each_entry(ev, &vmpr->events, node) {
		if (level >= ev->level) {
			eventfd_signal(ev->efd, 1);
			signalled = true;
		}
	}

	mutex_unlock(&vmpr->events_lock);

	return signalled;
}

static void vmpressure_work_fn(struct work_struct *work)
{
	struct vmpressure *vmpr = work_to_vmpressure(work);
	unsigned long scanned;
	unsigned long reclaimed;

	/*
	 * Several contexts might be calling vmpressure(), so it is
	 * possible that the work was rescheduled again before the old
	 * work context cleared the counters. In that case we will run
	 * just after the old work returns, but then scanned might be zero
	 * here. No need for any locks here since we don't care if
	 * vmpr->reclaimed is in sync.
	 */
	if (!vmpr->scanned)
		return;

	mutex_lock(&vmpr->sr_lock);
	scanned = vmpr->scanned;
	reclaimed = vmpr->reclaimed;
	vmpr->scanned = 0;
	vmpr->reclaimed = 0;
	mutex_unlock(&vmpr->sr_lock);

	do {
		if (vmpressure_event(vmpr, scanned, reclaimed))
			break;
		/*
		 * If not handled, propagate the event upward into the
		 * hierarchy.
		 */
	} while ((vmpr = vmpressure_parent(vmpr)));
}

/**
 * vmpressure() - Account memory pressure through scanned/reclaimed ratio
 * @gfp:	reclaimer's gfp mask
 * @memcg:	cgroup memory controller handle
 * @scanned:	number of pages scanned
 * @reclaimed:	number of pages reclaimed
 *
 * This function should be called from the vmscan reclaim path to account
 * "instantaneous" memory pressure (scanned/reclaimed ratio). The raw
 * pressure index is then further refined and averaged over time.
 *
 * This function does not return any value.
 */
void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
		unsigned long scanned, unsigned long reclaimed)
{
	struct vmpressure *vmpr = memcg_to_vmpressure(memcg);

	/*
	 * Here we only want to account pressure that userland is able to
	 * help us with. For example, suppose that DMA zone is under
	 * pressure; if we notify userland about that kind of pressure,
	 * then it will be mostly a waste as it will trigger unnecessary
	 * freeing of memory by userland (since userland is more likely to
	 * have HIGHMEM/MOVABLE pages instead of the DMA fallback). That
	 * is why we include only movable, highmem and FS/IO pages.
	 * Indirect reclaim (kswapd) sets sc->gfp_mask to GFP_KERNEL, so
	 * we account it too.
	 */
	if (!(gfp & (__GFP_HIGHMEM | __GFP_MOVABLE | __GFP_IO | __GFP_FS)))
		return;

	/*
	 * If we got here with no pages scanned, then that is an indicator
	 * that reclaimer was unable to find any shrinkable LRUs at the
	 * current scanning depth. But it does not mean that we should
	 * report the critical pressure, yet. If the scanning priority
	 * (scanning depth) goes too high (deep), we will be notified
	 * through vmpressure_prio(). But so far, keep calm.
	 */
	if (!scanned)
		return;

	mutex_lock(&vmpr->sr_lock);
	vmpr->scanned += scanned;
	vmpr->reclaimed += reclaimed;
	scanned = vmpr->scanned;
	mutex_unlock(&vmpr->sr_lock);

	if (scanned < vmpressure_win || work_pending(&vmpr->work))
		return;
	schedule_work(&vmpr->work);
}

/**
 * vmpressure_prio() - Account memory pressure through reclaimer priority level
 * @gfp:	reclaimer's gfp mask
 * @memcg:	cgroup memory controller handle
 * @prio:	reclaimer's priority
 *
 * This function should be called from the reclaim path every time when
 * the vmscan's reclaiming priority (scanning depth) changes.
 *
 * This function does not return any value.
 */
void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio)
{
	/*
	 * We only use prio for accounting critical level. For more info
	 * see comment for vmpressure_level_critical_prio variable above.
	 */
	if (prio > vmpressure_level_critical_prio)
		return;

	/*
	 * OK, the prio is below the threshold, updating vmpressure
	 * information before shrinker dives into long shrinking of long
	 * range vmscan. Passing scanned = vmpressure_win, reclaimed = 0
	 * to the vmpressure() basically means that we signal 'critical'
	 * level.
	 */
	vmpressure(gfp, memcg, vmpressure_win, 0);
}

/**
 * vmpressure_register_event() - Bind vmpressure notifications to an eventfd
 * @cg:		cgroup that is interested in vmpressure notifications
 * @cft:	cgroup control files handle
 * @eventfd:	eventfd context to link notifications with
 * @args:	event arguments (used to set up a pressure level threshold)
 *
 * This function associates eventfd context with the vmpressure
 * infrastructure, so that the notifications will be delivered to the
 * @eventfd. The @args parameter is a string that denotes pressure level
 * threshold (one of vmpressure_str_levels, i.e. "low", "medium", or
 * "critical").
 *
 * This function should not be used directly, just pass it to (struct
 * cftype).register_event, and then cgroup core will handle everything by
 * itself.
 */
int vmpressure_register_event(struct cgroup *cg, struct cftype *cft,
			      struct eventfd_ctx *eventfd, const char *args)
{
	struct vmpressure *vmpr = cg_to_vmpressure(cg);
	struct vmpressure_event *ev;
	int level;

	for (level = 0; level < VMPRESSURE_NUM_LEVELS; level++) {
		if (!strcmp(vmpressure_str_levels[level], args))
			break;
	}

	if (level >= VMPRESSURE_NUM_LEVELS)
		return -EINVAL;

	ev = kzalloc(sizeof(*ev), GFP_KERNEL);
	if (!ev)
		return -ENOMEM;

	ev->efd = eventfd;
	ev->level = level;

	mutex_lock(&vmpr->events_lock);
	list_add(&ev->node, &vmpr->events);
	mutex_unlock(&vmpr->events_lock);

	return 0;
}

/**
 * vmpressure_unregister_event() - Unbind eventfd from vmpressure
 * @cg:		cgroup handle
 * @cft:	cgroup control files handle
 * @eventfd:	eventfd context that was used to link vmpressure with the @cg
 *
 * This function does internal manipulations to detach the @eventfd from
 * the vmpressure notifications, and then frees internal resources
 * associated with the @eventfd (but the @eventfd itself is not freed).
 *
 * This function should not be used directly, just pass it to (struct
 * cftype).unregister_event, and then cgroup core will handle everything
 * by itself.
 */
void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft,
				 struct eventfd_ctx *eventfd)
{
	struct vmpressure *vmpr = cg_to_vmpressure(cg);
	struct vmpressure_event *ev;

	mutex_lock(&vmpr->events_lock);
	list_for_each_entry(ev, &vmpr->events, node) {
		if (ev->efd != eventfd)
			continue;
		list_del(&ev->node);
		kfree(ev);
		break;
	}
	mutex_unlock(&vmpr->events_lock);
}

/**
 * vmpressure_init() - Initialize vmpressure control structure
 * @vmpr:	Structure to be initialized
 *
 * This function should be called on every allocated vmpressure structure
 * before any usage.
 */
void vmpressure_init(struct vmpressure *vmpr)
{
	mutex_init(&vmpr->sr_lock);
	mutex_init(&vmpr->events_lock);
	INIT_LIST_HEAD(&vmpr->events);
	INIT_WORK(&vmpr->work, vmpressure_work_fn);
}


text:
package de.dakror.spamwars.game.weapon;

/**
 * @author Dakror
 */
public class DataPart {
	public Part part;
	public double x, y;

	public DataPart(Part part, double x, double y) {
		this.part = part;
		this.x = x;
		this.y = y;
	}

	@Override
	public String toString() {
		return part.id + ":" + x + ":" + y;
	}

	public static DataPart load(String s) {
		String[] parts = s.split(":");
		return new DataPart(Part.parts.get(Integer.parseInt(parts[0])), Double.parseDouble(parts[1]), Double.parseDouble(parts[2]));
	}
}


text:
using Helios.Net.Connections;
using Helios.Topology;

namespace Helios.Net.Bootstrap
{
    /// <summary>
    /// <see cref="IConnectionFactory"/> for spawning <see cref="UdpConnection"/> instances
    /// </summary>
    public sealed class UdpConnectionFactory : ClientConnectionFactoryBase
    {
        public UdpConnectionFactory(ClientBootstrap clientBootstrap) : base(clientBootstrap)
        {
        }

        protected override IConnection CreateConnection(INode localEndpoint, INode remoteEndpoint)
        {
            return new UdpConnection(EventLoop, localEndpoint, Encoder, Decoder, Allocator);
        }
    }
}


text:
#ifndef PATHNODE_H
#define PATHNODE_H

#include "nodes/relation.h"

/*
 * prototypes for pathnode.c
 */
extern int compare_path_costs(Path *path1, Path *path2,
				   CostSelector criterion);
extern int compare_fractional_path_costs(Path *path1, Path *path2,
							  double fraction);
extern void set_cheapest(RelOptInfo *parent_rel);
extern void add_path(RelOptInfo *parent_rel, Path *new_path);

extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel);
extern IndexPath *create_index_path(PlannerInfo *root,
				  IndexOptInfo *index,
				  List *clause_groups,
				  List *pathkeys,
				  ScanDirection indexscandir,
				  RelOptInfo *outer_rel);
extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root,
						RelOptInfo *rel,
						Path *bitmapqual,
						RelOptInfo *outer_rel);
extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root,
					   RelOptInfo *rel,
					   List *bitmapquals);
extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root,
					  RelOptInfo *rel,
					  List *bitmapquals);
extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel,
					List *tidquals);
extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths);
extern ResultPath *create_result_path(List *quals);
extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath);
extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel,
				   Path *subpath, SpecialJoinInfo *sjinfo);
extern Path *create_subqueryscan_path(RelOptInfo *rel, List *pathkeys);
extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel);
extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel);
extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel);
extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel);

extern NestPath *create_nestloop_path(PlannerInfo *root,
					 RelOptInfo *joinrel,
					 JoinType jointype,
					 SpecialJoinInfo *sjinfo,
					 Path *outer_path,
					 Path *inner_path,
					 List *restrict_clauses,
					 List *pathkeys);

extern MergePath *create_mergejoin_path(PlannerInfo *root,
					  RelOptInfo *joinrel,
					  JoinType jointype,
					  SpecialJoinInfo *sjinfo,
					  Path *outer_path,
					  Path *inner_path,
					  List *restrict_clauses,
					  List *pathkeys,
					  List *mergeclauses,
					  List *outersortkeys,
					  List *innersortkeys);

extern HashPath *create_hashjoin_path(PlannerInfo *root,
					 RelOptInfo *joinrel,
					 JoinType jointype,
					 SpecialJoinInfo *sjinfo,
					 Path *outer_path,
					 Path *inner_path,
					 List *restrict_clauses,
					 List *hashclauses);

/*
 * prototypes for relnode.c
 */
extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
				 RelOptKind reloptkind);
extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
extern RelOptInfo *build_join_rel(PlannerInfo *root,
			   Relids joinrelids,
			   RelOptInfo *outer_rel,
			   RelOptInfo *inner_rel,
			   SpecialJoinInfo *sjinfo,
			   List **restrictlist_ptr);

#endif   /* PATHNODE_H */


text:
<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "SqlTrace_Long".
 *
 * @property string $begindate
 * @property string $enddate
 * @property string $executedate
 * @property string $adddate
 * @property string $sqltext
 * @property double $sqlusedtime
 * @property string $Id
 * @property string $databasetype
 * @property string $ip
 */
class SqlTraceLong extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'SqlTrace_Long';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['executedate'], 'required'],
            [['executedate', 'adddate'], 'safe'],
            [['sqlusedtime'], 'number'],
            [['begindate', 'enddate'], 'string', 'max' => 50],
            [['sqltext'], 'string', 'max' => 5000],
            [['databasetype'], 'string', 'max' => 20],
            [['ip'], 'string', 'max' => 64]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'begindate' => 'Begindate',
            'enddate' => 'Enddate',
            'executedate' => 'Executedate',
            'adddate' => 'Adddate',
            'sqltext' => 'Sqltext',
            'sqlusedtime' => 'Sqlusedtime',
            'Id' => 'ID',
            'databasetype' => 'Databasetype',
            'ip' => '应用服务器IP',
        ];
    }
}


text:
class CreateMyAdminLocales < ActiveRecord::Migration
  def change
    create_table :my_admin_locales do |t|
      t.string :name, limit: 128
      t.string :acronym, limit: 128
      t.timestamps
    end
    add_index :my_admin_locales, :name, :unique => true
    add_index :my_admin_locales, :acronym, :unique => true
  end
end


text:
namespace SitefinityWebApp.ResourcePackages.Bootstrap.MVC.Views.Image
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Mvc;
    using System.Web.Mvc.Ajax;
    using System.Web.Mvc.Html;
    using System.Web.Routing;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.WebPages;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/MVC/Views/Image/Image.cshtml")]
    public partial class Image : System.Web.Mvc.WebViewPage<Telerik.Sitefinity.Frontend.Media.Mvc.Models.Image.ImageViewModel>
    {
        public Image()
        {
        }
        public override void Execute()
        {

            #line 3 "..\..MVC\Views\Image\Image.cshtml"
 if (string.IsNullOrEmpty(Model.LinkedContentUrl))
{

            #line default
            #line hidden
WriteLiteral("    <img");

WriteAttribute("class", Tuple.Create(" class=\"", 139), Tuple.Create("\"", 162)

            #line 5 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 147), Tuple.Create<System.Object, System.Int32>(Model.CssClass

            #line default
            #line hidden
, 147), false)
);

WriteAttribute("src", Tuple.Create(" src=\"", 163), Tuple.Create("\"", 191)

            #line 5 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 169), Tuple.Create<System.Object, System.Int32>(Model.SelectedSizeUrl

            #line default
            #line hidden
, 169), false)
);

WriteAttribute("title", Tuple.Create(" title=\"", 192), Tuple.Create("\"", 212)

            #line 5 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 200), Tuple.Create<System.Object, System.Int32>(Model.Title

            #line default
            #line hidden
, 200), false)
);

WriteAttribute("alt", Tuple.Create(" alt=\"", 213), Tuple.Create("\"", 241)

            #line 5 "..\..MVC\Views\Image\Image.cshtml"
         , Tuple.Create(Tuple.Create("", 219), Tuple.Create<System.Object, System.Int32>(Model.AlternativeText

            #line default
            #line hidden
, 219), false)
);

WriteLiteral(" />\r\n");

            #line 6 "..\..MVC\Views\Image\Image.cshtml"
}
else
{

            #line default
            #line hidden
WriteLiteral("    <a");

WriteAttribute("href", Tuple.Create(" href=\"", 265), Tuple.Create("\"", 295)

            #line 9 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 272), Tuple.Create<System.Object, System.Int32>(Model.LinkedContentUrl

            #line default
            #line hidden
, 272), false)
);

WriteLiteral(">\r\n        <img");

WriteAttribute("class", Tuple.Create(" class=\"", 311), Tuple.Create("\"", 334)

            #line 10 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 319), Tuple.Create<System.Object, System.Int32>(Model.CssClass

            #line default
            #line hidden
, 319), false)
);

WriteAttribute("src", Tuple.Create(" src=\"", 335), Tuple.Create("\"", 363)

            #line 10 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 341), Tuple.Create<System.Object, System.Int32>(Model.SelectedSizeUrl

            #line default
            #line hidden
, 341), false)
);

WriteAttribute("title", Tuple.Create(" title=\"", 364), Tuple.Create("\"", 384)

            #line 10 "..\..MVC\Views\Image\Image.cshtml"
, Tuple.Create(Tuple.Create("", 372), Tuple.Create<System.Object, System.Int32>(Model.Title

            #line default
            #line hidden
, 372), false)
);

WriteAttribute("alt", Tuple.Create(" alt=\"", 385), Tuple.Create("\"", 413)

            #line 10 "..\..MVC\Views\Image\Image.cshtml"
             , Tuple.Create(Tuple.Create("", 391), Tuple.Create<System.Object, System.Int32>(Model.AlternativeText

            #line default
            #line hidden
, 391), false)
);

WriteLiteral(" />\r\n    </a>\r\n");

            #line 12 "..\..MVC\Views\Image\Image.cshtml"
}

            #line default
            #line hidden
        }
    }
}
#pragma warning restore 1591


text:
def deserialize_form(data):
    """
    Create a new QueryDict from a serialized form.
    """
    from django.http import QueryDict
    data = QueryDict(query_string=unicode(data).encode('utf-8'))
    return data

def simple_import_module(name):
    """
    Reduced version of import_module
    """
    import sys
    __import__(name)
    return sys.modules[name]


text:
package common.utils;

import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.BlobId;
import com.google.cloud.storage.BlobInfo;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import runner.config.ServiceAccountSpecification;

public class StorageUtils {
  private static final Logger logger = LoggerFactory.getLogger(StorageUtils.class);

  private StorageUtils() {}

  /**
   * Build a Google Storage client object with credentials for the given service account. The client
   * object is newly created on each call to this method; it is not cached.
   */
  public static Storage getClientForServiceAccount(ServiceAccountSpecification serviceAccount)
      throws Exception {
    logger.debug(
        "Fetching credentials and building Storage client object for service account: {}",
        serviceAccount.name);

    GoogleCredentials serviceAccountCredentials =
        AuthenticationUtils.getServiceAccountCredential(serviceAccount);
    StorageOptions storageOptions =
        StorageOptions.newBuilder().setCredentials(serviceAccountCredentials).build();
    Storage storageClient = storageOptions.getService();

    return storageClient;
  }

  /**
   * Write the contents of a byte array to a file in the given GCS bucket.
   *
   * @param byteArray the bytes to write
   * @param fileName the name of the file
   * @param bucketName the bucket to write to
   * @return the created BlobId
   */
  public static BlobId writeBytesToFile(
      Storage storageClient, String bucketName, String fileName, byte[] byteArray) {
    BlobInfo blobToCreate = BlobInfo.newBuilder(bucketName, fileName).build();
    Blob createdBlob = storageClient.create(blobToCreate, byteArray);

    return createdBlob.getBlobId();
  }

  /** Convert a given BlobId to a gs:// path. Does not check for existence. */
  public static String blobIdToGSPath(BlobId blobId) {
    return String.format("gs://%s/%s", blobId.getBucket(), blobId.getName());
  }

  /** Delete all files in the given list. */
  public static void deleteFiles(Storage storageClient, List<BlobId> files) {
    for (BlobId file : files) {
      Blob blob = storageClient.get(file);
      if (blob == null) {
        logger.debug(
            "Blob not found: bucket = {}, file name = {}", file.getBucket(), file.getName());
      } else {
        logger.debug(
            "Deleting blob: bucket = {}, file name = {}", file.getBucket(), file.getName());
        blob.delete();
      }
    }
  }
}


text:
package org.pathvisio.cytoscape.superpathways;

import org.pathvisio.desktop.util.PropertyColumn;

public enum ResultProperty implements PropertyColumn {
		NAME("Name"),
		ORGANISM("Organism"),
		SCORE("Score"),
		URL("Url"),
		ID("Id");

		String title;

		private ResultProperty(String title) {
			this.title = title;
		}

		public String getTitle() {
			return title;
		}
	}


text:
static void close_cb(uv_handle_t *handle);
static void exit_cb(uv_process_t *handle, int64_t status, int term_signal);

bool uv_process_spawn(UvProcess *uvproc)
{
  log_msg("UV_PROCESS", "spawn");
  Process *proc = (Process *)uvproc;
  uvproc->uvopts.file = proc->argv[0];
  uvproc->uvopts.args = proc->argv;
  uvproc->uvopts.flags = UV_PROCESS_DETACHED;
  uvproc->uvopts.exit_cb = exit_cb;
  uvproc->uvopts.cwd = proc->cwd;
  uvproc->uvopts.env = NULL;
  uvproc->uvopts.stdio = uvproc->uvstdio;
  uvproc->uvopts.stdio_count = 3;
  uvproc->uvstdio[0].flags = UV_IGNORE;
  uvproc->uvstdio[1].flags = UV_IGNORE;
  uvproc->uvstdio[2].flags = UV_IGNORE;
  uvproc->uv.data = proc;

  if (proc->in) {
    uvproc->uvstdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE;
    uvproc->uvstdio[0].data.stream = (uv_stream_t *)&proc->in->uv.pipe;
  }

  if (proc->out) {
    uvproc->uvstdio[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE;
    uvproc->uvstdio[1].data.stream = (uv_stream_t *)&proc->out->uv.pipe;
  }

  if (proc->err) {
    uvproc->uvstdio[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE;
    uvproc->uvstdio[2].data.stream = (uv_stream_t *)&proc->err->uv.pipe;
  }

  int status;
  if ((status = uv_spawn(&proc->loop->uv, &uvproc->uv, &uvproc->uvopts))) {
    log_msg("UV_PROCESS", "uv_spawn failed: %s", uv_strerror(status));
    return false;
  }

  proc->pid = uvproc->uv.pid;
  return true;
}

void uv_process_close(UvProcess *uvproc)
{
  log_msg("UV_PROCESS", "uv_process_close");
  uv_close((uv_handle_t *)&uvproc->uv, close_cb);
}

static void close_cb(uv_handle_t *handle)
{
  log_msg("UV_PROCESS", "close_cb");
  Process *proc = handle->data;
  if (proc->internal_close_cb) {
    proc->internal_close_cb(proc);
  }
}

static void exit_cb(uv_process_t *handle, int64_t status, int term_signal)
{
  log_msg("UV_PROCESS", "exit_cb");
  Process *proc = handle->data;
  proc->status = (int)status;
  if (proc->fast_output)
    proc->fast_output(proc, status, proc->data);
  proc->internal_exit_cb(proc);
}


text:
package com.pinhuba.core.dao;

import com.pinhuba.core.pojo.*;
/**
 * 表:OA_NETMAIL_UID 对应dao
 */
public interface IOaNetmailUidDao extends BaseDao<OaNetmailUid,Long>{

}


text:
/*
Package hilbert implements a Hilbert R-tree based on PALM principles
to improve multithreaded performance.  This package is not quite complete
and some optimization and delete codes remain to be completed.

This serves as a potential replacement for the interval tree and
rangetree.

Benchmarks:
BenchmarkBulkAddPoints-8	     500	   2589270 ns/op
BenchmarkBulkUpdatePoints-8	    2000	   1212641 ns/op
BenchmarkPointInsertion-8	  200000	      9135 ns/op
BenchmarkQueryPoints-8	  	  500000	      3122 ns/op

*/
package hilbert

import (
	"runtime"
	"sync"
	"sync/atomic"

	"github.com/Workiva/go-datastructures/queue"
	"github.com/Workiva/go-datastructures/rtree"
)

type operation int

const (
	get operation = iota
	add
	remove
)

const multiThreadAt = 1000 // number of keys before we multithread lookups

type keyBundle struct {
	key         hilbert
	left, right rtree.Rectangle
}

type tree struct {
	root            *node
	_               [8]uint64
	number          uint64
	_               [8]uint64
	ary, bufferSize uint64
	actions         *queue.RingBuffer
	cache           []interface{}
	_               [8]uint64
	disposed        uint64
	_               [8]uint64
	running         uint64
}

func (tree *tree) checkAndRun(action action) {
	if tree.actions.Len() > 0 {
		if action != nil {
			tree.actions.Put(action)
		}
		if atomic.CompareAndSwapUint64(&tree.running, 0, 1) {
			var a interface{}
			var err error
			for tree.actions.Len() > 0 {
				a, err = tree.actions.Get()
				if err != nil {
					return
				}
				tree.cache = append(tree.cache, a)
				if uint64(len(tree.cache)) >= tree.bufferSize {
					break
				}
			}

			go tree.operationRunner(tree.cache, true)
		}
	} else if action != nil {
		if atomic.CompareAndSwapUint64(&tree.running, 0, 1) {
			switch action.operation() {
			case get:
				ga := action.(*getAction)
				result := tree.search(ga.lookup)
				ga.result = result
				action.complete()
				tree.reset()
			case add, remove:
				if len(action.keys()) > multiThreadAt {
					tree.operationRunner(interfaces{action}, true)
				} else {
					tree.operationRunner(interfaces{action}, false)
				}
			}
		} else {
			tree.actions.Put(action)
			tree.checkAndRun(nil)
		}
	}
}

func (tree *tree) init(bufferSize, ary uint64) {
	tree.bufferSize = bufferSize
	tree.ary = ary
	tree.cache = make([]interface{}, 0, bufferSize)
	tree.root = newNode(true, newKeys(ary), newNodes(ary))
	tree.root.mbr = &rectangle{}
	tree.actions = queue.NewRingBuffer(tree.bufferSize)
}

func (tree *tree) operationRunner(xns interfaces, threaded bool) {
	writeOperations, deleteOperations, toComplete := tree.fetchKeys(xns, threaded)
	tree.recursiveMutate(writeOperations, deleteOperations, false, threaded)
	for _, a := range toComplete {
		a.complete()
	}

	tree.reset()
}

func (tree *tree) fetchKeys(xns interfaces, inParallel bool) (map[*node][]*keyBundle, map[*node][]*keyBundle, actions) {
	if inParallel {
		tree.fetchKeysInParallel(xns)
	} else {
		tree.fetchKeysInSerial(xns)
	}

	writeOperations := make(map[*node][]*keyBundle)
	deleteOperations := make(map[*node][]*keyBundle)
	toComplete := make(actions, 0, len(xns)/2)
	for _, ifc := range xns {
		action := ifc.(action)
		switch action.operation() {
		case add:
			for i, n := range action.nodes() {
				writeOperations[n] = append(writeOperations[n], &keyBundle{key: action.rects()[i].hilbert, left: action.rects()[i].rect})
			}
			toComplete = append(toComplete, action)
		case remove:
			for i, n := range action.nodes() {
				deleteOperations[n] = append(deleteOperations[n], &keyBundle{key: action.rects()[i].hilbert, left: action.rects()[i].rect})
			}
			toComplete = append(toComplete, action)
		case get:
			action.complete()
		}
	}

	return writeOperations, deleteOperations, toComplete
}

func (tree *tree) fetchKeysInSerial(xns interfaces) {
	for _, ifc := range xns {
		action := ifc.(action)
		switch action.operation() {
		case add, remove:
			for i, key := range action.rects() {
				n := getParent(tree.root, key.hilbert, key.rect)
				action.addNode(int64(i), n)
			}
		case get:
			ga := action.(*getAction)
			rects := tree.search(ga.lookup)
			ga.result = rects
		}
	}
}

func (tree *tree) reset() {
	for i := range tree.cache {
		tree.cache[i] = nil
	}

	tree.cache = tree.cache[:0]
	atomic.StoreUint64(&tree.running, 0)
	tree.checkAndRun(nil)
}

func (tree *tree) fetchKeysInParallel(xns []interface{}) {
	var forCache struct {
		i      int64
		buffer [8]uint64 // different cache lines
		js     []int64
	}

	for j := 0; j < len(xns); j++ {
		forCache.js = append(forCache.js, -1)
	}
	numCPU := runtime.NumCPU()
	if numCPU > 1 {
		numCPU--
	}
	var wg sync.WaitGroup
	wg.Add(numCPU)

	for k := 0; k < numCPU; k++ {
		go func() {
			for {
				index := atomic.LoadInt64(&forCache.i)
				if index >= int64(len(xns)) {
					break
				}
				action := xns[index].(action)

				j := atomic.AddInt64(&forCache.js[index], 1)
				if j > int64(len(action.rects())) { // someone else is updating i
					continue
				} else if j == int64(len(action.rects())) {
					atomic.StoreInt64(&forCache.i, index+1)
					continue
				}

				switch action.operation() {
				case add, remove:
					hb := action.rects()[j]
					n := getParent(tree.root, hb.hilbert, hb.rect)
					action.addNode(j, n)
				case get:
					ga := action.(*getAction)
					result := tree.search(ga.lookup)
					ga.result = result
				}
			}
			wg.Done()
		}()
	}
	wg.Wait()
}

func (tree *tree) splitNode(n, parent *node, nodes *[]*node, keys *hilberts) {
	if !n.needsSplit(tree.ary) {
		return
	}

	length := n.keys.len()
	splitAt := tree.ary - 1

	for i := splitAt; i < length; i += splitAt {
		offset := length - i
		k, left, right := n.split(offset, tree.ary)
		left.right = right
		*keys = append(*keys, k)
		*nodes = append(*nodes, left, right)
		left.parent = parent
		right.parent = parent
	}
}

func (tree *tree) applyNode(n *node, adds, deletes []*keyBundle) {
	for _, kb := range deletes {
		if n.keys.len() == 0 {
			break
		}

		deleted := n.delete(kb)
		if deleted != nil {
			atomic.AddUint64(&tree.number, ^uint64(0))
		}
	}

	for _, kb := range adds {
		old := n.insert(kb)
		if n.isLeaf && old == nil {
			atomic.AddUint64(&tree.number, 1)
		}
	}
}

func (tree *tree) recursiveMutate(adds, deletes map[*node][]*keyBundle, setRoot, inParallel bool) {
	if len(adds) == 0 && len(deletes) == 0 {
		return
	}

	if setRoot && len(adds) > 1 {
		panic(`SHOULD ONLY HAVE ONE ROOT`)
	}

	ifs := make(interfaces, 0, len(adds))
	for n := range adds {
		if n.parent == nil {
			setRoot = true
		}
		ifs = append(ifs, n)
	}

	for n := range deletes {
		if n.parent == nil {
			setRoot = true
		}

		if _, ok := adds[n]; !ok {
			ifs = append(ifs, n)
		}
	}

	var dummyRoot *node
	if setRoot {
		dummyRoot = &node{
			keys:  newKeys(tree.ary),
			nodes: newNodes(tree.ary),
			mbr:   &rectangle{},
		}
	}

	var write sync.Mutex
	nextLayerWrite := make(map[*node][]*keyBundle)
	nextLayerDelete := make(map[*node][]*keyBundle)

	var mutate func(interfaces, func(interface{}))
	if inParallel {
		mutate = executeInterfacesInParallel
	} else {
		mutate = executeInterfacesInSerial
	}

	mutate(ifs, func(ifc interface{}) {
		n := ifc.(*node)
		adds := adds[n]
		deletes := deletes[n]

		if len(adds) == 0 && len(deletes) == 0 {
			return
		}

		if setRoot {
			tree.root = n
		}

		parent := n.parent
		if parent == nil {
			parent = dummyRoot
			setRoot = true
		}

		tree.applyNode(n, adds, deletes)

		if n.needsSplit(tree.ary) {
			keys := make(hilberts, 0, n.keys.len())
			nodes := make([]*node, 0, n.nodes.len())
			tree.splitNode(n, parent, &nodes, &keys)
			write.Lock()
			for i, k := range keys {
				nextLayerWrite[parent] = append(nextLayerWrite[parent], &keyBundle{key: k, left: nodes[i*2], right: nodes[i*2+1]})
			}
			write.Unlock()
		}
	})

	tree.recursiveMutate(nextLayerWrite, nextLayerDelete, setRoot, inParallel)
}

// Insert will add the provided keys to the tree.
func (tree *tree) Insert(rects ...rtree.Rectangle) {
	ia := newInsertAction(rects)
	tree.checkAndRun(ia)
	ia.completer.Wait()
}

// Delete will remove the provided keys from the tree.  If no
// matching key is found, this is a no-op.
func (tree *tree) Delete(rects ...rtree.Rectangle) {
	ra := newRemoveAction(rects)
	tree.checkAndRun(ra)
	ra.completer.Wait()
}

func (tree *tree) search(r *rectangle) rtree.Rectangles {
	if tree.root == nil {
		return rtree.Rectangles{}
	}

	result := make(rtree.Rectangles, 0, 10)
	whs := tree.root.searchRects(r)
	for len(whs) > 0 {
		wh := whs[0]
		if n, ok := wh.(*node); ok {
			whs = append(whs, n.searchRects(r)...)
		} else {
			result = append(result, wh)
		}
		whs = whs[1:]
	}

	return result
}

// Search will return a list of rectangles that intersect the provided
// rectangle.
func (tree *tree) Search(rect rtree.Rectangle) rtree.Rectangles {
	ga := newGetAction(rect)
	tree.checkAndRun(ga)
	ga.completer.Wait()
	return ga.result
}

// Len returns the number of items in the tree.
func (tree *tree) Len() uint64 {
	return atomic.LoadUint64(&tree.number)
}

// Dispose will clean up any resources used by this tree.  This
// must be called to prevent a memory leak.
func (tree *tree) Dispose() {
	tree.actions.Dispose()
	atomic.StoreUint64(&tree.disposed, 1)
}

func newTree(bufferSize, ary uint64) *tree {
	tree := &tree{}
	tree.init(bufferSize, ary)
	return tree
}

// New will construct a new Hilbert R-Tree and return it.
func New(bufferSize, ary uint64) rtree.RTree {
	return newTree(bufferSize, ary)
}


text:
form = module(xstyle/ext/form);
field = form/field;

form-field = {
	=>
		label (content/label)
		input (content)
		span.error (content/errors);
}

model = module(xstyle/test/form-data);

body {
	=>
		h1 (model/firstName)
		form (model)
			field (model/firstName)
				label 'First Name'
				input[name=firstName][type=text]
			form-field (model/lastName)
			form-field (model/age);
}


text:
module XCApp
  module Helper
    module GitHelper
      def self.get_current_user_email
        current_dir_user_email = `git config user.email`
        return current_dir_user_email if current_dir_user_email

        `git config --global user.email`
      end
    end
  end
end


text:
package io.spine.server.entity;

import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import io.spine.base.EventMessage;
import io.spine.core.Event;

import java.util.Collection;
import java.util.Optional;

/**
 * An {@link EventFilter} which allows any event to be posted unchanged.
 */
enum NoOpEventFilter implements EventFilter {

    INSTANCE;

    @Override
    public Optional<? extends EventMessage> filter(EventMessage event) {
        return Optional.of(event);
    }

    /**
     * {@inheritDoc}.
     *
     * @implSpec Overridden for performance reasons. The behavior of the parent method is unchanged.
     */
    @Override
    public ImmutableCollection<Event> filter(Collection<Event> events) {
        return ImmutableList.copyOf(events);
    }
}


text:
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:exslt="http://exslt.org/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd" version="3.3" ID="P0b002ee1812b888a">
<name type="corporate">
 <namePart>United States Government Printing Office</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">printer</roleTerm>
  <roleTerm type="code" authority="marcrelator">prt</roleTerm>
</role>
 <role>
  <roleTerm type="text" authority="marcrelator">distributor</roleTerm>
  <roleTerm type="code" authority="marcrelator">dst</roleTerm>
</role>
</name>
<name type="corporate">
 <namePart>United States</namePart>
 <namePart>United States District Court Middle District of Georgia</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">author</roleTerm>
  <roleTerm type="code" authority="marcrelator">aut</roleTerm>
</role>
 <description>Government Organization</description>
</name>
<typeOfResource>text</typeOfResource>
<genre authority="marcgt">government publication</genre>
<language>
 <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</language>
<extension>
 <collectionCode>USCOURTS</collectionCode>
 <category>Judicial Publications</category>
 <branch>judicial</branch>
 <dateIngested>2011-12-19</dateIngested>
</extension>
<originInfo>
 <publisher>Administrative Office of the United States Courts</publisher>
 <dateIssued encoding="w3cdtf">2008-01-28</dateIssued>
 <issuance>monographic</issuance>
</originInfo>
<physicalDescription>
 <note type="source content type">deposited</note>
 <digitalOrigin>born digital</digitalOrigin>
</physicalDescription>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="uri">http://www.gpo.gov/fdsys/pkg/USCOURTS-gamd-3_07-cv-00033</identifier>
<identifier type="local">P0b002ee1812b888a</identifier>
<recordInfo>
 <recordContentSource authority="marcorg">DGPO</recordContentSource>
 <recordCreationDate encoding="w3cdtf">2011-12-19</recordCreationDate>
 <recordChangeDate encoding="w3cdtf">2011-12-19</recordChangeDate>
 <recordIdentifier source="DGPO">USCOURTS-gamd-3_07-cv-00033</recordIdentifier>
 <recordOrigin>machine generated</recordOrigin>
 <languageOfCataloging>
  <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</languageOfCataloging>
</recordInfo>
<accessCondition type="GPO scope determination">fdlp</accessCondition>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-gamd-3_07-cv-00033</accessId>
 <courtType>District</courtType>
 <courtCode>gamd</courtCode>
 <courtCircuit>11th</courtCircuit>
 <courtState>Georgia</courtState>
 <courtSortOrder>2125</courtSortOrder>
 <caseNumber>3:07-cv-00033</caseNumber>
 <caseOffice>Athens</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>530</natureSuitCode>
 <natureSuit>Prisoner Petitions - Habeas Corpus</natureSuit>
 <cause>28:2254 Petition for Writ of Habeas Corpus (State)</cause>
 <party firstName="Tony" fullName="Tony Henderson" lastName="Henderson" role="Respondent"></party>
 <party firstName="Darrell" fullName="Darrell Lester" lastName="Lester" role="Petitioner"></party>
</extension>
<titleInfo>
 <title>Lester v. Henderson</title>
 <partNumber>3:07-cv-00033</partNumber>
</titleInfo>
<location>
 <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/pkg/USCOURTS-gamd-3_07-cv-00033/content-detail.html</url>
</location>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="preferred citation">3:07-cv-00033;07-033</identifier>
<name type="corporate">
 <namePart>United States District Court Middle District of Georgia</namePart>
 <namePart>11th Circuit</namePart>
 <namePart>Athens</namePart>
 <affiliation>U.S. Courts</affiliation>
 <role>
  <roleTerm authority="marcrelator" type="text">author</roleTerm>
  <roleTerm authority="marcrelator" type="code">aut</roleTerm>
</role>
</name>
<name type="personal">
 <displayForm>Tony Henderson</displayForm>
 <namePart type="family">Henderson</namePart>
 <namePart type="given">Tony</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Respondent</description>
</name>
<name type="personal">
 <displayForm>Darrell Lester</displayForm>
 <namePart type="family">Lester</namePart>
 <namePart type="given">Darrell</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Petitioner</description>
</name>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-gamd-3_07-cv-00033</accessId>
 <courtType>District</courtType>
 <courtCode>gamd</courtCode>
 <courtCircuit>11th</courtCircuit>
 <courtState>Georgia</courtState>
 <courtSortOrder>2125</courtSortOrder>
 <caseNumber>3:07-cv-00033</caseNumber>
 <caseOffice>Athens</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>530</natureSuitCode>
 <natureSuit>Prisoner Petitions - Habeas Corpus</natureSuit>
 <cause>28:2254 Petition for Writ of Habeas Corpus (State)</cause>
 <party firstName="Tony" fullName="Tony Henderson" lastName="Henderson" role="Respondent"></party>
 <party firstName="Darrell" fullName="Darrell Lester" lastName="Lester" role="Petitioner"></party>
 <state>Georgia</state>
</extension>
<relatedItem type="constituent" ID="id-USCOURTS-gamd-3_07-cv-00033-0" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-0/mods.xml">
 <titleInfo>
  <title>Lester v. Henderson</title>
  <subTitle>ORDER denying 12 Motion for Reconsideration and denying 19 Motion to Appoint Counsel. Ordered by Judge Claude W. Hicks Jr. on 7/23/07. (CWH)</subTitle>
  <partNumber>0</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2007-07-23</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-gamd-3_07-cv-00033-0.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee1812caed3</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-0</identifier>
 <identifier type="former granule identifier">gamd-3_07-cv-00033_0.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-0/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-gamd-3_07-cv-00033/pdf/USCOURTS-gamd-3_07-cv-00033-0.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 3:07-cv-00033; Lester v. Henderson; </searchTitle>
  <courtName>United States District Court Middle District of Georgia</courtName>
  <state>Georgia</state>
  <accessId>USCOURTS-gamd-3_07-cv-00033-0</accessId>
  <sequenceNumber>0</sequenceNumber>
  <dateIssued>2007-07-23</dateIssued>
  <docketText>ORDER denying 12 Motion for Reconsideration and denying 19 Motion to Appoint Counsel. Ordered by Judge Claude W. Hicks Jr. on 7/23/07. (CWH)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-gamd-3_07-cv-00033-1" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-1/mods.xml">
 <titleInfo>
  <title>Lester v. Henderson</title>
  <subTitle>RECOMMENDATION to grant 14 MOTION to Dismiss Petition as Untimely filed by Tony Henderson. Objections to R&R due by 1/3/2008. Ordered by Judge Claude W. Hicks Jr. on 12/11/07. (CWH)</subTitle>
  <partNumber>1</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2007-12-11</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-gamd-3_07-cv-00033-1.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee1812caf4e</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-1</identifier>
 <identifier type="former granule identifier">gamd-3_07-cv-00033_1.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-1/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-gamd-3_07-cv-00033/pdf/USCOURTS-gamd-3_07-cv-00033-1.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 3:07-cv-00033; Lester v. Henderson; </searchTitle>
  <courtName>United States District Court Middle District of Georgia</courtName>
  <state>Georgia</state>
  <accessId>USCOURTS-gamd-3_07-cv-00033-1</accessId>
  <sequenceNumber>1</sequenceNumber>
  <dateIssued>2007-12-11</dateIssued>
  <docketText>RECOMMENDATION to grant 14 MOTION to Dismiss Petition as Untimely filed by Tony Henderson. Objections to R&R due by 1/3/2008. Ordered by Judge Claude W. Hicks Jr. on 12/11/07. (CWH)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-gamd-3_07-cv-00033-2" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-2/mods.xml">
 <titleInfo>
  <title>Lester v. Henderson</title>
  <subTitle>ORDER granting 14 Motion to Dismiss; adopting Report and Recommendations re 22 Report and Recommendations. Signed by Judge Clay D. Land on 1/28/2008. (ggs)</subTitle>
  <partNumber>2</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2008-01-28</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-gamd-3_07-cv-00033-2.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee1812caed4</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-2</identifier>
 <identifier type="former granule identifier">gamd-3_07-cv-00033_2.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-gamd-3_07-cv-00033/USCOURTS-gamd-3_07-cv-00033-2/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-gamd-3_07-cv-00033/pdf/USCOURTS-gamd-3_07-cv-00033-2.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 3:07-cv-00033; Lester v. Henderson; </searchTitle>
  <courtName>United States District Court Middle District of Georgia</courtName>
  <state>Georgia</state>
  <accessId>USCOURTS-gamd-3_07-cv-00033-2</accessId>
  <sequenceNumber>2</sequenceNumber>
  <dateIssued>2008-01-28</dateIssued>
  <docketText>ORDER granting 14 Motion to Dismiss; adopting Report and Recommendations re 22 Report and Recommendations. Signed by Judge Clay D. Land on 1/28/2008. (ggs)</docketText>
</extension>
</relatedItem>
</mods>


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Button - Size</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
  <link href="../../../../../scripts/testing/styles.css" rel="stylesheet">

  <ion-app>

    <ion-header>
      <ion-toolbar>
        <ion-title>Button - Size</ion-title>
      </ion-toolbar>
    </ion-header>

    <ion-content class="ion-padding" id="content" no-bounce>

        <ion-button>Default</ion-button>
        <ion-button href="#">Default</ion-button>

        <ion-button size="small">Small</ion-button>
        <ion-button size="small" href="#">Small</ion-button>

        <ion-button size="small" fill="outline">Small</ion-button>
        <ion-button size="small" fill="outline" href="#">Small</ion-button>

        <ion-button size="small" fill="clear">Small</ion-button>
        <ion-button size="small" fill="clear" href="#">Small</ion-button>

        <ion-button size="large">Large</ion-button>
        <ion-button size="large" href="#">
          H
          E
          L
          L
          O
        </ion-button>

        <ion-button size="large" fill="outline">Large</ion-button>
        <ion-button size="large" fill="outline" href="#">Large</ion-button>

        <ion-button size="large" fill="clear">Large</ion-button>
        <ion-button size="large" fill="clear" href="#">Large</ion-button>

    </ion-content>

  </ion-app>


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
    <title>Coverage for graph_exceptions.py: 82%</title>
    <link rel="stylesheet" href="style.css" type="text/css">

Coverage for graph_exceptions.py :
            82%

            11 statements
            9 run
            2 missing
            0 excluded

Hot-keys on this page

        r
        m
        x
        p   toggle line displays

        j
        k   next/prev highlighted chunk

        0   (zero) top of page

        1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

#!/usr/bin/env python

"""

Implementation of graphs exceptions.

These classes (DigraphError and NotDigraphError) will be useful to raise exceptions when the graph structure don't support a given operation. For example, this can happen when you try to call "degree" method for a non-directed graph.

Check out the documentation for each method implemented in 'graph.py', it will show you whether an exception is raised or not.

"""

class DigraphError(Exception):

        def __init__(self, value):

                self.value = value

        def __str__(self):

                return repr(self.value)

class NotDigraphError(Exception):

        def __init__(self, value):

                self.value = value

        def __str__(self):

                return repr(self.value)

            « index     coverage.py v4.0.1,
            created at 2015-11-08 22:39


text: Notes and Programs from [CPP4C Coursera Course](https://www.coursera.org/course/cplusplus4c)