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


Python tempfile._RandomNameSequence方法代碼示例

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


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

示例1: setUp

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:4,代碼來源:test_tempfile.py

示例2: test_get_six_char_str

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:6,代碼來源:test_tempfile.py

示例3: test_many

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in xrange(TEST_FILES):
            s = r.next()
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:12,代碼來源:test_tempfile.py

示例4: test_supports_iter

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def test_supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        try:
            for s in r:
                i += 1
                if i == 20:
                    break
        except:
            self.failOnException("iteration") 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:14,代碼來源:test_tempfile.py

示例5: test_retval

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:6,代碼來源:test_tempfile.py

示例6: generate_temp_file_path

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def generate_temp_file_path(extension: str) -> str:
    return TEMP_PATH_BASE + next(tempfile._RandomNameSequence()) + extension 
開發者ID:scherroman,項目名稱:mugen,代碼行數:4,代碼來源:paths.py

示例7: setUp

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:5,代碼來源:test_tempfile.py

示例8: test_get_six_char_str

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:6,代碼來源:test_tempfile.py

示例9: test_many

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def test_many(self):
        # _RandomNameSequence returns no duplicate strings (stochastic)

        dict = {}
        r = self.r
        for i in range(TEST_FILES):
            s = next(r)
            self.nameCheck(s, '', '', '')
            self.assertNotIn(s, dict)
            dict[s] = 1 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:12,代碼來源:test_tempfile.py

示例10: supports_iter

# 需要導入模塊: import tempfile [as 別名]
# 或者: from tempfile import _RandomNameSequence [as 別名]
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:11,代碼來源:test_tempfile.py


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