<commit_before>def action(fn):
	"""The @action decorator
	"""
	fn._action = True
	return fn

def tested(date):
	"""Marks the last time this method has been tested.
        """
	def decorator(fn):
		fn._tested = date
		return fn
	return decorator

def broken(fn):
	"""Marks an action as 'broken', to ease tracking
	"""
	fn._action = True
	fn._broken = True
	return fn

def genom_request(module, request, args = None, wait_for_completion = True, abort = False, callback=None):
	return {"middleware": "pocolibs",
            "module": module,
            "request": request,
            "args": args,
	    "abort": abort,
	    "wait_for_completion": wait_for_completion,
	    "callback": callback}

def background_task(taskclass, args = None, wait_for_completion = True, abort = False, callback=None):
	return {"middleware": "python",
            "class": taskclass,
            "args": args,
	    "abort": abort,
	    "wait_for_completion": wait_for_completion,
	    "callback": callback}

def ros_request(client, goal, wait_for_completion = True, callback = None):
	return {"middleware": "ros",
            "client": client,
            "goal": goal,
	    "wait_for_completion": wait_for_completion,
	    "callback": callback}

def add_knowledge(stmts):
	return [{"middleware": "knowledge",
            "action": "add",
	    "args": stmts}]

def retract_knowledge(stmts):
	return [{"middleware": "knowledge",
            "action": "retract",
	    "args": stmts}]

def wait(seconds):
	""" This special action simply waits for a given amount of second before 
	sending the next action.
	"""
	return {"middleware": "special",
            "action": "wait",
            "args": seconds}

<commit_msg>genom actions: simplify declaration of callbacks<commit_after>def action(fn):
	"""The @action decorator
	"""
	fn._action = True
	return fn

def tested(date):
    """Marks the last time this method has been tested.
        """
    def decorator(fn):
        fn._tested = date
        return fn
    return decorator

def broken(fn):
    """Marks an action as 'broken', to ease tracking
    """
    fn._action = True
    fn._broken = True
    return fn

def genom_request(module, request, args = None, wait_for_completion = True, abort = False, callback=None):
    if callback:
        wait_for_completion = False

    return {"middleware": "pocolibs",
            "module": module,
            "request": request,
            "args": args,
        "abort": abort,
        "wait_for_completion": wait_for_completion,
        "callback": callback}

def background_task(taskclass, args = None, wait_for_completion = True, abort = False, callback=None):
	return {"middleware": "python",
            "class": taskclass,
            "args": args,
	    "abort": abort,
	    "wait_for_completion": wait_for_completion,
	    "callback": callback}

def ros_request(client, goal, wait_for_completion = True, callback = None):
	return {"middleware": "ros",
            "client": client,
            "goal": goal,
	    "wait_for_completion": wait_for_completion,
	    "callback": callback}

def add_knowledge(stmts):
	return [{"middleware": "knowledge",
            "action": "add",
	    "args": stmts}]

def retract_knowledge(stmts):
	return [{"middleware": "knowledge",
            "action": "retract",
	    "args": stmts}]

def wait(seconds):
	""" This special action simply waits for a given amount of second before 
	sending the next action.
	"""
	return {"middleware": "special",
            "action": "wait",
            "args": seconds}


{'fraction_non_alphanumeric': 0.13078014184397163, 'fraction_numerical': 0.0, 'mean_word_length': 3.043577981651376, 'pattern_counts': {'":': 54, '<': 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': '2717720', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1051, 'n_words': 313}