# Path: antioch/core/tasks.py
# def get_exchange(ctx=None):
# def authenticate(username, password, ip_address):
# def deploy(user_id, source):
# def login(user_id, session_id, ip_address):
# def logout(user_id):
# def parse(user_id, sentence):
# def registertask(user_id, delay, origin_id, verb_name, args, kwargs):
# def runtask(user_id, task_id):
# def iteratetasks():
# 
# Path: antioch/core/code.py
# def is_frame_access_allowed():
# def massage_verb_code(code):
# def parse_deployment(source):
# def r_eval(caller, src, environment={}, filename='<string>', runtype="eval"):
#     def _writer(s, is_error=False):
# def r_exec(caller, src, environment={}, filename='<string>', runtype="exec"):
#     def _writer(s, is_error=False):
# def restricted_import(name, gdict, ldict, fromlist, level=-1):
# def get_protected_attribute(obj, name, g=getattr):
# def set_protected_attribute(obj, name, value, s=setattr):
# def inplace_var_modification(operator, a, b):
# def get_restricted_environment(writer, p=None):
#         def _call_print(self, s):
#         def __init__(self, obj):
#         def __setattr__(self, name, value):
#         def __setitem__(self, key, value):
# def run_system_verb(exchange, verb_name, *args, **kwargs):
# def api(func):
#     def _api(p):
#         def __api(*args, **kwargs):
# def task(p, delay, origin, verb_name, *args, **kwargs):
# def execute(p, code):
# def evaluate(p, code):
# def tasks(p):
# def write(p, user, text, is_error=False, escape_html=True):
# def log(p, text, is_error=False):
# def broadcast(p, text, escape_html=True):
# def observe(p, user, observations):
# def count_named(p, key):
# def get_object(p, key, return_list=False):
# def create_object(p, name, unique_name=False):
# def get_last_client_ip(p, player):
#     class _print_(object):
#     class _write_(object):


import logging
from celery import shared_task
from antioch.core import tasks, code
# antioch
# Copyright (c) 1999-2019 Phil Christensen
#
#
# See LICENSE for details






log = logging.getLogger(__name__)

@shared_task
def addplayer(name, passwd, enabled=True):
    log.debug("Creating a player for %r" % name)
    with tasks.get_exchange() as x:
        user = code.run_system_verb(x, 'add_player', name=name, passwd=passwd, enabled=enabled)

    return user.id

@shared_task
def enableplayer(player_id):

# Path: antioch/core/tasks.py
# def get_exchange(ctx=None):
# def authenticate(username, password, ip_address):
# def deploy(user_id, source):
# def login(user_id, session_id, ip_address):
# def logout(user_id):
# def parse(user_id, sentence):
# def registertask(user_id, delay, origin_id, verb_name, args, kwargs):
# def runtask(user_id, task_id):
# def iteratetasks():
# 
# Path: antioch/core/code.py
# def is_frame_access_allowed():
# def massage_verb_code(code):
# def parse_deployment(source):
# def r_eval(caller, src, environment={}, filename='<string>', runtype="eval"):
#     def _writer(s, is_error=False):
# def r_exec(caller, src, environment={}, filename='<string>', runtype="exec"):
#     def _writer(s, is_error=False):
# def restricted_import(name, gdict, ldict, fromlist, level=-1):
# def get_protected_attribute(obj, name, g=getattr):
# def set_protected_attribute(obj, name, value, s=setattr):
# def inplace_var_modification(operator, a, b):
# def get_restricted_environment(writer, p=None):
#         def _call_print(self, s):
#         def __init__(self, obj):
#         def __setattr__(self, name, value):
#         def __setitem__(self, key, value):
# def run_system_verb(exchange, verb_name, *args, **kwargs):
# def api(func):
#     def _api(p):
#         def __api(*args, **kwargs):
# def task(p, delay, origin, verb_name, *args, **kwargs):
# def execute(p, code):
# def evaluate(p, code):
# def tasks(p):
# def write(p, user, text, is_error=False, escape_html=True):
# def log(p, text, is_error=False):
# def broadcast(p, text, escape_html=True):
# def observe(p, user, observations):
# def count_named(p, key):
# def get_object(p, key, return_list=False):
# def create_object(p, name, unique_name=False):
# def get_last_client_ip(p, player):
#     class _print_(object):
#     class _write_(object):


# Path: antioch/plugins/signup/tasks.py
import logging
from celery import shared_task
from antioch.core import tasks, code

# antioch
# Copyright (c) 1999-2019 Phil Christensen
#
#
# See LICENSE for details






log = logging.getLogger(__name__)

@shared_task
def addplayer(name, passwd, enabled=True):
    log.debug("Creating a player for %r" % name)
    with tasks.get_exchange() as x:
        user = code.run_system_verb(x, 'add_player', name=name, passwd=passwd, enabled=enabled)

    return user.id

@shared_task
def enableplayer(player_id):

    with tasks.get_exchange() as x: