[Python-checkins] CVS: python/dist/src/Lib gopherlib.py,1.8,1.9
Eric S. Raymond
esr@users.sourceforge.net
Fri, 09 Feb 2001 02:10:04 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv4276
Modified Files:
gopherlib.py
Log Message:
String method conversion.
(This one was trivial -- no actual string. references in it!)
Index: gopherlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gopherlib.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** gopherlib.py 2001/01/23 15:35:05 1.8
--- gopherlib.py 2001/02/09 10:10:02 1.9
***************
*** 1,6 ****
"""Gopher protocol client interface."""
- import string
-
__all__ = ["send_selector","send_query"]
--- 1,4 ----
***************
*** 59,71 ****
"""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, ':')
if i >= 0:
! host, port = host[:i], string.atoi(host[i+1:])
if not port:
port = DEF_PORT
elif type(port) == type(''):
! port = string.atoi(port)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
--- 57,68 ----
"""Send a selector to a given host and port, return a file with the reply."""
import socket
if not port:
! i = host.find(':')
if i >= 0:
! host, port = host[:i], int(host[i+1:])
if not port:
port = DEF_PORT
elif type(port) == type(''):
! port = int(port)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
***************
*** 99,103 ****
def get_directory(f):
"""Get a directory in the form of a list of entries."""
- import string
list = []
while 1:
--- 96,99 ----
***************
*** 116,120 ****
continue
gtype = line[0]
! parts = string.splitfields(line[1:], TAB)
if len(parts) < 4:
print '(Bad line from server:', `line`, ')'
--- 112,116 ----
continue
gtype = line[0]
! parts = line[1:].split(TAB)
if len(parts) < 4:
print '(Bad line from server:', `line`, ')'