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
becdad3d
Kaydet (Commit)
becdad3d
authored
Mar 02, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Check for binaries and non-python scripts.
üst
fcd1e6ed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
eqfix.py
Demo/scripts/eqfix.py
+18
-0
No files found.
Demo/scripts/eqfix.py
Dosyayı görüntüle @
becdad3d
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
# Symbolic links are always ignored (except as explicit directory
# Symbolic links are always ignored (except as explicit directory
# arguments). Of course, the original file is kept as a back-up
# arguments). Of course, the original file is kept as a back-up
# (with a "~" attached to its name).
# (with a "~" attached to its name).
# It complains about binaries (files containing null bytes)
# and about files that are ostensibly not Python files: if the first
# line starts with '#!' and does not contain the string 'python'.
#
#
# Changes made are reported to stdout in a diff-like format.
# Changes made are reported to stdout in a diff-like format.
#
#
...
@@ -31,6 +34,7 @@ import regex
...
@@ -31,6 +34,7 @@ import regex
import
posix
import
posix
import
path
import
path
from
stat
import
*
from
stat
import
*
import
string
err
=
sys
.
stderr
.
write
err
=
sys
.
stderr
.
write
dbg
=
err
dbg
=
err
...
@@ -94,6 +98,20 @@ def fix(filename):
...
@@ -94,6 +98,20 @@ def fix(filename):
line
=
f
.
readline
()
line
=
f
.
readline
()
if
not
line
:
break
if
not
line
:
break
lineno
=
lineno
+
1
lineno
=
lineno
+
1
if
g
is
None
and
'
\0
'
in
line
:
# Check for binary files
err
(
filename
+
': contains null bytes; not fixed
\n
'
)
f
.
close
()
return
1
if
lineno
==
1
and
g
is
None
and
line
[:
2
]
==
'#!'
:
# Check for non-Python scripts
words
=
string
.
split
(
line
[
2
:])
if
words
and
regex
.
search
(
'[pP]ython'
,
words
[
0
])
<
0
:
msg
=
filename
+
': '
+
words
[
0
]
msg
=
msg
+
' script; not fixed
\n
'
err
(
msg
)
f
.
close
()
return
1
while
line
[
-
2
:]
==
'
\\\n
'
:
while
line
[
-
2
:]
==
'
\\\n
'
:
nextline
=
f
.
readline
()
nextline
=
f
.
readline
()
if
not
nextline
:
break
if
not
nextline
:
break
...
...
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