diff options
author | AlKorgun@gmail.com <AlKorgun@gmail.com@94c44753-77e5-68b8-8764-2ca2b8acb85e> | 2012-10-14 16:00:44 +0400 |
---|---|---|
committer | AlKorgun@gmail.com <AlKorgun@gmail.com@94c44753-77e5-68b8-8764-2ca2b8acb85e> | 2012-10-14 16:00:44 +0400 |
commit | 61a6fdc2ddbf2b16e62c56c87f877ab726ed32db (patch) | |
tree | 6095816835da2a1ba696131a77b6d7b2013baa03 /expansions | |
parent | da9ce1f7d8ee223cba175bffa2078e956a75c077 (diff) |
some fixes and core update (Web.open, Web.download added)
Diffstat (limited to 'expansions')
-rw-r--r-- | expansions/access/code.py | 12 | ||||
-rw-r--r-- | expansions/alive_keeper/code.py | 4 | ||||
-rw-r--r-- | expansions/allweb/code.py | 8 | ||||
-rw-r--r-- | expansions/cron/code.py | 8 | ||||
-rw-r--r-- | expansions/talkers/code.py | 12 | ||||
-rw-r--r-- | expansions/turn/code.py | 30 |
6 files changed, 37 insertions, 37 deletions
diff --git a/expansions/access/code.py b/expansions/access/code.py index 23739f1..61d1101 100644 --- a/expansions/access/code.py +++ b/expansions/access/code.py @@ -82,7 +82,7 @@ class expansion_temp(expansion): def command_set_access(self, ltype, source, body, disp): - def set_access(self, instance, access = None): + def set_access(instance, access = None): if access != None: Galist[instance] = access else: @@ -113,14 +113,14 @@ class expansion_temp(expansion): access = body.pop(0) if access == "!": if Galist.has_key(instance): - set_access(self, instance) + set_access(instance) answer = AnsBase[4] else: answer = self.AnsBase[6] % (Nick) elif isNumber(access): access = int(access) if access in xrange(-1, 9): - set_access(self, instance, access) + set_access(instance, access) answer = AnsBase[4] else: answer = self.AnsBase[7] @@ -136,7 +136,7 @@ class expansion_temp(expansion): def command_set_local_access(self, ltype, source, body, disp): - def set_access(self, conf, instance, access = None): + def set_access(conf, instance, access = None): if access != None: Chats[conf].alist[instance] = access else: @@ -166,7 +166,7 @@ class expansion_temp(expansion): access = body.pop(0) if access == "!": if Chats[source[1]].alist.has_key(instance): - set_access(self, source[1], instance) + set_access(source[1], instance) answer = AnsBase[4] else: answer = self.AnsBase[6] % (Nick) @@ -174,7 +174,7 @@ class expansion_temp(expansion): if isNumber(access): access = int(access) if access in xrange(7): - set_access(self, source[1], instance, access) + set_access(source[1], instance, access) answer = AnsBase[4] else: answer = self.AnsBase[8] diff --git a/expansions/alive_keeper/code.py b/expansions/alive_keeper/code.py index d845b33..ba6dd5f 100644 --- a/expansions/alive_keeper/code.py +++ b/expansions/alive_keeper/code.py @@ -14,8 +14,8 @@ class expansion_temp(expansion): def alive_keeper(self): - def alive_keeper_answer(disp, answer): - if answer: + def alive_keeper_answer(disp, stanza): + if stanza: Clients[get_disp(disp)].aKeeper = itypes.Number() while VarCache["alive"]: diff --git a/expansions/allweb/code.py b/expansions/allweb/code.py index df76e1e..daefe28 100644 --- a/expansions/allweb/code.py +++ b/expansions/allweb/code.py @@ -48,7 +48,7 @@ class expansion_temp(expansion): def sub_ehtmls(self, data): if data.count("&"): - def e_sb(co, edefs = self.edefs): + def e_sb(co): co = co.group(1) if co.startswith("#"): if chr(120) == co[1].lower(): @@ -60,9 +60,9 @@ class expansion_temp(expansion): assert (-1 < Numb < 65535) Char = unichr(Numb) except: - Char = edefs.get(Char, "&%s;" % co) + Char = self.edefs.get(Char, "&%s;" % co) else: - Char = edefs.get(co, "&%s;" % co) + Char = self.edefs.get(co, "&%s;" % co) return Char data = self.compile_ehtmls.sub(e_sb, data) @@ -281,7 +281,7 @@ class expansion_temp(expansion): if list: comp = compile__('<td align="center">%s((?:\d\.\d)+|\d+?)</font></td><td>%s<a href="/title/tt\d+?/">' \ '(.+?)</a>(.+?)</font></td><td align="right">%s(.+?)</font>' \ - '</td>' % (('<font face="Arial, Helvetica, sans-serif" size="-1">',)*3), 16).findall(Web(get_text("http://www.imdb.com/chart/top").get_page(), '<div id="main">', "</div>")) + '</td>' % (('<font face="Arial, Helvetica, sans-serif" size="-1">',)*3), 16) list = comp.findall(list) if list: Number = itypes.Number() diff --git a/expansions/cron/code.py b/expansions/cron/code.py index ba9d891..58e3899 100644 --- a/expansions/cron/code.py +++ b/expansions/cron/code.py @@ -18,7 +18,7 @@ class expansion_temp(expansion): def def_cron(self): - def exe_cron(self, command, instance, ls, repeat = ()): + def exe_cron(command, instance, ls, repeat = ()): inst = get_source(ls[1][1], ls[1][2]) if inst == instance or (not inst or not instance): gt = time.mktime(time.gmtime()) @@ -39,7 +39,7 @@ class expansion_temp(expansion): for id, (date, ls) in self.CronDesc.items(): if Time > date: if Cmds.has_key(ls[0]): - sThread("command(cron)", exe_cron, (self,).__add__(ls)) + sThread("command(cron)", exe_cron, ls) del self.CronDesc[id] def getDate(self, ls, sft, sftime = "%H:%M:%S (%d.%m.%Y)"): @@ -62,7 +62,7 @@ class expansion_temp(expansion): ls[0] += 1 return time.strftime(sftime, time.struct_time(ls)) - def add_cron(self, disp, ls, body, Te, source, ltype, gt, answer, repeat, **ext_): + def add_cron(self, disp, ls, body, Te, source, ltype, gt, answer, repeat, **etc): cmd = (ls.pop(0)).lower() if Cmds.has_key(cmd): if enough_access(source[1], source[2], Cmds[cmd].access): @@ -121,7 +121,7 @@ class expansion_temp(expansion): for x in xrange(1, Tr): t_ls.append(t_ls[-1] + Te) ltls = len(t_ls) - t_ls = enumerated_list([self.getDate(list(gt), Tx) for Tx in t_ls[:8]]) + t_ls = enumerated_list([self.getDate(list(gt), dt) for dt in t_ls[:8]]) if ltls > 8: t_ls += self.AnsBase[3] % (ltls - 8) answer = self.AnsBase[4] % (t_ls) diff --git a/expansions/talkers/code.py b/expansions/talkers/code.py index f96f391..78f78cf 100644 --- a/expansions/talkers/code.py +++ b/expansions/talkers/code.py @@ -68,7 +68,7 @@ class expansion_temp(expansion): answer = AnsBase[2] elif a1 in ("global", "глобальный".decode("utf-8")): - def get_talker_stat(self, source_): + def get_talker_stat(source_): x, y = 0, 0 for conf in Chats.keys(): filename = cefile(chat_file(conf, self.TalkersFile)) @@ -88,7 +88,7 @@ class expansion_temp(expansion): if a2 in ("mine", "мой".decode("utf-8")): source_ = get_source(source[1], source[2]) if source_: - answer = get_talker_stat(self, source_) + answer = get_talker_stat(source_) else: answer = self.AnsBase[1] else: @@ -99,7 +99,7 @@ class expansion_temp(expansion): if not isSource(source_): source_ = None if source_: - answer = get_talker_stat(self, source_) + answer = get_talker_stat(source_) else: Glob_dbs = {} for conf in Chats.keys(): @@ -131,7 +131,7 @@ class expansion_temp(expansion): answer = self.AnsBase[1] elif a1 in ("local", "локальный".decode("utf-8")): - def get_talker_stat(self, source_, conf): + def get_talker_stat(source_, conf): filename = cefile(chat_file(conf, self.TalkersFile)) with self.TalkersDesc[conf]: with database(filename) as db: @@ -146,7 +146,7 @@ class expansion_temp(expansion): if a2 in ("mine", "мой".decode("utf-8")): source_ = get_source(source[1], source[2]) if source_: - answer = get_talker_stat(self, source_, source[1]) + answer = get_talker_stat(source_, source[1]) else: answer = self.AnsBase[1] else: @@ -157,7 +157,7 @@ class expansion_temp(expansion): if not isSource(source_): source_ = None if source_: - answer = get_talker_stat(self, source_, source[1]) + answer = get_talker_stat(source_, source[1]) else: filename = cefile(chat_file(source[1], self.TalkersFile)) with self.TalkersDesc[source[1]]: diff --git a/expansions/turn/code.py b/expansions/turn/code.py index 565c128..0830ea1 100644 --- a/expansions/turn/code.py +++ b/expansions/turn/code.py @@ -19,23 +19,23 @@ class expansion_temp(expansion): def command_turn(self, ltype, source, body, disp): - def Turn(self, conf, body): + def Turn(conf, body): desc = {} - for nick in Chats[conf].get_nicks(): - if Chats[conf].isHereTS(nick): - for x in (["%s%s" % (nick, Key) for Key in [":",",",">"]] + [nick]): - if body.count(x): + for Nick in Chats[conf].get_nicks(): + if Chats[conf].isHereTS(Nick): + for app in (["%s%s" % (Nick, Key) for Key in (":",",",">")] + [Nick]): + if body.count(app): Numb = "*%s*" % str(len(desc.keys()) + 1) - desc[Numb] = x - body = body.replace(x, Numb) - Turned = "" - for x in body: - if x in self.TableEN: - Turned += self.TableRU[self.TableEN.index(x)] - elif x in self.TableRU: - Turned += self.TableEN[self.TableRU.index(x)] + desc[Numb] = app + body = body.replace(app, Numb) + Turned = str() + for smb in body: + if smb in self.TableEN: + Turned += self.TableRU[self.TableEN.index(smb)] + elif smb in self.TableRU: + Turned += self.TableEN[self.TableRU.index(smb)] else: - Turned += x + Turned += smb return sub_desc(Turned, desc) if Chats.has_key(source[1]): @@ -45,7 +45,7 @@ class expansion_temp(expansion): source_ = get_source(source[1], source[2]) if source_ and self.TurnBase[source[1]].has_key(source_): (Time, body) = self.TurnBase[source[1]].pop(source_) - body = "Turn\->\n[%s] <%s>: %s" % (Time, source[2], Turn(self, source[1], body)) + body = "Turn\->\n[%s] <%s>: %s" % (Time, source[2], Turn(source[1], body)) Msend(source[1], body, disp) else: answer = AnsBase[7] |