Python tempfile 模块,_RandomNameSequence() 实例源码

我们从Python开源项目中,提取了以下42个代码示例,用于说明如何使用tempfile._RandomNameSequence()

项目:mugen    作者:scherroman    | 项目源码 | 文件源码
def generate_temp_file_path(extension: str) -> str:
    return TEMP_PATH_BASE + next(tempfile._RandomNameSequence()) + extension
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp()
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '')
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
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
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def 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")
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:pony-standup-bot    作者:alexanderad    | 项目源码 | 文件源码
def temp_file(self):
        temp_file = os.path.join(
            tempfile.gettempdir(),
            tempfile._RandomNameSequence().next()
        )
        try:
            yield temp_file
        finally:
            os.remove(temp_file)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '')
项目:oil    作者:oilshell    | 项目源码 | 文件源码
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
项目:oil    作者:oilshell    | 项目源码 | 文件源码
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")
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '')
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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")
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp()
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '')
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
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
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '')
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
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
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
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")
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp()
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '')
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
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
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '')
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
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
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
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")
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp()
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '')
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
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
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)