當前位置: 首頁>>代碼示例>>Python>>正文


Python stat.st_mtime方法代碼示例

本文整理匯總了Python中stat.st_mtime方法的典型用法代碼示例。如果您正苦於以下問題:Python stat.st_mtime方法的具體用法?Python stat.st_mtime怎麽用?Python stat.st_mtime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在stat的用法示例。


在下文中一共展示了stat.st_mtime方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _is_current

# 需要導入模塊: import stat [as 別名]
# 或者: from stat import st_mtime [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_mtime [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: load

# 需要導入模塊: import stat [as 別名]
# 或者: from stat import st_mtime [as 別名]
def load(self, path):
        """
        Load a manifest at path or return a suitable manifest already loaded.
        """
        path = os.path.normpath(path)
        mtime = os.stat(path).st_mtime

        if path not in self or self[path].mtime != mtime:
            manifest = self.build(path)
            self[path] = self.manifest_mod(manifest, mtime)

        return self[path].manifest 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:14,代碼來源:__init__.py

示例4: _is_current

# 需要導入模塊: import stat [as 別名]
# 或者: from stat import st_mtime [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

示例5: _is_current

# 需要導入模塊: import stat [as 別名]
# 或者: from stat import st_mtime [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_mtime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。