Fix pylint formating

This commit is contained in:
Cédric Leporcq 2021-11-12 09:39:08 +01:00
parent 5d7e0c4f46
commit e22ac84d75
1 changed files with 7 additions and 6 deletions

View File

@ -15,26 +15,27 @@ def checksum(file_path, blocksize=65536):
:returns: str or None :returns: str or None
""" """
hasher = hashlib.sha256() hasher = hashlib.sha256()
with open(file_path, 'rb') as f: with open(file_path, 'rb') as file:
buf = f.read(blocksize) buf = file.read(blocksize)
while len(buf) > 0: while len(buf) > 0:
hasher.update(buf) hasher.update(buf)
buf = f.read(blocksize) buf = file.read(blocksize)
return hasher.hexdigest() return hasher.hexdigest()
return None return None
def distance_between_two_points(lat1, lon1, lat2, lon2): def distance_between_two_points(lat1, lon1, lat2, lon2):
# As threshold is quite small use simple math """Return distance between two points"""
# From http://stackoverflow.com/questions/15736995/how-can-i-quickly-estimate-the-distance-between-two-latitude-longitude-points # noqa # From http://stackoverflow.com/questions/15736995/how-can-i-quickly-estimate-the-distance-between-two-latitude-longitude-points # noqa
# convert decimal degrees to radians # convert decimal degrees to radians
lat1, lon1, lat2, lon2 = list(map(radians, [lat1, lon1, lat2, lon2])) lat1, lon1, lat2, lon2 = list(map(radians, [lat1, lon1, lat2, lon2]))
r = 6371000 # radius of the earth in m rad = 6371000 # radius of the earth in m
x = (lon2 - lon1) * cos(0.5 * (lat2 + lat1)) x = (lon2 - lon1) * cos(0.5 * (lat2 + lat1))
y = lat2 - lat1 y = lat2 - lat1
return r * sqrt(x * x + y * y) return rad * sqrt(x * x + y * y)
def get_date_regex(user_regex=None): def get_date_regex(user_regex=None):