<commit_before>import sys
import json
import uuid
import logging

from boto.swf.layer1 import Layer1
from boto.swf.layer1_decisions import Layer1Decisions
from boto.swf.exceptions import SWFTypeAlreadyExistsError, SWFResponseError

from flowy.workflow import _UnhandledActivityError


__all__ = ['ActivityClient', 'WorkflowClient']


class SWFClient(object):
    """ A simple wrapper around Boto's SWF Layer1 that provides a cleaner
    interface and some convenience.

    """

    def __init__(self, domain, task_list, client=None):
        """ Initialize and bind the client to a *domain* and a *task_list*.

        A custom :py:class:`boto.swf.Layer1` instance can be sent as the
        *client* argument and it will be used instead of the default one.

        """
        self.client = client if client is not None else Layer1()
        self.domain = domain
        self.task_list = task_list
        self._scheduled_activities = []

    def register_workflow(self, name, version, workflow_runner,
                          execution_start_to_close=3600,
                          task_start_to_close=60,
                          child_policy='TERMINATE',
                          doc=None):
        """ Register a workflow with the given configuration options.

        If a workflow with the same *name* and *version* is already registered,
        this method returns a boolean indicating whether the registered
        workflow is compatible. A compatible workflow is a workflow that was
        registered using the same default values. The total workflow running
        time can be specified in seconds using *execution_start_to_close* and a
        specific decision task runtime can be limited by setting
        *task_start_to_close*.

        """
        version = str(version)
        execution_start_to_close = str(execution_start_to_close)
        task_start_to_close = str(task_start_to_close)
        try:
            self.client.register_workflow_type(self.domain, name, version,<commit_msg>Added external reference to boto and moved __init__ documentation.<commit_after>import sys
import json
import uuid
import logging

from boto.swf.layer1 import Layer1
from boto.swf.layer1_decisions import Layer1Decisions
from boto.swf.exceptions import SWFTypeAlreadyExistsError, SWFResponseError

from flowy.workflow import _UnhandledActivityError


__all__ = ['ActivityClient', 'WorkflowClient']


class SWFClient(object):
    """ A simple wrapper around Boto's SWF Layer1 that provides a cleaner
    interface and some convenience.

    Initialize and bind the client to a *domain* and a *task_list*.  A custom
    :py:class:`boto.swf.layer1.Layer1` instance can be sent as the *client*
    argument and it will be used instead of the default one.

    """
    def __init__(self, domain, task_list, client=None):
        self.client = client if client is not None else Layer1()
        self.domain = domain
        self.task_list = task_list
        self._scheduled_activities = []

    def register_workflow(self, name, version, workflow_runner,
                          execution_start_to_close=3600,
                          task_start_to_close=60,
                          child_policy='TERMINATE',
                          doc=None):
        """ Register a workflow with the given configuration options.

        If a workflow with the same *name* and *version* is already registered,
        this method returns a boolean indicating whether the registered
        workflow is compatible. A compatible workflow is a workflow that was
        registered using the same default values. The total workflow running
        time can be specified in seconds using *execution_start_to_close* and a
        specific decision task runtime can be limited by setting
        *task_start_to_close*.

        """
        version = str(version)
        execution_start_to_close = str(execution_start_to_close)
        task_start_to_close = str(task_start_to_close)
        try:
            self.client.register_workflow_type(self.domain, name, version,
{'fraction_non_alphanumeric': 0.059011556429800834, 'fraction_numerical': 0.006638800098352594, 'mean_word_length': 2.8161350844277675, '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': '713800', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1050, 'n_words': 377}