• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python nameof.nameof函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _string

    def _string(self):
        inner = self._pointer().dereference()
        inner_type = rawtype(inner.type)

        if inner_type.tag == 'HPHP::StringData':
            return string_data_val(inner)
        return nameof(inner)
开发者ID:AmritanshuRanjan,项目名称:hhvm,代码行数:7,代码来源:pretty.py


示例2: create_php

def create_php(idx, ar, rip='0x????????', pc=None):
    """Collect metadata for a PHP frame.

    All arguments are expected to be gdb.Values, except `idx'.
    """
    func = ar['m_func']
    shared = rawptr(func['m_shared'])

    # Pull the function name.
    if not shared['m_isClosureBody']:
        func_name = nameof(func)
    else:
        func_name = nameof(func['m_baseCls'])
        func_name = func_name[:func_name.find(';')]

    if len(func_name) == 0:
        func_name = '<pseudomain>'

    frame = {
        'idx':  idx,
        'sp':   str(ar),
        'rip':  _format_rip(rip),
        'func': '[PHP] %s()' % func_name,
    }

    attrs = idxs.atomic_get(func['m_attrs']['m_attrs'])

    if attrs & V('HPHP::AttrBuiltin'):
        # Builtins don't have source files.
        return frame

    # Pull the PC from Func::base() and ar->m_soff if necessary.
    if pc is None:
        pc = shared['m_base'] + ar['m_soff']

    # Adjust it for calls.
    op_ptype = T('HPHP::Op').pointer()
    op = (func['m_unit']['m_bc'] + pc).cast(op_ptype).dereference()

    if op in [V('HPHP::Op::' + x) for x in
              ['PopR', 'UnboxR', 'UnboxRNop']]:
        pc -= 1

    frame['file'] = php_filename(func)
    frame['line'] = php_line_number(func, pc)

    return frame
开发者ID:milesj,项目名称:hhvm,代码行数:47,代码来源:frame.py


示例3: to_string

    def to_string(self):
        global _tv_recurse

        data = self.val['m_data']
        t = self.val['m_type']
        val = None
        name = None

        if t == V('HPHP::KindOfUninit') or t == V('HPHP::KindOfNull'):
            pass

        elif t == V('HPHP::KindOfBoolean'):
            if data['num'] == 0:
                val = False
            elif data['num'] == 1:
                val = True
            else:
                val = data['num']

        elif t == V('HPHP::KindOfInt64'):
            val = data['num']

        elif t == V('HPHP::KindOfDouble'):
            val = data['dbl']

        elif (t == V('HPHP::KindOfString') or
              t == V('HPHP::KindOfPersistentString')):
            val = data['pstr'].dereference()

        elif (t == V('HPHP::KindOfArray') or
              t == V('HPHP::KindOfPersistentArray')):
            val = data['parr']
            if _tv_recurse:
                val = val.dereference()

        elif t == V('HPHP::KindOfObject'):
            val = data['pobj']
            if _tv_recurse:
                val = val.dereference()
            name = nameof(val)

        elif t == V('HPHP::KindOfResource'):
            val = data['pres']

        elif t == V('HPHP::KindOfRef'):
            val = data['pref'].dereference()

        else:
            t = 'Invalid(%d)' % t.cast(T('int8_t'))
            val = "0x%x" % int(data['num'])

        if val is None:
            out = '{ %s }' % t
        elif name is None:
            out = '{ %s, %s }' % (t, str(val))
        else:
            out = '{ %s, %s ("%s") }' % (t, str(val), name)

        return out
开发者ID:swtaarrs,项目名称:hhvm,代码行数:59,代码来源:pretty.py


示例4: create_php

def create_php(idx, ar, rip="0x????????", pc=None):
    """Collect metadata for a PHP frame.

    All arguments are expected to be gdb.Values, except `idx'.
    """
    func = ar["m_func"]
    shared = rawptr(func["m_shared"])

    # Pull the function name.
    if not shared["m_isClosureBody"]:
        func_name = nameof(func)
    else:
        func_name = nameof(func["m_baseCls"])
        func_name = func_name[: func_name.find(";")]

    if len(func_name) == 0:
        func_name = "<pseudomain>"

    frame = {"idx": idx, "sp": str(ar), "rip": _format_rip(rip), "func": "[PHP] {0!s}()".format(func_name)}

    attrs = idxs.atomic_get(func["m_attrs"]["m_attrs"])

    if attrs & V("HPHP::AttrBuiltin"):
        # Builtins don't have source files.
        return frame

    # Pull the PC from Func::base() and ar->m_soff if necessary.
    if pc is None:
        pc = shared["m_base"] + ar["m_soff"]

    # Adjust it for calls.
    op_ptype = T("HPHP::Op").pointer()
    op = (func["m_unit"]["m_bc"] + pc).cast(op_ptype).dereference()

    if op in [V("HPHP::Op::" + x) for x in ["PopR", "UnboxR", "UnboxRNop"]]:
        pc -= 1

    frame["file"] = php_filename(func)
    frame["line"] = php_line_number(func, pc)

    return frame
开发者ID:runt18,项目名称:hhvm,代码行数:41,代码来源:frame.py


示例5: to_string

    def to_string(self):
        data = self.val["m_data"]
        t = self.val["m_type"]
        val = None
        name = None

        if t == V("HPHP::KindOfUninit") or t == V("HPHP::KindOfNull"):
            pass

        elif t == V("HPHP::KindOfBoolean"):
            if data["num"] == 0:
                val = False
            elif data["num"] == 1:
                val = True
            else:
                val = data["num"]

        elif t == V("HPHP::KindOfInt64"):
            val = data["num"]

        elif t == V("HPHP::KindOfDouble"):
            val = data["dbl"]

        elif t == V("HPHP::KindOfString") or t == V("HPHP::KindOfStaticString"):
            val = data["pstr"].dereference()

        elif t == V("HPHP::KindOfArray"):
            val = data["parr"]

        elif t == V("HPHP::KindOfObject"):
            val = data["pobj"]
            name = nameof(val)

        elif t == V("HPHP::KindOfResource"):
            val = data["pres"]

        elif t == V("HPHP::KindOfRef"):
            val = data["pref"].dereference()

        else:
            t = "Invalid(%d)" % t.cast(T("int8_t"))
            val = "0x%x" % data["num"]

        if val is None:
            out = "{ %s }" % t
        elif name is None:
            out = "{ %s, %s }" % (t, str(val))
        else:
            out = '{ %s, %s ("%s") }' % (t, str(val), name)

        return out
开发者ID:Eagle-X,项目名称:hhvm,代码行数:51,代码来源:pretty.py


示例6: to_string

 def to_string(self):
     return 'Object of class "%s" @ %s' % (
         nameof(self.cls),
         self.val.address)
开发者ID:292388900,项目名称:hhvm,代码行数:4,代码来源:pretty.py


示例7: invoke

    def invoke(self, args, from_tty):
        asio_session = TL('HPHP::AsioSession::s_current')['m_p']

        contexts = asio_session['m_contexts']
        num_contexts = sizeof(contexts)

        if num_contexts == 0:
            print('Not currently in the scope of an AsioContext')
            return

        asio_ctx = asio_context()

        # Count the number of contexts, and print the topmost.
        print('\n%d stacked AsioContext%s (current: (%s) %s)' % (
            int(num_contexts),
            plural_suffix(num_contexts),
            str(asio_ctx.type),
            str(asio_ctx)))

        # Get the current vmfp().
        header_ptype = T('HPHP::rds::Header').pointer()
        vmfp = TL('HPHP::rds::tl_base').cast(header_ptype)['vmRegs']['fp']

        wh_ptype = T('HPHP::c_WaitableWaitHandle').pointer()

        # Find the most recent join().
        for i, fp in izip(count(), frame.gen_php(vmfp)):
            if nameof(fp['m_func']) == 'HH\WaitHandle::join':
                break

        if nameof(fp['m_func']) != 'HH\WaitHandle::join':
            print("...but couldn't find join().  Something is wrong.\n")
            return

        wh = fp['m_this'].cast(wh_ptype)

        print('\nCurrently %s WaitHandle: (%s) %s [state: %s]' % (
            'joining' if i == 0 else 'executing',
            str(wh.type),
            str(wh),
            WaitHandle(wh).state_str()))

        # Dump the async stacktrace.
        for s in frame.stringify_stacktrace(asio_stacktrace(wh)):
            print('    %s' % s)

        # Count the number of queued runnables.
        queue_size = sizeof(asio_ctx['m_runnableQueue'])
        print('%d other resumable%s queued' % (
            int(queue_size),
            plural_suffix(queue_size)))

        sleeps = asio_ctx['m_sleepEvents']
        externals = asio_ctx['m_externalThreadEvents']

        num_sleeps = sizeof(sleeps)
        num_externals = sizeof(externals)

        # Count sleep and external thread events.
        print('')
        print('%d pending sleep event%s' % (
            int(num_sleeps), plural_suffix(num_sleeps)))
        print('%d pending external thread event%s' % (
            int(num_externals), plural_suffix(num_externals)))

        # Dump sleep and external thread event stacktraces.
        for vec in [sleeps, externals]:
            for i in xrange(int(sizeof(vec))):
                wh = idx.vector_at(vec, i)
                stacktrace = frame.stringify_stacktrace(asio_stacktrace(wh, 3))

                print('\n(%s) %s [state: %s]' % (
                    str(wh.type), str(wh), WaitHandle(wh).state_str()))

                if len(stacktrace) == 4:
                    for s in stacktrace[0:-1]:
                        print('    %s' % s)
                    print('     ...')
                    print('    %s' % stacktrace[-1])
                else:
                    for s in stacktrace:
                        print('    %s' % s)
        print('')
开发者ID:292388900,项目名称:hhvm,代码行数:83,代码来源:asio.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python names.get_first_name函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_extension函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap