@@ -491,12 +491,11 @@ def rate_updated_date(global_translation, local_translation, soup):
491491 Rating: The Rating object with the updated overall rating.
492492 """
493493 rating = Rating (global_translation , get_config ('general.review.improve-only' ))
494- dates = []
495-
496494 element = soup .find ('body' )
497495 if element is None :
498496 return rating
499497
498+ dates = []
500499 element_text = element .get_text ()
501500
502501 regexes = [
@@ -730,10 +729,12 @@ def rate_evaluation_method(global_translation, local_translation, soup):
730729 Returns:
731730 rating (Rating object): The 'Rating' object with the overall rating set.
732731 """
733- match = soup .find (string = re .compile (
734- "(sj(.{1, 6}|ä|ä|ä)lvskattning|intern[a]{0,1} kontroller|intern[a]{0,1} test(ning|er){0,1}]|utvärderingsmetod|tillgänglighetsexpert(er){0,1}|funka|etu ab|siteimprove|oberoende granskning|oberoende tillgänglighetsgranskning(ar){0,1}|tillgänglighetskonsult(er){0,1}|med hjälp av|egna tester|oberoende experter|Hur vi testat webbplats(en){0,1}|vi testat webbplatsen|intervjuer|rutiner|checklistor|checklista|utbildningar|automatiserade|automatisk|maskinell|kontrollverktyg)" , # pylint: disable=line-too-long
735- flags = re .MULTILINE | re .IGNORECASE ))
736732 rating = Rating (global_translation , get_config ('general.review.improve-only' ))
733+ element = soup .find ('body' )
734+ if element is None :
735+ return rating
736+ text = element .get_text ()
737+ match = re .search (r"(sj(.{1, 6}|ä|ä|ä)lvskattning|intern[a]{0,1} kontroller|intern[a]{0,1} test(ning|er){0,1}]|utvärderingsmetod|tillgänglighetsexpert(er){0,1}|funka|etu ab|siteimprove|oberoende granskning|oberoende tillgänglighetsgranskning(ar){0,1}|tillgänglighetskonsult(er){0,1}|med hjälp av|egna tester|oberoende experter|Hur vi testat webbplats(en){0,1}|vi testat webbplatsen|intervjuer|rutiner|checklistor|checklista|utbildningar|automatiserade|automatisk|maskinell|kontrollverktyg)" , text , flags = re .MULTILINE | re .IGNORECASE )
737738 if match :
738739 rating .set_overall (
739740 5.0 , local_translation ('TEXT_REVIEW_EVALUATION_METHOD_FOUND' ))
@@ -762,9 +763,13 @@ def rate_unreasonably_burdensome_accommodation(global_translation, local_transla
762763 Returns:
763764 rating (Rating object): The 'Rating' object with the overall and accessibility ratings set.
764765 """
765- match = soup .find (string = re .compile (
766- "(Oskäligt betungande anpassning|12[ \t \r \n ]§ lagen)" , flags = re .MULTILINE | re .IGNORECASE ))
767766 rating = Rating (global_translation , get_config ('general.review.improve-only' ))
767+ element = soup .find ('body' )
768+ if element is None :
769+ return rating
770+
771+ text = element .get_text ()
772+ match = re .search (r"(Oskäligt betungande anpassning|12[ \t\r\n]§ lagen)" , text , flags = re .MULTILINE | re .IGNORECASE )
768773 if match :
769774 rating .set_overall (
770775 5.0 , local_translation ('TEXT_REVIEW_ADAPTATION_FOUND' ))
@@ -848,13 +853,15 @@ def rate_compatible_text(global_translation, local_translation, soup):
848853 Returns:
849854 Rating: A Rating object containing the overall and accessibility (a11y) ratings of the text.
850855 """
851- element = soup .find (string = re .compile (
852- "(?P<test>helt|delvis|inte) förenlig" , flags = re .MULTILINE | re .IGNORECASE ))
856+
853857 rating = Rating (global_translation , get_config ('general.review.improve-only' ))
854- if element :
855- text = element .get_text ()
856- regex = r'(?P<test>helt|delvis|inte) förenlig'
857- match = re .search (regex , text , flags = re .IGNORECASE )
858+ element = soup .find ('body' )
859+ if element is None :
860+ return rating
861+
862+ text = element .get_text ()
863+ match = re .search (r'(?P<test>helt|delvis|inte) förenlig' , text , flags = re .IGNORECASE )
864+ if match :
858865 test = match .group ('test' ).lower ()
859866 if 'inte' in test :
860867 rating .set_overall (
@@ -1060,15 +1067,12 @@ def get_interesting_urls(item, content, org_url_start, depth):
10601067 url , text , 'url.text' , precision , depth )
10611068 item ['links-all' ].append (info )
10621069
1063- if not link .find (string = re .compile (
1064- r"(om [a-z]+|(tillg(.{1,6}|ä|ä|ä)nglighet(sredog(.{1,6}|ö|ö|ö)relse){0,1}))" , # pylint: disable=line-too-long
1065- flags = re .MULTILINE | re .IGNORECASE )):
1070+ match = re .search (
1071+ r"(om [a-z]+|(tillg(.{1,6}|ä|ä|ä)nglighet(sredog(.{1,6}|ö|ö|ö)relse){0,1}))" ,
1072+ text , flags = re .MULTILINE | re .IGNORECASE )
1073+ if not match :
10661074 continue
10671075
1068- text = link .get_text ().strip ()
1069- precision = get_text_precision (text )
1070- info = get_default_info (
1071- url , text , 'url.text' , precision , depth )
10721076 if url not in checked_urls :
10731077 urls [url ] = info
10741078
0 commit comments