gallerifrey.py
def writeCategories(imagesByCategory):
    """Writes the given dictionary of (category -> image set)
to the category files."""
    for (catname, imgset) in imagesByCategory.iteritems():
        # Python sets have no defined iteration order.
        # So we do some shenanigans to make sure it's alphabetical.
        imglist = list(imgset)
        imglist.sort()
        catfilename = os.path.join(CATEGORYDIR, catname)
        bakfilename = catfilename + ".bak"
        tmpfilename = catfilename + ".tmp"
        with open(tmpfilename, 'w') as f:
            imglist = [x + '\n' for x in imglist]
            f.writelines(imglist)

        # Move temp file to real file
        try:
            shutil.copyfile(catfilename, bakfilename)
        except IOError:
            # It's okay if CATEGORYFILE doesn't exist
            pass
        os.rename(tmpfilename, catfilename)
Writes the given dictionary of (category -> image set)
to the category files.
Writes the given dictionary of (category -> image set)
to the category files.
Writes the given dictionary of ( category - > image set ) to the category files .
def writeCategories(imagesByCategory):
    for (catname, imgset) in imagesByCategory.iteritems():
        imglist = list(imgset)
        imglist.sort()
        catfilename = os.path.join(CATEGORYDIR, catname)
        bakfilename = catfilename + ".bak"
        tmpfilename = catfilename + ".tmp"
        with open(tmpfilename, 'w') as f:
            imglist = [x + '\n' for x in imglist]
            f.writelines(imglist)
        try:
            shutil.copyfile(catfilename, bakfilename)
        except IOError:
            pass
        os.rename(tmpfilename, catfilename)
def writeCategories ( imagesByCategory ) : for ( catname , imgset ) in imagesByCategory . iteritems ( ) : imglist = list ( imgset ) imglist . sort ( ) catfilename = os . path . join ( CATEGORYDIR , catname ) bakfilename = catfilename + ".bak" tmpfilename = catfilename + ".tmp" with open ( tmpfilename , 'w' ) as f : imglist = [ x + '\n' for x in imglist ] f . writelines ( imglist ) try : shutil . copyfile ( catfilename , bakfilename ) except IOError : pass os . rename ( tmpfilename , catfilename )
Writes the given dictionary of (category -> image set)
to the category files.
Writes the given dictionary of ( category - > image set ) to the category files .
"""Writes the given dictionary of (category -> image set)
to the category files.""" # Python sets have no defined iteration order. # So we do some shenanigans to make sure it's alphabetical. # Move temp file to real file # It's okay if CATEGORYFILE doesn't exist
imagesByCategory