Advertisement
Rawoas13

init

Aug 20th, 2020
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. from meme import MemeRepository, PostRepository
  2.  
  3. class Meme(object):
  4.     meme_repository = MemeRepository()
  5.    
  6.     @staticmethod
  7.     def get(name=None):
  8.         '''Gets a Meme by it's name/user, e.g.: "gchapiewski".'''
  9.         return Meme.meme_repository.get(name)
  10.  
  11.     @staticmethod
  12.     def search(query, count=10):
  13.         '''Searches for Memes that have the title similar to the search string.'''
  14.         return Meme.meme_repository.search(query, count)
  15.    
  16.     class Posts(object):
  17.         post_repository = PostRepository()
  18.        
  19.         @staticmethod
  20.         def get(owner_guid, pubid):
  21.             '''Gets one post.'''
  22.             return Meme.Posts.post_repository.get(owner_guid, pubid)
  23.  
  24.         @staticmethod
  25.         def popular(locale='en', count=10):
  26.             '''Gets the popular posts.'''
  27.             return Meme.Posts.post_repository.popular(locale, count)
  28.        
  29.         @staticmethod
  30.         def search(query, count=10):
  31.             '''Searches for Posts that contains the specified word(s).'''
  32.             return Meme.Posts.post_repository.search(query, count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement