from StringIO import StringIO from constants import * from bs4 import BeautifulSoup from js2py.base import * try: import lxml def parse(source): return BeautifulSoup(source, 'lxml') except: def parse(source): return BeautifulSoup(source) x = '''
Shady Grove Aeolian
Over the River, Charlie Dorian
''' class DOM(PyJs): prototype = ObjectPrototype def __init__(self): self.own = {} def readonly(self, name, val): self.define_own_property(name, {'writable':False, 'enumerable':False, 'configurable':False, 'value': Js(val)}) # DOMStringList class DOMStringListPrototype(DOM): Class = 'DOMStringListPrototype' def contains(element): return element.to_string().value in this._string_list def item(index): return this._string_list[index.to_int()] if 0<=index.to_int()