Merged diverged heads

Sun, 17 May 2015 20:42:32 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 17 May 2015 20:42:32 +0300
changeset 141
506e951fd338
parent 140
631451eecefc (diff)
parent 138
d0184734320e (current diff)
child 142
247454178654

Merged diverged heads

--- 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 '''<value %s>''' % (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)
--- 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()
--- 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))
--- 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
 

mercurial