style(workers/notificationworker.py): formatted file

[TESTING -> locally]

Issue: https://www.pivotaltracker.com/story/show/b144646649n

- [ ] It works!
- [ ] Comments provide sufficient explanations for the next contributor
- [ ] Tests cover changes and corner cases
- [ ] Follows Quay syntax patterns and format
This commit is contained in:
Charlton Austin 2017-05-19 11:36:55 -04:00
parent b40ad361db
commit 2282af2619

View file

@ -1,9 +1,8 @@
import logging
import json import json
import logging
import re import re
import requests import requests
from flask_mail import Message from flask_mail import Message
from app import mail, app, OVERRIDE_CONFIG_DIRECTORY from app import mail, app, OVERRIDE_CONFIG_DIRECTORY
@ -11,7 +10,6 @@ from data import model
from util.config.validator import SSL_FILENAMES from util.config.validator import SSL_FILENAMES
from workers.queueworker import JobException from workers.queueworker import JobException
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
METHOD_TIMEOUT = app.config.get('NOTIFICATION_SEND_TIMEOUT', 10) # Seconds METHOD_TIMEOUT = app.config.get('NOTIFICATION_SEND_TIMEOUT', 10) # Seconds
@ -152,7 +150,6 @@ class EmailMethod(NotificationMethod):
'is not authorized to receive ' 'is not authorized to receive '
'notifications for this repository') 'notifications for this repository')
def perform(self, notification_obj, event_handler, notification_data): def perform(self, notification_obj, event_handler, notification_data):
config_data = json.loads(notification_obj.config_json) config_data = json.loads(notification_obj.config_json)
email = config_data.get('email', '') email = config_data.get('email', '')
@ -208,6 +205,7 @@ class FlowdockMethod(NotificationMethod):
""" Method for sending notifications to Flowdock via the Team Inbox API: """ Method for sending notifications to Flowdock via the Team Inbox API:
https://www.flowdock.com/api/team-inbox https://www.flowdock.com/api/team-inbox
""" """
@classmethod @classmethod
def method_name(cls): def method_name(cls):
return 'flowdock' return 'flowdock'
@ -259,6 +257,7 @@ class HipchatMethod(NotificationMethod):
""" Method for sending notifications to Hipchat via the API: """ Method for sending notifications to Hipchat via the API:
https://www.hipchat.com/docs/apiv2/method/send_room_notification https://www.hipchat.com/docs/apiv2/method/send_room_notification
""" """
@classmethod @classmethod
def method_name(cls): def method_name(cls):
return 'hipchat' return 'hipchat'
@ -318,6 +317,7 @@ class HipchatMethod(NotificationMethod):
from HTMLParser import HTMLParser from HTMLParser import HTMLParser
class SlackAdjuster(HTMLParser): class SlackAdjuster(HTMLParser):
def __init__(self): def __init__(self):
self.reset() self.reset()
@ -359,6 +359,7 @@ class SlackAdjuster(HTMLParser):
def get_data(self): def get_data(self):
return ''.join(self.result) return ''.join(self.result)
def adjust_tags(html): def adjust_tags(html):
s = SlackAdjuster() s = SlackAdjuster()
s.feed(html) s.feed(html)