當前位置: 首頁>>代碼示例>>Python>>正文


Python a.next方法代碼示例

本文整理匯總了Python中x.a.next方法的典型用法代碼示例。如果您正苦於以下問題:Python a.next方法的具體用法?Python a.next怎麽用?Python a.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在x.a的用法示例。


在下文中一共展示了a.next方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_method_4

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import next [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


注:本文中的x.a.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。