# Path: src/compat.py
# PY2 = sys.version_info[0] == 2
# PY3 = sys.version_info[0] == 3
# def get_file_dir(filename):
# 
# Path: src/compat2qgis.py
# def getCanvasDestinationCrs(iface):
#     def __init__(self, src_crs, dst_crs):
#     def setDestinationCrs(self, dst_crs):
# def getOpenFileName(parent, caption, filedir, search_filter):
#     def __init__(self, id, type):
#     def fromEpsgId(id):
# class QgsCoordinateTransform(core.QgsCoordinateTransform):
# class QgsCoordinateReferenceSystem(core.QgsCoordinateReferenceSystem):


import ast
from .compat import urlopen
from .compat2qgis import QGis
from qgis.PyQt.QtCore import QSettings, QDir, Qt, QByteArray
        settings = cls.get_settings()
        services = []
        settings.beginGroup("last_used_services")
        for service_id in settings.childGroups():
            service_key = "{}".format(service_id)

            service_json_str = settings.value(service_key + "/json", None)
            service_json = ast.literal_eval(service_json_str)
            if not isinstance(service_json.get(u'name'), unicode):
                continue

            image_ba = settings.value(service_key + "/image", type=QByteArray)

            services.append((service_json, image_ba))

        return services
            
    @classmethod
    def set_last_used_services(cls, services):
        settings = cls.get_settings()
        settings.remove("last_used_services")
        settings.beginGroup("last_used_services")
        for geoservice in services:
            geoservice.saveSelf(settings)
        

    @classmethod
    def use_native_tms(cls):
        if QGis.QGIS_VERSION_INT >= 30000:
            return True

# Path: src/compat.py
# PY2 = sys.version_info[0] == 2
# PY3 = sys.version_info[0] == 3
# def get_file_dir(filename):
# 
# Path: src/compat2qgis.py
# def getCanvasDestinationCrs(iface):
#     def __init__(self, src_crs, dst_crs):
#     def setDestinationCrs(self, dst_crs):
# def getOpenFileName(parent, caption, filedir, search_filter):
#     def __init__(self, id, type):
#     def fromEpsgId(id):
# class QgsCoordinateTransform(core.QgsCoordinateTransform):
# class QgsCoordinateReferenceSystem(core.QgsCoordinateReferenceSystem):


# Path: src/plugin_settings.py
import ast
from .compat import urlopen
from .compat2qgis import QGis
from qgis.PyQt.QtCore import QSettings, QDir, Qt, QByteArray

        settings = cls.get_settings()
        services = []
        settings.beginGroup("last_used_services")
        for service_id in settings.childGroups():
            service_key = "{}".format(service_id)

            service_json_str = settings.value(service_key + "/json", None)
            service_json = ast.literal_eval(service_json_str)
            if not isinstance(service_json.get(u'name'), unicode):
                continue

            image_ba = settings.value(service_key + "/image", type=QByteArray)

            services.append((service_json, image_ba))

        return services
            
    @classmethod
    def set_last_used_services(cls, services):
        settings = cls.get_settings()
        settings.remove("last_used_services")
        settings.beginGroup("last_used_services")
        for geoservice in services:
            geoservice.saveSelf(settings)
        

    @classmethod
    def use_native_tms(cls):
        if QGis.QGIS_VERSION_INT >= 30000:
            return True

        elif QGis.QGIS_VERSION_INT >= 21808: