// GetChar will read and return a char value from an ast.BasicLit
491880
func GetChar(n ast.Node) (byte, error) {
	if node, ok := n.(*ast.BasicLit); ok && node.Kind == token.CHAR {
		return node.Value[0], nil
	}
	return 0, fmt.Errorf("Unexpected AST node type: %T", n)
}
1113927
func (r Row) GetString(colIdx int) string {
	col := r.c.columns[colIdx]
	start, end := col.offsets[r.idx], col.offsets[r.idx+1]
	str := string(hack.String(col.data[start:end]))
	return str
}
1185094
func stringToChar(s string) *C.char {
	ptrStr := (*reflect.StringHeader)(unsafe.Pointer(&s))
	return (*C.char)(unsafe.Pointer(ptrStr.Data))
}
965451
func (c *Carbon) GetTranslator() (*Translator, error) {
	if c.Translator == nil {
		c.Translator = translator()
	}

	return c.Translator, nil
}
345312
func (c *Conn) getWriter() io.Writer {
	if c.bufferedWriter != nil {
		return c.bufferedWriter
	}
	return c.conn
}
1307375
func byteToChar(b []byte) *C.char {
	var c *C.char
	if len(b) > 0 {
		c = (*C.char)(unsafe.Pointer(&b[0]))
	}
	return c
}
699784
func GetParser(buf []byte) Parser {
	for _, p := range parsers() {
		b := bytes.NewBuffer(buf)
		if p.Init(b) {
			return p
		}
	}

	return nil
}
1343165
func getCode(s string) string {
	if !strings.HasPrefix(s, `"`) || !strings.HasSuffix(s, `"`) {
		panic(fmt.Sprintf("expected string, got: %s", s))
	}

	return s[1 : len(s)-1]
}
1308272
func GetAllCharsets() []*Desc {
	descs := make([]*Desc, 0, len(charsets))
	// The charsetInfos is an array, so the iterate order will be stable.
	for _, ci := range charsetInfos {
		c, ok := charsets[ci.Name]
		if !ok {
			continue
		}
		desc := &Desc{
			Name:             c.Name,
			DefaultCollation: c.DefaultCollation.Name,
			Desc:             c.Desc,
			Maxlen:           c.Maxlen,
		}
		descs = append(descs, desc)
	}
	return descs
}
1319620
func GetInt(n ast.Node) (int64, error) {
	if node, ok := n.(*ast.BasicLit); ok && node.Kind == token.INT {
		return strconv.ParseInt(node.Value, 0, 64)
	}
	return 0, fmt.Errorf("Unexpected AST node type: %T", n)
}
189720
func (s *Session) GetString(ctx context.Context, key string) string {
	val := s.Get(ctx, key)
	str, ok := val.(string)
	if !ok {
		return ""
	}
	return str
}
403858
func GetText(imgPath string, args ...string) (string, error) {
	var lang = "eng"

	if len(args) > 0 {
		lang = args[0]
		if lang == "zh" {
			lang = "chi_sim"
		}
	}

	client := gosseract.NewClient()
	defer client.Close()

	client.SetImage(imgPath)
	client.SetLanguage(lang)
	return client.Text()
}
216974
func (s *InMemorySender) GetString() ([]string, error) {
	msgs := s.Get()
	strs := make([]string, 0, len(msgs))
	for _, msg := range msgs {
		str, err := s.Formatter(msg)
		if err != nil {
			return nil, err
		}
		strs = append(strs, str)
	}
	return strs, nil
}
356649
func IsAllCharsIn(s, encoding string) bool {
	var is = true
	for i := 0; i < len(s) && is; i++ {
		is = index.CharIn(s[i], encoding) >= 0
	}

	return is
}
810446
func getColorLevel(level string) string {
	level = strings.ToUpper(level)
	switch level {
	case "TRAC":
		return fmt.Sprintf("\033[%dm%s\033[0m", Blue, level)
	case "ERRO":
		return fmt.Sprintf("\033[%dm%s\033[0m", Red, level)
	case "WARN":
		return fmt.Sprintf("\033[%dm%s\033[0m", Magenta, level)
	case "SUCC":
		return fmt.Sprintf("\033[%dm%s\033[0m", Green, level)
	default:
		return level
	}
}
1038124
func UnicodeChar(table *unicode.RangeTable) gopter.Gen {
	if table == nil || len(table.R16)+len(table.R32) == 0 {
		return Fail(reflect.TypeOf(rune('a')))
	}
	return func(genParams *gopter.GenParameters) *gopter.GenResult {
		tableIdx := genParams.Rng.Intn(len(table.R16) + len(table.R32))

		var selectedRune rune
		if tableIdx < len(table.R16) {
			r := table.R16[tableIdx]
			runeOffset := uint16(genParams.Rng.Int63n(int64((r.Hi-r.Lo+1)/r.Stride))) * r.Stride
			selectedRune = rune(runeOffset + r.Lo)
		} else {
			r := table.R32[tableIdx-len(table.R16)]
			runeOffset := uint32(genParams.Rng.Int63n(int64((r.Hi-r.Lo+1)/r.Stride))) * r.Stride
			selectedRune = rune(runeOffset + r.Lo)
		}
		genResult := gopter.NewGenResult(selectedRune, gopter.NoShrinker)
		genResult.Sieve = func(v interface{}) bool {
			return unicode.Is(table, v.(rune))
		}
		return genResult
	}
}
575013
func litToString(lit *ast.BasicLit) (v string) {
	if lit.Kind != token.STRING {
		panic("expected string")
	}
	v, err := strconv.Unquote(string(lit.Value))
	if err != nil {
		panic("cannot unquote")
	}
	return v
}