// NewScanCmdResult returns a ScanCmd initialised with val and err for testing
483342
func NewScanCmdResult(keys []string, cursor uint64, err error) *ScanCmd {
	var cmd ScanCmd
	cmd.page = keys
	cmd.cursor = cursor
	cmd.setErr(err)
	return &cmd
}
550638
func newScanner(input string) *scanner {
	// Normalize newlines.
	input = strings.Replace(input, "\r\n", "\n", -1)
	return &scanner{
		input: input,
		row:   1,
		col:   1,
	}
}
170896
func NewSecured(s string) (secured, error) {
	var e secured
	err := e.FromString(s)
	if err != nil {
		return 0, err
	}
	return e, nil
}
1042795
func (l *GPSPoint) Scan(src interface{}) error {
	b, ok := src.([]byte)
	if !ok {
		return fmt.Errorf("expected []byte, got %T", src)
	}

	_, err := fmt.Sscanf(string(b), "(%f,%f)", &l.Latitude, &l.Longitude)
	return err
}
264627
func newScanModelRefHandler(fieldNames []string, mr *modelRef) ReplyHandler {
	return func(reply interface{}) error {
		fieldValues, err := redis.Values(reply, nil)
		if err != nil {
			if err == redis.ErrNil {
				return newModelNotFoundError(mr)
			}
			return err
		}
		if err := scanModel(fieldNames, fieldValues, mr); err != nil {
			return err
		}
		return nil
	}
}
652418
func NewZSliceCmdResult(val []Z, err error) *ZSliceCmd {
	var cmd ZSliceCmd
	cmd.val = val
	cmd.setErr(err)
	return &cmd
}
224097
func scannerMode(mode uint) uint {
	var m uint = scanner.InsertSemis
	if mode&ParseComments != 0 {
		m |= scanner.ScanComments
	}
	return m
}
1290177
func (cli *Client) BuildCancel(ctx context.Context, id string) error {
	query := url.Values{}
	query.Set("id", id)

	serverResp, err := cli.post(ctx, "/build/cancel", query, nil, nil)
	ensureReaderClosed(serverResp)
	return err
}
916365
func NewSSEC(key []byte) (ServerSide, error) {
	if len(key) != 32 {
		return nil, errors.New("encrypt: SSE-C key must be 256 bit long")
	}
	sse := ssec{}
	copy(sse[:], key)
	return sse, nil
}
620077
func NewSetAccountCmd(address, account string) *SetAccountCmd {
	return &SetAccountCmd{
		Address: address,
		Account: account,
	}
}
1066277
func NewScanner(r io.Reader) *Scanner {
	return &Scanner{dec: gob.NewDecoder(r)}
}
875302
func NewSegmentMap(size int64) (*SegmentMap, error) {
	if size <= 0 {
		return nil, errors.Errorf("Invalid size: %d", size)
	}

	sm := &SegmentMap{
		maps: make([]map[string]interface{}, size),
		size: size,
	}
	for i := int64(0); i < size; i++ {
		sm.maps[i] = make(map[string]interface{})
	}

	sm.crcTable = crc32.MakeTable(crc32.Castagnoli)
	return sm, nil
}
845903
func (c *Cmd) StderrScanner() (*bufio.Scanner, error) {
	c.stderrPipe = true
	r, err := c.Cmd.StderrPipe()
	if c.StderrEnc != nil {
		if err != nil {
			return nil, err
		}
		return bufio.NewScanner(transform.NewReader(r, c.StderrEnc)), nil
	}
	return bufio.NewScanner(r), nil
}
418932
func NewScaleApplicationCommand() modelcmd.ModelCommand {
	cmd := &scaleApplicationCommand{}
	cmd.newAPIFunc = func() (scaleApplicationAPI, error) {
		root, err := cmd.NewAPIRoot()
		if err != nil {
			return nil, errors.Trace(err)
		}
		return application.NewClient(root), nil
	}
	return modelcmd.Wrap(cmd)
}
1368391
func NewScanner(r io.Reader, path string) *Scanner {
	return &Scanner{
		r: r,
		pos: Pos{
			Path:   path,
			LineNo: 1,
		},
	}
}
264804
func NewSNMP(args SNMPArguments) (*SNMP, error) {
	if err := args.validate(); err != nil {
		return nil, err
	}
	args.setDefault()
	return &SNMP{args: &args}, nil
}
389493
func NewSubmitBlockCmd(hexBlock string, options *SubmitBlockOptions) *SubmitBlockCmd {
	return &SubmitBlockCmd{
		HexBlock: hexBlock,
		Options:  options,
	}
}