# Path: services/acservice/constants.py
# LICENSE_UNKNOWN = 'Unknown'
# 
# LICENSE_CC0 = 'CC0'
# 
# LICENSE_CC_BY = 'BY'
# 
# LICENSE_CC_BY_NC = 'BY-NC'
# 
# LICENSE_CC_BY_NC_ND = 'BY-NC-ND'
# 
# LICENSE_CC_BY_NC_SA = 'BY-NC-SA'
# 
# LICENSE_CC_BY_ND = 'BY-ND'
# 
# LICENSE_CC_BY_SA = 'BY-SA'
# 
# LICENSE_CC_SAMPLING_PLUS = 'SamplingPlus'


from services.acservice.constants import LICENSE_UNKNOWN, LICENSE_CC0, LICENSE_CC_BY, LICENSE_CC_BY_NC, \
    LICENSE_CC_BY_NC_ND, LICENSE_CC_BY_NC_SA, LICENSE_CC_BY_ND, LICENSE_CC_BY_SA, LICENSE_CC_SAMPLING_PLUS
from pyparsing import CaselessLiteral, Word, alphanums, alphas8bit, nums, quotedString, \
    operatorPrecedence, opAssoc, removeQuotes, Literal, Group, Suppress, Combine


def translate_cc_license_url(url):
    """
    Return CC license name from license URL
    """
    # TODO: this does not include license versioning (3.0, 4.0...)
    if '/by/' in url: return LICENSE_CC_BY

# Path: services/acservice/constants.py
# LICENSE_UNKNOWN = 'Unknown'
# 
# LICENSE_CC0 = 'CC0'
# 
# LICENSE_CC_BY = 'BY'
# 
# LICENSE_CC_BY_NC = 'BY-NC'
# 
# LICENSE_CC_BY_NC_ND = 'BY-NC-ND'
# 
# LICENSE_CC_BY_NC_SA = 'BY-NC-SA'
# 
# LICENSE_CC_BY_ND = 'BY-ND'
# 
# LICENSE_CC_BY_SA = 'BY-SA'
# 
# LICENSE_CC_SAMPLING_PLUS = 'SamplingPlus'


# Path: services/acservice/utils.py
from services.acservice.constants import LICENSE_UNKNOWN, LICENSE_CC0, LICENSE_CC_BY, LICENSE_CC_BY_NC, \
    LICENSE_CC_BY_NC_ND, LICENSE_CC_BY_NC_SA, LICENSE_CC_BY_ND, LICENSE_CC_BY_SA, LICENSE_CC_SAMPLING_PLUS
from pyparsing import CaselessLiteral, Word, alphanums, alphas8bit, nums, quotedString, \
    operatorPrecedence, opAssoc, removeQuotes, Literal, Group, Suppress, Combine



def translate_cc_license_url(url):
    """
    Return CC license name from license URL
    """
    # TODO: this does not include license versioning (3.0, 4.0...)
    if '/by/' in url: return LICENSE_CC_BY

    if '/by-nc/' in url: return LICENSE_CC_BY_NC