Skip to content

Commit

Permalink
Cleanup imports + pep8 and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
i-trofimtschuk committed Jun 29, 2018
1 parent 92a1240 commit eddce7b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pygeodb/pygeodb_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
distanz_liste = sort(locations, referenz)
"""

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from future_builtins import map, filter, ascii, hex, oct
from __future__ import absolute_import, print_function, unicode_literals

import math

from pygeodb.plzdata import geodata


Expand All @@ -41,7 +39,8 @@ def __init__(self, plz, land='DE'):
"""The python object for a geolocation"""
self.plz = plz
self.land = land
(self.longitude, self.latitude, self.city) = geodata.get(land.upper(), {}).get(plz, (0, 0, None))
(self.longitude, self.latitude, self.city) = geodata.get(
land.upper(), {}).get(plz, (0, 0, None))
if not self.city:
raise ValueError("Unknown PLZ: %s-%s" % (land, plz))

Expand All @@ -51,7 +50,7 @@ def __sub__(self, other):
tLat, tLon = math.radians(other.latitude), math.radians(other.longitude)
distance = math.acos(
round(math.sin(tLat) * math.sin(fLat) +
math.cos(tLat) * math.cos(fLat) * math.cos(tLon - fLon), 7)) * 6380000
math.cos(tLat) * math.cos(fLat) * math.cos(tLon - fLon), 10)) * 6380000
return int(distance)


Expand Down

0 comments on commit eddce7b

Please sign in to comment.