MCPcopy
hub / github.com/skywind3000/ECDICT / __obj_decode

Method __obj_decode

stardict.py:815–837  ·  view source on GitHub ↗
(self, row)

Source from the content-addressed store, hash-verified

813
814 # 对象解码
815 def __obj_decode (self, row):
816 if row is None:
817 return None
818 obj = {}
819 obj['id'] = row[COLUMN_ID]
820 obj['sw'] = row[COLUMN_SW]
821 skip = self.__numbers
822 for key, index in self.__fields:
823 value = row[index]
824 if index in skip:
825 if value is not None:
826 value = self.readint(value)
827 elif key != 'detail':
828 value = self.decode(value)
829 obj[key] = value
830 detail = obj.get('detail', None)
831 if detail is not None:
832 if detail != '':
833 detail = json.loads(detail)
834 else:
835 detail = None
836 obj['detail'] = detail
837 return obj
838
839 # 对象编码
840 def __obj_encode (self, obj):

Callers 1

queryMethod · 0.95

Calls 3

readintMethod · 0.95
decodeMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected