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


Python stat.ST_CTIME属性代码示例

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


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

示例1: fetch

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [as 别名]
def fetch(self, is_dl_forced=False):
        '''connection details for DISCO'''
        cxn = {}
        cxn['host'] = 'nif-db.crbs.ucsd.edu'
        cxn['database'] = 'disco_crawler'
        cxn['port'] = '5432'
        cxn['user'] = config.get_config()['user']['disco']
        cxn['password'] = config.get_config()['keys'][cxn['user']]

        pg_iri = 'jdbc:postgresql://'+cxn['host']+':'+cxn['port']+'/'+cxn['database']
        self.dataset.set_ingest_source(pg_iri)

        # process the tables
        # self.fetch_from_pgdb(self.tables,cxn,100)  #for testing
        self.fetch_from_pgdb(self.tables, cxn)

        self.get_files(is_dl_forced)

        fstat = os.stat('/'.join((self.rawdir, 'dvp.pr_nlx_157874_1')))
        filedate = datetime.utcfromtimestamp(fstat[ST_CTIME]).strftime("%Y-%m-%d")

        self.dataset.set_ingest_source_file_version_date(pg_iri, filedate) 
开发者ID:monarch-initiative,项目名称:dipper,代码行数:24,代码来源:EOM.py

示例2: test_version_level_source_version_download_timestamp

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [as 别名]
def test_version_level_source_version_download_timestamp(self):
        path_to_dl_file = '/'.join(
            (self.source.rawdir, self.source.files.get('test_file').get('file')))
        fstat = os.stat(path_to_dl_file)

        self.downloaded_file_timestamp = \
            datetime.utcfromtimestamp(fstat[ST_CTIME]).strftime("%Y%m%d")

        triples = list(self.source.dataset.graph.triples(
            (URIRef(self.theseFiles.get("test_file").get("url")),
             self.iri_retrieved_on,
             None)))
        self.assertTrue(len(triples) == 1,
                        "missing triple for ingest file retrieved on " +
                        "(download timestamp)")
        self.assertEqual(Literal(triples[0][2], datatype=XSD.date),
                         Literal(self.downloaded_file_timestamp, datatype=XSD.date),
                         "version level source version timestamp isn't " +
                         "the same as the download timestamp of the local file") 
开发者ID:monarch-initiative,项目名称:dipper,代码行数:21,代码来源:test_source_metadata.py

示例3: test_postgres_version_level_source_version_download_timestamp

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [as 别名]
def test_postgres_version_level_source_version_download_timestamp(self):
        path_to_dl_file = '/'.join(
            (self.pg_source.rawdir, self.pg_source.files.get('test_file').get('file')))
        fstat = os.stat(path_to_dl_file)

        self.downloaded_file_timestamp = \
            datetime.utcfromtimestamp(fstat[ST_CTIME]).strftime("%Y%m%d")

        triples = list(self.pg_source.dataset.graph.triples(
            (URIRef(self.theseFiles.get("test_file").get("url")),
             self.iri_retrieved_on,
             None)))
        self.assertTrue(len(triples) == 1,
                        "missing triple for ingest file retrieved on " +
                        "(download timestamp)")
        self.assertEqual(Literal(triples[0][2], datatype=XSD.date),
                         Literal(self.downloaded_file_timestamp, datatype=XSD.date),
                         "version level source version timestamp isn't " +
                         "the same as the download timestamp of the local file") 
开发者ID:monarch-initiative,项目名称:dipper,代码行数:21,代码来源:test_source_metadata.py

示例4: show_statistics

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [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

示例5: gen_folder_listing

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [as 别名]
def gen_folder_listing(path):
    l = os.listdir(path)
    s = '<?xml version="1.0"?>\n<folder-listing>\n'

    for i in l:
        objpath = os.path.join(path, i)
        if os.path.isdir(objpath):
            args = (i, unix2bluetime(os.stat(objpath)[stat.ST_CTIME]))
            s += '  <folder name="%s" created="%s" />' % args
        else:
            args = (i, unix2bluetime(os.stat(objpath)[stat.ST_CTIME]),
                    os.stat(objpath)[stat.ST_SIZE])
            s += '  <file name="%s" created="%s" size="%s" />' % args

    s += "</folder-listing>\n"

    if sys.version_info.major < 3:
        s = unicode(s)

    return s 
开发者ID:nccgroup,项目名称:nOBEX,代码行数:22,代码来源:ftp.py

示例6: get_file_info

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [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

示例7: getctime

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

示例8: get

# 需要导入模块: import stat [as 别名]
# 或者: from stat import ST_CTIME [as 别名]
def get(self, socket, request):
        name = ""
        req_type = ""

        for header in request.header_data:
            if isinstance(header, headers.Name):
                name = header.decode().strip("\x00")
                self.logger.info("Receiving request for {}".format(name))
            elif isinstance(header, headers.Type):
                req_type = header.decode().strip("\x00")
                self.logger.info("Request type: {}".format(req_type))

        path = os.path.abspath(os.path.join(self.directory, name))

        if os.path.isdir(path) or req_type == "x-obex/folder-listing":
            if path.startswith(self.directory):
                filelist = os.listdir(path)
                s = '<?xml version="1.0"?>\n<folder-listing>\n'

                for i in filelist:
                    objpath = os.path.join(path, i)
                    if os.path.isdir(objpath):
                        s += '  <folder name="{}" created="{}" />'.format(i, os.stat(objpath)[stat.ST_CTIME])
                    else:
                        s += '  <file name="{}" created="{}" size="{}" />'.format(
                            i, os.stat(objpath)[stat.ST_CTIME], os.stat(objpath)[stat.ST_SIZE])

                s += "</folder-listing>\n"
                self.logger.debug('Bluetooth get XML output:\n' + s)

                response = responses.Success()
                response_headers = [headers.Name(name.encode("utf8")),
                                    headers.Length(len(s)),
                                    headers.Body(s.encode("utf8"))]
                BrowserServer.send_response(self, socket, response, response_headers)
            else:
                self._reject(socket)
        else:
            self._reject(socket)


# vim:sw=4:ts=4:et: 
开发者ID:BlackLight,项目名称:platypush,代码行数:44,代码来源:fileserver.py


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