Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)

src/m/g/mgtaxa-HEAD/MGT/TaxaIO.py   mgtaxa(Download)
 
from MGT.Common import *
from MGT.TaxaTree import TaxaNode
import json
 
            # This will not split the last field, but we never use it anyway:
            values = rec.split("\t|\t")
            node = TaxaNode()
            node.id = int(values[0])
            node.idpar = int(values[1])
    def load(self):
        import json
        inp = openCompressed(self.fileName,"rb")
        data = json.load(inp,object_hook=lambda o: TaxaNode(**o) if "idpar" in o else o)
        print "JsonDict Loaded the nodes"
        #return dict( ((node.id,node) for node in nodes) )
        data = ujson.loads(buf)
        data["nodes"] = dict( ((node["id"],TaxaNode(**node)) for node in data["nodes"]) )
        data["merged"] = dict( (item for item in data["merged"]) )
        return data
        #return dict( ((node.id,node) for node in nodes) )
        data = jsonlib.read(buf,use_float=True)
        data["nodes"] = dict( ((node["id"],TaxaNode(**node)) for node in data["nodes"]) )
        data["merged"] = dict( (item for item in data["merged"]) )
        return data

src/m/g/mgtaxa-HEAD/MGT/TaxaIODb.py   mgtaxa(Download)
 
from MGT.Common import *
from MGT.TaxaTree import TaxaNode
from MGT.Sql import *
 
        for chunk in reader.chunks():
            for rec in chunk:
                node = TaxaNode()
                node.id = rec['id']
                node.idpar = rec['idpar']