Remove redundant imports

This commit is contained in:
Raymond Hettinger 2013-04-06 20:53:12 -07:00
parent 1a2ea9c592
commit 56b0a3d89a

View File

@ -846,7 +846,6 @@ def splittype(url):
"""splittype('type:opaquestring') --> 'type', 'opaquestring'.""" """splittype('type:opaquestring') --> 'type', 'opaquestring'."""
global _typeprog global _typeprog
if _typeprog is None: if _typeprog is None:
import re
_typeprog = re.compile('^([^/:]+):') _typeprog = re.compile('^([^/:]+):')
match = _typeprog.match(url) match = _typeprog.match(url)
@ -860,7 +859,6 @@ def splithost(url):
"""splithost('//host[:port]/path') --> 'host[:port]', '/path'.""" """splithost('//host[:port]/path') --> 'host[:port]', '/path'."""
global _hostprog global _hostprog
if _hostprog is None: if _hostprog is None:
import re
_hostprog = re.compile('^//([^/?]*)(.*)$') _hostprog = re.compile('^//([^/?]*)(.*)$')
match = _hostprog.match(url) match = _hostprog.match(url)
@ -877,7 +875,6 @@ def splituser(host):
"""splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
global _userprog global _userprog
if _userprog is None: if _userprog is None:
import re
_userprog = re.compile('^(.*)@(.*)$') _userprog = re.compile('^(.*)@(.*)$')
match = _userprog.match(host) match = _userprog.match(host)
@ -889,7 +886,6 @@ def splitpasswd(user):
"""splitpasswd('user:passwd') -> 'user', 'passwd'.""" """splitpasswd('user:passwd') -> 'user', 'passwd'."""
global _passwdprog global _passwdprog
if _passwdprog is None: if _passwdprog is None:
import re
_passwdprog = re.compile('^([^:]*):(.*)$',re.S) _passwdprog = re.compile('^([^:]*):(.*)$',re.S)
match = _passwdprog.match(user) match = _passwdprog.match(user)
@ -902,7 +898,6 @@ def splitport(host):
"""splitport('host:port') --> 'host', 'port'.""" """splitport('host:port') --> 'host', 'port'."""
global _portprog global _portprog
if _portprog is None: if _portprog is None:
import re
_portprog = re.compile('^(.*):([0-9]+)$') _portprog = re.compile('^(.*):([0-9]+)$')
match = _portprog.match(host) match = _portprog.match(host)
@ -917,7 +912,6 @@ def splitnport(host, defport=-1):
Return None if ':' but not a valid number.""" Return None if ':' but not a valid number."""
global _nportprog global _nportprog
if _nportprog is None: if _nportprog is None:
import re
_nportprog = re.compile('^(.*):(.*)$') _nportprog = re.compile('^(.*):(.*)$')
match = _nportprog.match(host) match = _nportprog.match(host)
@ -936,7 +930,6 @@ def splitquery(url):
"""splitquery('/path?query') --> '/path', 'query'.""" """splitquery('/path?query') --> '/path', 'query'."""
global _queryprog global _queryprog
if _queryprog is None: if _queryprog is None:
import re
_queryprog = re.compile('^(.*)\?([^?]*)$') _queryprog = re.compile('^(.*)\?([^?]*)$')
match = _queryprog.match(url) match = _queryprog.match(url)
@ -948,7 +941,6 @@ def splittag(url):
"""splittag('/path#tag') --> '/path', 'tag'.""" """splittag('/path#tag') --> '/path', 'tag'."""
global _tagprog global _tagprog
if _tagprog is None: if _tagprog is None:
import re
_tagprog = re.compile('^(.*)#([^#]*)$') _tagprog = re.compile('^(.*)#([^#]*)$')
match = _tagprog.match(url) match = _tagprog.match(url)
@ -966,7 +958,6 @@ def splitvalue(attr):
"""splitvalue('attr=value') --> 'attr', 'value'.""" """splitvalue('attr=value') --> 'attr', 'value'."""
global _valueprog global _valueprog
if _valueprog is None: if _valueprog is None:
import re
_valueprog = re.compile('^([^=]*)=(.*)$') _valueprog = re.compile('^([^=]*)=(.*)$')
match = _valueprog.match(attr) match = _valueprog.match(attr)