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


Python node.bin函数代码示例

本文整理汇总了Python中node.bin函数的典型用法代码示例。如果您正苦于以下问题:Python bin函数的具体用法?Python bin怎么用?Python bin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: parse_manifest

def parse_manifest(mfdict, fdict, lines):
    for l in lines.splitlines():
        f, n = l.split("\0")
        if len(n) > 40:
            fdict[f] = n[40:]
            mfdict[f] = bin(n[:40])
        else:
            mfdict[f] = bin(n)
开发者ID:dkrisman,项目名称:Traipse,代码行数:8,代码来源:parsers.py

示例2: parse

 def parse(self, lines):
     mfdict = manifestdict()
     fdict = mfdict._flags
     for l in lines.splitlines():
         f, n = l.split('\0')
         if len(n) > 40:
             fdict[f] = n[40:]
             mfdict[f] = bin(n[:40])
         else:
             mfdict[f] = bin(n)
     return mfdict
开发者ID:c0ns0le,项目名称:cygwin,代码行数:11,代码来源:manifest.py

示例3: do_changegroupsubset

    def do_changegroupsubset(self):
        argmap = dict([self.getarg(), self.getarg()])
        bases = [bin(n) for n in argmap['bases'].split(' ')]
        heads = [bin(n) for n in argmap['heads'].split(' ')]

        cg = self.repo.changegroupsubset(bases, heads, 'serve')
        while True:
            d = cg.read(4096)
            if not d:
                break
            self.fout.write(d)

        self.fout.flush()
开发者ID:dkrisman,项目名称:Traipse,代码行数:13,代码来源:sshserver.py

示例4: diff

 def diff(self, diffopts, node2, match, prefix, **opts):
     try:
         node1 = node.bin(self._state[1])
         # We currently expect node2 to come from substate and be
         # in hex format
         if node2 is not None:
             node2 = node.bin(node2)
         cmdutil.diffordiffstat(self._repo.ui, self._repo, diffopts,
                                node1, node2, match,
                                prefix=os.path.join(prefix, self._path),
                                listsubrepos=True, **opts)
     except error.RepoLookupError, inst:
         self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
                            % (inst, subrelpath(self)))
开发者ID:helloandre,项目名称:cr48,代码行数:14,代码来源:subrepo.py

示例5: _partialmatch

    def _partialmatch(self, id):
        try:
            return self.index.partialmatch(id)
        except RevlogError:
            # parsers.c radix tree lookup gave multiple matches
            raise LookupError(id, self.indexfile, _("ambiguous identifier"))
        except (AttributeError, ValueError):
            # we are pure python, or key was too short to search radix tree
            pass

        if id in self._pcache:
            return self._pcache[id]

        if len(id) < 40:
            try:
                # hex(node)[:...]
                l = len(id) // 2  # grab an even number of digits
                prefix = bin(id[:l * 2])
                nl = [e[7] for e in self.index if e[7].startswith(prefix)]
                nl = [n for n in nl if hex(n).startswith(id)]
                if len(nl) > 0:
                    if len(nl) == 1:
                        self._pcache[id] = nl[0]
                        return nl[0]
                    raise LookupError(id, self.indexfile,
                                      _('ambiguous identifier'))
                return None
            except TypeError:
                pass
开发者ID:chuchiperriman,项目名称:hg-stable,代码行数:29,代码来源:revlog.py

示例6: lookup

 def lookup(self, key):
     self.requirecap("lookup", _("look up remote revision"))
     d = self._call("lookup", key=key)
     success, data = d[:-1].split(" ", 1)
     if int(success):
         return bin(data)
     self._abort(error.RepoError(data))
开发者ID:helloandre,项目名称:cr48,代码行数:7,代码来源:wireproto.py

示例7: lookup

 def lookup(self, key):
     self.requirecap('lookup', _('look up remote revision'))
     d = self._call("lookup", key=encoding.fromlocal(key))
     success, data = d[:-1].split(" ", 1)
     if int(success):
         return bin(data)
     self._abort(error.RepoError(data))
开发者ID:MezzLabs,项目名称:mercurial,代码行数:7,代码来源:wireproto.py

示例8: renamed

 def renamed(self, node):
     if self.parents(node)[0] != nullid:
         return False
     m = self._readmeta(node)
     if m and "copy" in m:
         return (m["copy"], bin(m["copyrev"]))
     return False
开发者ID:c0ns0le,项目名称:cygwin,代码行数:7,代码来源:filelog.py

示例9: lookup

 def lookup(self, key):
     self.requirecap('lookup', _('look up remote revision'))
     d = self.do_cmd("lookup", key = key).read()
     success, data = d[:-1].split(' ', 1)
     if int(success):
         return bin(data)
     raise error.RepoError(data)
开发者ID:iluxa-c0m,项目名称:mercurial-crew-tonfa,代码行数:7,代码来源:httprepo.py

示例10: _match

 def _match(self, id):
     if isinstance(id, (long, int)):
         # rev
         return self.node(id)
     if len(id) == 20:
         # possibly a binary node
         # odds of a binary node being all hex in ASCII are 1 in 10**25
         try:
             node = id
             self.rev(node) # quick search the index
             return node
         except LookupError:
             pass # may be partial hex id
     try:
         # str(rev)
         rev = int(id)
         if str(rev) != id:
             raise ValueError
         if rev < 0:
             rev = len(self) + rev
         if rev < 0 or rev >= len(self):
             raise ValueError
         return self.node(rev)
     except (ValueError, OverflowError):
         pass
     if len(id) == 40:
         try:
             # a full hex nodeid?
             node = bin(id)
             self.rev(node)
             return node
         except (TypeError, LookupError):
             pass
开发者ID:mortonfox,项目名称:cr48,代码行数:33,代码来源:revlog.py

示例11: _readroots

def _readroots(repo, phasedefaults=None):
    """Read phase roots from disk

    phasedefaults is a list of fn(repo, roots) callable, which are
    executed if the phase roots file does not exist. When phases are
    being initialized on an existing repository, this could be used to
    set selected changesets phase to something else than public.

    Return (roots, dirty) where dirty is true if roots differ from
    what is being stored.
    """
    repo = repo.unfiltered()
    dirty = False
    roots = [set() for i in allphases]
    try:
        f = repo.sopener("phaseroots")
        try:
            for line in f:
                phase, nh = line.split()
                roots[int(phase)].add(bin(nh))
        finally:
            f.close()
    except IOError, inst:
        if inst.errno != errno.ENOENT:
            raise
        if phasedefaults:
            for f in phasedefaults:
                roots = f(repo, roots)
        dirty = True
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:29,代码来源:phases.py

示例12: analyzeremotephases

def analyzeremotephases(repo, subset, roots):
    """Compute phases heads and root in a subset of node from root dict

    * subset is heads of the subset
    * roots is {<nodeid> => phase} mapping. key and value are string.

    Accept unknown element input
    """
    repo = repo.unfiltered()
    # build list from dictionary
    draftroots = []
    nodemap = repo.changelog.nodemap  # to filter unknown nodes
    for nhex, phase in roots.iteritems():
        if nhex == "publishing":  # ignore data related to publish option
            continue
        node = bin(nhex)
        phase = int(phase)
        if phase == 0:
            if node != nullid:
                repo.ui.warn(_("ignoring inconsistent public root" " from remote: %s\n") % nhex)
        elif phase == 1:
            if node in nodemap:
                draftroots.append(node)
        else:
            repo.ui.warn(_("ignoring unexpected root from remote: %i %s\n") % (phase, nhex))
    # compute heads
    publicheads = newheads(repo, subset, draftroots)
    return publicheads, draftroots
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:28,代码来源:phases.py

示例13: lookup

 def lookup(self, key):
     self.requirecap('lookup', _('look up remote revision'))
     d = self.call("lookup", key=key)
     success, data = d[:-1].split(" ", 1)
     if int(success):
         return bin(data)
     else:
         self.raise_(repo.RepoError(data))
开发者ID:c0ns0le,项目名称:cygwin,代码行数:8,代码来源:sshrepo.py

示例14: lookup

 def lookup(self, key):
     self.requirecap("lookup", _("look up remote revision"))
     f = future()
     yield {"key": encoding.fromlocal(key)}, f
     d = f.value
     success, data = d[:-1].split(" ", 1)
     if int(success):
         yield bin(data)
     self._abort(error.RepoError(data))
开发者ID:pierfort123,项目名称:mercurial,代码行数:9,代码来源:wireproto.py

示例15: lookup

 def lookup(self, key):
     self.requirecap('lookup', _('look up remote revision'))
     f = future()
     yield todict(key=encoding.fromlocal(key)), f
     d = f.value
     success, data = d[:-1].split(" ", 1)
     if int(success):
         yield bin(data)
     self._abort(error.RepoError(data))
开发者ID:agbiotec,项目名称:galaxy-tools-vcr,代码行数:9,代码来源:wireproto.py


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