# 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
            return list(map(lambda n: api.query('node/' + str(n if self._json is not None else n['ref']), shallow='''
<?xml version="1.0" encoding="UTF-8"?>
<osm>
    <node id="''' + str(n if self._json is not None else n['ref']) + '''"/>
</osm>
            '''), nodes))
        else:
            return list(map(lambda n: api.query('node/' + str(n if self._json is not None else n['ref'])), nodes))
    def countNodes(self):
        nodes = self.__nodes()
        return len(nodes) if nodes is not None else None
    
    ### history
    def history(self):
        if self._soupHistory is None:
            return None
        history = []
        for soup in self._soupHistory:
            h = copy.copy(self)
            h._soup = soup
            history.append(h)
        return history

    ### members
    def __members(self):
        return self.__getElement('members') if self._json is not None else self._soup.find_all('member')
    def members(self, shallow=True):
        members = self.__members()
        if members is None or len(members) == 0:
            return []

# 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

            return list(map(lambda n: api.query('node/' + str(n if self._json is not None else n['ref']), shallow='''
<?xml version="1.0" encoding="UTF-8"?>
<osm>
    <node id="''' + str(n if self._json is not None else n['ref']) + '''"/>
</osm>
            '''), nodes))
        else:
            return list(map(lambda n: api.query('node/' + str(n if self._json is not None else n['ref'])), nodes))
    def countNodes(self):
        nodes = self.__nodes()
        return len(nodes) if nodes is not None else None
    
    ### history
    def history(self):
        if self._soupHistory is None:
            return None
        history = []
        for soup in self._soupHistory:
            h = copy.copy(self)
            h._soup = soup
            history.append(h)
        return history

    ### members
    def __members(self):
        return self.__getElement('members') if self._json is not None else self._soup.find_all('member')
    def members(self, shallow=True):
        members = self.__members()
        if members is None or len(members) == 0:
            return []

        api = SingletonApi()