• Home
  • Raw
  • Download

Lines Matching refs:tempfile

2 import tempfile
25 has_textmode = (tempfile._text_openflags != tempfile._bin_openflags)
41 self.assertIs(str, tempfile._infer_return_type(''))
42 self.assertIs(bytes, tempfile._infer_return_type(b''))
43 self.assertIs(str, tempfile._infer_return_type(None))
46 self.assertIs(str, tempfile._infer_return_type('', ''))
47 self.assertIs(bytes, tempfile._infer_return_type(b'', b''))
49 tempfile._infer_return_type('', b'')
51 tempfile._infer_return_type(b'', '')
54 self.assertIs(str, tempfile._infer_return_type(None, ''))
55 self.assertIs(str, tempfile._infer_return_type('', None))
56 self.assertIs(str, tempfile._infer_return_type(None, None))
57 self.assertIs(bytes, tempfile._infer_return_type(b'', None))
58 self.assertIs(bytes, tempfile._infer_return_type(None, b''))
60 tempfile._infer_return_type('', None, b'')
62 tempfile._infer_return_type(b'', None, '')
116 dict = tempfile.__dict__
147 self.r = tempfile._RandomNameSequence()
221 cand = tempfile._candidate_tempdir_list()
237 cand = tempfile._candidate_tempdir_list()
262 with tempfile.TemporaryDirectory() as our_temp_directory:
267 with support.swap_attr(tempfile, "_candidate_tempdir_list",
270 tempfile._get_default_tempdir()
279 tempfile._get_default_tempdir()
290 tempfile._get_default_tempdir()
299 obj = tempfile._get_candidate_names()
300 self.assertIsInstance(obj, tempfile._RandomNameSequence)
304 a = tempfile._get_candidate_names()
305 b = tempfile._get_candidate_names()
312 dir = tempfile.mkdtemp()
314 with support.swap_attr(tempfile, 'tempdir', dir):
321 return support.swap_attr(tempfile,
330 oldmode = mode = os.stat(tempfile.tempdir).st_mode
332 os.chmod(tempfile.tempdir, mode)
334 if os.access(tempfile.tempdir, os.W_OK):
338 self.assertEqual(os.listdir(tempfile.tempdir), [])
340 os.chmod(tempfile.tempdir, oldmode)
344 tempdir = os.path.join(tempfile.tempdir, 'nonexistent')
345 with support.swap_attr(tempfile, 'tempdir', tempdir):
351 tempdir = os.path.join(tempfile.tempdir, 'file')
353 with support.swap_attr(tempfile, 'tempdir', tempdir):
362 _bflags = tempfile._bin_openflags
363 _tflags = tempfile._text_openflags
371 output_type = tempfile._infer_return_type(dir, pre, suf)
372 (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags, output_type)
382 output_type = tempfile._infer_return_type(dir, pre, suf)
385 dir = tempfile.gettempdir()
387 dir = tempfile.gettempdirb()
408 dir_b = tempfile.gettempdirb()
430 dir = tempfile.mkdtemp()
500 return tempfile._mkstemp_inner(tempfile.gettempdir(),
501 tempfile.gettempprefix(),
503 tempfile._bin_openflags,
524 dir = tempfile.mkdtemp()
537 p = tempfile.gettempprefix()
542 pb = tempfile.gettempprefixb()
553 p = tempfile.gettempprefix() + "xxxxxx.xxx"
554 d = tempfile.mkdtemp(prefix="")
570 for d in (tempfile.gettempdir(), tempfile.gettempdirb()):
582 file = tempfile.NamedTemporaryFile()
588 a = tempfile.gettempdir()
589 b = tempfile.gettempdir()
590 c = tempfile.gettempdirb()
599 case_sensitive_tempdir = tempfile.mkdtemp("-Temp")
600 _tempdir, tempfile.tempdir = tempfile.tempdir, None
605 self.assertEqual(tempfile.gettempdir(), case_sensitive_tempdir)
607 tempfile.tempdir = _tempdir
615 output_type = tempfile._infer_return_type(dir, pre, suf)
618 dir = tempfile.gettempdir()
620 dir = tempfile.gettempdirb()
625 (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf)
649 d = tempfile.gettempdirb()
666 dir = tempfile.mkdtemp()
677 return tempfile.mkdtemp()
680 output_type = tempfile._infer_return_type(dir, pre, suf)
683 dir = tempfile.gettempdir()
685 dir = tempfile.gettempdirb()
690 name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf)
709 d = tempfile.gettempdirb()
735 dir = tempfile.mkdtemp()
764 file = tempfile.NamedTemporaryFile(delete=False)
767 dir = tempfile.mkdtemp()
775 dir1 = tempfile.mkdtemp()
777 dir2 = tempfile.mkdtemp()
787 self.dir = tempfile.mkdtemp()
798 _bflags = tempfile._bin_openflags
801 self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf)
846 dir = tempfile.gettempdir()
847 file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf,
883 f = tempfile.NamedTemporaryFile(mode='w+b')
893 f = tempfile.NamedTemporaryFile()
899 dir = tempfile.mkdtemp()
901 f = tempfile.NamedTemporaryFile(dir=dir)
911 dir = tempfile.mkdtemp()
914 f = tempfile.NamedTemporaryFile(dir=dir, delete=False)
927 f = tempfile.NamedTemporaryFile()
935 with tempfile.NamedTemporaryFile() as f:
953 self.assertRaises(ValueError, tempfile.NamedTemporaryFile)
957 dir = tempfile.mkdtemp()
960 tempfile.NamedTemporaryFile(mode='wr', dir=dir)
962 tempfile.NamedTemporaryFile(mode=2, dir=dir)
972 dir = tempfile.gettempdir()
973 file = tempfile.SpooledTemporaryFile(max_size=max_size, dir=dir, prefix=pre, suffix=suf)
987 dir = tempfile.mkdtemp()
989 f = tempfile.SpooledTemporaryFile(max_size=10, dir=dir)
1057 f = tempfile.SpooledTemporaryFile()
1066 f = tempfile.SpooledTemporaryFile(max_size=1)
1088 f = tempfile.SpooledTemporaryFile(max_size=10)
1110 f = tempfile.SpooledTemporaryFile(mode='w+', max_size=10)
1137 f = tempfile.SpooledTemporaryFile(mode='w+', max_size=10,
1159 with tempfile.SpooledTemporaryFile(max_size=1) as f:
1170 with tempfile.SpooledTemporaryFile(max_size=1) as f:
1184 f = tempfile.SpooledTemporaryFile(max_size=1)
1198 f = tempfile.SpooledTemporaryFile(max_size=10)
1205 f = tempfile.SpooledTemporaryFile(max_size=10)
1211 f = tempfile.SpooledTemporaryFile(max_size=10)
1219 if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile:
1227 tempfile.TemporaryFile()
1231 dir = tempfile.mkdtemp()
1232 f = tempfile.TemporaryFile(dir=dir)
1247 f = tempfile.TemporaryFile()
1257 with tempfile.TemporaryFile(*args, **kwargs) as fileobj:
1277 self.assertRaises(ValueError, tempfile.TemporaryFile)
1303 dir = tempfile.gettempdir()
1304 tmp = tempfile.TemporaryDirectory(dir=dir, prefix=pre, suffix=suf)
1318 with tempfile.TemporaryDirectory() as nonexistent:
1321 tempfile.TemporaryDirectory(dir=nonexistent)
1326 dir = tempfile.mkdtemp()
1361 dir = tempfile.mkdtemp()