text stringlengths 0 828 |
|---|
:returns: a JSON serializable python object |
"""""" |
return {'__Ci__': (self.id, self.specfile, self.dataProcessingRef, |
self.precursor, self.product, self.params, |
self.attrib, self.arrayInfo |
) |
}" |
1940,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.Ci` from a decoded |
JSON object (as generated by :func:`maspy.core.Ci._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`Ci` |
"""""" |
newInstance = cls(jsonobject[0], jsonobject[1]) |
attribDict = {} |
attribDict['dataProcessingRef'] = jsonobject[2] |
attribDict['precursor'] = jsonobject[3] |
attribDict['product'] = jsonobject[4] |
attribDict['params'] = [tuple(param) for param in jsonobject[5]] |
attribDict['attrib'] = jsonobject[6] |
attribDict['arrayInfo'] = dict() |
for arrayType, jsonEntry in viewitems(jsonobject[7]): |
arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'], |
'params': [tuple(_) for _ in jsonEntry['params']] |
} |
attribDict['arrayInfo'][arrayType] = arrayEntry |
for key, value in viewitems(attribDict): |
setattr(newInstance, key, value) |
return newInstance" |
1941,"def jsonHook(encoded): |
""""""Custom JSON decoder that allows construction of a new ``Ci`` instance |
from a decoded JSON object. |
:param encoded: a JSON decoded object literal (a dict) |
:returns: ""encoded"" or one of the these objects: :class:`Ci`, |
:class:`MzmlProduct`, :class:`MzmlPrecursor` |
"""""" |
if '__Ci__' in encoded: |
return Ci._fromJSON(encoded['__Ci__']) |
elif '__MzmlProduct__' in encoded: |
return MzmlProduct._fromJSON(encoded['__MzmlProduct__']) |
elif '__MzmlPrecursor__' in encoded: |
return MzmlPrecursor._fromJSON(encoded['__MzmlPrecursor__']) |
else: |
return encoded" |
1942,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.Sai` from a decoded |
JSON object (as generated by :func:`maspy.core.Sai._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`Sai` |
"""""" |
newInstance = cls(jsonobject[0], jsonobject[1]) |
for arrayType, jsonEntry in viewitems(jsonobject[2]): |
arrayEntry = {'dataProcessingRef': jsonEntry['dataProcessingRef'], |
'params': [tuple(_) for _ in jsonEntry['params']] |
} |
newInstance.arrayInfo[arrayType] = arrayEntry |
return newInstance" |
1943,"def _reprJSON(self): |
""""""Returns a JSON serializable represenation of a ``Smi`` class |
instance. Use :func:`maspy.core.Sai._fromJSON()` to generate a new |
``Smi`` instance from the return value. |
:returns: a JSON serializable python object |
"""""" |
return {'__Smi__': (self.id, self.specfile, self.attributes, |
self.params, self.scanListParams, self.scanList, |
self.precursorList, self.productList |
) |
}" |
1944,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.Smi` from a decoded |
JSON object (as generated by :func:`maspy.core.Smi._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`Smi` |
"""""" |
newInstance = cls(None, None) |
attribDict = {} |
attribDict['id'] = jsonobject[0] |
attribDict['specfile'] = jsonobject[1] |
attribDict['attributes'] = jsonobject[2] |
attribDict['params'] = [tuple(param) for param in jsonobject[3]] |
attribDict['scanListParams'] = [tuple(param) for param in jsonobject[4]] |
attribDict['scanList'] = jsonobject[5] |
attribDict['precursorList'] = jsonobject[6] |
attribDict['productList'] = jsonobject[7] |
for key, value in viewitems(attribDict): |
setattr(newInstance, key, value) |
return newInstance" |
1945,"def jsonHook(encoded): |
""""""Custom JSON decoder that allows construction of a new ``Smi`` |
instance from a decoded JSON object. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.