MCPcopy Create free account
hub / github.com/apache/thrift / fix_spec

Function fix_spec

lib/py/src/TRecursive.py:28–41  ·  view source on GitHub ↗

Wire up recursive references for all TStruct definitions inside of each thrift_spec.

(all_structs)

Source from the content-addressed store, hash-verified

26
27
28def 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
44def _fix_list_or_set(element_type):

Callers

nothing calls this directly

Calls 2

_fix_list_or_setFunction · 0.85
_fix_mapFunction · 0.85

Tested by

no test coverage detected