Skip to content

Commit 15f6fe0

Browse files
author
Konstantinacc
committed
Added comments to update_comment function in disqus.py file.
Removed redundant code from update_comment function.
1 parent 4e854a5 commit 15f6fe0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

codebender_testing/disqus.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,30 @@ def get_disqus_sso(self, user):
5858
return "{0} {1} {2}".format(message, sig, timestamp)
5959

6060
def update_comment(self, sketch, results, current_date, log_entry, openFailFlag, total_sketches):
61-
# Comment libraries
61+
"""A comment is added to the library as soon as its first example is compiled.
62+
`library`: The library in which belongs the currently compiled example.
63+
`self.last_library`: The library in which belongs the previously compiled example.
64+
`library_to_comment`: The library in which a comment should be added.
65+
"""
66+
6267
library_match = re.match(r'.+\/example\/(.+)\/.+', sketch)
6368
library = None
6469
library_to_comment = None
70+
6571
if library_match:
6672
library = library_match.group(1)
67-
if not self.last_library:
68-
self.last_library = library
69-
library_to_comment = library
7073

74+
"Check if the currently compiled example belongs to the same library as the previous one."
7175
if library != self.last_library:
7276
library_to_comment = library
7377

78+
"Check if we should add a comment to the library."
7479
if library_to_comment:
7580
log_entry = self.handle_library_comment(library_to_comment, current_date, log_entry)
7681

7782
self.last_library = library
7883

79-
# Comment examples
84+
"Add a comment to the currently compiled library example."
8085
if not openFailFlag:
8186
log_entry = self.handle_example_comment(sketch, results, current_date, log_entry)
8287

0 commit comments

Comments
 (0)