Bladeren bron

/providers: fix trailing whitespace, again

Helge Jung 9 jaren geleden
bovenliggende
commit
3e7d2147f4
1 gewijzigde bestanden met toevoegingen van 6 en 6 verwijderingen
  1. 6 6
      ffstatus/server.py

+ 6 - 6
ffstatus/server.py

@@ -486,22 +486,22 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 			for ip in ips:
 				isp = "UNKNOWN"
 				if isinstance(ip, dict):
-					name_parts = ip['name'].split('-')
+					#name_parts = ip['name'].split('-')
 					desc_lines = ip['description'].split('\n')
 					#isp = name_parts[0] + ' (' + desc_lines[0] + ')'
-					isp = desc_lines[0]
+					isp = desc_lines[0].strip()
 
 					# normalize name: strip company indication
-					isp = re.sub(r'(AG|UG|G?mbH( ?& ?Co\.? ?(OH|K)G)?)\s*$', '', isp, flags=re.IGNORECASE)
+					isp = re.sub(r'(AG|UG|G?mbH( ?& ?Co\.? ?(OH|K)G)?)$', '', isp, flags=re.IGNORECASE).strip()
 
 					# normalize name: strip "pool" suffixes
-					isp = re.sub(r'(dynamic )?(customer |subscriber )?(ip )?(pool|(address )?range|addresses)\s*$', '', isp, flags=re.IGNORECASE)
+					isp = re.sub(r'(dynamic )?(customer |subscriber )?(ip )?(pool|(address )?range|addresses)$', '', isp, flags=re.IGNORECASE).strip()
 
 					# normalize name: strip "B2B" and aggregation suffixes
-					isp = re.sub(r'(B2B )?(aggregate|aggregation)?\s*$', '', isp, flags=re.IGNORECASE)
+					isp = re.sub(r'(B2B )?(aggregate|aggregation)?$', '', isp, flags=re.IGNORECASE).strip()
 
 					# normalize name: strip country suffixes (in Germany)
-					isp = re.sub(r'(DE|Deutschland|Germany|Nordrhein[- ]Westfalen|NRW|Baden[- ]Wuerttemburg|BW|Hessen|Niedersachsen|Rheinland[- ]Pfalz|RLP)\s*$', '', isp, flags=re.IGNORECASE)
+					isp = re.sub(r'(DE|Deutschland|Germany|Nordrhein[- ]Westfalen|NRW|Baden[- ]Wuerttemburg|BW|Hessen|Niedersachsen|Rheinland[- ]Pfalz|RLP)$', '', isp, flags=re.IGNORECASE).strip()
 
 				item_isps.add(isp)