当前位置: 首页>>代码示例>>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;未经允许,请勿转载。