@@ -155,30 +155,28 @@ def get_maintenances(self, data: NotificationData) -> Iterable[Maintenance]:
155155 related_exceptions = related_exceptions ,
156156 )
157157
158-
159158 def add_subject_to_text (self , data : NotificationData ):
160159 """Append the subject to all text/* data_parts if not already present."""
161160 subject = None
162161 for part in data .data_parts :
163- if part .type == ' email-header-subject' :
164- subject = part .content .decode (errors = ' ignore' )
162+ if part .type == " email-header-subject" :
163+ subject = part .content .decode (errors = " ignore" )
165164 break
166165 if subject :
167166 new_data_parts = []
168167 for part in data .data_parts :
169- if part .type .startswith (' text/' ) or part .type .startswith (' html' ):
170- content_str = part .content .decode (errors = ' ignore' )
168+ if part .type .startswith (" text/" ) or part .type .startswith (" html" ):
169+ content_str = part .content .decode (errors = " ignore" )
171170 if subject not in content_str :
172171 # Append subject and update content
173- new_content = (content_str + ' \n ' + subject ).encode ()
172+ new_content = (content_str + " \n " + subject ).encode ()
174173 new_data_parts .append (type (part )(part .type , new_content ))
175174 else :
176175 new_data_parts .append (part )
177176 else :
178177 new_data_parts .append (part )
179178 data .data_parts = new_data_parts
180179
181-
182180 @classmethod
183181 def get_default_organizer (cls ) -> str :
184182 """Expose default_organizer as class attribute."""
0 commit comments