@@ -20,10 +20,10 @@ def __str__(self):
2020 def summary (self ):
2121 """A summary of the message."""
2222 (user , _ ) = email_to_fas (self ._primary_email )
23- idx = self .bug ['id' ]
24- title = self .bug [' summary' ]
25- action = self .body [' event' ][ ' action' ]
26- target = self .body [' event' ][ ' target' ]
23+ idx = self .bug ["id" ]
24+ title = self .bug [" summary" ]
25+ action = self .body [" event" ][ " action" ]
26+ target = self .body [" event" ][ " target" ]
2727
2828 if len (title ) > 40 :
2929 title = title [:40 ] + "..."
@@ -32,19 +32,21 @@ def summary(self):
3232 tmpl = "{user} filed a new bug RHBZ#{idx} '{title}'"
3333 return tmpl .format (user = user , idx = idx , title = title )
3434
35- elif self .body [' event' ][ ' action' ] == "create" :
35+ elif self .body [" event" ][ " action" ] == "create" :
3636 tmpl = "{user} added {target} on RHBZ#{idx} '{title}'"
3737 return tmpl .format (user = user , target = target , idx = idx , title = title )
3838
3939 # at this point 'action' must be "modify": we're modifying the
4040 # target
41- fields = [d [' field' ] for d in self .body [' event' ].get (' changes' , [])]
41+ fields = [d [" field" ] for d in self .body [" event" ].get (" changes" , [])]
4242 fields = comma_join (fields )
4343 if target == "bug" :
4444 tmpl = "{user} updated {fields} on RHBZ#{idx} '{title}'"
4545 return tmpl .format (user = user , fields = fields , idx = idx , title = title )
4646 tmpl = "{user} updated {fields} for {target} on RHBZ#{idx} '{title}'"
47- return tmpl .format (user = user , fields = fields , target = target , idx = idx , title = title )
47+ return tmpl .format (
48+ user = user , fields = fields , target = target , idx = idx , title = title
49+ )
4850
4951 @property
5052 def url (self ):
@@ -53,7 +55,7 @@ def url(self):
5355 Returns:
5456 str: A relevant URL.
5557 """
56- return "https://bugzilla.redhat.com/show_bug.cgi?id={}" .format (self .bug ['id' ])
58+ return "https://bugzilla.redhat.com/show_bug.cgi?id={}" .format (self .bug ["id" ])
5759
5860 @property
5961 def app_icon (self ):
@@ -78,14 +80,14 @@ def packages(self):
7880 # these are Bugzilla components that are not Fedora packages
7981 # add any more you can think of
8082 notpackages = [
81- ' distribution' ,
82- ' LiveCD' ,
83- ' LiveCD - FEL' ,
84- ' LiveCD - Games' ,
85- ' LiveCD - KDE' ,
86- ' LiveCD - LXDE' ,
87- ' LiveCD - Xfce' ,
88- ' Package Review' ,
83+ " distribution" ,
84+ " LiveCD" ,
85+ " LiveCD - FEL" ,
86+ " LiveCD - Games" ,
87+ " LiveCD - KDE" ,
88+ " LiveCD - LXDE" ,
89+ " LiveCD - Xfce" ,
90+ " Package Review" ,
8991 ]
9092 if compname in notpackages :
9193 return []
@@ -101,7 +103,7 @@ def _primary_email(self):
101103 """The email for the primary user associated with the action
102104 that generated this message.
103105 """
104- return self .body [' event' ][ ' user' ][ ' login' ]
106+ return self .body [" event" ][ " user" ][ " login" ]
105107
106108 @property
107109 def _all_emails (self ):
@@ -114,27 +116,27 @@ def _all_emails(self):
114116 users .add (self ._primary_email )
115117
116118 # bug reporter and assignee
117- users .add (self .bug [' reporter' ][ ' login' ])
119+ users .add (self .bug [" reporter" ][ " login" ])
118120 users .add (self .assigned_to_email )
119121
120- for change in self .body [' event' ].get (' changes' , []):
121- if change [' field' ] == "cc" :
122+ for change in self .body [" event" ].get (" changes" , []):
123+ if change [" field" ] == "cc" :
122124 # anyone added to CC list
123- for user in change [' added' ].split (',' ):
125+ for user in change [" added" ].split ("," ):
124126 user .strip ()
125127 if user :
126128 users .add (user )
127- elif change [' field' ] == "flag.needinfo" :
129+ elif change [" field" ] == "flag.needinfo" :
128130 # anyone for whom a 'needinfo' flag is set
129131 # this is extracting the email from a value like:
130132 # "? (senrique@redhat.com)"
131- user = change [' added' ].split ('(' , 1 )[1 ].rsplit (')' , 1 )[0 ]
133+ user = change [" added" ].split ("(" , 1 )[1 ].rsplit (")" , 1 )[0 ]
132134 if user :
133135 users .add (user )
134136
135137 # Strip anything that made it in erroneously
136138 for user in list (users ):
137- if user .endswith (' lists.fedoraproject.org' ):
139+ if user .endswith (" lists.fedoraproject.org" ):
138140 users .remove (user )
139141
140142 users = list (users )
@@ -233,11 +235,31 @@ class MessageV1(BaseMessage):
233235 },
234236 "whiteboard" : {"type" : "string" },
235237 },
236- "required" : ["alias" , "assigned_to" , "classification" , "component" ,
237- "creation_time" , "flags" , "id" , "is_private" , "keywords" ,
238- "last_change_time" , "operating_system" , "platform" , "priority" ,
239- "product" , "qa_contact" , "reporter" , "resolution" , "severity" ,
240- "status" , "summary" , "url" , "version" , "whiteboard" ],
238+ "required" : [
239+ "alias" ,
240+ "assigned_to" ,
241+ "classification" ,
242+ "component" ,
243+ "creation_time" ,
244+ "flags" ,
245+ "id" ,
246+ "is_private" ,
247+ "keywords" ,
248+ "last_change_time" ,
249+ "operating_system" ,
250+ "platform" ,
251+ "priority" ,
252+ "product" ,
253+ "qa_contact" ,
254+ "reporter" ,
255+ "resolution" ,
256+ "severity" ,
257+ "status" ,
258+ "summary" ,
259+ "url" ,
260+ "version" ,
261+ "whiteboard" ,
262+ ],
241263 },
242264 "event" : {
243265 "description" : "An object representing the event the message relates to" ,
@@ -260,8 +282,15 @@ class MessageV1(BaseMessage):
260282 },
261283 },
262284 },
263- "required" : ["action" , "bug_id" , "change_set" , "routing_key" , "target" ,
264- "time" , "user" ],
285+ "required" : [
286+ "action" ,
287+ "bug_id" ,
288+ "change_set" ,
289+ "routing_key" ,
290+ "target" ,
291+ "time" ,
292+ "user" ,
293+ ],
265294 },
266295 "comment" : {
267296 "description" : "An object representing a comment affected by the event" ,
@@ -289,9 +318,18 @@ class MessageV1(BaseMessage):
289318 "is_private" : {"type" : "boolean" },
290319 "last_change_time" : {"type" : "number" },
291320 },
292- "required" : ["content_type" , "creation_time" , "description" , "file_name" ,
293- "flags" , "id" , "is_obsolete" , "is_patch" , "is_private" ,
294- "last_change_time" ],
321+ "required" : [
322+ "content_type" ,
323+ "creation_time" ,
324+ "description" ,
325+ "file_name" ,
326+ "flags" ,
327+ "id" ,
328+ "is_obsolete" ,
329+ "is_patch" ,
330+ "is_private" ,
331+ "last_change_time" ,
332+ ],
295333 },
296334 },
297335 "required" : ["bug" , "event" ],
@@ -300,22 +338,22 @@ class MessageV1(BaseMessage):
300338 @property
301339 def bug (self ):
302340 """The bug dictionary from the message."""
303- return self .body [' bug' ]
341+ return self .body [" bug" ]
304342
305343 @property
306344 def assigned_to_email (self ):
307345 """The email address of the user to which the bug is assigned."""
308- return self .bug [' assigned_to' ][ ' login' ]
346+ return self .bug [" assigned_to" ][ " login" ]
309347
310348 @property
311349 def component_name (self ):
312350 """The name of the component against which the bug is filed."""
313- return self .bug [' component' ][ ' name' ]
351+ return self .bug [" component" ][ " name" ]
314352
315353 @property
316354 def product_name (self ):
317355 """The name of the product against which the bug is filed."""
318- return self .bug [' product' ][ ' name' ]
356+ return self .bug [" product" ][ " name" ]
319357
320358
321359class MessageV1BZ4 (MessageV1 ):
@@ -345,19 +383,19 @@ class MessageV1BZ4(MessageV1):
345383 @property
346384 def bug (self ):
347385 """The bug dictionary from the message."""
348- return self .body [' bug' ]
386+ return self .body [" bug" ]
349387
350388 @property
351389 def assigned_to_email (self ):
352390 """The email address of the user to which the bug is assigned."""
353- return self .bug [' assigned_to' ]
391+ return self .bug [" assigned_to" ]
354392
355393 @property
356394 def component_name (self ):
357395 """The name of the component against which the bug is filed."""
358- return self .bug [' component' ]
396+ return self .bug [" component" ]
359397
360398 @property
361399 def product_name (self ):
362400 """The name of the product against which the bug is filed."""
363- return self .bug [' product' ]
401+ return self .bug [" product" ]
0 commit comments