How to use dispose method in Playwright Python

Best Python code snippet using playwright-python

DisposeBeanText.py

Source:DisposeBeanText.py Github

copy

Full Screen

1import json2from paohuan.DaHuaInterfaceUtil import huishou_path3from paohuan.DisposeBean import TalkBean4"""5在这里添加任务信息6"""7# list = []8# list.append(DisposeBean(1, '王秀才博学多才,代我问下他考研补?', 'wangxiucai.jpg', '王秀才', 530, 172, '长安城(199,72)').__dict__)9# list.append(DisposeBean(1, '听说疯牛怪,患有疯牛病,你给他送一个羚羊角过去探望一下。', 'fengniuguai.jpg', '疯牛怪', 533, 332, '狮驼岭(34,58)').__dict__)10# list.append(DisposeBean(1, '何小姐,说自己很喜欢萧举人,一直在等待他的表白。', 'hexiaojie.jpg', '何小姐', 235, 225, '洛阳城(63,130)').__dict__)11# list.append(DisposeBean(1, '胡巧儿的杂技出神入化啊,你要不要去看看。', 'huqiaoer.jpg', '胡巧儿', 296, 175, '洛阳城(154,95)').__dict__)12# list.append(DisposeBean(1, '听说黄火牛前几天被人打了,你去看看他伤势如何。', 'huanghuoniu.jpg', '黄火牛', 285, 262, '洛阳城(256,13)').__dict__)13# list.append(DisposeBean(1, '天灯老人每当想去女儿就会哭啼不止,你去问候一下吧。', 'tiandenglaoren.jpg', '天灯老人', 279, 290, '长安城(80,138)').__dict__)14# list.append(DisposeBean(1, '长安的衙役因为最近站岗太郁闷,开导一下他。', 'yayi.jpg', '衙役', 305, 265, '长安城(126,13)').__dict__)15# list.append(DisposeBean(1, '渔村村长说统计民普,你去找他报个名吧。', 'yucuncunzhang.jpg', '渔村村长', 312, 283, '东海渔村(30,17)').__dict__)16# list.append(DisposeBean(1, '李老九说希望在有生之年见到大侠。你不妨去见见他吧。', 'lilaojiu.jpg', '李老九', 300, 266, '长安城(16,135)').__dict__)17# list.append(DisposeBean(1, '渔村的乞丐心里想念亲人,你去问候下给他点人情温暖。', 'qigai.jpg', '乞丐', 577, 180, '东海渔村(43,52)').__dict__)18# list.append(DisposeBean(1, '传闻袁天罡知道前生来世,又是可以去找到他。', 'yuantiangang.jpg', '袁天罡', 284, 270, '长安城(138,44)').__dict__)19# list.append(DisposeBean(1, '小黑说,想找个人聊聊天,你去陪陪她吧。', 'xiaohei.jpg', '小黑', 309, 419, '长寿村(14,145)').__dict__)20# list.append(DisposeBean(1, '听说玉狐仙说,你去查明情况。', 'yuhuxian.jpg', '玉狐仙', 378, 366, '普陀山(15,55)').__dict__)21# list.append(DisposeBean(1, '玄奘前些天嘱咐说有事找你,你赶快过去看看。', 'xuanzang.jpg', '玄奘', 442, 158, '玄空僧房(14,14)').__dict__)22# list.append(DisposeBean(1, '问问洛阳的胡大力打听下百晓生的下落。', 'hudali.jpg', '胡大力', 302, 316, '洛阳城(232,21)').__dict__)23# list.append(DisposeBean(1, '桃园土地,说最近郁闷想找你聊聊。', 'pantaoyuantudi.jpg', '桃园土地', 278, 224, '蟠桃园(15,49)').__dict__)24# list.append(DisposeBean(1, '陈老才,说他想传授你,生意经你赶快去吧。', 'chenlaocai.jpg', '陈老才', 341, 281, '长寿村(46,70)').__dict__)25# list.append(DisposeBean(1, '牛头,说今夜要勾老贾的魂魄,你速去阻止一下吧。', 'niutou.jpg', '牛头', 311, 275, '地狱迷宫2(25,15)').__dict__)26# list.append(DisposeBean(1, '老猴精年事已高身体抱恙,你带上旋复花去看看他吧。', 'laohoujing.jpg', '老猴精', 325, 279, '五指山(21,43)').__dict__)27# list.append(DisposeBean(1, '马面,说想让自己变帅气点,你去找他讨论下。', 'mamian.jpg', '马面', 88, 262, '地狱迷宫4(6,19)').__dict__)28# list.append(DisposeBean(1, '陈夫人说老贾喜欢他,可惜一直等不到老贾的表白,然后生气不见老贾。', 'chenfuren.jpg', '陈夫人', 325, 279, '长安城(44,124)').__dict__)29# list.append(DisposeBean(1, '萧举人,说自己很喜欢何小姐,但是苦于表白,你去看看吧。', 'xiaojuren.jpg', '萧举人', 560, 240, '洛阳城(63,130)').__dict__)30# list.append(DisposeBean(1, '顶天柱,说要向你请教如何训练铁砂掌,你不妨去看看', 'dingtianzhu.jpg', '顶天柱', 269, 265, '洛阳城(198,69)').__dict__)31# list.append(DisposeBean(1, '顶天柱前几天表演弄伤身体了,帮我送点金创药给他。', 'dingtianzhu1.jpg', '顶天柱', 269, 265, '洛阳城(198,69)').__dict__)32# list.append(DisposeBean(1, '何老才,在收集羚羊角,你买一个送给他吧。', 'helaocai.jpg', '何老才', 296, 256, '洛阳城(248,118)').__dict__)33# list.append(DisposeBean(1, '游方术士,说想收门徒苦于找不到徒弟,你去帮助他一下吧。', 'youfangshushi.jpg', '游方术士', 282, 247, '方寸山(21,23)').__dict__)34# list.append(DisposeBean(1, '五指山土,地说找你有点事情,你去看看吧。', 'wuzhishantudi.jpg', '五指山土地', 467, 270, '五指山(163,43)').__dict__)35# list.append(DisposeBean(1, '鲁大婶,最近很苦恼你去问问为何如此苦恼。', 'ludashen.jpg', '鲁大婶', 331, 213, '洛阳城(157,138)').__dict__)36# list.append(DisposeBean(1, '前几天洛阳桥发生挤压,游客受到了惊吓,你去看看那吧。', 'youke.jpg', '游客', 332, 235, '洛阳城(175,102)').__dict__)37# list.append(DisposeBean(1, '满堂春,在找亲父你有什么消息赶快告诉他吧。', 'mantangchun.jpg', '满堂春', 307, 261, '洛阳城(214,113)').__dict__)38#39# list.append(DisposeBean(2, '梅花仙,说自己想要个簪子,你买一个送给他吧。', 'meihuaxian.jpg', '梅花仙', 300, 252, '长安东(64,26)').__dict__)40# list.append(DisposeBean(2, '秦琼在找一件拿手的武器,你去买一把长枪送给他。', 'qinqiong.jpg', '秦琼', 559, 174, '长安城(255,52)').__dict__)41# list.append(DisposeBean(2, '老贾想学习武艺,一直头痛找不到铁拳套,你去买个送给他吧。', 'laojia.jpg', '老贾', 292, 255, '长安东(34,36)').__dict__)42# list.append(DisposeBean(2, '庞夫人前几天看上了一件布裙,你买个他当做礼物吧。', 'pangfuren.jpg', '庞夫人', 329, 270, '长安城(24,91)').__dict__)43# list.append(DisposeBean(2, '情花仙子的鞋子丢了,正为此事发愁呢,你去买双布鞋送给他。', 'qinghuaxianzi.jpg', '情花仙子', 210, 383, '东海渔村(43,52)').__dict__)44#45# list.append(DisposeBean(3, '蟠桃神灵偷吃了蟠桃去教训他一番。', 'shenling.jpg', '神灵', 558, 110, '蟠桃园(81,85)').__dict__)46# list.append(DisposeBean(3, '蟠桃神灵偷吃了蟠桃去教训他一番。', 'shenling1.jpg', '神灵', 558, 110, '蟠桃园(81,85)').__dict__)47# list.append(DisposeBean(3, '蟠桃女娲偷吃了蟠桃去教训他一番。', 'nvwa.jpg', '女娲', 172, 480, '蟠桃园(81,85)').__dict__)48# list.append(DisposeBean(3, '蟠桃女娲偷吃了蟠桃去教训他一番。', 'nvwa1.jpg', '女娲', 172, 480, '蟠桃园(81,85)').__dict__)49# list.append(DisposeBean(3, '蟠桃凤凰偷吃了蟠桃去教训他一番。', 'fenghuang.jpg', '凤凰', 228, 266, '蟠桃园(39,68)').__dict__)50# list.append(DisposeBean(3, '蟠桃凤凰偷吃了蟠桃去教训他一番。', 'fenghuang1.jpg', '凤凰', 228, 266, '蟠桃园(39,68)').__dict__)51# str = json.dumps(list).encode('utf-8').decode('unicode_escape')52# with open(file_path + 'TaskProfile.txt', 'w', encoding='utf-8') as f:53# f.write(str)54# list = []55# list.append(FlightBean(1, 1, 1, '长安城(199,72)', 15).__dict__)56# list.append(FlightBean(1, 1, 2, '长安城(138,44)', 10).__dict__)57# list.append(FlightBean(1, 1, 3, '长安城(126,13)', 83).__dict__)58# list.append(FlightBean(1, 1, 4, '长安城(16,135)', 95).__dict__)59# list.append(FlightBean(1, 1, 5, '长安城(44,124)', 90).__dict__)60# list.append(FlightBean(1, 1, 6, '长安城(80,138)', 14).__dict__)61#62# list.append(FlightBean(1, 2, 1, '长安城(24,91)', 18).__dict__)63# list.append(FlightBean(1, 2, 2, '长安城(255,52)', 87).__dict__)64# list.append(FlightBean(1, 2, 3, '洛阳城(256,13)', 10).__dict__)65# list.append(FlightBean(1, 2, 4, '洛阳城(232,21)', 18).__dict__)66# list.append(FlightBean(1, 2, 5, '洛阳城(154,95)', 95).__dict__)67# list.append(FlightBean(1, 2, 6, '洛阳城(175,102)', 91).__dict__)68#69# list.append(FlightBean(1, 3, 1, '洛阳城(214,113)', 9).__dict__)70# list.append(FlightBean(1, 3, 2, '洛阳城(157,138)', 90).__dict__)71# list.append(FlightBean(1, 3, 3, '洛阳城(63,130)', 30).__dict__)72# list.append(FlightBean(1, 3, 4, '洛阳城(248,118)', 17).__dict__)73# list.append(FlightBean(1, 3, 5, '洛阳城(198,69)', 93).__dict__)74# list.append(FlightBean(1, 3, 6, '蟠桃园(15,49)', 95).__dict__)75#76# list.append(FlightBean(1, 4, 1, '蟠桃园(81,85)', 99).__dict__)77# list.append(FlightBean(1, 4, 2, '蟠桃园(39,68)', 38).__dict__)78# list.append(FlightBean(1, 4, 3, '东海渔村(30,17)', 98).__dict__)79# list.append(FlightBean(1, 4, 4, '东海渔村(43,52)', 98).__dict__)80# list.append(FlightBean(1, 4, 5, '长安东(34,36)', 9).__dict__)81# list.append(FlightBean(1, 4, 6, '长安东(64,26)', 3).__dict__)82#83# list.append(FlightBean(2, 1, 1, '长寿村(46,70)', 9).__dict__)84# list.append(FlightBean(2, 1, 2, '长寿村(14,145)', 3).__dict__)85# list.append(FlightBean(2, 1, 3, '地狱迷宫2(25,15)', 18).__dict__)86# list.append(FlightBean(2, 1, 4, '地狱迷宫4(6,19)', 10).__dict__)87# list.append(FlightBean(2, 1, 5, '五指山(163,43)', 8).__dict__)88# list.append(FlightBean(2, 1, 6, '五指山(21,43)', 12).__dict__)89#90# list.append(FlightBean(2, 2, 1, '普陀山(15,55)', 1).__dict__)91# list.append(FlightBean(2, 2, 2, '方寸山(21,23)', 95).__dict__)92# list.append(FlightBean(2, 2, 3, '玄空僧房(14,14)', 8).__dict__)93# list.append(FlightBean(2, 2, 4, '狮驼岭(34,58)', 10).__dict__)94#95# list.append(FlightBean(2, 3, 2, '备用棋', 99).__dict__)96# list.append(FlightBean(2, 3, 3, '备用棋', 99).__dict__)97# list.append(FlightBean(2, 3, 4, '备用棋', 99).__dict__)98# list.append(FlightBean(2, 3, 5, '备用棋', 99).__dict__)99# list.append(FlightBean(2, 3, 6, '备用棋', 99).__dict__)100#101# list.append(FlightBean(2, 4, 1, '备用棋', 99).__dict__)102# list.append(FlightBean(2, 4, 2, '备用棋', 99).__dict__)103# list.append(FlightBean(2, 4, 3, '备用棋', 99).__dict__)104# list.append(FlightBean(2, 4, 4, '备用棋', 99).__dict__)105# list.append(FlightBean(2, 4, 5, '备用棋', 99).__dict__)106# list.append(FlightBean(2, 4, 6, '备用棋', 99).__dict__)107#108# str = json.dumps(list).encode('utf-8').decode('unicode_escape')109# with open(file_path + 'FlightChessProfile.txt', 'w', encoding='utf-8') as f:110# f.write(str)111# list = []112# list.append(TalkBean(2, '这长安城中有一大雁塔,听说里面镇压了十万妖魔,要是没有两把刷子可别进去送死。', 'talk_2_1.jpg', ).__dict__)113# list.append(TalkBean(2, '在我所知道的关于孙悟空的故事中,他在一万多年里持续与天地神佛为敌,这到底是为什么呢?究竟为了什么,他要破坏三界的平衡?', 'talk_2_2.jpg', ).__dict__)114# list.append(TalkBean(2, '我们狮驼岭有三位大王,大大王能吞十万天兵,二大王一身铜身铁臂,三大王搏风运雾,谁人能敌?', 'talk_2_3.jpg', ).__dict__)115# list.append(TalkBean(0, '', 'talk_0_1.jpg', ).__dict__)116# str = json.dumps(list).encode('utf-8').decode('unicode_escape')117# with open(file_path + 'TalkProfile.txt', 'w', encoding='utf-8') as f:118# f.write(str)119# list = []120# list.append(FlightBean(1, 1, 1, '长安城(199,72)', 15).__dict__)121# list.append(FlightBean(1, 1, 2, '备用棋', 99).__dict__)122# list.append(FlightBean(1, 1, 3, '备用棋', 99).__dict__)123# list.append(FlightBean(1, 1, 4, '备用棋', 99).__dict__)124# list.append(FlightBean(1, 1, 5, '备用棋', 99).__dict__)125#126# myClassReBuild = json.loads(read_ispose(file_path + 'FlightChessProfile.txt'))127# flight_chess_datas = []128# for letter in myClassReBuild:129# flight_chess_datas.append(130# FlightBean(letter['goods_position'], letter['goods_position_x'], letter['goods_position_y'],131# letter['flight_chess_info'], letter['times_left']))132# list = []133# for temp in flight_chess_datas:134# list.append(temp.__dict__)135# list.append(FlightBean(2, 3, 5, '备用棋', 99).__dict__)136# list.append(FlightBean(2, 3, 6, '备用棋', 99).__dict__)137#138# list.append(FlightBean(2, 4, 1, '备用棋', 99).__dict__)139# list.append(FlightBean(2, 4, 2, '备用棋', 99).__dict__)140# list.append(FlightBean(2, 4, 3, '备用棋', 99).__dict__)141# list.append(FlightBean(2, 4, 4, '备用棋', 99).__dict__)142# list.append(FlightBean(2, 4, 5, '备用棋', 99).__dict__)143# list.append(FlightBean(2, 4, 6, '备用棋', 99).__dict__)144# str = json.dumps(list).encode('utf-8').decode('unicode_escape')145# with open(file_path + 'FlightChessProfile.txt', 'w', encoding='utf-8') as f:146# f.write(str)147# 怀旧西游148# list = []149# # list.append(DisposeBean(1, '李老九说希望在有生之年见到大侠。你不妨去见见他吧。', 'lilaojiu.jpg', '李老九', 300, 266, '长安城(16,135)').__dict__)150# # list.append(DisposeBean(1, '陈夫人说老贾喜欢他,可惜一直等不到老贾的表白,然后生气不见老贾。', 'chenfuren.jpg', '陈夫人', 326, 282, '长安城(64,112)').__dict__)151# # list.append(DisposeBean(1, '听说黄火牛前几天被人打了,你去看看他伤势如何。', 'huanghuoniu.jpg', '黄火牛', 335, 278, '洛阳城(254,13)').__dict__)152# # list.append(DisposeBean(1, '满堂春,在找亲父你有什么消息赶快告诉他吧。', 'mantangchun.jpg', '满堂春', 337, 297, '洛阳城(213,112)').__dict__)153# # list.append(DisposeBean(1, '长安的衙役因为最近站岗太郁闷,开导一下他。', 'yayi.jpg', '衙役', 242, 306, '长安城(126,13)').__dict__)154# # list.append(DisposeBean(1, '天灯老人每当想去女儿就会哭啼不止,你去问候一下吧。', 'tiandenglaoren.jpg', '天灯老人', 338, 290, '长安城(79,138)').__dict__)155# # list.append(DisposeBean(1, '传闻袁天罡知道前生来世,又是可以去找到他。', 'yuantiangang.jpg', '袁天罡', 284, 270, '长安城(138,44)').__dict__)156# # list.append(DisposeBean(1, '问问洛阳的胡大力打听下百晓生的下落。', 'hudali.jpg', '胡大力', 334, 265, '洛阳城(231,22)').__dict__)157# # list.append(DisposeBean(1, '五指山土,地说找你有点事情,你去看看吧。', 'wuzhishantudi.jpg', '五指山土地', 321, 255, '五指山(167,43)').__dict__)158# # list.append(DisposeBean(1, '萧举人,说自己很喜欢何小姐,但是苦于表白,你去看看吧。', 'xiaojuren.jpg', '萧举人', 572, 240, '洛阳城(63,130)').__dict__)159# # list.append(DisposeBean(1, '小黑说,想找个人聊聊天,你去陪陪她吧。', 'xiaohei.jpg', '小黑', 339, 420, '长寿村(13,145)').__dict__)160# # list.append(DisposeBean(1, '桃园土地,说最近郁闷想找你聊聊。', 'pantaoyuantudi.jpg', '桃园土地', 304, 270, '蟠桃园(13,48)').__dict__)161# # list.append(DisposeBean(1, '何老才,在收集羚羊角,你买一个送给他吧。', 'helaocai.jpg', '何老才', 327, 260, '洛阳城(247,118)').__dict__)162# # list.append(DisposeBean(1, '听说玉狐仙说,你去查明情况。', 'yuhuxian.jpg', '玉狐仙', 384, 366, '普陀山(15,54)').__dict__)163# # list.append(DisposeBean(1, '渔村村长说统计民普,你去找他报个名吧。', 'yucuncunzhang.jpg', '渔村村长', 309, 271, '东海渔村(57,43)').__dict__)164#165# list.append(DisposeBean(1, '王秀才博学多才,代我问下他考研补?', 'wangxiucai.jpg', '王秀才', 530, 172, '长安城(199,72)').__dict__)166# list.append(DisposeBean(1, '听说疯牛怪,患有疯牛病,你给他送一个羚羊角过去探望一下。', 'fengniuguai.jpg', '疯牛怪', 533, 332, '狮驼岭(34,58)').__dict__)167# list.append(DisposeBean(1, '何小姐,说自己很喜欢萧举人,一直在等待他的表白。', 'hexiaojie.jpg', '何小姐', 235, 225, '洛阳城(63,130)').__dict__)168# list.append(DisposeBean(1, '胡巧儿的杂技出神入化啊,你要不要去看看。', 'huqiaoer.jpg', '胡巧儿', 296, 175, '洛阳城(154,95)').__dict__)169# list.append(DisposeBean(1, '渔村的乞丐心里想念亲人,你去问候下给他点人情温暖。', 'qigai.jpg', '乞丐', 577, 180, '东海渔村(43,52)').__dict__)170# list.append(DisposeBean(1, '玄奘前些天嘱咐说有事找你,你赶快过去看看。', 'xuanzang.jpg', '玄奘', 442, 158, '玄空僧房(14,14)').__dict__)171# list.append(DisposeBean(1, '陈老才,说他想传授你,生意经你赶快去吧。', 'chenlaocai.jpg', '陈老才', 341, 281, '长寿村(46,70)').__dict__)172# list.append(DisposeBean(1, '牛头,说今夜要勾老贾的魂魄,你速去阻止一下吧。', 'niutou.jpg', '牛头', 311, 275, '地狱迷宫2(25,15)').__dict__)173# list.append(DisposeBean(1, '老猴精年事已高身体抱恙,你带上旋复花去看看他吧。', 'laohoujing.jpg', '老猴精', 325, 279, '五指山(21,43)').__dict__)174# list.append(DisposeBean(1, '马面,说想让自己变帅气点,你去找他讨论下。', 'mamian.jpg', '马面', 88, 262, '地狱迷宫4(6,19)').__dict__)175# list.append(DisposeBean(1, '顶天柱,说要向你请教如何训练铁砂掌,你不妨去看看', 'dingtianzhu.jpg', '顶天柱', 269, 265, '洛阳城(198,69)').__dict__)176# list.append(DisposeBean(1, '顶天柱前几天表演弄伤身体了,帮我送点金创药给他。', 'dingtianzhu1.jpg', '顶天柱', 269, 265, '洛阳城(198,69)').__dict__)177# list.append(DisposeBean(1, '游方术士,说想收门徒苦于找不到徒弟,你去帮助他一下吧。', 'youfangshushi.jpg', '游方术士', 282, 247, '方寸山(21,23)').__dict__)178# list.append(DisposeBean(1, '鲁大婶,最近很苦恼你去问问为何如此苦恼。', 'ludashen.jpg', '鲁大婶', 331, 213, '洛阳城(157,138)').__dict__)179# list.append(DisposeBean(1, '前几天洛阳桥发生挤压,游客受到了惊吓,你去看看那吧。', 'youke.jpg', '游客', 332, 235, '洛阳城(175,102)').__dict__)180#181# # list.append(DisposeBean(2, '秦琼在找一件拿手的武器,你去买一把长枪送给他。', 'qinqiong.jpg', '秦琼', 336, 321, '长安城(262,48)').__dict__)182# # list.append(DisposeBean(2, '情花仙子的鞋子丢了,正为此事发愁呢,你去买双布鞋送给他。', 'qinghuaxianzi.jpg', '情花仙子', 435, 130, '东海渔村(27,93)').__dict__)183# # list.append(DisposeBean(2, '老贾想学习武艺,一直头痛找不到铁拳套,你去买个送给他吧。', 'laojia.jpg', '老贾', 331, 292, '长安东(45,36)').__dict__)184# # list.append(DisposeBean(2, '梅花仙,说自己想要个簪子,你买一个送给他吧。', 'meihuaxian.jpg', '梅花仙', 329, 302, '长安东(63,26)').__dict__)185#186# list.append(DisposeBean(2, '庞夫人前几天看上了一件布裙,你买个他当做礼物吧。', 'pangfuren.jpg', '庞夫人', 329, 270, '长安城(24,91)').__dict__)187#188# # list.append(DisposeBean(3, '蟠桃神灵偷吃了蟠桃去教训他一番。', 'shenling.jpg', '神灵', 527, 110, '蟠桃园(82,85)').__dict__)189# # list.append(DisposeBean(3, '蟠桃神灵偷吃了蟠桃去教训他一番。', 'shenling1.jpg', '神灵', 527, 110, '蟠桃园(82,85)').__dict__)190# list.append(DisposeBean(3, '蟠桃女娲偷吃了蟠桃去教训他一番。', 'nvwa.jpg', '女娲', 172, 480, '蟠桃园(81,85)').__dict__)191# list.append(DisposeBean(3, '蟠桃女娲偷吃了蟠桃去教训他一番。', 'nvwa1.jpg', '女娲', 172, 480, '蟠桃园(81,85)').__dict__)192# list.append(DisposeBean(3, '蟠桃凤凰偷吃了蟠桃去教训他一番。', 'fenghuang.jpg', '凤凰', 248, 308, '蟠桃园(38,67)').__dict__)193# list.append(DisposeBean(3, '蟠桃凤凰偷吃了蟠桃去教训他一番。', 'fenghuang1.jpg', '凤凰', 248, 308, '蟠桃园(38,67)').__dict__)194# str = json.dumps(list).encode('utf-8').decode('unicode_escape')195# with open(file_path + 'TaskProfile.txt', 'w', encoding='utf-8') as f:196# f.write(str)197# list = []198# list.append(FlightBean(1, 1, 1, '长安城(199,72)', 991).__dict__)199# list.append(FlightBean(1, 1, 2, '长安城(138,44)', 60).__dict__)200# list.append(FlightBean(1, 1, 3, '长安城(126,13)', 68).__dict__)201# list.append(FlightBean(1, 1, 4, '长安城(16,135)', 50).__dict__)202# list.append(FlightBean(1, 1, 5, '长安城(64,112)', 960).__dict__)203# list.append(FlightBean(1, 1, 6, '长安城(79,138)', 959).__dict__)204#205# list.append(FlightBean(1, 2, 1, '长安城(24,91)', 61).__dict__)206# list.append(FlightBean(1, 2, 2, '长安城(262,48)', 68).__dict__)207# list.append(FlightBean(1, 2, 3, '洛阳城(254,13)', 957).__dict__)208# list.append(FlightBean(1, 2, 4, '洛阳城(231,22)', 920).__dict__)209# list.append(FlightBean(1, 2, 5, '洛阳城(153,92)', 970).__dict__)210# list.append(FlightBean(1, 2, 6, '洛阳城(174,101)', 975).__dict__)211#212# list.append(FlightBean(1, 3, 1, '洛阳城(213,112)', 962).__dict__)213# list.append(FlightBean(1, 3, 2, '洛阳城(157,136)', 960).__dict__)214# list.append(FlightBean(1, 3, 3, '洛阳城(63,130)', 931).__dict__)215# list.append(FlightBean(1, 3, 4, '洛阳城(247,118)', 61).__dict__)216# list.append(FlightBean(1, 3, 5, '洛阳城(196,69)', 40).__dict__)217# list.append(FlightBean(1, 3, 6, '蟠桃园(13,48)', 969).__dict__)218#219# list.append(FlightBean(1, 4, 1, '蟠桃园(82,85)', 773).__dict__)220# list.append(FlightBean(1, 4, 2, '蟠桃园(38,67)', 19).__dict__)221# list.append(FlightBean(1, 4, 3, '东海渔村(57,43)', 966).__dict__)222# list.append(FlightBean(1, 4, 4, '东海渔村(112,70)', 958).__dict__)223# list.append(FlightBean(1, 4, 5, '东海渔村(27,93)', 65).__dict__)224# list.append(FlightBean(1, 4, 6, '长安东(45,36)', 58).__dict__)225#226# list.append(FlightBean(2, 1, 1, '长安东(63,26)', 57).__dict__)227# list.append(FlightBean(2, 1, 2, '长寿村(47,70)', 961).__dict__)228# list.append(FlightBean(2, 1, 3, '长寿村(13,145)', 954).__dict__)229# list.append(FlightBean(2, 1, 4, '地狱迷宫2(24,15)', 956).__dict__)230# list.append(FlightBean(2, 1, 5, '地狱迷宫4(6,18)', 961).__dict__)231# list.append(FlightBean(2, 1, 6, '五指山(167,43)', 961).__dict__)232#233# list.append(FlightBean(2, 2, 1, '五指山(21,42)', 57).__dict__)234# list.append(FlightBean(2, 2, 2, '普陀山(15,54)', 965).__dict__)235# list.append(FlightBean(2, 2, 3, '方寸山(19,22)', 959).__dict__)236# list.append(FlightBean(2, 2, 4, '玄空僧房(14,14)', 963).__dict__)237# list.append(FlightBean(2, 2, 5, '狮驼岭(34,58)', 64).__dict__)238# list.append(FlightBean(2, 2, 6, '备用棋', 99).__dict__)239#240# list.append(FlightBean(2, 3, 1, '备用棋', 83).__dict__)241# list.append(FlightBean(2, 3, 2, '备用棋', 69).__dict__)242# list.append(FlightBean(2, 3, 3, '备用棋', 72).__dict__)243# list.append(FlightBean(2, 3, 4, '备用棋', 81).__dict__)244# list.append(FlightBean(2, 3, 5, '备用棋', 74).__dict__)245# list.append(FlightBean(2, 3, 6, '备用棋', 84).__dict__)246#247# list.append(FlightBean(2, 4, 1, '备用棋', 44).__dict__)248# list.append(FlightBean(2, 4, 2, '备用棋', 37).__dict__)249# list.append(FlightBean(2, 4, 3, '备用棋', 17).__dict__)250# list.append(FlightBean(2, 4, 4, '备用棋', 994).__dict__)251# list.append(FlightBean(2, 4, 5, '备用棋', 999).__dict__)252# list.append(FlightBean(2, 4, 6, '备用棋', 993).__dict__)253# str = json.dumps(list).encode('utf-8').decode('unicode_escape')254# with open(file_path + 'FlightChessProfile.txt', 'w', encoding='utf-8') as f:255# f.write(str)256#257# list = []258# list.append(TalkBean(2, '这长安城中有一大雁塔,听说里面镇压了十万妖魔,要是没有两把刷子可别进去送死。', 'talk_2_1.jpg', ).__dict__)259# list.append(TalkBean(2, '在我所知道的关于孙悟空的故事中,他在一万多年里持续与天地神佛为敌,这到底是为什么呢?究竟为了什么,他要破坏三界的平衡?', 'talk_2_2.jpg', ).__dict__)260# list.append(TalkBean(2, '我们狮驼岭有三位大王,大大王能吞十万天兵,二大王一身铜身铁臂,三大王搏风运雾,谁人能敌?', 'talk_2_3.jpg', ).__dict__)261# list.append(TalkBean(2, '铜钱拿着不太方便了,您能否给点银子?银子没有,能不能给点钞票啊?美元也可以啦', 'talk_2_4.jpg', ).__dict__)262# list.append(TalkBean(2, '欢迎您来到大话西游2世界,您可以邀请您的朋友一起回归', 'talk_2_5.jpg', ).__dict__)263# list.append(TalkBean(0, '', 'talk_0_1.jpg', ).__dict__)264# str = json.dumps(list).encode('utf-8').decode('unicode_escape')265# with open(file_path + 'TalkProfile.txt', 'w', encoding='utf-8') as f:266# f.write(str)267# list = []268# list.append(FlightBean(1, 1, 1, '长安城(199,72)', 15).__dict__)269# list.append(FlightBean(1, 1, 2, '备用棋', 99).__dict__)270# list.append(FlightBean(1, 1, 3, '备用棋', 99).__dict__)271# list.append(FlightBean(1, 1, 4, '备用棋', 99).__dict__)272# list.append(FlightBean(1, 1, 5, '备用棋', 99).__dict__)273# myClassReBuild = json.loads(read_ispose(file_path + 'FlightChessProfile.txt'))274# flight_chess_datas = []275# for letter in myClassReBuild:276# flight_chess_datas.append(277# FlightBean(letter['goods_position'], letter['goods_position_x'], letter['goods_position_y'],278# letter['flight_chess_info'], letter['times_left']))279# list = []280# for temp in flight_chess_datas:281# list.append(temp.__dict__)282# # list.append(FlightBean(2, 3, 4, '备用棋', 99).__dict__)283# list.append(FlightBean(2, 3, 5, '备用棋', 99).__dict__)284# list.append(FlightBean(2, 3, 6, '备用棋', 99).__dict__)285#286# list.append(FlightBean(2, 4, 1, '备用棋', 99).__dict__)287# # list.append(FlightBean(2, 4, 2, '备用棋', 99).__dict__)288# # list.append(FlightBean(2, 4, 3, '备用棋', 99).__dict__)289# # list.append(FlightBean(2, 4, 4, '备用棋', 99).__dict__)290# # list.append(FlightBean(2, 4, 5, '备用棋', 99).__dict__)291# # list.append(FlightBean(2, 4, 6, '备用棋', 99).__dict__)292# str = json.dumps(list).encode('utf-8').decode('unicode_escape')293# with open(file_path + 'FlightChessProfile.txt', 'w', encoding='utf-8') as f:294# f.write(str)295# list = []296# list.append(DisposeBean(1, '李老九说希望在有生之年见到大侠。你不妨去见见他吧。', 'lilaojiu.jpg', '李老九', 310, 280, '长安城(16,135)').__dict__)297# list.append(DisposeBean(1, '陈夫人说老贾喜欢他,可惜一直等不到老贾的表白,然后生气不见老贾。', 'chenfuren.jpg', '陈夫人', 326, 282, '长安城(64,112)').__dict__)298# list.append(DisposeBean(1, '听说黄火牛前几天被人打了,你去看看他伤势如何。', 'huanghuoniu.jpg', '黄火牛', 335, 278, '洛阳城(254,13)').__dict__)299# list.append(DisposeBean(1, '满堂春,在找亲父你有什么消息赶快告诉他吧。', 'mantangchun.jpg', '满堂春', 337, 297, '洛阳城(213,112)').__dict__)300# list.append(DisposeBean(1, '长安的衙役因为最近站岗太郁闷,开导一下他。', 'yayi.jpg', '衙役', 242, 306, '长安城(126,13)').__dict__)301# list.append(DisposeBean(1, '天灯老人每当想去女儿就会哭啼不止,你去问候一下吧。', 'tiandenglaoren.jpg', '天灯老人', 338, 290, '长安城(79,138)').__dict__)302# list.append(DisposeBean(1, '传闻袁天罡知道前生来世,又是可以去找到他。', 'yuantiangang.jpg', '袁天罡', 284, 270, '长安城(138,44)').__dict__)303# list.append(DisposeBean(1, '问问洛阳的胡大力打听下百晓生的下落。', 'hudali.jpg', '胡大力', 334, 265, '洛阳城(231,22)').__dict__)304# list.append(DisposeBean(1, '五指山土,地说找你有点事情,你去看看吧。', 'wuzhishantudi.jpg', '五指山土地', 321, 255, '五指山(167,43)').__dict__)305# list.append(DisposeBean(1, '萧举人,说自己很喜欢何小姐,但是苦于表白,你去看看吧。', 'xiaojuren.jpg', '萧举人', 572, 240, '洛阳城(63,130)').__dict__)306# list.append(DisposeBean(1, '小黑说,想找个人聊聊天,你去陪陪她吧。', 'xiaohei.jpg', '小黑', 339, 420, '长寿村(13,145)').__dict__)307# list.append(DisposeBean(1, '桃园土地,说最近郁闷想找你聊聊。', 'pantaoyuantudi.jpg', '桃园土地', 304, 270, '蟠桃园(13,48)').__dict__)308# list.append(DisposeBean(1, '何老才,在收集羚羊角,你买一个送给他吧。', 'helaocai.jpg', '何老才', 327, 260, '洛阳城(247,118)').__dict__)309# list.append(DisposeBean(1, '听说玉狐仙说,你去查明情况。', 'yuhuxian.jpg', '玉狐仙', 384, 367, '普陀山(15,54)').__dict__)310# list.append(DisposeBean(1, '渔村村长说统计民普,你去找他报个名吧。', 'yucuncunzhang.jpg', '渔村村长', 309, 271, '东海渔村(57,43)').__dict__)311# list.append(DisposeBean(1, '王秀才博学多才,代我问下他考研补?', 'wangxiucai.jpg', '王秀才', 532, 196, '长安城(199,72)').__dict__)312# list.append(DisposeBean(1, '渔村的乞丐心里想念亲人,你去问候下给他点人情温暖。', 'qigai.jpg', '乞丐', 336, 270, '东海渔村(112,70)').__dict__)313# list.append(DisposeBean(1, '何小姐,说自己很喜欢萧举人,一直在等待他的表白。', 'hexiaojie.jpg', '何小姐', 247, 225, '洛阳城(63,130)').__dict__)314# list.append(DisposeBean(1, '老猴精年事已高身体抱恙,你带上旋复花去看看他吧。', 'laohoujing.jpg', '老猴精', 328, 300, '五指山(21,42)').__dict__)315# list.append(DisposeBean(1, '陈老才,说他想传授你,生意经你赶快去吧。', 'chenlaocai.jpg', '陈老才', 338, 296, '长寿村(47,70)').__dict__)316# list.append(DisposeBean(1, '鲁大婶,最近很苦恼你去问问为何如此苦恼。', 'ludashen.jpg', '鲁大婶', 320, 265, '洛阳城(157,136)').__dict__)317# list.append(DisposeBean(1, '听说疯牛怪,患有疯牛病,你给他送一个羚羊角过去探望一下。', 'fengniuguai.jpg', '疯牛怪', 533, 332, '狮驼岭(34,58)').__dict__)318# list.append(DisposeBean(1, '顶天柱,说要向你请教如何训练铁砂掌,你不妨去看看', 'dingtianzhu.jpg', '顶天柱', 328, 278, '洛阳城(196,69)').__dict__)319# list.append(DisposeBean(1, '游方术士,说想收门徒苦于找不到徒弟,你去帮助他一下吧。', 'youfangshushi.jpg', '游方术士', 333, 273, '方寸山(19,22)').__dict__)320# list.append(DisposeBean(1, '顶天柱前几天表演弄伤身体了,帮我送点金创药给他。', 'dingtianzhu1.jpg', '顶天柱', 328, 278, '洛阳城(196,69)').__dict__)321# list.append(DisposeBean(1, '玄奘前些天嘱咐说有事找你,你赶快过去看看。', 'xuanzang.jpg', '玄奘', 442, 158, '玄空僧房(14,14)').__dict__)322# list.append(DisposeBean(1, '牛头,说今夜要勾老贾的魂魄,你速去阻止一下吧。', 'niutou.jpg', '牛头', 330, 278, '地狱迷宫2(24,15)').__dict__)323# list.append(DisposeBean(1, '胡巧儿的杂技出神入化啊,你要不要去看看。', 'huqiaoer.jpg', '胡巧儿', 338, 260, '洛阳城(153,92)').__dict__)324# list.append(DisposeBean(1, '前几天洛阳桥发生挤压,游客受到了惊吓,你去看看那吧。', 'youke.jpg', '游客', 333, 257, '洛阳城(174,101)').__dict__)325# list.append(DisposeBean(1, '马面,说想让自己变帅气点,你去找他讨论下。', 'mamian.jpg', '马面', 88, 269, '地狱迷宫4(6,18)').__dict__)326#327# list.append(DisposeBean(2, '秦琼在找一件拿手的武器,你去买一把长枪送给他。', 'qinqiong.jpg', '秦琼', 336, 321, '长安城(262,48)').__dict__)328# list.append(DisposeBean(2, '情花仙子的鞋子丢了,正为此事发愁呢,你去买双布鞋送给他。', 'qinghuaxianzi.jpg', '情花仙子', 435, 130, '东海渔村(27,93)').__dict__)329# list.append(DisposeBean(2, '老贾想学习武艺,一直头痛找不到铁拳套,你去买个送给他吧。', 'laojia.jpg', '老贾', 331, 292, '长安东(45,36)').__dict__)330# list.append(DisposeBean(2, '梅花仙,说自己想要个簪子,你买一个送给他吧。', 'meihuaxian.jpg', '梅花仙', 329, 302, '长安东(63,26)').__dict__)331# list.append(DisposeBean(2, '庞夫人前几天看上了一件布裙,你买个他当做礼物吧。', 'pangfuren.jpg', '庞夫人', 329, 278, '长安城(24,91)').__dict__)332#333# list.append(DisposeBean(3, '蟠桃神灵偷吃了蟠桃去教训他一番。', 'shenling.jpg', '神灵', 527, 110, '蟠桃园(82,85)').__dict__)334# list.append(DisposeBean(3, '蟠桃神灵偷吃了蟠桃去教训他一番。', 'shenling1.jpg', '神灵', 527, 110, '蟠桃园(82,85)').__dict__)335# list.append(DisposeBean(3, '蟠桃凤凰偷吃了蟠桃去教训他一番。', 'fenghuang.jpg', '凤凰', 248, 307, '蟠桃园(38,67)').__dict__)336# list.append(DisposeBean(3, '蟠桃凤凰偷吃了蟠桃去教训他一番。', 'fenghuang1.jpg', '凤凰', 248, 307, '蟠桃园(38,67)').__dict__)337# list.append(DisposeBean(3, '蟠桃女娲偷吃了蟠桃去教训他一番。', 'nvwa.jpg', '女娲', 142, 480, '蟠桃园(82,85)').__dict__)338# list.append(DisposeBean(3, '蟠桃女娲偷吃了蟠桃去教训他一番。', 'nvwa1.jpg', '女娲', 142, 480, '蟠桃园(82,85)').__dict__)339#340# str = json.dumps(list).encode('utf-8').decode('unicode_escape')341# with open(file_path + 'TaskProfile.txt', 'w', encoding='utf-8') as f:342# f.write(str)343# 做天344# list = []345# list.append(FlightBean(1, 1, 1, '李靖', 99).__dict__)346# list.append(FlightBean(1, 1, 2, '三头魔王', 99).__dict__)347# list.append(FlightBean(1, 1, 3, '黑山妖王', 99).__dict__)348# list.append(FlightBean(1, 1, 4, '蓝色妖王', 99).__dict__)349# list.append(FlightBean(1, 1, 5, '万年妖王', 99).__dict__)350# list.append(FlightBean(1, 2, 1, '石破烂', 99).__dict__)351# str = json.dumps(list).encode('utf-8').decode('unicode_escape')352# with open(tian_path + 'ZuoTianFlightChess.txt', 'w', encoding='utf-8') as f:353# f.write(str)354list = []355list.append(TalkBean(1, '亲密丹', 'qinmidan11.jpg', ).__dict__)356list.append(TalkBean(1, '亲密丹', 'qinmidan12.jpg', ).__dict__)357list.append(TalkBean(1, '亲密丹', 'qinmidan13.jpg', ).__dict__)358list.append(TalkBean(1, '亲密丹', 'qinmidan14.jpg', ).__dict__)359list.append(TalkBean(1, '亲密丹', 'qinmidan15.jpg', ).__dict__)360list.append(TalkBean(1, '亲密丹', 'qinmidan16.jpg', ).__dict__)361list.append(TalkBean(1, '亲密丹', 'qinmidan21.jpg', ).__dict__)362list.append(TalkBean(1, '亲密丹', 'qinmidan22.jpg', ).__dict__)363list.append(TalkBean(1, '亲密丹', 'qinmidan23.jpg', ).__dict__)364list.append(TalkBean(1, '亲密丹', 'qinmidan24.jpg', ).__dict__)365list.append(TalkBean(1, '亲密丹', 'qinmidan25.jpg', ).__dict__)366list.append(TalkBean(1, '亲密丹', 'qinmidan26.jpg', ).__dict__)367list.append(TalkBean(1, '亲密丹', 'qinmidan31.jpg', ).__dict__)368list.append(TalkBean(1, '亲密丹', 'qinmidan32.jpg', ).__dict__)369list.append(TalkBean(1, '亲密丹', 'qinmidan33.jpg', ).__dict__)370list.append(TalkBean(1, '亲密丹', 'qinmidan34.jpg', ).__dict__)371list.append(TalkBean(1, '亲密丹', 'qinmidan35.jpg', ).__dict__)372list.append(TalkBean(1, '亲密丹', 'qinmidan36.jpg', ).__dict__)373list.append(TalkBean(1, '亲密丹', 'qinmidan41.jpg', ).__dict__)374list.append(TalkBean(1, '亲密丹', 'qinmidan42.jpg', ).__dict__)375list.append(TalkBean(1, '亲密丹', 'qinmidan43.jpg', ).__dict__)376list.append(TalkBean(1, '亲密丹', 'qinmidan44.jpg', ).__dict__)377list.append(TalkBean(1, '亲密丹', 'qinmidan45.jpg', ).__dict__)378list.append(TalkBean(1, '亲密丹', 'qinmidan46.jpg', ).__dict__)379list.append(TalkBean(1, '血玲珑', 'xuelinglong11.jpg', ).__dict__)380list.append(TalkBean(1, '血玲珑', 'xuelinglong12.jpg', ).__dict__)381list.append(TalkBean(1, '血玲珑', 'xuelinglong13.jpg', ).__dict__)382list.append(TalkBean(1, '血玲珑', 'xuelinglong14.jpg', ).__dict__)383list.append(TalkBean(1, '血玲珑', 'xuelinglong15.jpg', ).__dict__)384list.append(TalkBean(1, '血玲珑', 'xuelinglong16.jpg', ).__dict__)385list.append(TalkBean(1, '血玲珑', 'xuelinglong21.jpg', ).__dict__)386list.append(TalkBean(1, '血玲珑', 'xuelinglong22.jpg', ).__dict__)387list.append(TalkBean(1, '血玲珑', 'xuelinglong23.jpg', ).__dict__)388list.append(TalkBean(1, '血玲珑', 'xuelinglong24.jpg', ).__dict__)389list.append(TalkBean(1, '血玲珑', 'xuelinglong25.jpg', ).__dict__)390list.append(TalkBean(1, '血玲珑', 'xuelinglong26.jpg', ).__dict__)391list.append(TalkBean(1, '血玲珑', 'xuelinglong31.jpg', ).__dict__)392list.append(TalkBean(1, '血玲珑', 'xuelinglong32.jpg', ).__dict__)393list.append(TalkBean(1, '血玲珑', 'xuelinglong33.jpg', ).__dict__)394list.append(TalkBean(1, '血玲珑', 'xuelinglong34.jpg', ).__dict__)395list.append(TalkBean(1, '血玲珑', 'xuelinglong35.jpg', ).__dict__)396list.append(TalkBean(1, '血玲珑', 'xuelinglong36.jpg', ).__dict__)397list.append(TalkBean(1, '血玲珑', 'xuelinglong41.jpg', ).__dict__)398list.append(TalkBean(1, '血玲珑', 'xuelinglong42.jpg', ).__dict__)399list.append(TalkBean(1, '血玲珑', 'xuelinglong43.jpg', ).__dict__)400list.append(TalkBean(1, '血玲珑', 'xuelinglong44.jpg', ).__dict__)401list.append(TalkBean(1, '血玲珑', 'xuelinglong45.jpg', ).__dict__)402list.append(TalkBean(1, '血玲珑', 'xuelinglong46.jpg', ).__dict__)403list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu11.jpg', ).__dict__)404list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu12.jpg', ).__dict__)405list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu13.jpg', ).__dict__)406list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu14.jpg', ).__dict__)407list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu15.jpg', ).__dict__)408list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu16.jpg', ).__dict__)409list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu21.jpg', ).__dict__)410list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu22.jpg', ).__dict__)411list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu23.jpg', ).__dict__)412list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu24.jpg', ).__dict__)413list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu25.jpg', ).__dict__)414list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu26.jpg', ).__dict__)415list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu31.jpg', ).__dict__)416list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu32.jpg', ).__dict__)417list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu33.jpg', ).__dict__)418list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu34.jpg', ).__dict__)419list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu35.jpg', ).__dict__)420list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu36.jpg', ).__dict__)421list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu41.jpg', ).__dict__)422list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu42.jpg', ).__dict__)423list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu43.jpg', ).__dict__)424list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu44.jpg', ).__dict__)425list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu45.jpg', ).__dict__)426list.append(TalkBean(1, '九彩云龙珠', 'jiucaiyunlongzhu46.jpg', ).__dict__)427list.append(TalkBean(1, '内丹精华', 'neidanjinghua11.jpg', ).__dict__)428list.append(TalkBean(1, '内丹精华', 'neidanjinghua12.jpg', ).__dict__)429list.append(TalkBean(1, '内丹精华', 'neidanjinghua13.jpg', ).__dict__)430list.append(TalkBean(1, '内丹精华', 'neidanjinghua14.jpg', ).__dict__)431list.append(TalkBean(1, '内丹精华', 'neidanjinghua15.jpg', ).__dict__)432list.append(TalkBean(1, '内丹精华', 'neidanjinghua16.jpg', ).__dict__)433list.append(TalkBean(1, '内丹精华', 'neidanjinghua21.jpg', ).__dict__)434list.append(TalkBean(1, '内丹精华', 'neidanjinghua22.jpg', ).__dict__)435list.append(TalkBean(1, '内丹精华', 'neidanjinghua23.jpg', ).__dict__)436list.append(TalkBean(1, '内丹精华', 'neidanjinghua24.jpg', ).__dict__)437list.append(TalkBean(1, '内丹精华', 'neidanjinghua25.jpg', ).__dict__)438list.append(TalkBean(1, '内丹精华', 'neidanjinghua26.jpg', ).__dict__)439list.append(TalkBean(1, '内丹精华', 'neidanjinghua31.jpg', ).__dict__)440list.append(TalkBean(1, '内丹精华', 'neidanjinghua32.jpg', ).__dict__)441list.append(TalkBean(1, '内丹精华', 'neidanjinghua33.jpg', ).__dict__)442list.append(TalkBean(1, '内丹精华', 'neidanjinghua34.jpg', ).__dict__)443list.append(TalkBean(1, '内丹精华', 'neidanjinghua35.jpg', ).__dict__)444list.append(TalkBean(1, '内丹精华', 'neidanjinghua36.jpg', ).__dict__)445list.append(TalkBean(1, '内丹精华', 'neidanjinghua41.jpg', ).__dict__)446list.append(TalkBean(1, '内丹精华', 'neidanjinghua42.jpg', ).__dict__)447list.append(TalkBean(1, '内丹精华', 'neidanjinghua43.jpg', ).__dict__)448list.append(TalkBean(1, '内丹精华', 'neidanjinghua44.jpg', ).__dict__)449list.append(TalkBean(1, '内丹精华', 'neidanjinghua45.jpg', ).__dict__)450list.append(TalkBean(1, '内丹精华', 'neidanjinghua46.jpg', ).__dict__)451list.append(TalkBean(1, '千年寒铁', 'qiannianhantie11.jpg', ).__dict__)452list.append(TalkBean(1, '千年寒铁', 'qiannianhantie12.jpg', ).__dict__)453list.append(TalkBean(1, '千年寒铁', 'qiannianhantie13.jpg', ).__dict__)454list.append(TalkBean(1, '千年寒铁', 'qiannianhantie14.jpg', ).__dict__)455list.append(TalkBean(1, '千年寒铁', 'qiannianhantie15.jpg', ).__dict__)456list.append(TalkBean(1, '千年寒铁', 'qiannianhantie16.jpg', ).__dict__)457list.append(TalkBean(1, '千年寒铁', 'qiannianhantie21.jpg', ).__dict__)458list.append(TalkBean(1, '千年寒铁', 'qiannianhantie22.jpg', ).__dict__)459list.append(TalkBean(1, '千年寒铁', 'qiannianhantie23.jpg', ).__dict__)460list.append(TalkBean(1, '千年寒铁', 'qiannianhantie24.jpg', ).__dict__)461list.append(TalkBean(1, '千年寒铁', 'qiannianhantie25.jpg', ).__dict__)462list.append(TalkBean(1, '千年寒铁', 'qiannianhantie26.jpg', ).__dict__)463list.append(TalkBean(1, '千年寒铁', 'qiannianhantie31.jpg', ).__dict__)464list.append(TalkBean(1, '千年寒铁', 'qiannianhantie32.jpg', ).__dict__)465list.append(TalkBean(1, '千年寒铁', 'qiannianhantie33.jpg', ).__dict__)466list.append(TalkBean(1, '千年寒铁', 'qiannianhantie34.jpg', ).__dict__)467list.append(TalkBean(1, '千年寒铁', 'qiannianhantie35.jpg', ).__dict__)468list.append(TalkBean(1, '千年寒铁', 'qiannianhantie36.jpg', ).__dict__)469list.append(TalkBean(1, '千年寒铁', 'qiannianhantie41.jpg', ).__dict__)470list.append(TalkBean(1, '千年寒铁', 'qiannianhantie42.jpg', ).__dict__)471list.append(TalkBean(1, '千年寒铁', 'qiannianhantie43.jpg', ).__dict__)472list.append(TalkBean(1, '千年寒铁', 'qiannianhantie44.jpg', ).__dict__)473list.append(TalkBean(1, '千年寒铁', 'qiannianhantie45.jpg', ).__dict__)474list.append(TalkBean(1, '千年寒铁', 'qiannianhantie46.jpg', ).__dict__)475list.append(TalkBean(1, '天外飞石', 'tianwaifeishi11.jpg', ).__dict__)476list.append(TalkBean(1, '天外飞石', 'tianwaifeishi12.jpg', ).__dict__)477list.append(TalkBean(1, '天外飞石', 'tianwaifeishi13.jpg', ).__dict__)478list.append(TalkBean(1, '天外飞石', 'tianwaifeishi14.jpg', ).__dict__)479list.append(TalkBean(1, '天外飞石', 'tianwaifeishi15.jpg', ).__dict__)480list.append(TalkBean(1, '天外飞石', 'tianwaifeishi16.jpg', ).__dict__)481list.append(TalkBean(1, '天外飞石', 'tianwaifeishi21.jpg', ).__dict__)482list.append(TalkBean(1, '天外飞石', 'tianwaifeishi22.jpg', ).__dict__)483list.append(TalkBean(1, '天外飞石', 'tianwaifeishi23.jpg', ).__dict__)484list.append(TalkBean(1, '天外飞石', 'tianwaifeishi24.jpg', ).__dict__)485list.append(TalkBean(1, '天外飞石', 'tianwaifeishi25.jpg', ).__dict__)486list.append(TalkBean(1, '天外飞石', 'tianwaifeishi26.jpg', ).__dict__)487list.append(TalkBean(1, '天外飞石', 'tianwaifeishi31.jpg', ).__dict__)488list.append(TalkBean(1, '天外飞石', 'tianwaifeishi32.jpg', ).__dict__)489list.append(TalkBean(1, '天外飞石', 'tianwaifeishi33.jpg', ).__dict__)490list.append(TalkBean(1, '天外飞石', 'tianwaifeishi34.jpg', ).__dict__)491list.append(TalkBean(1, '天外飞石', 'tianwaifeishi35.jpg', ).__dict__)492list.append(TalkBean(1, '天外飞石', 'tianwaifeishi36.jpg', ).__dict__)493list.append(TalkBean(1, '天外飞石', 'tianwaifeishi41.jpg', ).__dict__)494list.append(TalkBean(1, '天外飞石', 'tianwaifeishi42.jpg', ).__dict__)495list.append(TalkBean(1, '天外飞石', 'tianwaifeishi43.jpg', ).__dict__)496list.append(TalkBean(1, '天外飞石', 'tianwaifeishi44.jpg', ).__dict__)497list.append(TalkBean(1, '天外飞石', 'tianwaifeishi45.jpg', ).__dict__)498list.append(TalkBean(1, '天外飞石', 'tianwaifeishi46.jpg', ).__dict__)499list.append(TalkBean(1, '盘古精铁', 'pangujingtie11.jpg', ).__dict__)500list.append(TalkBean(1, '盘古精铁', 'pangujingtie12.jpg', ).__dict__)501list.append(TalkBean(1, '盘古精铁', 'pangujingtie13.jpg', ).__dict__)502list.append(TalkBean(1, '盘古精铁', 'pangujingtie14.jpg', ).__dict__)503list.append(TalkBean(1, '盘古精铁', 'pangujingtie15.jpg', ).__dict__)504list.append(TalkBean(1, '盘古精铁', 'pangujingtie16.jpg', ).__dict__)505list.append(TalkBean(1, '盘古精铁', 'pangujingtie21.jpg', ).__dict__)506list.append(TalkBean(1, '盘古精铁', 'pangujingtie22.jpg', ).__dict__)507list.append(TalkBean(1, '盘古精铁', 'pangujingtie23.jpg', ).__dict__)508list.append(TalkBean(1, '盘古精铁', 'pangujingtie24.jpg', ).__dict__)509list.append(TalkBean(1, '盘古精铁', 'pangujingtie25.jpg', ).__dict__)510list.append(TalkBean(1, '盘古精铁', 'pangujingtie26.jpg', ).__dict__)511list.append(TalkBean(1, '盘古精铁', 'pangujingtie31.jpg', ).__dict__)512list.append(TalkBean(1, '盘古精铁', 'pangujingtie32.jpg', ).__dict__)513list.append(TalkBean(1, '盘古精铁', 'pangujingtie33.jpg', ).__dict__)514list.append(TalkBean(1, '盘古精铁', 'pangujingtie34.jpg', ).__dict__)515list.append(TalkBean(1, '盘古精铁', 'pangujingtie35.jpg', ).__dict__)516list.append(TalkBean(1, '盘古精铁', 'pangujingtie36.jpg', ).__dict__)517list.append(TalkBean(1, '盘古精铁', 'pangujingtie41.jpg', ).__dict__)518list.append(TalkBean(1, '盘古精铁', 'pangujingtie42.jpg', ).__dict__)519list.append(TalkBean(1, '盘古精铁', 'pangujingtie43.jpg', ).__dict__)520list.append(TalkBean(1, '盘古精铁', 'pangujingtie44.jpg', ).__dict__)521list.append(TalkBean(1, '盘古精铁', 'pangujingtie45.jpg', ).__dict__)522list.append(TalkBean(1, '盘古精铁', 'pangujingtie46.jpg', ).__dict__)523str = json.dumps(list).encode('utf-8').decode('unicode_escape')524with open(huishou_path + 'KeHuiShouProfile.txt', 'w', encoding='utf-8') as f:...

Full Screen

Full Screen

views.py

Source:views.py Github

copy

Full Screen

1import json2import numpy3import pandas as pd4import datetime as dt5from django.http import HttpResponse6from django.shortcuts import render7from plotly.offline import plot8import plotly.express as px9from EcoJeju.models import user, worker, wastedata, region, disposedata, workerarea, wasteprediction10from config.settings import DATA_DIRS11map1 = pd.read_csv(DATA_DIRS[0]+'/0816_지역별_요일별.csv', encoding ='cp949')12geo_path2 = DATA_DIRS[0]+'/LSMD_ADM_SECT_UMD_제주.zip.geojson'13geo_data2 = json.load(open(geo_path2, encoding='utf-8'))14fig1 = plot(px.choropleth_mapbox(map1, geojson=geo_data2,15 locations='emd_nm',16 color='em_kg',17 color_continuous_scale="matter",18 range_color=(0, 50000),19 mapbox_style="carto-positron",20 featureidkey="properties.EMD_NM",21 zoom=9, center={"lat": 33.39075486566194, "lon": 126.53390204213252},22 opacity=0.5,23 labels={'emd_nm': 'em_kg'},24 animation_frame='week'), output_type='div')25fig2 = plot(px.choropleth_mapbox(map1, geojson=geo_data2,26 locations='emd_nm',27 color='pay_amt',28 color_continuous_scale="matter",29 range_color=(10000, 1200000),30 mapbox_style="carto-positron",31 featureidkey="properties.EMD_NM",32 zoom=9, center={"lat": 33.39075486566194, "lon": 126.53390204213252},33 opacity=0.5,34 labels={'emd_nm': 'pay_amt'},35 animation_frame='week'), output_type='div')36allwaste = wastedata.objects.all();37def home(request):38 context={39 'loginok': False,40 'plot_div1': fig1,41 'plot_div2': fig242 }43 return render(request, 'dashboard.html',context)44def dashboard(request):45 if 'loginok' in request.session:46 context = {47 'loginok': request.session['loginok'],48 'id': request.session['id'],49 'type': request.session['type'],50 'name': request.session['name'],51 'plot_div1': fig1,52 'plot_div2': fig253 }54 else :55 context={ 'loginok': False }56 return render(request, 'dashboard.html',context)57def userboard(request):58 if 'loginok' in request.session:59 context = {60 'loginok': request.session['loginok'],61 'id': request.session['id'],62 'type': request.session['type'],63 'name': request.session['name'],64 }65 else :66 context={67 'loginok': False68 }69 return render(request,'userboard.html',context)70def workerboard(request):71 if 'loginok' in request.session:72 context = {73 'loginok': request.session['loginok'],74 'id': request.session['id'],75 'type': request.session['type'],76 'name': request.session['name'],77 }78 else :79 context={ 'loginok': False,80 }81 return render(request,'workerboard.html',context)82def login(request):83 return render(request, 'login.html')84def loginimpl(request):85 id = request.POST['loginid'];86 pwd = request.POST['loginpwd']87 typecheck = request.POST['logintype'];88 next = 'login.html'89 context={}90 if id == '' or pwd == '':91 context = {92 'result': '빈칸을 모두 채워주세요',93 }94 elif(typecheck =='envir'):95 if worker.objects.filter(worker_id =id).exists():96 getworker = worker.objects.get(worker_id=id);97 if getworker.worker_pwd == pwd:98 context={99 'loginok':True,100 'id': id,101 'type': 00,102 'name': getworker.worker_name103 }104 request.session['loginok']= True;105 request.session['id'] = id;106 request.session['name'] = getworker.worker_name;107 request.session['type'] = 10;108 next = 'dashboard.html'109 else:110 context = {111 "result": "비밀번호가 틀렸습니다",112 }113 else:114 context={115 "result": "존재하지 않는 아이디 입니다.",116 }117 elif typecheck =='normal':118 if user.objects.filter(user_id =id).exists():119 getuser = user.objects.get(user_id=id);120 if getuser.user_pwd == pwd:121 context={122 'loginok':True,123 'id': id,124 'type': 10,125 'name': getuser.user_name126 }127 request.session['loginok']= True;128 request.session['id'] = id;129 request.session['name'] = getuser.user_name;130 request.session['type'] = 10;131 next = 'dashboard.html'132 else:133 context = {134 "result": "비밀번호가 틀렸습니다"135 }136 else:137 context = {138 "result": "존재하지 않는 아이디 입니다.",139 }140 else :141 context={142 "result": "로그인 실패",143 }144 return render(request,next,context)145def register(request):146 return render(request,'register.html')147def registerimpl(request):148 typecheck = request.POST['inputtype'];149 id = request.POST['inputid'];150 pwd = request.POST['inputpwd'];151 repwd = request.POST['inputrepwd'];152 name = request.POST['inputname'];153 if id=='' or pwd=='' or repwd==''or name =='':154 context = {'result': '빈칸을 모두 채워주세요'}155 elif user.objects.filter(user_id =id).exists() or worker.objects.filter(worker_id =id).exists() :156 context = {'result': '이미 존재하는 아이디 입니다.'}157 elif pwd != repwd:158 context = {'result': '비밀번호가 일치하지 않습니다.'}159 else:160 context = {'result': '회원가입을 성공하였습니다.'}161 if typecheck == 'envir':162 worker.objects.create(163 worker_id =id,164 worker_name =name,165 worker_pwd =pwd166 ).save()167 else:168 user.objects.create(169 user_id= id,170 user_name= name,171 user_pwd= pwd172 ).save()173 return HttpResponse(json.dumps(context), content_type="application/json")174def recover(request):175 return render(request,'recover.html')176def card1(request):177 todaystr ='2021-06-30'178 today = dt.datetime.strptime(todaystr, '%Y-%m-%d')179 week_ago = today - dt.timedelta(days=6)180 data = pd.DataFrame(allwaste.filter(base_date__gte= week_ago).values_list('base_date','em_g'));181 grouped = data[1].groupby([data[0]]).sum().reset_index()182 result=''183 for d in grouped[1]:184 result = result + ',' + str(int(d/1000))185 result = result[1:]186 print(result);187 context = {188 'data' : result,189 'today': todaystr,190 'today_g': float(grouped[1][grouped.shape[0]-1]/1000)191 }192 return HttpResponse(json.dumps(context), content_type='application/json');193def card2(request):194 todaystr ='2021-06-30'195 today = dt.datetime.strptime(todaystr, '%Y-%m-%d')196 week_ago = today - dt.timedelta(days=6)197 data = pd.DataFrame(allwaste.filter(base_date__gte= week_ago).values_list('base_date','pay_amt'));198 grouped = data[1].groupby([data[0]]).sum().reset_index()199 result=''200 for d in grouped[1]:201 result = result + ',' + str(int(d/10000))202 result = result[1:]203 print();204 context = {205 'data' : result,206 'today': todaystr,207 'today_amt': float(grouped[1][grouped.shape[0]-1]/10000)208 }209 return HttpResponse(json.dumps(context), content_type='application/json');210def plot1(request):211 datas = pd.DataFrame(allwaste.filter(base_date__year=2021).values_list('base_date','pay_amt'));212 datas['Month'] = datas[0].dt.month213 grouped = datas[1].groupby([datas['Month']])214 mon = pd.DataFrame(grouped.sum()).reset_index()215 result = []216 for i in range(len(mon['Month'])):217 result.append([str(mon['Month'][i]) + '월', float(mon[1][i]/10000)])218 context = {219 "label": "사용금액(만원)",220 "color": "#1f92fe",221 "data" : result222 }223 return HttpResponse(json.dumps(context), content_type='application/json');224def plot3(request):225 datas = pd.DataFrame(allwaste.filter(base_date__year=2021).values_list('base_date','em_g'));226 datas['Month'] = datas[0].dt.month227 grouped = datas[1].groupby([datas['Month']])228 mon = pd.DataFrame(grouped.sum()).reset_index()229 result = []230 for i in range(len(mon['Month'])):231 result.append([str(mon['Month'][i]) + '월', float(mon[1][i] / 1000)])232 context = {233 "label": "배출량(kg)",234 "color": "#1ba3cd",235 "data" : result236 }237 return HttpResponse(json.dumps(context), content_type='application/json');238def usergimpl(request):239 id = 'test01'240 todaystr ='2021-06-30'241 today = dt.datetime.strptime(todaystr, '%Y-%m-%d')242 month_ago = today - dt.timedelta(days=29)243 # disposedata = pd.read_csv(DATA_DIRS[0]+'/regiontabledata.csv', encoding ='cp949')244 datas = pd.DataFrame(disposedata.objects.filter(dispose_user_id=id, dispose_date__gte=month_ago).values('dispose_amount','dispose_weight', 'dispose_date'))245 todayg = int(datas[datas['dispose_date'] == today]['dispose_weight'][0])246 todayamt = int(datas[datas['dispose_date'] == today]['dispose_amount'][0])247 datas['Day'] = datas['dispose_date'].dt.day248 datas.sort_values(by=['Day'], axis=0, inplace=True)249 print(datas);250 first = 7 - int(datas['dispose_date'][0].isoweekday())251 week = [0, 0, 0, 0, 0, 0]252 aweek = [0, 0, 0, 0, 0, 0]253 for i in range(len(datas['Day'])):254 if datas['Day'][i] < first + 1:255 week[0] = week[0] + datas['dispose_weight'][i]256 aweek[0] = aweek[0] + datas['dispose_amount'][i]257 elif datas['Day'][i] < first + 8:258 week[1] = week[1] + datas['dispose_weight'][i]259 aweek[1] = aweek[1] + datas['dispose_amount'][i]260 elif datas['Day'][i] < first + 15:261 week[2] = week[2] + datas['dispose_weight'][i]262 aweek[2] = aweek[2] + datas['dispose_amount'][i]263 elif datas['Day'][i] < first + 22:264 week[3] = week[3] + datas['dispose_weight'][i]265 aweek[3] = aweek[3] + datas['dispose_amount'][i]266 elif datas['Day'][i] < first + 29:267 week[4] = week[4] + datas['dispose_weight'][i]268 aweek[4] = aweek[4] + datas['dispose_amount'][i]269 else:270 week[5] = week[5] + datas['dispose_weight'][i]271 aweek[5] = aweek[5] + datas['dispose_amount'][i]272 print(aweek)273 result = ''274 for d in week:275 if d == 0:276 continue;277 result = result + ',' + str(int(d))278 result = result[1:]279 total_g = int(sum(week)/1000)280 aresult=''281 for a in aweek:282 if a==0:283 continue284 aresult= aresult+','+str(a)285 aresult=aresult[1:]286 total_amt = int(sum(aweek))287 print(aresult)288 context = {289 'gvalues': result,290 'amtvalues':aresult,291 'totalg':total_g,292 'totalamt': total_amt,293 'todayg': todayg,294 'todayamt':todayamt,295 'todaystr':todaystr296 }297 return HttpResponse(json.dumps(context), content_type='application/json');298def bars3(request):299 id='test01'300 data2 = pd.DataFrame(disposedata.objects.filter(dispose_user_id = id).values('dispose_date','dispose_weight'))301 data2['dispose_date'] = pd.to_datetime(data2['dispose_date'])302 data2['dispose_year'] = data2['dispose_date'].dt.year303 data2['dispose_month'] = data2['dispose_date'].dt.month304 data2_1 = data2[data2['dispose_month'] == 1]305 data2_2 = data2[data2['dispose_month'] == 2]306 data2_3 = data2[data2['dispose_month'] == 3]307 data2_4 = data2[data2['dispose_month'] == 4]308 data2_5 = data2[data2['dispose_month'] == 5]309 data2_6 = data2[data2['dispose_month'] == 6]310 test2_1 = data2_1['dispose_weight'].sum()311 test2_2 = data2_2['dispose_weight'].sum()312 test2_3 = data2_3['dispose_weight'].sum()313 test2_4 = data2_4['dispose_weight'].sum()314 test2_5 = data2_5['dispose_weight'].sum()315 test2_6 = data2_6['dispose_weight'].sum()316 context = [{317 "label": "나의 한달 배출량",318 "color": "#FF3700",319 "data": [["1월", int(test2_1)], ["2월", int(test2_2)], ["3월", int(test2_3)],320 ["4월", int(test2_4)], ["5월", int(test2_5)], ["6월", int(test2_6)]]321 }, {322 "label": "월별 가구당 배출 평균량",323 "color": "#57E9E1",324 "data": [['1월', 12417], ['2월', 12810], ['3월', 13518],325 ['4월', 11979], ['5월', 13212], ['6월', 12027]]326 }]327 return HttpResponse(json.dumps(context), content_type='application/json');328 ##------------준웅님그래프---------------------------329def bars4(request):330 id='test01'331 data2 = pd.DataFrame(disposedata.objects.filter(dispose_user_id = id).values('dispose_date','dispose_amount'))332 data2['dispose_date'] = pd.to_datetime(data2['dispose_date'])333 data2['dispose_year'] = data2['dispose_date'].dt.year334 data2['dispose_month'] = data2['dispose_date'].dt.month335 data2_1 = data2[data2['dispose_month'] == 1]336 data2_2 = data2[data2['dispose_month'] == 2]337 data2_3 = data2[data2['dispose_month'] == 3]338 data2_4 = data2[data2['dispose_month'] == 4]339 data2_5 = data2[data2['dispose_month'] == 5]340 data2_6 = data2[data2['dispose_month'] == 6]341 test2_1 = data2_1['dispose_amount'].sum()342 test2_2 = data2_2['dispose_amount'].sum()343 test2_3 = data2_3['dispose_amount'].sum()344 test2_4 = data2_4['dispose_amount'].sum()345 test2_5 = data2_5['dispose_amount'].sum()346 test2_6 = data2_6['dispose_amount'].sum()347 context = [{348 "label": "월별 가구당 사용 금액 평균량",349 "color": "#5ab1ef",350 "data": [['1월', 369], ['2월', 381], ['3월', 372],351 ['4월', 357], ['5월', 393], ['6월', 354]]352 }, {353 "label": "나의 한달 금액",354 "color": "#FF007B",355 "data": [["1월", int(test2_1)], ["2월", int(test2_2)], ["3월", int(test2_3)],356 ["4월", int(test2_4)], ["5월", int(test2_5)], ["6월", int(test2_6)]]357 }]358 return HttpResponse(json.dumps(context), content_type='application/json');359def piecharts(request):360 id='worker'361 worklist = pd.DataFrame(workerarea.objects.filter(worker_id=id).values())362 areas=[];363 for area in worklist['area_cd']:364 cur = region.objects.get(region_id=area)365 areas.append({'area':area,'region':cur.region_name,'parent':cur.parent_name, 'city':cur.city_name})366 todaystr = '2021-06-30'367 today = dt.datetime.strptime(todaystr, '%Y-%m-%d')368 for area in areas:369 df =pd.DataFrame(wastedata.objects.filter(base_date = today, area_cd=area['area']).values())370 if df.empty :371 area['percent'] = 0372 else :373 val = numpy.around(df['em_g'][0] / 3000)374 area['percent'] = int(val)375 context={376 'areas': areas,377 'today': todaystr,378 }379 return HttpResponse(json.dumps(context), content_type='application/json');380def tables(request):381 id='worker'382 worklist = pd.DataFrame(workerarea.objects.filter(worker_id=id).values('area_cd'))383 checkp=[];384 for area in worklist['area_cd']:385 cur = region.objects.get(region_id=area)386 parent = cur.parent_name387 if parent not in checkp:388 checkp.append(parent);389 list = [];390 for p in checkp:391 jq = wasteprediction.objects.get(region=p)392 list.append({'region': jq.region, 'seven': int(jq.onemonth), 'eight': int(jq.tw0month)})393 context={394 'list': list395 }396 return HttpResponse(json.dumps(context), content_type='application/json');397# db에 데이터 넣기 위한 함수398def insertdata(request):399 #음식물 지역별 데이터 넣기400 # df = pd.read_csv(DATA_DIRS[0] + '\\foodwastedata.csv', encoding='cp949')401 # data21 = df[df['base_date'].str.split('-').str[0] == '2021']402 # for index in data21.index:403 # base_date = dt.datetime.strptime(df.loc[index]['base_date'], '%Y-%m-%d')404 # city = df.loc[index]['city']405 # emd_nm = df.loc[index]['emd_nm']406 # area_cd = df.loc[index]['em_area_cd']407 # em_cnt = df.loc[index]['em_cnt']408 # em_g = df.loc[index]['em_g']409 # pay_amt = df.loc[index]['pay_amt']410 # wastedata.objects.create(411 # base_date =base_date,412 # city = city,413 # emd_nm =emd_nm,414 # area_cd =area_cd,415 # em_cnt =em_cnt,416 # em_g =em_g,417 # pay_amt =pay_amt418 # ).save()419 # 지역 코드 데이터 넣기420 # datas = pd.read_csv(DATA_DIRS[0] + '\\regiontabledata.csv', encoding='cp949')421 # for index in datas.index:422 # region_id =datas.loc[index]['region_id']423 # region_name = datas.loc[index]['region_name']424 # parent_name = datas.loc[index]['parent_name']425 # city_name = datas.loc[index]['city_name']426 # region.objects.create(427 # region_id =region_id,428 # region_name=region_name,429 # parent_name = parent_name,430 # city_name = city_name431 # ).save()432 # # 사용자 이용 데이터 넣기433 # datas = pd.read_csv(DATA_DIRS[0] + '\\disposedata.csv', encoding='cp949')434 # print(datas);435 # for index in range(datas.shape[0]):436 # dispose_date = dt.datetime.strptime(datas.loc[index]['dispose_date'], '%Y-%m-%d'),437 # dispose_weight = datas.loc[index]['dispose_weight'],438 # dispose_amount=datas.loc[index]['dispose_amount'],439 # dispose_region_code=datas.loc[index]['dispose_city_code'],440 # user_id = datas.loc[index]['dispose_id']441 # print(dispose_date[0],dispose_weight[0],dispose_amount[0],dispose_region_code[0],user_id)442 # disposedata.objects.create(443 # dispose_date=dispose_date[0],444 # dispose_weight=dispose_weight[0],445 # dispose_amount= dispose_amount[0],446 # dispose_region_code=dispose_region_code[0],447 # dispose_user_id= user_id448 # ).save()449 datas = pd.read_csv(DATA_DIRS[0] + '\\78월시계열예측kg.csv', encoding='cp949')450 for index in range(datas.shape[0]):451 region=datas['emd_nm'][index]452 predic_weight7 =datas['em_kg_pred7'][index]453 predic_weight8=datas['em_kg_pred8'][index]454 print(region,predic_weight7,predic_weight8)455 wasteprediction.objects.create(456 region=region,457 onemonth = predic_weight7,458 tw0month = predic_weight8,459 ).save()460 context={'result': 'success'}461 return render(request,'insertdata.html',context)462def into(request):463 return render(request,'insertdata.html')464if __name__ == '__main__' :...

Full Screen

Full Screen

xBrepFace_extendAtUntrimmedEdge.py

Source:xBrepFace_extendAtUntrimmedEdge.py Github

copy

Full Screen

...20import xBrepFace21import xBrepTrim222324def dispose(listDispose): map(lambda x: x.Dispose, listDispose)252627def getBrepIdAndTrimIdx():28 29 disposeUs = []30 31 # Load sticky.32 stickyKeys = ['bSmooth({})'.format(__file__)]33 stickyValues = [True]34 for i, stickyKey in enumerate(stickyKeys):35 if sc.sticky.has_key(stickyKey): stickyValues[i] = sc.sticky[stickyKey]36 bSmooth, = stickyValues37 38 # Get untrimmed brep edge with optional input.39 go = ri.Custom.GetObject(); disposeUs.append(go)40 go.SetCommandPrompt("Select untrimmed edge to extend")41 go.GeometryFilter = rd.ObjectType.EdgeFilter42 # SurfaceBoundaryEdge doesn't include seams.43 go.GeometryAttributeFilter = (44 ri.Custom.GeometryAttributeFilter.SurfaceBoundaryEdge)45 46 def is1FaceBrep (rdBrep, rgTrim, compIdx):47 return rdBrep.BrepGeometry.Faces.Count == 148 go.SetCustomGeometryFilter(is1FaceBrep)49 50 optT_Smooth = ri.Custom.OptionToggle(bSmooth, 'RuledExtension', 'Smooth')51 go.AddOptionToggle('Type', optT_Smooth)52 53 while go.Get() != ri.GetResult.Object:54 sc.escape_test()55 if go.CommandResult() != Rhino.Commands.Result.Success: # Canceled.56 dispose(disposeUs); return57 58 objref = go.Object(0); disposeUs.append(objref)59 idBrep = objref.ObjectId60 compIdx = objref.GeometryComponentIndex.Index61 62 bSmooth = optT_Smooth.CurrentValue63 64 # Save sticky.65 stickyValues = bSmooth,66 for i, stickyKey in enumerate(stickyKeys):67 sc.sticky[stickyKey] = stickyValues[i]68 69 dispose(disposeUs)70 return idBrep, compIdx, bSmooth717273def getExtensionFactor():74 75 # Load sticky.76 stickyKeys = ['fExtLength({})'.format(__file__)]77 stickyValues = [1.0]78 for i, stickyKey in enumerate(stickyKeys):79 if sc.sticky.has_key(stickyKey): stickyValues[i] = sc.sticky[stickyKey]80 fExtLength, = stickyValues81 82 rc, fExtLength = ri.RhinoGet.GetNumber("ExtensionFactor",83 False, fExtLength, 0., 1./Rhino.RhinoMath.ZeroTolerance)84 85 if rc == Rhino.Commands.Result.Success:86 # Save sticky.87 stickyValues = fExtLength,88 for i, stickyKey in enumerate(stickyKeys):89 sc.sticky[stickyKey] = stickyValues[i]90 91 return fExtLength929394def isBrepReadyForExtend(rgBrep, bEcho=False, bDebug=False):95 96 if not rgBrep.IsValid:97 if bEcho: print "Surface is not valid. Exiting..."98 return False99 if not rgBrep.IsManifold:100 if bEcho: print "Surface is non-manifold. Exiting..."101 return False102 if rgBrep.IsSurface and rgBrep.IsSolid:103 if bEcho: print "Surface is a solid. Exiting..."104 return False105 106 disposeUs = []107 108 rgFace = rgBrep.Faces[0]; disposeUs.append(rgFace)109 if not rgFace.IsValid:110 if bEcho:111 print "Warning: Face is invalid, but script will attempt to continue."112 113 rgSrf = rgFace.UnderlyingSurface(); disposeUs.append(rgSrf)114 if not rgSrf.IsValid:115 if bEcho: print "Underlying surface is invalid. Exiting.."116 dispose(disposeUs); return 117 118 rgBrep_Extended_TrySplit = rgSrf.ToBrep(); disposeUs.append(rgBrep_Extended_TrySplit)119 120 fKinkTol = sc.doc.ModelAngleToleranceRadians121 bSplitKinkyFaces = rgBrep_Extended_TrySplit.Faces.SplitKinkyFaces(122 fKinkTol, True) # True doesn't mean that any splits had occurred.123 if not bSplitKinkyFaces:124 if bDebug: sPrint = 'bSplitKinkyFaces'; print sPrint + ':', eval(sPrint)125 if bEcho: print "Split kiny face check failed. Exiting..."126 dispose(disposeUs); return127 if rgBrep_Extended_TrySplit.Faces.Count != 1:128 if bEcho: print "At {}{} tolerance, the surface has kinks. " \129 "Repair surface before extending it.".format(130 sc.doc.ModelAngleToleranceDegrees, chr(176))131 dispose(disposeUs); return132 133 dispose(disposeUs)134 135 return True136137138def getAreaOfSurface(rgSrf, bEcho=False):139 """Tries brep if surface fails."""140 areaMassProp = rg.AreaMassProperties.Compute(rgSrf)141 if areaMassProp is None:142 if bEcho:143 print "AreaMassProperties cannot be computed for surface."144 print "Trying to compute AreaMassProperties for brep of surface..."145 rgBrepTemp = rgSrf.ToBrep()146 areaMassProp = rg.AreaMassProperties.Compute(rgBrepTemp)147 rgBrepTemp.Dispose()148 if areaMassProp is None: return149 elif bEcho: print "...Success!"150 area = areaMassProp.Area151 areaMassProp.Dispose()152 return area153154155def isExtendedSrfOk(rgSrf_Ext, rgSrf0, bEcho=False, bDebug=False):156 """157 Includes verification that area has changed.158 """159 160 if not rgSrf_Ext.IsValid:161 return False162 163 # Get AreaMassProperties of original and new surface.164 areaSrf0 = getAreaOfSurface(rgSrf0)165 if areaSrf0 is None:166 if bEcho: print "Area not computed for original surface."167 return False168 areaSrf_Extended = getAreaOfSurface(rgSrf_Ext)169 if areaSrf_Extended is None:170 if bEcho: print "Area of original surface not computed."171 return False172 173 # Compare original and new areas and, if the same, return.174 if Rhino.RhinoMath.EpsilonEquals(areaSrf_Extended, areaSrf0,175 sc.doc.ModelAbsoluteTolerance**2):176 return False177 178 return rgSrf_Ext179180181def trimExtendedSrf(rgSrf_Ext, rgBrep0, idxTrims_toSkip, bEcho=False, bDebug=False):182 """183 Parameters:184 rgSrf_Ext: Extended surface.185 rgBrep0: Original 1-face Brep.186 idxTrims_toSkip: List of SENW Trims not to trim.187 Returns:188 Trimmed 1-face Brep or None.189 """190 191 disposeUs = []192 193 fPtMatchTol = 1.e-6194 195 # Make IsoStatus list per idxTrims_toSkip.196 isoStats_Ext = []197 for i in idxTrims_toSkip:198 rgT_Ext = rgBrep0.Trims[i]; disposeUs.append(rgT_Ext)199 if rgT_Ext.IsoStatus not in isoStats_Ext:200 isoStats_Ext.append(rgT_Ext.IsoStatus)201 202 # Make outer Edge list and inner Edge list of only non-SENW Edges or203 # SENW Trim not extended for Trim.204 rgTrims_B0 = rgBrep0.Trims; disposeUs.extend(rgTrims_B0)205 rgEs_Otr = []; rgEs_Inr = []206 for i, rgTrim in enumerate(rgTrims_B0):207 if rgTrim.Loop.LoopType == rg.BrepLoopType.Outer: # Outer loop.208 # Only use other edges with selected edge SENW.209 if xBrepTrim.isSenw(rgTrim):210 if any(i == idx for idx in idxTrims_toSkip):211 continue # Trims of idxTrims_toSkip will not be used.212 if any(rgTrim.IsoStatus == iso for iso in isoStats_Ext):213 continue # This is a SENW different than that of any of the extended Trims.214 rgEs_Otr.append(rgTrim.Edge)215 else: # Inner loop216 rgEs_Inr.append(rgTrim.Edge)217 218 #map(sc.doc.Objects.AddCurve, rgEs_Otr)219 220 rgBrep_Extended = Rhino.Geometry.Brep.CreateFromSurface(rgSrf_Ext)221 222 # How could this happen?223 if rgEs_Otr.Count + rgEs_Inr.Count == 0:224 if bEcho: print "Original brep was trimmed, but " \225 "no edges found with which to trim. Using full surface."226 return rgBrep_Extended227 228 # Trim face (surface) with both outer and inner edges.229 disposeUs.append(rgBrep_Extended)230 disposeUs.extend(rgEs_Otr + rgEs_Inr)231 232 # TO (Possibly) DO: If extending the curves when they don't need to233 # be becomes a problem, first check whether extended edge is a full234 # surface edge and create conditional based on that condition.235 236 # Join curves (edges).237 rgCs_Otr_Joined_All = rg.Curve.JoinCurves(rgEs_Otr)238 disposeUs.extend(rgCs_Otr_Joined_All)239 240 # Extend joined curves on surface, using SimplifyEnd at actual extensions241 # before the curves are exploded.242 rgFace_Ext = rgBrep_Extended.Faces[0]; disposeUs.append(rgFace_Ext)243 rgCs_Otr_Joined_Ext = []244 for rgC_Otr_Joined in rgCs_Otr_Joined_All:245 rgC_Otr_Joined_Ext = rgC_Otr_Joined.ExtendOnSurface(246 rg.CurveEnd.Both, rgFace_Ext)247 if rgC_Otr_Joined_Ext is None: continue248 disposeUs.append(rgC_Otr_Joined_Ext)249 250 ## Find extension "side" ends by comparing CurveEnd points, before vs. after ExtendOnSurface.251 # At extended "side" ends, use SimplifyEnd to simplify only that "side" end and adjacent segments.252 ptS0 = rgC_Otr_Joined.PointAtStart253 ptE0 = rgC_Otr_Joined.PointAtEnd254 ptS1 = rgC_Otr_Joined_Ext.PointAtStart255 ptE1 = rgC_Otr_Joined_Ext.PointAtEnd256 257 # CurveEnd.Start check and simplification.258 if not ptS1.EpsilonEquals(ptS0, fPtMatchTol):259 rgC_Otr_Joined_Ext_StartSimpl = rgC_Otr_Joined_Ext.SimplifyEnd(260 rg.CurveEnd.Start, rg.CurveSimplifyOptions.All,261 fPtMatchTol, sc.doc.ModelAngleToleranceRadians)262 if rgC_Otr_Joined_Ext_StartSimpl is None:263 rgC_Otr_Joined_Ext_StartSimpl = rgC_Otr_Joined_Ext # For CurveEnd.End processing.264 else:265 disposeUs.append(rgC_Otr_Joined_Ext)266 else: rgC_Otr_Joined_Ext_StartSimpl = rgC_Otr_Joined_Ext # For CurveEnd.End processing.267 268 # CurveEnd.End check and simplification.269 if not ptE1.EpsilonEquals(ptE0, fPtMatchTol):270 rgC_Otr_Joined_Ext = rgC_Otr_Joined_Ext_StartSimpl.SimplifyEnd(271 rg.CurveEnd.End, rg.CurveSimplifyOptions.All,272 fPtMatchTol, sc.doc.ModelAngleToleranceRadians)273 if rgC_Otr_Joined_Ext is None:274 rgC_Otr_Joined_Ext = rgC_Otr_Joined_Ext_StartSimpl275 else:276 disposeUs.append(rgC_Otr_Joined_Ext)277 rgCs_Otr_Joined_Ext.append(rgC_Otr_Joined_Ext)278 disposeUs.extend(rgCs_Otr_Joined_Ext)279 280 # Explode curves so that the proper vertices are replaced on the brep.281 rgCs_Otr_Ext_Segs_All = []282 for rgCrv_Otr_Ext in rgCs_Otr_Joined_Ext:283 rgCrvs_Otr_Ext_Segs = rgCrv_Otr_Ext.DuplicateSegments()284 rgCs_Otr_Ext_Segs_All.extend(rgCrvs_Otr_Ext_Segs)285 disposeUs.extend(rgCs_Otr_Ext_Segs_All)286 287 if bDebug: map(sc.doc.Objects.AddCurve, rgCs_Otr_Ext_Segs_All + rgEs_Inr)288 289 # Split full surface brep with curves.290 rgBrep_Split = rgFace_Ext.Split(rgCs_Otr_Ext_Segs_All + rgEs_Inr,291 sc.doc.ModelAbsoluteTolerance)292 if rgBrep_Split is None: dispose(disposeUs); return293 disposeUs.append(rgBrep_Split)294 295 # Check whether brep has more than one face before attempting to get correct face.296 if rgBrep_Split.Faces.Count > 1:297 # Get point on face of original brep for face matching.298 ptOnFace = xBrepFace.createPoint3dOnInterior(299 rgBrep0.Faces[0],300 fMinDistFromBorder=10.0*sc.doc.ModelAbsoluteTolerance)301 if ptOnFace is None:302 dispose(disposeUs); return303 304 # Get correct brep face.305 idx_rgFace_Pos = xBrep_findMatchingFace.usingPointOnFace(306 rgBrep_Split, ptOnFace)307 if idx_rgFace_Pos is None:308 dispose(disposeUs); return309 310 rgBrep_ForReplace = rgBrep_Split.Faces[311 idx_rgFace_Pos].DuplicateFace(False)312 disposeUs.append(rgBrep_ForReplace)313 else:314 if bEcho:315 print "Brep was not split. Replacing original with full surface..."316 rgBrep_ForReplace = rgBrep_Split317 318 return rgBrep_ForReplace319320321def main(bEcho=False, bDebug=False):322 323 disposeUs = []324 325 sTitle = "Extend Base Surface"326 327 ret = getBrepIdAndTrimIdx()328 if ret is None: return329 idBrep0, idxTrim, bSmooth = ret330 331 rgBrep0 = sc.doc.Objects.Find(idBrep0).BrepGeometry332 disposeUs.append(rgBrep0)333 if not isBrepReadyForExtend(rgBrep0, bEcho=bEcho, bDebug=bDebug):334 dispose(disposeUs); return Rhino.Commands.Result.Failure335 336 rgSrf0 = rgBrep0.Faces[0].UnderlyingSurface(); disposeUs.append(rgSrf0)337 if rgSrf0 is None:338 dispose(disposeUs); return Rhino.Commands.Result.Failure339 340 fExtLength = getExtensionFactor()341 if fExtLength is None: dispose(disposeUs); return342 343 rgTrim = rgBrep0.Trims[idxTrim]; disposeUs.append(rgTrim)344 345 # Create extended surface.346 rgSrf_Ext = rgSrf0.Extend(rgTrim.IsoStatus, fExtLength, bSmooth)347 if rgSrf_Ext is None: dispose(disposeUs); return348 disposeUs.append(rgSrf_Ext)349 if not isExtendedSrfOk(rgSrf_Ext, rgSrf0, bEcho=bEcho, bDebug=bDebug):350 dispose(disposeUs); return351 #sc.doc.Objects.AddSurface(rgSrf_Ext)352 353 # Was brep a full surface?354 if rgBrep0.IsSurface:355 if bEcho: print "Original brep was not trimmed. Using full surface."356 rgBrep_ForReplace = Rhino.Geometry.Brep.CreateFromSurface(rgSrf_Ext)357 else:358 rgBrep_ForReplace = trimExtendedSrf(rgSrf_Ext, rgBrep0, [idxTrim], bEcho=bEcho, bDebug=bDebug)359 if rgBrep_ForReplace is None: dispose(disposeUs); return360 361 if not sc.doc.Objects.Replace(idBrep0, rgBrep_ForReplace):362 dispose(disposeUs); return Rhino.Commands.Result.Failure363 364 sc.doc.Views.Redraw()365 366 dispose(disposeUs); return Rhino.Commands.Result.Success367368 ...

Full Screen

Full Screen

excel2Lua.py

Source:excel2Lua.py Github

copy

Full Screen

1import os2import sys3import codecs4import xlrd #http://pypi.python.org/pypi/xlrd5import traceback6import excel2sproto7'''示例代码8local JSON = require "cjson"9local function disposeNumArr(arr, rate)10 local newArr = {}11 for k, v in ipairs(arr) do 12 table.insert(newArr, v / rate)13 end14 return newArr15end16local function disposeStructArr_ntest(arr)17 local newArr = {}18 for k, v in ipairs(arr) do 19 v.count = v.count / rate20 table.insert(newArr, v)21 end22 return newArr23end24local function disposeValue(conf)25 conf.tnumber = conf.tnumber / 1026 conf.cost = JSON.decode(conf.cost)27 -- 数组28 conf.numbers = disposeNumArr(conf.numbers, 10)29 -- 结构体30 conf.nitem.count = conf.nitem.count / 10031 -- 结构体数组32 conf.ntest = disposeStructArr_ntest(conf.ntest)33 return conf34end35Configs[v.id] = disposeValue(v)36Configs[v.id] = v37'''38#前后换行39disposeNumArr = '''40local function disposeNumArr(arr, rate)41 local newArr = {}42 for k, v in ipairs(arr) do 43 table.insert(newArr, v / rate)44 end45 return newArr46end47'''48lua = '''TestConfigs = {}49local Configs = {}50|disposeValue|51function TestConfigs.InitModule()52 local data = ConfigMgr.ParseBytes("TestConfigs")53 for k, v in pairs(data.AllTestConfig) do 54 Configs[v.id] = disposeValueVV55 end56end57function TestConfigs.Get(id)58 return Configs[id]59end60function TestConfigs.GetAll()61 local arr = {}62 for k, v in pairs(Configs) do63 table.insert(arr, v)64 end65 return arr66end67return TestConfigs'''68#TestConfig -> TestConfigs.lua69def genLuaFile(table, exportPath):70 nrows = table.nrows71 ncols = table.ncols72 config = table.cell_value(0, 0)73 configs = config + "s"74 75 luaPath = exportPath + "/" + configs + ".lua"76 dir = os.path.dirname(luaPath)77 if dir and not os.path.exists(dir):78 os.makedirs(dir)79 file = codecs.open(luaPath, "w", "utf-8")80 81 luaFile = lua82 luaFile = luaFile.replace('AllTestConfig', 'All' + config)83 luaFile = luaFile.replace('TestConfigs', configs)84 disposeValueStr = ""85 hasJSON = False86 hasDisFunc = False87 hasDisposeNumArr = False88 hasStructArr = False89 #处理浮点,JSON90 sp_struct_arr = excel2sproto.collectStructArrayInfo(table, ncols)91 numStrcutArrDic = {}92 for c in range(0, ncols):93 #第3行是属性 第4行是数据类型94 propName = table.cell_value(3, c)95 propType = table.cell_value(4, c)96 if propName == "" or propType == "":97 continue #跳过空列98 if propType == "ignore":99 continue100 #JSON101 if propType == "json" or propType == "JSON":102 # conf.cost = JSON.decode(conf.cost)103 jsonVal = "\tconf.{0} = JSON.decode(conf.{1})\n".format(propName, propName)104 disposeValueStr = disposeValueStr + jsonVal105 hasJSON = True106 hasDisFunc = True107 #number108 # 处理结构体,数组,里面的浮点数109 if "number" in propType:110 rate = propType.replace('number', '')111 #number数组112 if propName.find("-") != -1 and propName.find('.') != -1:113 #结构体数组114 propNames = propName.split("-")115 prop0 = propNames[0]116 parts = propNames[1].split(".")117 part1 = parts[1]118 # ntest-0.count119 struct_item_index = parts[0]120 if struct_item_index == '0':121 if prop0 in sp_struct_arr:122 if not prop0 in numStrcutArrDic:123 numStrcutArrDic[prop0] = {}124 numStrcutArrDic[prop0][part1] = rate125 hasDisFunc = True126 hasStructArr = True127 elif propName.find("-") != -1:128 #数组129 propNames = propName.split("-")130 prop0 = propNames[0]131 if propNames[1] == "0":132 # conf.numbers = disposeNumArr(conf.numbers, 10)133 numArrVal = "\tconf.{0} = disposeNumArr(conf.{1}, {2})\n".format(prop0, prop0, rate)134 disposeValueStr = disposeValueStr + numArrVal135 hasDisFunc = True136 hasDisposeNumArr = True137 elif propName.find(".") != -1:138 #结构体139 # conf.nitem.count = conf.nitem.count / 100140 numStrcutVal = "\tconf.{0} = conf.{1} / {2}\n".format(propName, propName, rate)141 disposeValueStr = disposeValueStr + numStrcutVal142 hasDisFunc = True143 else:144 # conf.tnumber = conf.tnumber / 10145 numVal = "\tconf.{0} = conf.{1} / {2}\n".format(propName, propName, rate)146 disposeValueStr = disposeValueStr + numVal147 hasDisFunc = True148 if hasStructArr == True:149 numStructArrFunc = ""150 for k, v in numStrcutArrDic.items():151 # conf.ntest = disposeStructArr_ntest(conf.ntest)152 numStructArrVal = "\tconf.{0} = disposeStructArr_{1}(conf.{2})\n".format(k, k, k)153 disposeValueStr = disposeValueStr + numStructArrVal154 funcVal = "\nlocal function disposeStructArr_{}(arr)\n".format(k)155 funcVal = funcVal + "\tlocal newArr = {}\n"156 funcVal = funcVal + "\tfor k, v in ipairs(arr) do\n"157 for kk, vv in v.items():158 funcVal = funcVal + "\t\tv.{} = v.{} / {}\n".format(kk, kk, vv)159 funcVal = funcVal + "\t\ttable.insert(newArr, v)\n"160 funcVal = funcVal + "\tend\n"161 funcVal = funcVal + "\treturn newArr\n"162 funcVal = funcVal + "end\n"163 numStructArrFunc = numStructArrFunc + funcVal164 disposeValueStr = "\nlocal function disposeValue(conf)\n" + disposeValueStr165 disposeValueStr = disposeValueStr + "\treturn conf\nend\n"166 if hasStructArr == True:167 disposeValueStr = numStructArrFunc + disposeValueStr168 if hasDisposeNumArr == True:169 disposeValueStr = disposeNumArr + disposeValueStr170 if hasDisFunc == True:171 luaFile = luaFile.replace('|disposeValue|', disposeValueStr)172 luaFile = luaFile.replace('disposeValueVV', 'disposeValue(v)')173 else:174 luaFile = luaFile.replace('|disposeValue|', '')175 luaFile = luaFile.replace('disposeValueVV', 'v')176 if hasJSON == True:177 luaFile = "local JSON = require \"cjson\"\n\n" + luaFile178 file.write(luaFile)179 file.close()180def exportAll(excelPath, exportPath):181 excel = xlrd.open_workbook(excelPath)182 allSheetNames = excel.sheet_names()183 for name in allSheetNames:184 exports = name.split("_")185 if len(exports) > 1:186 if str(exports[1]) == "noexport":187 continue188 table = excel.sheet_by_name(name)189 genLuaFile(table, exportPath)190 print("generate lua done " + name)191if __name__ == '__main__':192 try:193 if len(sys.argv) < 2:194 print('excel2Lua argv error')195 os.system("pause")196 197 excelPath = sys.argv[1]198 exportPath = sys.argv[2]199 200 exportAll(excelPath, exportPath)201 print("All OK")202 except:203 traceback.print_exc()...

Full Screen

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful