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


Python b.c方法代码示例

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


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

示例1: _pop_import_LOAD_ATTRs

# 需要导入模块: from a import b [as 别名]
# 或者: from a.b import c [as 别名]
def _pop_import_LOAD_ATTRs(module_name, queue):
    """
    Pop LOAD_ATTR instructions for an import of the form::

        import a.b.c as d

    which should generate bytecode like this::

        1           0 LOAD_CONST               0 (0)
                    3 LOAD_CONST               1 (None)
                    6 IMPORT_NAME              0 (a.b.c.d)
                    9 LOAD_ATTR                1 (b)
                   12 LOAD_ATTR                2 (c)
                   15 LOAD_ATTR                3 (d)
                   18 STORE_NAME               3 (d)
    """
    popped = popwhile(is_a(instrs.LOAD_ATTR), queue, side='left')
    if popped:
        expected = module_name.split('.', maxsplit=1)[1]
        actual = '.'.join(map(op.attrgetter('arg'), popped))
        if expected != actual:
            raise DecompilationError(
                "Decompiling import of module %s, but LOAD_ATTRS imply %s" % (
                    expected, actual,
                )
            )
    return popped 
开发者ID:llllllllll,项目名称:codetransformer,代码行数:29,代码来源:_343.py

示例2: _make_expr_empty_dict

# 需要导入模块: from a import b [as 别名]
# 或者: from a.b import c [as 别名]
def _make_expr_empty_dict(toplevel, stack_builders):
    """
    This should only be hit for empty dicts.  Anything else should hit the
    STORE_MAP handler instead.
    """
    if toplevel.arg:
        raise DecompilationError(
            "make_expr() called with nonzero BUILD_MAP arg %d" % toplevel.arg
        )

    if stack_builders:
        raise DecompilationError(
            "Unexpected stack_builders for BUILD_MAP(0): %s" % stack_builders
        )
    return ast.Dict(keys=[], values=[]) 
开发者ID:llllllllll,项目名称:codetransformer,代码行数:17,代码来源:_343.py

示例3: make_slice_tuple

# 需要导入模块: from a import b [as 别名]
# 或者: from a.b import c [as 别名]
def make_slice_tuple(toplevel, stack_builders):
    slice_ = _make_expr(toplevel, stack_builders)
    if isinstance(slice_, ast.Tuple):
        # a = b[c, d] generates Index(value=Tuple(...))
        # a = b[c:, d] generates ExtSlice(dims=[Slice(...), Index(...)])
        slice_ = normalize_tuple_slice(slice_)
    return slice_ 
开发者ID:llllllllll,项目名称:codetransformer,代码行数:9,代码来源:_343.py

示例4: spam

# 需要导入模块: from a import b [as 别名]
# 或者: from a.b import c [as 别名]
def spam(a, b, c): pass 
开发者ID:flexxui,项目名称:pscript,代码行数:3,代码来源:python_sample.py

示例5: popwhile

# 需要导入模块: from a import b [as 别名]
# 或者: from a.b import c [as 别名]
def popwhile(cond, queue, *, side):
    """
    Pop elements off a queue while `cond(nextelem)` is True.

    Parameters
    ----------
    cond : predicate
    queue : deque
    side : {'left', 'right'}

    Returns
    -------
    popped : deque

    Examples
    --------
    >>> from collections import deque
    >>> d = deque([1, 2, 3, 2, 1])
    >>> popwhile(lambda x: x < 3, d, side='left')
    deque([1, 2])
    >>> d
    deque([3, 2, 1])
    >>> popwhile(lambda x: x < 3, d, side='right')
    deque([2, 1])
    >>> d
    deque([3])
    """
    if side not in ('left', 'right'):
        raise ValueError("`side` must be one of 'left' or 'right'")

    out = deque()

    if side == 'left':
        popnext = queue.popleft
        pushnext = out.append
        nextidx = 0
    else:
        popnext = queue.pop
        pushnext = out.appendleft
        nextidx = -1

    while queue:
        if not cond(queue[nextidx]):
            break
        pushnext(popnext())
    return out 
开发者ID:llllllllll,项目名称:codetransformer,代码行数:48,代码来源:_343.py


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