MCPcopy Index your code
hub / github.com/clips/pattern / _makeSafeAbsoluteURI

Function _makeSafeAbsoluteURI

pattern/web/feed/feedparser.py:2575–2598  ·  view source on GitHub ↗
(base, rel=None)

Source from the content-addressed store, hash-verified

2573 return p.output()
2574
2575def _makeSafeAbsoluteURI(base, rel=None):
2576 # bail if ACCEPTABLE_URI_SCHEMES is empty
2577 if not ACCEPTABLE_URI_SCHEMES:
2578 try:
2579 return _urljoin(base, rel or u'')
2580 except ValueError:
2581 return u''
2582 if not base:
2583 return rel or u''
2584 if not rel:
2585 try:
2586 scheme = urlparse.urlparse(base)[0]
2587 except ValueError:
2588 return u''
2589 if not scheme or scheme in ACCEPTABLE_URI_SCHEMES:
2590 return base
2591 return u''
2592 try:
2593 uri = _urljoin(base, rel)
2594 except ValueError:
2595 return u''
2596 if uri.strip().split(':', 1)[0] not in ACCEPTABLE_URI_SCHEMES:
2597 return u''
2598 return uri
2599
2600class _HTMLSanitizer(_BaseHTMLProcessor):
2601 acceptable_elements = set(['a', 'abbr', 'acronym', 'address', 'area',

Callers 5

unknown_starttagMethod · 0.85
_end_newlocationMethod · 0.85
resolveURIMethod · 0.85
unknown_starttagMethod · 0.85
parseFunction · 0.85

Calls 3

_urljoinFunction · 0.85
stripMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…