in server/scripts/cloudstorage/cloudstorage_api.py [0:0]
def _next_file_gen(self, root):
"""Generator for next file element in the document.
Args:
root: root element of the XML tree.
Yields:
GCSFileStat for the next file.
"""
for e in root.getiterator(common._T_CONTENTS):
st_ctime, size, etag, key = None, None, None, None
for child in e.getiterator('*'):
if child.tag == common._T_LAST_MODIFIED:
st_ctime = common.dt_str_to_posix(child.text)
elif child.tag == common._T_ETAG:
etag = child.text
elif child.tag == common._T_SIZE:
size = child.text
elif child.tag == common._T_KEY:
key = child.text
yield common.GCSFileStat(self._path + '/' + key,
size, etag, st_ctime)
e.clear()
yield None