Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a0d55de8
Kaydet (Commit)
a0d55de8
authored
Agu 09, 2002
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Whitespace normalization.
üst
4030714a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
tempfile.py
Lib/tempfile.py
+9
-6
test_tempfile.py
Lib/test/test_tempfile.py
+2
-2
No files found.
Lib/tempfile.py
Dosyayı görüntüle @
a0d55de8
...
@@ -58,11 +58,14 @@ except (ImportError, AttributeError):
...
@@ -58,11 +58,14 @@ except (ImportError, AttributeError):
release
=
acquire
release
=
acquire
_text_openflags
=
_os
.
O_RDWR
|
_os
.
O_CREAT
|
_os
.
O_EXCL
_text_openflags
=
_os
.
O_RDWR
|
_os
.
O_CREAT
|
_os
.
O_EXCL
if
hasattr
(
_os
,
'O_NOINHERIT'
):
_text_openflags
|=
_os
.
O_NOINHERIT
if
hasattr
(
_os
,
'O_NOINHERIT'
):
if
hasattr
(
_os
,
'O_NOFOLLOW'
):
_text_openflags
|=
_os
.
O_NOFOLLOW
_text_openflags
|=
_os
.
O_NOINHERIT
if
hasattr
(
_os
,
'O_NOFOLLOW'
):
_text_openflags
|=
_os
.
O_NOFOLLOW
_bin_openflags
=
_text_openflags
_bin_openflags
=
_text_openflags
if
hasattr
(
_os
,
'O_BINARY'
):
_bin_openflags
|=
_os
.
O_BINARY
if
hasattr
(
_os
,
'O_BINARY'
):
_bin_openflags
|=
_os
.
O_BINARY
if
hasattr
(
_os
,
'TMP_MAX'
):
if
hasattr
(
_os
,
'TMP_MAX'
):
TMP_MAX
=
_os
.
TMP_MAX
TMP_MAX
=
_os
.
TMP_MAX
...
@@ -177,7 +180,7 @@ def _candidate_tempdir_list():
...
@@ -177,7 +180,7 @@ def _candidate_tempdir_list():
dirlist
.
append
(
_os
.
curdir
)
dirlist
.
append
(
_os
.
curdir
)
return
dirlist
return
dirlist
def
_get_default_tempdir
():
def
_get_default_tempdir
():
"""Calculate the default directory to use for temporary files.
"""Calculate the default directory to use for temporary files.
This routine should be called through '_once' (see above) as we
This routine should be called through '_once' (see above) as we
...
@@ -239,7 +242,7 @@ def _mkstemp_inner(dir, pre, suf, flags):
...
@@ -239,7 +242,7 @@ def _mkstemp_inner(dir, pre, suf, flags):
raise
raise
raise
IOError
,
(
_errno
.
EEXIST
,
"No usable temporary file name found"
)
raise
IOError
,
(
_errno
.
EEXIST
,
"No usable temporary file name found"
)
# User visible interfaces.
# User visible interfaces.
...
@@ -302,7 +305,7 @@ def mkdtemp(suffix="", prefix=template, dir=gettempdir()):
...
@@ -302,7 +305,7 @@ def mkdtemp(suffix="", prefix=template, dir=gettempdir()):
"""
"""
names
=
_get_candidate_names
()
names
=
_get_candidate_names
()
for
seq
in
xrange
(
TMP_MAX
):
for
seq
in
xrange
(
TMP_MAX
):
name
=
names
.
next
()
name
=
names
.
next
()
file
=
_os
.
path
.
join
(
dir
,
prefix
+
name
+
suffix
)
file
=
_os
.
path
.
join
(
dir
,
prefix
+
name
+
suffix
)
...
...
Lib/test/test_tempfile.py
Dosyayı görüntüle @
a0d55de8
...
@@ -268,7 +268,7 @@ class test__mkstemp_inner(TC):
...
@@ -268,7 +268,7 @@ class test__mkstemp_inner(TC):
def
__del__
(
self
):
def
__del__
(
self
):
self
.
_close
(
self
.
fd
)
self
.
_close
(
self
.
fd
)
self
.
_unlink
(
self
.
name
)
self
.
_unlink
(
self
.
name
)
def
do_create
(
self
,
dir
=
None
,
pre
=
""
,
suf
=
""
,
bin
=
1
):
def
do_create
(
self
,
dir
=
None
,
pre
=
""
,
suf
=
""
,
bin
=
1
):
if
dir
is
None
:
if
dir
is
None
:
dir
=
tempfile
.
gettempdir
()
dir
=
tempfile
.
gettempdir
()
...
@@ -485,7 +485,7 @@ class test_mkdtemp(TC):
...
@@ -485,7 +485,7 @@ class test_mkdtemp(TC):
os
.
rmdir
(
self
.
do_create
(
suf
=
"b"
))
os
.
rmdir
(
self
.
do_create
(
suf
=
"b"
))
os
.
rmdir
(
self
.
do_create
(
pre
=
"a"
,
suf
=
"b"
))
os
.
rmdir
(
self
.
do_create
(
pre
=
"a"
,
suf
=
"b"
))
os
.
rmdir
(
self
.
do_create
(
pre
=
"aa"
,
suf
=
".txt"
))
os
.
rmdir
(
self
.
do_create
(
pre
=
"aa"
,
suf
=
".txt"
))
def
test_basic_many
(
self
):
def
test_basic_many
(
self
):
"""mkdtemp can create many directories (stochastic)"""
"""mkdtemp can create many directories (stochastic)"""
extant
=
range
(
1000
)
extant
=
range
(
1000
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment