# Path: OSMPythonTools/internal/singletonApi.py
# class SingletonApi():
#     __instance = None
#     def __init__(self, *args, **kwargs):
#         from OSMPythonTools.api import Api
#         if not SingletonApi.__instance:
#             SingletonApi.__instance = Api(*args, **kwargs)
#     def __getattr__(self, name):
#         return getattr(self.__instance, name)
# 
# Path: OSMPythonTools/internal/elementShallow.py
# class ElementShallow(Response):
#     def __init__(self, cacheMetadata):
#         super().__init__(cacheMetadata)
#     def type(self):
#         return None
#     def id(self):
#         return None
#     def typeId(self):
#         return self.type() + '/' + str(self.id()) if self.type() != None and self.id() != None else None
#     def typeIdShort(self):
#         return self.type()[0] + str(self.id()) if self.type() != None and self.id() != None else None
#     def areaId(self):
#         return self._areaId(self.type(), self.id())
#     def _areaId(self, type, id):
#         if type == 'way':
#             return id + 2400000000
#         elif type == 'relation':
#             return id + 3600000000
#         else:
#             return None


import copy
import dateutil.parser
import geojson
import re
import OSMPythonTools
from OSMPythonTools.internal.singletonApi import SingletonApi
from OSMPythonTools.internal.elementShallow import ElementShallow


def _extendAndRaiseException(e, msg):
    msgComplete = str(e) + msg
    OSMPythonTools.logger.exception(msgComplete)
    raise(Exception(msgComplete))

class Element(ElementShallow):
    def __init__(self, cacheMetadata=None, json=None, soup=None, soupHistory=None, shallow=False):
        self._json = json
        self._soup = soup
        self._soupHistory = soupHistory
        self._shallow = shallow
        super().__init__(cacheMetadata)
    
    @staticmethod
    def fromId(idToParse):
        if isinstance(idToParse, Element):
            return idToParse

# Path: OSMPythonTools/internal/singletonApi.py
# class SingletonApi():
#     __instance = None
#     def __init__(self, *args, **kwargs):
#         from OSMPythonTools.api import Api
#         if not SingletonApi.__instance:
#             SingletonApi.__instance = Api(*args, **kwargs)
#     def __getattr__(self, name):
#         return getattr(self.__instance, name)
# 
# Path: OSMPythonTools/internal/elementShallow.py
# class ElementShallow(Response):
#     def __init__(self, cacheMetadata):
#         super().__init__(cacheMetadata)
#     def type(self):
#         return None
#     def id(self):
#         return None
#     def typeId(self):
#         return self.type() + '/' + str(self.id()) if self.type() != None and self.id() != None else None
#     def typeIdShort(self):
#         return self.type()[0] + str(self.id()) if self.type() != None and self.id() != None else None
#     def areaId(self):
#         return self._areaId(self.type(), self.id())
#     def _areaId(self, type, id):
#         if type == 'way':
#             return id + 2400000000
#         elif type == 'relation':
#             return id + 3600000000
#         else:
#             return None


# Path: OSMPythonTools/element.py
import copy
import dateutil.parser
import geojson
import re
import OSMPythonTools
from OSMPythonTools.internal.singletonApi import SingletonApi
from OSMPythonTools.internal.elementShallow import ElementShallow



def _extendAndRaiseException(e, msg):
    msgComplete = str(e) + msg
    OSMPythonTools.logger.exception(msgComplete)
    raise(Exception(msgComplete))

class Element(ElementShallow):
    def __init__(self, cacheMetadata=None, json=None, soup=None, soupHistory=None, shallow=False):
        self._json = json
        self._soup = soup
        self._soupHistory = soupHistory
        self._shallow = shallow
        super().__init__(cacheMetadata)
    
    @staticmethod
    def fromId(idToParse):
        if isinstance(idToParse, Element):
            return idToParse

        if isinstance(idToParse, ElementShallow):