text:
import requests
import unittest
import time
import json
import sys
import shutil
import getpass
from zrest.server import App
from zrest.datamodels.shelvemodels import ShelveModel, ShelveForeign
from urllib import request

def set_proxies(cls, done=list()): #This is going to be moved, it's useful
    if len(done) == 0:
        cls.proxies = request.getproxies()
        if len(cls.proxies) > 0:
            answer = input("Is it a authentyfied proxy? (Y/n) ")
            if not "n" in answer.lower():
                pwd = input("Type your password in: ")
                usr = getpass.getuser()
                final_proxies = dict()
                for item in cls.proxies:
                    final_string = cls.proxies[item]  # Dangerous
                    final_string = "{}://{}".format(item, final_string.replace("{}://".format(item),
                                                                               "{}:{}@".format(usr, pwd)))
                    final_proxies[item] = final_string
                cls.proxies = final_proxies
        done.append(1)

#TODO: Implement HAL HATEOAS http://stateless.co/hal_specification.html

class App_Test_0(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.app = App()
        cls.path = "extrafiles/app_test/model1"
        cls.app.set_model(ShelveModel(cls.path,
                                      2,
                                      index_fields=["a", "b", "c"],
                                      headers=["a", "b", "c"]),
                          "model1",
                          "^/model1/<_id>$",)
        cls.app.run_thread("127.0.0.1", 9000)

    @classmethod
    def tearDownClass(cls):
        cls.app.shutdown()
        time.sleep(0.5)
        shutil.rmtree(cls.path)

    def setUp(self):
        self.data1 = {"a": 1, "b": 2, "c": 3}
        self.data1_id = self.data1.copy()
        self.data1_id.update({"_id": 1,
                              "_links": {"self": {"href": "/model1/0"}}})
        self.datas = [dict(zip(("a", "b", "c"), data)) for data in [[4, 5, 6],
                                                                    [7, 8, 9],
                                                                    [10, 11, 12],
                                                                    [13, 14, 15]]]
        self.datas_id = self.datas.copy()
        [data.update({"_id": item+1,
                      "_links": {"self": {"href": "/model1/{}".format(item+1)}}})
                      for item, data in enumerate(self.datas_id)]
        self.gets1 = ["0", "?a=1", "?b=2", "?c=3",
                      "?a=1&b=2", "?b=2&c=3",
                      "?a=1&b=2&c=3"]
        self.data2id = {"a":4, "b":5, "c":9, "_id":1, "_links": {"self": {"href": "/model1/1"}}}
        self.data3 = {"a":16, "b":17, "c":18}
        self.data3id = self.data3.copy()
        self.data3id.update({"_id": 5,
                             "_links": {"self": {"href": "/model1/4"}}})

    def test_0_post(self):
        req = requests.post("http://localhost:9000/model1",
                            json = self.data1)
        self.assertEqual(req.status_code, 201)
        self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
        self.assertEqual(req.headers["Location"], "/model1/1")
        self.assertEqual(json.loads(req.text), self.data1_id)
        datas_id = self.datas.copy()
        for index, data in enumerate(self.datas):
            req = requests.post("http://localhost:9000/model1",
                                json=data)
            self.assertEqual(req.status_code, 201)
            self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
            self.assertEqual(req.headers["Location"], "/model1/{}".format(index+1))
            datas_id[index].update({"_id": json.loads(req.text)["_id"]})
            self.assertEqual(json.loads(req.text), datas_id[index+1])

    def test_1_get(self):
        for query in self.gets1:
            req = requests.get("http://localhost:9000/model1/{}".format(query))
            self.assertEqual(req.status_code, 200)
            self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
            self.assertEqual(json.loads(req.text), self.data1_id)
        req = requests.get("http://localhost:9000/model1")
        self.assertEqual(req.status_code, 200)
        self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
        print("JSON: {}".format(req.text))
        self.assertEqual(len(json.loads(req.text)["_embedded"]["model1"]), 5)

    def test_2_delete(self):
        req = requests.delete("http://localhost:9000/model1/0")
        self.assertEqual(req.status_code, 200)
        self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")

    def test_3_patch(self):
        req = requests.patch("http://localhost:9000/model1?a=4", json={"c": 9})
        self.assertEqual(req.status_code, 200)
        self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
        print("JSON: {}".format(req.text))
        self.assertEqual(json.loads(req.text), self.data2id)

    def test_4_put(self):
        req = requests.put("http://localhost:9000/model1?a=13", json=self.data3)
        self.assertEqual(req.status_code, 200)
        self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
        #self.assertEqual(json.loads(req.text), self.data3id)
        req = requests.put("http://localhost:9000/model1/2", json=self.data3)
        self.assertEqual(req.status_code, 200)
        self.assertEqual(req.headers["Content-Type"], "application/json; charset=utf-8")
        self.data3id.update({"_id": 2, "_links": {"self": {"href": "/model1/2"}}})
        self.assertEqual(json.loads(req.text), self.data3id) # Returns the current data

class App_Test_1(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.app = App()
        cls.path_customers = "extrafiles/app_test/customers"
        cls.path_invoices = "extrafiles/app_test/invoices"
        cls.app.set_model(ShelveModel(cls.path_customers,
                                      2,
                                      index_fields=["nombre", "dni"],
                                      headers=["nombre", "dni"]),
                          "customers",
                          "^/customers/<dni>$",)
        cls.app.set_model(ShelveModel(cls.path_invoices,
                                      2,
                                      index_fields=["cliente", "fecha", "importe"],
                                      headers=["cliente", "fecha", "importe"]),
                          "invoices",
                          "^/invoices/<_id>$", )
        cls.app.set_model(ShelveForeign(cls.app._models["customers"],
                                        cls.app._models["invoices"],
                                        "cliente"),
                          "customers/invoices",
                          "^/customers/<customers_dni>/invoices/<invoices__id>$")
        cls.app.run_thread("127.0.0.1", 9001)

    @classmethod
    def tearDownClass(cls):
        cls.app.shutdown()
        time.sleep(0.05)
        shutil.rmtree(cls.path_customers)
        shutil.rmtree(cls.path_invoices)

    def test_00_post(self):
        print("posting")
        req = requests.post("http://localhost:9001/customers",
                            json={"dni": "12345678H", "nombre": "Yo, yo mismo"})
        print("???")
        print(req.headers["Location"])
        print(req.text)
        req = requests.post("http://localhost:9001/customers",
                            json={"dni": "11111111J", "nombre": "Nanai"})

        req = requests.get("http://localhost:9001/customers/11111111J")
        print("HERE AGAIN ", req.text)

    def test_01_post(self):
        req = requests.post("http://localhost:9001/invoices",
                            json={"cliente":1, "fecha": "01/01/2017", "importe": "10.25"})
        print(req.headers["Location"])
        print(req.text)
        req = requests.post("http://localhost:9001/invoices",
                            json={"cliente": 1, "fecha": "01/01/2017", "importe": "20.55"})
        print(req.headers["Location"])
        print(req.text)
        req = requests.patch("http://localhost:9001/invoices/1",
                            json={"cliente": 1, "fecha": "01/01/2017", "importe": "10.55"})

        print("HERE ", req.text)
        req = requests.get("http://localhost:9001/invoices/1")
        print("AND HERE ", req.text)

    def test_1_post_foreign(self):
        req = requests.post("http://localhost:9001/customers/12345678H/invoices",
                            json={"fecha": "01/02/2017", "importe": "16.30"})
        print(req.headers["Location"]) #Mal
        print(req.text) #Mal
        req = requests.post("http://localhost:9001/customers/11111111J/invoices",
                            json={"fecha": "01/02/2017", "importe": "18.30"})
        print(req.headers["Location"])  # Mal
        print(req.text)  # Mal

        req = requests.get("http://localhost:9001/customers/11111111J/invoices")
        print("SO HERE ", req.text)

    def test_2_get(self):
        req = requests.get("http://localhost:9001/customers/12345678H/invoices")
        print(req.text)

    def test_3_put(self):
        req = requests.put("http://localhost:9001/customers/12345678H/invoices/1",
                           json={"fecha": "01/03/2017", "importe": "18.00"})
        print(req.text)
        req = requests.get("http://localhost:9001/invoices")
        print(req.text)

    def test_4_patch(self):
        req = requests.patch("http://localhost:9001/customers/12345678H/invoices/1",
                             json={"importe": "00.00"})
        print(req.text)
        req = requests.get("http://localhost:9001/invoices")
        print(req.text)

    def test_5_delete(self):
        req = requests.delete("http://localhost:9001/customers/12345678H/invoices/1")
        print(req.text)

    def test_6_get_single(self):
        req = requests.get("http://localhost:9001/customers/12345678H/invoices")
        print(req.text)

    def test_7_get_invoices(self):
        req = requests.get("http://localhost:9001/invoices")
        print(req.text)

    def test_8_get_customers(self):
        req = requests.get("http://localhost:9001/customers")
        print(req.text)

    def test_9_get_all(self):
        req = requests.get("http://localhost:9001/customers//invoices")
        print(req.text)

if __name__ == "__main__":
    unittest.main()


text:
define({
  "tabs_section_Label": "Kartice",
  "addTab": "Dodaj karticu",
  "layerName": "Sloj",
  "layerType": "Vrsta analize",
  "layerLabel": "Oznaka",
  "actions": "Radnje",
  "closest": "Najbliži geoobjekt",
  "proximity": "Blizina",
  "summary": "Sažetak",
  "select_lbl": "-- Odaberi --",
  "general_setting_Label": "Opće postavke",
  "units_text_lbl": "Jedinice udaljenosti",
  "miles": "Milje",
  "kilometers": "Kilometri",
  "feet": "Stope",
  "meters": "Metri",
  "yards": "Jardi",
  "nauticalMiles": "Nautičke milje",
  "maximum_distance_lbl": "Maksimalna udaljenost najbližeg geoobjekta",
  "buffer_text_lbl": "Oznaka pojasa",
  "buffer_lbl": "Veličina pojasa",
  "buffer_max_lbl": "Maksimalna veličina pojasa",
  "buffer_min_lbl": "Minimalna veličina pojasa",
  "routing_checkBox": "Omogući rutiranje",
  "weather_Label": "Opcije vremena",
  "weather_checkBox": "Uključi informacije o vremenu",
  "weather_celsius": "Celzijevi-Kilometri",
  "selectLayers": "Odaberi slojeve s vremenom",
  "currentlySelectedLayer": "Slojevi s vremenom koji su trenutačno odabrani",
  "missingTabLabel": "Barem jedna kartica nema svoju oznaku",
  "cancel": "Odustani",
  "ok": "U redu",
  "missingLayerInWebMap": "Nema operativnih slojeva.",
  "selectFields": "Odaberi polja",
  "addField": "Dodaj polje",
  "sum": "ZBROJ",
  "min": "MIN.",
  "max": "MAKS.",
  "avg": "PROSJEK",
  "count": "BROJ",
  "area": "POVRŠINA",
  "length": "DULJINA",
  "count_checkBox": "Prikaži zbroj",
  "area_checkBox": "Prikaži površinu",
  "length_checkBox": "Prikaži duljinu",
  "max_records": "Dosegnuto je maksimalno ograničenje",
  "disable_checkBox": "Onemogući upravljanje vidljivosti sloja",
  "optional_lbl": "Dodatne oznake",
  "incident_lbl": "Incident",
  "locate_lbl": "Pronađi incident"
});

redpajama_set_name: RedPajamaGithub


text:
require('styles/App.scss');
import React from 'react';
import ReactDOM from 'react-dom';
var imageDatas=require('../data/imageData.json');
//
 imageDatas = (function genImageURL(aImageData){
		for(var i = 0,j = aImageData.length;i < j;i++){
			var singleImageData = aImageData[i];
			singleImageData.imageURL = require('../images/'+singleImageData.fileName);
			aImageData[i] = singleImageData;
		}
		return aImageData;
	})(imageDatas);

//圖片的讀取 設定
class ImgFigure extends React.Component {
	constructor(props){
		super(props);
		this.handleClick=this.handleClick.bind(this);
	}

	handleClick (e) {
		if(this.props.arrange.isCenter){
			this.props.inverse();
		}else{
			this.props.center();
		}
		e.stopPropagation();
		e.preventDefault();
	}

	render() {
		var styleObj ={};

		//如果 props 屬性中指定了這張圖片的位置,則使用
		if(this.props.arrange.pos){
			styleObj = this.props.arrange.pos;
		}

		//如果圖片的旋轉角度不為0 則設置角度
		if(this.props.arrange.rotate){
			(['MozTransform','msTransform','WebkitTransform','transform']).forEach(function(value){

				styleObj[value] = 'rotate('+this.props.arrange.rotate + 'deg)';

			}.bind(this));

		}

		if(this.props.arrange.isCenter){
			styleObj.zIndex=11;
		}
		var imgFigureClassName = 'img-figure';
			imgFigureClassName += this.props.arrange.isInverse?' is-inverse':'';

		return(

{this.props.data.title}

							{this.props.data.desc}

		)
	}
}

class ControllerUnits extends React.Component {
	constructor(props){
		super(props);

		this.handleClick=this.handleClick.bind(this);
	}

	handleClick(e){

		//如果點到的圖片是已經居中,就翻轉。如果不是就把該圖片居中
		if(this.props.arrange.isCenter){
			this.props.inverse();
		}else{
			this.props.center();
		}

		e.stopPropagation();
		e.preventDefault();
	}

	render(){
		var controllerUnitClassName = 'controller-unit';

		//如果對應的是居中的圖片,則顯示居中的狀態
		if(this.props.arrange.isCenter){
			controllerUnitClassName += ' is-center';

			//如果該圖片是翻轉過的 ,則顯示翻轉的狀態
			if(this.props.arrange.isInverse){
				controllerUnitClassName += ' is-inverse';
			}
		}
		return (

		)

	}
}
class AppComponent extends React.Component {
	/*
	 *也就是说 通过es6类的继承实现时 state的初始化要在constructor中声明 ,無法用
	 *React 當state 有變化,則會重新渲染(render)
	 *getInitialState() {
		return{
				aImgsRange:[
					pos:{
						left:'0',
						top:'0'
					},

				]
			}
		}
	*/

	constructor(props){
		super(props);
		this.state = {
			aImgsRange:[
						/*
						'pos':{
							left:'0',
							top:'0',

						},
						rotate:0,	//圖片的旋轉角度
						isInverse:false, //圖片正反面
						isCenter:false//圖片是否居中
						*/
					],
					Constant:{
						centerPos:{
							left:0,
							right:0
						},
						hPosRange:{ //水平方向的取值範圍
							leftSecX: [0,0],
							rightSecX: [0,0],
							y: [0,0]
						},
						vPosRange:{//垂直方向的取值範圍
							x: [0,0],
							topY: [0,0]
						}
					}
				};
		this.rearrange = this.rearrange.bind(this);
		this.getRangeRandom = this.getRangeRandom;
		this.get30DegRandom=this.get30DegRandom;
		this.inverse=this.inverse.bind(this);
		this.center=this.center.bind(this);
	}

	/*
	 *翻轉圖片
	 *@param index 輸入當前被執行inverse圖片的值
	 *@return {Function} 這是一個閉包函數,期內回傳一個真正被執行的函數
	 */
	inverse(index){
		return function(){
			var aImgsRange =this.state.aImgsRange;
			aImgsRange[index].isInverse = !aImgsRange[index].isInverse;
			this.setState({
				aImgsRange:aImgsRange
			})
		}.bind(this);
	}

	//獲取區間內的隨機值
	getRangeRandom(low,high){
		return Math.ceil(Math.random() * (high - low) + low);
	}

	//獲得 0~30之間的任意正負值
	get30DegRandom(){

		var Deg =( Math.random() > 0.5 )?Math.ceil(Math.random()*30):Math.ceil(Math.random()*30*-1);
		return 	Deg;
	}

	/*
	*重新布局所有圖片
	*@param centerIndex 指定中間排哪個圖片
	*/
	rearrange(centerIndex){
		var aImgsRange = this.state.aImgsRange,
			Constant = this.state.Constant,
			centerPos = Constant.centerPos,
			hPosRange = Constant.hPosRange,
			vPosRange = Constant.vPosRange,
			hPosRangeLeftSecX = hPosRange.leftSecX,
			hPosRangeRightSecX = hPosRange.rightSecX,
			hPosRangeY = hPosRange.y,
			vPosRangeTopY = vPosRange.topY,
			vPosRangeX = vPosRange.x,

			aImgsRangeTop= [],
			topImgNum =Math.floor(Math.random()*2),//取一個或不取
			topImgSpliceIndex =0,
			aImgsRangeCenter = aImgsRange.splice(centerIndex,1);

			//首先居中 centerIndex的圖片,居中的圖片不需要旋轉。
			aImgsRangeCenter[0]={
				pos:centerPos,
				rotate:0,
				isCenter:true
			}

			//取出要布局上方圖片的狀態訊息
			topImgSpliceIndex = Math.ceil(Math.random()*(aImgsRange.length-topImgNum));

			aImgsRangeTop = aImgsRange.splice(topImgSpliceIndex,topImgNum);

			//布局位於上方的圖片
			aImgsRangeTop.forEach(function(value,index){
				aImgsRangeTop[index]={
					pos:{
						top:this.getRangeRandom(vPosRangeTopY[0],vPosRangeTopY[1]),
						left:this.getRangeRandom(vPosRangeX[0],vPosRangeX[1])
					},
					rotate:this.get30DegRandom(),
					isCenter:false
				}
			}.bind(this));

			//布局位於左右的圖片

			for (var i = 0,j= aImgsRange.length, k = j / 2; i < j ;i++){
				var hPosRangeLORX = null;

				//前半部分 布局在左邊, 後面的布局在右邊
				if( i < k){
					hPosRangeLORX = hPosRangeLeftSecX;
				}else{
					hPosRangeLORX = hPosRangeRightSecX;
				}

				aImgsRange[i]={
					pos:{
						top:this.getRangeRandom(hPosRangeY[0],hPosRangeY[1]),
						left:this.getRangeRandom(hPosRangeLORX[0],hPosRangeLORX[1])
					},
					rotate:this.get30DegRandom(),
					isCenter:false
				}
			}

			if(aImgsRangeTop && aImgsRangeTop[0] ){
				aImgsRange.splice(topImgSpliceIndex,0,aImgsRangeTop[0]);
			}

			aImgsRange.splice(centerIndex,0, aImgsRangeCenter[0]);

			this.setState({
					aImgsRange:aImgsRange
			});
	}

	/*
	 *利用rearrange(),把相對應的index圖片 居中
	 *@param index 需要被居中的圖片的index 。
	 *@return {Function}
	 */

	center(index){
		return function(){
			this.rearrange(index);

		}.bind(this);

	}

	//加載後,為每張圖片計算其位置範圍
	componentDidMount() {
		//首先拿到舞台的大小
		var stageDOM = ReactDOM.findDOMNode(this.refs.stage),
			stageW = stageDOM.scrollWidth,
			stageH = stageDOM.scrollHeight,
			halfStageW = Math.ceil(stageW / 2),
			halfStageH = Math.ceil(stageH / 2);

		//拿到第一個 imageFigure的大小
		var imgFigureDOM = ReactDOM.findDOMNode(this.refs.imgFigure0),
			imgW = imgFigureDOM.scrollWidth,
			imgH = imgFigureDOM.scrollHeight,
			halfImgW = Math.ceil(imgW / 2),
			halfImgH = Math.ceil(imgH / 2);

		this.state.Constant.centerPos ={
			left : halfStageW - halfImgW,
			top : halfStageH - halfImgH
		}
		//計算左右圖片位置範圍
		this.state.Constant.hPosRange.leftSecX[0]=-halfImgW;
		this.state.Constant.hPosRange.leftSecX[1]=halfStageW-halfImgW*3;

		this.state.Constant.hPosRange.rightSecX[0]=halfStageW+halfImgW;
		this.state.Constant.hPosRange.rightSecX[1]=stageW-halfImgW;
		this.state.Constant.hPosRange.y[0]=-halfImgH;
		this.state.Constant.hPosRange.y[1]=stageH-halfImgH;

		//計算上下圖片位置範圍
		this.state.Constant.vPosRange.topY[0]=-halfImgH;
		this.state.Constant.vPosRange.topY[1]=halfStageH-halfImgH*3;
		this.state.Constant.vPosRange.x[0]=halfStageW - imgW;
		this.state.Constant.vPosRange.x[1]=halfStageW;

		this.rearrange(0);

	}

	render() {
		var controllerUnits = [],
			imgFigures = [];
		imageDatas.forEach(function(value , index){

			//圖片的初始
			if(!this.state.aImgsRange[index]){
				this.state.aImgsRange[index] = {
					pos:{
						left:0,
						top:0
					},
					rotate:0,
					isInverse:false,
					isCenter:false
				}
			}

			//key 是為了優化
			imgFigures.push(<ImgFigure data={value} key={index} ref={'imgFigure'+index} arrange={this.state.aImgsRange[index]} inverse={this.inverse(index)} center = {this.center(index)}/>);

			controllerUnits.push(<ControllerUnits key={index} arrange={this.state.aImgsRange[index]} inverse={this.inverse(index)} center={this.center(index)} />);
		}.bind(this));

    return (

				{imgFigures}

				{controllerUnits}

控制按鈕

    );
  }
}

AppComponent.defaultProps = {
};

export default AppComponent;


text:
package com.intellij.appengine.facet;

import com.intellij.appengine.JavaGoogleAppEngineBundle;
import com.intellij.framework.FrameworkTypeEx;
import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider;
import icons.GoogleAppEngineIcons;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

public class AppEngineFrameworkType extends FrameworkTypeEx {
  public static final String ID = "appengine-java";

  public AppEngineFrameworkType() {
    super(ID);
  }

  static AppEngineFrameworkType getFrameworkType() {
    return EP_NAME.findExtension(AppEngineFrameworkType.class);
  }

  @NotNull
  @Override
  public FrameworkSupportInModuleProvider createProvider() {
    return new AppEngineSupportProvider();
  }

  @NotNull
  @Override
  public String getPresentableName() {
    return JavaGoogleAppEngineBundle.message("plugin.name");
  }

  @NotNull
  @Override
  public Icon getIcon() {
    return GoogleAppEngineIcons.AppEngine;
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace GW2PAO.PresentationCore.DragDrop
{
    public class OnDropEventArgs : RoutedEventArgs
    {
        private DragEventArgs dragEventArgs;

        /// <summary>
        /// Data associated with the dropped item
        /// </summary>
        public object Data
        {
            get;
            private set;
        }

        public OnDropEventArgs(DragEventArgs dragEventArgs, object data)
            : base()
        {
            this.dragEventArgs = dragEventArgs;
            this.Data = data;
        }

        public OnDropEventArgs(RoutedEvent routedEvent, DragEventArgs dragEventArgs, object data)
            : base(routedEvent)
        {
            this.dragEventArgs = dragEventArgs;
            this.Data = data;
        }

        public OnDropEventArgs(RoutedEvent routedEvent, object source, DragEventArgs dragEventArgs, object data)
            : base(routedEvent, source)
        {
            this.dragEventArgs = dragEventArgs;
            this.Data = data;
        }

        public Point GetPosition(IInputElement relativeTo)
        {
            return this.dragEventArgs.GetPosition(relativeTo);
        }
    }
}


text:
import argparse
import json
import os

from trainer import model

import tensorflow as tf

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--job-dir",
        help="this model ignores this field, but it is required by gcloud",
        default="junk"
    )
    parser.add_argument(
        "--train_data_path",
        help="GCS location of training data",
        required=True
    )
    parser.add_argument(
        "--eval_data_path",
        help="GCS location of evaluation data",
        required=True
    )
    parser.add_argument(
        "--output_dir",
        help="GCS location to write checkpoints and export models",
        required=True
    )
    parser.add_argument(
        "--batch_size",
        help="Number of examples to compute gradient over.",
        type=int,
        default=512
    )
    parser.add_argument(
        "--nnsize",
        help="Hidden layer sizes for DNN -- provide space-separated layers",
        nargs="+",
        type=int,
        default=[128, 32, 4]
    )
    parser.add_argument(
        "--nembeds",
        help="Embedding size of a cross of n key real-valued parameters",
        type=int,
        default=3
    )
    parser.add_argument(
        "--num_epochs",
        help="Number of epochs to train the model.",
        type=int,
        default=10
    )
    parser.add_argument(
        "--train_examples",
        help="""Number of examples (in thousands) to run the training job over.
        If this is more than actual # of examples available, it cycles through
        them. So specifying 1000 here when you have only 100k examples makes
        this 10 epochs.""",
        type=int,
        default=5000
    )
    parser.add_argument(
        "--eval_steps",
        help="""Positive number of steps for which to evaluate model. Default
        to None, which means to evaluate until input_fn raises an end-of-input
        exception""",
        type=int,
        default=None
    )

    # Parse all arguments
    args = parser.parse_args()
    arguments = args.__dict__

    # Unused args provided by service
    arguments.pop("job_dir", None)
    arguments.pop("job-dir", None)

    # Modify some arguments
    arguments["train_examples"] *= 1000

    # Append trial_id to path if we are doing hptuning
    # This code can be removed if you are not using hyperparameter tuning
    arguments["output_dir"] = os.path.join(
        arguments["output_dir"],
        json.loads(
            os.environ.get("TF_CONFIG", "{}")
        ).get("task", {}).get("trial", "")
    )

    # Run the training job
    model.train_and_evaluate(arguments)


text:
Clock
=====

Heavily modified clock, originally by [Roger Meier](https://github.com/bufferoverflow/clock)


text:
namespace speech {
namespace sparrowhawk {

// Internal implementation detail -- do not call these.
void  protobuf_AddDesc_rule_5forder_2eproto();
void protobuf_AssignDesc_rule_5forder_2eproto();
void protobuf_ShutdownFile_rule_5forder_2eproto();

class Rule;
class Grammar;

// ===================================================================

class Rule : public ::google::protobuf::Message {
 public:
  Rule();
  virtual ~Rule();

  Rule(const Rule& from);

  inline Rule& operator=(const Rule& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
    return _unknown_fields_;
  }

  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
    return &_unknown_fields_;
  }

  static const ::google::protobuf::Descriptor* descriptor();
  static const Rule& default_instance();

  void Swap(Rule* other);

  // implements Message ----------------------------------------------

  Rule* New() const;
  void CopyFrom(const ::google::protobuf::Message& from);
  void MergeFrom(const ::google::protobuf::Message& from);
  void CopyFrom(const Rule& from);
  void MergeFrom(const Rule& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  public:

  ::google::protobuf::Metadata GetMetadata() const;

  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // required string main = 1;
  inline bool has_main() const;
  inline void clear_main();
  static const int kMainFieldNumber = 1;
  inline const ::std::string& main() const;
  inline void set_main(const ::std::string& value);
  inline void set_main(const char* value);
  inline void set_main(const char* value, size_t size);
  inline ::std::string* mutable_main();
  inline ::std::string* release_main();
  inline void set_allocated_main(::std::string* main);

  // optional string parens = 2;
  inline bool has_parens() const;
  inline void clear_parens();
  static const int kParensFieldNumber = 2;
  inline const ::std::string& parens() const;
  inline void set_parens(const ::std::string& value);
  inline void set_parens(const char* value);
  inline void set_parens(const char* value, size_t size);
  inline ::std::string* mutable_parens();
  inline ::std::string* release_parens();
  inline void set_allocated_parens(::std::string* parens);

  // optional string assignments = 3;
  inline bool has_assignments() const;
  inline void clear_assignments();
  static const int kAssignmentsFieldNumber = 3;
  inline const ::std::string& assignments() const;
  inline void set_assignments(const ::std::string& value);
  inline void set_assignments(const char* value);
  inline void set_assignments(const char* value, size_t size);
  inline ::std::string* mutable_assignments();
  inline ::std::string* release_assignments();
  inline void set_allocated_assignments(::std::string* assignments);

  // optional string redup = 4;
  inline bool has_redup() const;
  inline void clear_redup();
  static const int kRedupFieldNumber = 4;
  inline const ::std::string& redup() const;
  inline void set_redup(const ::std::string& value);
  inline void set_redup(const char* value);
  inline void set_redup(const char* value, size_t size);
  inline ::std::string* mutable_redup();
  inline ::std::string* release_redup();
  inline void set_allocated_redup(::std::string* redup);

  // @@protoc_insertion_point(class_scope:speech.sparrowhawk.Rule)
 private:
  inline void set_has_main();
  inline void clear_has_main();
  inline void set_has_parens();
  inline void clear_has_parens();
  inline void set_has_assignments();
  inline void clear_has_assignments();
  inline void set_has_redup();
  inline void clear_has_redup();

  ::google::protobuf::UnknownFieldSet _unknown_fields_;

  ::std::string* main_;
  ::std::string* parens_;
  ::std::string* assignments_;
  ::std::string* redup_;

  mutable int _cached_size_;
  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];

  friend void  protobuf_AddDesc_rule_5forder_2eproto();
  friend void protobuf_AssignDesc_rule_5forder_2eproto();
  friend void protobuf_ShutdownFile_rule_5forder_2eproto();

  void InitAsDefaultInstance();
  static Rule* default_instance_;
};
// -------------------------------------------------------------------

class Grammar : public ::google::protobuf::Message {
 public:
  Grammar();
  virtual ~Grammar();

  Grammar(const Grammar& from);

  inline Grammar& operator=(const Grammar& from) {
    CopyFrom(from);
    return *this;
  }

  inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
    return _unknown_fields_;
  }

  inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
    return &_unknown_fields_;
  }

  static const ::google::protobuf::Descriptor* descriptor();
  static const Grammar& default_instance();

  void Swap(Grammar* other);

  // implements Message ----------------------------------------------

  Grammar* New() const;
  void CopyFrom(const ::google::protobuf::Message& from);
  void MergeFrom(const ::google::protobuf::Message& from);
  void CopyFrom(const Grammar& from);
  void MergeFrom(const Grammar& from);
  void Clear();
  bool IsInitialized() const;

  int ByteSize() const;
  bool MergePartialFromCodedStream(
      ::google::protobuf::io::CodedInputStream* input);
  void SerializeWithCachedSizes(
      ::google::protobuf::io::CodedOutputStream* output) const;
  ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
  int GetCachedSize() const { return _cached_size_; }
  private:
  void SharedCtor();
  void SharedDtor();
  void SetCachedSize(int size) const;
  public:

  ::google::protobuf::Metadata GetMetadata() const;

  // nested types ----------------------------------------------------

  // accessors -------------------------------------------------------

  // required string grammar_file = 1;
  inline bool has_grammar_file() const;
  inline void clear_grammar_file();
  static const int kGrammarFileFieldNumber = 1;
  inline const ::std::string& grammar_file() const;
  inline void set_grammar_file(const ::std::string& value);
  inline void set_grammar_file(const char* value);
  inline void set_grammar_file(const char* value, size_t size);
  inline ::std::string* mutable_grammar_file();
  inline ::std::string* release_grammar_file();
  inline void set_allocated_grammar_file(::std::string* grammar_file);

  // required string grammar_name = 2;
  inline bool has_grammar_name() const;
  inline void clear_grammar_name();
  static const int kGrammarNameFieldNumber = 2;
  inline const ::std::string& grammar_name() const;
  inline void set_grammar_name(const ::std::string& value);
  inline void set_grammar_name(const char* value);
  inline void set_grammar_name(const char* value, size_t size);
  inline ::std::string* mutable_grammar_name();
  inline ::std::string* release_grammar_name();
  inline void set_allocated_grammar_name(::std::string* grammar_name);

  // repeated .speech.sparrowhawk.Rule rules = 3;
  inline int rules_size() const;
  inline void clear_rules();
  static const int kRulesFieldNumber = 3;
  inline const ::speech::sparrowhawk::Rule& rules(int index) const;
  inline ::speech::sparrowhawk::Rule* mutable_rules(int index);
  inline ::speech::sparrowhawk::Rule* add_rules();
  inline const ::google::protobuf::RepeatedPtrField< ::speech::sparrowhawk::Rule >&
      rules() const;
  inline ::google::protobuf::RepeatedPtrField< ::speech::sparrowhawk::Rule >*
      mutable_rules();

  // @@protoc_insertion_point(class_scope:speech.sparrowhawk.Grammar)
 private:
  inline void set_has_grammar_file();
  inline void clear_has_grammar_file();
  inline void set_has_grammar_name();
  inline void clear_has_grammar_name();

  ::google::protobuf::UnknownFieldSet _unknown_fields_;

  ::std::string* grammar_file_;
  ::std::string* grammar_name_;
  ::google::protobuf::RepeatedPtrField< ::speech::sparrowhawk::Rule > rules_;

  mutable int _cached_size_;
  ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];

  friend void  protobuf_AddDesc_rule_5forder_2eproto();
  friend void protobuf_AssignDesc_rule_5forder_2eproto();
  friend void protobuf_ShutdownFile_rule_5forder_2eproto();

  void InitAsDefaultInstance();
  static Grammar* default_instance_;
};
// ===================================================================

// ===================================================================

// Rule

// required string main = 1;
inline bool Rule::has_main() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Rule::set_has_main() {
  _has_bits_[0] |= 0x00000001u;
}
inline void Rule::clear_has_main() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void Rule::clear_main() {
  if (main_ != &::google::protobuf::internal::kEmptyString) {
    main_->clear();
  }
  clear_has_main();
}
inline const ::std::string& Rule::main() const {
  return *main_;
}
inline void Rule::set_main(const ::std::string& value) {
  set_has_main();
  if (main_ == &::google::protobuf::internal::kEmptyString) {
    main_ = new ::std::string;
  }
  main_->assign(value);
}
inline void Rule::set_main(const char* value) {
  set_has_main();
  if (main_ == &::google::protobuf::internal::kEmptyString) {
    main_ = new ::std::string;
  }
  main_->assign(value);
}
inline void Rule::set_main(const char* value, size_t size) {
  set_has_main();
  if (main_ == &::google::protobuf::internal::kEmptyString) {
    main_ = new ::std::string;
  }
  main_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Rule::mutable_main() {
  set_has_main();
  if (main_ == &::google::protobuf::internal::kEmptyString) {
    main_ = new ::std::string;
  }
  return main_;
}
inline ::std::string* Rule::release_main() {
  clear_has_main();
  if (main_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = main_;
    main_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Rule::set_allocated_main(::std::string* main) {
  if (main_ != &::google::protobuf::internal::kEmptyString) {
    delete main_;
  }
  if (main) {
    set_has_main();
    main_ = main;
  } else {
    clear_has_main();
    main_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// optional string parens = 2;
inline bool Rule::has_parens() const {
  return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void Rule::set_has_parens() {
  _has_bits_[0] |= 0x00000002u;
}
inline void Rule::clear_has_parens() {
  _has_bits_[0] &= ~0x00000002u;
}
inline void Rule::clear_parens() {
  if (parens_ != &::google::protobuf::internal::kEmptyString) {
    parens_->clear();
  }
  clear_has_parens();
}
inline const ::std::string& Rule::parens() const {
  return *parens_;
}
inline void Rule::set_parens(const ::std::string& value) {
  set_has_parens();
  if (parens_ == &::google::protobuf::internal::kEmptyString) {
    parens_ = new ::std::string;
  }
  parens_->assign(value);
}
inline void Rule::set_parens(const char* value) {
  set_has_parens();
  if (parens_ == &::google::protobuf::internal::kEmptyString) {
    parens_ = new ::std::string;
  }
  parens_->assign(value);
}
inline void Rule::set_parens(const char* value, size_t size) {
  set_has_parens();
  if (parens_ == &::google::protobuf::internal::kEmptyString) {
    parens_ = new ::std::string;
  }
  parens_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Rule::mutable_parens() {
  set_has_parens();
  if (parens_ == &::google::protobuf::internal::kEmptyString) {
    parens_ = new ::std::string;
  }
  return parens_;
}
inline ::std::string* Rule::release_parens() {
  clear_has_parens();
  if (parens_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = parens_;
    parens_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Rule::set_allocated_parens(::std::string* parens) {
  if (parens_ != &::google::protobuf::internal::kEmptyString) {
    delete parens_;
  }
  if (parens) {
    set_has_parens();
    parens_ = parens;
  } else {
    clear_has_parens();
    parens_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// optional string assignments = 3;
inline bool Rule::has_assignments() const {
  return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void Rule::set_has_assignments() {
  _has_bits_[0] |= 0x00000004u;
}
inline void Rule::clear_has_assignments() {
  _has_bits_[0] &= ~0x00000004u;
}
inline void Rule::clear_assignments() {
  if (assignments_ != &::google::protobuf::internal::kEmptyString) {
    assignments_->clear();
  }
  clear_has_assignments();
}
inline const ::std::string& Rule::assignments() const {
  return *assignments_;
}
inline void Rule::set_assignments(const ::std::string& value) {
  set_has_assignments();
  if (assignments_ == &::google::protobuf::internal::kEmptyString) {
    assignments_ = new ::std::string;
  }
  assignments_->assign(value);
}
inline void Rule::set_assignments(const char* value) {
  set_has_assignments();
  if (assignments_ == &::google::protobuf::internal::kEmptyString) {
    assignments_ = new ::std::string;
  }
  assignments_->assign(value);
}
inline void Rule::set_assignments(const char* value, size_t size) {
  set_has_assignments();
  if (assignments_ == &::google::protobuf::internal::kEmptyString) {
    assignments_ = new ::std::string;
  }
  assignments_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Rule::mutable_assignments() {
  set_has_assignments();
  if (assignments_ == &::google::protobuf::internal::kEmptyString) {
    assignments_ = new ::std::string;
  }
  return assignments_;
}
inline ::std::string* Rule::release_assignments() {
  clear_has_assignments();
  if (assignments_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = assignments_;
    assignments_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Rule::set_allocated_assignments(::std::string* assignments) {
  if (assignments_ != &::google::protobuf::internal::kEmptyString) {
    delete assignments_;
  }
  if (assignments) {
    set_has_assignments();
    assignments_ = assignments;
  } else {
    clear_has_assignments();
    assignments_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// optional string redup = 4;
inline bool Rule::has_redup() const {
  return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void Rule::set_has_redup() {
  _has_bits_[0] |= 0x00000008u;
}
inline void Rule::clear_has_redup() {
  _has_bits_[0] &= ~0x00000008u;
}
inline void Rule::clear_redup() {
  if (redup_ != &::google::protobuf::internal::kEmptyString) {
    redup_->clear();
  }
  clear_has_redup();
}
inline const ::std::string& Rule::redup() const {
  return *redup_;
}
inline void Rule::set_redup(const ::std::string& value) {
  set_has_redup();
  if (redup_ == &::google::protobuf::internal::kEmptyString) {
    redup_ = new ::std::string;
  }
  redup_->assign(value);
}
inline void Rule::set_redup(const char* value) {
  set_has_redup();
  if (redup_ == &::google::protobuf::internal::kEmptyString) {
    redup_ = new ::std::string;
  }
  redup_->assign(value);
}
inline void Rule::set_redup(const char* value, size_t size) {
  set_has_redup();
  if (redup_ == &::google::protobuf::internal::kEmptyString) {
    redup_ = new ::std::string;
  }
  redup_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Rule::mutable_redup() {
  set_has_redup();
  if (redup_ == &::google::protobuf::internal::kEmptyString) {
    redup_ = new ::std::string;
  }
  return redup_;
}
inline ::std::string* Rule::release_redup() {
  clear_has_redup();
  if (redup_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = redup_;
    redup_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Rule::set_allocated_redup(::std::string* redup) {
  if (redup_ != &::google::protobuf::internal::kEmptyString) {
    delete redup_;
  }
  if (redup) {
    set_has_redup();
    redup_ = redup;
  } else {
    clear_has_redup();
    redup_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// -------------------------------------------------------------------

// Grammar

// required string grammar_file = 1;
inline bool Grammar::has_grammar_file() const {
  return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void Grammar::set_has_grammar_file() {
  _has_bits_[0] |= 0x00000001u;
}
inline void Grammar::clear_has_grammar_file() {
  _has_bits_[0] &= ~0x00000001u;
}
inline void Grammar::clear_grammar_file() {
  if (grammar_file_ != &::google::protobuf::internal::kEmptyString) {
    grammar_file_->clear();
  }
  clear_has_grammar_file();
}
inline const ::std::string& Grammar::grammar_file() const {
  return *grammar_file_;
}
inline void Grammar::set_grammar_file(const ::std::string& value) {
  set_has_grammar_file();
  if (grammar_file_ == &::google::protobuf::internal::kEmptyString) {
    grammar_file_ = new ::std::string;
  }
  grammar_file_->assign(value);
}
inline void Grammar::set_grammar_file(const char* value) {
  set_has_grammar_file();
  if (grammar_file_ == &::google::protobuf::internal::kEmptyString) {
    grammar_file_ = new ::std::string;
  }
  grammar_file_->assign(value);
}
inline void Grammar::set_grammar_file(const char* value, size_t size) {
  set_has_grammar_file();
  if (grammar_file_ == &::google::protobuf::internal::kEmptyString) {
    grammar_file_ = new ::std::string;
  }
  grammar_file_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Grammar::mutable_grammar_file() {
  set_has_grammar_file();
  if (grammar_file_ == &::google::protobuf::internal::kEmptyString) {
    grammar_file_ = new ::std::string;
  }
  return grammar_file_;
}
inline ::std::string* Grammar::release_grammar_file() {
  clear_has_grammar_file();
  if (grammar_file_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = grammar_file_;
    grammar_file_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Grammar::set_allocated_grammar_file(::std::string* grammar_file) {
  if (grammar_file_ != &::google::protobuf::internal::kEmptyString) {
    delete grammar_file_;
  }
  if (grammar_file) {
    set_has_grammar_file();
    grammar_file_ = grammar_file;
  } else {
    clear_has_grammar_file();
    grammar_file_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// required string grammar_name = 2;
inline bool Grammar::has_grammar_name() const {
  return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void Grammar::set_has_grammar_name() {
  _has_bits_[0] |= 0x00000002u;
}
inline void Grammar::clear_has_grammar_name() {
  _has_bits_[0] &= ~0x00000002u;
}
inline void Grammar::clear_grammar_name() {
  if (grammar_name_ != &::google::protobuf::internal::kEmptyString) {
    grammar_name_->clear();
  }
  clear_has_grammar_name();
}
inline const ::std::string& Grammar::grammar_name() const {
  return *grammar_name_;
}
inline void Grammar::set_grammar_name(const ::std::string& value) {
  set_has_grammar_name();
  if (grammar_name_ == &::google::protobuf::internal::kEmptyString) {
    grammar_name_ = new ::std::string;
  }
  grammar_name_->assign(value);
}
inline void Grammar::set_grammar_name(const char* value) {
  set_has_grammar_name();
  if (grammar_name_ == &::google::protobuf::internal::kEmptyString) {
    grammar_name_ = new ::std::string;
  }
  grammar_name_->assign(value);
}
inline void Grammar::set_grammar_name(const char* value, size_t size) {
  set_has_grammar_name();
  if (grammar_name_ == &::google::protobuf::internal::kEmptyString) {
    grammar_name_ = new ::std::string;
  }
  grammar_name_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* Grammar::mutable_grammar_name() {
  set_has_grammar_name();
  if (grammar_name_ == &::google::protobuf::internal::kEmptyString) {
    grammar_name_ = new ::std::string;
  }
  return grammar_name_;
}
inline ::std::string* Grammar::release_grammar_name() {
  clear_has_grammar_name();
  if (grammar_name_ == &::google::protobuf::internal::kEmptyString) {
    return NULL;
  } else {
    ::std::string* temp = grammar_name_;
    grammar_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
    return temp;
  }
}
inline void Grammar::set_allocated_grammar_name(::std::string* grammar_name) {
  if (grammar_name_ != &::google::protobuf::internal::kEmptyString) {
    delete grammar_name_;
  }
  if (grammar_name) {
    set_has_grammar_name();
    grammar_name_ = grammar_name;
  } else {
    clear_has_grammar_name();
    grammar_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
  }
}

// repeated .speech.sparrowhawk.Rule rules = 3;
inline int Grammar::rules_size() const {
  return rules_.size();
}
inline void Grammar::clear_rules() {
  rules_.Clear();
}
inline const ::speech::sparrowhawk::Rule& Grammar::rules(int index) const {
  return rules_.Get(index);
}
inline ::speech::sparrowhawk::Rule* Grammar::mutable_rules(int index) {
  return rules_.Mutable(index);
}
inline ::speech::sparrowhawk::Rule* Grammar::add_rules() {
  return rules_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::speech::sparrowhawk::Rule >&
Grammar::rules() const {
  return rules_;
}
inline ::google::protobuf::RepeatedPtrField< ::speech::sparrowhawk::Rule >*
Grammar::mutable_rules() {
  return &rules_;
}

// @@protoc_insertion_point(namespace_scope)

}  // namespace sparrowhawk
}  // namespace speech

#ifndef SWIG
namespace google {
namespace protobuf {

}  // namespace google
}  // namespace protobuf
#endif  // SWIG

// @@protoc_insertion_point(global_scope)

#endif  // PROTOBUF_rule_5forder_2eproto__INCLUDED


text:
package org.apereo.cas.token;

import com.google.common.base.Throwables;
import com.nimbusds.jwt.JWTClaimsSet;
import net.minidev.json.JSONObject;
import org.apereo.cas.CipherExecutor;
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.util.DateTimeUtils;
import org.hjson.JsonValue;
import org.hjson.Stringify;
import org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator;
import org.jasig.cas.client.validation.Assertion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.ZonedDateTime;

/**
 * This is {@link JWTTokenTicketBuilder}.
 *
 * @author Misagh Moayyed
 * @since 5.2.0
 */
public class JWTTokenTicketBuilder implements TokenTicketBuilder {
    private static final Logger LOGGER = LoggerFactory.getLogger(JWTTokenTicketBuilder.class);

    private final AbstractUrlBasedTicketValidator ticketValidator;
    private final String casSeverPrefix;
    private final CipherExecutor<String, String> tokenCipherExecutor;
    private final long expirationTimeSeconds;

    public JWTTokenTicketBuilder(final AbstractUrlBasedTicketValidator ticketValidator,
                                 final String casSeverPrefix,
                                 final CipherExecutor<String, String> tokenCipherExecutor,
                                 final long expirationTimeSeconds) {
        this.ticketValidator = ticketValidator;
        this.casSeverPrefix = casSeverPrefix;
        this.tokenCipherExecutor = tokenCipherExecutor;
        this.expirationTimeSeconds = expirationTimeSeconds;
    }

    @Override
    public String build(final String ticketId, final Service service) {
        try {
            final Assertion assertion = this.ticketValidator.validate(ticketId, service.getId());
            final JWTClaimsSet.Builder claims =
                    new JWTClaimsSet.Builder()
                            .audience(service.getId())
                            .issuer(casSeverPrefix)
                            .jwtID(ticketId)
                            .issueTime(assertion.getAuthenticationDate())
                            .subject(assertion.getPrincipal().getName());
            assertion.getAttributes().forEach(claims::claim);
            assertion.getPrincipal().getAttributes().forEach(claims::claim);

            if (assertion.getValidUntilDate() != null) {
                claims.expirationTime(assertion.getValidUntilDate());
            } else {
                final ZonedDateTime dt = ZonedDateTime.now().plusSeconds(expirationTimeSeconds);
                claims.expirationTime(DateTimeUtils.dateOf(dt));
            }
            final JWTClaimsSet claimsSet = claims.build();
            final JSONObject object = claimsSet.toJSONObject();

            final String jwtJson = object.toJSONString();
            LOGGER.debug("Generated JWT [{}]", JsonValue.readJSON(jwtJson).toString(Stringify.FORMATTED));
            return tokenCipherExecutor.encode(jwtJson);
        } catch (final Exception e) {
            throw Throwables.propagate(e);
        }
    }
}


text:
#include "tensorflow/lite/delegates/xnnpack/prelu_tester.h"

#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <numeric>
#include <random>
#include <vector>

#include <gtest/gtest.h>
#include <fp16.h>
#include "flatbuffers/flatbuffers.h"  // from @flatbuffers
#include "tensorflow/lite/delegates/xnnpack/test_util.h"
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/schema/schema_conversion_utils.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"

namespace tflite {
namespace xnnpack {

void PreluTester::Test(TfLiteDelegate* delegate) const {
  std::random_device random_device;
  auto rng = std::mt19937(random_device());
  auto input_rng = std::bind(std::uniform_real_distribution<float>(-1.0f, 1.0f),
                             std::ref(rng));

  std::vector<char> buffer = CreateTfLiteModel();
  const Model* model = GetModel(buffer.data());

  std::unique_ptr<Interpreter> delegate_interpreter;
  ASSERT_EQ(
      InterpreterBuilder(
          model,
          ::tflite::ops::builtin::BuiltinOpResolverWithoutDefaultDelegates())(
          &delegate_interpreter),
      kTfLiteOk);
  std::unique_ptr<Interpreter> default_interpreter;
  ASSERT_EQ(
      InterpreterBuilder(
          model,
          ::tflite::ops::builtin::BuiltinOpResolverWithoutDefaultDelegates())(
          &default_interpreter),
      kTfLiteOk);

  ASSERT_TRUE(delegate_interpreter);
  ASSERT_TRUE(default_interpreter);

  ASSERT_EQ(delegate_interpreter->inputs().size(), 1);
  ASSERT_EQ(default_interpreter->inputs().size(), 1);

  ASSERT_EQ(delegate_interpreter->outputs().size(), 1);
  ASSERT_EQ(default_interpreter->outputs().size(), 1);

  ASSERT_EQ(delegate_interpreter->AllocateTensors(), kTfLiteOk);
  ASSERT_EQ(default_interpreter->AllocateTensors(), kTfLiteOk);

  ASSERT_EQ(delegate_interpreter->ModifyGraphWithDelegate(delegate), kTfLiteOk);

  float* default_input_data = default_interpreter->typed_input_tensor<float>(0);
  std::generate(default_input_data,
                default_input_data + ComputeSize(InputShape()),
                std::ref(input_rng));

  float* xnnpack_input_data =
      delegate_interpreter->typed_input_tensor<float>(0);
  std::copy(default_input_data, default_input_data + ComputeSize(InputShape()),
            xnnpack_input_data);

  ASSERT_EQ(default_interpreter->Invoke(), kTfLiteOk);
  ASSERT_EQ(delegate_interpreter->Invoke(), kTfLiteOk);

  float* default_output_data =
      default_interpreter->typed_output_tensor<float>(0);
  float* xnnpack_output_data =
      delegate_interpreter->typed_output_tensor<float>(0);

  for (size_t i = 0; i < ComputeSize(OutputShape()); i++) {
    ASSERT_EQ(default_output_data[i], xnnpack_output_data[i]);
  }
}

std::vector<char> PreluTester::CreateTfLiteModel() const {
  std::random_device random_device;
  auto rng = std::mt19937(random_device());
  auto slope_rng = std::bind(std::uniform_real_distribution<float>(0.25f, 0.5f),
                             std::ref(rng));

  flatbuffers::FlatBufferBuilder builder;
  std::vector<flatbuffers::Offset<OperatorCode>> operator_codes{
      {CreateOperatorCode(builder, BuiltinOperator_PRELU)}};
  if (FP16Weights() || INT8Weights()) {
    operator_codes.emplace_back(
        CreateOperatorCode(builder, BuiltinOperator_DEQUANTIZE));
  } else if (SparseWeights()) {
    operator_codes.emplace_back(
        CreateOperatorCode(builder, BuiltinOperator_DENSIFY));
  }

  std::vector<flatbuffers::Offset<Buffer>> buffers{{
      CreateBuffer(builder, builder.CreateVector({})),
  }};

  float slope_scale = 0;
  if (FP16Weights()) {
    std::vector<uint16_t> slope_data(ComputeSize(SlopeShape()));
    std::generate(slope_data.begin(), slope_data.end(),
                  std::bind(fp16_ieee_from_fp32_value, slope_rng));

    buffers.push_back(CreateBuffer(
        builder, builder.CreateVector(
                     reinterpret_cast<const uint8_t*>(slope_data.data()),
                     sizeof(uint16_t) * slope_data.size())));
  } else {
    std::vector<float> slope_data(ComputeSize(SlopeShape()));
    std::generate(slope_data.begin(), slope_data.end(), slope_rng);

    if (INT8Weights()) {
      std::vector<int8_t> quantized_slope_data(slope_data.size());
      slope_scale = GetInt8QuantizationScale(slope_data);
      std::transform(
          slope_data.begin(), slope_data.end(), quantized_slope_data.begin(),
          std::bind(QuantizeInt8, std::placeholders::_1, 0, slope_scale));
      buffers.push_back(CreateBuffer(
          builder, builder.CreateVector(
                       reinterpret_cast<const uint8_t*>(slope_data.data()),
                       sizeof(int8_t) * slope_data.size())));
    } else {
      buffers.push_back(CreateBuffer(
          builder, builder.CreateVector(
                       reinterpret_cast<const uint8_t*>(slope_data.data()),
                       sizeof(float) * slope_data.size())));
    }
  }

  std::vector<flatbuffers::Offset<Tensor>> tensors;
  std::vector<flatbuffers::Offset<Operator>> operators;
  if (FP16Weights()) {
    tensors.emplace_back(CreateTensor(
        builder,
        builder.CreateVector<int32_t>(SlopeShape().data(), SlopeShape().size()),
        TensorType_FLOAT16, /*buffer=*/1));
  } else if (INT8Weights()) {
    tensors.emplace_back(CreateTensor(
        builder,
        builder.CreateVector<int32_t>(SlopeShape().data(), SlopeShape().size()),
        TensorType_INT8, /*buffer=*/1, /*name=*/0,
        CreateQuantizationParameters(builder, /*min=*/0, /*max=*/0,
                                     builder.CreateVector<float>({slope_scale}),
                                     builder.CreateVector<int64_t>({0}))));
  } else if (SparseWeights()) {
    const int dims_count = SlopeShape().size();
    std::vector<flatbuffers::Offset<DimensionMetadata>> dim_metadata(
        dims_count);
    std::vector<int> traversal_order(dims_count);
    for (int i = 0; i < dims_count; i++) {
      traversal_order[i] = i;
      dim_metadata[i] = CreateDimensionMetadata(builder, DimensionType_DENSE,
                                                SlopeShape()[i]);
    }
    const flatbuffers::Offset<SparsityParameters> sparsity_param =
        CreateSparsityParameters(builder, builder.CreateVector(traversal_order),
                                 0, builder.CreateVector(dim_metadata));
    tensors.emplace_back(CreateTensor(
        builder,
        builder.CreateVector<int32_t>(SlopeShape().data(), SlopeShape().size()),
        TensorType_FLOAT32, /*buffer=*/1, /*name=*/0, /*quantization=*/0,
        /*is_variable=*/false, /*sparsity=*/sparsity_param));
  }
  if (FP16Weights() || INT8Weights()) {
    const std::array<int32_t, 1> dequantize_inputs{{0}};
    const std::array<int32_t, 1> dequantize_outputs{{2}};
    operators.emplace_back(CreateOperator(
        builder, /*opcode_index=*/1,
        builder.CreateVector<int32_t>(dequantize_inputs.data(),
                                      dequantize_inputs.size()),
        builder.CreateVector<int32_t>(dequantize_outputs.data(),
                                      dequantize_outputs.size())));
  } else if (SparseWeights()) {
    const std::array<int32_t, 1> densify_inputs{{0}};
    const std::array<int32_t, 1> densify_outputs{{2}};
    operators.emplace_back(
        CreateOperator(builder, /*opcode_index=*/1,
                       builder.CreateVector<int32_t>(densify_inputs.data(),
                                                     densify_inputs.size()),
                       builder.CreateVector<int32_t>(densify_outputs.data(),
                                                     densify_outputs.size())));
  }
  tensors.emplace_back(CreateTensor(
      builder,
      builder.CreateVector<int32_t>(InputShape().data(), InputShape().size()),
      TensorType_FLOAT32));
  tensors.emplace_back(CreateTensor(
      builder,
      builder.CreateVector<int32_t>(SlopeShape().data(), SlopeShape().size()),
      TensorType_FLOAT32,
      /*buffer=*/(FP16Weights() || INT8Weights() || SparseWeights()) ? 0 : 1));
  tensors.emplace_back(CreateTensor(
      builder,
      builder.CreateVector<int32_t>(OutputShape().data(), OutputShape().size()),
      TensorType_FLOAT32));

  const std::array<int32_t, 2> op_inputs{
      {static_cast<int>(tensors.size()) - 3,
       static_cast<int>(tensors.size()) - 2}};
  const std::array<int32_t, 1> op_outputs{
      {static_cast<int>(tensors.size()) - 1}};
  operators.emplace_back(CreateOperator(
      builder, /*opcode_index=*/0,
      builder.CreateVector<int32_t>(op_inputs.data(), op_inputs.size()),
      builder.CreateVector<int32_t>(op_outputs.data(), op_outputs.size())));

  const std::array<int32_t, 1> subgraph_inputs{
      {static_cast<int32_t>(tensors.size() - 3)}};
  const std::array<int32_t, 1> subgraph_outputs{
      {static_cast<int32_t>(tensors.size()) - 1}};
  flatbuffers::Offset<SubGraph> subgraph = CreateSubGraph(
      builder, builder.CreateVector(tensors.data(), tensors.size()),
      builder.CreateVector<int32_t>(subgraph_inputs.data(),
                                    subgraph_inputs.size()),
      builder.CreateVector<int32_t>(subgraph_outputs.data(),
                                    subgraph_outputs.size()),
      builder.CreateVector(operators.data(), operators.size()));

  flatbuffers::Offset<flatbuffers::String> description =
      builder.CreateString("PReLU model");

  flatbuffers::Offset<Model> model_buffer = CreateModel(
      builder, TFLITE_SCHEMA_VERSION,
      builder.CreateVector(operator_codes.data(), operator_codes.size()),
      builder.CreateVector(&subgraph, 1), description,
      builder.CreateVector(buffers.data(), buffers.size()));

  builder.Finish(model_buffer);

  return std::vector<char>(builder.GetBufferPointer(),
                           builder.GetBufferPointer() + builder.GetSize());
}

int32_t PreluTester::ComputeSize(const std::vector<int32_t>& shape) {
  return std::accumulate(shape.cbegin(), shape.cend(), 1,
                         std::multiplies<int32_t>());
}

}  // namespace xnnpack
}  // namespace tflite


text:
<?php

namespace Iltar\HttpBundle;

use Iltar\HttpBundle\Functional\Fixtures\Entity\Authentication;
use Iltar\HttpBundle\Functional\Fixtures\Entity\BlindWrite;
use Iltar\HttpBundle\Functional\Fixtures\Entity\Client;
use Iltar\HttpBundle\Functional\Fixtures\Entity\Message;
use Iltar\HttpBundle\Functional\Fixtures\Model\MappedPost;
use Iltar\HttpBundle\Functional\Fixtures\Model\Post;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\HttpUtils;

/**
 * @author Wouter J <wouter@wouterj.nl>
 */
class RouteGenerationTest extends KernelTestCase
{
    protected function setUp()
    {
        static::bootKernel();
    }

    /** @dataProvider getPropertyPathResolverData */
    public function testPropertyPathResolver($routeName, $routeParameters, $expectedPath)
    {
        $router = static::$kernel->getContainer()->get('router');

        self::assertEquals($expectedPath, $router->generate($routeName, $routeParameters));
    }

    public function getPropertyPathResolverData()
    {
        return [
            ['property_route', ['title' => new Post('hello')], '/post/hello'],
            ['method_route', ['slug' => new Post('A nice title')], '/post/a-nice-title'],
            ['mapped_property_route', ['title_slug' => new MappedPost('Hello World')], '/post/hello-world'],
            ['mapped_fallback_route', ['post' => new MappedPost('HTTPBundle', 12)], '/post/12'],
        ];
    }

    /** @dataProvider getEntityIdResolverData */
    public function testEntityIdResolver($routeName, $routeParameters, $expectedPath)
    {
        $router = static::$kernel->getContainer()->get('router');

        self::assertEquals($expectedPath, $router->generate($routeName, $routeParameters));
    }

    public function getEntityIdResolverData()
    {
        return [
            ['client_route', ['client' => new Client(10)], '/client/10'],
            ['authentication_route', ['authentication' => new Authentication(new Client(500))], '/authentication/500'],
        ];
    }

    /** @expectedException \Iltar\HttpBundle\DoctrineBridge\Exception\CompositePrimaryKeyException */
    public function testEntityIdResolverWithCompositePk()
    {
        $router = static::$kernel->getContainer()->get('router');

        $router->generate('message_route', ['message' => new Message(10, 20)]);
    }

    /** @expectedException \Iltar\HttpBundle\DoctrineBridge\Exception\IdentifyingFieldNotReachableException */
    public function testEntityIdResolverWithWithoutAvailableAccessor()
    {
        $router = static::$kernel->getContainer()->get('router');

        $router->generate('message_route', ['blind_write' => new BlindWrite(10)]);
    }

    public function testIfUnresolvedValuesAreLeftAlone()
    {
        $router = static::$kernel->getContainer()->get('router');

        self::assertSame('/post/10?empty_key=&normal_key=10', $router->generate('mapped_fallback_route', [
            'object_key' => new \stdClass(),
            'empty_key' => '',
            'array_key' => [],
            'normal_key' => '10',
            'resource_key' => fopen(__FILE__, 'rb'),
            'post' => 10,
        ]));
    }

    /**
     * @dataProvider getUnresolvedData
     *
     * @expectedException \Iltar\HttpBundle\Exception\UnresolvedParameterException
     * @expectedExceptionMessage Parameters for the route 'client_route' could not be resolved to scalar values. Parameters: "client".
     */
    public function testIfUnresolvedDataThrowsException($id)
    {
        static::$kernel->getContainer()->get('router')->generate('client_route', ['client' => new Client($id)]);
    }

    public function getUnresolvedData()
    {
        return [[''], [[]], [null], [['non empty' => 'array value']]];
    }

    public function testExpectHttpUtilsToWork()
    {
        $router = static::$kernel->getContainer()->get('router');
        $utils = new HttpUtils($router);
        $request = Request::create('/');
        $request->attributes->set('_route_params', []);
        $request->attributes->set('foobar', new \stdClass());

        self::assertSame('http://localhost/login', $utils->generateUri($request, 'login'));
    }
}


text:
import collections
import csv
import sys

import types
from pymongo import MongoClient

if __name__ == '__main__':
    prefix = sys.argv[1]

    db = MongoClient().aliexpress

    store_coll = db['{}store'.format(prefix)]

    product_coll = db['{}product'.format(prefix)]

    order_coll = db['{}order'.format(prefix)]

    feedback_coll = db['{}feedback'.format(prefix)]

    products = collections.defaultdict()

    class Product(object):
        def __init__(self, id):
            self.prefix = ''
            self.id = id
            self.url = ''
            self.store = ''
            self.orders = []
            self.feedbacks = []

        def __str__(self):
            return 'prefix: {}, id: {}, url: {}, store: {}, orders: {}, feedback: {}'.format(self.prefix, self.id, self.url, self.store,
                                                                                len(self.orders), len(self.feedbacks))

    def get_product(id):
        if id not in products:
            products[id] = Product(id)
        return products[id]

    for product in product_coll.find():
        get_product(product['_id']).id = product['_id']
        get_product(product['_id']).prefix = product['prefix']
        get_product(product['_id']).url = product['url']
        get_product(product['_id']).store = product['store']

    for order in order_coll.find():
        get_product(order['_id']).orders = order['orders']

    for feedback in feedback_coll.find():
        get_product(feedback['_id']).feedbacks = feedback['feedbacks']

    with open('../target/{}.csv'.format(prefix), 'w') as f:
        headers = ['prefix', 'id', 'url', 'store', 'orders', 'feedbacks']

        rows = [dict((key, value) for key, value in product.__dict__.iteritems() if not callable(value) and not key.startswith('__')) for
                product in products.values()]
        for row in rows:
            for key, value in row.iteritems():
                if isinstance(value, collections.Iterable) and not isinstance(value, types.StringTypes):
                    row[key] = len(value)

        f_csv = csv.DictWriter(f, headers)
        f_csv.writeheader()
        f_csv.writerows(rows)

    print 'finish'


text:
import unittest

def my_test_suite():
    testLoader = unittest.TestLoader()
    testSuite = testLoader.discover('.', pattern='*_test.py')
    return testSuite


text:
"""
sensor_bmp180.py: BMP180 Barometer Sensor

Sensror Info:
http://www.seeedstudio.com/wiki/Grove_-_Barometer_Sensor_(BMP180)
"""

__author__ = "Daniel Mazzer"
__copyright__ = "Copyright 2016, NORS project"
__credits__ = ""
__license__ = "MIT"
__maintainer__ = "Daniel Mazzer"
__email__ = "dmazzer@gmail.com"

import sys
import signal

from genericsensor.genericsensor import Nors_GenericSensor

sys.path.append('../../GrovePi/Software/Python/grove_barometer_sensors/barometric_sensor_bmp180/')
sys.path.append('../GrovePi/Software/Python/grove_barometer_sensors/barometric_sensor_bmp180/')
import smbus
import RPi.GPIO as GPIO
from grove_i2c_barometic_sensor_BMP180 import BMP085

from norsutils.logmsgs.logger import Logger

logger = Logger('debug')
logger.log("SENSOR - BMP180 Barometer sensor", 'info')

class RealSensor(Nors_GenericSensor):
    def __init__(self):

        # Initialise the BMP085 and use STANDARD mode (default value)
        # bmp = BMP085(0x77, debug=True)
        # To specify a different operating mode, uncomment one of the following:
        # bmp = BMP085(0x77, 0)  # ULTRALOWPOWER Mode
        # bmp = BMP085(0x77, 1)  # STANDARD Mode
        # bmp = BMP085(0x77, 2)  # HIRES Mode
        # bmp = BMP085(0x77, 3)  # ULTRAHIRES Mode
        self.bmp = BMP085(0x77, 1)

        rev = GPIO.RPI_REVISION
        if rev == 2 or rev == 3:
            self.bus = smbus.SMBus(1)
        else:
            self.bus = smbus.SMBus(0)

        self.sensor_name = 'BMP180'
        super(RealSensor, self).__init__(
                                         gs_name = self.sensor_name,
                                         gs_id = '51c8f22a-e191-11e5-914d-001dbaefa596',
                                         gs_description = 'BMP180 Barometer sensor',
                                         gs_interface = None,
                                         gs_read_interval = 60)

    def SensorRead(self):
        try:
            temp = self.bmp.readTemperature()

            # Read the current barometric pressure level
            pressure = self.bmp.readPressure() / 100.0

            # To calculate altitude based on an estimated mean sea level pressure
            # (1013.25 hPa) call the function as follows, but this won't be very accurate
            # altitude = bmp.readAltitude()

            # To specify a more accurate altitude, enter the correct mean sea level
            # pressure level.  For example, if the current pressure level is 1023.50 hPa
            # enter 102350 since we include two decimal places in the integer value
            altitude = self.bmp.readAltitude(99191)
            logger.log( "Temp = " + str(temp) + "  Press = " + str(pressure) + " hPa" + "  Alt = " + str(altitude), 'debug')
            return {'temp': temp, 'press': pressure, 'alt': altitude}
        except (IOError,TypeError) as e:
            logger.log("Error reading sensor " + self.sensor_name, 'error')

    def SensorDataProcessing(self,sensor_data):
        return sensor_data

if __name__ == '__main__':
    sensor = RealSensor()

    def do_exit(sig, stack):
        raise SystemExit('Exiting')

    signal.signal(signal.SIGINT, do_exit)
    signal.signal(signal.SIGUSR1, do_exit)

    signal.pause()


text:
namespace marisa {

template <typename T>
class scoped_ptr {
 public:
  scoped_ptr() : ptr_(NULL) {}
  explicit scoped_ptr(T *ptr) : ptr_(ptr) {}

  ~scoped_ptr() {
    delete ptr_;
  }

  void reset(T *ptr = NULL) {
    MARISA_THROW_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
    scoped_ptr(ptr).swap(*this);
  }

  T &operator*() const {
    MARISA_DEBUG_IF(ptr_ == NULL, MARISA_STATE_ERROR);
    return *ptr_;
  }
  T *operator->() const {
    MARISA_DEBUG_IF(ptr_ == NULL, MARISA_STATE_ERROR);
    return ptr_;
  }
  T *get() const {
    return ptr_;
  }

  void clear() {
    scoped_ptr().swap(*this);
  }
  void swap(scoped_ptr &rhs) {
    marisa::swap(ptr_, rhs.ptr_);
  }

 private:
  T *ptr_;

  // Disallows copy and assignment.
  scoped_ptr(const scoped_ptr &);
  scoped_ptr &operator=(const scoped_ptr &);
};

}  // namespace marisa

#endif  // MARISA_SCOPED_PTR_H_


text:
#pragma once
#include <aws/s3/S3_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/DateTime.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Xml
{
  class XmlNode;
} // namespace Xml
} // namespace Utils
namespace S3
{
namespace Model
{

  /**
   *
 In terms of implementation, a Bucket is a resource. An Amazon S3 bucket name
   * is globally unique, and the namespace is shared by all Amazon Web Services
   * accounts.

See Also:
   AWS API
   * Reference

   */
  class AWS_S3_API Bucket
  {
  public:
    Bucket();
    Bucket(const Aws::Utils::Xml::XmlNode& xmlNode);
    Bucket& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);

    void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const;

    /**
     *
The name of the bucket.

     */
    inline const Aws::String& GetName() const{ return m_name; }

    /**
     *
The name of the bucket.

     */
    inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }

    /**
     *
The name of the bucket.

     */
    inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }

    /**
     *
The name of the bucket.

     */
    inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }

    /**
     *
The name of the bucket.

     */
    inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }

    /**
     *
The name of the bucket.

     */
    inline Bucket& WithName(const Aws::String& value) { SetName(value); return *this;}

    /**
     *
The name of the bucket.

     */
    inline Bucket& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}

    /**
     *
The name of the bucket.

     */
    inline Bucket& WithName(const char* value) { SetName(value); return *this;}

    /**
     *
Date the bucket was created. This date can change when making changes to your
     * bucket, such as editing its bucket policy.

     */
    inline const Aws::Utils::DateTime& GetCreationDate() const{ return m_creationDate; }

    /**
     *
Date the bucket was created. This date can change when making changes to your
     * bucket, such as editing its bucket policy.

     */
    inline bool CreationDateHasBeenSet() const { return m_creationDateHasBeenSet; }

    /**
     *
Date the bucket was created. This date can change when making changes to your
     * bucket, such as editing its bucket policy.

     */
    inline void SetCreationDate(const Aws::Utils::DateTime& value) { m_creationDateHasBeenSet = true; m_creationDate = value; }

    /**
     *
Date the bucket was created. This date can change when making changes to your
     * bucket, such as editing its bucket policy.

     */
    inline void SetCreationDate(Aws::Utils::DateTime&& value) { m_creationDateHasBeenSet = true; m_creationDate = std::move(value); }

    /**
     *
Date the bucket was created. This date can change when making changes to your
     * bucket, such as editing its bucket policy.

     */
    inline Bucket& WithCreationDate(const Aws::Utils::DateTime& value) { SetCreationDate(value); return *this;}

    /**
     *
Date the bucket was created. This date can change when making changes to your
     * bucket, such as editing its bucket policy.

     */
    inline Bucket& WithCreationDate(Aws::Utils::DateTime&& value) { SetCreationDate(std::move(value)); return *this;}

  private:

    Aws::String m_name;
    bool m_nameHasBeenSet;

    Aws::Utils::DateTime m_creationDate;
    bool m_creationDateHasBeenSet;
  };

} // namespace Model
} // namespace S3
} // namespace Aws


text:
package org.apache.commons.validator.routines;

import java.text.Format;
import java.util.Locale;

/**
 *
Double Validation and Conversion routines (java.lang.Double).

 *
 *
This validator provides a number of methods for
 *    validating/converting a String value to
 *    a Double using java.text.NumberFormat
 *    to parse either:

 *

 *
using the default format for the default Locale

 *
using a specified pattern with the default Locale

 *
using the default format for a specified Locale

 *
using a specified pattern with a specified Locale

 *

 *
 *
Use one of the isValid() methods to just validate or
 *    one of the validate() methods to validate and receive a
 *    converted Double value.

 *
 *
Once a value has been successfully converted the following
 *    methods can be used to perform minimum, maximum and range checks:

 *

 *
minValue() checks whether the value is greater
 *           than or equal to a specified minimum.

 *
maxValue() checks whether the value is less
 *           than or equal to a specified maximum.

 *
isInRange() checks whether the value is within
 *           a specified range of values.

 *

 *
 *
So that the same mechanism used for parsing an input value
 *    for validation can be used to format output, corresponding
 *    format() methods are also provided. That is you can
 *    format either:

 *

 *
using the default format for the default Locale

 *
using a specified pattern with the default Locale

 *
using the default format for a specified Locale

 *
using a specified pattern with a specified Locale

 *

 *
 * @version $Revision$
 * @since Validator 1.3.0
 */
public class DoubleValidator extends AbstractNumberValidator {

    private static final long serialVersionUID = 5867946581318211330L;

    private static final DoubleValidator VALIDATOR = new DoubleValidator();

    /**
     * Return a singleton instance of this validator.
     * @return A singleton instance of the DoubleValidator.
     */
    public static DoubleValidator getInstance() {
        return VALIDATOR;
    }

    /**
     * Construct a strict instance.
     */
    public DoubleValidator() {
        this(true, STANDARD_FORMAT);
    }

    /**
     *
Construct an instance with the specified strict setting
     *    and format type.

     *
     *
The formatType specified what type of
     *    NumberFormat is created - valid types
     *    are:

     *

     *
AbstractNumberValidator.STANDARD_FORMAT -to create
     *           standard number formats (the default).

     *
AbstractNumberValidator.CURRENCY_FORMAT -to create
     *           currency number formats.

     *
AbstractNumberValidator.PERCENT_FORMAT -to create
     *           percent number formats (the default).

     *

     *
     * @param strict true if strict
     *        Format parsing should be used.
     * @param formatType The NumberFormat type to
     *        create for validation, default is STANDARD_FORMAT.
     */
    public DoubleValidator(boolean strict, int formatType) {
        super(strict, formatType, true);
    }

    /**
     *
Validate/convert a Double using the default
     *    Locale.
     *
     * @param value The value validation is being performed on.
     * @return The parsed Double if valid or null
     *  if invalid.
     */
    public Double validate(String value) {
        return (Double)parse(value, (String)null, (Locale)null);
    }

    /**
     *
Validate/convert a Double using the
     *    specified pattern.
     *
     * @param value The value validation is being performed on.
     * @param pattern The pattern used to validate the value against.
     * @return The parsed BigDecimal if valid or null if invalid.
     */
    public Double validate(String value, String pattern) {
        return (Double)parse(value, pattern, (Locale)null);
    }

    /**
     *
Validate/convert a Double using the
     *    specified Locale.
     *
     * @param value The value validation is being performed on.
     * @param locale The locale to use for the number format, system default if null.
     * @return The parsed Double if valid or null if invalid.
     */
    public Double validate(String value, Locale locale) {
        return (Double)parse(value, (String)null, locale);
    }

    /**
     *
Validate/convert a Double using the
     *    specified pattern and/ or Locale.
     *
     * @param value The value validation is being performed on.
     * @param pattern The pattern used to validate the value against, or the
     *        default for the Locale if null.
     * @param locale The locale to use for the date format, system default if null.
     * @return The parsed Double if valid or null if invalid.
     */
    public Double validate(String value, String pattern, Locale locale) {
        return (Double)parse(value, pattern, locale);
    }

    /**
     * Check if the value is within a specified range.
     *
     * @param value The Number value to check.
     * @param min The minimum value of the range.
     * @param max The maximum value of the range.
     * @return true if the value is within the
     *         specified range.
     */
    public boolean isInRange(double value, double min, double max) {
        return (value >= min && value <= max);
    }

    /**
     * Check if the value is within a specified range.
     *
     * @param value The Number value to check.
     * @param min The minimum value of the range.
     * @param max The maximum value of the range.
     * @return true if the value is within the
     *         specified range.
     */
    public boolean isInRange(Double value, double min, double max) {
        return isInRange(value.doubleValue(), min, max);
    }

    /**
     * Check if the value is greater than or equal to a minimum.
     *
     * @param value The value validation is being performed on.
     * @param min The minimum value.
     * @return true if the value is greater than
     *         or equal to the minimum.
     */
    public boolean minValue(double value, double min) {
        return (value >= min);
    }

    /**
     * Check if the value is greater than or equal to a minimum.
     *
     * @param value The value validation is being performed on.
     * @param min The minimum value.
     * @return true if the value is greater than
     *         or equal to the minimum.
     */
    public boolean minValue(Double value, double min) {
        return minValue(value.doubleValue(), min);
    }

    /**
     * Check if the value is less than or equal to a maximum.
     *
     * @param value The value validation is being performed on.
     * @param max The maximum value.
     * @return true if the value is less than
     *         or equal to the maximum.
     */
    public boolean maxValue(double value, double max) {
        return (value <= max);
    }

    /**
     * Check if the value is less than or equal to a maximum.
     *
     * @param value The value validation is being performed on.
     * @param max The maximum value.
     * @return true if the value is less than
     *         or equal to the maximum.
     */
    public boolean maxValue(Double value, double max) {
        return maxValue(value.doubleValue(), max);
    }

    /**
     * Convert the parsed value to a Double.
     *
     * @param value The parsed Number object created.
     * @param formatter The Format used to parse the value with.
     * @return The validated/converted Double value if valid
     * or null if invalid.
     */
    protected Object processParsedValue(Object value, Format formatter) {

        if (value instanceof Double) {
            return value;
        }
        return new Double(((Number)value).doubleValue());

    }
}


text:
title: What's the meaning of Euler's number
date: '2020-01-31T18:02:24.689Z'
description:
  Euler's number is a math star. However, unlike the number pi, its meaning is
  not so well known. In this post I talk about the way I tend to think about
  Euler's number.
---

In this post, and for something a bit different, I want to talk about Math. Math
is not the most loved discipline between students. However, I do feel that
people would enjoy it more if we improve the way it is usually taught.

It is not uncommon to find people, even with an academic engineering background,
not being able to tell the meaning of the number $\pi$. That fact is even more
impressive when we think that $\pi$ is nothing more than the ratio between the
circumference and the diameter of a circle.

Another poorly understood superstar number in Math is the so-called Euler's
number ($e$). Although not as easy to explain as the number $\pi$, it can be
taught in such a way that it becomes less mysterious. That is precisely the
subject of this blog post.

## How to define Euler's number?

To get things started, consider an exponential function of base $a$:

$$
f(x) = a^{x}
$$

We know that by definition its derivative is:

$$
\frac{d}{dx}a^{x} = \lim_{dx \rightarrow 0} \frac{a^{x+dx} - a^{x}}{dx}
$$

If we rearrange the terms a little bit we can see that the derivative of an
exponential function is the function itself times a constant:

$$
\frac{d}{dx}a^{x} = a^{x}\lim_{dx \rightarrow 0} \frac{a^{dx} - 1}{dx}
$$

Since $a$ is itself also constant, there is a specific number for which the
above constant is equal to $1$. If we call that number "$e$" we get:

$$
\lim_{dx \rightarrow 0} \frac{e^{dx} - 1}{dx} = 1
$$

It is not difficult to see that $e$ is:

$$
e = \lim_{dx \rightarrow 0} \left(1 + dx\right) ^ {1/dx}
$$

And finally, we can see that for an exponential function of base $e$:

$$
\frac{d}{dx}e^{x} = e^{x}
$$

In other words, an exponential function with base $e$ has a derivative that is
equal to itself. This means the slope of the function at any point is equal to
the value of the function at that same point.

As a side note, our definition of $e$ allows us to easily get approximations for
its value (by replacing $dx$ with small values). For instance, for $dx = 0.0001$
we calculate $e$ to be:

$$
e = \left( 1 + 0.0001 \right) ^ {1 / 0.0001} = 2.718145926824926
$$

It is already pretty close to the real value of $e$ ($2.718281828459045...$).

## So, what is Euler's number exactly?

As we can see, there is nothing mysterious about Euler's number. It is just the
number for which an exponential function derivative is equal to itself.
Actually, $e^{x}$ is the only function having this property and that's why in
Math, most of the exponential functions have base $e$.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <title>PowerShell - Update-Table - Rivet</title>
    <link href="silk.css" type="text/css" rel="stylesheet" />
	<link href="styles.css" type="text/css" rel="stylesheet" />

Get-Rivet

-Documentation

-ReleaseNotes

-Blog

Update-Table

Adds new columns or alters existing columns on an existing table.

Syntax

Update-Table [-Name] <String> [-SchemaName <String>] [-AddColumn <ScriptBlock>] [-UpdateColumn <ScriptBlock>] [-RemoveColumn <String[]>] [<CommonParameters>]

Description

The Update-Table operation adds, updates, and removes columns from a table. Columns are added, then updated, then removed.

The new columns for the table should be created and returned in a script block, which is passed as the value of the AddColumn parameter.  For example,

Update-Table 'Suits' -AddColumn {
    Bit 'HasVest' -NotNull -Default 0
}

The new definitions for existing columns should be created and returned in a script block, which is passed as the value of the UpdateColumn parameter.  For example,

Update-Table 'Suits' -UpdateColumn {
    VarChar 'Color' 256 -NotNull
}

Related Commands

bigint

binary

bit

char

date

datetime

datetime2

datetimeoffset

decimal

float

hierarchyid

int

money

nchar

numeric

nvarchar

real

rowversion

smalldatetime

smallint

smallmoney

sqlvariant

time

tinyint

uniqueidentifier

varbinary

varchar

xml

 Parameters

	Name
    Type
	Description
	Required?
	Pipeline Input
	Default Value

	Name
	String

The name of the table.

	true
	false

	SchemaName
	String

The table's schema.  Defaults to dbo.

	false
	false
    dbo

	AddColumn
	ScriptBlock

A script block that returns the new columns to add to a table.

	false
	false

	UpdateColumn
	ScriptBlock

A script block that returns new column definitions for existing columns

	false
	false

	RemoveColumn
	String[]

Columns to remove.

	false
	false

EXAMPLE 1

Update-Table -Name 'Ties' -AddColumn { VarChar 'Color' 50 -NotNull }

Adds a new Color column to the Ties table.  Pretty!

EXAMPLE 2

Update-Table -Name 'Ties' -UpdateColumn { VarChar 'Color' 100 -NotNull }

Demonstrates how to change the definition of an existing column.

EXAMPLE 3

Update-Table -Name 'Ties' -RemoveColumn 'Pattern','Manufacturer'

Demonstrates how to remove columns from a table.

		Copyright 2013 - 2016 Aaron Jensen.


text:
package org.openeos.activiti.integration.test;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.aop.SpringProxy;

public class Prueba {

	public void prueba() {
		ProcessEngine pe = ProcessEngines.getDefaultProcessEngine();
		SpringProcessEngineConfiguration
	}
}


text:
import os
import argparse
import baseline as bl

def main():
    parser = argparse.ArgumentParser(description='Score text with a language model.')
    parser.add_argument("--model", help='The path to either the .zip file (or dir) created by training', required=True)
    parser.add_argument("--text", help="The text to score as a string, or a path to a file", required=True)
    parser.add_argument("--backend", default="tf", help="the dl backend framework the model was trained with", choices=("tensorflow", "tf", "pytorch", "pyt"))
    parser.add_argument("--device", help="the device to run the model on")
    parser.add_argument("--prob", default="conditional", choices=("joint", "conditional"), help="Should you score the whole string (joint) or the score of the last token given the previous (conditional)")
    args = parser.parse_args()

    if os.path.exists(args.text) and os.path.isfile(args.text):
        with open(args.text, 'r') as f:
            text = [f.read.strip().split()]
    else:
        text = [args.text.split()]

    if len(text) > 1:
        raise ValueError(f"Currently only batch size 1 supported for LanguageModelServices, got {len(text)}")

    m = bl.LanguageModelService.load(args.model, backend=args.backend, device=args.device)

    if args.prob == 'joint':
        scores = m.joint(text)
        print(f"P({' '.join(text[0])}) = {scores[0]}")
    else:
        *context, targets = list(zip(*text))
        context = list(zip(*context))
        scores = m.conditional(context, target=targets)
        print(f"P({text[0][-1]} | {' '.join(text[0][:-1])}) = {scores[0]}")

if __name__ == '__main__':
    main()


text:
namespace net {

TEST(SpdyFrameBuilderTestVersionAgnostic, GetWritableBuffer) {
  const size_t builder_size = 10;
  SpdyFrameBuilder builder(builder_size);
  char* writable_buffer = builder.GetWritableBuffer(builder_size);
  memset(writable_buffer, ~1, builder_size);
  EXPECT_TRUE(builder.Seek(builder_size));
  scoped_ptr<SpdyFrame> frame(builder.take());
  char expected[builder_size];
  memset(expected, ~1, builder_size);
  EXPECT_EQ(base::StringPiece(expected, builder_size),
            base::StringPiece(frame->data(), builder_size));
}

class SpdyFrameBuilderTest : public ::testing::TestWithParam<SpdyMajorVersion> {
 protected:
  virtual void SetUp() {
    spdy_version_ = GetParam();
  }

  // Major version of SPDY protocol to be used.
  SpdyMajorVersion spdy_version_;
};

// All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
INSTANTIATE_TEST_CASE_P(SpdyFrameBuilderTests,
                        SpdyFrameBuilderTest,
                        ::testing::Values(SPDY2, SPDY3, SPDY4));

TEST_P(SpdyFrameBuilderTest, RewriteLength) {
  // Create an empty SETTINGS frame both via framer and manually via builder.
  // The one created via builder is initially given the incorrect length, but
  // then is corrected via RewriteLength().
  SpdyFramer framer(spdy_version_);
  SpdySettingsIR settings_ir;
  scoped_ptr<SpdyFrame> expected(framer.SerializeSettings(settings_ir));
  SpdyFrameBuilder builder(expected->size() + 1);
  if (spdy_version_ < 4) {
    builder.WriteControlFrameHeader(framer, SETTINGS, 0);
    builder.WriteUInt32(0);  // Write the number of settings.
  } else {
    builder.WriteFramePrefix(framer, SETTINGS, 0, 0);
  }
  EXPECT_TRUE(builder.GetWritableBuffer(1) != NULL);
  builder.RewriteLength(framer);
  scoped_ptr<SpdyFrame> built(builder.take());
  EXPECT_EQ(base::StringPiece(expected->data(), expected->size()),
            base::StringPiece(built->data(), expected->size()));
}

}  // namespace net


text:
@interface GIFViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@end


text: Scroll


text:
 **Stone Tell**

**School** divination; **Level** druid 6

**Casting Time** 10 minutes

**Components** V, S, DF

**Range** personal

**Target** you

**Duration** 1 min./level

You gain the ability to speak with stones, which relate to you who or what has touched them as well as revealing what is covered or concealed behind or under them. The stones relate complete descriptions if asked. A stone's perspective, perception, and knowledge may prevent the stone from providing the details you are looking for. You can speak with natural or worked stone.