Guénaël Muller 7 years ago
parent
commit
1411316f07
1 changed files with 7 additions and 10 deletions
  1. 7 10
      tracim/tracim/lib/email_body_parser.py

+ 7 - 10
tracim/tracim/lib/email_body_parser.py View File

@@ -54,7 +54,7 @@ class BodyMailParts(object):
54 54
         BodyMailParts._check_value(value)
55 55
         self._append(value)
56 56
 
57
-    def _append(self, value):
57
+    def _append(self, value) -> None:
58 58
         same_type_as_last =len(self._list) > 0 and \
59 59
                            self._list[-1].part_type == value.part_type
60 60
         if same_type_as_last or self.follow :
@@ -243,7 +243,7 @@ class ParsedHTMLMail(object):
243 243
     def __str__(self):
244 244
         return str(self._parse_mail())
245 245
 
246
-    def get_elements(self):
246
+    def get_elements(self) -> BodyMailParts:
247 247
         tree = self._make_sanitized_tree()
248 248
         return self._distinct_elements(tree)
249 249
 
@@ -252,7 +252,7 @@ class ParsedHTMLMail(object):
252 252
         elements = self._process_elements(elements)
253 253
         return elements
254 254
 
255
-    def _make_sanitized_tree(self):
255
+    def _make_sanitized_tree(self) -> BeautifulSoup:
256 256
         """
257 257
         Get only html body content and remove some unneeded elements
258 258
         :return:
@@ -331,22 +331,19 @@ class ParsedHTMLMail(object):
331 331
         return elements
332 332
 
333 333
     @classmethod
334
-    def _process_quote_first_case(cls, elements: BodyMailParts):
334
+    def _process_quote_first_case(cls, elements: BodyMailParts) -> None:
335 335
         elements.drop_part_type(BodyMailPartType.Signature)
336
-        pass
337 336
 
338 337
     @classmethod
339
-    def _process_main_first_case(cls, elements: BodyMailParts):
338
+    def _process_main_first_case(cls, elements: BodyMailParts) -> None:
340 339
         elements.drop_part_type(BodyMailPartType.Quote)
341 340
         elements.drop_part_type(BodyMailPartType.Signature)
342
-        pass
343 341
 
344 342
     @classmethod
345
-    def _process_multiples_elems_case(cls, elements: BodyMailParts):
343
+    def _process_multiples_elems_case(cls, elements: BodyMailParts) -> None:
346 344
         elements.drop_part_type(BodyMailPartType.Signature)
347
-        pass
348 345
 
349 346
     @classmethod
350
-    def _process_default_case(cls, elements: BodyMailParts):
347
+    def _process_default_case(cls, elements: BodyMailParts) -> None:
351 348
         elements.drop_part_type(BodyMailPartType.Quote)
352 349
         elements.drop_part_type(BodyMailPartType.Signature)