def __init__(self, data, inject=True):
        """
        Accepts a string or file object containing valid html

        By default we inject a style reset into the doc to make it
        look resonable, passing inject=False will disable it.
        """
        if isinstance(data, str):
            self.html = data
        elif hasattr(data, 'read'):
            if hasattr(data, 'seek'):
                data.seek(0)
            self.html = data.read()
        else:
            raise ValueError("data must be a string or an io object")
        if inject:
            self.inject_head()
def __init__ ( self , data , inject = True ) : if isinstance ( data , str ) : self . html = data elif hasattr ( data , 'read' ) : if hasattr ( data , 'seek' ) : data . seek ( 0 ) self . html = data . read ( ) else : raise ValueError ( "data must be a string or an io object" ) if inject : self . inject_head ( )
Accepts a string or file object containing valid html

        By default we inject a style reset into the doc to make it
        look resonable, passing inject=False will disable it.