# HG changeset patch # User Teemu Piippo # Date 1431884552 -10800 # Node ID 506e951fd3383395af4cfbcc062cad0d07e39c52 # Parent 631451eecefcb63382043b3a050bba8b9d60347e# Parent d0184734320e03fc7b9987bbcd440e0f473d2afb Merged diverged heads diff -r d0184734320e -r 506e951fd338 calc.py --- a/calc.py Fri May 08 04:23:48 2015 +0300 +++ b/calc.py Sun May 17 20:42:32 2015 +0300 @@ -76,6 +76,16 @@ def __repr__ (self): return self.__str__() +class Value (object): + def __init__ (self, value): + self.value = value + + def __str__ (self): + return '''''' % (self.value) + + def __repr__ (self): + return self.__str__() + def do_realf (func, *args): for x in args: if x.imag: @@ -338,7 +348,7 @@ raise ValueError ('end of expression encountered while parsing ' 'base-%d literal' % base) - return (complex (int (expr[startingIndex:i], base), 0), i) + return (Value (int (expr[startingIndex:i], base)), i) if expr[0] == 'i': # Special case, we just have 'i' -- need special handling here because otherwise this would @@ -351,9 +361,9 @@ try: while i < len (expr): if expr[i] == 'i': - value = complex (0.0, float (expr[:i])) + value = Value (float (expr[:i]) * 1j) else: - value = complex (float (expr [:i + 1]), 0.0) + value = Value (float (expr [:i + 1])) i += 1 return (value, i) @@ -537,7 +547,7 @@ self.tabs = self.tabs[:-1] printFunc (self.tabs + 'Evaluating function call: %s' % (sym)) - expr[i] = Functions[sym.funcname]['function'] (*sym.args) + expr[i] = Value (Functions[sym.funcname]['function'] (*[x.value for x in sym.args])) printFunc (self.tabs + '-> %s' % expr[i]) i += 1 @@ -561,7 +571,7 @@ args = [expr[x] for x in argIndices] argIndices = sorted (argIndices, reverse=True) printFunc (self.tabs + 'Processing: (%s, %d) with args %s' % (op, i, args)) - expr[i] = op.function (*args) + expr[i] = Value (op.function (*[x.value for x in args])) printFunc (self.tabs + '-> %s' % expr[i]) for i2 in argIndices: @@ -653,5 +663,5 @@ self.process_parens (expr) self.process_functions (expr) self.process_operators (expr) - result = self.evaluate (expr, verbose) + result = self.evaluate (expr, verbose).value return self.represent (result) diff -r d0184734320e -r 506e951fd338 cobalt.py --- a/cobalt.py Fri May 08 04:23:48 2015 +0300 +++ b/cobalt.py Sun May 17 20:42:32 2015 +0300 @@ -105,7 +105,8 @@ raise ValueError ("unknown autoconnect entry %s" % (aconn)) # Start the REST server - Rest.RESTServer() + if Config.get_node ('rest').get_value ('active', True): + Rest.RESTServer() g_BotActive = True asyncore.loop() diff -r d0184734320e -r 506e951fd338 hgpoll.py --- a/hgpoll.py Fri May 08 04:23:48 2015 +0300 +++ b/hgpoll.py Sun May 17 20:42:32 2015 +0300 @@ -301,8 +301,8 @@ for repo in all_repo_names(): check_repo_exists (repo) + g_CommitsDb = CommitsDb() repocheck_timeout = time.time() + 15 - g_CommitsDb = CommitsDb() global ZDoomRevNumber try: @@ -421,17 +421,18 @@ alreadyAdded = len (existingrepos) > 0 delim = '@@@@@@@@@@' - data = get_commit_data (zanrepo, commit_node, delim.join (['{author}', '{bookmarks}', \ + data = get_commit_data (zanrepo, commit_node, delim.join (['{node}', '{author}', '{bookmarks}', \ '{date|hgdate}'])).split (delim) - commit_author = data[0] - commit_bookmarks = prettify_bookmarks (data[1]) - commit_time = int (data[2].split (' ')[0]) + commit_full_node = data[0] + commit_author = data[1] + commit_bookmarks = prettify_bookmarks (data[2]) + commit_time = int (data[3].split (' ')[0]) commit_url = '%s/commits/%s' % (repo_url, commit_node) commit_email = '' # If the commit was already in the commits database, it is not a new one and we should # not react to it. Still add it to the db though so that the new repo name is added. - g_CommitsDb.add_commit (repo=repo_name, changeset=commit_node, timestamp=commit_time) + g_CommitsDb.add_commit (repo=repo_name, changeset=commit_full_node, timestamp=commit_time) if alreadyAdded: print ('''I already know of %s - they're in %s - not announcing.''' % (commit_node, existingrepos)) @@ -537,6 +538,7 @@ Irc.broadcast ('Error while dealing with ZDoom upgrade number: %s' % e) def update_zadev_topic(): + return fraction = float (ZDoomRevNumber - ZDoomMin) / (ZDoomMax - ZDoomMin) topicText = """ZDoom 2.6.1 progress: at r%d, %d revisions left (%d%% complete)""" %\ (ZDoomRevNumber, ZDoomMax - ZDoomRevNumber, round (fraction * 100)) diff -r d0184734320e -r 506e951fd338 irc.py --- a/irc.py Fri May 08 04:23:48 2015 +0300 +++ b/irc.py Sun May 17 20:42:32 2015 +0300 @@ -100,6 +100,7 @@ all_clients.append (self) asyncore.dispatcher.__init__ (self) self.create_socket (socket.AF_INET, socket.SOCK_STREAM) + print "Connecting to [%s] %s:%d..." % (self.name, self.host, self.port) self.connect ((self.host, self.port)) ClientsByName[self.name] = self