Did I find the right examples for you? yes no

All Samples(12)  |  Call(8)  |  Derive(0)  |  Import(4)
A better urlsplit.

It differentiates empty querystring/fragment from none.
e.g.::

  urisplit('http://a.b/c/d') -> ('http', 'a.b', '/c/d', None, None)
  urisplit('http://a.b/c/d?') -> ('http', 'a.b', '/c/d', '', None)
  urisplit('http://a.b/c/d#') -> ('http', 'a.b', '/c/d', None, '')
  urisplit('http://a.b/c/d?#') -> ('http', 'a.b', '/c/d', '', '')

        def urisplit(url):
    """A better urlsplit.

    It differentiates empty querystring/fragment from none.
    e.g.::

      urisplit('http://a.b/c/d') -> ('http', 'a.b', '/c/d', None, None)
      urisplit('http://a.b/c/d?') -> ('http', 'a.b', '/c/d', '', None)
      urisplit('http://a.b/c/d#') -> ('http', 'a.b', '/c/d', None, '')
      urisplit('http://a.b/c/d?#') -> ('http', 'a.b', '/c/d', '', '')

    """
    ret = list(urlsplit(url))

    if ret[4] == '' and url[-1] != '#':
        ret[4] = None
        before_fragment = -1
    else:
        # there is a (possibly empty) fragment
        # -> remove it and the '#', to test query-string below
        before_fragment = - (len(ret[4]) + 2)

    if ret[3] == '' and url[before_fragment] != '?':
        ret[3] = None

    return SplitResult(*ret)
        


src/k/t/kTBS-0.2/lib/rdfrest/local.py   kTBS(Download)
from .hosted import HostedResource
from .interface import get_subclass, IResource
from .utils import coerce_to_uri, Diagnosis, make_fresh_uri, ReadOnlyGraph, \
    urisplit
 
        # but ensures that we will not generate multiple instances for the
        # same resource.
        assert urisplit(root_uri)[3:] == (None, None), \
            "Invalid URI <%s>" % root_uri
        self.root_uri = coerce_to_uri(root_uri)
        """
        assert isinstance(uri, URIRef)
        querystr, fragid = urisplit(uri)[3:]
        if querystr is not None  or  fragid is not None:
            # fragid is managed by the decorator HostedResource.handle_fragment
    def __init__(self, service, uri):
        # not calling parents __init__ #pylint: disable=W0231
        assert urisplit(uri)[3:] == (None, None), "Invalid URI <%s>" % uri
 
        self.service = service

src/k/t/ktbs-HEAD/lib/rdfrest/local.py   ktbs(Download)
from .hosted import HostedResource
from .interface import get_subclass, IResource
from .utils import coerce_to_uri, Diagnosis, make_fresh_uri, ReadOnlyGraph, \
    urisplit
 
        # but ensures that we will not generate multiple instances for the
        # same resource.
        assert urisplit(root_uri)[3:] == (None, None), \
            "Invalid URI <%s>" % root_uri
        self.root_uri = coerce_to_uri(root_uri)
        """
        assert isinstance(uri, URIRef)
        querystr, fragid = urisplit(uri)[3:]
        if querystr is not None  or  fragid is not None:
            # fragid is managed by the decorator HostedResource.handle_fragment
    def __init__(self, service, uri):
        # not calling parents __init__ #pylint: disable=W0231
        assert urisplit(uri)[3:] == (None, None), "Invalid URI <%s>" % uri
 
        self.service = service

src/k/t/kTBS-0.2/lib/rdfrest/hosted.py   kTBS(Download)
from .exceptions import MethodNotAllowedError
from .interface import get_subclass, IResource
from .utils import coerce_to_uri, urisplit
 
class HostedResource(IResource):
        def decorated_factory(self_or_cls, uri, _rdf_type=None,
                              _no_spawn=False):
            """I wrap a resource factory to handle URIs with frag-id."""
            fragid = urisplit(uri)[4]
            if fragid is None:

src/k/t/ktbs-HEAD/lib/rdfrest/hosted.py   ktbs(Download)
from .exceptions import MethodNotAllowedError
from .interface import get_subclass, IResource
from .utils import coerce_to_uri, urisplit
 
class HostedResource(IResource):
        def decorated_factory(self_or_cls, uri, _rdf_type=None,
                              _no_spawn=False):
            """I wrap a resource factory to handle URIs with frag-id."""
            fragid = urisplit(uri)[4]
            if fragid is None: