Wire up recursive references for all TStruct definitions inside of each thrift_spec.
(all_structs)
| 26 | |
| 27 | |
| 28 | def fix_spec(all_structs): |
| 29 | """Wire up recursive references for all TStruct definitions inside of each thrift_spec.""" |
| 30 | for struc in all_structs: |
| 31 | spec = struc.thrift_spec |
| 32 | for thrift_spec in spec: |
| 33 | if thrift_spec is None: |
| 34 | continue |
| 35 | elif thrift_spec[TYPE_IDX] == TType.STRUCT: |
| 36 | other = thrift_spec[SPEC_ARGS_IDX][SPEC_ARGS_CLASS_REF_IDX].thrift_spec |
| 37 | thrift_spec[SPEC_ARGS_IDX][SPEC_ARGS_THRIFT_SPEC_IDX] = other |
| 38 | elif thrift_spec[TYPE_IDX] in (TType.LIST, TType.SET): |
| 39 | _fix_list_or_set(thrift_spec[SPEC_ARGS_IDX]) |
| 40 | elif thrift_spec[TYPE_IDX] == TType.MAP: |
| 41 | _fix_map(thrift_spec[SPEC_ARGS_IDX]) |
| 42 | |
| 43 | |
| 44 | def _fix_list_or_set(element_type): |
nothing calls this directly
no test coverage detected