def __init__(self, obj_or_path):
        """A convenient object that reads and makes sense of Par2 blocks."""
        self.path = None
        if isinstance(obj_or_path, basestring):
            with open(obj_or_path) as f:
                self.contents = f.read()
                self.path = obj_or_path
        else:
            self.contents = obj_or_path.read()
            if getattr(obj_or_path, 'name', None):
                self.path = obj_or_path.name
        self.packets = self.read_packets()
def __init__ ( self , obj_or_path ) : self . path = None if isinstance ( obj_or_path , basestring ) : with open ( obj_or_path ) as f : self . contents = f . read ( ) self . path = obj_or_path else : self . contents = obj_or_path . read ( ) if getattr ( obj_or_path , 'name' , None ) : self . path = obj_or_path . name self . packets = self . read_packets ( )
A convenient object that reads and makes sense of Par2 blocks.