Example #1
    def __init__(self, available_targets, file_name):
        configuration = dict(
            title="Discovery manager configure file",
            description="List of all fpga targets provided by discovery manager",

        with open(file_name, 'w') as config_file:
            jsondump(configuration, config_file, sort_keys=True, indent=4)
Example #2
    def dump(self, filename):
        """ Stores a Cube object in a json text file

        A dictionary with every side of the cube is written to a text
        file formated in JSON.

        The json module doesn't have support for numpy arrays so those are
        converted to normal python arrays first.


        dictionary = dict()
        dictionary["front"] = [list(elem) for elem in self.front]
        dictionary["back"]  = [list(elem) for elem in self.back]
        dictionary["left"]  = [list(elem) for elem in self.left]
        dictionary["right"] = [list(elem) for elem in self.right]
        dictionary["up"]    = [list(elem) for elem in self.up]
        dictionary["down"]  = [list(elem) for elem in self.down]
        file_handle = open(filename, 'r+')
        jsondump(dictionary, file_handle)
Example #3
def dump(obj, fp):
    jsondump(obj, fp, indent=4)
Example #4
        #if not unzipto(absolute, temppath):
        #    print u'错误:解压 %s 失败!'%args.src
        #    sys.exit(1)

        bigdict, msg_anim = parsefla(d)
        if not bigdict:

        # 使用flash自带功能搞定
        # packimages(d, outputroot)

        # dump protocol msg
        msgdestpath = os.path.join(outputroot, current_filename+'.anim')
        dumpmsg(msg_anim, msgdestpath)
        print 'write', msgdestpath

        # dump animxml
        destpath = os.path.join(outputroot, current_filename+'.animxml')
        dumpplist(bigdict, destpath)
        print 'write', destpath

        if False:
            destpath = os.path.join(outputroot, os.path.splitext(f)[0]+'.animxml.json')
            result = jsondump(bigdict, file(destpath, 'w'), indent=4)
            print 'write', destpath

    # 生成索引
    #print u'生成索引'
    #import genindex
Example #5
#set longitude values - Y values
#minx = -180
#maxx = 180

minx = 40
maxx = 65

#set latitude values - X values
#miny = -23.5
#maxy = 23.5

miny = 11.5
maxy = 15.5

print "Start Time:", strftime("%a, %d %b %Y %H:%M:%S")
#Print the column headers
#print >>f, "ID",",","X",",","Y"
for x in range(0,numpoints):
#print >>f, x,",", random.uniform(minx,maxx),",",                      random.uniform(miny,maxy)
    rec = {'lat': random.uniform(minx,maxx), 'lng': random.uniform(miny,maxy),
    'media': 'http://placehold.it/200x200',
    'text': get_lipsum(random.randint(12,140), 'bytes', 'no')[0],
    'category': random.randint(0,9)
    print jsondump(rec)
    r = requests.post("http://emea-fr-01.services.massforstroel.se/ads", data=jsondump(rec))
    print r.text

print "Script Complete, Hooray!", numpoints, "random points generated"
print "End Time:", strftime("%a, %d %b %Y %H:%M:%S")