# Path: mapmyfitness/utils.py
# def iso_format_to_datetime(iso_format):
#     relevant_str = iso_format.split('+')[0]
#     date, time = relevant_str.split('T')
#     year, month, day = map(int, date.split('-'))
#     hour, minute, second = map(float, time.split(':'))
#     hour, minute, second = map(int, (hour, minute, second))
#     return datetime.datetime(year, month, day, hour, minute, second, tzinfo=utc)


from ..utils import iso_format_to_datetime


class BaseObject(object):
    def __init__(self, dict_):
        self.original_dict = dict_

        if hasattr(self, 'simple_properties'):
            for property_key, property_name in self.simple_properties.items():
                if property_key in self.original_dict:
                    if property_name is None:
                        property_name = property_key
                    setattr(self, property_name, self.original_dict[property_key])

        if hasattr(self, 'datetime_properties'):
            for property_key, property_name in self.datetime_properties.items():
                if property_key in self.original_dict:
                    if property_name is None:
                        property_name = property_key

# Path: mapmyfitness/utils.py
# def iso_format_to_datetime(iso_format):
#     relevant_str = iso_format.split('+')[0]
#     date, time = relevant_str.split('T')
#     year, month, day = map(int, date.split('-'))
#     hour, minute, second = map(float, time.split(':'))
#     hour, minute, second = map(int, (hour, minute, second))
#     return datetime.datetime(year, month, day, hour, minute, second, tzinfo=utc)


# Path: mapmyfitness/objects/base.py
from ..utils import iso_format_to_datetime



class BaseObject(object):
    def __init__(self, dict_):
        self.original_dict = dict_

        if hasattr(self, 'simple_properties'):
            for property_key, property_name in self.simple_properties.items():
                if property_key in self.original_dict:
                    if property_name is None:
                        property_name = property_key
                    setattr(self, property_name, self.original_dict[property_key])

        if hasattr(self, 'datetime_properties'):
            for property_key, property_name in self.datetime_properties.items():
                if property_key in self.original_dict:
                    if property_name is None:
                        property_name = property_key

                    setattr(self, property_name, iso_format_to_datetime(self.original_dict[property_key]))