本文整理汇总了Python中util.fstat函数的典型用法代码示例。如果您正苦于以下问题:Python fstat函数的具体用法?Python fstat怎么用?Python fstat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fstat函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: readerr
def readerr(self):
while 1:
size = util.fstat(self.pipee).st_size
if size == 0: break
l = self.pipee.readline()
if not l: break
self.ui.status(_("remote: "), l)
开发者ID:pombredanne,项目名称:SmartNotes,代码行数:7,代码来源:sshrepo.py
示例2: write
def write(self):
if not self._dirty:
return
st = self._opener("dirstate", "w", atomictemp=True)
try:
gran = int(self._ui.config('dirstate', 'granularity', 1))
except ValueError:
gran = 1
limit = sys.maxint
if gran > 0:
limit = util.fstat(st).st_mtime - gran
cs = cStringIO.StringIO()
copymap = self._copymap
pack = struct.pack
write = cs.write
write("".join(self._pl))
for f, e in self._map.iteritems():
if f in copymap:
f = "%s\0%s" % (f, copymap[f])
if e[3] > limit and e[0] == 'n':
e = (e[0], 0, -1, -1, 0)
e = pack(_format, e[0], e[1], e[2], e[3], len(f))
write(e)
write(f)
st.write(cs.getvalue())
st.rename()
self._dirty = self._dirtypl = False
开发者ID:c0ns0le,项目名称:cygwin,代码行数:29,代码来源:dirstate.py
示例3: _writedirstate
def _writedirstate(self, st):
# use the modification time of the newly created temporary file as the
# filesystem's notion of 'now'
now = util.statmtimesec(util.fstat(st)) & _rangemask
st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
st.close()
self._lastnormaltime = 0
self._dirty = self._dirtypl = False
开发者ID:html-shell,项目名称:mozilla-build,代码行数:8,代码来源:dirstate.py
示例4: readerr
def readerr(self):
while 1:
size = util.fstat(self.pipee).st_size
if size == 0:
break
s = self.pipee.read(size)
if not s:
break
for l in s.splitlines():
self.ui.status(_("remote: "), l, '\n')
开发者ID:MezzLabs,项目名称:mercurial,代码行数:10,代码来源:sshrepo.py
示例5: write
def write(self):
if not self._dirty:
return
st = self._opener("dirstate", "w", atomictemp=True)
# use the modification time of the newly created temporary file as the
# filesystem's notion of 'now'
now = util.fstat(st).st_mtime
st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
st.close()
self._lastnormaltime = 0
self._dirty = self._dirtypl = False
开发者ID:leetaizhu,项目名称:Odoo_ENV_MAC_OS,代码行数:11,代码来源:dirstate.py
示例6: __init__
def __init__(self, dataf):
try:
size = util.fstat(dataf).st_size
except AttributeError:
size = 0
self.dataf = dataf
self.s = struct.calcsize(indexformatng)
self.datasize = size
self.l = size / self.s
self.index = [None] * self.l
self.map = {nullid: nullrev}
self.allmap = 0
self.all = 0
self.mapfind_count = 0
开发者ID:Frostman,项目名称:intellij-community,代码行数:14,代码来源:revlog.py
示例7: parseindex
def parseindex(self, fp, inline):
try:
size = util.fstat(fp).st_size
except AttributeError:
size = 0
if util.openhardlinks() and not inline and size > 1000000:
# big index, let's parse it on demand
parser = lazyparser(fp, size)
index = lazyindex(parser)
nodemap = lazymap(parser)
e = list(index[0])
type = gettype(e[0])
e[0] = offset_type(0, type)
index[0] = e
return index, nodemap, None
s = self.size
cache = None
index = []
nodemap = {nullid: nullrev}
n = off = 0
# if we're not using lazymap, always read the whole index
data = fp.read()
l = len(data) - s
append = index.append
if inline:
cache = (0, data)
while off <= l:
e = _unpack(indexformatng, data[off:off + s])
nodemap[e[7]] = n
append(e)
n += 1
if e[1] < 0:
break
off += e[1] + s
else:
while off <= l:
e = _unpack(indexformatng, data[off:off + s])
nodemap[e[7]] = n
append(e)
n += 1
off += s
e = list(index[0])
type = gettype(e[0])
e[0] = offset_type(0, type)
index[0] = e
return index, nodemap, cache
开发者ID:c0ns0le,项目名称:cygwin,代码行数:50,代码来源:revlog.py
示例8: _trusted
def _trusted(self, fp, f):
st = util.fstat(fp)
if util.isowner(st):
return True
tusers, tgroups = self._trustusers, self._trustgroups
if "*" in tusers or "*" in tgroups:
return True
user = util.username(st.st_uid)
group = util.groupname(st.st_gid)
if user in tusers or group in tgroups or user == util.username():
return True
if self._reportuntrusted:
self.warn(_("not trusting file %s from untrusted " "user %s, group %s\n") % (f, user, group))
return False
开发者ID:guitao,项目名称:hg-stable,代码行数:17,代码来源:ui.py
示例9: write
def write(self):
if not self._dirty:
return
# enough 'delaywrite' prevents 'pack_dirstate' from dropping
# timestamp of each entries in dirstate, because of 'now > mtime'
delaywrite = self._ui.configint('debug', 'dirstate.delaywrite', 0)
if delaywrite:
import time # to avoid useless import
time.sleep(delaywrite)
st = self._opener("dirstate", "w", atomictemp=True)
# use the modification time of the newly created temporary file as the
# filesystem's notion of 'now'
now = util.fstat(st).st_mtime
st.write(parsers.pack_dirstate(self._map, self._copymap, self._pl, now))
st.close()
self._lastnormaltime = 0
self._dirty = self._dirtypl = False
开发者ID:CS76,项目名称:ipo-galaxy,代码行数:19,代码来源:dirstate.py
示例10: parseindex
def parseindex(self, fp, inline):
try:
size = util.fstat(fp).st_size
except AttributeError:
size = 0
if util.openhardlinks() and not inline and size > 1000000:
# big index, let's parse it on demand
parser = lazyparser(fp, size)
index = lazyindex(parser)
nodemap = lazymap(parser)
e = list(index[0])
type = gettype(e[0])
e[0] = offset_type(0, type)
index[0] = e
return index, nodemap, None
data = fp.read()
# call the C implementation to parse the index data
index, nodemap, cache = parsers.parse_index(data, inline)
return index, nodemap, cache
开发者ID:pombredanne,项目名称:SmartNotes,代码行数:21,代码来源:revlog.py
示例11: _is_trusted
def _is_trusted(self, fp, f, warn=True):
if not self.check_trusted:
return True
st = util.fstat(fp)
if util.isowner(fp, st):
return True
tusers = self.trusted_users
tgroups = self.trusted_groups
if not tusers:
user = util.username()
if user is not None:
self.trusted_users[user] = 1
self.fixconfig(section="trusted")
if (tusers or tgroups) and "*" not in tusers and "*" not in tgroups:
user = util.username(st.st_uid)
group = util.groupname(st.st_gid)
if user not in tusers and group not in tgroups:
if warn and self.report_untrusted:
self.warn(_("Not trusting file %s from untrusted " "user %s, group %s\n") % (f, user, group))
return False
return True
开发者ID:pombredanne,项目名称:SmartNotes,代码行数:21,代码来源:ui.py
示例12: write
def write(self):
if not self._dirty:
return
st = self._opener("dirstate", "w", atomictemp=True)
# use the modification time of the newly created temporary file as the
# filesystem's notion of 'now'
now = int(util.fstat(st).st_mtime)
cs = cStringIO.StringIO()
copymap = self._copymap
pack = struct.pack
write = cs.write
write("".join(self._pl))
for f, e in self._map.iteritems():
if e[0] == 'n' and e[3] == now:
# The file was last modified "simultaneously" with the current
# write to dirstate (i.e. within the same second for file-
# systems with a granularity of 1 sec). This commonly happens
# for at least a couple of files on 'update'.
# The user could change the file without changing its size
# within the same second. Invalidate the file's stat data in
# dirstate, forcing future 'status' calls to compare the
# contents of the file. This prevents mistakenly treating such
# files as clean.
e = (e[0], 0, -1, -1) # mark entry as 'unset'
self._map[f] = e
if f in copymap:
f = "%s\0%s" % (f, copymap[f])
e = pack(_format, e[0], e[1], e[2], e[3], len(f))
write(e)
write(f)
st.write(cs.getvalue())
st.rename()
self._lastnormaltime = None
self._dirty = self._dirtypl = False
开发者ID:rybesh,项目名称:mysite-lib,代码行数:37,代码来源:dirstate.py
示例13: __init__
def __init__(self, fp, buf):
self.data = buf
self.fp = fp
self.offset = fp.tell()
self.size = util.fstat(fp).st_size
开发者ID:agbiotec,项目名称:galaxy-tools-vcr,代码行数:5,代码来源:changelog.py
示例14: fstat
def fstat(self, fp):
return util.fstat(fp)
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:2,代码来源:scmutil.py
注:本文中的util.fstat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论