示例#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
文件: common_test.py 项目: uri247/lib
 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)))
 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)))