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