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
b2ac8092
Kaydet (Commit)
b2ac8092
authored
Mar 30, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
change posix to os and path to os.path
üst
4ea570d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
38 deletions
+36
-38
eqfix.py
Demo/scripts/eqfix.py
+18
-19
classfix.py
Tools/scripts/classfix.py
+18
-19
No files found.
Demo/scripts/eqfix.py
Dosyayı görüntüle @
b2ac8092
...
@@ -31,8 +31,7 @@
...
@@ -31,8 +31,7 @@
import
sys
import
sys
import
regex
import
regex
import
posix
import
os
import
path
from
stat
import
*
from
stat
import
*
import
string
import
string
...
@@ -46,9 +45,9 @@ def main():
...
@@ -46,9 +45,9 @@ def main():
err
(
'usage: '
+
argv
[
0
]
+
' file-or-directory ...
\n
'
)
err
(
'usage: '
+
argv
[
0
]
+
' file-or-directory ...
\n
'
)
sys
.
exit
(
2
)
sys
.
exit
(
2
)
for
arg
in
sys
.
argv
[
1
:]:
for
arg
in
sys
.
argv
[
1
:]:
if
path
.
isdir
(
arg
):
if
os
.
path
.
isdir
(
arg
):
if
recursedown
(
arg
):
bad
=
1
if
recursedown
(
arg
):
bad
=
1
elif
path
.
islink
(
arg
):
elif
os
.
path
.
islink
(
arg
):
err
(
arg
+
': will not process symbolic links
\n
'
)
err
(
arg
+
': will not process symbolic links
\n
'
)
bad
=
1
bad
=
1
else
:
else
:
...
@@ -63,17 +62,17 @@ def recursedown(dirname):
...
@@ -63,17 +62,17 @@ def recursedown(dirname):
dbg
(
'recursedown('
+
`dirname`
+
')
\n
'
)
dbg
(
'recursedown('
+
`dirname`
+
')
\n
'
)
bad
=
0
bad
=
0
try
:
try
:
names
=
posix
.
listdir
(
dirname
)
names
=
os
.
listdir
(
dirname
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
dirname
+
': cannot list directory: '
+
`msg`
+
'
\n
'
)
err
(
dirname
+
': cannot list directory: '
+
`msg`
+
'
\n
'
)
return
1
return
1
names
.
sort
()
names
.
sort
()
subdirs
=
[]
subdirs
=
[]
for
name
in
names
:
for
name
in
names
:
if
name
in
(
'.'
,
'..'
):
continue
if
name
in
(
os
.
curdir
,
os
.
pardir
):
continue
fullname
=
path
.
join
(
dirname
,
name
)
fullname
=
os
.
path
.
join
(
dirname
,
name
)
if
path
.
islink
(
fullname
):
pass
if
os
.
path
.
islink
(
fullname
):
pass
elif
path
.
isdir
(
fullname
):
elif
os
.
path
.
isdir
(
fullname
):
subdirs
.
append
(
fullname
)
subdirs
.
append
(
fullname
)
elif
ispython
(
name
):
elif
ispython
(
name
):
if
fix
(
fullname
):
bad
=
1
if
fix
(
fullname
):
bad
=
1
...
@@ -88,8 +87,8 @@ def fix(filename):
...
@@ -88,8 +87,8 @@ def fix(filename):
except
IOError
,
msg
:
except
IOError
,
msg
:
err
(
filename
+
': cannot open: '
+
`msg`
+
'
\n
'
)
err
(
filename
+
': cannot open: '
+
`msg`
+
'
\n
'
)
return
1
return
1
head
,
tail
=
path
.
split
(
filename
)
head
,
tail
=
os
.
path
.
split
(
filename
)
tempname
=
path
.
join
(
head
,
'@'
+
tail
)
tempname
=
os
.
path
.
join
(
head
,
'@'
+
tail
)
g
=
None
g
=
None
# If we find a match, we rewind the file and start over but
# If we find a match, we rewind the file and start over but
# now copy everything to a temp file.
# now copy everything to a temp file.
...
@@ -145,19 +144,19 @@ def fix(filename):
...
@@ -145,19 +144,19 @@ def fix(filename):
# First copy the file's mode to the temp file
# First copy the file's mode to the temp file
try
:
try
:
statbuf
=
posix
.
stat
(
filename
)
statbuf
=
os
.
stat
(
filename
)
posix
.
chmod
(
tempname
,
statbuf
[
ST_MODE
]
&
07777
)
os
.
chmod
(
tempname
,
statbuf
[
ST_MODE
]
&
07777
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
tempname
+
': warning: chmod failed ('
+
`msg`
+
')
\n
'
)
err
(
tempname
+
': warning: chmod failed ('
+
`msg`
+
')
\n
'
)
# Then make a backup of the original file as filename~
# Then make a backup of the original file as filename~
try
:
try
:
posix
.
rename
(
filename
,
filename
+
'~'
)
os
.
rename
(
filename
,
filename
+
'~'
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
filename
+
': warning: backup failed ('
+
`msg`
+
')
\n
'
)
err
(
filename
+
': warning: backup failed ('
+
`msg`
+
')
\n
'
)
# Now move the temp file to the original file
# Now move the temp file to the original file
try
:
try
:
posix
.
rename
(
tempname
,
filename
)
os
.
rename
(
tempname
,
filename
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
filename
+
': rename failed ('
+
`msg`
+
')
\n
'
)
err
(
filename
+
': rename failed ('
+
`msg`
+
')
\n
'
)
return
1
return
1
# Return succes
# Return succes
...
...
Tools/scripts/classfix.py
Dosyayı görüntüle @
b2ac8092
...
@@ -28,8 +28,7 @@
...
@@ -28,8 +28,7 @@
import
sys
import
sys
import
regex
import
regex
import
posix
import
os
import
path
from
stat
import
*
from
stat
import
*
err
=
sys
.
stderr
.
write
err
=
sys
.
stderr
.
write
...
@@ -42,9 +41,9 @@ def main():
...
@@ -42,9 +41,9 @@ def main():
err
(
'usage: '
+
argv
[
0
]
+
' file-or-directory ...
\n
'
)
err
(
'usage: '
+
argv
[
0
]
+
' file-or-directory ...
\n
'
)
sys
.
exit
(
2
)
sys
.
exit
(
2
)
for
arg
in
sys
.
argv
[
1
:]:
for
arg
in
sys
.
argv
[
1
:]:
if
path
.
isdir
(
arg
):
if
os
.
path
.
isdir
(
arg
):
if
recursedown
(
arg
):
bad
=
1
if
recursedown
(
arg
):
bad
=
1
elif
path
.
islink
(
arg
):
elif
os
.
path
.
islink
(
arg
):
err
(
arg
+
': will not process symbolic links
\n
'
)
err
(
arg
+
': will not process symbolic links
\n
'
)
bad
=
1
bad
=
1
else
:
else
:
...
@@ -59,17 +58,17 @@ def recursedown(dirname):
...
@@ -59,17 +58,17 @@ def recursedown(dirname):
dbg
(
'recursedown('
+
`dirname`
+
')
\n
'
)
dbg
(
'recursedown('
+
`dirname`
+
')
\n
'
)
bad
=
0
bad
=
0
try
:
try
:
names
=
posix
.
listdir
(
dirname
)
names
=
os
.
listdir
(
dirname
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
dirname
+
': cannot list directory: '
+
`msg`
+
'
\n
'
)
err
(
dirname
+
': cannot list directory: '
+
`msg`
+
'
\n
'
)
return
1
return
1
names
.
sort
()
names
.
sort
()
subdirs
=
[]
subdirs
=
[]
for
name
in
names
:
for
name
in
names
:
if
name
in
(
'.'
,
'..'
):
continue
if
name
in
(
os
.
curdir
,
os
.
pardir
):
continue
fullname
=
path
.
join
(
dirname
,
name
)
fullname
=
os
.
path
.
join
(
dirname
,
name
)
if
path
.
islink
(
fullname
):
pass
if
os
.
path
.
islink
(
fullname
):
pass
elif
path
.
isdir
(
fullname
):
elif
os
.
path
.
isdir
(
fullname
):
subdirs
.
append
(
fullname
)
subdirs
.
append
(
fullname
)
elif
ispython
(
name
):
elif
ispython
(
name
):
if
fix
(
fullname
):
bad
=
1
if
fix
(
fullname
):
bad
=
1
...
@@ -84,8 +83,8 @@ def fix(filename):
...
@@ -84,8 +83,8 @@ def fix(filename):
except
IOError
,
msg
:
except
IOError
,
msg
:
err
(
filename
+
': cannot open: '
+
`msg`
+
'
\n
'
)
err
(
filename
+
': cannot open: '
+
`msg`
+
'
\n
'
)
return
1
return
1
head
,
tail
=
path
.
split
(
filename
)
head
,
tail
=
os
.
path
.
split
(
filename
)
tempname
=
path
.
join
(
head
,
'@'
+
tail
)
tempname
=
os
.
path
.
join
(
head
,
'@'
+
tail
)
g
=
None
g
=
None
# If we find a match, we rewind the file and start over but
# If we find a match, we rewind the file and start over but
# now copy everything to a temp file.
# now copy everything to a temp file.
...
@@ -127,19 +126,19 @@ def fix(filename):
...
@@ -127,19 +126,19 @@ def fix(filename):
# First copy the file's mode to the temp file
# First copy the file's mode to the temp file
try
:
try
:
statbuf
=
posix
.
stat
(
filename
)
statbuf
=
os
.
stat
(
filename
)
posix
.
chmod
(
tempname
,
statbuf
[
ST_MODE
]
&
07777
)
os
.
chmod
(
tempname
,
statbuf
[
ST_MODE
]
&
07777
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
tempname
+
': warning: chmod failed ('
+
`msg`
+
')
\n
'
)
err
(
tempname
+
': warning: chmod failed ('
+
`msg`
+
')
\n
'
)
# Then make a backup of the original file as filename~
# Then make a backup of the original file as filename~
try
:
try
:
posix
.
rename
(
filename
,
filename
+
'~'
)
os
.
rename
(
filename
,
filename
+
'~'
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
filename
+
': warning: backup failed ('
+
`msg`
+
')
\n
'
)
err
(
filename
+
': warning: backup failed ('
+
`msg`
+
')
\n
'
)
# Now move the temp file to the original file
# Now move the temp file to the original file
try
:
try
:
posix
.
rename
(
tempname
,
filename
)
os
.
rename
(
tempname
,
filename
)
except
posix
.
error
,
msg
:
except
os
.
error
,
msg
:
err
(
filename
+
': rename failed ('
+
`msg`
+
')
\n
'
)
err
(
filename
+
': rename failed ('
+
`msg`
+
')
\n
'
)
return
1
return
1
# Return succes
# Return succes
...
...
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