Python tempfile._RandomNameSequence() Examples

The following are code examples for showing how to use tempfile._RandomNameSequence(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: mugen   Author: scherroman   File: paths.py    (license) View Source Project 5 votes vote down vote up
def generate_temp_file_path(extension: str) -> str:
    return TEMP_PATH_BASE + next(tempfile._RandomNameSequence()) + extension 
Example 2
Project: zippy   Author: securesystemslab   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
Example 3
Project: zippy   Author: securesystemslab   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
Example 4
Project: zippy   Author: securesystemslab   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 5
Project: zippy   Author: securesystemslab   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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") 
Example 6
Project: zippy   Author: securesystemslab   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 7
Project: pony-standup-bot   Author: alexanderad   File: test_storage.py    (license) View Source Project 5 votes vote down vote up
def temp_file(self):
        temp_file = os.path.join(
            tempfile.gettempdir(),
            tempfile._RandomNameSequence().next()
        )
        try:
            yield temp_file
        finally:
            os.remove(temp_file) 
Example 8
Project: oil   Author: oilshell   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example 9
Project: oil   Author: oilshell   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example 10
Project: oil   Author: oilshell   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 11
Project: oil   Author: oilshell   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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") 
Example 12
Project: oil   Author: oilshell   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 13
Project: python2-tracer   Author: extremecoders-re   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example 14
Project: python2-tracer   Author: extremecoders-re   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example 15
Project: python2-tracer   Author: extremecoders-re   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 16
Project: python2-tracer   Author: extremecoders-re   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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") 
Example 17
Project: python2-tracer   Author: extremecoders-re   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 18
Project: web_ctp   Author: molebot   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
Example 19
Project: web_ctp   Author: molebot   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
Example 20
Project: web_ctp   Author: molebot   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 21
Project: web_ctp   Author: molebot   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break 
Example 22
Project: web_ctp   Author: molebot   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 23
Project: pefile.pypy   Author: cloudtracer   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example 24
Project: pefile.pypy   Author: cloudtracer   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example 25
Project: pefile.pypy   Author: cloudtracer   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 26
Project: pefile.pypy   Author: cloudtracer   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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") 
Example 27
Project: pefile.pypy   Author: cloudtracer   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 28
Project: ouroboros   Author: pybee   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
Example 29
Project: ouroboros   Author: pybee   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
Example 30
Project: ouroboros   Author: pybee   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 31
Project: ouroboros   Author: pybee   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break 
Example 32
Project: ouroboros   Author: pybee   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 33
Project: ndk-python   Author: gittor   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence() 
Example 34
Project: ndk-python   Author: gittor   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = self.r.next()
        self.nameCheck(s, '', '', '') 
Example 35
Project: ndk-python   Author: gittor   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 36
Project: ndk-python   Author: gittor   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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") 
Example 37
Project: ndk-python   Author: gittor   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence) 
Example 38
Project: kbe_server   Author: xiaohaoppy   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def setUp(self):
        self.r = tempfile._RandomNameSequence()
        super().setUp() 
Example 39
Project: kbe_server   Author: xiaohaoppy   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_get_six_char_str(self):
        # _RandomNameSequence returns a six-character string
        s = next(self.r)
        self.nameCheck(s, '', '', '') 
Example 40
Project: kbe_server   Author: xiaohaoppy   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
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 
Example 41
Project: kbe_server   Author: xiaohaoppy   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def supports_iter(self):
        # _RandomNameSequence supports the iterator protocol

        i = 0
        r = self.r
        for s in r:
            i += 1
            if i == 20:
                break 
Example 42
Project: kbe_server   Author: xiaohaoppy   File: test_tempfile.py    (license) View Source Project 5 votes vote down vote up
def test_retval(self):
        # _get_candidate_names returns a _RandomNameSequence object
        obj = tempfile._get_candidate_names()
        self.assertIsInstance(obj, tempfile._RandomNameSequence)