<commit_before># -* encoding: utf-8 *-

import argparse

from gopythongo.utils import highlight


class VersionerHelpAction(argparse.Action):
    def __init__(self,
                 option_strings,
                 dest,
                 default=None,
                 choices=None,
                 help="Show help for GoPythonGo versioners."):
        super(VersionerHelpAction, self).__init__(option_strings=option_strings, dest=dest, default=default, nargs="?",
                                                  choices=choices, help=help)

    def __call__(self, parser, namespace, values, option_string=None):
        from gopythongo.versioners import versioners
        if values in versioners.keys():
            versioners[values].print_help()
        else:
            print("Versioners\n"
                  "==========\n"
                  "\n"
                  "Versioners are responsible for two actions:\n"
                  "\n"
                  "    1. They read a version string from a source. What the source is, depends on\n"
                  "       the versioner.\n"
                  "    2. They process the version string, changing it when configured to do so\n"
                  "       and then setting the resulting version as the output version for a\n"
                  "       GoPythonGo packer.\n"
                  "\n"
                  "You specify how to read a version using %s and split it into its\n"
                  "parts using %s. The target version is then specified using\n"
                  "%s, which can be optionally modified by setting %s.\n"
                  "\n"
                  "If you want more information on the available versioners and their supported\n"
                  "methods, you want to use %s.\n"
                  "\n"
                  "Version format strings\n"
                  "----------------------\n"
                  "\n"
                  "%s and %s support the following placeholders:\n"
                  "\n"
                  "    %s    - identifies the major version number (2 in '5:2.3.4-1')\n"
                  "    %s    - identifies the minor version number (3 in '5:2.3.4-1')\n"
                  "    %s    - identifies the patch version number (4 in '5:2.3.4-1')\n"
                  "    %s - identifies the revision number (1 in '5:2.3.4-1')\n"
                  "\n"
                  "You can also use the following predefined version formats for both input and\n"
                  "output:\n"
                  "\n"
                  "    %s - reads a Debian version string\n"
                  "    %s - reads a SemVer version string\n"
                  "\n"
                  "Please note that while this setup is pretty flexible, it far from delivers\n"
                  "everything you could ever ask for in a version string. Instead it's completely\n"
                  "oriented towards supporting %s. While\n"
                  "also supporting package Epochs which are easy to use for pushing out new\n"
                  "development versions of packages to staging systems. If you need additional\n"
                  "flexibility, don't hesitate to write your own Versioner for GoPythonGo.\n"
                  "\n"
                  "Version actions\n"
                  "---------------\n"
                  "\n"
                  "Typically you want to read a version string and then modify it in some way. I\n"
                  "recommend that you %s, but\n"
                  "create automatically incremented version strings for development versions which\n"
                  "are automatically distributed to your staging/development systems. GoPythonGo\n"
                  "can modify version strings through %s, which supports the\n"
                  "following parameter values:\n"
                  "\n"
                  "    %s - increment the version string epoch\n"
                  "    %s - increment the version string patch level\n"
                  "    %s - increment the version string revision\n"
                  "    %s - do nothing to the version string (the default)\n"
                  "\n"
                  "This action will be performed before creating the new version string by the\n"
                  "versioner processing the new version string. For example: The %s versioner,\n"
                  "when faced with the 'increment-epoch' action, will first find out the highest\n"
                  "Epoch value in its repository, then increment that Epoch by 1 and then create\n"
                  "the new version string. For more details, please look at the help pages of the\n"
                  "individual versioners.\n"
                  "\n"
                  "Best practice\n"
                  "-------------\n"
                  "\n"
                  "A good start is to read the version from your Python project so you have a\n"
                  "central point where you change the version. Make sure that your development\n"
                  "model changes the version string according to SemVer when you make a new\n"
                  "release. For example when using git flow, you change the version every time\n"
                  "you create a new release branch.\n"
                  "\n"
                  "Then you just have to make sure that your packaging system will recognize the\n"
                  "automatically incremented new version string as newer than the last one. I like\n"
                  "to use the following configuration for my development branches:\n"
                  "\n"
                  "    --read-version='pymodule:myproject:__version__' \\\n"
                  "    --parse-version-format='semver' \\\n"
                  "    --version-action='increment-revision' \\\n"
                  "    --new-version='aptly:debian'\n"
                  "\n"
                  "This will:\n"
                  "\n"
                  "    * read the __version__ attribute from the Python module myproject in the\n"
                  "      current PYTHONPATH,\n"
                  "    * then parse this value as a SemVer formatted version,\n"
                  "    * then find the highest revision in the current package repository,\n"
                  "    * then increment the revision by 1 and\n"
                  "    * finally output the result as a Debian-compatible version string.\n"
                  "\n"
                  "Storing the created package in an APT repository will ensure that they are\n"
                  "picked up by apt-get update && apt-get upgrade.\n" %
                  (highlight("--read-version"), highlight("--parse-version-format"),
                   highlight("--new-version"), highlight("--version-action"),
                   highlight("--help-versioner=[%s]" % ", ".join(versioners.keys())),
                   highlight("--parse-version-format"), highlight("--new-version"),
                   highlight("%major"), highlight("%minor"), highlight("%patch"), highlight("%revision"),
                   highlight("debian"), highlight("semver"),
                   highlight("Semantic Versioning (http://semver.org/)"),
                   highlight("keep version strings constant for release versions"),
                   highlight("--version-action"), highlight("increment-epoch"),
                   highlight("increment-patch"), highlight("increment-revision"), highlight("none"),
                   highlight("aptly")))

        parser.exit()
<commit_msg>start rewriting the versioner help page for the new process<commit_after># -* encoding: utf-8 *-

import argparse

from gopythongo.utils import highlight


class VersionerHelpAction(argparse.Action):
    def __init__(self,
                 option_strings,
                 dest,
                 default=None,
                 choices=None,
                 help="Show help for GoPythonGo versioners."):
        super(VersionerHelpAction, self).__init__(option_strings=option_strings, dest=dest, default=default, nargs="?",
                                                  choices=choices, help=help)

    def __call__(self, parser, namespace, values, option_string=None):
        from gopythongo.versioners import versioners
        if values in versioners.keys():
            versioners[values].print_help()
        else:
            print("Versioners\n"
                  "==========\n"
                  "\n"
                  "Versioners are responsible for reading a version string from a source. What the\n"
                  "source is, depends on the versioner.\n"
                  "\n"
                  "You specify how to read a version using %s and split it into its parts using\n"
                  "%s. The target version is then specified using %s,\n"
                  "which can be optionally modified by setting %s.\n"
                  "\n"
                  "If you want more information on the available versioners and their supported\n"
                  "methods, you want to use %s.\n"
                  "You can find out more about version parsers whic"
                  "\n"
                  "Version format strings\n"
                  "----------------------\n"
                  "\n"
                  "%s and %s support the following placeholders:\n"
                  "\n"
                  "    %s    - identifies the major version number (2 in '5:2.3.4-1')\n"
                  "    %s    - identifies the minor version number (3 in '5:2.3.4-1')\n"
                  "    %s    - identifies the patch version number (4 in '5:2.3.4-1')\n"
                  "    %s - identifies the revision number (1 in '5:2.3.4-1')\n"
                  "\n"
                  "You can also use the following predefined version formats for both input and\n"
                  "output:\n"
                  "\n"
                  "    %s - reads a Debian version string\n"
                  "    %s - reads a SemVer version string\n"
                  "\n"
                  "Please note that while this setup is pretty flexible, it far from delivers\n"
                  "everything you could ever ask for in a version string. Instead it's completely\n"
                  "oriented towards supporting %s. While\n"
                  "also supporting package Epochs which are easy to use for pushing out new\n"
                  "development versions of packages to staging systems. If you need additional\n"
                  "flexibility, don't hesitate to write your own Versioner for GoPythonGo.\n"
                  "\n"
                  "Version actions\n"
                  "---------------\n"
                  "\n"
                  "Typically you want to read a version string and then modify it in some way. I\n"
                  "recommend that you %s, but\n"
                  "create automatically incremented version strings for development versions which\n"
                  "are automatically distributed to your staging/development systems. GoPythonGo\n"
                  "can modify version strings through %s, which supports the\n"
                  "following parameter values:\n"
                  "\n"
                  "    %s - increment the version string epoch\n"
                  "    %s - increment the version string patch level\n"
                  "    %s - increment the version string revision\n"
                  "    %s - do nothing to the version string (the default)\n"
                  "\n"
                  "This action will be performed before creating the new version string by the\n"
                  "versioner processing the new version string. For example: The %s versioner,\n"
                  "when faced with the 'increment-epoch' action, will first find out the highest\n"
                  "Epoch value in its repository, then increment that Epoch by 1 and then create\n"
                  "the new version string. For more details, please look at the help pages of the\n"
                  "individual versioners.\n"
                  "\n"
                  "Best practice\n"
                  "-------------\n"
                  "\n"
                  "A good start is to read the version from your Python project so you have a\n"
                  "central point where you change the version. Make sure that your development\n"
                  "model changes the version string according to SemVer when you make a new\n"
                  "release. For example when using git flow, you change the version every time\n"
                  "you create a new release branch.\n"
                  "\n"
                  "Then you just have to make sure that your packaging system will recognize the\n"
                  "automatically incremented new version string as newer than the last one. I like\n"
                  "to use the following configuration for my development branches:\n"
                  "\n"
                  "    --read-version='pymodule:myproject:__version__' \\\n"
                  "    --parse-version-format='semver' \\\n"
                  "    --version-action='increment-revision' \\\n"
                  "    --new-version='aptly:debian'\n"
                  "\n"
                  "This will:\n"
                  "\n"
                  "    * read the __version__ attribute from the Python module myproject in the\n"
                  "      current PYTHONPATH,\n"
                  "    * then parse this value as a SemVer formatted version,\n"
                  "    * then find the highest revision in the current package repository,\n"
                  "    * then increment the revision by 1 and\n"
                  "    * finally output the result as a Debian-compatible version string.\n"
                  "\n"
                  "Storing the created package in an APT repository will ensure that they are\n"
                  "picked up by apt-get update && apt-get upgrade.\n" %
                  (highlight("--read-version"), highlight("--version-parser"),
                   highlight("--new-version"), highlight("--version-action"),
                   highlight("--help-versioner=[%s]" % ", ".join(versioners.keys())),
                   highlight("--parse-version-format"), highlight("--new-version"),
                   highlight("%major"), highlight("%minor"), highlight("%patch"), highlight("%revision"),
                   highlight("debian"), highlight("semver"),
                   highlight("Semantic Versioning (http://semver.org/)"),
                   highlight("keep version strings constant for release versions"),
                   highlight("--version-action"), highlight("increment-epoch"),
                   highlight("increment-patch"), highlight("increment-revision"), highlight("none"),
                   highlight("aptly")))

        parser.exit()

{'fraction_non_alphanumeric': 0.09758238789843328, 'fraction_numerical': 0.0037817396002160996, 'mean_word_length': 1.4217497955846279, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '957910', 'n_tokens_mistral': 3645, 'n_tokens_neox': 3370, 'n_words': 1308}