当前位置: 首页>>代码示例>>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;未经允许,请勿转载。