def ittr():
        global minute
        global counter
        global timeer
        minuts = int(minute.get())

        if counter:
            if timeer >= minuts * 60000:
                timeer = 0
                auto(user)
                view_my_fav()
                window.after(1000, ittr)
            else:
                timeer += 1000
                label_6.config(text=f'Iteration time remaining: {(minuts * 60000 - timeer)//1000}')
                label_6.place(x=320, y=380)
                window.after(1000, ittr)
Ejemplo n.º 2
0
def send_text():
    while True:
        try:
            # 질병관리청 Text Check
            if article_check()[0] == 'True':
                print(1)
                break

            # 공공데이터포털 Api
            else:
                api_data = api()
                api_data['response']['body']['items']['item'][37]
                print(2)
                break
        except IndexError:
            print(3)
            time.sleep(60)

    auto()
Ejemplo n.º 3
0
 def parseAuto(self):
     doc = xml.dom.minidom.parse(self.filename)
     autos = doc.getElementsByTagName("auto")
     for Auto in autos:
         id = Auto.getAttribute("id")
         mark = Auto.getAttribute("mark")
         cost = Auto.getAttribute("cost")
         case_cost = Auto.getAttribute("case_cost")
         typ = Auto.getAttribute("typ")
         newauto = auto(mark, cost, case_cost, typ)
         newauto.setId(id)
         self.autosList[id] = newauto
     print(self.autosList)
Ejemplo n.º 4
0
            log('capture:%s/%s.bmp' % (path, hwnd))
            capture(path, handle=hwnd, x0=x0, y0=y0, w=_w, h=_h)
            try:
                pos = match(waitmatch=path + '/%s.bmp' % hwnd,
                            example=path + '/' + 'block.png')
            except Exception as e:
                log('%s' % e)
            if pos != None:
                move_click(x=pos[0] + x0, y=pos[1] + y0, hwnd=hwnd)
                log('点击%s,%s' % (pos[0] + x0, pos[1] + y0))
                last = t
                t = time()
                if t - last <= 3:
                    capture(path, handle=hwnd)
                    pos = match(waitmatch=path + '/%s.bmp' % hwnd,
                                example=path + '/' + 'block.png')
                    if pos != None:
                        move_click(position=pos, hwnd=hwnd)
                        log('点击%s,%s' % (pos[0] + x0, pos[1] + y0))
            else:
                capture(path, handle=hwnd)
                pos = match(waitmatch=path + '/%s.bmp' % hwnd,
                            example=path + '/' + 'block.png')
                if pos != None:
                    move_click(position=pos, hwnd=hwnd)
                    log('点击%s,%s' % (pos[0] + x0, pos[1] + y0))


if __name__ == '__main__':
    auto(Capture, LunHuiHuanJing, path)
Ejemplo n.º 5
0
    O7 = f" {((np.array2string(Core[10,:,:]).replace('[','')).replace(newline,tabline)).replace(']]','')}"
    G = open("Flux_shaping.std", 'r')
    writestr = eval(f'f"""{G.read()}"""')
    G.close()
    F = open(f"{filename}", 'w')
    F.write(writestr)
    F.close()
    print(f"{rod} rods were used")
    return (Core)


Core = np.zeros((12, 13, 13), int)
for x, y in [(1, 1), (4, 1), (8, 1), (11, 1), (6, 2), (3, 3), (9, 3), (1, 4),
             (6, 4), (11, 4), (2, 6), (4, 6), (8, 6), (10, 6), (1, 8), (6, 8),
             (11, 8), (3, 9), (9, 9), (6, 10), (1, 11), (4, 11), (8, 11),
             (11, 11)]:
    Core[:, x, y] = 2
Core[:, 6, 6] = 3
Core[Core == 0] = 1

for coreset in range(0, 20):

    if coreset == 0:
        prevfilename = "Full_Tally_24.csm"
        filename = f"Optimization_{coreset}.i"
    else:
        prevfilename = f"Optimization_{coreset-1}_Tally_24.csm"
        filename = f"Optimization_{coreset}.i"
    Core = Coreadjust(filename, prevfilename, Core)
    auto()
Ejemplo n.º 6
0
from client import client
from auto import auto
from case import case
c = client("gleb", "nazemnov", "adnr", "moscow", "97436395762037")
a = auto("bmw", "101202012", 1414, "sport")
ca = case(c, a, "22.22.22", "22.22.22")
print(c)
print(a)
Ejemplo n.º 7
0
    y[i]=float(y[i])
    x[i]=float(x[i])#*(3600)
#    z[i]=1/float(z[i])**2
z=None
nykvist=1/(2*(x[2]-x[1]))
print nykvist
#[y,f]=aband.aband(x,y,1000,z,0.0001,0.0021,3,0.0005,0.0015)
[y]=aband.aband(x,y,z,num,0.1*nykvist,nykvist,2,0.4*nykvist,0.4*nykvist)
[f,p,a,b]=aft.aft(x,y,z,0.1*nykvist,nykvist,num)
f=multiply(1000,f)
subplot(3,3,1)

qq=[]
uu=[]
for i in range(10,len(f)/10): 
 qq.append(auto.auto(f,p,i))
 uu.append(i*(f[2]-f[1])) 


plot(p,f)
ylabel('correlation')
title('Low-pass 0.1-0.4 $f_{nykvist}$ Sun')
legend()

[x,y,z]=opendata.opendata(data=da)
y=submean.submean(y)
for i in range(len(x)):
    y[i]=float(y[i])
    x[i]=float(x[i])#*(3600)
#    z[i]=1/float(z[i])**2
z=None
Ejemplo n.º 8
0
 xny[i]=xny[i]/(24)

a=0
for i in range(len(tf)):
 if tf[i]> tf[a]:
  a=i
print'-------------------------------'
print tf[a]
print '------------------------------'
b=0
for i in range(a-4):
 if tf[i]> tf[b] and abs(i-a)>7:
  b=i
print (xny[a]-xny[b])
for i in range(4,len(tf)-10):
 qq.append(auto.auto(xny,tf,i))
 uu.append(i*(xny[2]-xny[1]))
c=0
for i in range(len(qq)):
 if qq[i]>qq[c]:
  c=i
#for j in range(len(qq))
# qq[j]=qq[j]*qq[j]*qq[j]
#print 'tra lala'
#print uu[c]/6*365
#[f,p,l,k]=aft.aft(xny,tf,None,1,10000,10000)
#print f[:32]
#print p[:32]
#for i in range(len(x)):
# x[i]=x[i]/365
Ejemplo n.º 9
0
from auto import auto


class camper(auto):
    pass


# inizia il programma chiamante

if __name__ == "__main__":

    pippo = camper("pippo", "Ford", "Transit", 2500, 1600, "giallo")

    marco = auto("marco", "fiat", "Bravo", 2500, 200, "verde")

    print(pippo.scheda())
    print(marco.scheda())
Ejemplo n.º 10
0
def process(msg, group=False):
    #if msg['FromUserName'] == my_glob.me:
    #    return
    #msg['RemarkName'] = my_glob.UserName_to_name(msg['FromUserName'])
    #if msg['RemarkName'] == None:
    #    print("No remark name for this person. Returned.")
    #    return
    if time.time() - my_glob.last_save_time > 300:
        my_glob.params.write_all()
        my_glob.last_save_time = time.time()
    msg['Text'] = msg['Text'].rstrip(".").rstrip(u"。")  ##
    if msg['FromUserName'] == my_glob.me and msg['Text'].startswith("$"):
        command(msg['Text'][1:])
        return
    if my_glob.params.get("time", msg['FromUserName']):
        if my_glob.params.get("mode", msg['FromUserName']) == "shutup" and (
                time.time() - my_glob.params.get("time", msg['FromUserName']) >
                18000.0):  ## If shutup, reset after 5 hrs instead of 20 mins
            fundamental.mysend(
                u"上次閉嘴時間為%d分鐘前,超過五小時,已重置。\n" % int(
                    (time.time() -
                     my_glob.params.get("time", msg['FromUserName'])) / 60),
                msg['FromUserName'])
            my_glob.params.set(task="mode",
                               UserName=msg['FromUserName'],
                               value=None)
        elif my_glob.params.get("mode", msg['FromUserName']) != "shutup" and (
                time.time() - my_glob.params.get("time", msg['FromUserName']) >
                1200.0):
            fundamental.mysend(
                u"您上次玩耍時間為%d秒前,超過二十分鐘,已重置。\n" %
                (time.time() -
                 my_glob.params.get("time", msg['FromUserName'])),
                msg['FromUserName'])
            my_glob.params.set(
                task="mode", UserName=msg['FromUserName'], value=None
            )  # It's possible that someone stopped choosing the mode and then time elapsed for more than 10 min, so initialize mode
    my_glob.params.set(task="time", UserName=msg['FromUserName'])
    if (len(msg['Text']) <= 3
            and msg['Text'].startswith(u"停")) or msg['Text'].upper(
            ).startswith("F**K") or msg['Text'].upper().startswith(
                "STOP") or u"[On Fire]" in msg['Text'] or u"傻逼" in msg['Text']:
        fundamental.mysend("[Silence][Distressed]", msg['FromUserName'])
        return
    if (my_glob.params.get(task="mode", UserName=msg['FromUserName']) is
            None) or msg['Text'] in my_glob.change_chinese:
        if group:
            fundamental.mysend("#GREETING1#", msg['FromUserName'],
                               msg)  # If group
        else:
            fundamental.mysend("#GREETING1#", msg['FromUserName'])
        my_glob.params.set(task="mode",
                           UserName=msg['FromUserName'],
                           value="CHANGE")
        my_glob.params.set(
            task="params",
            UserName=msg['FromUserName'],
            value=None,
            mode="stock"
        )  # If change mode from stock, need to reset stock ticker # The set function takes care of the case with no stock
        return
    if my_glob.params.get(task="mode",
                          UserName=msg['FromUserName']) == "shutup":
        if (u"機器人" in msg['Text'] and
            (u"出來" in msg['Text'] or u"回來" in msg['Text']
             or u"出現" in msg['Text'])) or (
                 u"机器人" in msg['Text'] and
                 (u"出来" in msg['Text'] or u"回来" in msg['Text']
                  or u"出现" in msg['Text'])) or (u"機器人呢" in msg['Text']) or (
                      u"机器人呢" in msg['Text']) or (msg['Text'] in [
                          u"召唤", u"召喚", u"召回", u"召唤!", u"召喚!", u"召回!", u"召唤!",
                          u"召喚!", u"召回!"
                      ]):
            fundamental.mysend(u"我在這呢!\n要我回來,請說換!", msg['FromUserName'])
        return
    if msg['Text'].startswith(u"闭嘴") or msg['Text'].startswith(
            u"閉嘴") or msg['Text'].startswith(u"收皮"):
        my_glob.params.set("mode", msg['FromUserName'], value="shutup")
        fundamental.mysend(my_glob.modes_greeting["shutup"],
                           msg['FromUserName'])
        return
    if msg['Text'] == u"我":
        fundamental.mysend(
            u"你是" + (my_glob._to_NN(msg['FromUserName']) or u"誰?"),
            msg['FromUserName'])
        return
    if msg['Text'] == u"你":
        fundamental.mysend(u"我是小" + your_name + "!", msg['FromUserName'])
        return
    #if my_glob.params.get(task="mode", UserName=msg['FromUserName']) == "CHANGE":
    for mode in [
            "chat", "google_translate", "chiuman", "weather", "stock", "mw",
            "ytenx", "wiki"
    ]:  ## In any mode, if user input is a mode name, switch to that mode
        if msg['Text'] == str(
                my_glob.modes_indices[mode]
        ) or msg['Text'] in my_glob.modes_alt_names[mode]:
            my_glob.params.set("mode", msg['FromUserName'], mode)
            if mode == "stock":  # If stock, send indices first and then greeting
                fundamental.mysend(stock.get_indices(), msg['FromUserName'])
            fundamental.mysend(my_glob.modes_greeting[mode] +
                               u"\n(此後更換模式請輸入「換」,或直接輸入模式名)",
                               msg['FromUserName'])  # Send greeting
            if mode == "chiuman":  # If chiuman, send greeting first and then start stories
                fundamental.mysend(chiuman.chiuman(msg), msg['FromUserName'])
            return
    if msg['Text'] == str(
            my_glob.modes_indices["shutup"]
    ):  ## In any mode, if user input is a mode name, switch to that mode
        my_glob.params.set("mode", msg['FromUserName'], value="shutup")
        fundamental.mysend(
            my_glob.modes_greeting["shutup"] + u"\n(此後更換模式請輸入「換」,或直接輸入模式名)",
            msg['FromUserName'])
        return
    elif msg['Text'] == str(
            my_glob.modes_indices["reverse"]
    ) or msg['Text'] in my_glob.modes_alt_names[
            "reverse"]:  ## In any mode, if user input is a mode name, switch to that mode
        my_glob.params.set("mode", msg['FromUserName'], value="reverse")
        try:
            to = my_glob._to_NN(msg['FromUserName'])  ## Individual friend chat
        except:
            try:
                to = msg['ActualNickName']  ## Group chat
            except:
                to = u"客官"
        fundamental.mysend((u"好的," + to)[::-1] + u"\n(此後更換模式請輸入「換」,或直接輸入模式名)",
                           msg['FromUserName'])
        return
    elif msg['Text'] == str(
            my_glob.modes_indices["twitter"]
    ) or msg['Text'] in my_glob.modes_alt_names[
            "twitter"]:  ## In any mode, if user input is a mode name, switch to that mode
        my_glob.params.set("mode", msg['FromUserName'], value="twitter")
        try:
            userlangs = [
                my_glob.lang_names[la] for la in my_glob.params.get(
                    "params", msg['FromUserName'], "lang")
            ]
        except:
            userlangs = [u"中文", u"英語"]
        fundamental.mysend(
            my_glob.modes_greeting["twitter"] %
            (u"、".join(userlangs[:-1]) + u"和" + userlangs[-1]) +
            u"\n(此後更換模式請輸入「換」,或直接輸入模式名)", msg['FromUserName'])
        return
    elif my_glob.params.get(
            task="mode", UserName=msg['FromUserName']
    ) == "CHANGE":  ## If user really is in the change mode but entered wrong input
        if msg['Text'] == "0":
            fundamental.mysend(
                u"[Smile]你自己就是個0吧[Smile]說了讓你輸1-%s![Smile]" %
                (len(my_glob.modes) - 1), msg['FromUserName'])
            return
        elif msg['Text'] == str(len(my_glob.modes)):
            fundamental.mysend(
                u"[Smile]你以為我不知道你輸了" + str(len(my_glob.modes)) + u"?[Smile]",
                msg['FromUserName'])
            return
        else:  # Really wrong input
            fundamental.mysend("#GREETING2#", msg['FromUserName'])
            return
        #my_glob.params.set("params", msg['FromUserName'], None) # Not sure why this was here
        return  # Can return here if user is meant to change mode
    # Otherwise, continue with the current mode
    if my_glob.params.get("mode", msg['FromUserName']) == "chat":
        send_text = auto.auto(msg)
    elif my_glob.params.get("mode", msg['FromUserName']) == "google_translate":
        send_text = translate.google_translate(msg)
    elif my_glob.params.get("mode", msg['FromUserName']) == "chiuman":
        send_text = chiuman.chiuman(msg)
    elif my_glob.params.get("mode", msg['FromUserName']) == "reverse":
        send_text = reverse(msg)
    elif my_glob.params.get("mode", msg['FromUserName']) == "weather":
        send_text = my_weather.weather(msg)
    elif my_glob.params.get("mode", msg['FromUserName']) == "stock":
        send_text = stock.get_stock(msg)
    elif my_glob.params.get("mode", msg['FromUserName']) == "twitter":
        twitter.good_lang = (my_glob.params.get("params", msg['FromUserName'],
                                                "lang") or ["zh", "en"])
        send_text = twitter.tweet()
    elif my_glob.params.get("mode", msg['FromUserName']) == "mw":
        send_text = mw.lookup(msg['Text'])
    elif my_glob.params.get("mode", msg['FromUserName']) == "ytenx":
        res = ytenx.ytenx(msg['Text'])
        for send_text in res:
            if send_text != "":
                fundamental.mysend(send_text, msg['FromUserName'])
    elif my_glob.params.get(
            "mode", msg['FromUserName']
    ) == "wiki":  ## Immediately reset after wiki is done so that user will not search again by mistake
        try:
            send_text = safe_exec("wiki.wiki(msg)", msg)
        except:
            send_text = u"維基百科抓取失敗。"
        signal.alarm(0)
        fundamental.mysend(send_text + u"\n已為您重置回主菜單。", msg['FromUserName'])
        my_glob.params.set(task="mode",
                           UserName=msg['FromUserName'],
                           value="CHANGE")
        if group:
            fundamental.mysend("#GREETING1#", msg['FromUserName'],
                               msg)  # If group
        else:
            fundamental.mysend("#GREETING1#", msg['FromUserName'])
        return
    fundamental.mysend(send_text, msg['FromUserName'])
Ejemplo n.º 11
0
def _data():
    rows = auto()
    lst = sorted(rows.all, key=lambda z: z.doms(rows))
    for row in lst[:5] + lst[-5:]:
        print(row.id, row.doms(rows), [row[g.pos] for g in rows.goals])