pygeek_stellar/utils/file.py
def load_file(filename, read_as_binary=False):
    """
    Loads the specified file to memory.
    :param str filename: File to be loaded.
    :param bool read_as_binary: Flag that specifies if the file must be loaded in binary form or not.
    This parameter is optional and by default files are not loaded is binary form.
    :return: Returns the content of the file or None if the file could not be read.
    :rtype: str or bytearray or None
    """
    if os.path.isfile(filename):
        opening_mode = FILE_MODE_READ if not read_as_binary else FILE_MODE_READ_BINARY
        try:
            with open(filename, opening_mode) as file_content:
                return file_content.read()
        except (OSError, IOError):
            print("There was a problem opening/reading the file: {}".format(filename))
            return None
    return None

    Loads the specified file to memory.
    :param str filename: File to be loaded.
    :param bool read_as_binary: Flag that specifies if the file must be loaded in binary form or not.
    This parameter is optional and by default files are not loaded is binary form.
    :return: Returns the content of the file or None if the file could not be read.
    :rtype: str or bytearray or None
    
Loads the specified file to memory.
Loads the specified file to memory .
def load_file(filename, read_as_binary=False):
    if os.path.isfile(filename):
        opening_mode = FILE_MODE_READ if not read_as_binary else FILE_MODE_READ_BINARY
        try:
            with open(filename, opening_mode) as file_content:
                return file_content.read()
        except (OSError, IOError):
            print("There was a problem opening/reading the file: {}".format(filename))
            return None
    return None
def load_file ( filename , read_as_binary = False ) : if os . path . isfile ( filename ) : opening_mode = FILE_MODE_READ if not read_as_binary else FILE_MODE_READ_BINARY try : with open ( filename , opening_mode ) as file_content : return file_content . read ( ) except ( OSError , IOError ) : print ( "There was a problem opening/reading the file: {}" . format ( filename ) ) return None return None
Loads the specified file to memory.
Loads the specified file to memory .
"""
    Loads the specified file to memory.
    :param str filename: File to be loaded.
    :param bool read_as_binary: Flag that specifies if the file must be loaded in binary form or not.
    This parameter is optional and by default files are not loaded is binary form.
    :return: Returns the content of the file or None if the file could not be read.
    :rtype: str or bytearray or None
    """
Returns the content of the file or None if the file could not be read.
Returns the content of the file or None if the file could not be read .
str or bytearray or None
filename
File to be loaded.
File to be loaded .
read_as_binary
Flag that specifies if the file must be loaded in binary form or not.
This parameter is optional and by default files are not loaded is binary form.
Flag that specifies if the file must be loaded in binary form or not . This parameter is optional and by default files are not loaded is binary form .