// newTHS constructor
169343
func newTHS(s BaseSentence) (THS, error) {
	p := newParser(s)
	p.AssertType(TypeTHS)
	m := THS{
		BaseSentence: s,
		Heading:      p.Float64(0, "heading"),
		Status:       p.EnumString(1, "status", AutonomousTHS, EstimatedTHS, ManualTHS, SimulatorTHS, InvalidTHS),
	}
	return m, p.Err()
}
638766
func (s *Service) NewTXT(name string) *dns.TXT {
	return &dns.TXT{Hdr: dns.RR_Header{Name: name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: s.TTL}, Txt: split255(s.Text)}
}
668083
func hstsHandler(fn http.HandlerFunc) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
		fn(w, r)
	})
}
572012
func NewTimer(h Histogram) *Timer {
	return &Timer{
		h: h,
		t: time.Now(),
		u: time.Second,
	}
}
1155168
func newTikvTxnWithStartTS(store *tikvStore, startTS uint64) (*tikvTxn, error) {
	ver := kv.NewVersion(startTS)
	snapshot := newTiKVSnapshot(store, ver)
	return &tikvTxn{
		snapshot:  snapshot,
		us:        kv.NewUnionStore(snapshot),
		store:     store,
		startTS:   startTS,
		startTime: time.Now(),
		valid:     true,
		vars:      kv.DefaultVars,
	}, nil
}
984079
func NewTreeHash() *TreeHash {
	result := &TreeHash{
		runningHash: sha256.New(),
		remaining:   make([]byte, 0, 1<<20),
	}
	result.Reset()
	return result
}
592953
func (m *MockClock) NewTimer(d time.Duration) Timer {
	t := NewMockTimer(m)
	t.Reset(d)
	return t
}
352761
func NewTsfForStreamWithSrcLen(sourceLength uint, priceStream gotrade.DOHLCVStreamSubscriber, timePeriod int, selectData gotrade.DOHLCVDataSelectionFunc) (indicator *Tsf, err error) {
	ind, err := NewTsfWithSrcLen(sourceLength, timePeriod, selectData)
	priceStream.AddTickSubscription(ind)
	return ind, err
}
821586
func (x *SexpHashSelector) RHS(env *Zlisp) (sx Sexp, err error) {
	if env == nil {
		panic("SexpHashSelector.RSH() called with nil env")
	}
	if x.Select == nil {
		panic("cannot call RHS on hash selector with nil Select")
	}
	Q("SexpHashSelector.RHS(): x.Select is '%#v'", x.Select)
	switch t := x.Select.(type) {
	case *SexpSymbol:
		Q("SexpHashSelector.RHS(): x.Select is symbol, t = '%#v'", t)
		Q("SexpHashSelector.RHS(): x.Container is '%v'",
			x.Container.SexpString(nil))
		sx, err = x.Container.DotPathHashGet(x.Container.Env, t)
		if err != nil {
			Q("SexpHashSelector.RHS() sees err when calling"+
				" on x.Container.DotPathHashGet: with query t='%#v' err='%v'", t, err)
			return SexpNull, err
		}
	default:
		Q("SexpHashSelector.RHS() selector is not a symbol, x= '%#v'", x)
		sx, err = x.Container.HashGet(x.Container.Env, x.Select)
		if err != nil {
			Q("SexpHashSelector.RHS() sees err when calling"+
				" on x.Container.HashGet: '%v'", err)
			return SexpNull, err
		}
		//return &SexpStr{S: fmt.Sprintf("(hashidx   %s   %s)", x.Container.SexpString(nil), x.Select.SexpString(nil))}, nil
	}
	Q("SexpHashSelector) RHS() returning sx = '%v'", sx)
	return sx, nil
}
1141639
func newTS() *Set {
	s := &Set{}
	s.m = make(map[interface{}]struct{})

	// Ensure interface compliance
	var _ Interface = s

	return s
}
83232
func (ls *LState) NewThread() (*LState, context.CancelFunc) {
	thread := newLState(ls.Options)
	thread.G = ls.G
	thread.Env = ls.Env
	var f context.CancelFunc = nil
	if ls.ctx != nil {
		thread.mainLoop = mainLoopWithContext
		thread.ctx, f = context.WithCancel(ls.ctx)
	}
	return thread, f
}
317216
func (x *SexpArraySelector) RHS(env *Zlisp) (Sexp, error) {
	if len(x.Select.Val) != 1 {
		return SexpNull, fmt.Errorf("SexpArraySelector: only " +
			"size 1 selectors implemented")
	}
	var i int64
	switch asInt := x.Select.Val[0].(type) {
	case *SexpInt:
		i = asInt.Val
	default:
		return SexpNull, fmt.Errorf("SexpArraySelector: int "+
			"selector required; we saw %T", x.Select.Val[0])
	}
	if i < 0 {
		return SexpNull, fmt.Errorf("SexpArraySelector: negative "+
			"indexes not supported; we saw %v", i)
	}
	if i >= int64(len(x.Container.Val)) {
		return SexpNull, fmt.Errorf("SexpArraySelector: index "+
			"%v is out-of-bounds; length is %v", i, len(x.Container.Val))
	}
	ret := x.Container.Val[i]
	Q("arraySelector returning ret = %#v", ret)
	return ret, nil
}
474168
func NewTerrainMap(bounds coord.Bounds, s string) (TerrainMap, error) {
	tm, err := NewTerrainArray(bounds, s)
	if err != nil {
		return TerrainMap{}, err
	}

	return TerrainMap{bounds, tm}, nil
}
1173586
func (glpeer *GLPeer) NewTexture(s sprite.SubTex) *Texture {
	return &Texture{
		subTex: s,
	}
}
255485
func (mh *MethodHandler) Headers(headerNames ...string) *MethodHandler {
	if mh.headers == nil {
		mh.headers = make([]string, 0)
	}
	mh.headers = append(mh.headers, headerNames...)
	return mh
}
34552
func NewTreePool(hasher BaseHasherFunc, segmentCount, capacity int) *TreePool {
	// initialises the zerohashes lookup table
	depth := calculateDepthFor(segmentCount)
	segmentSize := hasher().Size()
	zerohashes := make([][]byte, depth+1)
	zeros := make([]byte, segmentSize)
	zerohashes[0] = zeros
	h := hasher()
	for i := 1; i < depth+1; i++ {
		zeros = doSum(h, nil, zeros, zeros)
		zerohashes[i] = zeros
	}
	return &TreePool{
		c:            make(chan *tree, capacity),
		hasher:       hasher,
		SegmentSize:  segmentSize,
		SegmentCount: segmentCount,
		Capacity:     capacity,
		Size:         segmentCount * segmentSize,
		Depth:        depth,
		zerohashes:   zerohashes,
	}
}
1044748
func HSTS(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
		next.ServeHTTP(w, r)
	})
}