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

Class _RelativeURIResolver

pattern/web/feed/feedparser.py:2528–2565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2526 return {"tags": p.tags, "enclosures": p.enclosures, "xfn": p.xfn, "vcard": p.vcard}
2527
2528class _RelativeURIResolver(_BaseHTMLProcessor):
2529 relative_uris = set([('a', 'href'),
2530 ('applet', 'codebase'),
2531 ('area', 'href'),
2532 ('blockquote', 'cite'),
2533 ('body', 'background'),
2534 ('del', 'cite'),
2535 ('form', 'action'),
2536 ('frame', 'longdesc'),
2537 ('frame', 'src'),
2538 ('iframe', 'longdesc'),
2539 ('iframe', 'src'),
2540 ('head', 'profile'),
2541 ('img', 'longdesc'),
2542 ('img', 'src'),
2543 ('img', 'usemap'),
2544 ('input', 'src'),
2545 ('input', 'usemap'),
2546 ('ins', 'cite'),
2547 ('link', 'href'),
2548 ('object', 'classid'),
2549 ('object', 'codebase'),
2550 ('object', 'data'),
2551 ('object', 'usemap'),
2552 ('q', 'cite'),
2553 ('script', 'src')])
2554
2555 def __init__(self, baseuri, encoding, _type):
2556 _BaseHTMLProcessor.__init__(self, encoding, _type)
2557 self.baseuri = baseuri
2558
2559 def resolveURI(self, uri):
2560 return _makeSafeAbsoluteURI(self.baseuri, uri.strip())
2561
2562 def unknown_starttag(self, tag, attrs):
2563 attrs = self.normalize_attrs(attrs)
2564 attrs = [(key, ((tag, key) in self.relative_uris) and self.resolveURI(value) or value) for key, value in attrs]
2565 _BaseHTMLProcessor.unknown_starttag(self, tag, attrs)
2566
2567def _resolveRelativeURIs(htmlSource, baseURI, encoding, _type):
2568 if not _SGML_AVAILABLE:

Callers 1

_resolveRelativeURIsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…