// NewSparkline returns a unrenderable single sparkline that needs to be added to a SparklineGroup
433554
func NewSparkline() *Sparkline {
	return &Sparkline{
		TitleStyle: Theme.Sparkline.Title,
		LineColor:  Theme.Sparkline.Line,
	}
}
495498
func newSegment(name string, r *http.Request) *awsxray.Segment {
	// attempt to get IDs first
	parentId := getParentId(r.Header)
	traceId := getTraceId(r.Header)

	// now set the trace ID
	traceHdr := r.Header.Get(awsxray.TraceHeader)
	traceHdr = awsxray.SetTraceId(traceHdr, traceId)

	// create segment
	s := &awsxray.Segment{
		Id:        getRandom(8),
		HTTP:      newHTTP(r),
		Name:      name,
		TraceId:   traceId,
		StartTime: float64(time.Now().Truncate(time.Millisecond).UnixNano()) / 1e9,
	}

	// if we have a parent then we are a subsegment
	if len(parentId) > 0 {
		s.ParentId = parentId
		s.Type = "subsegment"
	} else {
		// set a new parent Id
		traceHdr = awsxray.SetParentId(traceHdr, s.Id)
	}

	// now save the header for the future context
	r.Header.Set(awsxray.TraceHeader, traceHdr)

	return s
}
504158
func NewSQLMapper(filename string, conn *sql.DB) (*SQLMapper, error) {
	conf, confErr := GetSQLConfFromFile(filename)
	if confErr != nil {
		return nil, confErr
	}

	return &SQLMapper{conf: conf, sqlConn: conn}, nil
}
64337
func NewStackLines(skip int, messages ...interface{}) Composer {
	return &stackMessage{
		trace:    captureStack(skip),
		Composer: NewLine(messages...),
	}
}
109002
func NewSource(ctx *plan.Context, p *plan.Source) (*Source, error) {

	if p.Stmt == nil {
		return nil, fmt.Errorf("must have from for Source")
	}
	if p.Conn == nil {
		return nil, fmt.Errorf("Must have existing connection on Plan")
	}

	scanner, hasScanner := p.Conn.(schema.ConnScanner)

	// Some sources require context so we seed it here
	if sourceContext, needsContext := p.Conn.(RequiresContext); needsContext {
		sourceContext.SetContext(ctx)
	}

	if !hasScanner {
		e, hasSourceExec := p.Conn.(ExecutorSource)
		if hasSourceExec {
			s := &Source{
				TaskBase:   NewTaskBase(ctx),
				ExecSource: e,
				p:          p,
			}
			return s, nil
		}
		u.Warnf("source %T does not implement datasource.Scanner", p.Conn)
		return nil, fmt.Errorf("%T Must Implement Scanner for %q", p.Conn, p.Stmt.String())
	}
	s := &Source{
		TaskBase: NewTaskBase(ctx),
		Scanner:  scanner,
		p:        p,
	}
	return s, nil
}
36237
func (c *Conn) NewStream() (inet.Stream, error) {
	ts, err := c.conn.OpenStream()
	if err != nil {
		return nil, err
	}
	return c.addStream(ts, inet.DirOutbound)
}
416120
func NewSerializer(meta MetaFactory, creater runtime.ObjectCreater, typer runtime.ObjectTyper, pretty bool) *Serializer {
	return NewSerializerWithOptions(meta, creater, typer, SerializerOptions{false, pretty, false})
}
1169326
func NewStream(ctx context.Context, method string, conn *Conn) (Stream, error) {
	if ctx == nil {
		ctx = context.Background()
	}

	return newStreamClient(ctx, method, conn)
}
1237593
func Line(nums []float64) string {
	if len(nums) == 0 {
		return ""
	}
	indices := normalize(nums)
	var sparkline bytes.Buffer
	for _, index := range indices {
		sparkline.WriteRune(steps[index])
	}
	return sparkline.String()
}
447279
func WalkLines(inpReader io.Reader, walkFn WalkLineFn) error {
	reader := bufio.NewReader(inpReader)

	var walkErr error
	line, readErr := ReadLongLine(reader)
	for ; walkErr == nil && readErr == nil; line, readErr = ReadLongLine(reader) {
		walkErr = walkFn(line)
	}

	// if walk returned an error (other than io.EOF)
	// return that error
	if walkErr != nil && walkErr != io.EOF {
		return walkErr
	}

	// otherwise, if there was a read error (except io.EOF), return that
	if readErr != nil && readErr != io.EOF {
		return readErr
	}

	return nil
}
216492
func (l *WAL) newSegmentFile() error {
	l.currentSegmentID++
	if l.currentSegmentWriter != nil {
		l.sync()

		if err := l.currentSegmentWriter.close(); err != nil {
			return err
		}
		l.tracker.SetOldSegmentSize(uint64(l.currentSegmentWriter.size))
	}

	fileName := filepath.Join(l.path, fmt.Sprintf("%s%05d.%s", WALFilePrefix, l.currentSegmentID, WALFileExtension))
	fd, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR, 0666)
	if err != nil {
		return err
	}
	l.currentSegmentWriter = NewWALSegmentWriter(fd)
	l.tracker.IncSegments()

	// Reset the current segment size stat
	l.tracker.SetCurrentSegmentSize(0)
	return nil
}
1330040
func processLine(d *Directive, token []byte, stripLeftWhitespace bool) ([]byte, error) {
	if stripLeftWhitespace {
		token = trimWhitespace(token)
	}
	return trimComments(token), d.possibleParserDirective(string(token))
}
548510
func (builder *Builder) NextLine(n uint) *Builder {
	return builder.With(NextLine(n))
}
9595
func (d *Document) CurrentLineBeforeCursor() string {
	s := strings.Split(d.TextBeforeCursor(), "\n")
	return s[len(s)-1]
}
1335446
func NewServiceRecord(instance, service, domain string) *ServiceRecord {
	return &ServiceRecord{instance, service, domain, "", "", ""}
}
1002988
func NewStandaloneFile(filespace filesystem.Filespace, path, mime string) (filesystem.File, error) {
	now := time.Now()
	base := filepath.Base(path)
	return &StandaloneFile{
		filespace:  filespace,
		path:       path,
		mime:       mime,
		createTime: now,
		name:       base,
	}, nil
}
349346
func (t *TextTable) AddRowLine() error {
	rowLine := &tableRow{kind: ROW_LINE}
	t.rows = append(t.rows, rowLine)

	return nil
}