src/p/d/pdb2pqr-HEAD/trunk/pdb2pqr/contrib/numpy-1.1.0/numpy/lib/_datasource.py pdb2pqr(Download)
import os import tempfile from shutil import rmtree from urllib2 import urlopen, URLError from urlparse import urlparse # TODO: .zip support, .tar support?
openedurl = urlopen(path)
file(upath, 'w').write(openedurl.read())
except URLError:
raise URLError("URL not found: ", path)
else:
try:
# TODO: Why not just copy the file with shutils.copyfile?
src/p/d/pdb2pqr-HEAD/pdb2pqr/contrib/numpy-1.1.0/numpy/lib/_datasource.py pdb2pqr(Download)
import os import tempfile from shutil import rmtree from urllib2 import urlopen, URLError from urlparse import urlparse # TODO: .zip support, .tar support?
openedurl = urlopen(path)
file(upath, 'w').write(openedurl.read())
except URLError:
raise URLError("URL not found: ", path)
else:
try:
# TODO: Why not just copy the file with shutils.copyfile?
src/k/e/keeprunning-HEAD/twill/other_packages/_mechanize_dist/_http.py keeprunning(Download)
import copy, time, tempfile, htmlentitydefs, re, logging, socket, \
urllib2, urllib, httplib, sgmllib
from urllib2 import URLError, HTTPError, BaseHandler
from cStringIO import StringIO
from _request import Request
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host = req.get_host()
if not host:
raise URLError('no host given')
h = http_class(host) # will parse host:port
h.set_debuglevel(self._debuglevel)
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
src/m/e/mechanize-HEAD/mechanize/_urllib2_fork.py mechanize(Download)
# support for FileHandler, proxies via environment variables from urllib import localhost, url2pathname, getproxies from urllib2 import HTTPError, URLError import _request import _rfc3986
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host_port = req.get_host()
if not host_port:
raise URLError('no host given')
try:
h = http_class(host_port, timeout=req.timeout)
if req._tunnel_host:
if not hasattr(h, "set_tunnel"):
if not hasattr(h, "_set_tunnel"):
raise URLError("HTTPS through proxy not supported "
"(Python >= 2.6.4 required)")
else:
# python 2.6
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
def unknown_open(self, req):
type = req.get_type()
raise URLError('unknown url type: %s' % type)
def parse_keqv_list(l):
"""Parse list of key=value strings where keys are not duplicated."""
parsed = {}
headers, 'file:'+file)
except OSError, msg:
# urllib2 users shouldn't expect OSErrors coming from urlopen()
raise URLError(msg)
raise URLError('file not on local host')
class FTPHandler(BaseHandler):
def ftp_open(self, req):
import ftplib
import mimetypes
host = req.get_host()
if not host:
raise URLError('ftp error: no host given')
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise URLError(msg)
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
dirs = map(unquote, dirs)
src/w/s/wsat-HEAD/trunk/src/crawling/ClientCookie/_urllib2_support.py wsat(Download)
import sgmllib
# monkeypatch to fix http://www.python.org/sf/803422 :-(
sgmllib.charref = re.compile("&#(x?[0-9a-fA-F]+)[^0-9a-fA-F]")
from urllib2 import URLError, HTTPError
import types, string, socket
from cStringIO import StringIO
try:
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host = req.get_host()
if not host:
raise URLError('no host given')
h = http_class(host) # will parse host:port
h.set_debuglevel(self._debuglevel)
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
src/s/t/stewbot-HEAD/components/modules/mechanize/_urllib2_fork.py stewbot(Download)
# support for FileHandler, proxies via environment variables from urllib import localhost, url2pathname, getproxies from urllib2 import HTTPError, URLError import _request import _rfc3986
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host_port = req.get_host()
if not host_port:
raise URLError('no host given')
try:
h = http_class(host_port, timeout=req.timeout)
if req._tunnel_host:
if not hasattr(h, "set_tunnel"):
if not hasattr(h, "_set_tunnel"):
raise URLError("HTTPS through proxy not supported "
"(Python >= 2.6.4 required)")
else:
# python 2.6
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
def unknown_open(self, req):
type = req.get_type()
raise URLError('unknown url type: %s' % type)
def parse_keqv_list(l):
"""Parse list of key=value strings where keys are not duplicated."""
parsed = {}
headers, 'file:'+file)
except OSError, msg:
# urllib2 users shouldn't expect OSErrors coming from urlopen()
raise URLError(msg)
raise URLError('file not on local host')
class FTPHandler(BaseHandler):
def ftp_open(self, req):
import ftplib
import mimetypes
host = req.get_host()
if not host:
raise URLError('ftp error: no host given')
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise URLError(msg)
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
dirs = map(unquote, dirs)
src/w/s/wsat-HEAD/src/crawling/ClientCookie/_urllib2_support.py wsat(Download)
import sgmllib
# monkeypatch to fix http://www.python.org/sf/803422 :-(
sgmllib.charref = re.compile("&#(x?[0-9a-fA-F]+)[^0-9a-fA-F]")
from urllib2 import URLError, HTTPError
import types, string, socket
from cStringIO import StringIO
try:
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host = req.get_host()
if not host:
raise URLError('no host given')
h = http_class(host) # will parse host:port
h.set_debuglevel(self._debuglevel)
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
src/p/y/pyitc-HEAD/mechanize/_urllib2_fork.py pyitc(Download)
# support for FileHandler, proxies via environment variables from urllib import localhost, url2pathname, getproxies from urllib2 import HTTPError, URLError import _request import _rfc3986
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host_port = req.get_host()
if not host_port:
raise URLError('no host given')
try:
h = http_class(host_port, timeout=req.timeout)
if req._tunnel_host:
if not hasattr(h, "set_tunnel"):
if not hasattr(h, "_set_tunnel"):
raise URLError("HTTPS through proxy not supported "
"(Python >= 2.6.4 required)")
else:
# python 2.6
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
def unknown_open(self, req):
type = req.get_type()
raise URLError('unknown url type: %s' % type)
def parse_keqv_list(l):
"""Parse list of key=value strings where keys are not duplicated."""
parsed = {}
headers, 'file:'+file)
except OSError, msg:
# urllib2 users shouldn't expect OSErrors coming from urlopen()
raise URLError(msg)
raise URLError('file not on local host')
class FTPHandler(BaseHandler):
def ftp_open(self, req):
import ftplib
import mimetypes
host = req.get_host()
if not host:
raise URLError('ftp error: no host given')
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise URLError(msg)
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
dirs = map(unquote, dirs)
src/n/u/numpy3k-HEAD/numpy/lib/_datasource.py numpy3k(Download)
"""
# We import these here because importing urllib2 is slow and
# a significant fraction of numpy's total import time.
from urllib2 import urlopen, URLError
upath = self.abspath(path)
openedurl = urlopen(path)
file(upath, 'w').write(openedurl.read())
except URLError:
raise URLError("URL not found: %s" % path)
else:
try:
# TODO: Why not just copy the file with shutils.copyfile?
"""
# We import this here because importing urllib2 is slow and
# a significant fraction of numpy's total import time.
from urllib2 import urlopen, URLError
# Test local path
if os.path.exists(path):
src/n/u/numpy-HEAD/numpy/lib/_datasource.py numpy(Download)
"""
# We import these here because importing urllib2 is slow and
# a significant fraction of numpy's total import time.
from urllib2 import urlopen, URLError
upath = self.abspath(path)
openedurl = urlopen(path)
file(upath, 'w').write(openedurl.read())
except URLError:
raise URLError("URL not found: %s" % path)
else:
try:
# TODO: Why not just copy the file with shutils.copyfile?
"""
# We import this here because importing urllib2 is slow and
# a significant fraction of numpy's total import time.
from urllib2 import urlopen, URLError
# Test local path
if os.path.exists(path):
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next