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

Method lookslikehtml

pattern/web/feed/feedparser.py:1039–1053  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

1037 # data loss, this function errs on the conservative side.
1038 @staticmethod
1039 def lookslikehtml(s):
1040 # must have a close tag or an entity reference to qualify
1041 if not (re.search(r'</(\w+)>',s) or re.search("&#?\w+;",s)):
1042 return
1043
1044 # all tags must be in a restricted subset of valid HTML tags
1045 if filter(lambda t: t.lower() not in _HTMLSanitizer.acceptable_elements,
1046 re.findall(r'</?(\w+)',s)):
1047 return
1048
1049 # all entities must have been defined as valid HTML entities
1050 if filter(lambda e: e not in entitydefs.keys(), re.findall(r'&(\w+);', s)):
1051 return
1052
1053 return 1
1054
1055 def _mapToStandardPrefix(self, name):
1056 colonpos = name.find(':')

Callers 1

popMethod · 0.95

Calls 3

filterFunction · 0.50
searchMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected