-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing html elements from events description. #19
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,27 +7,39 @@ | |||||||||||||||||||||||||||||||||
from dateutil import parser | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# import regular expression module | ||||||||||||||||||||||||||||||||||
import re | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
class Event: | ||||||||||||||||||||||||||||||||||
"""Event records all the data from an event, and has methods to generate the | ||||||||||||||||||||||||||||||||||
message from an event | ||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# pylint: disable=too-many-instance-attributes | ||||||||||||||||||||||||||||||||||
# Events have lots of data that we need to save together | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
Comment on lines
+22
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
⛏️ These lines can be removed |
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
def __init__( | ||||||||||||||||||||||||||||||||||
self, title, group_name, description, location, time, url, status, uuid | ||||||||||||||||||||||||||||||||||
): | ||||||||||||||||||||||||||||||||||
# pylint: disable=too-many-arguments | ||||||||||||||||||||||||||||||||||
self.title = title | ||||||||||||||||||||||||||||||||||
self.group_name = group_name | ||||||||||||||||||||||||||||||||||
self.description = description | ||||||||||||||||||||||||||||||||||
self.description = self.remove_html(description) | ||||||||||||||||||||||||||||||||||
self.location = location | ||||||||||||||||||||||||||||||||||
self.time = time | ||||||||||||||||||||||||||||||||||
self.url = url | ||||||||||||||||||||||||||||||||||
self.status = status | ||||||||||||||||||||||||||||||||||
self.uuid = uuid | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
def remove_html(self, string): | ||||||||||||||||||||||||||||||||||
Comment on lines
+31
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
🔧 Since this function is only intended to be used in |
||||||||||||||||||||||||||||||||||
regex = re.compile(r'<[^>]+>') | ||||||||||||||||||||||||||||||||||
return regex.sub('', string) | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
# creates a struct of event information used to compose different formats of the event message | ||||||||||||||||||||||||||||||||||
@classmethod | ||||||||||||||||||||||||||||||||||
def from_event_json(cls, event_json): | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ There isn't a big need for this import to be separate from the other imports, and I think the comment isn't totally necessary