docstr: Return a `(arrow type, list)` tuple where the arrow type
  corresponds to the given logical *type_name*, and the list
  is a list of *n* random-generated Python objects compatible
  with the arrow type.
docstr_tok: ["Return","a","`","(","arrow","type",",","list",")","`","tuple","where","the","arrow","type","corresponds","to","the","given","logical","*","type_name","*",",","and","the","list","is","a","list","of","*","n","*","random-generated","Python","objects","compatible","with","the","arrow","type","."]
code: def get_type_and_builtins(self, n, type_name):
      """
      Return a `(arrow type, list)` tuple where the arrow type
      corresponds to the given logical *type_name*, and the list
      is a list of *n* random-generated Python objects compatible
      with the arrow type.
      """
      size = None
  
      if type_name in (
          "bool",
          "decimal",
          "ascii",
          "unicode",
          "int64 list",
      ):
          kind = type_name
      elif type_name.startswith(("int", "uint")):
          kind = "int"
      elif type_name.startswith("float"):
          kind = "float"
      elif type_name.startswith("struct"):
          kind = "struct"
      elif type_name == "binary":
          kind = "varying binary"
      elif type_name.startswith("binary"):
          kind = "fixed binary"
          size = int(type_name[6:])
          assert size > 0
      else:
          raise ValueError("unrecognized type %r" % (type_name,))
  
      if kind in ("int", "float"):
          ty = getattr(pa, type_name)()
      elif kind == "bool":
          ty = pa.bool_()
      elif kind == "decimal":
          ty = pa.decimal128(9, 9)
      elif kind == "fixed binary":
          ty = pa.binary(size)
      elif kind == "varying binary":
          ty = pa.binary()
      elif kind in ("ascii", "unicode"):
          ty = pa.string()
      elif kind == "int64 list":
          ty = pa.list_(pa.int64())
      elif kind == "struct":
          ty = pa.struct(
              [
                  pa.field("u", pa.int64()),
                  pa.field("v", pa.float64()),
                  pa.field("w", pa.bool_()),
              ]
          )
  
      factories = {
          "int": self.generate_int_list,
          "float": self.generate_float_list,
          "bool": self.generate_bool_list,
          "decimal": self.generate_decimal_list,
          "fixed binary": partial(
              self.generate_fixed_binary_list, size=size
          ),
          "varying binary": partial(
              self.generate_varying_binary_list, min_size=3, max_size=40
          ),
          "ascii": partial(
              self.generate_ascii_string_list, min_size=3, max_size=40
          ),
          "unicode": partial(
              self.generate_unicode_string_list, min_size=3, max_size=40
          ),
          "int64 list": partial(
              self.generate_int_list_list, min_size=0, max_size=20
          ),
          "struct": self.generate_dict_list,
          "struct from tuples": self.generate_tuple_list,
      }
      data = factories[kind](n)
      return ty, data
  
imports: import codecs
  import decimal
  from functools import partial
  import itertools
  import sys
  import unicodedata
  import numpy
  import pyarrow
label_desc: Use image node_id 17 for calling the BuiltinsGenerator obj's underlying member method code with example usage: obj.get_type_and_builtins(n, type_name) and returns: ty,  data