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
19e6d621
Kaydet (Commit)
19e6d621
authored
Şub 09, 2001
tarafından
Eric S. Raymond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
String method conversion.
(This one was trivial -- no actual string. references in it!)
üst
c95bf69f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
gopherlib.py
Lib/gopherlib.py
+4
-8
No files found.
Lib/gopherlib.py
Dosyayı görüntüle @
19e6d621
"""Gopher protocol client interface."""
import
string
__all__
=
[
"send_selector"
,
"send_query"
]
# Default selector, host and port
...
...
@@ -58,15 +56,14 @@ TAB = '\t'
def
send_selector
(
selector
,
host
,
port
=
0
):
"""Send a selector to a given host and port, return a file with the reply."""
import
socket
import
string
if
not
port
:
i
=
string
.
find
(
host
,
':'
)
i
=
host
.
find
(
':'
)
if
i
>=
0
:
host
,
port
=
host
[:
i
],
string
.
atoi
(
host
[
i
+
1
:])
host
,
port
=
host
[:
i
],
int
(
host
[
i
+
1
:])
if
not
port
:
port
=
DEF_PORT
elif
type
(
port
)
==
type
(
''
):
port
=
string
.
atoi
(
port
)
port
=
int
(
port
)
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
s
.
connect
((
host
,
port
))
s
.
send
(
selector
+
CRLF
)
...
...
@@ -98,7 +95,6 @@ def path_to_datatype_name(path):
def
get_directory
(
f
):
"""Get a directory in the form of a list of entries."""
import
string
list
=
[]
while
1
:
line
=
f
.
readline
()
...
...
@@ -115,7 +111,7 @@ def get_directory(f):
print
'(Empty line from server)'
continue
gtype
=
line
[
0
]
parts
=
string
.
splitfields
(
line
[
1
:],
TAB
)
parts
=
line
[
1
:]
.
split
(
TAB
)
if
len
(
parts
)
<
4
:
print
'(Bad line from server:'
,
`line`
,
')'
continue
...
...
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