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


Python a.b方法代碼示例

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


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

示例1: test_tuple_unpack

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_tuple_unpack(self):
        b = """
            def foo():
                try:
                    pass
                except Exception, (f, e):
                    pass
                except ImportError, e:
                    pass"""

        a = """
            def foo():
                try:
                    pass
                except Exception as xxx_todo_changeme:
                    (f, e) = xxx_todo_changeme.args
                    pass
                except ImportError as e:
                    pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:22,代碼來源:test_fixers.py

示例2: test_bare_except

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_bare_except(self):
        b = """
            try:
                pass
            except Exception, a:
                pass
            except:
                pass"""

        a = """
            try:
                pass
            except Exception as a:
                pass
            except:
                pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:19,代碼來源:test_fixers.py

示例3: test_multi_fixed_excepts_before_bare_except

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_multi_fixed_excepts_before_bare_except(self):
        b = """
            try:
                pass
            except TypeError, b:
                pass
            except Exception, a:
                pass
            except:
                pass"""

        a = """
            try:
                pass
            except TypeError as b:
                pass
            except Exception as a:
                pass
            except:
                pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:23,代碼來源:test_fixers.py

示例4: test_basic

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_basic(self):
        b = """if x <> y:
            pass"""

        a = """if x != y:
            pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:9,代碼來源:test_fixers.py

示例5: test_no_spaces

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_no_spaces(self):
        b = """if x<>y:
            pass"""

        a = """if x!=y:
            pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:9,代碼來源:test_fixers.py

示例6: test_chained

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_chained(self):
        b = """if x<>y<>z:
            pass"""

        a = """if x!=y!=z:
            pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:9,代碼來源:test_fixers.py

示例7: test_1

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_1(self):
        b = """x = d.has_key("x") or d.has_key("y")"""
        a = """x = "x" in d or "y" in d"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例8: test_2

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_2(self):
        b = """x = a.b.c.d.has_key("x") ** 3"""
        a = """x = ("x" in a.b.c.d) ** 3"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例9: test_4

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_4(self):
        b = """x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4"""
        a = """x = (1 + 2 in a.b).__repr__() ** -3 ** 4"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例10: test_5

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_5(self):
        b = """x = a.has_key(f or g)"""
        a = """x = (f or g) in a"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例11: test_6

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_6(self):
        b = """x = a + b.has_key(c)"""
        a = """x = a + (c in b)"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例12: test_7

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_7(self):
        b = """x = a.has_key(lambda: 12)"""
        a = """x = (lambda: 12) in a"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例13: test_8

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_8(self):
        b = """x = a.has_key(a for a in b)"""
        a = """x = (a for a in b) in a"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例14: test_10

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_10(self):
        b = """if not a.has_key(b).__repr__(): pass"""
        a = """if not (b in a).__repr__(): pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py

示例15: test_11

# 需要導入模塊: from x import a [as 別名]
# 或者: from x.a import b [as 別名]
def test_11(self):
        b = """if not a.has_key(b) ** 2: pass"""
        a = """if not (b in a) ** 2: pass"""
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:test_fixers.py


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