Lines Matching refs:attrs

244     def findNext(self, name=None, attrs={}, text=None, **kwargs):
247 return self._findOne(self.findAllNext, name, attrs, text, **kwargs)
249 def findAllNext(self, name=None, attrs={}, text=None, limit=None,
253 return self._findAll(name, attrs, text, limit, self.nextGenerator,
256 def findNextSibling(self, name=None, attrs={}, text=None, **kwargs):
259 return self._findOne(self.findNextSiblings, name, attrs, text,
262 def findNextSiblings(self, name=None, attrs={}, text=None, limit=None,
266 return self._findAll(name, attrs, text, limit,
270 def findPrevious(self, name=None, attrs={}, text=None, **kwargs):
273 return self._findOne(self.findAllPrevious, name, attrs, text, **kwargs)
275 def findAllPrevious(self, name=None, attrs={}, text=None, limit=None,
279 return self._findAll(name, attrs, text, limit, self.previousGenerator,
283 def findPreviousSibling(self, name=None, attrs={}, text=None, **kwargs):
286 return self._findOne(self.findPreviousSiblings, name, attrs, text,
289 def findPreviousSiblings(self, name=None, attrs={}, text=None,
293 return self._findAll(name, attrs, text, limit,
297 def findParent(self, name=None, attrs={}, **kwargs):
303 l = self.findParents(name, attrs, 1)
308 def findParents(self, name=None, attrs={}, limit=None, **kwargs):
312 return self._findAll(name, attrs, None, limit, self.parentGenerator,
318 def _findOne(self, method, name, attrs, text, **kwargs):
320 l = method(name, attrs, text, 1, **kwargs)
325 def _findAll(self, name, attrs, text, limit, generator, **kwargs):
332 strainer = SoupStrainer(name, attrs, text, **kwargs)
500 def __init__(self, parser, name, attrs=None, parent=None,
509 if attrs == None:
510 attrs = []
511 self.attrs = attrs
527 self.attrs = map(convert, self.attrs)
564 for i in range(0, len(self.attrs)):
565 if self.attrs[i][0] == key:
566 self.attrs[i] = (key, value)
569 self.attrs.append((key, value))
574 for item in self.attrs:
576 self.attrs.remove(item)
603 if not hasattr(other, 'name') or not hasattr(other, 'attrs') or not hasattr(other, 'contents') or self.name != other.name or self.attrs != other.attrs or len(self) != len(other):
643 attrs = []
644 if self.attrs:
645 for key, val in self.attrs:
685 attrs.append(decoded)
705 if attrs:
706 attributeString = ' ' + ' '.join(attrs)
763 def find(self, name=None, attrs={}, recursive=True, text=None,
768 l = self.findAll(name, attrs, recursive, text, 1, **kwargs)
774 def findAll(self, name=None, attrs={}, recursive=True, text=None,
780 The value of a key-value pair in the 'attrs' map can be a
788 return self._findAll(name, attrs, text, limit, generator, **kwargs)
817 for (key, value) in self.attrs:
845 def __init__(self, name=None, attrs={}, text=None, **kwargs):
847 if isString(attrs):
848 kwargs['class'] = attrs
849 attrs = None
851 if attrs:
852 attrs = attrs.copy()
853 attrs.update(kwargs)
855 attrs = kwargs
856 self.attrs = attrs
863 return "%s|%s" % (self.name, self.attrs)
883 for attr, matchAgainst in self.attrs.items():
1013 def handle_starttag(self, name, attrs):
1015 self.soup.extractCharsetFromMeta(attrs)
1017 self.soup.unknown_starttag(name, attrs)
1397 def unknown_starttag(self, name, attrs, selfClosing=0):
1398 #print "Start tag %s: %s" % (name, attrs)
1402 attrs = ''.join(map(lambda(x, y): ' %s="%s"' % (x, y), attrs))
1403 self.handle_data('<%s%s>' % (name, attrs))
1411 and (self.parseOnlyThese.text or not self.parseOnlyThese.searchTag(name, attrs)):
1414 tag = Tag(self, name, attrs, self.currentTag, self.previous)
1443 def extractCharsetFromMeta(self, attrs):
1444 self.unknown_starttag('meta', attrs)
1553 def extractCharsetFromMeta(self, attrs):
1562 for i in range(0, len(attrs)):
1563 key, value = attrs[i]
1584 attrs[contentTypeIndex] = (attrs[contentTypeIndex][0],
1596 tag = self.unknown_starttag("meta", attrs)