• Home
  • Raw
  • Download

Lines Matching refs:tempfile

2 import tempfile
21 has_textmode = (tempfile._text_openflags != tempfile._bin_openflags)
37 self.assertIs(str, tempfile._infer_return_type(''))
38 self.assertIs(bytes, tempfile._infer_return_type(b''))
39 self.assertIs(str, tempfile._infer_return_type(None))
42 self.assertIs(str, tempfile._infer_return_type('', ''))
43 self.assertIs(bytes, tempfile._infer_return_type(b'', b''))
45 tempfile._infer_return_type('', b'')
47 tempfile._infer_return_type(b'', '')
50 self.assertIs(str, tempfile._infer_return_type(None, ''))
51 self.assertIs(str, tempfile._infer_return_type('', None))
52 self.assertIs(str, tempfile._infer_return_type(None, None))
53 self.assertIs(bytes, tempfile._infer_return_type(b'', None))
54 self.assertIs(bytes, tempfile._infer_return_type(None, b''))
56 tempfile._infer_return_type('', None, b'')
58 tempfile._infer_return_type(b'', None, '')
61 self.assertIs(str, tempfile._infer_return_type(pathlib.Path('/')))
120 dict = tempfile.__dict__
151 self.r = tempfile._RandomNameSequence()
217 cand = tempfile._candidate_tempdir_list()
233 cand = tempfile._candidate_tempdir_list()
258 with tempfile.TemporaryDirectory() as our_temp_directory:
263 with support.swap_attr(tempfile, "_candidate_tempdir_list",
266 tempfile._get_default_tempdir()
275 tempfile._get_default_tempdir()
286 tempfile._get_default_tempdir()
295 obj = tempfile._get_candidate_names()
296 self.assertIsInstance(obj, tempfile._RandomNameSequence)
300 a = tempfile._get_candidate_names()
301 b = tempfile._get_candidate_names()
308 dir = tempfile.mkdtemp()
310 with support.swap_attr(tempfile, 'tempdir', dir):
317 return support.swap_attr(tempfile,
326 oldmode = mode = os.stat(tempfile.tempdir).st_mode
328 os.chmod(tempfile.tempdir, mode)
330 if os.access(tempfile.tempdir, os.W_OK):
334 self.assertEqual(os.listdir(tempfile.tempdir), [])
336 os.chmod(tempfile.tempdir, oldmode)
340 tempdir = os.path.join(tempfile.tempdir, 'nonexistent')
341 with support.swap_attr(tempfile, 'tempdir', tempdir):
347 tempdir = os.path.join(tempfile.tempdir, 'file')
349 with support.swap_attr(tempfile, 'tempdir', tempdir):
358 _bflags = tempfile._bin_openflags
359 _tflags = tempfile._text_openflags
367 output_type = tempfile._infer_return_type(dir, pre, suf)
368 (self.fd, self.name) = tempfile._mkstemp_inner(dir, pre, suf, flags, output_type)
378 output_type = tempfile._infer_return_type(dir, pre, suf)
381 dir = tempfile.gettempdir()
383 dir = tempfile.gettempdirb()
404 dir_b = tempfile.gettempdirb()
426 dir = tempfile.mkdtemp()
496 return tempfile._mkstemp_inner(tempfile.gettempdir(),
497 tempfile.gettempprefix(),
499 tempfile._bin_openflags,
520 dir = tempfile.mkdtemp()
533 p = tempfile.gettempprefix()
538 pb = tempfile.gettempprefixb()
549 p = tempfile.gettempprefix() + "xxxxxx.xxx"
550 d = tempfile.mkdtemp(prefix="")
566 for d in (tempfile.gettempdir(), tempfile.gettempdirb()):
578 with tempfile.NamedTemporaryFile() as file:
583 a = tempfile.gettempdir()
584 b = tempfile.gettempdir()
585 c = tempfile.gettempdirb()
594 case_sensitive_tempdir = tempfile.mkdtemp("-Temp")
595 _tempdir, tempfile.tempdir = tempfile.tempdir, None
600 self.assertEqual(tempfile.gettempdir(), case_sensitive_tempdir)
602 tempfile.tempdir = _tempdir
610 output_type = tempfile._infer_return_type(dir, pre, suf)
613 dir = tempfile.gettempdir()
615 dir = tempfile.gettempdirb()
620 (fd, name) = tempfile.mkstemp(dir=dir, prefix=pre, suffix=suf)
644 d = tempfile.gettempdirb()
661 dir = tempfile.mkdtemp()
673 return tempfile.mkdtemp()
676 output_type = tempfile._infer_return_type(dir, pre, suf)
679 dir = tempfile.gettempdir()
681 dir = tempfile.gettempdirb()
686 name = tempfile.mkdtemp(dir=dir, prefix=pre, suffix=suf)
705 d = tempfile.gettempdirb()
731 dir = tempfile.mkdtemp()
760 file = tempfile.NamedTemporaryFile(delete=False)
763 dir = tempfile.mkdtemp()
771 dir1 = tempfile.mkdtemp()
773 dir2 = tempfile.mkdtemp()
783 self.dir = tempfile.mkdtemp()
794 _bflags = tempfile._bin_openflags
797 self.name = tempfile.mktemp(dir=dir, prefix=pre, suffix=suf)
842 dir = tempfile.gettempdir()
843 file = tempfile.NamedTemporaryFile(dir=dir, prefix=pre, suffix=suf,
879 f = tempfile.NamedTemporaryFile(mode='w+b')
889 f = tempfile.NamedTemporaryFile()
895 dir = tempfile.mkdtemp()
897 with tempfile.NamedTemporaryFile(dir=dir) as f:
906 dir = tempfile.mkdtemp()
909 f = tempfile.NamedTemporaryFile(dir=dir, delete=False)
922 f = tempfile.NamedTemporaryFile()
930 with tempfile.NamedTemporaryFile() as f:
948 self.assertRaises(ValueError, tempfile.NamedTemporaryFile)
952 dir = tempfile.mkdtemp()
955 tempfile.NamedTemporaryFile(mode='wr', dir=dir)
957 tempfile.NamedTemporaryFile(mode=2, dir=dir)
967 dir = tempfile.gettempdir()
968 file = tempfile.SpooledTemporaryFile(max_size=max_size, dir=dir, prefix=pre, suffix=suf)
982 dir = tempfile.mkdtemp()
984 f = tempfile.SpooledTemporaryFile(max_size=10, dir=dir)
1054 f = tempfile.SpooledTemporaryFile()
1063 f = tempfile.SpooledTemporaryFile(max_size=1)
1085 f = tempfile.SpooledTemporaryFile(max_size=10)
1111 f = tempfile.SpooledTemporaryFile(mode='w+', max_size=10,
1141 f = tempfile.SpooledTemporaryFile(mode='w+', max_size=10,
1168 with tempfile.SpooledTemporaryFile(max_size=1) as f:
1179 with tempfile.SpooledTemporaryFile(max_size=1) as f:
1193 f = tempfile.SpooledTemporaryFile(max_size=1)
1207 f = tempfile.SpooledTemporaryFile(max_size=10)
1214 f = tempfile.SpooledTemporaryFile(max_size=10)
1220 f = tempfile.SpooledTemporaryFile(max_size=10)
1227 self.assertIsInstance(tempfile.SpooledTemporaryFile[bytes],
1230 if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile:
1238 tempfile.TemporaryFile()
1242 dir = tempfile.mkdtemp()
1243 f = tempfile.TemporaryFile(dir=dir)
1258 f = tempfile.TemporaryFile()
1268 with tempfile.TemporaryFile(*args, **kwargs) as fileobj:
1288 self.assertRaises(ValueError, tempfile.TemporaryFile)
1314 dir = tempfile.gettempdir()
1315 tmp = tempfile.TemporaryDirectory(dir=dir, prefix=pre, suffix=suf)
1335 with tempfile.TemporaryDirectory() as nonexistent:
1338 tempfile.TemporaryDirectory(dir=nonexistent)
1343 dir = tempfile.mkdtemp()
1378 dir = tempfile.mkdtemp()