(element_type)
| 55 | |
| 56 | |
| 57 | def _fix_map(element_type): |
| 58 | # For a map of key -> value type, ``element_type`` will be, |
| 59 | # (TType.I16, None, TType.STRUCT, [RecMapBasic, None], False), None, ) |
| 60 | # which is just a normal struct definition. |
| 61 | # |
| 62 | # For a map of key -> list / set, ``element_type`` will be, |
| 63 | # (TType.I16, None, TType.LIST, (TType.STRUCT, [RecMapList, None], False), False) |
| 64 | # and we need to process the 3rd element as a list. |
| 65 | # |
| 66 | # For a map of key -> map, ``element_type`` will be, |
| 67 | # (TType.I16, None, TType.MAP, (TType.I16, None, TType.STRUCT, |
| 68 | # [RecMapMap, None], False), False) |
| 69 | # and need to process 3rd element as a map. |
| 70 | |
| 71 | # Is the map key a struct? |
| 72 | if element_type[0] == TType.STRUCT: |
| 73 | element_type[1][1] = element_type[1][0].thrift_spec |
| 74 | elif element_type[0] in (TType.LIST, TType.SET): |
| 75 | _fix_list_or_set(element_type[1]) |
| 76 | elif element_type[0] == TType.MAP: |
| 77 | _fix_map(element_type[1]) |
| 78 | |
| 79 | # Is the map value a struct? |
| 80 | if element_type[2] == TType.STRUCT: |
| 81 | element_type[3][1] = element_type[3][0].thrift_spec |
| 82 | elif element_type[2] in (TType.LIST, TType.SET): |
| 83 | _fix_list_or_set(element_type[3]) |
| 84 | elif element_type[2] == TType.MAP: |
| 85 | _fix_map(element_type[3]) |
no test coverage detected