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
9a29e7ab
Kaydet (Commit)
9a29e7ab
authored
Mar 26, 2002
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
operate as a filter when no files or directories appear on the command line
üst
85ee491b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
reindent.py
Tools/scripts/reindent.py
+17
-9
No files found.
Tools/scripts/reindent.py
Dosyayı görüntüle @
9a29e7ab
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# Released to the public domain, by Tim Peters, 03 October 2000.
# Released to the public domain, by Tim Peters, 03 October 2000.
"""reindent [-d][-r][-v]
path ...
"""reindent [-d][-r][-v]
[ path ... ]
-d Dry run. Analyze, but don't make any changes to, files.
-d Dry run. Analyze, but don't make any changes to, files.
-r Recurse. Search for all .py files in subdirectories too.
-r Recurse. Search for all .py files in subdirectories too.
...
@@ -12,14 +12,20 @@ Change Python (.py) files to use 4-space indents and no hard tab characters.
...
@@ -12,14 +12,20 @@ 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
Also trim excess spaces and tabs from ends of lines, and remove empty lines
at the end of files. Also ensure the last line ends with a newline.
at the end of files. Also ensure the last line ends with a newline.
Pass one or more file and/or directory paths. When a directory path, all
If no paths are given on the command line, reindent operates as a filter,
.py files within the directory will be examined, and, if the -r option is
reading a single source file from standard input and writing the transformed
given, likewise recursively for subdirectories.
source to standard output. In this case, the -d, -r and -v flags are
ignored.
Overwrites files in place, renaming the originals with a .bak extension.
You can pass one or more file and/or directory paths. When a directory
If reindent finds nothing to change, the file is left alone. If reindent
path, all .py files within the directory will be examined, and, if the -r
does change a file, the changed file is a fixed-point for reindent (i.e.,
option is given, likewise recursively for subdirectories.
running reindent on the resulting .py file won't change it again).
If output is not to standard output, reindent overwrites files in place,
renaming the originals with a .bak extension. If it finds nothing to
change, the file is left alone. If reindent does change a file, the changed
file is a fixed-point for future runs (i.e., running reindent on the
resulting .py file won't change it again).
The hard part of reindenting is figuring out what to do with comment
The hard part of reindenting is figuring out what to do with comment
lines. So long as the input files get a clean bill of health from
lines. So long as the input files get a clean bill of health from
...
@@ -59,7 +65,9 @@ def main():
...
@@ -59,7 +65,9 @@ def main():
elif
o
==
'-v'
:
elif
o
==
'-v'
:
verbose
+=
1
verbose
+=
1
if
not
args
:
if
not
args
:
errprint
(
"Usage:"
,
__doc__
)
r
=
Reindenter
(
sys
.
stdin
)
r
.
run
()
r
.
write
(
sys
.
stdout
)
return
return
for
arg
in
args
:
for
arg
in
args
:
check
(
arg
)
check
(
arg
)
...
...
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