update Geo module
This commit is contained in:
parent
9c39e0e2e6
commit
0bf4d5a0f5
5 changed files with 582 additions and 62 deletions
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import codecs
|
||||
import json
|
||||
import os
|
||||
import ox
|
||||
|
|
@ -96,7 +97,6 @@ def get_countries():
|
|||
'country': data['dependency'],
|
||||
'date': country['created']['date']
|
||||
}
|
||||
sys.exit()
|
||||
# Flags
|
||||
countries = sorted(countries, key=sort)
|
||||
flags = get_flags(countries)
|
||||
|
|
@ -126,14 +126,14 @@ def get_country_data(country):
|
|||
country['created'] = DATA['created'][name]
|
||||
# dependencies
|
||||
for c, d in DATA['dependencies'].iteritems():
|
||||
c = c.split(', ')
|
||||
c = c.split('; ')
|
||||
if name in c:
|
||||
country['dependencies'] = d if not 'dependencies' in country else country['dependencies'] + d
|
||||
elif name in d:
|
||||
country['dependency'] = c if not 'dependency' in country else country['dependency'] + c
|
||||
# disputes
|
||||
for c, d in DATA['disputes'].iteritems():
|
||||
c = c.split(', ')
|
||||
c = c.split('; ')
|
||||
if name in c:
|
||||
country['disputes'] = d if not 'disputes' in country else country['disputes'] + d
|
||||
elif name in d:
|
||||
|
|
@ -261,7 +261,7 @@ def parse_txt():
|
|||
'dissolved': {},
|
||||
'independence': {}
|
||||
}
|
||||
f = open('../txt/countries.txt')
|
||||
f = codecs.open('../txt/countries.txt', 'r', 'utf-8')
|
||||
lines = map(lambda x: x.strip(), f.readlines())
|
||||
f.close()
|
||||
for line in filter(lambda x: x[0] != '#', lines):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue