SF.net SVN: geany:[4680] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Feb 21 13:21:39 UTC 2010


Revision: 4680
          http://geany.svn.sourceforge.net/geany/?rev=4680&view=rev
Author:   eht16
Date:     2010-02-21 13:21:39 +0000 (Sun, 21 Feb 2010)

Log Message:
-----------
Minor fixes.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/scripts/create_py_tags.py

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-02-20 17:28:46 UTC (rev 4679)
+++ trunk/ChangeLog	2010-02-21 13:21:39 UTC (rev 4680)
@@ -1,3 +1,9 @@
+2010-02-21  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * scripts/create_py_tags.py:
+   Minor fixes.
+
+
 2010-02-20 Dominic Hopf <dmaphy(at)googlemail(dot)com>
  * doc/geany.txt:
    add more detailed hints about reloading configuration (thanks to Tony Rick)

Modified: trunk/scripts/create_py_tags.py
===================================================================
--- trunk/scripts/create_py_tags.py	2010-02-20 17:28:46 UTC (rev 4679)
+++ trunk/scripts/create_py_tags.py	2010-02-21 13:21:39 UTC (rev 4680)
@@ -15,9 +15,7 @@
 import datetime
 import imp
 import inspect
-import os
 import re
-import string
 import sys
 import types
 
@@ -44,21 +42,21 @@
 		self.re_matcher = re.compile(tag_regexp)
 
 	#----------------------------------------------------------------------
-	def _get_superclass(self, c):
+	def _get_superclass(self, _object):
 		"""
 		Python class base-finder
 		(found on http://mail.python.org/pipermail/python-list/2002-November/173949.html)
 
-		@param c (object)
+		@param _object (object)
 		@return superclass (object)
 		"""
 		try:
 			#~ TODO print inspect.getmro(c)
-			if type(c) == types.ClassType:
-				return c.__bases__[0].__name__
+			if type(_object) == types.ClassType:
+				return _object.__bases__[0].__name__
 			else:
-				return c.__mro__[1].__name__
-		except Exception, e:
+				return _object.__mro__[1].__name__
+		except IndexError:
 			return ''
 
 	#----------------------------------------------------------------------
@@ -91,7 +89,7 @@
 			specs.append(formatvarargs(varargs))
 		if varkw is not None:
 			specs.append(formatvarkw(varkw))
-		return '(' + string.join(specs, ', ') + ')'
+		return ', '.join(specs)
 
 	#----------------------------------------------------------------------
 	def _add_tag(self, obj, tag_type, parent=''):
@@ -106,7 +104,7 @@
 		scope = ''
 		try:
 			args = apply(self._formatargspec, inspect.getargspec(obj))
-		except TypeError, KeyError:
+		except (TypeError, KeyError):
 			pass
 		if parent:
 			if tag_type == TYPE_CLASS:
@@ -131,7 +129,11 @@
 		"""
 		try:
 			module = imp.load_source('tags_file_module', filename)
-		except Exception, e:
+		except IOError, e:
+			# file not found
+			print '%s: %s' % (filename, e)
+			return
+		except Exception:
 			module = None
 
 		if module:
@@ -143,7 +145,7 @@
 					name = obj_name
 				if not name or not isinstance(name, basestring) or name.startswith('_'):
 					# skip non-public tags
-					continue;
+					continue
 				if inspect.isfunction(obj):
 					self._add_tag(obj, TYPE_FUNCTION)
 				elif inspect.isclass(obj):
@@ -159,14 +161,14 @@
 						self._add_tag(m_obj, TYPE_FUNCTION, name)
 		else:
 			# plain regular expression based parsing
-			fp = open(filename)
-			for line in fp:
+			filep = open(filename)
+			for line in filep:
 				m = self.re_matcher.match(line)
 				if m:
 					tag_type_str, tagname, args = m.groups()
 					if not tagname or tagname.startswith('_'):
 						# skip non-public tags
-						continue;
+						continue
 					if tag_type_str == 'class':
 						tag_type = TYPE_CLASS
 					else:
@@ -175,7 +177,7 @@
 					tag = '%s%s%s%s%s\n' % (tagname, TA_TYPE, tag_type, TA_ARGLIST, args)
 					if not tagname in self.tags:
 						self.tags[tagname] = tag
-			fp.close()
+			filep.close()
 
 	#----------------------------------------------------------------------
 	def write_to_file(self, filename):
@@ -188,14 +190,14 @@
 		# sort the tags
 		result.sort()
 		# write them
-		fp = open(filename, 'wb')
-		fp.write(
+		target_file = open(filename, 'wb')
+		target_file.write(
 			'# format=tagmanager - Automatically generated file - do not edit (created on %s)\n' % \
 			datetime.datetime.now().ctime())
-		for s in result:
-			if not s == '\n': # skip empty lines
-				fp.write(s)
-		fp.close()
+		for symbol in result:
+			if not symbol == '\n': # skip empty lines
+				target_file.write(symbol)
+		target_file.close()
 
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list