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
ce85827a
Kaydet (Commit)
ce85827a
authored
Eyl 14, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Utility to untabify stubber results.
üst
dcd038ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
untabify.py
Tools/scripts/untabify.py
+50
-0
No files found.
Tools/scripts/untabify.py
0 → 100755
Dosyayı görüntüle @
ce85827a
#! /usr/bin/env python
"Replace tabs with spaces in argument files. Print names of changed files."
import
os
import
sys
import
string
import
getopt
def
main
():
tabsize
=
8
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"t:"
)
if
not
args
:
raise
getopt
.
error
,
"At least one file argument required"
except
getopt
.
error
,
msg
:
print
msg
print
"usage:"
,
sys
.
argv
[
0
],
"file ..."
return
for
file
in
args
:
process
(
file
,
tabsize
)
def
process
(
file
,
tabsize
):
try
:
f
=
open
(
file
)
text
=
f
.
read
()
f
.
close
()
except
IOError
,
msg
:
print
"
%
s: I/O error:
%
s"
%
(
`file`
,
str
(
msg
))
return
newtext
=
string
.
expandtabs
(
text
,
tabsize
)
if
newtext
==
text
:
return
backup
=
file
+
"~"
try
:
os
.
unlink
(
backup
)
except
os
.
error
:
pass
try
:
os
.
rename
(
file
,
backup
)
except
os
.
error
:
pass
f
=
open
(
file
,
"w"
)
f
.
write
(
newtext
)
f
.
close
()
print
file
if
__name__
==
'__main__'
:
main
()
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