mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	replace extract_region_from_filename- use re
This commit is contained in:
		
							parent
							
								
									ef6d775abb
								
							
						
					
					
						commit
						abc8fb8947
					
				
					 1 changed files with 5 additions and 8 deletions
				
			
		| 
						 | 
					@ -192,14 +192,11 @@ def fetch_menu_json_value(key):
 | 
				
			||||||
      return data.get(key,'')
 | 
					      return data.get(key,'')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def extract_region_from_filename(fname):
 | 
					def extract_region_from_filename(fname):
 | 
				
			||||||
   substitutions = { "north": "north_america",\
 | 
					   nibble = re.search(r"^.._osm_..._(.*)_[0-9]{4}",fname)
 | 
				
			||||||
                     "central": "central_america",\
 | 
					   if not nibble:
 | 
				
			||||||
                     "southeast": "southeast_asia",
 | 
					      return("maplist")
 | 
				
			||||||
                     "south": "south_america" }
 | 
					   resp = nibble.group(1)
 | 
				
			||||||
   # wish I had used - as separator between key and date
 | 
					   return(resp)
 | 
				
			||||||
   nibble = fname.split('_')[0]
 | 
					 | 
				
			||||||
   nibble = substitutions.get(nibble,nibble)
 | 
					 | 
				
			||||||
   return(nibble)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
   if console_installed:
 | 
					   if console_installed:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue