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


Python b.keys方法代碼示例

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


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

示例1: test_prefix_preservation

# 需要導入模塊: from x import b [as 別名]
# 或者: from x.b import keys [as 別名]
def test_prefix_preservation(self):
        b = "if   d. keys  (  )  : pass"
        a = "if   list(d. keys  (  ))  : pass"
        self.check(b, a)

        b = "if   d. items  (  )  : pass"
        a = "if   list(d. items  (  ))  : pass"
        self.check(b, a)

        b = "if   d. iterkeys  ( )  : pass"
        a = "if   iter(d. keys  ( ))  : pass"
        self.check(b, a)

        b = "[i for i in    d.  iterkeys(  )  ]"
        a = "[i for i in    d.  keys(  )  ]"
        self.check(b, a)

        b = "if   d. viewkeys  ( )  : pass"
        a = "if   d. keys  ( )  : pass"
        self.check(b, a)

        b = "[i for i in    d.  viewkeys(  )  ]"
        a = "[i for i in    d.  keys(  )  ]"
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:26,代碼來源:test_fixers.py

示例2: test_trailing_comment

# 需要導入模塊: from x import b [as 別名]
# 或者: from x.b import keys [as 別名]
def test_trailing_comment(self):
        b = "d.keys() # foo"
        a = "list(d.keys()) # foo"
        self.check(b, a)

        b = "d.items()  # foo"
        a = "list(d.items())  # foo"
        self.check(b, a)

        b = "d.iterkeys()  # foo"
        a = "iter(d.keys())  # foo"
        self.check(b, a)

        b = """[i for i in d.iterkeys() # foo
               ]"""
        a = """[i for i in d.keys() # foo
               ]"""
        self.check(b, a)

        b = """[i for i in d.iterkeys() # foo
               ]"""
        a = """[i for i in d.keys() # foo
               ]"""
        self.check(b, a)

        b = "d.viewitems()  # foo"
        a = "d.items()  # foo"
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:30,代碼來源:test_fixers.py

示例3: test_unchanged

# 需要導入模塊: from x import b [as 別名]
# 或者: from x.b import keys [as 別名]
def test_unchanged(self):
        for wrapper in fixer_util.consuming_calls:
            s = "s = %s(d.keys())" % wrapper
            self.unchanged(s)

            s = "s = %s(d.values())" % wrapper
            self.unchanged(s)

            s = "s = %s(d.items())" % wrapper
            self.unchanged(s) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:12,代碼來源:test_fixers.py

示例4: test_01

# 需要導入模塊: from x import b [as 別名]
# 或者: from x.b import keys [as 別名]
def test_01(self):
        b = "d.keys()"
        a = "list(d.keys())"
        self.check(b, a)

        b = "a[0].foo().keys()"
        a = "list(a[0].foo().keys())"
        self.check(b, a) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:10,代碼來源:test_fixers.py

示例5: test_04

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

示例6: test_08

# 需要導入模塊: from x import b [as 別名]
# 或者: from x.b import keys [as 別名]
def test_08(self):
        s = "sorted(d.keys())"
        self.unchanged(s) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:5,代碼來源:test_fixers.py

示例7: test_09

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

示例8: test_10

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

示例9: test_11

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

示例10: test_12

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

示例11: test_14

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

示例12: test_15

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

示例13: test_16

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

示例14: test_17

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

示例15: test_18

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


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