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


Python path.getctime方法代碼示例

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


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

示例1: date_created

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def date_created(self, format: str="%A, %B %d, %Y") -> str:
        date = None
        try:
            date = datetime.strptime(self.metadata.InstanceCreationDate+str(round(float(self.metadata.InstanceCreationTime))), "%Y%m%d%H%M%S")
            date = date.strftime(format)
        except (AttributeError, ValueError):
            try:
                date = datetime.strptime(self.metadata.StudyDate, "%Y%m%d")
                date = date.strftime(format)
            except:
                pass
        if date is None:
            try:
                date = datetime.fromtimestamp(osp.getctime(self.path)).strftime(format)
            except AttributeError:
                date = 'Unknown'
        return date 
開發者ID:jrkerns,項目名稱:pylinac,代碼行數:19,代碼來源:image.py

示例2: _file_timestamp

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def _file_timestamp(filename):
        """Gets the last created timestamp of the file/dir."""
        if platform.system() == 'Windows':
            ts = int(path.getctime(filename))
        else:
            stat = os.stat(filename)
            if hasattr(stat, 'st_birthtime'):  # odx
                ts = int(stat.st_birthtime)
            else:
                ts = int(stat.st_mtime)  # linux
        return ts 
開發者ID:snowflakedb,項目名稱:snowflake-connector-python,代碼行數:13,代碼來源:ocsp_snowflake.py

示例3: get_dates

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def get_dates(path):
    try:
        created = datetime.fromtimestamp(getctime(path)).strftime('%d %b %Y, %H:%M:%S')
    except OSError as e:
        created = e
    try:
        accessed = datetime.fromtimestamp(getatime(path)).strftime('%d %b %Y, %H:%M:%S')
    except OSError as e:
        accessed = e
    try:
        modified = datetime.fromtimestamp(getmtime(path)).strftime('%d %b %Y, %H:%M:%S')
    except OSError as e:
        modified = e
    return created, accessed, modified 
開發者ID:aziz,項目名稱:SublimeFileBrowser,代碼行數:16,代碼來源:dired_misc.py

示例4: find_latest_local

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def find_latest_local(self):
        """
        >>> self = Deployer()
        >>> self.find_pretrained()
        >>> self.find_latest_local()
        """
        from os.path import getctime
        task_clf_candidates = self.find_pretrained()
        task_clf_fpaths = {}
        for task_key, fpaths in task_clf_candidates.items():
            # Find the classifier most recently created
            fpath = fpaths[ut.argmax(map(getctime, fpaths))]
            task_clf_fpaths[task_key] = fpath
        return task_clf_fpaths 
開發者ID:Erotemic,項目名稱:ibeis,代碼行數:16,代碼來源:deploy.py

示例5: __del__

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def __del__(self):
        if not isdir(self.dir_cache):
            return

        for file_cache in listdir(self.dir_cache):
            diff_time = (datetime.now() - datetime.fromtimestamp(getctime(self.dir_cache + file_cache)))
            if diff_time.seconds >= self.cache_timeout:
                remove(self.dir_cache + file_cache)

        self.save_cookie() 
開發者ID:aropan,項目名稱:clist,代碼行數:12,代碼來源:__init__.py

示例6: getctime

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def getctime(path=("StringPin", "", {PinSpecifires.INPUT_WIDGET_VARIANT: "PathWidget"})):
        '''Return the system’s ctime which, on some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time for path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.'''
        return osPath.getctime(path, path2) 
開發者ID:wonderworks-software,項目名稱:PyFlow,代碼行數:5,代碼來源:PathLib.py

示例7: getsize

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def getsize(path=("StringPin", "", {PinSpecifires.INPUT_WIDGET_VARIANT: "PathWidget"})):
        '''Return the size, in bytes, of path. Raise os.error if the file does not exist or is inaccessible.'''
        return osPath.getctime(path, path2) 
開發者ID:wonderworks-software,項目名稱:PyFlow,代碼行數:5,代碼來源:PathLib.py

示例8: get_update_time

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def get_update_time(self):
        try:
            from os.path import getctime
            from datetime import datetime
            self.update_utc_time = datetime.utcfromtimestamp(getctime(self.ANSIBLE_PULL_LOG_FILE))
        except:
            pass 
開發者ID:usableprivacy,項目名稱:upribox,代碼行數:9,代碼來源:info.py

示例9: __init__

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def __init__(self, pid):

        self.pid = pid
        self.running = True
        self.ended_datetime = None

        # Mapping of each status_fields to value from the status file.
        # Initialize fields to zero in case info() is called.
        self.status = {field: 0 for field in self.status_fields}

        self.path = path = P.join(PROC_DIR, str(pid))
        if not P.exists(path):
            raise NoProcessFound(pid)

        self.status_path = P.join(path, 'status')

        # Get the command that started the process
        with open(P.join(path, 'cmdline'), encoding='utf-8') as f:
            cmd = f.read()
            # args are separated by \x00 (Null byte)
            self.command = cmd.replace('\x00', ' ').strip()

            if self.command == '':
                # Some processes (such as kworker) have nothing in cmdline, read comm instead
                with open(P.join(path, 'comm')) as comm_file:
                    self.command = self.executable = comm_file.read().strip()

            else:
                # Just use 1st arg instead of reading comm
                self.executable = self.command.split()[0]

        # Get the start time (/proc/PID file creation time)
        self.created_datetime = datetime.fromtimestamp(P.getctime(path))

        self.check() 
開發者ID:arlowhite,項目名稱:process-watcher,代碼行數:37,代碼來源:__init__.py

示例10: created_time

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import getctime [as 別名]
def created_time(self, name):
        return datetime.fromtimestamp(path.getctime(self.path(name))) 
開發者ID:canvasnetworks,項目名稱:canvas,代碼行數:4,代碼來源:storage.py


注:本文中的os.path.getctime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。