<commit_before>from argparse import ArgumentParser

from flows.builtin.webserver.post import run_webserver
from jobrunner.cli.parse import parse_arguments
from jobrunner.jobs import register_job


def parse_webserver_arguments(args=None):
    """
    Parse the commandline options for posting a job that
    runs a simple HTTP webserver
    :param list args: Args to pass to the arg parser.
    Will use argv if none specified.
    :return obj args: parsed arguments
    """
    parser = ArgumentParser(
        prog="jobrunner post simple_http_webserver",
        description='Post a job that runs a simple HTTP webserver'
    )
    parser.add_argument(
        '--port', '-p', type=int, default=8080,
        help="The port to use to run the webserver on. Defaults to 8080"
    )
    return parse_arguments(parser, args=args)


@register_job()
def simple_http_webserver(args=None):
    """
    Show information about running jobs
    :param list args: Args to pass to the arg parser.
    Will use argv if none specified.
    :return None:
    """
    args = parse_webserver_arguments(args=args)
    run_webserver(port=args.port)<commit_msg>fix example http webserver docstring<commit_after>from argparse import ArgumentParser

from flows.builtin.webserver.post import run_webserver
from jobrunner.cli.parse import parse_arguments
from jobrunner.jobs import register_job


def parse_webserver_arguments(args=None):
    """
    Parse the commandline options for posting a job that
    runs a simple HTTP webserver
    :param list args: Args to pass to the arg parser.
    Will use argv if none specified.
    :return obj args: parsed arguments
    """
    parser = ArgumentParser(
        prog="jobrunner post simple_http_webserver",
        description='Post a job that runs a simple HTTP webserver'
    )
    parser.add_argument(
        '--port', '-p', type=int, default=8080,
        help="The port to use to run the webserver on. Defaults to 8080"
    )
    return parse_arguments(parser, args=args)


@register_job()
def simple_http_webserver(args=None):
    """
    Post a job that runs the simple http webserver
    :param list args: Args to pass to the arg parser.
    Will use argv if none specified.
    :return None:
    """
    args = parse_webserver_arguments(args=args)
    run_webserver(port=args.port)
{'fraction_non_alphanumeric': 0.07420189818809318, 'fraction_numerical': 0.006902502157031924, 'mean_word_length': 3.4510556621880997, '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': '5977027', 'n_tokens_mistral': 666, 'n_tokens_neox': 652, 'n_words': 239}