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


Python stat.st_size方法代码示例

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


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

示例1: _is_current

# 需要导入模块: import stat [as 别名]
# 或者: from stat import st_size [as 别名]
def _is_current(self, file_path, zip_path):
        """
        Return True if the file_path is current for this zip_path
        """
        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
        if not os.path.isfile(file_path):
            return False
        stat = os.stat(file_path)
        if stat.st_size!=size or stat.st_mtime!=timestamp:
            return False
        # check that the contents match
        zip_contents = self.loader.get_data(zip_path)
        f = open(file_path, 'rb')
        file_contents = f.read()
        f.close()
        return zip_contents == file_contents 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:18,代码来源:pkg_resources.py

示例2: get_file_sha256

# 需要导入模块: import stat [as 别名]
# 或者: from stat import st_size [as 别名]
def get_file_sha256(self, path:str) -> list:
        """
        Checks if the file has a stored sha256 value

        :param path:
        :return: A list of sha256 strings
        """

        stat = os.stat(path)
        abspath = Path(path).resolve()

        existing_entries = DataFile.select().where(
            (
                (DataFile.abspath == abspath) &
                (DataFile.mtime == stat.st_mtime) &
                (DataFile.size == stat.st_size)
            )
        )

        sha256 = [e.sha256 for e in existing_entries]
        return sha256 
开发者ID:rstojnic,项目名称:lazydata,代码行数:23,代码来源:local.py

示例3: _is_current

# 需要导入模块: import stat [as 别名]
# 或者: from stat import st_size [as 别名]
def _is_current(self, file_path, zip_path):
        """
        Return True if the file_path is current for this zip_path
        """
        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
        if not os.path.isfile(file_path):
            return False
        stat = os.stat(file_path)
        if stat.st_size != size or stat.st_mtime != timestamp:
            return False
        # check that the contents match
        zip_contents = self.loader.get_data(zip_path)
        with open(file_path, 'rb') as f:
            file_contents = f.read()
        return zip_contents == file_contents 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:17,代码来源:__init__.py

示例4: _is_current

# 需要导入模块: import stat [as 别名]
# 或者: from stat import st_size [as 别名]
def _is_current(self, file_path, zip_path):
        """
        Return True if the file_path is current for this zip_path
        """
        timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
        if not os.path.isfile(file_path):
            return False
        stat = os.stat(file_path)
        if stat.st_size!=size or stat.st_mtime!=timestamp:
            return False
        # check that the contents match
        zip_contents = self.loader.get_data(zip_path)
        with open(file_path, 'rb') as f:
            file_contents = f.read()
        return zip_contents == file_contents 
开发者ID:jpush,项目名称:jbox,代码行数:17,代码来源:__init__.py


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