src/reddit_bot.py
def write_cache(file, mem_cache):
        """Writes list into file, converting list to \n separated contents.
        Overwrites original cache file.
        Creates cache file if does not exist.

        Parameters
        ----------
        file : str
            Location of cache file.
        mem_cache : list or deque
            Items in memory cache

        """
        try:
            print("Saving memory into cache file...")
            with open(file, 'w') as cache_file:
                try:
                    cache_file.write(mem_cache.popleft())
                    for entry in mem_cache:
                        cache_file.write('\n'+entry)
                    # avoid adding \n to end of file so that we don't get empty
                    # entries in deque when next loaded
                    print("Cache saved")
                except IndexError:
                    print("No items in cache")
        except IOError as error:
            print(error)
            print("Unable to create cache file")
Writes list into file, converting list to \n separated contents.
        Overwrites original cache file.
        Creates cache file if does not exist.

        Parameters
        ----------
        file : str
            Location of cache file.
        mem_cache : list or deque
            Items in memory cache

        
Writes list into file, converting list to \n separated contents.
Overwrites original cache file.
Creates cache file if does not exist.

Parameters

file : str
Location of cache file.
mem_cache : list or deque
Items in memory cache
Writes list into file converting list to \ n separated contents . Overwrites original cache file . Creates cache file if does not exist . Parameters file : str Location of cache file . mem_cache : list or deque Items in memory cache
def write_cache(file, mem_cache):
        try:
            print("Saving memory into cache file...")
            with open(file, 'w') as cache_file:
                try:
                    cache_file.write(mem_cache.popleft())
                    for entry in mem_cache:
                        cache_file.write('\n'+entry)
                    print("Cache saved")
                except IndexError:
                    print("No items in cache")
        except IOError as error:
            print(error)
            print("Unable to create cache file")
def write_cache ( file , mem_cache ) : try : print ( "Saving memory into cache file..." ) with open ( file , 'w' ) as cache_file : try : cache_file . write ( mem_cache . popleft ( ) ) for entry in mem_cache : cache_file . write ( '\n' + entry ) print ( "Cache saved" ) except IndexError : print ( "No items in cache" ) except IOError as error : print ( error ) print ( "Unable to create cache file" )
Writes list into file, converting list to \n separated contents.
Writes list into file converting list to \ n separated contents .
"""Writes list into file, converting list to \n separated contents.
        Overwrites original cache file.
        Creates cache file if does not exist.

        Parameters
        ----------
        file : str
            Location of cache file.
        mem_cache : list or deque
            Items in memory cache

        """ # avoid adding \n to end of file so that we don't get empty # entries in deque when next loaded
file
mem_cache