8585# OF THIS SOFTWARE.
8686# --------------------------------------------------------------------
8787
88- #
89- # things to look into some day:
90-
91- # TODO: sort out True/False/boolean issues for Python 2.3
92-
9388"""
9489An XML-RPC client interface for Python.
9590
120115
121116Exported constants:
122117
123- True
124- False
118+ (none)
125119
126120Exported functions:
127121
133127 name (None if not present).
134128"""
135129
136- import re , time , operator
130+ import base64
131+ import time
137132import http .client
138133from xml .parsers import expat
139134import socket
@@ -230,7 +225,7 @@ class ResponseError(Error):
230225##
231226# Indicates an XML-RPC fault response package. This exception is
232227# raised by the unmarshalling layer, if the XML-RPC response contains
233- # a fault string. This exception can also used as a class, to
228+ # a fault string. This exception can also be used as a class, to
234229# generate a fault XML-RPC message.
235230#
236231# @param faultCode The XML-RPC fault code.
@@ -243,10 +238,7 @@ def __init__(self, faultCode, faultString, **extra):
243238 self .faultCode = faultCode
244239 self .faultString = faultString
245240 def __repr__ (self ):
246- return (
247- "<Fault %s: %s>" %
248- (self .faultCode , repr (self .faultString ))
249- )
241+ return "<Fault %s: %r>" % (self .faultCode , self .faultString )
250242
251243# --------------------------------------------------------------------
252244# Special values
@@ -352,7 +344,7 @@ def __str__(self):
352344 return self .value
353345
354346 def __repr__ (self ):
355- return "<DateTime %s at %x>" % (repr ( self .value ) , id (self ))
347+ return "<DateTime %r at %x>" % (self .value , id (self ))
356348
357349 def decode (self , data ):
358350 self .value = str (data ).strip ()
@@ -378,9 +370,6 @@ def _datetime_type(data):
378370#
379371# @param data An 8-bit string containing arbitrary data.
380372
381- import base64
382- import io
383-
384373class Binary :
385374 """Wrapper for binary data."""
386375
@@ -1198,7 +1187,6 @@ def get_host_info(self, host):
11981187 auth , host = urllib .parse .splituser (host )
11991188
12001189 if auth :
1201- import base64
12021190 auth = urllib .parse .unquote_to_bytes (auth )
12031191 auth = base64 .encodebytes (auth ).decode ("utf-8" )
12041192 auth = "" .join (auth .split ()) # get rid of whitespace
0 commit comments