# Path: _import.py
# def postprocess_move(move):
# 
#     if move.public is None:
#         move.public = False
# 
#     gps_samples = [sample for sample in move.samples if sample.sample_type and sample.sample_type.startswith('gps-')]
# 
#     if gps_samples:
#         first_sample = gps_samples[0]
#         latitude = first_sample.latitude
#         longitude = first_sample.longitude
# 
#         if latitude and longitude:
#             geo_locator = Nominatim(user_agent='openmoves.net')
#             location = geo_locator.reverse("%f, %f" % (radian_to_degree(latitude), radian_to_degree(longitude)), timeout=60)
#             move.location_address = location.address
#             move.location_raw = location.raw
# 
# Path: filters.py
# def degree_to_radian(value):
#     if value is None:
#         return None
#     return math.radians(value)
# 
# def celcius_to_kelvin(value):
#     if value is None:
#         return None
#     return value + 273.15
# 
# Path: model.py
# class JsonEncodedDict(TypeDecorator):
# class Device(db.Model):
# class User(db.Model):
# class UserPreference(db.Model):
# class Move(db.Model):
# class Sample(db.Model):
# class MoveEdit(db.Model):
# class AlembicVersion(db.Model):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def is_authenticated(self):
#     def is_active(self):
#     def is_anonymous(self):
#     def has_strava(self):
#     def get_strava_access_token(self):
#     def get_id(self):
#     def __init__(self, key, value):


from datetime import datetime, timedelta
from sqlalchemy.sql import func
from _import import postprocess_move
from filters import degree_to_radian, celcius_to_kelvin
from model import User, Device, Move, Sample, db
import numpy as np
import pytz
import stravalib
import gpx_import
            hr = None

        if 'latlng' in streams:
            lat, lng = streams['latlng'].data[i]
        else:
            lat = None
            lng = None

        if 'altitude' in streams:
            altitude = float(streams['altitude'].data[i])
        else:
            altitude = None

        if 'velocity_smooth' in streams:
            speed = float(streams['velocity_smooth'].data[i])
        else:
            speed = None

        if 'temp' in streams:
            temperature = celcius_to_kelvin(streams['temp'].data[i])
        else:
            temperature = None

        sample = Sample()
        sample.sample_type = SAMPLE_TYPE
        sample.move = move
        sample.time = time
        sample.utc = (activity.start_date + time).replace(tzinfo=None)
        sample.distance = distance
        sample.latitude = degree_to_radian(lat)

# Path: _import.py
# def postprocess_move(move):
# 
#     if move.public is None:
#         move.public = False
# 
#     gps_samples = [sample for sample in move.samples if sample.sample_type and sample.sample_type.startswith('gps-')]
# 
#     if gps_samples:
#         first_sample = gps_samples[0]
#         latitude = first_sample.latitude
#         longitude = first_sample.longitude
# 
#         if latitude and longitude:
#             geo_locator = Nominatim(user_agent='openmoves.net')
#             location = geo_locator.reverse("%f, %f" % (radian_to_degree(latitude), radian_to_degree(longitude)), timeout=60)
#             move.location_address = location.address
#             move.location_raw = location.raw
# 
# Path: filters.py
# def degree_to_radian(value):
#     if value is None:
#         return None
#     return math.radians(value)
# 
# def celcius_to_kelvin(value):
#     if value is None:
#         return None
#     return value + 273.15
# 
# Path: model.py
# class JsonEncodedDict(TypeDecorator):
# class Device(db.Model):
# class User(db.Model):
# class UserPreference(db.Model):
# class Move(db.Model):
# class Sample(db.Model):
# class MoveEdit(db.Model):
# class AlembicVersion(db.Model):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def is_authenticated(self):
#     def is_active(self):
#     def is_anonymous(self):
#     def has_strava(self):
#     def get_strava_access_token(self):
#     def get_id(self):
#     def __init__(self, key, value):


# Path: strava.py
from datetime import datetime, timedelta
from sqlalchemy.sql import func
from _import import postprocess_move
from filters import degree_to_radian, celcius_to_kelvin
from model import User, Device, Move, Sample, db
import numpy as np
import pytz
import stravalib
import gpx_import

            hr = None

        if 'latlng' in streams:
            lat, lng = streams['latlng'].data[i]
        else:
            lat = None
            lng = None

        if 'altitude' in streams:
            altitude = float(streams['altitude'].data[i])
        else:
            altitude = None

        if 'velocity_smooth' in streams:
            speed = float(streams['velocity_smooth'].data[i])
        else:
            speed = None

        if 'temp' in streams:
            temperature = celcius_to_kelvin(streams['temp'].data[i])
        else:
            temperature = None

        sample = Sample()
        sample.sample_type = SAMPLE_TYPE
        sample.move = move
        sample.time = time
        sample.utc = (activity.start_date + time).replace(tzinfo=None)
        sample.distance = distance
        sample.latitude = degree_to_radian(lat)

        sample.longitude = degree_to_radian(lng)