当前位置: 首页>>代码示例>>Python>>正文


Python stat.ST_ATIME属性代码示例

本文整理汇总了Python中stat.ST_ATIME属性的典型用法代码示例。如果您正苦于以下问题:Python stat.ST_ATIME属性的具体用法?Python stat.ST_ATIME怎么用?Python stat.ST_ATIME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在stat的用法示例。


在下文中一共展示了stat.ST_ATIME属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_statistics

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def show_statistics(self):
        """Show general file and table statistics
        """

        print "# File Statistics:"
        file_stats = os.stat(self.frm_path)
        file_info = {
            'Size': file_stats[stat.ST_SIZE],
            'Last Modified': time.ctime(file_stats[stat.ST_MTIME]),
            'Last Accessed': time.ctime(file_stats[stat.ST_ATIME]),
            'Creation Time': time.ctime(file_stats[stat.ST_CTIME]),
            'Mode': file_stats[stat.ST_MODE],
        }
        for value, data in file_info.iteritems():
            print "#%22s : %s" % (value, data)
        print

        # Fail if we cannot read the file
        try:
            self.frm_file = open(self.frm_path, "rb")
        except Exception, error:
            raise UtilError("The file %s cannot be read.\n%s" %
                            (self.frm_path, error))

        # Read the file type 
开发者ID:mysql,项目名称:mysql-utilities,代码行数:27,代码来源:frm_reader.py

示例2: test_only_new

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def test_only_new(self):
        restoreFile = os.path.join(self.include.name, 'test')
        self.prepairFileInfo(restoreFile)
        with open(restoreFile, 'wt') as f:
            f.write('fooooooooooooooooooo')

        # change mtime to be newer than the one in snapshot
        st = os.stat(restoreFile)
        atime = st[stat.ST_ATIME]
        mtime = st[stat.ST_MTIME]
        new_mtime = mtime + 3600
        os.utime(restoreFile, (atime, new_mtime))

        self.sn.restore(self.sid, restoreFile, only_new = True)
        self.assertIsFile(restoreFile)
        with open(restoreFile, 'rt') as f:
            self.assertEqual(f.read(), 'fooooooooooooooooooo') 
开发者ID:bit-team,项目名称:backintime,代码行数:19,代码来源:test_restore.py

示例3: last_access_time

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def last_access_time(path):
    """
    Return the number of seconds since the epoch of the last access of a
    given file.

    """
    return os.stat(path)[stat.ST_ATIME] 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:9,代码来源:cmodule.py

示例4: get_file_info

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def get_file_info(system, path, verbose=False):
    fullpath = get_fullpath(system, path)
    if fullpath == IO_ERROR:
        return IO_ERROR
    
    result = {}    
    if system.startswith('/'): # local or sub
        if can_read(system, path):
            # TODO platform-specific
            stats = os.stat(fullpath)
            stm = stats.st_mode
            result['type'] = get_file_type_char(stat.S_IFMT(stm))
            result['permissions'] = '%o' % (stat.S_IMODE(stm))
            result['UID'] = stats[stat.ST_UID]
            result['GID'] = stats[stat.ST_GID]
            result['ATIME'] = stats[stat.ST_ATIME]
            result['MTIME'] = stats[stat.ST_MTIME]
            result['CTIME'] = stats[stat.ST_CTIME] # actually mtime on UNIX, TODO
        else:
            if verbose:
                log.info('File \'%s\' is not accessible.' % (fullpath))
            result['type'] = None
            result['permissions'] =  None
            result['UID'] = None
            result['GID'] = None
            result['ATIME'] = None
            result['MTIME'] = None
            result['CTIME'] = None
        return result

    else: # SSH/FTP/TFTP/HTTP
        # TODO NOT IMPLEMENTED
        return IO_ERROR 
开发者ID:lightfaith,项目名称:locasploit,代码行数:35,代码来源:io.py

示例5: updateModificationTime

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def updateModificationTime(path):
    accessTime = os.stat(path)[stat.ST_ATIME]
    modificationTime = time.time()
    os.utime(path, (accessTime, modificationTime)) 
开发者ID:luoliyan,项目名称:incremental-reading,代码行数:6,代码来源:util.py

示例6: getatime

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def getatime(self):
        st = self.statinfo
        if not st:
            self.restat()
            st = self.statinfo
        return st[ST_ATIME] 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:8,代码来源:filepath.py

示例7: _write_infos_to_temp

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_ATIME [as 别名]
def _write_infos_to_temp(temp_folder, original_stat, infos):
  times = (original_stat[stat.ST_ATIME], original_stat[stat.ST_MTIME])

  for name, info in infos.items():
    out = os.path.join(temp_folder, name)
    with open(out, 'w') as f:
      f.write(info)
    os.utime(out, times) 
开发者ID:JakeWharton,项目名称:jardiff,代码行数:10,代码来源:jardiff.py


注:本文中的stat.ST_ATIME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。