Changed obsolete string formatting operations

pull/38/head
Konstantin Gründger 2016-02-03 23:19:25 +01:00
rodzic 03ea96c71e
commit 018ea8c549
4 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -30,7 +30,7 @@ def import_ddb():
logger.info("Import registered devices fom the DDB...")
counter = update_devices(app.session, AddressOrigin.ogn_ddb, get_ddb())
logger.info("Imported %i devices." % counter)
logger.info("Imported {} devices.".format(counter))
@app.task
@ -39,7 +39,7 @@ def import_file(path='tests/custom_ddb.txt'):
logger.info("Import registered devices from '{}'...".format(path))
counter = update_devices(app.session, AddressOrigin.user_defined, get_ddb(path))
logger.info("Imported %i devices." % counter)
logger.info("Imported {} devices.".format(counter))
@app.task

Wyświetl plik

@ -86,6 +86,6 @@ def compute_takeoff_and_landing():
result = app.session.execute(ins)
counter = result.rowcount
app.session.commit()
logger.debug("New/recalculated takeoffs and landings: %s" % counter)
logger.debug("New/recalculated takeoffs and landings: {}".format(counter))
return counter

Wyświetl plik

@ -21,7 +21,7 @@ def compute():
print("Compute takeoffs and landings...")
result = compute_takeoff_and_landing.delay()
counter = result.get()
print("New/recalculated takeoffs/landings: %s" % counter)
print("New/recalculated takeoffs/landings: {}"format(counter))
@manager.command

Wyświetl plik

@ -49,15 +49,15 @@ def get_trackable(ddb):
l = []
for i in ddb:
if i.tracked and i.address_type in address_prefixes:
l.append('{}{}'.format(address_prefixes[i.address_type], i.address))
l.append("{}{}".format(address_prefixes[i.address_type], i.address))
return l
def get_country_code(latitude, longitude):
geolocator = Nominatim()
try:
location = geolocator.reverse("%f, %f" % (latitude, longitude))
country_code = location.raw["address"]["country_code"]
location = geolocator.reverse("{}, {}".format(latitude, longitude))
country_code = location.raw['address']['country_code']
except KeyError:
country_code = None
except GeopyError: