summaryrefslogtreecommitdiff
path: root/client/__init__.py
blob: 1ac18cde8d498bc9292368bb712d0d926641141d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# coding=utf-8

import multiprocessing.managers

__all__ = ['get_session_by_id', 'get_or_create_session']

class CodeqManager(multiprocessing.managers.BaseManager):
    pass

CodeqManager.register('PrologSession')
CodeqManager.register('UserSession')
#CodeqManager.register('get_session_by_id')
#CodeqManager.register('get_or_create_session')
#CodeqManager.register('authenticate_and_create_session')
#CodeqManager.register('list_problems_in_groups')
CodeqManager.register('Codeq')

m = CodeqManager(address=('localhost', 16231), authkey=b'c0d3q3y')
m.connect()
codeq = m.Codeq()

def get_session_by_id(sid):
#    return m.get_session_by_id(sid)
    return codeq.get_session_by_id(sid)

def get_or_create_session(uid, username, sid=None):
#    return m.get_or_create_session(uid, username, sid)
    return codeq.get_or_create_session(uid, username, sid)

def authenticate_and_create_session(username, password):
#    return m.authenticate_and_create_session(username, password)
    return codeq.authenticate_and_create_session(username, password)

def list_problems_in_groups(language):
#    return m.list_problems_in_groups(language)
    return codeq.list_problems_in_groups(language)