text:
package ent

import (
	"context"
	"errors"
	"fmt"
	"math"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/orestonce/ChessGame/ent/dsession"
	"github.com/orestonce/ChessGame/ent/predicate"
)

// DSessionQuery is the builder for querying DSession entities.
type DSessionQuery struct {
	config
	limit      *int
	offset     *int
	unique     *bool
	order      []OrderFunc
	fields     []string
	predicates []predicate.DSession
	// intermediate query (i.e. traversal path).
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}

// Where adds a new predicate for the DSessionQuery builder.
func (dq *DSessionQuery) Where(ps ...predicate.DSession) *DSessionQuery {
	dq.predicates = append(dq.predicates, ps...)
	return dq
}

// Limit adds a limit step to the query.
func (dq *DSessionQuery) Limit(limit int) *DSessionQuery {
	dq.limit = &limit
	return dq
}

// Offset adds an offset step to the query.
func (dq *DSessionQuery) Offset(offset int) *DSessionQuery {
	dq.offset = &offset
	return dq
}

// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func (dq *DSessionQuery) Unique(unique bool) *DSessionQuery {
	dq.unique = &unique
	return dq
}

// Order adds an order step to the query.
func (dq *DSessionQuery) Order(o ...OrderFunc) *DSessionQuery {
	dq.order = append(dq.order, o...)
	return dq
}

// First returns the first DSession entity from the query.
// Returns a *NotFoundError when no DSession was found.
func (dq *DSessionQuery) First(ctx context.Context) (*DSession, error) {
	nodes, err := dq.Limit(1).All(ctx)
	if err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nil, &NotFoundError{dsession.Label}
	}
	return nodes[0], nil
}

// FirstX is like First, but panics if an error occurs.
func (dq *DSessionQuery) FirstX(ctx context.Context) *DSession {
	node, err := dq.First(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return node
}

// FirstID returns the first DSession ID from the query.
// Returns a *NotFoundError when no DSession ID was found.
func (dq *DSessionQuery) FirstID(ctx context.Context) (id string, err error) {
	var ids []string
	if ids, err = dq.Limit(1).IDs(ctx); err != nil {
		return
	}
	if len(ids) == 0 {
		err = &NotFoundError{dsession.Label}
		return
	}
	return ids[0], nil
}

// FirstIDX is like FirstID, but panics if an error occurs.
func (dq *DSessionQuery) FirstIDX(ctx context.Context) string {
	id, err := dq.FirstID(ctx)
	if err != nil && !IsNotFound(err) {
		panic(err)
	}
	return id
}

// Only returns a single DSession entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when exactly one DSession entity is not found.
// Returns a *NotFoundError when no DSession entities are found.
func (dq *DSessionQuery) Only(ctx context.Context) (*DSession, error) {
	nodes, err := dq.Limit(2).All(ctx)
	if err != nil {
		return nil, err
	}
	switch len(nodes) {
	case 1:
		return nodes[0], nil
	case 0:
		return nil, &NotFoundError{dsession.Label}
	default:
		return nil, &NotSingularError{dsession.Label}
	}
}

// OnlyX is like Only, but panics if an error occurs.
func (dq *DSessionQuery) OnlyX(ctx context.Context) *DSession {
	node, err := dq.Only(ctx)
	if err != nil {
		panic(err)
	}
	return node
}

// OnlyID is like Only, but returns the only DSession ID in the query.
// Returns a *NotSingularError when exactly one DSession ID is not found.
// Returns a *NotFoundError when no entities are found.
func (dq *DSessionQuery) OnlyID(ctx context.Context) (id string, err error) {
	var ids []string
	if ids, err = dq.Limit(2).IDs(ctx); err != nil {
		return
	}
	switch len(ids) {
	case 1:
		id = ids[0]
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = &NotSingularError{dsession.Label}
	}
	return
}

// OnlyIDX is like OnlyID, but panics if an error occurs.
func (dq *DSessionQuery) OnlyIDX(ctx context.Context) string {
	id, err := dq.OnlyID(ctx)
	if err != nil {
		panic(err)
	}
	return id
}

// All executes the query and returns a list of DSessions.
func (dq *DSessionQuery) All(ctx context.Context) ([]*DSession, error) {
	if err := dq.prepareQuery(ctx); err != nil {
		return nil, err
	}
	return dq.sqlAll(ctx)
}

// AllX is like All, but panics if an error occurs.
func (dq *DSessionQuery) AllX(ctx context.Context) []*DSession {
	nodes, err := dq.All(ctx)
	if err != nil {
		panic(err)
	}
	return nodes
}

// IDs executes the query and returns a list of DSession IDs.
func (dq *DSessionQuery) IDs(ctx context.Context) ([]string, error) {
	var ids []string
	if err := dq.Select(dsession.FieldID).Scan(ctx, &ids); err != nil {
		return nil, err
	}
	return ids, nil
}

// IDsX is like IDs, but panics if an error occurs.
func (dq *DSessionQuery) IDsX(ctx context.Context) []string {
	ids, err := dq.IDs(ctx)
	if err != nil {
		panic(err)
	}
	return ids
}

// Count returns the count of the given query.
func (dq *DSessionQuery) Count(ctx context.Context) (int, error) {
	if err := dq.prepareQuery(ctx); err != nil {
		return 0, err
	}
	return dq.sqlCount(ctx)
}

// CountX is like Count, but panics if an error occurs.
func (dq *DSessionQuery) CountX(ctx context.Context) int {
	count, err := dq.Count(ctx)
	if err != nil {
		panic(err)
	}
	return count
}

// Exist returns true if the query has elements in the graph.
func (dq *DSessionQuery) Exist(ctx context.Context) (bool, error) {
	if err := dq.prepareQuery(ctx); err != nil {
		return false, err
	}
	return dq.sqlExist(ctx)
}

// ExistX is like Exist, but panics if an error occurs.
func (dq *DSessionQuery) ExistX(ctx context.Context) bool {
	exist, err := dq.Exist(ctx)
	if err != nil {
		panic(err)
	}
	return exist
}

// Clone returns a duplicate of the DSessionQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (dq *DSessionQuery) Clone() *DSessionQuery {
	if dq == nil {
		return nil
	}
	return &DSessionQuery{
		config:     dq.config,
		limit:      dq.limit,
		offset:     dq.offset,
		order:      append([]OrderFunc{}, dq.order...),
		predicates: append([]predicate.DSession{}, dq.predicates...),
		// clone intermediate query.
		sql:  dq.sql.Clone(),
		path: dq.path,
	}
}

// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
//	var v []struct {
//		UserID string `json:"user_id,omitempty"`
//		Count int `json:"count,omitempty"`
//	}
//
//	client.DSession.Query().
//		GroupBy(dsession.FieldUserID).
//		Aggregate(ent.Count()).
//		Scan(ctx, &v)
//
func (dq *DSessionQuery) GroupBy(field string, fields ...string) *DSessionGroupBy {
	group := &DSessionGroupBy{config: dq.config}
	group.fields = append([]string{field}, fields...)
	group.path = func(ctx context.Context) (prev *sql.Selector, err error) {
		if err := dq.prepareQuery(ctx); err != nil {
			return nil, err
		}
		return dq.sqlQuery(ctx), nil
	}
	return group
}

// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
//	var v []struct {
//		UserID string `json:"user_id,omitempty"`
//	}
//
//	client.DSession.Query().
//		Select(dsession.FieldUserID).
//		Scan(ctx, &v)
//
func (dq *DSessionQuery) Select(fields ...string) *DSessionSelect {
	dq.fields = append(dq.fields, fields...)
	return &DSessionSelect{DSessionQuery: dq}
}

func (dq *DSessionQuery) prepareQuery(ctx context.Context) error {
	for _, f := range dq.fields {
		if !dsession.ValidColumn(f) {
			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
		}
	}
	if dq.path != nil {
		prev, err := dq.path(ctx)
		if err != nil {
			return err
		}
		dq.sql = prev
	}
	return nil
}

func (dq *DSessionQuery) sqlAll(ctx context.Context) ([]*DSession, error) {
	var (
		nodes = []*DSession{}
		_spec = dq.querySpec()
	)
	_spec.ScanValues = func(columns []string) ([]interface{}, error) {
		node := &DSession{config: dq.config}
		nodes = append(nodes, node)
		return node.scanValues(columns)
	}
	_spec.Assign = func(columns []string, values []interface{}) error {
		if len(nodes) == 0 {
			return fmt.Errorf("ent: Assign called without calling ScanValues")
		}
		node := nodes[len(nodes)-1]
		return node.assignValues(columns, values)
	}
	if err := sqlgraph.QueryNodes(ctx, dq.driver, _spec); err != nil {
		return nil, err
	}
	if len(nodes) == 0 {
		return nodes, nil
	}
	return nodes, nil
}

func (dq *DSessionQuery) sqlCount(ctx context.Context) (int, error) {
	_spec := dq.querySpec()
	return sqlgraph.CountNodes(ctx, dq.driver, _spec)
}

func (dq *DSessionQuery) sqlExist(ctx context.Context) (bool, error) {
	n, err := dq.sqlCount(ctx)
	if err != nil {
		return false, fmt.Errorf("ent: check existence: %w", err)
	}
	return n > 0, nil
}

func (dq *DSessionQuery) querySpec() *sqlgraph.QuerySpec {
	_spec := &sqlgraph.QuerySpec{
		Node: &sqlgraph.NodeSpec{
			Table:   dsession.Table,
			Columns: dsession.Columns,
			ID: &sqlgraph.FieldSpec{
				Type:   field.TypeString,
				Column: dsession.FieldID,
			},
		},
		From:   dq.sql,
		Unique: true,
	}
	if unique := dq.unique; unique != nil {
		_spec.Unique = *unique
	}
	if fields := dq.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, dsession.FieldID)
		for i := range fields {
			if fields[i] != dsession.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
			}
		}
	}
	if ps := dq.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if limit := dq.limit; limit != nil {
		_spec.Limit = *limit
	}
	if offset := dq.offset; offset != nil {
		_spec.Offset = *offset
	}
	if ps := dq.order; len(ps) > 0 {
		_spec.Order = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	return _spec
}

func (dq *DSessionQuery) sqlQuery(ctx context.Context) *sql.Selector {
	builder := sql.Dialect(dq.driver.Dialect())
	t1 := builder.Table(dsession.Table)
	columns := dq.fields
	if len(columns) == 0 {
		columns = dsession.Columns
	}
	selector := builder.Select(t1.Columns(columns...)...).From(t1)
	if dq.sql != nil {
		selector = dq.sql
		selector.Select(selector.Columns(columns...)...)
	}
	for _, p := range dq.predicates {
		p(selector)
	}
	for _, p := range dq.order {
		p(selector)
	}
	if offset := dq.offset; offset != nil {
		// limit is mandatory for offset clause. We start
		// with default value, and override it below if needed.
		selector.Offset(*offset).Limit(math.MaxInt32)
	}
	if limit := dq.limit; limit != nil {
		selector.Limit(*limit)
	}
	return selector
}

// DSessionGroupBy is the group-by builder for DSession entities.
type DSessionGroupBy struct {
	config
	fields []string
	fns    []AggregateFunc
	// intermediate query (i.e. traversal path).
	sql  *sql.Selector
	path func(context.Context) (*sql.Selector, error)
}

// Aggregate adds the given aggregation functions to the group-by query.
func (dgb *DSessionGroupBy) Aggregate(fns ...AggregateFunc) *DSessionGroupBy {
	dgb.fns = append(dgb.fns, fns...)
	return dgb
}

// Scan applies the group-by query and scans the result into the given value.
func (dgb *DSessionGroupBy) Scan(ctx context.Context, v interface{}) error {
	query, err := dgb.path(ctx)
	if err != nil {
		return err
	}
	dgb.sql = query
	return dgb.sqlScan(ctx, v)
}

// ScanX is like Scan, but panics if an error occurs.
func (dgb *DSessionGroupBy) ScanX(ctx context.Context, v interface{}) {
	if err := dgb.Scan(ctx, v); err != nil {
		panic(err)
	}
}

// Strings returns list of strings from group-by.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Strings(ctx context.Context) ([]string, error) {
	if len(dgb.fields) > 1 {
		return nil, errors.New("ent: DSessionGroupBy.Strings is not achievable when grouping more than 1 field")
	}
	var v []string
	if err := dgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// StringsX is like Strings, but panics if an error occurs.
func (dgb *DSessionGroupBy) StringsX(ctx context.Context) []string {
	v, err := dgb.Strings(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// String returns a single string from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) String(ctx context.Context) (_ string, err error) {
	var v []string
	if v, err = dgb.Strings(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionGroupBy.Strings returned %d results when one was expected", len(v))
	}
	return
}

// StringX is like String, but panics if an error occurs.
func (dgb *DSessionGroupBy) StringX(ctx context.Context) string {
	v, err := dgb.String(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Ints returns list of ints from group-by.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Ints(ctx context.Context) ([]int, error) {
	if len(dgb.fields) > 1 {
		return nil, errors.New("ent: DSessionGroupBy.Ints is not achievable when grouping more than 1 field")
	}
	var v []int
	if err := dgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// IntsX is like Ints, but panics if an error occurs.
func (dgb *DSessionGroupBy) IntsX(ctx context.Context) []int {
	v, err := dgb.Ints(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Int returns a single int from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Int(ctx context.Context) (_ int, err error) {
	var v []int
	if v, err = dgb.Ints(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionGroupBy.Ints returned %d results when one was expected", len(v))
	}
	return
}

// IntX is like Int, but panics if an error occurs.
func (dgb *DSessionGroupBy) IntX(ctx context.Context) int {
	v, err := dgb.Int(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Float64s returns list of float64s from group-by.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Float64s(ctx context.Context) ([]float64, error) {
	if len(dgb.fields) > 1 {
		return nil, errors.New("ent: DSessionGroupBy.Float64s is not achievable when grouping more than 1 field")
	}
	var v []float64
	if err := dgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// Float64sX is like Float64s, but panics if an error occurs.
func (dgb *DSessionGroupBy) Float64sX(ctx context.Context) []float64 {
	v, err := dgb.Float64s(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Float64 returns a single float64 from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Float64(ctx context.Context) (_ float64, err error) {
	var v []float64
	if v, err = dgb.Float64s(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionGroupBy.Float64s returned %d results when one was expected", len(v))
	}
	return
}

// Float64X is like Float64, but panics if an error occurs.
func (dgb *DSessionGroupBy) Float64X(ctx context.Context) float64 {
	v, err := dgb.Float64(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Bools returns list of bools from group-by.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Bools(ctx context.Context) ([]bool, error) {
	if len(dgb.fields) > 1 {
		return nil, errors.New("ent: DSessionGroupBy.Bools is not achievable when grouping more than 1 field")
	}
	var v []bool
	if err := dgb.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// BoolsX is like Bools, but panics if an error occurs.
func (dgb *DSessionGroupBy) BoolsX(ctx context.Context) []bool {
	v, err := dgb.Bools(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Bool returns a single bool from a group-by query.
// It is only allowed when executing a group-by query with one field.
func (dgb *DSessionGroupBy) Bool(ctx context.Context) (_ bool, err error) {
	var v []bool
	if v, err = dgb.Bools(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionGroupBy.Bools returned %d results when one was expected", len(v))
	}
	return
}

// BoolX is like Bool, but panics if an error occurs.
func (dgb *DSessionGroupBy) BoolX(ctx context.Context) bool {
	v, err := dgb.Bool(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

func (dgb *DSessionGroupBy) sqlScan(ctx context.Context, v interface{}) error {
	for _, f := range dgb.fields {
		if !dsession.ValidColumn(f) {
			return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
		}
	}
	selector := dgb.sqlQuery()
	if err := selector.Err(); err != nil {
		return err
	}
	rows := &sql.Rows{}
	query, args := selector.Query()
	if err := dgb.driver.Query(ctx, query, args, rows); err != nil {
		return err
	}
	defer rows.Close()
	return sql.ScanSlice(rows, v)
}

func (dgb *DSessionGroupBy) sqlQuery() *sql.Selector {
	selector := dgb.sql.Select()
	aggregation := make([]string, 0, len(dgb.fns))
	for _, fn := range dgb.fns {
		aggregation = append(aggregation, fn(selector))
	}
	// If no columns were selected in a custom aggregation function, the default
	// selection is the fields used for "group-by", and the aggregation functions.
	if len(selector.SelectedColumns()) == 0 {
		columns := make([]string, 0, len(dgb.fields)+len(dgb.fns))
		for _, f := range dgb.fields {
			columns = append(columns, selector.C(f))
		}
		for _, c := range aggregation {
			columns = append(columns, c)
		}
		selector.Select(columns...)
	}
	return selector.GroupBy(selector.Columns(dgb.fields...)...)
}

// DSessionSelect is the builder for selecting fields of DSession entities.
type DSessionSelect struct {
	*DSessionQuery
	// intermediate query (i.e. traversal path).
	sql *sql.Selector
}

// Scan applies the selector query and scans the result into the given value.
func (ds *DSessionSelect) Scan(ctx context.Context, v interface{}) error {
	if err := ds.prepareQuery(ctx); err != nil {
		return err
	}
	ds.sql = ds.DSessionQuery.sqlQuery(ctx)
	return ds.sqlScan(ctx, v)
}

// ScanX is like Scan, but panics if an error occurs.
func (ds *DSessionSelect) ScanX(ctx context.Context, v interface{}) {
	if err := ds.Scan(ctx, v); err != nil {
		panic(err)
	}
}

// Strings returns list of strings from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Strings(ctx context.Context) ([]string, error) {
	if len(ds.fields) > 1 {
		return nil, errors.New("ent: DSessionSelect.Strings is not achievable when selecting more than 1 field")
	}
	var v []string
	if err := ds.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// StringsX is like Strings, but panics if an error occurs.
func (ds *DSessionSelect) StringsX(ctx context.Context) []string {
	v, err := ds.Strings(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// String returns a single string from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) String(ctx context.Context) (_ string, err error) {
	var v []string
	if v, err = ds.Strings(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionSelect.Strings returned %d results when one was expected", len(v))
	}
	return
}

// StringX is like String, but panics if an error occurs.
func (ds *DSessionSelect) StringX(ctx context.Context) string {
	v, err := ds.String(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Ints(ctx context.Context) ([]int, error) {
	if len(ds.fields) > 1 {
		return nil, errors.New("ent: DSessionSelect.Ints is not achievable when selecting more than 1 field")
	}
	var v []int
	if err := ds.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// IntsX is like Ints, but panics if an error occurs.
func (ds *DSessionSelect) IntsX(ctx context.Context) []int {
	v, err := ds.Ints(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Int returns a single int from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Int(ctx context.Context) (_ int, err error) {
	var v []int
	if v, err = ds.Ints(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionSelect.Ints returned %d results when one was expected", len(v))
	}
	return
}

// IntX is like Int, but panics if an error occurs.
func (ds *DSessionSelect) IntX(ctx context.Context) int {
	v, err := ds.Int(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Float64s(ctx context.Context) ([]float64, error) {
	if len(ds.fields) > 1 {
		return nil, errors.New("ent: DSessionSelect.Float64s is not achievable when selecting more than 1 field")
	}
	var v []float64
	if err := ds.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// Float64sX is like Float64s, but panics if an error occurs.
func (ds *DSessionSelect) Float64sX(ctx context.Context) []float64 {
	v, err := ds.Float64s(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Float64(ctx context.Context) (_ float64, err error) {
	var v []float64
	if v, err = ds.Float64s(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionSelect.Float64s returned %d results when one was expected", len(v))
	}
	return
}

// Float64X is like Float64, but panics if an error occurs.
func (ds *DSessionSelect) Float64X(ctx context.Context) float64 {
	v, err := ds.Float64(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Bools(ctx context.Context) ([]bool, error) {
	if len(ds.fields) > 1 {
		return nil, errors.New("ent: DSessionSelect.Bools is not achievable when selecting more than 1 field")
	}
	var v []bool
	if err := ds.Scan(ctx, &v); err != nil {
		return nil, err
	}
	return v, nil
}

// BoolsX is like Bools, but panics if an error occurs.
func (ds *DSessionSelect) BoolsX(ctx context.Context) []bool {
	v, err := ds.Bools(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

// Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (ds *DSessionSelect) Bool(ctx context.Context) (_ bool, err error) {
	var v []bool
	if v, err = ds.Bools(ctx); err != nil {
		return
	}
	switch len(v) {
	case 1:
		return v[0], nil
	case 0:
		err = &NotFoundError{dsession.Label}
	default:
		err = fmt.Errorf("ent: DSessionSelect.Bools returned %d results when one was expected", len(v))
	}
	return
}

// BoolX is like Bool, but panics if an error occurs.
func (ds *DSessionSelect) BoolX(ctx context.Context) bool {
	v, err := ds.Bool(ctx)
	if err != nil {
		panic(err)
	}
	return v
}

func (ds *DSessionSelect) sqlScan(ctx context.Context, v interface{}) error {
	rows := &sql.Rows{}
	query, args := ds.sql.Query()
	if err := ds.driver.Query(ctx, query, args, rows); err != nil {
		return err
	}
	defer rows.Close()
	return sql.ScanSlice(rows, v)
}


text:
package com.amazonaws.services.iotanalytics.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.iotanalytics.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * ParquetConfiguration JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ParquetConfigurationJsonUnmarshaller implements Unmarshaller<ParquetConfiguration, JsonUnmarshallerContext> {

    public ParquetConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception {
        ParquetConfiguration parquetConfiguration = new ParquetConfiguration();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("schemaDefinition", targetDepth)) {
                    context.nextToken();
                    parquetConfiguration.setSchemaDefinition(SchemaDefinitionJsonUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return parquetConfiguration;
    }

    private static ParquetConfigurationJsonUnmarshaller instance;

    public static ParquetConfigurationJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new ParquetConfigurationJsonUnmarshaller();
        return instance;
    }
}

redpajama_set_name: RedPajamaGithub


text:
var BitField = require('bitfield')
var EventEmitter = require('events').EventEmitter
var hat = require('hat')
var RarityMap = require('../lib/rarity-map')
var Swarm = require('../lib/swarm')
var test = require('tape')

var infoHash = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36'
var peerId1 = new Buffer('-WW0001-' + hat(48))

test('Rarity map usage', function (t) {
  t.plan(16)

  var swarm = new Swarm(infoHash, peerId1)
  var numPieces = 4
  swarm.wires = [ new EventEmitter(), new EventEmitter() ]
  swarm.wires.forEach(function (wire) {
    wire.peerPieces = new BitField(numPieces)
  })
  var rarityMap = new RarityMap(swarm, numPieces)

  function validateInitial () {
    // note that getRarestPiece will return a random piece since they're all equal
    // so repeat the test several times to reasonably ensure its correctness.
    var piece = rarityMap.getRarestPiece()
    t.ok(piece >= 0 && piece < numPieces)

    piece = rarityMap.getRarestPiece()
    t.ok(piece >= 0 && piece < numPieces)

    piece = rarityMap.getRarestPiece()
    t.ok(piece >= 0 && piece < numPieces)

    piece = rarityMap.getRarestPiece()
    t.ok(piece >= 0 && piece < numPieces)
  }

  // test initial / empty case
  validateInitial()

  rarityMap.recalculate()

  // test initial / empty case after recalc
  validateInitial()

  function setPiece (wire, index) {
    wire.peerPieces.set(index)
    wire.emit('have', index)
  }

  setPiece(swarm.wires[0], 0)
  setPiece(swarm.wires[1], 0)

  setPiece(swarm.wires[0], 1)
  setPiece(swarm.wires[1], 3)

  // test rarest piece after setting pieces and handling 'have' events
  var piece = rarityMap.getRarestPiece()
  t.equal(piece, 2)

  rarityMap.recalculate()

  // test rarest piece after recalc to ensure its the same
  piece = rarityMap.getRarestPiece()
  t.equal(piece, 2)

  function addWire () {
    var wire = new EventEmitter()
    wire.peerPieces = new BitField(numPieces)
    wire.peerPieces.set(1)
    wire.peerPieces.set(2)
    swarm.wires.push(wire)
    swarm.emit('wire', wire)
  }

  addWire()
  addWire()

  // test rarest piece after adding wires
  piece = rarityMap.getRarestPiece()
  t.equal(piece, 3)

  rarityMap.recalculate()

  // test rarest piece after adding wires and recalc
  piece = rarityMap.getRarestPiece()
  t.equal(piece, 3)

  function removeWire (index) {
    var wire = swarm.wires.splice(index, 1)[0]
    wire.emit('close')
  }

  removeWire(3)
  removeWire(1)

  // test rarest piece after removing wires
  piece = rarityMap.getRarestPiece()
  t.equal(piece, 3)

  rarityMap.recalculate()

  // test rarest piece after removing wires and recalc
  piece = rarityMap.getRarestPiece()
  t.equal(piece, 3)

  // test piece filter func
  piece = rarityMap.getRarestPiece(function (i) { return i <= 1 })
  t.equal(piece, 0)

  piece = rarityMap.getRarestPiece(function (i) { return i === 1 || i === 2 })
  t.equal(piece, 2)
})


text:
import sys
import os

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

apikey=os.getenv('EXOSCALE_API_KEY')
secretkey=os.getenv('EXOSCALE_SECRET_KEY')

Driver = get_driver(Provider.EXOSCALE)
conn=Driver(key=apikey,secret=secretkey)

#Convenience function
def getimage(id):
    return [i for i in conn.list_images() if i.id == id][0]
def getsize(id):
    return [i for i in conn.list_sizes() if i.id == id][0]

#This is a coreos template with a 10GB disk
image=getimage('d2857804-034c-4973-8944-fb1639eafca5')
#This is a micro instance
size=getsize('71004023-bb72-4a97-b1e9-bc66dfce9470')

#Reads cloud config file
userdata = "\n".join(open('./nodes/etcd.yml').readlines())

# Replace the name of the key with what you created and make sure you created an etcd security group
name = 'etcd'
for i in range(5):
    name = name + '-' + str(i)
    conn.create_node(image=image,size=size,ex_keyname='exoscale',ex_security_groups=['etcd'],ex_display_name=name, ex_userdata=userdata)


text:
<?xml version="1.0"?>
<doc>
<assembly>
<name>
dotAPK
</name>
</assembly>
<members>
<member name="T:dotAPK.My.Resources.Resources">
<summary>
  A strongly-typed resource class, for looking up localized strings, etc.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.ResourceManager">
<summary>
  Returns the cached ResourceManager instance used by this class.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.Culture">
<summary>
  Overrides the current thread's CurrentUICulture property for all
  resource lookups using this strongly typed resource class.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.ac">
<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.battery">
<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.bottom_layer">
<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.top_layer">
<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.usb">
<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member>
<member name="P:dotAPK.My.Resources.Resources.wireless">
<summary>
  Looks up a localized resource of type System.Drawing.Bitmap.
</summary>
</member>
</members>
</doc>


text:
package edu.umd.cs.findbugs;

import edu.umd.cs.findbugs.ba.XMethod;

public class ProgramPoint {
    public ProgramPoint(BytecodeScanningDetector v) {
        method = v.getXMethod();
        pc = v.getPC();
    }

    public final XMethod method;

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((method == null) ? 0 : method.hashCode());
        result = prime * result + pc;
        return result;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ProgramPoint other = (ProgramPoint) obj;
        if (method == null) {
            if (other.method != null)
                return false;
        } else if (!method.equals(other.method))
            return false;
        if (pc != other.pc)
            return false;
        return true;
    }

    public final int pc;

    public MethodAnnotation getMethodAnnotation() {
        return MethodAnnotation.fromXMethod(method);
    }

    public SourceLineAnnotation getSourceLineAnnotation() {
        return SourceLineAnnotation.fromVisitedInstruction(method.getMethodDescriptor(), pc);
    }

    @Override
    public String toString() {
        return method.toString() + ":" + pc;
    }
}


text:
/**
 * All [view].js methods must have this metod defined!
 *
 * @param callback
 */
function modelAndView(context, callback) {
    byteport_client.get_namespaces(callback);
}

/***
 * GUI Event handlers
 *
 * DEMO:
 * Here we request a soft update through updateView() and not a full page reload (as a redirect would force)
 *
 * This will refresh the contents of the main div

 defined in application.html
 *
 */
function onGetNamespacesClick() {
    updateView('home');
}


text:
define(function() { return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}

/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }

	var _libFormatL20nAstParser = __webpack_require__(1);

	exports.L20nParser = _interopRequire(_libFormatL20nAstParser);

/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

	var _ast = __webpack_require__(2);

	var _ast2 = _interopRequireDefault(_ast);

	var _errors = __webpack_require__(3);

	var MAX_PLACEABLES = 100;

	exports.default = {
	  parse: function (env, string) {
	    var pos = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];

	    this._source = string;
	    this._index = 0;
	    this._length = string.length;
	    this._curEntryStart = 0;
	    this._config = {
	      pos: pos
	    };

	    if (pos !== true) {
	      _ast2.default.Node.prototype.setPosition = function () {};
	    }
	    return this.getResource(pos);
	  },

	  getResource: function () {
	    var resource = new _ast2.default.Resource();
	    resource.setPosition(0, this._length);
	    resource._errors = [];

	    this.getWS();
	    while (this._index < this._length) {
	      try {
	        resource.body.push(this.getEntry());
	      } catch (e) {
	        if (e instanceof _errors.L10nError) {
	          resource._errors.push(e);
	          resource.body.push(this.getJunkEntry());
	        } else {
	          throw e;
	        }
	      }
	      if (this._index < this._length) {
	        this.getWS();
	      }
	    }

	    return resource;
	  },

	  getEntry: function () {
	    this._curEntryStart = this._index;

	    if (this._source[this._index] === '<') {
	      ++this._index;
	      var id = this.getIdentifier();
	      if (this._source[this._index] === '[') {
	        ++this._index;
	        return this.getEntity(id, this.getItemList(this.getExpression, ']'));
	      }
	      return this.getEntity(id);
	    }

	    if (this._source.startsWith('/*', this._index)) {
	      return this.getComment();
	    }

	    throw this.error('Invalid entry');
	  },

	  getEntity: function (id, index) {
	    if (!this.getRequiredWS()) {
	      throw this.error('Expected white space');
	    }

	    var ch = this._source.charAt(this._index);
	    var value = this.getValue(ch, index === undefined);
	    var attrs = undefined;

	    if (value === null) {
	      if (ch === '>') {
	        throw this.error('Expected ">"');
	      }
	      attrs = this.getAttributes();
	    } else {
	      var ws1 = this.getRequiredWS();
	      if (this._source[this._index] !== '>') {
	        if (!ws1) {
	          throw this.error('Expected ">"');
	        }
	        attrs = this.getAttributes();
	      }
	    }

	    ++this._index;

	    var entity = new _ast2.default.Entity(id, value, index, attrs);
	    entity.setPosition(this._curEntryStart, this._index);
	    return entity;
	  },

	  getValue: function () {
	    var ch = arguments.length <= 0 || arguments[0] === undefined ? this._source[this._index] : arguments[0];
	    var optional = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];

	    switch (ch) {
	      case '\'':
	      case '"':
	        return this.getString(ch, 1);
	      case '{':
	        return this.getHash();
	    }

	    if (!optional) {
	      throw this.error('Unknown value type');
	    }
	    return null;
	  },

	  getWS: function () {
	    var cc = this._source.charCodeAt(this._index);

	    while (cc === 32 || cc === 10 || cc === 9 || cc === 13) {
	      cc = this._source.charCodeAt(++this._index);
	    }
	  },

	  getRequiredWS: function () {
	    var pos = this._index;
	    var cc = this._source.charCodeAt(pos);

	    while (cc === 32 || cc === 10 || cc === 9 || cc === 13) {
	      cc = this._source.charCodeAt(++this._index);
	    }
	    return this._index !== pos;
	  },

	  getIdentifier: function () {
	    var start = this._index;
	    var cc = this._source.charCodeAt(this._index);

	    if (cc >= 97 && cc <= 122 || cc >= 65 && cc <= 90 || cc === 95) {
	      cc = this._source.charCodeAt(++this._index);
	    } else {
	      throw this.error('Identifier has to start with [a-zA-Z_]');
	    }

	    while (cc >= 97 && cc <= 122 || cc >= 65 && cc <= 90 || cc >= 48 && cc <= 57 || cc === 95) {
	      cc = this._source.charCodeAt(++this._index);
	    }

	    var id = new _ast2.default.Identifier(this._source.slice(start, this._index));
	    id.setPosition(start, this._index);
	    return id;
	  },

	  getUnicodeChar: function () {
	    for (var i = 0; i < 4; i++) {
	      var cc = this._source.charCodeAt(++this._index);
	      if (cc > 96 && cc < 103 || cc > 64 && cc < 71 || cc > 47 && cc < 58) {
	        continue;
	      }
	      throw this.error('Illegal unicode escape sequence');
	    }
	    return '\\u' + this._source.slice(this._index - 3, this._index + 1);
	  },

	  getString: function (opchar, opcharLen) {
	    var body = [];
	    var buf = '';
	    var placeables = 0;

	    this._index += opcharLen - 1;

	    var start = this._index + 1;

	    var closed = false;

	    while (!closed) {
	      var ch = this._source[++this._index];

	      switch (ch) {
	        case '\\':
	          var ch2 = this._source[++this._index];
	          if (ch2 === 'u') {
	            buf += this.getUnicodeChar();
	          } else if (ch2 === opchar || ch2 === '\\') {
	            buf += ch2;
	          } else if (ch2 === '{' && this._source[this._index + 1] === '{') {
	            buf += '{';
	          } else {
	            throw this.error('Illegal escape sequence');
	          }
	          break;
	        case '{':
	          if (this._source[this._index + 1] === '{') {
	            if (placeables > MAX_PLACEABLES - 1) {
	              throw this.error('Too many placeables, maximum allowed is ' + MAX_PLACEABLES);
	            }
	            if (buf.length) {
	              body.push(buf);
	              buf = '';
	            }
	            this._index += 2;
	            this.getWS();
	            body.push(this.getExpression());
	            this.getWS();
	            if (!this._source.startsWith('}}', this._index)) {
	              throw this.error('Expected "}}"');
	            }
	            this._index += 1;
	            placeables++;
	            break;
	          }

	        default:
	          if (ch === opchar) {
	            this._index++;
	            closed = true;
	            break;
	          }

	          buf += ch;
	          if (this._index + 1 >= this._length) {
	            throw this.error('Unclosed string literal');
	          }
	      }
	    }

	    if (buf.length) {
	      body.push(buf);
	    }

	    var string = new _ast2.default.String(this._source.slice(start, this._index - 1), body);
	    string.setPosition(start, this._index);
	    string._opchar = opchar;

	    return string;
	  },

	  getAttributes: function () {
	    var attrs = [];

	    while (true) {
	      var attr = this.getAttribute();
	      attrs.push(attr);
	      var ws1 = this.getRequiredWS();
	      var ch = this._source.charAt(this._index);
	      if (ch === '>') {
	        break;
	      } else if (!ws1) {
	        throw this.error('Expected ">"');
	      }
	    }
	    return attrs;
	  },

	  getAttribute: function () {
	    var start = this._index;
	    var key = this.getIdentifier();
	    var index = undefined;

	    if (this._source[this._index] === '[') {
	      ++this._index;
	      this.getWS();
	      index = this.getItemList(this.getExpression, ']');
	    }
	    this.getWS();
	    if (this._source[this._index] !== ':') {
	      throw this.error('Expected ":"');
	    }
	    ++this._index;
	    this.getWS();
	    var attr = new _ast2.default.Attribute(key, this.getValue(), index);
	    attr.setPosition(start, this._index);
	    return attr;
	  },

	  getHash: function () {
	    var start = this._index;
	    var items = [];

	    ++this._index;
	    this.getWS();

	    while (true) {
	      items.push(this.getHashItem());
	      this.getWS();

	      var comma = this._source[this._index] === ',';
	      if (comma) {
	        ++this._index;
	        this.getWS();
	      }
	      if (this._source[this._index] === '}') {
	        ++this._index;
	        break;
	      }
	      if (!comma) {
	        throw this.error('Expected "}"');
	      }
	    }

	    var hash = new _ast2.default.Hash(items);
	    hash.setPosition(start, this._index);
	    return hash;
	  },

	  getHashItem: function () {
	    var start = this._index;

	    var defItem = false;
	    if (this._source[this._index] === '*') {
	      ++this._index;
	      defItem = true;
	    }

	    var key = this.getIdentifier();
	    this.getWS();
	    if (this._source[this._index] !== ':') {
	      throw this.error('Expected ":"');
	    }
	    ++this._index;
	    this.getWS();

	    var hashItem = new _ast2.default.HashItem(key, this.getValue(), defItem);
	    hashItem.setPosition(start, this._index);
	    return hashItem;
	  },

	  getComment: function () {
	    this._index += 2;
	    var start = this._index;
	    var end = this._source.indexOf('*/', start);

	    if (end === -1) {
	      throw this.error('Comment without a closing tag');
	    }

	    this._index = end + 2;
	    var comment = new _ast2.default.Comment(this._source.slice(start, end));
	    comment.setPosition(start - 2, this._index);
	    return comment;
	  },

	  getExpression: function () {
	    var start = this._index;
	    var exp = this.getPrimaryExpression();

	    while (true) {
	      var ch = this._source[this._index];
	      if (ch === '.' || ch === '[') {
	        ++this._index;
	        exp = this.getPropertyExpression(exp, ch === '[', start);
	      } else if (ch === '(') {
	        ++this._index;
	        exp = this.getCallExpression(exp, start);
	      } else {
	        break;
	      }
	    }

	    return exp;
	  },

	  getPropertyExpression: function (idref, computed, start) {
	    var exp = undefined;

	    if (computed) {
	      this.getWS();
	      exp = this.getExpression();
	      this.getWS();
	      if (this._source[this._index] !== ']') {
	        throw this.error('Expected "]"');
	      }
	      ++this._index;
	    } else {
	      exp = this.getIdentifier();
	    }

	    var propExpr = new _ast2.default.PropertyExpression(idref, exp, computed);
	    propExpr.setPosition(start, this._index);
	    return propExpr;
	  },

	  getCallExpression: function (callee, start) {
	    this.getWS();

	    var callExpr = new _ast2.default.CallExpression(callee, this.getItemList(this.getExpression, ')'));
	    callExpr.setPosition(start, this._index);
	    return callExpr;
	  },

	  getPrimaryExpression: function () {
	    var start = this._index;
	    var ch = this._source[this._index];

	    switch (ch) {
	      case '$':
	        ++this._index;
	        var variable = new _ast2.default.Variable(this.getIdentifier());
	        variable.setPosition(start, this._index);
	        return variable;
	      case '@':
	        ++this._index;
	        var global = new _ast2.default.Global(this.getIdentifier());
	        global.setPosition(start, this._index);
	        return global;
	      default:
	        return this.getIdentifier();
	    }
	  },

	  getItemList: function (callback, closeChar) {
	    var items = [];
	    var closed = false;

	    this.getWS();

	    if (this._source[this._index] === closeChar) {
	      ++this._index;
	      closed = true;
	    }

	    while (!closed) {
	      items.push(callback.call(this));
	      this.getWS();
	      var ch = this._source.charAt(this._index);
	      switch (ch) {
	        case ',':
	          ++this._index;
	          this.getWS();
	          break;
	        case closeChar:
	          ++this._index;
	          closed = true;
	          break;
	        default:
	          throw this.error('Expected "," or "' + closeChar + '"');
	      }
	    }

	    return items;
	  },

	  error: function (message) {
	    var pos = this._index;

	    var start = this._source.lastIndexOf('<', pos - 1);
	    var lastClose = this._source.lastIndexOf('>', pos - 1);
	    start = lastClose > start ? lastClose + 1 : start;
	    var context = this._source.slice(start, pos + 10);

	    var msg = message + ' at pos ' + pos + ': `' + context + '`';

	    var err = new _errors.L10nError(msg);
	    err._pos = { start: pos, end: undefined };
	    err.offset = pos - start;
	    err.description = message;
	    err.context = context;
	    return err;
	  },

	  getJunkEntry: function () {
	    var pos = this._index;
	    var nextEntity = this._source.indexOf('<', pos);
	    var nextComment = this._source.indexOf('/*', pos);

	    if (nextEntity === -1) {
	      nextEntity = this._length;
	    }
	    if (nextComment === -1) {
	      nextComment = this._length;
	    }

	    var nextEntry = Math.min(nextEntity, nextComment);

	    this._index = nextEntry;

	    var junk = new _ast2.default.JunkEntry(this._source.slice(this._curEntryStart, nextEntry));
	    if (this._config.pos) {
	      junk._pos = { start: this._curEntryStart, end: nextEntry };
	    }
	    return junk;
	  }
	};
	module.exports = exports.default;

/***/ },
/* 2 */
/***/ function(module, exports) {

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

	function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }

	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

	var Node = (function () {
	  function Node() {
	    _classCallCheck(this, Node);

	    this.type = this.constructor.name;
	  }

	  _createClass(Node, [{
	    key: 'setPosition',
	    value: function setPosition(start, end) {
	      this._pos = { start: start, end: end };
	    }
	  }]);

	  return Node;
	})();

	var Entry = (function (_Node) {
	  function Entry() {
	    _classCallCheck(this, Entry);

	    _get(Object.getPrototypeOf(Entry.prototype), 'constructor', this).call(this);
	  }

	  _inherits(Entry, _Node);

	  return Entry;
	})(Node);

	var Identifier = (function (_Node2) {
	  function Identifier(name) {
	    _classCallCheck(this, Identifier);

	    _get(Object.getPrototypeOf(Identifier.prototype), 'constructor', this).call(this);
	    this.name = name;
	  }

	  _inherits(Identifier, _Node2);

	  return Identifier;
	})(Node);

	var Variable = (function (_Node3) {
	  function Variable(name) {
	    _classCallCheck(this, Variable);

	    _get(Object.getPrototypeOf(Variable.prototype), 'constructor', this).call(this);
	    this.name = name;
	  }

	  _inherits(Variable, _Node3);

	  return Variable;
	})(Node);

	var Global = (function (_Node4) {
	  function Global(name) {
	    _classCallCheck(this, Global);

	    _get(Object.getPrototypeOf(Global.prototype), 'constructor', this).call(this);
	    this.name = name;
	  }

	  _inherits(Global, _Node4);

	  return Global;
	})(Node);

	var Value = (function (_Node5) {
	  function Value() {
	    _classCallCheck(this, Value);

	    _get(Object.getPrototypeOf(Value.prototype), 'constructor', this).call(this);
	  }

	  _inherits(Value, _Node5);

	  return Value;
	})(Node);

	var String = (function (_Value) {
	  function String(source, content) {
	    _classCallCheck(this, String);

	    _get(Object.getPrototypeOf(String.prototype), 'constructor', this).call(this);
	    this.source = source;
	    this.content = content;

	    this._opchar = '"';
	  }

	  _inherits(String, _Value);

	  return String;
	})(Value);

	var Hash = (function (_Value2) {
	  function Hash(items) {
	    _classCallCheck(this, Hash);

	    _get(Object.getPrototypeOf(Hash.prototype), 'constructor', this).call(this);
	    this.items = items;
	  }

	  _inherits(Hash, _Value2);

	  return Hash;
	})(Value);

	var Entity = (function (_Entry) {
	  function Entity(id) {
	    var value = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
	    var index = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];
	    var attrs = arguments.length <= 3 || arguments[3] === undefined ? [] : arguments[3];

	    _classCallCheck(this, Entity);

	    _get(Object.getPrototypeOf(Entity.prototype), 'constructor', this).call(this);
	    this.id = id;
	    this.value = value;
	    this.index = index;
	    this.attrs = attrs;
	  }

	  _inherits(Entity, _Entry);

	  return Entity;
	})(Entry);

	var Resource = (function (_Node6) {
	  function Resource() {
	    _classCallCheck(this, Resource);

	    _get(Object.getPrototypeOf(Resource.prototype), 'constructor', this).call(this);
	    this.body = [];
	  }

	  _inherits(Resource, _Node6);

	  return Resource;
	})(Node);

	var Attribute = (function (_Node7) {
	  function Attribute(id, value) {
	    var index = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2];

	    _classCallCheck(this, Attribute);

	    _get(Object.getPrototypeOf(Attribute.prototype), 'constructor', this).call(this);
	    this.id = id;
	    this.value = value;
	    this.index = index;
	  }

	  _inherits(Attribute, _Node7);

	  return Attribute;
	})(Node);

	var HashItem = (function (_Node8) {
	  function HashItem(id, value, defItem) {
	    _classCallCheck(this, HashItem);

	    _get(Object.getPrototypeOf(HashItem.prototype), 'constructor', this).call(this);
	    this.id = id;
	    this.value = value;
	    this.default = defItem;
	  }

	  _inherits(HashItem, _Node8);

	  return HashItem;
	})(Node);

	var Comment = (function (_Entry2) {
	  function Comment(body) {
	    _classCallCheck(this, Comment);

	    _get(Object.getPrototypeOf(Comment.prototype), 'constructor', this).call(this);
	    this.body = body;
	  }

	  _inherits(Comment, _Entry2);

	  return Comment;
	})(Entry);

	var Expression = (function (_Node9) {
	  function Expression() {
	    _classCallCheck(this, Expression);

	    _get(Object.getPrototypeOf(Expression.prototype), 'constructor', this).call(this);
	  }

	  _inherits(Expression, _Node9);

	  return Expression;
	})(Node);

	var PropertyExpression = (function (_Expression) {
	  function PropertyExpression(idref, exp) {
	    var computed = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];

	    _classCallCheck(this, PropertyExpression);

	    _get(Object.getPrototypeOf(PropertyExpression.prototype), 'constructor', this).call(this);
	    this.idref = idref;
	    this.exp = exp;
	    this.computed = computed;
	  }

	  _inherits(PropertyExpression, _Expression);

	  return PropertyExpression;
	})(Expression);

	var CallExpression = (function (_Expression2) {
	  function CallExpression(callee, args) {
	    _classCallCheck(this, CallExpression);

	    _get(Object.getPrototypeOf(CallExpression.prototype), 'constructor', this).call(this);
	    this.callee = callee;
	    this.args = args;
	  }

	  _inherits(CallExpression, _Expression2);

	  return CallExpression;
	})(Expression);

	var JunkEntry = (function (_Entry3) {
	  function JunkEntry(content) {
	    _classCallCheck(this, JunkEntry);

	    _get(Object.getPrototypeOf(JunkEntry.prototype), 'constructor', this).call(this);
	    this.content = content;
	  }

	  _inherits(JunkEntry, _Entry3);

	  return JunkEntry;
	})(Entry);

	exports.default = {
	  Node: Node,
	  Identifier: Identifier,
	  Value: Value,
	  String: String,
	  Hash: Hash,
	  Entity: Entity,
	  Resource: Resource,
	  Attribute: Attribute,
	  HashItem: HashItem,
	  Comment: Comment,
	  Variable: Variable,
	  Global: Global,
	  Expression: Expression,
	  PropertyExpression: PropertyExpression,
	  CallExpression: CallExpression,
	  JunkEntry: JunkEntry
	};
	module.exports = exports.default;

/***/ },
/* 3 */
/***/ function(module, exports) {

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});
	exports.L10nError = L10nError;

	function L10nError(message, id, lang) {
	  this.name = 'L10nError';
	  this.message = message;
	  this.id = id;
	  this.lang = lang;
	}

	L10nError.prototype = Object.create(Error.prototype);
	L10nError.prototype.constructor = L10nError;

/***/ }
/******/ ])});;


text:
package biz.jovido.seed.thymeleaf;

import biz.jovido.seed.content.ItemService;
import biz.jovido.seed.thymeleaf.processor.AbstractComponentProcessor;
import biz.jovido.seed.thymeleaf.processor.AbstractContentProcessor;
import biz.jovido.seed.thymeleaf.processor.ContentIncludeProcessor;
import biz.jovido.seed.thymeleaf.processor.ContentReplaceProcessor;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Stephan Grundner
 */
public class ContentDialect extends AbstractProcessorDialect {

    private static final String PREFIX = "seed";

    private ItemService itemService;

    public ItemService getItemService() {
        return itemService;
    }

    public void setItemService(ItemService itemService) {
        this.itemService = itemService;
    }

    public ContentReplaceProcessor createReplaceProcessor() {
        return new ContentReplaceProcessor(PREFIX, getDialectProcessorPrecedence() * 10);
    }

    public ContentIncludeProcessor createIncludeProcessor() {
        return new ContentIncludeProcessor(PREFIX, getDialectProcessorPrecedence() * 10 + 1);
    }

    @Override
    public Set<IProcessor> getProcessors(String dialectPrefix) {
        HashSet<IProcessor> processors = new HashSet<>();
        processors.add(createReplaceProcessor());
        processors.add(createIncludeProcessor());

        processors.forEach(it -> ((AbstractContentProcessor) it)
                .setItemService(itemService));

        return processors;
    }

    public ContentDialect() {
        super("Seed Dialect", PREFIX, 1000);
    }
}


text:
package org.jbpm.workbench.pr.client.editors.instance.list;

import java.util.Arrays;
import java.util.List;
import javax.enterprise.context.Dependent;

import org.dashbuilder.dataset.sort.SortOrder;
import org.jbpm.workbench.df.client.filter.FilterSettings;
import org.jbpm.workbench.df.client.filter.FilterSettingsBuilderHelper;
import org.jbpm.workbench.df.client.filter.FilterSettingsManagerImpl;
import org.jbpm.workbench.pr.client.resources.i18n.Constants;
import org.kie.api.runtime.process.ProcessInstance;

import static org.dashbuilder.dataset.filter.FilterFactory.equalsTo;
import static org.dashbuilder.dataset.filter.FilterFactory.in;
import static org.jbpm.workbench.pr.model.ProcessInstanceDataSetConstants.*;

@Dependent
public class ProcessInstanceListFilterSettingsManager extends FilterSettingsManagerImpl {

    protected static final String TAB_ACTIVE = PROCESS_INSTANCES_WITH_VARIABLES_INCLUDED_LIST_PREFIX + "_0";
    protected static final String TAB_COMPLETED = PROCESS_INSTANCES_WITH_VARIABLES_INCLUDED_LIST_PREFIX + "_1";
    protected static final String TAB_ABORTED = PROCESS_INSTANCES_WITH_VARIABLES_INCLUDED_LIST_PREFIX + "_2";

    private Constants constants = Constants.INSTANCE;

    @Override
    public String getGridGlobalPreferencesKey() {
        return PROCESS_INSTANCES_WITH_VARIABLES_INCLUDED_LIST_PREFIX;
    }

    @Override
    public FilterSettings createFilterSettingsPrototype() {
        return createFilterSettings(PROCESS_INSTANCE_DATASET,
                                    COLUMN_START,
                                    null);
    }

    @Override
    public List<FilterSettings> initDefaultFilters() {
        return Arrays.asList(
                //Filter status Active
                createFilterSettings(PROCESS_INSTANCE_DATASET,
                                     COLUMN_START,
                                     builder -> builder.filter(equalsTo(COLUMN_STATUS,
                                                                        ProcessInstance.STATE_ACTIVE)),
                                     getDefaultFilterSettingsKey(), //initialDefaultFilter
                                     constants.Active(),
                                     constants.FilterActive()),

                //Filter status completed
                createFilterSettings(PROCESS_INSTANCE_DATASET,
                                     COLUMN_START,
                                     builder -> builder.filter(equalsTo(COLUMN_STATUS,
                                                                        ProcessInstance.STATE_COMPLETED)),
                                     TAB_COMPLETED,
                                     constants.Completed(),
                                     constants.FilterCompleted()),

                //Filter status aborted
                createFilterSettings(PROCESS_INSTANCE_DATASET,
                                     COLUMN_START,
                                     builder -> builder.filter(equalsTo(COLUMN_STATUS,
                                                                        ProcessInstance.STATE_ABORTED)),
                                     TAB_ABORTED,
                                     constants.Aborted(),
                                     constants.FilterAborted())
        );
    }

    @Override
    public FilterSettings getVariablesFilterSettings(final List<Long> processIds) {
        FilterSettingsBuilderHelper builder = FilterSettingsBuilderHelper.init();
        builder.initBuilder();

        builder.dataset(PROCESS_INSTANCE_WITH_VARIABLES_DATASET);
        builder.filter(in(PROCESS_INSTANCE_ID,
                          processIds));

        builder.setColumn(PROCESS_INSTANCE_ID,
                          "processInstanceId");
        builder.setColumn(PROCESS_NAME,
                          "processName");
        builder.setColumn(VARIABLE_ID,
                          "variableID");
        builder.setColumn(VARIABLE_NAME,
                          "variableName");
        builder.setColumn(VARIABLE_VALUE,
                          "variableValue");

        builder.filterOn(true,
                         true,
                         true);
        builder.tableOrderEnabled(true);
        builder.tableOrderDefault(PROCESS_INSTANCE_ID,
                                  SortOrder.ASCENDING);

        FilterSettings varTableSettings = builder.buildSettings();
        varTableSettings.setTablePageSize(-1);
        varTableSettings.setTableName("Filtered");
        varTableSettings.setTableDescription("Filtered Desc");

        return varTableSettings;
    }
}


text:
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
from RGT.XML.SVG.Attribs.graphicalEventAttributes import GraphicalEventAttributes
from RGT.XML.SVG.Attribs.presentationAttributes import PresentationAttributes
from RGT.XML.SVG.Attribs.classAttribute import ClassAttribute
from RGT.XML.SVG.Attribs.styleAttribute import StyleAttribute
from types import StringType
from RGT.XML.SVG.Attribs.Error.valueParsingError import ValueParsingError

class BaseStructuralNode(BasicSvgNode, GraphicalEventAttributes, PresentationAttributes, ClassAttribute,
                         StyleAttribute):
    ATTRIBUTE_EXTERNALRESOURCESREQUIRED = 'externalResourcesRequired'

    def __init__(self, ownerDoc, tagName):
        BasicSvgNode.__init__(self, ownerDoc, tagName)
        PresentationAttributes.__init__(self)
        ClassAttribute.__init__(self)
        StyleAttribute.__init__(self)
        self._allowedSvgChildNodes.update(self.SVG_GROUP_DESCRIPTIVE_ELEMENTS, self.SVG_GROUP_ANIMATION_ELEMENTS)

    def setExternalResourcesRequired(self, data):
        allowedValues = ['true', 'false']

        if data is not None:
            if type(data) is not StringType:
                data = str(data)

            if data not in allowedValues:
                values = ''
                for value in allowedValues:
                    values += value + ', '
                values = values[0: len(values) - 2]
                raise ValueError('Value not allowed, only ' + values + 'are allowed')
            else:
                self._setNodeAttribute(self.ATTRIBUTE_EXTERNALRESOURCESREQUIRED, data)

    def getExternalResourcesRequired(self):
        node = self._getNodeAttribute(self.ATTRIBUTE_EXTERNALRESOURCESREQUIRED)
        if node is not None:
            value = node.nodeValue
            if value == 'false' or value == 'False':
                return False
            elif value == 'true' or value == 'True':
                return True
            else:
                raise ValueParsingError(
                    'Could not parse the value of the ' + self.ATTRIBUTE_EXTERNALRESOURCESREQUIRE + ' attribute', value)
        return None


text:
package cs.ucla.edu.bwaspark.commandline

class BWAMEMCommand {
    var fastaInputPath: String = ""                    // the local BWA index files (bns, pac, and so on)
    var fastqHDFSInputPath: String = ""                // the raw read file stored in HDFS
    var isPairEnd: Boolean = false                     // perform pair-end or single-end mapping
    var fastqInputFolderNum: Int = 0                   // the number of folders generated in the HDFS for the raw reads
    var batchedFolderNum: Int = 4                      // the number of raw read folders in a batch to be processed
    var isPSWBatched: Boolean = true                   // (optional) whether the pair-end Smith Waterman is performed in a batched way
    var subBatchSize: Int = 10                         // (optional) the number of reads to be processed in a subbatch
    var isPSWJNI: Boolean = true                       // (optional) whether the native JNI library is called for better performance
    var jniLibPath: String = "./target/jniNative.so"   // (optional) the JNI library path in the local machine
    var outputChoice: Int = 1                          // (optional) the output format choice
                                                       //            0: no output (pure computation)
                                                       //            1: SAM file output in the local file system (default)
                                                       //            2: ADAM format output in the distributed file system
    var outputPath: String = "output.sam"              // (optional) the output path; users need to provide correct path in the local or distributed file system
    var localRef: Int = 0                              // (optional) specify if each local node has the reference genome (you can use it to bypass the broadcasting overhead.
                                                       // 0: w/o local reference genome (default)
                                                       // 1: with local reference genome
    var headerLine: String = "@RG\tID:foo\tSM:bar";    // (should be added for common use case) Complete read group header line: Example: @RG\tID:foo\tSM:bar
    var isSWExtBatched: Boolean = false                // (optional) whether the SWExtend is executed in a batched way
    var swExtBatchSize: Int = 1024                     // (optional) the batch size used for used for SWExtend
    var isFPGAAccSWExtend: Boolean = false             // (optional) whether the FPGA accelerator is used for accelerating SWExtend
    var fpgaSWExtThreshold: Int = 128                  // (optional) the threshold of using FPGA accelerator for SWExtend
    var jniSWExtendLibPath: String = "./target/jniSWExtend.so"   // (optional) the JNI library path used for SWExtend FPGA acceleration
}


text:
var g = new Y.inputEx.Group({parentEl: 'container', fields: Y.inputEx.Group.groupOptions});

g.setValue({
   "fields": [
      {
         "type": "string",
         "placeholder": "firstname",
         "name": "firstname",
         "label": "Firstname"
      },
      {
         "type": "string",
         "placeholder": "lastname",
         "name": "lastname",
         "label": "Lastname"
      },
      {
         "type": "email",
         "label": "Email",
         "name": "",
         "required": false
      }
   ],
   "collapsible": true,
   "legend": "User"
}, false);

var rebuildPreview = function() {
   var value = g.getValue();
   var previewGroup = new Y.inputEx.Group(value);

   var groupContainer = Y.one('#groupContainer')._node;
   groupContainer.innerHTML = "";
   groupContainer.appendChild(previewGroup.getEl());

   var codeContainer = Y.one('#codeGenerator')._node;
   codeContainer.innerHTML = value.toPrettyJSONString(true);
};

rebuildPreview();

// Update the preview event
g.on('updated', rebuildPreview);

 // Generate Page:
Y.one('#generateButton').on('click', function() {

   var html = [
      "",
      "",
      "  <title>inputEx Builder: generate inputEx Forms</title>",
      "  <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n",

      "<link rel='stylesheet' href='http://yui.yahooapis.com/3.14.1/build/cssgrids/grids-min.css'>",

      "<link rel='stylesheet' href='http://yui.yahooapis.com/combo?3.14.1/build/cssreset/reset-min.css&3.14.1/build/cssfonts/fonts-min.css'>",

      "  ",
      "\n",
      "",
      "

",
      "",
      "<scr"+"ipt type='text/javascript' src='http://yui.yahooapis.com/3.14.1/build/yui/yui-debug.js'></scr"+"ipt>",
      "<scr"+"ipt type='text/javascript' src='../../build/inputex-loader/inputex-loader.js'></scr"+"ipt>",
      "<scr"+"ipt>",
      "YUI_config.groups.inputex.base = '../../build/';",

      "var formDef = "+g.getValue().toPrettyJSONString(true)+";",

      "YUI().use('inputex-group', function(Y) {",

      "   // Load the modules using Y.use (asynchronously)",
      "   Y.inputEx.use(formDef, function() {",

      "      // Instantiate the form using Y.inputEx",
      "      formDef.parentEl = 'formContainer';",
      "      new Y.inputEx.Group(formDef);",

      "   });",

      "});",

      "</scr"+"ipt>",
      "",
      ""
   ];

   // Center popup
   var Posx = screen.width /2;
   var Posy = screen.height /2;
   Posx -= (this.windowWidth/2);
   Posy -= (this.windowHeight/2);

   var formPage = window.open("",'InputExForm','left='+Posx+',top='+Posy+
                                                                         ',width=850,height=600,toolbar=no,scrollbars,resizable=yes');

   formPage.document.write(html.join("\n"));
   formPage.document.close();
});

// Add a popup and a load button
Example1 = {};

Y.one("#loadButton").on("click", function() {
   Example1.myPanel.show();
});

var formConfig = {
   type: 'form',
   fields: [
      {
         type: 'text',
         name: 'code',
         cols: 50,
         rows: 10
      },
      {
         type: "radio",
         label : "Format",
         name : "format",
         choices : ["inputEx JSON","JSON Schema"],
         value: "inputEx JSON"
      }
   ],
   buttons: [
      {
         type: 'submit',
         value: 'Load',
         onClick: function() {

            try {
               var value = Example1.myPanel.get('field').getValue();

               try {
                  var code = eval('('+value.code+')');
               } catch(ex) {
                  alert("Error during JSON evaluation");
                  return;
               }

               // Build using JSON Schema
               if(value.format == "JSON Schema") {

                  try {
                     var builder = new Y.inputEx.JsonSchema.Builder({
                        'schemaIdentifierMap': code,
                        'defaultOptions':{
                           'showMsg':true
                        }
                     });

                     var lastSchema = (function(o){
                        var r;
                        for(var k in o) {
                           if(o.hasOwnProperty(k)) {
                              r = o[k];
                           }
                        }
                        return r;
                     })(code);

                     var m = builder.schemaToInputEx(lastSchema);
                     g.setValue(m);

                  } catch(ex) {
                     return;
                  }

               } // OR standard inputEx JSON
               else { // value.format == "inputEx JSON"
                  g.setValue(code);
               }

               Example1.myPanel.hide();

            } catch(ex) {
               if (window.console && Y.Lang.isFunction(console.log)) {
                  console.log(ex);
               }
            }

            return false;
         }
      },
      {
         type: 'link',
         value: 'Cancel',
         onClick: function() {
            Example1.myPanel.hide();
            return false;
         }
      }
   ]
};

Example1.myPanel = new Y.inputEx.Panel({
   inputEx: formConfig,
   title: 'Copy/Paste your inputEx JSON or JSON Schema here :',
   constraintoviewport: true,
   underlay:"shadow",
   close:true,
   fixedcenter: true,
   visible:false,
   plugins: [Y.Plugin.Drag],
   modal: true,
   render: true
});


text:
    Date Range:
    <select data-on-change="updateDateSelector">
      <option value="loadHourly" {{- if d.activeDateRange === 'loadHourly' }}selected{{/}}>Last 3 hours</option>
      <option value="loadDaily" {{- if d.activeDateRange === 'loadDaily' }}selected{{/}}>Last 12 hours</option>
      <option value="loadWeekly" {{- if d.activeDateRange === 'loadWeekly' }}selected{{/}}>Last 7 days</option>
      <option value="loadMonthly" {{- if d.activeDateRange === 'loadMonthly' }}selected{{/}}>Last 30 days</option>
    </select>

  {{- for d.instances }}
    {{- render instanceSummary }}
  {{- end }}


text:
layout: post
status: publish
published: true
title: Xcode 4.0.2
author: mick
author_login: mick
author_email: mickael@flochlay.com
wordpress_id: 153
wordpress_url: http://morningcoffee.mickaelflochlay.com/?p=153
date: 2011-04-15 10:00:52.000000000 +02:00
categories:
- Geek
tags: []
comments: []
---

Outre la prise en charge d'iOS 4.3.2, cette mouture corrige son lot de bogues et est présentée comme étant plus stable par Apple.

Bonne nouvelle mais il est trop tôt pour que je revienne à Xcode 4.

J'étais revenu à Xcode 3 après un test de quelques jours de Xcode 4. Mais je n'y reviendrai définitivement que lorsque les docs d'Apple, en particulier les guides de distribution sur App Store, seront basés sur cette version 4.

via Xcode passe en 4.0.2.


text:
#import <IDEKit/IDESourceControlOperationInfo.h>

#import "IDESourceControlBranchingOperationInfoProtocol.h"

@class IDESourceControlBranch, NSMutableDictionary, NSString;

@interface IDESourceControlMergeOperationInfo : IDESourceControlOperationInfo <IDESourceControlBranchingOperationInfoProtocol>
{
    IDESourceControlBranch *_mergeBranch;
    IDESourceControlBranch *_targetBranch;
    NSString *_currentRevisionIdentifier;
    NSString *_branchRevisionIdentifier;
    NSString *_ancestorRevisionIdentifier;
    NSString *_remoteURLToMerge;
    NSMutableDictionary *_itemsWithConflicts;
    BOOL _landingMerge;
}

- (void).cxx_destruct;
@property(copy) NSString *ancestorRevisionIdentifier; // @synthesize ancestorRevisionIdentifier=_ancestorRevisionIdentifier;
@property(copy) NSString *branchRevisionIdentifier; // @synthesize branchRevisionIdentifier=_branchRevisionIdentifier;
@property(readonly) unsigned long long conflictCount;
@property(copy) NSString *currentRevisionIdentifier; // @synthesize currentRevisionIdentifier=_currentRevisionIdentifier;
@property(readonly) NSMutableDictionary *itemsWithConflicts; // @synthesize itemsWithConflicts=_itemsWithConflicts;
@property BOOL landingMerge; // @synthesize landingMerge=_landingMerge;
@property(retain) IDESourceControlBranch *mainBranch; // @synthesize mainBranch=_targetBranch;
@property(retain) IDESourceControlBranch *otherBranch; // @synthesize otherBranch=_mergeBranch;
- (id)processDistributedMergeInfoWithProgressBlock:(id)arg1 isSingleOperation:(void)arg2 completionBlock:(BOOL)arg3;
- (id)processInfoWithProgressBlock:(id)arg1 isSingleOperation:(void)arg2 completionBlock:(BOOL)arg3;
- (id)processMergeInfoWithProgressBlock:(id)arg1 isSingleOperation:(void)arg2 completionBlock:(BOOL)arg3;
@property(readonly) NSString *remoteURLToMerge; // @synthesize remoteURLToMerge=_remoteURLToMerge;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
Documentation

Kafka Streams


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Protocols.TestTools.StackSdk.Messages.Marshaling
{
    /// <summary>
    /// Length Mode
    /// </summary>
    public enum LengthMode
    {
        /// <summary>
        /// Marshaling in Bit Mode
        /// </summary>
        Bit,

        /// <summary>
        /// Marshaling in Byte Mode
        /// </summary>
        Byte,
    }

    /// <summary>
    /// Datatype Info Provider
    /// </summary>
    public static class DatatypeInfoProvider
    {
        /// <summary>
        /// Check if the given data type is predefined.
        /// </summary>
        /// <param name="datatypeName">Name of the data type</param>
        /// <returns>True if it is predefined</returns>
        public static bool IsPredefinedDatatype(string datatypeName)
        {
            int step = 3;
            for (int i = 0; i < datatypeLengthInfo.Length; i += step)
            {
                if (datatypeLengthInfo[i] == datatypeName)
                {
                    return true;
                }
            }

            return false;
        }

        /// <summary>
        /// Check if the given type modifier is predefined.
        /// </summary>
        /// <param name="modifier">The given type modifier</param>
        /// <returns>True if it is predefined</returns>
        public static bool isPredefinedModifier(string modifier)
        {
            foreach (string str in predefinedModifier)
            {
                if (str == modifier)
                {
                    return true;
                }
            }
            return false;
        }

        /// <summary>
        /// Get RPC data type length
        /// </summary>
        /// <param name="datatypeName">Name of the data type</param>
        /// <returns>The RPC data type length</returns>
        public static int GetRpcDatatypeLength(string datatypeName)
        {
            string lengthStr = "-1";
            int step = 3;

            if (datatypeLengthInfo.Length % 3 != 0)
            {
                return -1;
            }

            for (int i = 0; i < datatypeLengthInfo.Length; i += step)
            {
                if (datatypeLengthInfo[i] == datatypeName)
                {
                    lengthStr = datatypeLengthInfo[i + 1];
                    break;
                }
            }

            int length;
            if (!Int32.TryParse(lengthStr, out length))
            {
                return -1;
            }

            return length;
        }

        /// <summary>
        /// Get data type length.
        /// </summary>
        /// <param name="datatypeName">Name of the data type</param>
        /// <param name="length">The data type length (in string format)</param>
        /// <param name="mode">The length mode (in string format)</param>
        public static void GetDatatypeLength(string datatypeName, out string length, out string mode)
        {
            length = "-1";
            mode = "byte";
            int step = 3;

            for (int i = 0; i < datatypeLengthInfo.Length; i += step)
            {
                if (datatypeLengthInfo[i] == datatypeName)
                {
                    length = datatypeLengthInfo[i + 1];
                    mode = datatypeLengthInfo[i + 2];
                    break;
                }
            }
        }

        private static string[] datatypeLengthInfo =
        {
            "BIT", "1", "bit",
            "byte", "1", "byte",
            "small", "1", "byte",
            "boolean", "1", "byte",
            "int", "4", "byte",
            "__int32", "4", "byte",
            "long", "4", "byte",
            "short", "2", "byte",
            "char", "1", "byte",
            "hyper", "8", "byte",
            "wchar_t", "2", "byte",
            "float", "4", "byte",
            "double", "8", "byte",
            "__int64", "8", "byte",
            "__int3264", "-1", "byte",
            "error_status_t", "4", "byte",
            "void", "-1", "byte",
            "handle_t", "-1", "byte",
        };

        private static string[] predefinedModifier =
        {
            "unsigned",
            "const",
            "signed",
            "enum",
            "struct",
            "union",
        };
    }
}


text:
def raises(err, lamda):
    try:
        lamda()
        return False
    except err:
        return True

no_default = '__no__default__'


text:
package main.tree;

import java.util.PriorityQueue;

public class SecondMinimumNode {

    public int findSecondMinimumValue(TreeNode root) {
        PriorityQueue<Integer> q = new PriorityQueue<>();
        helper(root, q);
        int min = q.poll();
        while (!q.isEmpty()) {
            int secondMin = q.poll();
            if (secondMin > min) return secondMin;
        }
        return -1;
    }

    void helper(TreeNode root, PriorityQueue<Integer> q) {
        if (root == null) return;
        q.offer(root.val);
        helper(root.left, q);
        helper(root.right, q);
    }
}


text:
package com.tle.core.quota.dao;

import com.tle.beans.item.Item;
import com.tle.common.usermanagement.user.valuebean.UserBean;
import com.tle.core.hibernate.dao.GenericInstitutionalDao;

public interface QuotaDao extends GenericInstitutionalDao<Item, Long> {
  long calculateUserFileSize(UserBean user);
}


text:
require_relative 'spec_helper'

describe IOEncrypter do
	it 'should encrypt input stream to output stream' do
		cipher_selector = CipherSelector.new.cipher('IDEA').mode('CBC').longest_key(128)

		input = StringIO.new('hello world')
		output = StringIO.new

		IOEncrypter.new(input, output, cipher_selector, 'password', initialization_vector: 't' * 16, session_key: 's' * 16)

		output.string.should include('IDEA')
		output.string.to_base64.should == "Y2lwaGVyICJJREVBIgptb2RlICJDQkMiCmtleV9zaXplIDEyOAppbml0aWFsaXphdGlvbl92ZWN0b3IgIjc0NzQ3NDc0NzQ3NDc0NzQ3NDc0NzQ3NDc0NzQ3NDc0IgpzZXNzaW9uX2tleSAiMjkwMzI5MTAxOGUyZTY2YzI5MDMyOTEwMThlMmU2NmMyOTY5ZTVhOGEwZGQ0NTViIgoKQaa+VoEhcFYOgrrdgDxSdQ=="
	end

	it 'should use defferent session key for each run if not specified' do
		cipher_selector = CipherSelector.new.cipher('IDEA').mode('CBC').longest_key(128)

		input = StringIO.new('hello world')
		output = StringIO.new
		IOEncrypter.new(input, output, cipher_selector, 'password', initialization_vector: 'test' * 16)

		input.rewind
		output2 = StringIO.new
		IOEncrypter.new(input, output2, cipher_selector, 'password', initialization_vector: 'test' * 16)

		output.string.should_not == output2.string
	end

	it 'should use defferent initialization vector for each run if not specified' do
		cipher_selector = CipherSelector.new.cipher('IDEA').mode('CBC').longest_key(128)

		input = StringIO.new('hello world')
		output = StringIO.new
		IOEncrypter.new(input, output, cipher_selector, 'password', session_key: 's' * 16)

		input.rewind
		output2 = StringIO.new
		IOEncrypter.new(input, output2, cipher_selector, 'password', session_key: 's' * 16)

		output.string.should_not == output2.string
	end
end

describe IODecrypter do
	it 'should decrypt input stream to output stream' do
		input = StringIO.new("Y2lwaGVyICJJREVBIgptb2RlICJDQkMiCmtleV9zaXplIDEyOAppbml0aWFsaXphdGlvbl92ZWN0b3IgIjc0NzQ3NDc0NzQ3NDc0NzQ3NDc0NzQ3NDc0NzQ3NDc0IgpzZXNzaW9uX2tleSAiMjkwMzI5MTAxOGUyZTY2YzI5MDMyOTEwMThlMmU2NmMyOTY5ZTVhOGEwZGQ0NTViIgoKQaa+VoEhcFYOgrrdgDxSdQ==".from_base64)
		output = StringIO.new

		IODecrypter.new(input, output, 'password')

		output.string.should == 'hello world'
	end
end


text:
namespace moducom { namespace coap {

// 4/18/2018 - after much experimentation, I have settled on network-buffer pattern
// reigning supreme for shuttling memory around, so then this is the canonical go-to
// encoder
// 12/8/2019 - no longer exactly the case.  StreambufEncoder is now the preferred mechanism,
// however we're going to keep netbuf based things around in a minimal sense since pre c++11
// code I expect can work with it.  Be advised this code expects a mk. 1 netbuf, so to be
// functional we'll need to upgrade to a mk. 2 netbuf
template <class TNetBuf>
class NetBufEncoder :
        public moducom::io::experimental::NetBufWriter<TNetBuf>,
        protected experimental::EncoderBase
{
    typedef TNetBuf netbuf_t;
    typedef moducom::io::experimental::NetBufWriter<TNetBuf> base_t;
    typedef const estd::const_buffer ro_chunk_t;

    OptionEncoder option_encoder;

public:
    typedef Option::Numbers option_number_t;
    typedef typename base_t::size_type size_type;

    // acquire direct access to underlying netbuf, useful for bulk operations like
    // payload writes
    netbuf_t& netbuf()
    {
        return this->m_netbuf;
    }

protected:
    size_type write(const estd::const_buffer& chunk)
    {
        return base_t::write(chunk.data(), chunk.size());
    }

    // would use declval to deduce a .data() and .length() provider or not but that's
    // a C++ only thing, so probably gotta retrofit it into estdlib
    template <class TString>
    size_type write(const TString (&s))
    {
        return base_t::write(s);
    }

    // process all NON-value portion of option
    bool option_header(option_number_t number, uint16_t value_length);

    // process ONLY value portion of option
    template <class TContainer>
    bool option_value(const TContainer& chunk, bool last_chunk)
    {
        size_type written = write(chunk);
        if(written == chunk.size())
        {
            if (last_chunk)
                option_encoder.fast_forward();

            return true;
        }
        else
        {
            this->written(written);
            return false;
        }
    }

#ifndef DEBUG
    // NOTE: having this presents a strong case to *always* do state/consistency
    // feature, not just debug mode
    bool m_payload_marker_written;
#endif

    bool payload_marker_written() const
    {
#ifdef DEBUG
        return state() == _state_t::Payload;
#else
        return m_payload_marker_written;
#endif
    }

    void payload_marker_written(bool is_written)
    {
#ifndef DEBUG
        m_payload_marker_written = is_written;
#endif
    }

public:
    // public so that zero copy operations can kick off payloads properly
    bool payload_header()
    {
        assert_not_state(_state_t::Header);
        assert_not_state(_state_t::Token);
        assert_not_state(_state_t::Payload);
        assert_state(_state_t::OptionsDone);

        if(!payload_marker_written())
        {
            if(this->size() == 0)
            {
                written(0);
                return false;
            }

            this->putchar(COAP_PAYLOAD_MARKER);

            payload_marker_written(true);
        }

        state(_state_t::Payload);

        return true;
    }

    ///
    /// \brief output payload marker
    ///
    /// better name than payload header... header you have to infer the meaning, but marker
    /// is the actual proper name of the 0xFF
    ///
    /// \return
    ///
    bool payload_marker() { return payload_header(); }

    // ensures payload marker is written and then returns current netbuf unprocessed
    // chunk ptr
    uint8_t* payload()
    {
        payload_header();
        return base_t::data();
    }

    size_type write(const void* d, int len)
    {
        return base_t::write(d, len);
    }

    template <class TImpl>
    size_type write(const estd::internal::allocated_array<TImpl>& value)
    {
        size_type written = base_t::write(value.clock(), value.size());
        value.cunlock();
        return written;
    }

protected:
    // represents how many bytes were written during last public/high level encode operation
    // only available if encode operation comes back as false.  Undefined when operation
    // succeeds
    size_type m_written;

    void written(size_type w) { m_written = w; }

public:
#ifdef FEATURE_CPP_MOVESEMANTIC
    template <class ...TArgs>
    NetBufEncoder(TArgs&&...args) :
        base_t(std::forward<TArgs>(args)...)
    {
        payload_marker_written(false);
    }
#else
    template <class TNetBufInitParam>
    NetBufEncoder(TNetBufInitParam& netbufinitparam) :
        base_t(netbufinitparam)
    {
        payload_marker_written(false);
    }
#endif

    NetBufEncoder() { payload_marker_written(false); }

    size_type written() const { return m_written; }

    bool header(const Header& header)
    {
        assert_state(_state_t::Header);

        // TODO: handle incomplete write
        if(this->size() >= 4)
        {
            write(header.bytes);
            state(_state_t::HeaderDone);
            return true;
        }
        else
        {
            written(0);
            return false;
        }
    }

    template <class TImpl>
    bool token(const estd::internal::allocated_array<TImpl>& value, bool last_chunk = true)
    {
        // TODO: handle chunking
        assert_state(_state_t::HeaderDone);
        size_type written = write(value);
        state(_state_t::TokenDone);
        this->written(written);
        return written == value.size();
    }

    // this variety does not handle chunking on the input
    bool token(const uint8_t* data, size_type tkl)
    {
        assert_state(_state_t::HeaderDone);
        size_type written = base_t::write(data, tkl);
        state(_state_t::TokenDone);
        this->written(written);
        return written == tkl;
    }

    bool token(const estd::const_buffer& b)
    {
        return token(b.data(), b.size());
    }

    bool option(option_number_t number,
                ro_chunk_t& option_value,
                bool last_chunk = true);

    // have to explicitly do this, otherwise the string-capable version greedily
    // eats things up
    bool option(option_number_t number,
                const pipeline::MemoryChunk& option_value,
                bool last_chunk = true)
    {
        // since there's a tiny bit of overload-complexity, do a legacy behavior here
        // until we clean the overload complexity up
        ro_chunk_t ov(option_value.data(), option_value.length());

        return option(number, ov, last_chunk);
    }

    // FIX: clumsy but helpful.  Once we get SFINAE working right to
    // properly select underlying write operation, things will be cleaner
    bool option(option_number_t number, int option_value)
    {
        coap::layer2::UInt<> v;

        v.set(option_value);

        return option(number, pipeline::MemoryChunk(v));
    }

    // TString should match std::string signature
    template <class TString>
    bool option(option_number_t number, TString s);

    bool option(option_number_t number)
    {
        return option_header(number, 0);
    }

    // NOTE: this has no provision for chunking, this is a one-shot payload string
    // assignment
    template <class TString>
    bool payload(TString s);

    bool payload(ro_chunk_t option_value, bool last_chunk = true);

    // do a most-used case for filling out a response based on a requesting
    // token and header context
    template <bool inline_token, bool simple_buffer>
    bool header_and_token(TokenAndHeaderContext<inline_token, simple_buffer>& context,
                          Header::Code::Codes response_code)
    {
        // Not going to check header write, we always assume we have at least 4 bytes
        // at the start of our netbuf
        header(moducom::coap::create_response(context.header(),
                                       response_code));
        return token(context.token());
    }

    // marks end of encoding - oftentimes, encoder cannot reasonably figure this out due to optional
    // presence of both options and payload.  Only during presence of payload can we
    // indicate a 'last chunk'.  To avoid mixing and matching complete-detection techniques,
    // an explicit call to complete() is always required to signal to underlying netbuf
    // (or perhaps alternate signalling mechanism?) - At time of this writing no formalized
    // signaling mechanism is present
    void complete()
    {
        //netbuf().complete();
    }
};

}}


text:
/* eslint-disable */
exports.css = name => `.root {
  /* TODO: ${name} styles. */
}`;

exports.uiComponent = name => `// @flow
import React, { Component } from "react";
import styles from "./${name}.css";

type Props = {
};

type State = {
};

export default class ${name} extends Component {
  props: Props;
  state: State;

  render() {
    return (

        ${name}

    );
  }
}
`;

exports.uiFunctionalComponent = name => `// @flow
import React from "react";
import styles from "./${name}.css";

type Props = {
};

const ${name} = (props: Props) => {
  const {
    ...
  } = props;

  return (

      ${name}

  );
};

export default ${name};
`;

exports.uiComponentSpec = name => `import assert from "power-assert";
import sinon from "sinon";
import React from "react";
import { mount } from "enzyme";
import ${name} from "./${name}";

describe("<${name} />", () => {
  it("Should be writing tests for ${name} component", () => {
    // TODO: Writing tests.
  });
});
`;

exports.uiComponentExample = name => `Basic:

\`\`\`
<${name} />
\`\`\`
`;

exports.containerUI = name => `// @flow
import React, { Component } from "react";
import { connect } from "react-redux";
import styles from "./${name}.css";

import type { Dispatch } from "redux";

type Props = {
  dispatch: Dispatch<*>;
};

export class ${name} extends Component {
  props: Props;

  render() {
    return (

        ${name}

    );
  }
}

export default connect(
  state => state
)(${name});
`;

exports.containerPage = name => `// @flow
import React, { Component } from "react";
import { connect } from "react-redux";
import Helmet from "../../../components/utils/Helmet";
import styles from "./${name}.css";

import type { Dispatch } from "redux";

type Props = {
  dispatch: Dispatch<*>;
};

export class ${name} extends Component {
  props: Props;

  render() {
    return (

        <Helmet title="TODO: Title" />

        ${name}

    );
  }
}

export default connect(
  state => state
)(${name});
`;


text:
#pragma once
#include <aws/servicecatalog/ServiceCatalog_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace ServiceCatalog
{
namespace Model
{
  enum class Replacement
  {
    NOT_SET,
    TRUE,
    FALSE,
    CONDITIONAL
  };

namespace ReplacementMapper
{
AWS_SERVICECATALOG_API Replacement GetReplacementForName(const Aws::String& name);

AWS_SERVICECATALOG_API Aws::String GetNameForReplacement(Replacement value);
} // namespace ReplacementMapper
} // namespace Model
} // namespace ServiceCatalog
} // namespace Aws