當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。