# Path: pytrainer/util/color.py
# def color_from_hex_string(hex_string):
#     return Color(int(hex_string, 16))
# 
# Path: pytrainer/lib/singleton.py
# class Singleton (object):
#     def __new__(cls, *args, **kwargs): 
#         if not hasattr(cls, 'self'):
#             cls.self = object.__new__(cls)
#         return cls.self


import logging
import os
import warnings
            import urlparse
            import urllib.parse as urlparse
            import datetime
            import gzip
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import TypeDecorator
from sqlalchemy import Integer, Table, Column, ForeignKey
from pytrainer.util.color import color_from_hex_string
from pytrainer.lib.singleton import Singleton
        from pytrainer.core.sport import Sport
        from pytrainer.core.equipment import Equipment
        from pytrainer.waypoint import Waypoint
        from pytrainer.core.activity import Lap
        from pytrainer.athlete import Athletestat
            from urllib import url2pathname
            from urllib.request import url2pathname
# Modified by dgranda

#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.




DeclarativeBase = declarative_base()

record_to_equipment = Table('record_equipment', DeclarativeBase.metadata,
                            Column('id', Integer, primary_key=True),
                            Column('equipment_id', Integer,
                                   ForeignKey('equipment.id'),
                                   index=True, nullable=False),
                            Column('record_id', Integer,
                                   ForeignKey('records.id_record'),
                                   index=True, nullable=False))


# Path: pytrainer/util/color.py
# def color_from_hex_string(hex_string):
#     return Color(int(hex_string, 16))
# 
# Path: pytrainer/lib/singleton.py
# class Singleton (object):
#     def __new__(cls, *args, **kwargs): 
#         if not hasattr(cls, 'self'):
#             cls.self = object.__new__(cls)
#         return cls.self


# Path: pytrainer/lib/ddbb.py
import logging
import os
import warnings
            import urlparse
            import urllib.parse as urlparse
            import datetime
            import gzip
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import TypeDecorator
from sqlalchemy import Integer, Table, Column, ForeignKey
from pytrainer.util.color import color_from_hex_string
from pytrainer.lib.singleton import Singleton
        from pytrainer.core.sport import Sport
        from pytrainer.core.equipment import Equipment
        from pytrainer.waypoint import Waypoint
        from pytrainer.core.activity import Lap
        from pytrainer.athlete import Athletestat
            from urllib import url2pathname
            from urllib.request import url2pathname

# Modified by dgranda

#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.




DeclarativeBase = declarative_base()

record_to_equipment = Table('record_equipment', DeclarativeBase.metadata,
                            Column('id', Integer, primary_key=True),
                            Column('equipment_id', Integer,
                                   ForeignKey('equipment.id'),
                                   index=True, nullable=False),
                            Column('record_id', Integer,
                                   ForeignKey('records.id_record'),
                                   index=True, nullable=False))


class DDBB(Singleton):