Skip to content

Commit b59ed1f

Browse files
committed
Remove trailing whitespaces, Format strings according to PEP8
1 parent 59c5378 commit b59ed1f

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@
6262
if __name__ == "__main__":
6363
if ARGV.start:
6464
print('''
65-
\U0001F604 Hello and Welcome to Dynamic CLI
66-
\U0001F917 Use the following commands to get started
67-
\U0001F50E Search on StackOverflow with '-s'
68-
\U0001F4C4 Open browser to create new Stack Overflow question with '-n [title(optional)]'
65+
\U0001F604 Hello and Welcome to Dynamic CLI
66+
\U0001F917 Use the following commands to get started
67+
\U0001F50E Search on StackOverflow with '-s'
68+
\U0001F4C4 Open browser to create new Stack Overflow question with '-n [title(optional)]'
6969
\U0001F4C2 Save answer to a file with '-file'
70-
\U00002728 Know the version of Dynamic CLI with '-V'
70+
\U00002728 Know the version of Dynamic CLI with '-V'
7171
\U0001F609 See this message again with '-st'
7272
\U00002755 Get help with '-h'
7373
''')

src/arguments/api_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def get_request(cls):
3030
# Ask the user for endpoint if not present in request_url
3131
if not(has_endpoint):
3232
if(request_url[-1] == '/'):
33-
endpoint = input("Input endpoint \
34-
(Without the starting slash): ")
33+
endpoint = input("Input endpoint " +
34+
"(Without the starting slash): ")
3535
else:
3636
endpoint = input("Input endpoint (With the starting slash): ")
3737
request_url += endpoint
@@ -44,7 +44,7 @@ def get_request(cls):
4444
print(f"Reponse Status Code: {response.status_code}")
4545
response_data = json.loads(response.content)
4646
parsed_json = json.dumps(response_data, indent=4)
47-
output_json = highlight(parsed_json, lexers.JsonLexer(),
47+
output_json = highlight(parsed_json, lexers.JsonLexer(),
4848
formatters.TerminalFormatter())
4949
print(output_json)
5050

@@ -55,8 +55,8 @@ def get_request(cls):
5555
print("Response data stored in response_data.json")
5656

5757
except requests.exceptions.InvalidSchema:
58-
print("Check whether the URL is valid or check if \
59-
the localhost server is active or not")
58+
print("Check whether the URL is valid or check if " +
59+
"the localhost server is active or not")
6060
except Exception as e:
6161
print(e)
6262

src/arguments/search.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def prompt(self):
2020
print(colored(f"{self.message} : ", 'cyan'), end='')
2121
data = input()
2222
if data == "":
23-
SearchError("\U0001F613 Input data empty",
23+
SearchError("\U0001F613 Input data empty",
2424
"\U0001F504 Please try again ")
2525
sys.exit()
2626
else:
@@ -75,19 +75,19 @@ def search_for_results(self, save=False):
7575
questions = self.utility_object.get_que(json_output)
7676
if questions == []:
7777
# evoke an error
78-
search_error = SearchError("\U0001F613 No answer found",
78+
search_error = SearchError("\U0001F613 No answer found",
7979
"\U0001F604 Please try reddit")
8080
else:
8181
data = self.utility_object.get_ans(questions)
8282
print('''
83-
\U0001F604 Hopefully you found what you were looking for!
84-
\U0001F4C2 You can save an answer to a file with '-file'
83+
\U0001F604 Hopefully you found what you were looking for!
84+
\U0001F4C2 You can save an answer to a file with '-file'
8585
8686
Not found what you were looking for \U00002754
87-
\U0001F4C4 Open browser and post your question
88-
on StackOverflow with '-n [title (optional)]'
89-
90-
\U0001F50E To search more use '-s'
87+
\U0001F4C4 Open browser and post your question
88+
on StackOverflow with '-n [title (optional)]'
89+
90+
\U0001F50E To search more use '-s'
9191
''')
9292

9393
if save:

src/arguments/utility.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self):
4646
@property
4747
def playbook_path(self):
4848
"""
49-
Create an environment variable 'DYNAMIC'
49+
Create an environment variable 'DYNAMIC'
5050
containing the path of dynamic_playbook.json and returns it
5151
"""
5252
if not os.getenv(self.key):
@@ -143,7 +143,7 @@ def delete_from_playbook(self, stackoverflow_object, question_id):
143143
def display_panel(self):
144144
playbook_data = self.playbook_content
145145
if(len(playbook_data['items_stackoverflow']) == 0):
146-
SearchError("You have no entries in the playbook",
146+
SearchError("You have no entries in the playbook",
147147
"Browse and save entries in playbook with 'p' key")
148148
sys.exit()
149149
# Creates QuestionPanelStackoverflow object
@@ -161,7 +161,7 @@ def __init__(self):
161161
# list( list( question_title, question_id, question_link )... )
162162
self.questions_data = []
163163

164-
# dict( question_id:list( body, link ))
164+
# dict( question_id:list( body, link ))
165165
# corresponding to self.questions_data
166166
self.answer_data = defaultdict(lambda: False)
167167

@@ -214,7 +214,7 @@ def populate_answer_data(self, questions_list):
214214
self.answer_data[item['question_id']] = item['body_markdown']
215215
# Sometimes the StackExchange API fails to deliver some answers.
216216
# The below code is to fetch them
217-
failed_ques_id = [question[1] for question in self.questions_data
217+
failed_ques_id = [question[1] for question in self.questions_data
218218
if not(self.answer_data[question[1]])]
219219
if not(len(failed_ques_id) == 0):
220220
self.populate_answer_data(failed_ques_id)
@@ -223,7 +223,7 @@ def return_formatted_ans(self, ques_id):
223223
# This function uses uses Rich Markdown to format answers body.
224224
body_markdown = self.answer_data[int(ques_id)]
225225
body_markdown = str(body_markdown)
226-
xml_markup_replacement = [("&amp;", "&"), ("&lt;", "<"), ("&gt;", ">"),
226+
xml_markup_replacement = [("&amp;", "&"), ("&lt;", "<"), ("&gt;", ">"),
227227
("&quot;", "\""), ("&apos;", "\'"),
228228
("&#39;", "\'")]
229229
for convert_from, convert_to in xml_markup_replacement:
@@ -236,7 +236,7 @@ def return_formatted_ans(self, ques_id):
236236
highlighted = capture.get()
237237
if not('UTF' in locale.getlocale()[1]):
238238
box_replacement = [("─", "-"), ("═","="), ("║","|"), ("│", "|"),
239-
('┌', '+'), ("└", "+"), ("┐", "+"), ("┘", "+"),
239+
('┌', '+'), ("└", "+"), ("┐", "+"), ("┘", "+"),
240240
("╔", "+"), ("╚", "+"), ("╗","+"), ("╝", "+"),
241241
("•","*")]
242242
for convert_from, convert_to in box_replacement:
@@ -316,14 +316,14 @@ def get_batch_ans_url(self, ques_id_list):
316316

317317
def make_request(self, que, tag: str):
318318
"""
319-
This function uses the requests library to make
319+
This function uses the requests library to make
320320
the rest api call to the stackexchange server.
321-
:param que: The user questions that servers as
321+
:param que: The user questions that servers as
322322
a question in the api.
323323
:type que: String
324324
:param tag: The tags that user wants for searching the relevant
325-
answers. For e.g. TypeError might be for multiple
326-
languages so is tag is used as "Python" then the
325+
answers. For e.g. TypeError might be for multiple
326+
languages so is tag is used as "Python" then the
327327
api will return answers based on the tags and question.
328328
:type tag: String
329329
:return: Json response from the api call.
@@ -333,7 +333,7 @@ def make_request(self, que, tag: str):
333333
try:
334334
resp = requests.get(self.__get_search_url(que, tag))
335335
except:
336-
SearchError("\U0001F613 Search Failed",
336+
SearchError("\U0001F613 Search Failed",
337337
"\U0001F4BB Try connecting to the internet")
338338
sys.exit()
339339
return resp.json()
@@ -368,7 +368,7 @@ def setCustomKey(self):
368368
read_inbox - access a user's global inbox
369369
no_expiry - access_token's with this scope do not expire
370370
write_access - perform write operations as a user
371-
private_info - access full history of a user's private
371+
private_info - access full history of a user's private
372372
actions on the site
373373
"""
374374
scopes = 'read_inbox'

0 commit comments

Comments
 (0)