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


Python bar.foo方法代码示例

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


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

示例1: test_method_4

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_method_4(self):
        b = """
            class A:
                def __init__(self, foo):
                    self.foo = foo

                def next(self):
                    pass

                def __iter__(self):
                    return self
            """
        a = """
            class A:
                def __init__(self, foo):
                    self.foo = foo

                def __next__(self):
                    pass

                def __iter__(self):
                    return self
            """
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:26,代码来源:test_fixers.py

示例2: test_shadowing_funcdef_2

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_shadowing_funcdef_2(self):
        b = """
            def next(a):
                pass

            class A:
                def next(self):
                    pass

            it.next()
            """
        a = """
            def next(a):
                pass

            class A:
                def __next__(self):
                    pass

            it.__next__()
            """
        self.warns(b, a, "Calls to builtin next() possibly shadowed") 
开发者ID:remg427,项目名称:misp42splunk,代码行数:24,代码来源:test_fixers.py

示例3: test_prefix_preservation_4

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_prefix_preservation_4(self):
        b = """
            next = 5
            for a in b:
                foo(a) # abc
                # def
                a.next()
            """
        a = """
            next = 5
            for a in b:
                foo(a) # abc
                # def
                a.__next__()
            """
        self.check(b, a, ignore_warnings=True) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:18,代码来源:test_fixers.py

示例4: test_21

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_21(self):
        b = "print h.iterkeys().next()"
        a = "print iter(h.keys()).next()"
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例5: test_23

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_23(self):
        b = "print list(h.iterkeys().next())"
        a = "print list(iter(h.keys()).next())"
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例6: test_1

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_1(self):
        b = """it.next()"""
        a = """next(it)"""
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例7: test_2

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_2(self):
        b = """a.b.c.d.next()"""
        a = """next(a.b.c.d)"""
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例8: test_3

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_3(self):
        b = """(a + b).next()"""
        a = """next((a + b))"""
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例9: test_5

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_5(self):
        b = """a().next() + b"""
        a = """next(a()) + b"""
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例10: test_6

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_6(self):
        b = """c(      a().next() + b)"""
        a = """c(      next(a()) + b)"""
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:test_fixers.py

示例11: test_prefix_preservation_1

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_prefix_preservation_1(self):
        b = """
            for a in b:
                foo(a)
                a.next()
            """
        a = """
            for a in b:
                foo(a)
                next(a)
            """
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:14,代码来源:test_fixers.py

示例12: test_prefix_preservation_2

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_prefix_preservation_2(self):
        b = """
            for a in b:
                foo(a) # abc
                # def
                a.next()
            """
        a = """
            for a in b:
                foo(a) # abc
                # def
                next(a)
            """
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:16,代码来源:test_fixers.py

示例13: test_prefix_preservation_3

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_prefix_preservation_3(self):
        b = """
            next = 5
            for a in b:
                foo(a)
                a.next()
            """
        a = """
            next = 5
            for a in b:
                foo(a)
                a.__next__()
            """
        self.check(b, a, ignore_warnings=True) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:16,代码来源:test_fixers.py

示例14: test_prefix_preservation_5

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_prefix_preservation_5(self):
        b = """
            next = 5
            for a in b:
                foo(foo(a), # abc
                    a.next())
            """
        a = """
            next = 5
            for a in b:
                foo(foo(a), # abc
                    a.__next__())
            """
        self.check(b, a, ignore_warnings=True) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:16,代码来源:test_fixers.py

示例15: test_prefix_preservation_6

# 需要导入模块: import bar [as 别名]
# 或者: from bar import foo [as 别名]
def test_prefix_preservation_6(self):
        b = """
            for a in b:
                foo(foo(a), # abc
                    a.next())
            """
        a = """
            for a in b:
                foo(foo(a), # abc
                    next(a))
            """
        self.check(b, a) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:14,代码来源:test_fixers.py


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