def main():
    """test logic for when running this module as the primary one!"""

    ## pass the namespace you test again (your dev namespace or production)
    test_namespace = 'ibelyaev-dev'

    #search test case
    args = {'experimentID': '106', 'platformID':'84', 'metaboliteID':'4349', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.search(args)
    
    # list test case
    args = {'experimentID': '106', 'platformID':'84', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.list(args)
def main():
    """test logic for when running this module as the primary one!"""

    ## pass the namespace you test again (your dev namespace or production)
    test_namespace = 'ibelyaev-dev'

    #search
    args = {'experimentID': '106', 'platformID':'100', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.search(args)
    param_map = rb.build_param_map(args, 'search')
    log.info("Param Map:")
    log.info(param_map)

    # list
    args = {'experimentID': '106', '_url': 'https://api.araport.org/community/v0.3', '_namespace': test_namespace}
    driver.list(args)
Exemple #3
0
def p_x_y(attr, team):
    numOfGames = len(main.list(team))
    with open(team +'data.csv', 'r') as csvfile:
        next(csvfile)
        read = csv.reader(csvfile, delimiter=' ', quotechar=',')
        given_win = 0
        given_loss = 0
        notxgivenwin = 0
        notxgivenloss = 0
        for row in read:
            # This grabs a certain column and reads how many times it happens
            for word in row:

                word = word.split(",")

                for i in range(len(row)): #

                    if '1' in word[attr] and '1' in word[-1]:
                        given_win += 1
                    if '1' in word[attr] and '0' in word[-1]:
                        given_loss += 1
                    if '0' in word[attr] and '1' in word[-1]:
                        notxgivenwin += 1
                    if '0' in word[attr] and '0' in word[-1]:
                        notxgivenloss += 1

        p_not_x_y = given_loss / numOfGames
        p_x_y = given_win / numOfGames
        not_p_x_y = notxgivenwin / numOfGames
        not_p_not_x_y = notxgivenloss / numOfGames

    return p_x_y, p_not_x_y#p_not_x_y
Exemple #4
0
def bulk():
    teamname()
    team = main.teamname1()
    #createTrainingCSV()
    #Writes out first line with team name
    #createCSV(team)

    list = main.list(team)
    for item in list:

        html = requests.get(item).text
        soup = BeautifulSoup(html, 'html5lib')
        # GRAB ALL STAT INFO
        for td_tag in soup.find_all('td'):
            each_stat = td_tag.text
            stats.append(each_stat)
            stat = [x.replace('\t', '').replace('\n', '') for x in stats]

        teamstats(team)
        appendCSV(team)
        del stats[:]
        del team1list[:]
        del team2list[:]
        #del stat[:]

    team2 = main.teamname2()


    list = main.list(team2)
    for item in list:

        html = requests.get(item).text
        soup = BeautifulSoup(html, 'html5lib')
        # GRAB ALL STAT INFO
        for td_tag in soup.find_all('td'):
            each_stat = td_tag.text
            stats.append(each_stat)
            stat = [x.replace('\t', '').replace('\n', '') for x in stats]
        #print(stat)
        teamstats(team2)
        appendCSV(team2)
        del stats[:]
        del team1list[:]
        del team2list[:]

#bulk()
Exemple #5
0
async def work1():
    url = "wss://sprs.herokuapp.com/first/" + SessionID
    async with websockets.connect(url) as websocket:

        await websocket.send("Let's start")
        response = await websocket.recv()
        print(f"\n>Request: Let's start \n<Response: {response}")

        temp = response.split(" ")
        bWidth = int(temp[0])
        bHeight = int(temp[1])
        numAmount = int(temp[2])

        width = bWidth * hScale
        height = bHeight * vScale

        temp = str(hScale) + " " + str(vScale) + " " + str(level) + " " + str(
            length) + " on"

        await websocket.send(temp)
        response = await websocket.recv()
        print(f"\n>Request: {temp} \n<Response: collected")

        dictionary = m.list(m.parseEven(response, 0, 0), numAmount,
                            width * height)

        for step in range(0, length):
            await websocket.send("Ready")
            response = await websocket.recv()
            print(
                f"\n>Request: Ready \n<Response: Task-{step + 1} \n{response}\n"
            )
            x = m.parseEven(response, step)

            probs = []
            if (level == 0):
                answer = m.find(x, dictionary)
            elif (level == 1):
                answer = m.find(m.invert(x), dictionary)
            else:
                for k in range(0, numAmount):
                    a = m.best(x, dictionary[k], level)
                    probs.append(a)
                answer = m.maxInd(probs)

            await websocket.send(f"{step + 1} {answer}")
            response = await websocket.recv()
            print(
                f"\n>Request: answer - {answer} \n<Response: correct - {response}"
            )

        await websocket.send("Bye")
        response = await websocket.recv()
        print(f"\n>Request: Bye \n<Response: {response}")

        input("Press enter...")
Exemple #6
0
def prob_of_win(team):
    numOfGames = len(main.list(team))
    if team == main.teamname1():

        with open(main.teamname1()+'data.csv', 'r') as csvfile:
            next(csvfile)
            read = csv.reader(csvfile, delimiter=' ', quotechar=',')
            wins = 0
            for row in read:

                for word in row:
                    #print(word)
                    word = word.split(",")
                    #print(word)
                    if '1' in word[-1]:
                        wins += 1
            chances = ((wins / numOfGames) + 0.5) / 2
            #print(chances)
            prob_win.append(chances)
            return (chances)
    else:
        with open(main.teamname2()+'data.csv', 'r') as csvfile:
            next(csvfile)
            read = csv.reader(csvfile, delimiter=' ', quotechar=',')
            wins = 0
            for row in read:

                for word in row:
                    #print(word)
                    word = word.split(",")
                    #print(word)
                    if '1' in word[-1]:
                        wins += 1

            #print(((wins / numOfGames) + 0.5) / 2)
            return (((wins / numOfGames) + 0.5) / 2)
Exemple #7
0
def test_ensure_xor_addition():
    assert program.list([1, 1]) + program.list([1, 1]) == program.list([0, 0])
Exemple #8
0
def test_normal_additon():
    assert program.list([1, 0]) + program.list([0, 1]) == program.list([1, 1])
Exemple #9
0
def test_list(app):
    # need datastore emulator
    with app.test_request_context():
        res = main.list(flask.request)
        data = json.loads(res)
        assert isinstance(data, list)
Exemple #10
0
team1list = []
team2list = []
probabilities = []
winner_is = []
points = []
less_likely_to_lose = []
teamnames = []


def teamname1():

    teamname = main.teamname()
    teamnames.append(teamname)


list = main.list()


def createTrainingCSV():
    with open(main.masterlist() + 'data.csv', 'w') as c:
        writer = csv.writer(c,
                            delimiter=' ',
                            quotechar=',',
                            quoting=csv.QUOTE_MINIMAL)
        writer.writerow(main.masterlist())


def createCSV():
    with open(main.teamname() + 'data.csv', 'w') as csvfile:
        writer = csv.writer(csvfile,
                            delimiter=' ',
Exemple #11
0
def ds_list():
    return main.list(request)
Exemple #12
0
import main
import csv
import functools
import grabAttributes

numOfGames = len(main.list())
numOfAttrs = 15
givenwin = []
givenloss = []
list = []
prob_win = []


def p_x_y(attr):
    with open(main.teamname() + 'data.csv', 'r') as csvfile:
        next(csvfile)
        read = csv.reader(csvfile, delimiter=' ', quotechar=',')
        given_win = 0
        given_loss = 0
        notxgivenwin = 0
        notxgivenloss = 0
        for row in read:
            # This grabs a certain column and reads how many times it happens
            for word in row:

                word = word.split(",")

                for i in range(len(row)):  #

                    if '1' in word[attr] and '1' in word[-1]:
                        given_win += 1
Exemple #13
0

class message:
    def reply_text(self, date):
        print(date)


class from_user:
    pass


class bot:
    def sendMessage(self, x, *, text):
        print('send message to ', x, ' : ', text)


from datetime import datetime, timedelta

from_user.username = '******'
from_user.id = 1895
message.from_user = from_user()
message.chat_id = 1895
update.message = message()
message.date = datetime.now() + timedelta(days=1)
message.text = 'text test5'
t = update()

#main.start(bot(),t,['psw'])
#main.record(bot(),t)
main.list(bot(), t, [])