code: def fix_spec(all_structs):
      """Wire up recursive references for all TStruct definitions inside of each thrift_spec."""
      for struc in all_structs:
          spec = struc.thrift_spec
          for thrift_spec in spec:
              if thrift_spec is None:
                  continue
              elif thrift_spec[TYPE_IDX] == TType.STRUCT:
                  other = thrift_spec[SPEC_ARGS_IDX][
                      SPEC_ARGS_CLASS_REF_IDX
                  ].thrift_spec
                  thrift_spec[SPEC_ARGS_IDX][
                      SPEC_ARGS_THRIFT_SPEC_IDX
                  ] = other
              elif thrift_spec[TYPE_IDX] in (TType.LIST, TType.SET):
                  _fix_list_or_set(thrift_spec[SPEC_ARGS_IDX])
              elif thrift_spec[TYPE_IDX] == TType.MAP:
                  _fix_map(thrift_spec[SPEC_ARGS_IDX])
  
file_path: infinity/third_party/thrift/lib/py/src/TRecursive.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from thrift.Thrift import TType
label_desc: Use image node_id 1 for calling a global function with example usage: fix_spec(all_structs) without return types