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
165163f2
Kaydet (Commit)
165163f2
authored
Mar 27, 2004
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add usage() function, -h(elp) flag and long versions of short flags
üst
dbb40780
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
reindent.py
Tools/scripts/reindent.py
+18
-8
No files found.
Tools/scripts/reindent.py
Dosyayı görüntüle @
165163f2
...
...
@@ -4,9 +4,10 @@
"""reindent [-d][-r][-v] [ path ... ]
-d Dry run. Analyze, but don't make any changes to, files.
-r Recurse. Search for all .py files in subdirectories too.
-v Verbose. Print informative msgs; else no output.
-d (--dryrun) Dry run. Analyze, but don't make any changes to, files.
-r (--recurse) Recurse. Search for all .py files in subdirectories too.
-v (--verbose) Verbose. Print informative msgs; else no output.
-h (--help) Help. Print this usage information and exit.
Change Python (.py) files to use 4-space indents and no hard tab characters.
Also trim excess spaces and tabs from ends of lines, and remove empty lines
...
...
@@ -42,6 +43,11 @@ verbose = 0
recurse
=
0
dryrun
=
0
def
usage
(
msg
=
None
):
if
msg
is
not
None
:
print
>>
sys
.
stderr
,
msg
print
>>
sys
.
stderr
,
__doc__
def
errprint
(
*
args
):
sep
=
""
for
arg
in
args
:
...
...
@@ -53,17 +59,21 @@ def main():
import
getopt
global
verbose
,
recurse
,
dryrun
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"drv"
)
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"drvh"
,
[
"dryrun"
,
"recurse"
,
"verbose"
,
"help"
])
except
getopt
.
error
,
msg
:
errprint
(
msg
)
usage
(
msg
)
return
for
o
,
a
in
opts
:
if
o
==
'-d'
:
if
o
in
(
'-d'
,
'--dryrun'
)
:
dryrun
+=
1
elif
o
==
'-r'
:
elif
o
in
(
'-r'
,
'--recurse'
)
:
recurse
+=
1
elif
o
==
'-v'
:
elif
o
in
(
'-v'
,
'--verbose'
)
:
verbose
+=
1
elif
o
in
(
'-h'
,
'--help'
):
usage
()
return
if
not
args
:
r
=
Reindenter
(
sys
.
stdin
)
r
.
run
()
...
...
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