now = time() post_message('oscar', 'Work is the curse of the drinking classes') post_message('jrr', 'Not all those who wander are lost.') post_message('rene', 'There is nothing so strange and so unbelievable that it has been said by one philosopher or another.') post_message('anais', "We don't see things as they are, we see them as we are.") post_message('kongzi', 'To study and not think is a waste. To think and not study is dangerous.') post_message('kongzi', 'What you do not want done to yourself, do not do to others.') post_message('kongzi', 'Is it not a joy to have friends come from afar?') post_message('kongzi', 'The things which men greatly desire are comprehended in meat and drink and sexual pleasure.') post_message('albert', 'Insanity is repeating the same mistakes and expecting different results.') post_message('albert', 'Experts are just trained dogs.') post_message('gsantayana', 'Those who cannot remember the past are condemened to repeat it.') follow('oscar', followed_user='******') follow('oscar', followed_user='******') follow('oscar', followed_user='******') follow('kongzi', followed_user='******') follow('kongzi', followed_user='******') follow('jrr', followed_user='******') if __name__ == '__main__': pprint(posts) pprint(user_posts['anais']) follow('Oscar Wilde', followed_user='******') follow('Oscar Wilde', followed_user='******') follow('Oscar Wilde', followed_user='******')
password='******', email='*****@*****.**', bio='Husband of Marge Simpson.', photo='homer.jpg', ) now = time() post_message('felix', '#python tip: use named tuples', now - 3600 * 48) post_message('felix', '#python tip: develop interactively', now - 500) post_message('popeye', 'gradient descent save me money on travel', now - 2500) post_message('popeye', 'join a band today', now - 3600) post_message('homer', 'Donuts?', now - 80) post_message('homer', 'Anybody here?', now - 50) post_message('homer', 'have you ever wanted to unpack mappings?', now - 46) follow('felix', followed_user='******') follow('felix', followed_user='******') follow('homer', followed_user='******') follow('homer', followed_user='******') follow('popeye', followed_user='******') if __name__ == '__main__': from pubsub import posts, followers, following, user_info from pubsub import posts_by_user, posts_for_user, search from pubsub import get_followers, get_followed, get_user, check_user, age assert check_user('felix', password='******') assert not check_user('homer', password='******') print() pprint(list(posts))
now = time() post_message('raymondh', '#python tip: use named tuples', now-3600*48) post_message('barry', 'join a band today', now-3600) post_message('selik', 'gradient descent save me money on travel', now-2500) post_message('raymondh', '#python tip: develop interactively', now-500) post_message('barry', 'learn emacs', now-80) post_message('davin', 'teaching #python today', now-50) post_message('selik', 'have you ever wanted to unpack mappings?', now-46) post_message('raymondh', '#python tip: have fun programming', now-40) post_message('davin', '#camping tip: always take water', now-30) post_message('barry', 'enums rock', now-20) post_message('raymondh', '#python tip: never mutate while iterating', now-10) post_message('davin', 'coriander and cilantro come from the same plant', now) follow('davin', followed_user='******') follow('davin', followed_user='******') follow('selik', followed_user='******') follow('raymondh', followed_user='******') follow('raymondh', followed_user='******') if __name__ == '__main__': from pubsub import posts, followers, following, user_info from pubsub import posts_by_user, posts_for_user, search from pubsub import get_followers, get_followed, get_user, check_user, age assert check_user('raymondh', password='******') assert not check_user('davin', password='******') print() pprint(list(posts))
now = time() post_message('raymondh', '#python tip: use named tuples', now - 3600 * 48) post_message('barry', 'join a band today', now - 3600) post_message('selik', 'gradient descent save me money on travel', now - 2500) post_message('raymondh', '#python tip: develop interactively', now - 500) post_message('barry', 'learn emacs', now - 80) post_message('davin', '@raymondh teaching #python today', now - 50) post_message('selik', 'have you ever wanted to unpack mappings?', now - 46) post_message('raymondh', '#python tip: have fun programming', now - 40) post_message('davin', '#camping tip: always take water', now - 30) post_message('barry', 'enums rock', now - 20) post_message('raymondh', '#python tip: never mutate while iterating', now - 10) post_message('davin', 'coriander and cilantro come from the same plant', now) follow('davin', followed_user='******') follow('davin', followed_user='******') follow('selik', followed_user='******') follow('raymondh', followed_user='******') follow('raymondh', followed_user='******') if __name__ == '__main__': import pubsub pubsub.save() del pubsub.posts, pubsub.user_posts, pubsub.hashtag_index, del pubsub.followers, pubsub.following, pubsub.user_info pubsub.restore() from pubsub import posts, followers, following, user_info, hashtag_index from pubsub import posts_by_user, posts_for_user, search
now = time() post_message("raymondh", "#python tip: use named tuples", now - 3600 * 48) post_message("barry", "join a band today", now - 3600) post_message("selik", "gradient descent save me money on travel", now - 2500) post_message("raymondh", "#python tip: develop interactively", now - 500) post_message("barry", "learn emacs", now - 80) post_message("davin", "@raymondh teaching #python today", now - 50) post_message("selik", "have you ever wanted to unpack mappings?", now - 46) post_message("raymondh", "#python tip: have fun programming", now - 40) post_message("davin", "#camping tip: always take water", now - 30) post_message("barry", "enums rock", now - 20) post_message("raymondh", "#python tip: never mutate while iterating", now - 10) post_message("davin", "coriander and cilantro come from the same plant", now) follow("davin", followed_user="******") follow("davin", followed_user="******") follow("selik", followed_user="******") follow("raymondh", followed_user="******") follow("raymondh", followed_user="******") if __name__ == "__main__": import pubsub pubsub.save() del ( pubsub.posts, pubsub.user_posts, pubsub.hashtag_index, ) del pubsub.followers, pubsub.following, pubsub.user_info