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
e46d14cd
Kaydet (Commit)
e46d14cd
authored
Eyl 22, 2003
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid list as a variable name.
üst
d7160f88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
gopherlib.py
Lib/gopherlib.py
+10
-10
No files found.
Lib/gopherlib.py
Dosyayı görüntüle @
e46d14cd
...
...
@@ -95,7 +95,7 @@ def path_to_datatype_name(path):
def
get_directory
(
f
):
"""Get a directory in the form of a list of entries."""
list
=
[]
entries
=
[]
while
1
:
line
=
f
.
readline
()
if
not
line
:
...
...
@@ -122,14 +122,14 @@ def get_directory(f):
else
:
parts
.
append
(
''
)
parts
.
insert
(
0
,
gtype
)
list
.
append
(
parts
)
return
list
entries
.
append
(
parts
)
return
entries
def
get_textfile
(
f
):
"""Get a text file as a list of lines, with trailing CRLF stripped."""
li
st
=
[]
get_alt_textfile
(
f
,
li
st
.
append
)
return
li
st
li
nes
=
[]
get_alt_textfile
(
f
,
li
nes
.
append
)
return
li
nes
def
get_alt_textfile
(
f
,
func
):
"""Get a text file and pass each line to a function, with trailing CRLF stripped."""
...
...
@@ -191,11 +191,11 @@ def test():
else
:
f
=
send_selector
(
selector
,
host
)
if
type
==
A_TEXT
:
li
st
=
get_textfile
(
f
)
for
item
in
li
st
:
print
item
li
nes
=
get_textfile
(
f
)
for
item
in
li
nes
:
print
item
elif
type
in
(
A_MENU
,
A_INDEX
):
list
=
get_directory
(
f
)
for
item
in
list
:
print
item
entries
=
get_directory
(
f
)
for
item
in
entries
:
print
item
else
:
data
=
get_binary
(
f
)
print
'binary data:'
,
len
(
data
),
'bytes:'
,
`data[:100]`
[:
40
]
...
...
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