def load_layer_with_provider(layer_uri, provider, layer_name='tmp'):
    """Load a layer with a specific driver.

    :param layer_uri: Layer URI that will be used by QGIS to load the layer.
    :type layer_uri: basestring

    :param provider: Provider name to use.
    :type provider: basestring

    :param layer_name: Layer name to use. Default to 'tmp'.
    :type layer_name: basestring

    :return: The layer or None if it's failed.
    :rtype: QgsMapLayer
    """
    if provider in RASTER_DRIVERS:
        return QgsRasterLayer(layer_uri, layer_name, provider)
    elif provider in VECTOR_DRIVERS:
        return QgsVectorLayer(layer_uri, layer_name, provider)
    else:
        return None
def load_layer_with_provider ( layer_uri , provider , layer_name = 'tmp' ) : if provider in RASTER_DRIVERS : return QgsRasterLayer ( layer_uri , layer_name , provider ) elif provider in VECTOR_DRIVERS : return QgsVectorLayer ( layer_uri , layer_name , provider ) else : return None
Load a layer with a specific driver.

    :param layer_uri: Layer URI that will be used by QGIS to load the layer.
    :type layer_uri: basestring

    :param provider: Provider name to use.
    :type provider: basestring

    :param layer_name: Layer name to use. Default to 'tmp'.
    :type layer_name: basestring

    :return: The layer or None if it's failed.
    :rtype: QgsMapLayer