Пример #1
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
  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
Пример #3
0
 def testDatetimeConversion(self):
   dt_str = '2013-04-12T00:22:27.000Z'
   self.assertEqual(dt_str,
                    common.posix_to_dt_str(common.dt_str_to_posix(dt_str)))
Пример #4
0
 def testDatetimeConversion(self):
     dt_str = '2013-04-12T00:22:27.000Z'
     self.assertEqual(
         dt_str, common.posix_to_dt_str(common.dt_str_to_posix(dt_str)))