From 233be593e3145cbc19a4d6aabf59af845b31f09b Mon Sep 17 00:00:00 2001 From: sameer Date: Fri, 19 Aug 2022 23:51:03 +0530 Subject: [PATCH 1/3] added dataset.json --- dataset.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 dataset.json diff --git a/dataset.json b/dataset.json new file mode 100644 index 0000000..c83a556 --- /dev/null +++ b/dataset.json @@ -0,0 +1,21 @@ + + +{ + "titles" : [ + "ranting about jira", + "siting in a meeting", + "squashing bugs", + "centering divs", + "waiting for staging deployment", + "writing tests", + "pushing directly to prod", + "doing code review", + "deleting jira tickets", + "Creating a pull request", + "forgot to run DB migrations", + "Broke production", + "running on staging ENV", + "merging git branches", + "releasing the MVP", "finding JIRA tickets" + ] +} \ No newline at end of file From c5d9651101fbdbcf1f97b3884309ce6b6c9013f9 Mon Sep 17 00:00:00 2001 From: sameer Date: Fri, 19 Aug 2022 23:58:17 +0530 Subject: [PATCH 2/3] made some changes to main.py --- main.py | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index ae9b4c4..c8c66ec 100644 --- a/main.py +++ b/main.py @@ -2,30 +2,18 @@ import praw import os import random import time +import json -titles = [ - "ranting about jira", - "siting in a meeting", - "squashing bugs", - "centering divs", - "waiting for staging deployment", - "writing tests", - "pushing directly to prod", - "doing code review", - "deleting jira tickets", - "Creating a pull request", - "forgot to run DB migrations", - "Broke production", - "running on staging ENV", - "merging git branches", - "releasing the MVP", - "finding JIRA tickets" -] +with open('dataset.json', 'r') as f: + data = json.load(f) + +titles = data['titles'] client_id = os.environ["REDDIT_CLIENT_ID"] client_secret = os.environ["REDDIT_CLIENT_SECRET"] reddit_pass = os.environ["REDDIT_PASSWORD"] + def get_titles(): currentlyViewingText, subscribersText = random.sample(titles, 2) return [currentlyViewingText, subscribersText] @@ -53,4 +41,5 @@ def update_titles(): widgets.refresh() widgets.id_card.mod.update(subscribersText=titles[1]) -update_titles() \ No newline at end of file + +update_titles() From 13ca61590fe5142b18beb6174d36ee6ba5761f9c Mon Sep 17 00:00:00 2001 From: sameer Date: Sat, 20 Aug 2022 18:59:34 +0530 Subject: [PATCH 3/3] made the required change --- dataset.json | 37 ++++++++++++++++++------------------- main.py | 11 ++++------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/dataset.json b/dataset.json index c83a556..0164533 100644 --- a/dataset.json +++ b/dataset.json @@ -1,21 +1,20 @@ - - { - "titles" : [ - "ranting about jira", - "siting in a meeting", - "squashing bugs", - "centering divs", - "waiting for staging deployment", - "writing tests", - "pushing directly to prod", - "doing code review", - "deleting jira tickets", - "Creating a pull request", - "forgot to run DB migrations", - "Broke production", - "running on staging ENV", - "merging git branches", - "releasing the MVP", "finding JIRA tickets" - ] + "titles": [ + "ranting about jira", + "siting in a meeting", + "squashing bugs", + "centering divs", + "waiting for staging deployment", + "writing tests", + "pushing directly to prod", + "doing code review", + "deleting jira tickets", + "Creating a pull request", + "forgot to run DB migrations", + "Broke production", + "running on staging ENV", + "merging git branches", + "releasing the MVP", + "finding JIRA tickets" + ] } \ No newline at end of file diff --git a/main.py b/main.py index c8c66ec..9b04b1b 100644 --- a/main.py +++ b/main.py @@ -4,21 +4,18 @@ import random import time import json -with open('dataset.json', 'r') as f: - data = json.load(f) - -titles = data['titles'] - client_id = os.environ["REDDIT_CLIENT_ID"] client_secret = os.environ["REDDIT_CLIENT_SECRET"] reddit_pass = os.environ["REDDIT_PASSWORD"] - def get_titles(): + with open('dataset.json', 'r') as f: + data = json.load(f) + + titles = data['titles'] currentlyViewingText, subscribersText = random.sample(titles, 2) return [currentlyViewingText, subscribersText] - def update_titles(): reddit = praw.Reddit( client_id=client_id,