Skip to content

Commit 6a97883

Browse files
committedNov 6, 2022
Fix some unnecessary newlines in code
1 parent 98ddcc7 commit 6a97883

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed
 

‎PapersCited.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def get_file():
7878
# Make the main window of tkinter invisible since we only need the dialog.
7979
root.withdraw()
8080
root.attributes("-topmost", True)
81-
filename = filedialog.askopenfilename(
82-
title="Select a document to search for citations:")
81+
filename = filedialog.askopenfilename(title="Select a document to search for citations:")
8382
root.destroy()
8483
return(filename)
8584

@@ -197,8 +196,7 @@ def get_matches(target_document):
197196
for index_no, citation in enumerate(second_authors):
198197
# Citation by citation, check and change all listed symbols
199198
for phrase in starts_with_and:
200-
second_authors[index_no] = second_authors[index_no].replace(
201-
phrase, "", 1)
199+
second_authors[index_no] = second_authors[index_no].replace(phrase, "", 1)
202200

203201
# Now we have two lists, all authors with year detected and only those who occur after an 'i'/'&'
204202
# For each occuring in the second list, delete ONE from the first - so if theres A & B 2000 and also B 2000,
@@ -224,22 +222,19 @@ def get_matches(target_document):
224222
)
225223

226224
# Combine all found cases into a single list
227-
all_found_citations = matches_single_author + \
228-
matches_multiple_authors + matches_author_et_al
225+
all_found_citations = matches_single_author + matches_multiple_authors + matches_author_et_al
229226
return(all_found_citations)
230227

231228

232229
def remove_characters_adjust_phrases(list_of_matches, characters_to_remove, phrases_to_adjust):
233230
for index_no, citation in enumerate(list_of_matches):
234231
# Remove uneccessary characters
235232
for char in characters_to_remove:
236-
list_of_matches[index_no] = list_of_matches[index_no].replace(
237-
char, "")
233+
list_of_matches[index_no] = list_of_matches[index_no].replace(char, "")
238234

239235
# Change several phrases
240236
for key in phrases_to_adjust:
241-
list_of_matches[index_no] = list_of_matches[index_no].replace(
242-
key, phrases_to_adjust[key])
237+
list_of_matches[index_no] = list_of_matches[index_no].replace(key, phrases_to_adjust[key])
243238

244239
# Remove leading and trailing spaces with strip() to not confuse the duplicate detection
245240
list_of_matches[index_no] = list_of_matches[index_no].strip()
@@ -326,8 +321,7 @@ def write_excel(list_of_matches, filename):
326321
workbook.close()
327322

328323
print(f"Success! A file has been created at {output_filename}.")
329-
print(
330-
f"A total of {len(list_of_matches)} different citations have been recorded.")
324+
print(f"A total of {len(list_of_matches)} different citations have been recorded.")
331325
input("\nPress Enter to exit the program.")
332326

333327
# MAIN ----

0 commit comments

Comments
 (0)
Please sign in to comment.