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

Class Link

pattern/web/__init__.py:3030–3054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3028# Tested with a crawl across 1,000 domains so far.
3029
3030class Link(object):
3031
3032 def __init__(self, url, text="", relation="", referrer=""):
3033 """ A hyperlink parsed from a HTML document, in the form:
3034 <a href="url"", title="text", rel="relation">xxx</a>.
3035 """
3036 self.url, self.text, self.relation, self.referrer = \
3037 u(url), u(text), u(relation), u(referrer),
3038
3039 @property
3040 def description(self):
3041 return self.text
3042
3043 def __repr__(self):
3044 return "Link(url=%s)" % repr(self.url)
3045
3046 # Used for sorting in Crawler.links:
3047 def __eq__(self, link):
3048 return self.url == link.url
3049 def __ne__(self, link):
3050 return self.url != link.url
3051 def __lt__(self, link):
3052 return self.url < link.url
3053 def __gt__(self, link):
3054 return self.url > link.url
3055
3056class HTMLLinkParser(HTMLParser):
3057

Callers 2

handle_starttagMethod · 0.85
pushMethod · 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…