text:
import routes
import six

from heat.api.openstack.v1 import actions
from heat.api.openstack.v1 import build_info
from heat.api.openstack.v1 import events
from heat.api.openstack.v1 import resources
from heat.api.openstack.v1 import services
from heat.api.openstack.v1 import software_configs
from heat.api.openstack.v1 import software_deployments
from heat.api.openstack.v1 import stacks
from heat.common import wsgi

class API(wsgi.Router):

    """WSGI router for Heat v1 REST API requests."""

    def __init__(self, conf, **local_conf):
        self.conf = conf
        mapper = routes.Mapper()
        default_resource = wsgi.Resource(wsgi.DefaultMethodController(),
                                         wsgi.JSONRequestDeserializer())

        def connect(controller, path_prefix, routes):
            """Connects list of routes to given controller with path_prefix.

            This function connects the list of routes to the given
            controller, prepending the given path_prefix. Then for each URL it
            finds which request methods aren't handled and configures those
            to return a 405 error. Finally, it adds a handler for the
            OPTIONS method to all URLs that returns the list of allowed
            methods with 204 status code.
            """
            # register the routes with the mapper, while keeping track of which
            # methods are defined for each URL
            urls = {}
            for r in routes:
                url = path_prefix + r['url']
                methods = r['method']
                if isinstance(methods, six.string_types):
                    methods = [methods]
                methods_str = ','.join(methods)
                mapper.connect(r['name'], url, controller=controller,
                               action=r['action'],
                               conditions={'method': methods_str})
                if url not in urls:
                    urls[url] = methods
                else:
                    urls[url] += methods

            # now register the missing methods to return 405s, and register
            # a handler for OPTIONS that returns the list of allowed methods
            for url, methods in urls.items():
                all_methods = ['HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE']
                missing_methods = [m for m in all_methods if m not in methods]
                allowed_methods_str = ','.join(methods)
                mapper.connect(url,
                               controller=default_resource,
                               action='reject',
                               allowed_methods=allowed_methods_str,
                               conditions={'method': missing_methods})
                if 'OPTIONS' not in methods:
                    mapper.connect(url,
                                   controller=default_resource,
                                   action='options',
                                   allowed_methods=allowed_methods_str,
                                   conditions={'method': 'OPTIONS'})

        # Stacks
        stacks_resource = stacks.create_resource(conf)
        connect(controller=stacks_resource,
                path_prefix='/{tenant_id}',
                routes=[
                    # Template handling
                    {
                        'name': 'template_validate',
                        'url': '/validate',
                        'action': 'validate_template',
                        'method': 'POST'
                    },
                    {
                        'name': 'resource_types',
                        'url': '/resource_types',
                        'action': 'list_resource_types',
                        'method': 'GET'
                    },
                    {
                        'name': 'resource_schema',
                        'url': '/resource_types/{type_name}',
                        'action': 'resource_schema',
                        'method': 'GET'
                    },
                    {
                        'name': 'generate_template',
                        'url': '/resource_types/{type_name}/template',
                        'action': 'generate_template',
                        'method': 'GET'
                    },

                    {
                        'name': 'template_versions',
                        'url': '/template_versions',
                        'action': 'list_template_versions',
                        'method': 'GET'
                    },

                    {
                        'name': 'template_functions',
                        'url': '/template_versions/{template_version}'
                               '/functions',
                        'action': 'list_template_functions',
                        'method': 'GET'
                    },

                    # Stack collection
                    {
                        'name': 'stack_index',
                        'url': '/stacks',
                        'action': 'index',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_create',
                        'url': '/stacks',
                        'action': 'create',
                        'method': 'POST'
                    },
                    {
                        'name': 'stack_preview',
                        'url': '/stacks/preview',
                        'action': 'preview',
                        'method': 'POST'
                    },
                    {
                        'name': 'stack_detail',
                        'url': '/stacks/detail',
                        'action': 'detail',
                        'method': 'GET'
                    },

                    # Stack data
                    {
                        'name': 'stack_lookup',
                        'url': '/stacks/{stack_name}',
                        'action': 'lookup',
                        'method': ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
                    },
                    # \x3A matches on a colon.
                    # Routes treats : specially in its regexp
                    {
                        'name': 'stack_lookup',
                        'url': r'/stacks/{stack_name:arn\x3A.*}',
                        'action': 'lookup',
                        'method': ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
                    },
                    {
                        'name': 'stack_lookup_subpath',
                        'url': '/stacks/{stack_name}/'
                               '{path:resources|events|template|actions'
                               '|environment|files}',
                        'action': 'lookup',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_lookup_subpath_post',
                        'url': '/stacks/{stack_name}/'
                               '{path:resources|events|template|actions}',
                        'action': 'lookup',
                        'method': 'POST'
                    },
                    {
                        'name': 'stack_show',
                        'url': '/stacks/{stack_name}/{stack_id}',
                        'action': 'show',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_lookup',
                        'url': '/stacks/{stack_name}/{stack_id}/template',
                        'action': 'template',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_lookup',
                        'url': '/stacks/{stack_name}/{stack_id}/environment',
                        'action': 'environment',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_lookup',
                        'url': '/stacks/{stack_name}/{stack_id}/files',
                        'action': 'files',
                        'method': 'GET'
                    },

                    # Stack update/delete
                    {
                        'name': 'stack_update',
                        'url': '/stacks/{stack_name}/{stack_id}',
                        'action': 'update',
                        'method': 'PUT'
                    },
                    {
                        'name': 'stack_update_patch',
                        'url': '/stacks/{stack_name}/{stack_id}',
                        'action': 'update_patch',
                        'method': 'PATCH'
                    },
                    {
                        'name': 'preview_stack_update',
                        'url': '/stacks/{stack_name}/{stack_id}/preview',
                        'action': 'preview_update',
                        'method': 'PUT'
                    },
                    {
                        'name': 'preview_stack_update_patch',
                        'url': '/stacks/{stack_name}/{stack_id}/preview',
                        'action': 'preview_update_patch',
                        'method': 'PATCH'
                    },
                    {
                        'name': 'stack_delete',
                        'url': '/stacks/{stack_name}/{stack_id}',
                        'action': 'delete',
                        'method': 'DELETE'
                    },

                    # Stack abandon
                    {
                        'name': 'stack_abandon',
                        'url': '/stacks/{stack_name}/{stack_id}/abandon',
                        'action': 'abandon',
                        'method': 'DELETE'
                    },
                    {
                        'name': 'stack_export',
                        'url': '/stacks/{stack_name}/{stack_id}/export',
                        'action': 'export',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_snapshot',
                        'url': '/stacks/{stack_name}/{stack_id}/snapshots',
                        'action': 'snapshot',
                        'method': 'POST'
                    },
                    {
                        'name': 'stack_snapshot_show',
                        'url': '/stacks/{stack_name}/{stack_id}/snapshots/'
                               '{snapshot_id}',
                        'action': 'show_snapshot',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_snapshot_delete',
                        'url': '/stacks/{stack_name}/{stack_id}/snapshots/'
                               '{snapshot_id}',
                        'action': 'delete_snapshot',
                        'method': 'DELETE'
                    },
                    {
                        'name': 'stack_list_snapshots',
                        'url': '/stacks/{stack_name}/{stack_id}/snapshots',
                        'action': 'list_snapshots',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_snapshot_restore',
                        'url': '/stacks/{stack_name}/{stack_id}/snapshots/'
                               '{snapshot_id}/restore',
                        'action': 'restore_snapshot',
                        'method': 'POST'
                    },

                    # Stack outputs
                    {
                        'name': 'stack_output_list',
                        'url': '/stacks/{stack_name}/{stack_id}/outputs',
                        'action': 'list_outputs',
                        'method': 'GET'
                    },
                    {
                        'name': 'stack_output_show',
                        'url': '/stacks/{stack_name}/{stack_id}/outputs/'
                               '{output_key}',
                        'action': 'show_output',
                        'method': 'GET'
                    }
                ])

        # Resources
        resources_resource = resources.create_resource(conf)
        stack_path = '/{tenant_id}/stacks/{stack_name}/{stack_id}'
        connect(controller=resources_resource, path_prefix=stack_path,
                routes=[
                    # Resource collection
                    {
                        'name': 'resource_index',
                        'url': '/resources',
                        'action': 'index',
                        'method': 'GET'
                    },

                    # Resource data
                    {
                        'name': 'resource_show',
                        'url': '/resources/{resource_name}',
                        'action': 'show',
                        'method': 'GET'
                    },
                    {
                        'name': 'resource_metadata_show',
                        'url': '/resources/{resource_name}/metadata',
                        'action': 'metadata',
                        'method': 'GET'
                    },
                    {
                        'name': 'resource_signal',
                        'url': '/resources/{resource_name}/signal',
                        'action': 'signal',
                        'method': 'POST'
                    },
                    {
                        'name': 'resource_mark_unhealthy',
                        'url': '/resources/{resource_name}',
                        'action': 'mark_unhealthy',
                        'method': 'PATCH'
                    }
                ])

        # Events
        events_resource = events.create_resource(conf)
        connect(controller=events_resource, path_prefix=stack_path,
                routes=[
                    # Stack event collection
                    {
                        'name': 'event_index_stack',
                        'url': '/events',
                        'action': 'index',
                        'method': 'GET'
                    },

                    # Resource event collection
                    {
                        'name': 'event_index_resource',
                        'url': '/resources/{resource_name}/events',
                        'action': 'index',
                        'method': 'GET'
                    },

                    # Event data
                    {
                        'name': 'event_show',
                        'url': '/resources/{resource_name}/events/{event_id}',
                        'action': 'show',
                        'method': 'GET'
                    }
                ])

        # Actions
        actions_resource = actions.create_resource(conf)
        connect(controller=actions_resource, path_prefix=stack_path,
                routes=[
                    {
                        'name': 'action_stack',
                        'url': '/actions',
                        'action': 'action',
                        'method': 'POST'
                    }
                ])

        # Info
        info_resource = build_info.create_resource(conf)
        connect(controller=info_resource, path_prefix='/{tenant_id}',
                routes=[
                    {
                        'name': 'build_info',
                        'url': '/build_info',
                        'action': 'build_info',
                        'method': 'GET'
                    }
                ])

        # Software configs
        software_config_resource = software_configs.create_resource(conf)
        connect(controller=software_config_resource,
                path_prefix='/{tenant_id}/software_configs',
                routes=[
                    {
                        'name': 'software_config_index',
                        'url': '',
                        'action': 'index',
                        'method': 'GET'
                    },
                    {
                        'name': 'software_config_create',
                        'url': '',
                        'action': 'create',
                        'method': 'POST'
                    },
                    {
                        'name': 'software_config_show',
                        'url': '/{config_id}',
                        'action': 'show',
                        'method': 'GET'
                    },
                    {
                        'name': 'software_config_delete',
                        'url': '/{config_id}',
                        'action': 'delete',
                        'method': 'DELETE'
                    }
                ])

        # Software deployments
        sd_resource = software_deployments.create_resource(conf)
        connect(controller=sd_resource,
                path_prefix='/{tenant_id}/software_deployments',
                routes=[
                    {
                        'name': 'software_deployment_index',
                        'url': '',
                        'action': 'index',
                        'method': 'GET'
                    },
                    {
                        'name': 'software_deployment_metadata',
                        'url': '/metadata/{server_id}',
                        'action': 'metadata',
                        'method': 'GET'
                    },
                    {
                        'name': 'software_deployment_create',
                        'url': '',
                        'action': 'create',
                        'method': 'POST'
                    },
                    {
                        'name': 'software_deployment_show',
                        'url': '/{deployment_id}',
                        'action': 'show',
                        'method': 'GET'
                    },
                    {
                        'name': 'software_deployment_update',
                        'url': '/{deployment_id}',
                        'action': 'update',
                        'method': 'PUT'
                    },
                    {
                        'name': 'software_deployment_delete',
                        'url': '/{deployment_id}',
                        'action': 'delete',
                        'method': 'DELETE'
                    }
                ])

        # Services
        service_resource = services.create_resource(conf)
        with mapper.submapper(
            controller=service_resource,
            path_prefix='/{tenant_id}/services'
        ) as sa_mapper:

            sa_mapper.connect("service_index",
                              "",
                              action="index",
                              conditions={'method': 'GET'})

        # now that all the routes are defined, add a handler for
        super(API, self).__init__(mapper)


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="com.swfarm.pub.framework.formula.bo.SimpleFormula"
		table="SimpleFormula">
		<id name="id" column="id">
			<generator class="sequence">
				<param name="sequence">SIMPLEFORMULA_ID_SEQ</param>
			</generator>
		</id>
		<property name="name" column="name" />
		<property name="formula" column="formula" />
		<property name="description" column="description" />
	</class>
</hibernate-mapping>

redpajama_set_name: RedPajamaGithub


text:
import ZzButtonComponent from 'zz-button/components/zz_button';

export default ZzButtonComponent;


text:
package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"path/filepath"
	"strings"
	"time"

	"github.com/BurntSushi/toml"
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/sqlite" // Needed for GORM
	homedir "github.com/mitchellh/go-homedir"
)

func main() {
	flag.Parse()

	if len(flag.Args()) < 1 {
		flag.Usage()
		return
	}

	if strings.ToLower(flag.Arg(0)) == "init" {
		if len(flag.Args()) < 2 {
			flag.Usage()
			return
		}
		target := flag.Arg(1)

		if err := Init(target); err != nil {
			fmt.Printf("%v.\n", err)
		}
		return
	}

	homePath, err := homedir.Dir()
	if err != nil {
		fmt.Printf("Can not retrieve home path for current user.\n")
		return
	}

	configPath := filepath.Join(homePath, ".config/stash/stash.conf")
	config, err := readConfig(configPath)
	if err != nil {
		fmt.Printf("%v\n", err)
		return
	}

	if err := initLogging(config.LogDir); err != nil {
		fmt.Printf("Can not access log file.\n")
		return
	}

	dbPath := filepath.Join(config.DataDir, "index.db")
	db, err := gorm.Open("sqlite3", dbPath)
	if err != nil {
		log.Printf("Main: %v at path %v\n", err, dbPath)
		fmt.Printf("Can not connect to database.\n")
		return
	}

	source := flag.Arg(0)
	switch strings.ToLower(flag.Arg(0)) {
	case "list":
		source = "."
		if len(flag.Args()) >= 2 {
			source = flag.Arg(1)
		}
		if err := List(db, source); err != nil {
			fmt.Printf("Could not list entries.\nMore info: %v\n", err)
			log.Printf("%v\n", err)
		}
	case "release":
		source = "/home/alex/.local/share/hidden"
		target := flag.Arg(1)
		destination := "."

		if len(flag.Args()) >= 3 {
			destination = flag.Arg(2)
		}
		if err := Release(db, source, target, destination); err != nil {
			fmt.Printf("Could not release.\nMore info: %v\n", err)
			log.Printf("%v\n", err)
		}
	case "stash":
		source = flag.Arg(1)
		fallthrough
	default:
		if err := Stash(db, source, "/home/alex/.local/share/hidden"); err != nil {
			fmt.Printf("Could not stash files.\nMore info: %v\n", err)
			log.Printf("%v\n", err)
		}
	}
}

func readConfig(path string) (*Config, error) {
	config := new(Config)
	if _, err := toml.DecodeFile(path, config); err != nil {
		return nil, fmt.Errorf("Could not read configuration file. Did you call \"stash init\"?")
	}
	return config, nil
}

func initLogging(path string) error {
	absPath, err := filepath.Abs(path)
	if err != nil {
		return err
	}
	path = filepath.Join(absPath, string(time.Now().Local().Format("2006-02-01")))
	path += ".log"

	file, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666)
	if err != nil {
		return fmt.Errorf("Can not create log file.")
	}

	log.SetOutput(file)
	log.Printf("Started logging to file %v\n", absPath)
	return nil
}


text:
package scala.net.yefremov.sleipnir.test.map

import com.linkedin.data.ByteString
import net.yefremov.sleipnir.test.CustomPoint
import scala.net.yefremov.sleipnir.test.{SimpleEnum, SleipnirSpec}

class MapTest extends SleipnirSpec {

  "Map types" should {

    "support custom names through typerefs" in {
      val map = Map("key" -> SimpleRecordValue)
      val wrapper = CustomNamedMap(map)
      wrapper.map must beEqualTo(map)
      val wrapperFromJson = checkSerialization(wrapper, """{"key":{"field":"string value"}}""")
      wrapperFromJson.map must beEqualTo(map)
    }

    "support primitive values" in {
      val map = Map("key" -> StringValue)
      val record = MapPrimitiveRecord(map)
      record.mapField must beEqualTo(map)
      val recordFromJson = checkSerialization(record, """{"mapField":{"key":"string value"}}""")
      recordFromJson.mapField must beEqualTo(map)
    }

    "support complex values" in {
      val map = Map("key" -> SimpleRecordValue)
      val record = MapComplexRecord(map)
      record.mapField must beEqualTo(map)
      val recordFromJson = checkSerialization(record, """{"mapField":{"key":{"field":"string value"}}}""")
      recordFromJson.mapField must beEqualTo(map)
    }

    "support enum values" in {
      val map = Map("key" -> SimpleEnum.Foo)
      val record = MapEnumRecord(map)
      record.mapField must beEqualTo(map)
      val recordFromJson = checkSerialization(record, """{"mapField":{"key":"Foo"}}""")
      recordFromJson.mapField must beEqualTo(map)
    }

    "support unknown enum values" in {
      val mapEnumRecordSchema = MapEnumRecord(Map()).schema()
      val recordFromJson = fromJson[MapEnumRecord]("""{"mapField":{"key":"Baz"}}""", mapEnumRecordSchema)
      recordFromJson.mapField must beEqualTo(Map("key" -> SimpleEnum.$Unknown))
    }

    "support bytes values" in {
      val map = Map("key" -> ByteString.copy(Array[Byte](100)))
      val record = MapBytesRecord(map)
      record.mapField must beEqualTo(map)
      val recordFromJson = checkSerialization(record, """{"mapField":{"key":"d"}}""")
      recordFromJson.mapField must beEqualTo(map)
    }

    "support array values" in {
      val map = Map("key" -> Seq(SimpleRecordValue))
      val wrapper = MapOfArrays(map)
      wrapper.map must beEqualTo(map)
      val wrapperFromJson = checkSerialization(wrapper, """{"key":[{"field":"string value"}]}""")
      wrapperFromJson.map must beEqualTo(map)
    }

    "support map values" in {
      val map = Map("key" -> Map("key" -> SimpleRecordValue))
      val wrapper = MapOfMaps(map)
      wrapper.map must beEqualTo(map)
      val wrapperFromJson = checkSerialization(wrapper, """{"key":{"key":{"field":"string value"}}}""")
      wrapperFromJson.map must beEqualTo(map)
    }

    "support custom java bindings" in {
      val customPointMap = Map("key" -> new CustomPoint(1, 2))
      val wrapper = MapCustomPoint(customPointMap)
      wrapper.map must beEqualTo(customPointMap)
      val wrapperFromJson = checkSerialization(wrapper, """{"key":"1,2"}""")
      wrapperFromJson.map must beEqualTo(customPointMap)
    }
  }

}


text:
package com.taobao.api.response;

import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.domain.Item;

import com.taobao.api.TaobaoResponse;

/**
 * TOP API: taobao.item.recommend.add response.
 *
 * @author auto create
 * @since 1.0, null
 */
public class ItemRecommendAddResponse extends TaobaoResponse {

	private static final long serialVersionUID = 1449581776652577456L;

	/**
	 * 被推荐的商品的信息
	 */
	@ApiField("item")
	private Item item;

	public void setItem(Item item) {
		this.item = item;
	}
	public Item getItem( ) {
		return this.item;
	}

}


text:
  <!DOCTYPE html>
<html>
  <head>
    <title>Examples • Checkpoints</title>
    <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
    <script src="node_modules/aframe-extras/dist/aframe-extras.controls.min.js"></script>
    <script src="node_modules/aframe-extras/dist/aframe-extras.min.js"></script>
    <script src="http://cdn.rawgit.com/donmccurdy/aframe-extras/v3.3.1/dist/aframe-extras.controls.min.js"></script>
    <script src="http://cdn.rawgit.com/donmccurdy/aframe-extras/v3.3.1/dist/aframe-extras.min.js"></script>
    <script src="bundle.js"></script>
   </head>
  <body>
    <a-scene>
      <a-assets>
        <a-mixin id="checkpoint"></a-mixin>
        <a-mixin id="checkpoint-hovered" color="#6CEEB5"></a-mixin>
      </a-assets>
<a-grid></a-grid>
      <!-- Player -->
      <a-entity camera
                look-controls
                universal-controls="movementControls: checkpoint"
                checkpoint-controls="mode: animate"
                position="0 1.764 0">
        <a-entity cursor="maxDistance: 30;fuse:true;fuseTimeout:100"
                  position="0 0 -1"
                  geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03;"
                  material="color: #CCC; shader: flat;">
                <a-animation begin="click" easing="ease-in" attribute="scale"  fill="backwards" from="0.1 0.1 0.1" to="1 1 1" dur="150"></a-animation>
                <a-animation begin="fusing" easing="ease-in" attribute="scale" fill="forwards" from="1 1 1" to="0.1 0.1 0.1" dur="1500"></a-animation>
        </a-entity>
      </a-entity>

      <!-- Terrain -->
      <a-grid></a-grid>

      <!-- Checkpoints -->
      <a-entity position="1 0 1">
        <a-cylinder checkpoint radius="1" height="0.1" position="0 0 -5.2" color="#39BB82"></a-cylinder>
        <a-cylinder checkpoint radius="1" height="0.1" position="3 0 0" color="#39BB82"></a-cylinder>
        <a-cylinder checkpoint radius="1" height="0.1" position="-3 0 0" color="#39BB82"></a-cylinder>
      </a-entity>

      <!-- Lighting -->
      <a-light type="ambient" color="#fff"></a-light>
    </a-scene>
  </body>
</html>