All Samples(415) | Call(372) | Derive(0) | Import(43)
OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.
def pathname2url(pathname):
"""OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use."""
return quote(pathname)
def __init__(self, url, method, params):
from urllib import url2pathname, pathname2url
self.url = url
self.redirect = None
pathname = url2pathname(url)
if not os.path.isabs(pathname):
try:
pathname = os.path.normpath(pathname)
self.redirect = 1
self.pathname = pathname
self.url = "file:" + pathname2url(pathname)
self.method = method
self.params = params
self.headers = {}
src/z/a/zamboni-lib-HEAD/lib/python/rdflib/parser.py zamboni-lib(Download)
import os import __builtin__ import warnings from urllib import pathname2url, url2pathname from urllib2 import urlopen, Request, HTTPError from urlparse import urljoin from StringIO import StringIO
def __init__(self, file):
base = urljoin("file:", pathname2url(os.getcwd()))
system_id = URIRef(file.name, base=base)
super(FileInputSource, self).__init__(system_id)
self.file = file
self.setByteStream(file)
# TODO: self.setEncoding(encoding)
raise Exception("Unexpected type '%s' for source '%s'" % (type(source), source))
if location is not None:
base = urljoin("file:", "%s/" % pathname2url(os.getcwd()))
absolute_location = URIRef(location, base=base).defrag()
if absolute_location.startswith("file:///"):
filename = url2pathname(absolute_location.replace("file:///", "/"))
src/l/1/l10n-checks-0.3rc2/lib/mozilla/core/l10nconfigparser.py l10n-checks(Download)
import os from ConfigParser import ConfigParser, NoSectionError, NoOptionError from urlparse import urlparse, urljoin from urllib import pathname2url, url2pathname from urllib2 import urlopen class L10nConfigParser(object):
def __init__(self, inipath, **kwargs):
# TODO: try to get the cwd from the main application
if os.path.isabs(inipath) and os.name != 'nt':
self.inipath = 'file:%s' % pathname2url(inipath)
else:
pwdurl = 'file:%s/' % pathname2url(os.getcwd())
self.inipath = urljoin(pwdurl, inipath)
src/l/1/l10n-checks-0.3rc2/lib/mozilla/core/filter.py l10n-checks(Download)
import os.path from urlparse import urlparse, urljoin from urllib import pathname2url, url2pathname class Filter(object): ''' Class for reading and using the filter.py file
'''
self.filters = []
drive, tail = os.path.splitdrive(inipath)
filterpath = drive + url2pathname(urlparse(urljoin(pathname2url(tail),
'filter.py'))[2])
self.addFilterFrom(filterpath)
'''
for f in self.filters:
try:
if not f(pathname2url(module), pathname2url(filepath), entity):
return False
except Exception, e:
raise Exception("Error in filter.py: " +str(e))
src/c/o/compare-locales-0.9/lib/Mozilla/Paths.py compare-locales(Download)
import os from ConfigParser import ConfigParser, NoSectionError, NoOptionError from urlparse import urlparse, urljoin from urllib import pathname2url, url2pathname from urllib2 import urlopen from Mozilla.CompareLocales import defaultdict
defaults.
"""
if os.path.isabs(inipath):
self.inipath = 'file:%s' % pathname2url(inipath)
else:
pwdurl = 'file:%s/' % pathname2url(os.getcwd())
self.inipath = urljoin(pwdurl, inipath)
src/b/t/btqueue-HEAD/trunk/btqueue/BitCrawler/aurllib.py btqueue(Download)
import base64 import os from urllib import addinfourl, pathname2url from urlparse import urlparse,urlunparse import urllib2 from cgi import parse_qs from httpsession import HTTPSession
ut[5] = ''
uri = urlunparse(tuple(ut))
if uri.find('://') == -1:
uri = 'file://' + pathname2url(os.path.realpath(uri))
return urlopener.urlopen(uri,data,method=method,referer=referer)
src/r/d/rdflib-HEAD/rdflib/parser.py rdflib(Download)
import os import __builtin__ import warnings from urllib import pathname2url, url2pathname from urllib2 import urlopen, Request, HTTPError from urlparse import urljoin from StringIO import StringIO
def __init__(self, file):
base = urljoin("file:", pathname2url(os.getcwd()))
system_id = URIRef(file.name, base=base)
super(FileInputSource, self).__init__(system_id)
self.file = file
self.setByteStream(file)
# TODO: self.setEncoding(encoding)
raise Exception("Unexpected type '%s' for source '%s'" % (type(source), source))
if location is not None:
base = urljoin("file:", "%s/" % pathname2url(os.getcwd()))
absolute_location = URIRef(location, base=base).defrag()
if absolute_location.startswith("file:///"):
filename = url2pathname(absolute_location.replace("file:///", "/"))
src/b/t/btqueue-HEAD/btqueue/BitCrawler/aurllib.py btqueue(Download)
import base64 import os from urllib import addinfourl, pathname2url from urlparse import urlparse,urlunparse import urllib2 from cgi import parse_qs from httpsession import HTTPSession
ut[5] = ''
uri = urlunparse(tuple(ut))
if uri.find('://') == -1:
uri = 'file://' + pathname2url(os.path.realpath(uri))
return urlopener.urlopen(uri,data,method=method,referer=referer)
src/k/a/karrigell-HEAD/trunk/karrigell/core/k_utils.py karrigell(Download)
def dirlist(dir_path,url):
import os
import urlparse
from urllib import pathname2url,url2pathname
if not url.endswith("/"):
url += "/"
names = os.listdir(dir_path)
#body += '<BR>+<A href="%s">%s</A>\n' %(urlparse.urljoin(url,pathname2url(d)),d)
body += '<BR><SPAN class="cadre">+</span>'
body += '<A href="%s/">%s</A>\n' \
%(urlparse.urljoin(url,pathname2url(d)),d)
for f in files:
body += '<BR> <A href="%s">%s</A>\n' \
%(urlparse.urljoin(url,pathname2url(f)),f)
src/k/a/karrigell-HEAD/karrigell/core/k_utils.py karrigell(Download)
def dirlist(dir_path,url):
import os
import urlparse
from urllib import pathname2url,url2pathname
if not url.endswith("/"):
url += "/"
names = os.listdir(dir_path)
#body += '<BR>+<A href="%s">%s</A>\n' %(urlparse.urljoin(url,pathname2url(d)),d)
body += '<BR><SPAN class="cadre">+</span>'
body += '<A href="%s/">%s</A>\n' \
%(urlparse.urljoin(url,pathname2url(d)),d)
for f in files:
body += '<BR> <A href="%s">%s</A>\n' \
%(urlparse.urljoin(url,pathname2url(f)),f)
1 | 2 | 3 | 4 | 5 Next