def file_contents(self, filename, binary=False):
        """Return the file for a given filename.

        If you want binary content use ``mode='rb'``.

        """
        if binary:
            mode = 'rb'
        else:
            mode = 'r'
        try:
            with open(filename, mode) as f:
                return f.read()
        except (OSError, IOError) as e:
            raise FileReadError(str(e))
def file_contents ( self , filename , binary = False ) : if binary : mode = 'rb' else : mode = 'r' try : with open ( filename , mode ) as f : return f . read ( ) except ( OSError , IOError ) as e : raise FileReadError ( str ( e ) )
Return the file for a given filename.

        If you want binary content use ``mode='rb'``.