<commit_before>""" Factory of RoutingService classes """

import json
from .mb import MapboxRouter
from .graphhopper import GraphHopperRouter

# from . import mapzen
# from . import google
# from . import here
# from . import tomtom
""" Factory method of creating concrete routing service instances
"""
VALID_ROUTING_SERVICES = [
    'mapbox', 'graphhopper', 'mapzen', 'google', 'here', 'tomtom'
]


def RoutingServiceFactory(service_name):
    if service_name not in VALID_ROUTING_SERVICES:
        # TODO(lliu): Here should throw an exception or deal with it in an
        # identical way
        return None
    with open('../apikeys.json', 'r') as f:
        service_provider_conf = json.load(f)

    # TODO(lliu): The following stuff of course should be prettified
    # ATTENTION!! A pile of ugly things are coming...
    if service_name == 'mapbox':
        return MapboxRouter(service_provider_conf['mapbox']['key'])
    elif service_name == 'graphhopper':
        return GraphHopperRouter(service_provider_conf['graphhopper']['key'])<commit_msg>remove the router name validation because that has been done in the __init__.py<commit_after>""" Factory of RoutingService classes """

import json
from .mb import MapboxRouter
from .graphhopper import GraphHopperRouter

# from . import mapzen
# from . import google
# from . import here
# from . import tomtom
""" Factory method of creating concrete routing service instances
"""


def RoutingServiceFactory(service_name):
    with open('routerconf.json', 'r') as f:
        service_provider_conf = json.load(f)
    # TODO(lliu): The following stuff of course should be prettified
    # ATTENTION!! A pile of ugly things are coming...
    if service_name == 'mapbox':
        return MapboxRouter(service_provider_conf['mapbox']['key'])
    elif service_name == 'graphhopper':
        return GraphHopperRouter(service_provider_conf['graphhopper']['key'])
{'fraction_non_alphanumeric': 0.10062893081761007, 'fraction_numerical': 0.0, 'mean_word_length': 4.117962466487936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1963246', 'n_tokens_mistral': 545, 'n_tokens_neox': 531, 'n_words': 181}