<commit_before># Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import collections

from slave.recipe_config import List
from slave.recipe_config import config_item_context, ConfigGroup, Dict, Single
from slave.recipe_config_types import Path
from slave.recipe_util import Placeholder


def BaseConfig(**_kwargs):
  def render_cmd(lst):
    return [(x if isinstance(x, Placeholder) else str(x)) for x in lst]

  return ConfigGroup(
    name = Single(str),
    cmd = List(inner_type=(int,basestring,Path,Placeholder),
               jsonish_fn=render_cmd),

    # optional
    env = Dict(item_fn=lambda (k, v): (k, str(v)),
               value_type=(basestring,int,Path,type(None))),
    cwd = Single(Path, jsonish_fn=str, required=False),

    stdout = Single(Placeholder, required=False),
    stderr = Single(Placeholder, required=False),
    stdin = Single(Placeholder, required=False),

    abort_on_failure = Single(bool, required=False),
    allow_subannotations = Single(bool, required=False),
    always_run = Single(bool, required=False),
    can_fail_build = Single(bool, required=False),
    skip = Single(bool, required=False),

    seed_steps = List(basestring),
    followup_fn = Single(collections.Callable, required=False),

    step_test_data = Single(collections.Callable, required=False),
  )


config_ctx = config_item_context(BaseConfig, {'_DUMMY': ['val']}, 'example')<commit_msg>Step name should be a basestring instead of str.<commit_after># Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import collections

from slave.recipe_config import List
from slave.recipe_config import config_item_context, ConfigGroup, Dict, Single
from slave.recipe_config_types import Path
from slave.recipe_util import Placeholder


def BaseConfig(**_kwargs):
  def render_cmd(lst):
    return [(x if isinstance(x, Placeholder) else str(x)) for x in lst]

  return ConfigGroup(
    name = Single(basestring),
    cmd = List(inner_type=(int,basestring,Path,Placeholder),
               jsonish_fn=render_cmd),

    # optional
    env = Dict(item_fn=lambda (k, v): (k, str(v)),
               value_type=(basestring,int,Path,type(None))),
    cwd = Single(Path, jsonish_fn=str, required=False),

    stdout = Single(Placeholder, required=False),
    stderr = Single(Placeholder, required=False),
    stdin = Single(Placeholder, required=False),

    abort_on_failure = Single(bool, required=False),
    allow_subannotations = Single(bool, required=False),
    always_run = Single(bool, required=False),
    can_fail_build = Single(bool, required=False),
    skip = Single(bool, required=False),

    seed_steps = List(basestring),
    followup_fn = Single(collections.Callable, required=False),

    step_test_data = Single(collections.Callable, required=False),
  )


config_ctx = config_item_context(BaseConfig, {'_DUMMY': ['val']}, 'example')
{'fraction_non_alphanumeric': 0.10832791151594014, 'fraction_numerical': 0.002602472348731295, 'mean_word_length': 4.694444444444445, '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': '6260912', 'n_tokens_mistral': 959, 'n_tokens_neox': 926, 'n_words': 247}