def get_patches_for_filename(cls, filename):
     return [p for p in session.query(Patch).all()
             if p.target_filename == filename]
 def clear_empty_patchsets(cls):
     for ps in session.query(PatchSet).all():
         if len(ps.patches) == 0:
             session.delete(ps)
     session.commit()