<commit_before>#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import bindings as bi
import sys
PY3 = sys.version_info[0] == 3
str_type = str if PY3 else (str, unicode)

# ----------------------------------------------------------------------------------------------------------------------
#   Generate per-model classes
# ----------------------------------------------------------------------------------------------------------------------

def gen_module(schema, algo):
    help_preamble = help_preamble_for(algo)
    help_epilogue = help_epilogue_for(algo)
    help_afterword = help_afterword_for(algo)
    model_name = algo_to_modelname(algo)
    help_example = help_example_for(algo)
    help_return = help_return_for(algo)
    help_references = help_references_for(algo)
    class_extra = class_extra_for(algo)

    yield "# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_R.py"
    yield "# Copyright 2016 H2O.ai;  Apache License Version 2.0 (see LICENSE for details) \n#'"
    yield "# -------------------------- %s -------------------------- #" % model_name
    if help_preamble:
        lines = help_preamble.split("\n")
        for line in lines:
            yield "#' %s" % line.lstrip()
    yield "#'"
    yield "#' @param x A vector containing the \code{character} names of the predictors in the model."
    yield "#'        If x is missing,then all columns except y are used."
    yield "#' @param y The name of the response variable in the model."
    for param in schema["parameters"]:
        if param["name"] == "ignored_columns" or param["name"] == "response_column":
            continue;
        phelp = param["help"]
        if param["type"] == "boolean":
            phelp = "\code{Logical}. " + phelp
        if param["values"]:
            phelp += " Must be one of: %s." % ", ".join('"%s"' % p for p in param["values"])
        if param["default_value"] is not None:
            phelp += " Defaults to %s." % param["default_value"]
        yield "#' @param %s %s" % (param["name"], bi.wrap(phelp, indent=("#'        "), indent_first=False))
    if help_return:
        yield "#' @return %s" % bi.wrap(help_return, indent=("#'          "), indent_first=False)
    if help_epilogue:
        yield "#' @seealso %s" % bi.wrap(help_epilogue, indent=("#'          "), indent_first=False)
    if help_references:
        #lines = help_references.split("\n")
        #for line in lines:
        #    yield "#' %s" % line.lstrip()
        yield "#' @references %s" % bi.wrap(help_references, indent=("#'             "), indent_first=False)
    if help_example:
        lines = help_example.split("\n")
        for line in lines:
            yield "#' %s" % line.lstrip()
    yield "#' @export"<commit_msg>Fixed missing @examples (#404)<commit_after>#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import bindings as bi
import sys
PY3 = sys.version_info[0] == 3
str_type = str if PY3 else (str, unicode)

# ----------------------------------------------------------------------------------------------------------------------
#   Generate per-model classes
# ----------------------------------------------------------------------------------------------------------------------

def gen_module(schema, algo):
    help_preamble = help_preamble_for(algo)
    help_epilogue = help_epilogue_for(algo)
    help_afterword = help_afterword_for(algo)
    model_name = algo_to_modelname(algo)
    help_example = help_example_for(algo)
    help_return = help_return_for(algo)
    help_references = help_references_for(algo)
    class_extra = class_extra_for(algo)

    yield "# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_R.py"
    yield "# Copyright 2016 H2O.ai;  Apache License Version 2.0 (see LICENSE for details) \n#'"
    yield "# -------------------------- %s -------------------------- #" % model_name
    if help_preamble:
        lines = help_preamble.split("\n")
        for line in lines:
            yield "#' %s" % line.lstrip()
    yield "#'"
    yield "#' @param x A vector containing the \code{character} names of the predictors in the model."
    yield "#'        If x is missing,then all columns except y are used."
    yield "#' @param y The name of the response variable in the model."
    for param in schema["parameters"]:
        if param["name"] == "ignored_columns" or param["name"] == "response_column":
            continue;
        phelp = param["help"]
        if param["type"] == "boolean":
            phelp = "\code{Logical}. " + phelp
        if param["values"]:
            phelp += " Must be one of: %s." % ", ".join('"%s"' % p for p in param["values"])
        if param["default_value"] is not None:
            phelp += " Defaults to %s." % param["default_value"]
        yield "#' @param %s %s" % (param["name"], bi.wrap(phelp, indent=("#'        "), indent_first=False))
    if help_return:
        yield "#' @return %s" % bi.wrap(help_return, indent=("#'          "), indent_first=False)
    if help_epilogue:
        yield "#' @seealso %s" % bi.wrap(help_epilogue, indent=("#'          "), indent_first=False)
    if help_references:
        #lines = help_references.split("\n")
        #for line in lines:
        #    yield "#' %s" % line.lstrip()
        yield "#' @references %s" % bi.wrap(help_references, indent=("#'             "), indent_first=False)
    if help_example:
        yield "#' @examples"
        lines = help_example.split("\n")
        for line in lines:
            yield "#' %s" % line.lstrip()
    yield "#' @export"
{'fraction_non_alphanumeric': 0.23070050035739814, 'fraction_numerical': 0.005897069335239456, 'mean_word_length': 1.9105564222568903, 'pattern_counts': {'":': 4, '<': 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': '3679086', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1631, 'n_words': 436}