<commit_before>import os

from ott.utils import otp_utils
from test_suite import ListTestSuites


def get_args_parser():
    parser = otp_utils.get_initial_arg_parser()
    parser.add_argument('--hostname', '-hn',  help="specify the hostname for the test url")
    parser.add_argument('--ws_path',  '-ws',  help="OTP url path, ala 'prod' or '/otp/routers/default/plan'")
    parser.add_argument('--printer',  '-p',   help="print to stdout rather than a file", action='store_true')
    parser.add_argument('--selenium', '-sel', help="output a selenium IDE file", action='store_true')
    parser.add_argument('--filename', '-f',   help="filename")
    parser.add_argument('--no_place', '-np',  help="use from and to URL params rather than fromPlace & toPlace", action='store_true')
    parser.add_argument('--strip',    '-st',  help="remove strings from a url, ala '?submit&module=planner&'")
    return parser


def to_urls(args, port):
    #import pdb; pdb.set_trace()
    ws_url, map_url = otp_utils.get_test_urls_from_config(hostname=args.hostname, port=port, ws_path=args.ws_path)
    lts = ListTestSuites(ws_url=ws_url, map_url=map_url, filter=args.test_suite)
    urls = lts.to_url_list()

    # fix up the service urls by either removing strings or renaming parameters (fromPlace / toPlace)
    if args.no_place or args.strip:
        fixed_urls = []
        for u in urls:
            new_url = u
            if args.no_place:
                new_url = new_url.replace('Place=', '=')
            if args.strip:
                new_url = new_url.replace(args.strip, '')
            fixed_urls.append(new_url)<commit_msg>more fixes for trimet.org 2/N .. add NAME:: to bare coordinate<commit_after>import os

from ott.utils import otp_utils
from test_suite import ListTestSuites


def get_args_parser():
    parser = otp_utils.get_initial_arg_parser()
    parser.add_argument('--hostname', '-hn',  help="specify the hostname for the test url")
    parser.add_argument('--ws_path',  '-ws',  help="OTP url path, ala 'prod' or '/otp/routers/default/plan'")
    parser.add_argument('--printer',  '-p',   help="print to stdout rather than a file", action='store_true')
    parser.add_argument('--selenium', '-sel', help="output a selenium IDE file", action='store_true')
    parser.add_argument('--filename', '-f',   help="filename")
    parser.add_argument('--no_place', '-np',  help="use from and to URL params rather than fromPlace & toPlace", action='store_true')
    parser.add_argument('--strip',    '-st',  help="remove strings from a url, ala '?submit&module=planner&'")
    return parser


def to_urls(args, port):
    #import pdb; pdb.set_trace()
    ws_url, map_url = otp_utils.get_test_urls_from_config(hostname=args.hostname, port=port, ws_path=args.ws_path)
    lts = ListTestSuites(ws_url=ws_url, map_url=map_url, filter=args.test_suite)
    urls = lts.to_url_list()

    # fix up the service urls by either removing strings or renaming parameters (fromPlace / toPlace)
    if args.no_place or args.strip:
        fixed_urls = []
        for u in urls:
            new_url = u
            if args.no_place:
                # TODO: make this work for other lat beyond 45-parallel
                new_url = new_url\
                    .replace('fromPlace=45.', 'from=FROM::45.') \
                    .replace('toPlace=45.', 'to=TO::45.') \
                    .replace('Place=', '=')

            if args.strip:
                new_url = new_url.replace(args.strip, '')
            fixed_urls.append(new_url)
{'fraction_non_alphanumeric': 0.13458262350936967, 'fraction_numerical': 0.0031232254400908573, 'mean_word_length': 3.1495877502944643, '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': '2481307', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1149, 'n_words': 278}