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
83e879d9
Kaydet (Commit)
83e879d9
authored
Şub 06, 2003
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add DeprecationWarning when use_statcache argument is supplied
Fix use of GetoptError, so demo() now works
üst
98b922c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
filecmp.py
Lib/filecmp.py
+12
-4
No files found.
Lib/filecmp.py
Dosyayı görüntüle @
83e879d9
...
@@ -4,20 +4,21 @@ Classes:
...
@@ -4,20 +4,21 @@ Classes:
dircmp
dircmp
Functions:
Functions:
cmp(f1, f2, shallow=1
, use_statcache=0
) -> int
cmp(f1, f2, shallow=1) -> int
cmpfiles(a, b, common) -> ([], [], [])
cmpfiles(a, b, common) -> ([], [], [])
"""
"""
import
os
import
os
import
stat
import
stat
import
warnings
__all__
=
[
"cmp"
,
"dircmp"
,
"cmpfiles"
]
__all__
=
[
"cmp"
,
"dircmp"
,
"cmpfiles"
]
_cache
=
{}
_cache
=
{}
BUFSIZE
=
8
*
1024
BUFSIZE
=
8
*
1024
def
cmp
(
f1
,
f2
,
shallow
=
1
,
use_statcache
=
0
):
def
cmp
(
f1
,
f2
,
shallow
=
1
,
use_statcache
=
None
):
"""Compare two files.
"""Compare two files.
Arguments:
Arguments:
...
@@ -39,6 +40,10 @@ def cmp(f1, f2, shallow=1, use_statcache=0):
...
@@ -39,6 +40,10 @@ def cmp(f1, f2, shallow=1, use_statcache=0):
with a cache invalidation mechanism relying on stale signatures.
with a cache invalidation mechanism relying on stale signatures.
"""
"""
if
use_statcache
is
not
None
:
warnings
.
warn
(
"use_statcache argument is deprecated"
,
DeprecationWarning
)
s1
=
_sig
(
os
.
stat
(
f1
))
s1
=
_sig
(
os
.
stat
(
f1
))
s2
=
_sig
(
os
.
stat
(
f2
))
s2
=
_sig
(
os
.
stat
(
f2
))
if
s1
[
0
]
!=
stat
.
S_IFREG
or
s2
[
0
]
!=
stat
.
S_IFREG
:
if
s1
[
0
]
!=
stat
.
S_IFREG
or
s2
[
0
]
!=
stat
.
S_IFREG
:
...
@@ -261,7 +266,7 @@ class dircmp:
...
@@ -261,7 +266,7 @@ class dircmp:
sd
.
report_full_closure
()
sd
.
report_full_closure
()
def
cmpfiles
(
a
,
b
,
common
,
shallow
=
1
,
use_statcache
=
0
):
def
cmpfiles
(
a
,
b
,
common
,
shallow
=
1
,
use_statcache
=
None
):
"""Compare common files in two directories.
"""Compare common files in two directories.
a, b -- directory names
a, b -- directory names
...
@@ -275,6 +280,9 @@ def cmpfiles(a, b, common, shallow=1, use_statcache=0):
...
@@ -275,6 +280,9 @@ def cmpfiles(a, b, common, shallow=1, use_statcache=0):
filenames that aren't regular files.
filenames that aren't regular files.
"""
"""
if
use_statcache
is
not
None
:
warnings
.
warn
(
"use_statcache argument is deprecated"
,
DeprecationWarning
)
res
=
([],
[],
[])
res
=
([],
[],
[])
for
x
in
common
:
for
x
in
common
:
ax
=
os
.
path
.
join
(
a
,
x
)
ax
=
os
.
path
.
join
(
a
,
x
)
...
@@ -312,7 +320,7 @@ def demo():
...
@@ -312,7 +320,7 @@ def demo():
import
getopt
import
getopt
options
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'r'
)
options
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'r'
)
if
len
(
args
)
!=
2
:
if
len
(
args
)
!=
2
:
raise
getopt
.
error
,
'need exactly two args'
raise
getopt
.
GetoptError
(
'need exactly two args'
,
None
)
dd
=
dircmp
(
args
[
0
],
args
[
1
])
dd
=
dircmp
(
args
[
0
],
args
[
1
])
if
(
'-r'
,
''
)
in
options
:
if
(
'-r'
,
''
)
in
options
:
dd
.
report_full_closure
()
dd
.
report_full_closure
()
...
...
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