<commit_before>/*ckwg +5
 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#include <vistk/pipeline/schedule.h>
#include <vistk/pipeline/schedule_exception.h>

#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

/**
 * \file schedule.cxx
 *
 * \brief Python bindings for \link vistk::schedule\endlink.
 */

using namespace boost::python;

static void translator(vistk::schedule_exception const& e);

class wrap_schedule
  : public vistk::schedule
  , public wrapper<vistk::schedule>
{
  public:
    wrap_schedule(vistk::config_t const& config, vistk::pipeline_t const& pipe);
    ~wrap_schedule();

    void start();
    void wait();
    void stop();
};

BOOST_PYTHON_MODULE(schedule)
{
  register_exception_translator<
    vistk::schedule_exception>(translator);

  class_<wrap_schedule, boost::noncopyable>("PythonSchedule"
    , no_init)
    .def(init<vistk::config_t, vistk::pipeline_t>())
    .def("start", pure_virtual(&vistk::schedule::start))
    .def("wait", pure_virtual(&vistk::schedule::wait))
    .def("stop", pure_virtual(&vistk::schedule::stop))
  ;
}

void
translator(vistk::schedule_exception const& e)
{<commit_msg>Add docstrings to schedule bindings<commit_after>/*ckwg +5
 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#include <vistk/pipeline/schedule.h>
#include <vistk/pipeline/schedule_exception.h>

#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

/**
 * \file schedule.cxx
 *
 * \brief Python bindings for \link vistk::schedule\endlink.
 */

using namespace boost::python;

static void translator(vistk::schedule_exception const& e);

class wrap_schedule
  : public vistk::schedule
  , public wrapper<vistk::schedule>
{
  public:
    wrap_schedule(vistk::config_t const& config, vistk::pipeline_t const& pipe);
    ~wrap_schedule();

    void start();
    void wait();
    void stop();
};

BOOST_PYTHON_MODULE(schedule)
{
  register_exception_translator<
    vistk::schedule_exception>(translator);

  class_<wrap_schedule, boost::noncopyable>("PythonSchedule"
    , "The base class for Python schedules."
    , no_init)
    .def(init<vistk::config_t, vistk::pipeline_t>())
    .def("start", pure_virtual(&vistk::schedule::start)
      , "Start the execution of the pipeline.")
    .def("wait", pure_virtual(&vistk::schedule::wait)
      , "Wait until the pipeline execution is complete.")
    .def("stop", pure_virtual(&vistk::schedule::stop)
      , "Stop the execution of the pipeline.")
  ;
}

void
translator(vistk::schedule_exception const& e)
{
{'fraction_non_alphanumeric': 0.1344364012409514, 'fraction_numerical': 0.008273009307135471, 'mean_word_length': 4.922448979591837, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '500764', 'n_tokens_mistral': 983, 'n_tokens_neox': 928, 'n_words': 213}