Only in Twisted-New: build
Only in Twisted-New/twisted: __init__.pyc
Only in Twisted-New/twisted: _version.pyc
Only in Twisted-New/twisted: copyright.pyc
Only in Twisted-New/twisted/python: __init__.pyc
diff -ur Twisted/twisted/python/_utilpy3.py Twisted-New/twisted/python/_utilpy3.py
--- Twisted/twisted/python/_utilpy3.py	Sat Oct 27 04:03:06 2012
+++ Twisted-New/twisted/python/_utilpy3.py	Sat Oct 27 06:09:16 2012
@@ -8,7 +8,7 @@
 
 from __future__ import division, absolute_import
 
-import sys, errno, warnings
+import sys, errno, warnings, string
 
 class FancyEqMixin:
     """
@@ -170,16 +170,24 @@
     @type mname: C{str}
     @param mname: The name to convert to a label.  This must be a string
     which could be used as a Python identifier.  Strings which do not take
-    this form will result in unpredictable behavior.
+    this form will raise an AssertionError.
 
     @rtype: C{str}
     """
+    #check that mname is a valid indentifier
+    assert (mname[0] in string.letters) or (mname[0] == '_') #check that the first character is valid
+    assert all(map(lambda char : (char in string.letters) or (char in string.digits) or (char == '_'), mname)) #check that each character after the first is valid
+    
     labelList = []
     word = ''
     lastWasUpper = False
     for letter in mname:
-        if letter.isupper() == lastWasUpper:
-            # Continuing a word.
+        currentIsUpper = letter.isupper() or (lastWasUpper and (letter in (string.digits + string.punctuation))) #If an all caps is broken up by digits or punctuation it will remain one word
+        if letter == "_":
+            labelList.append(word)
+            word = ''
+        elif currentIsUpper == lastWasUpper:
+            # Continuing a word. Runs if word is a series of lowercase or capital letters.
             word += letter
         else:
             # breaking a word OR beginning a word
@@ -189,20 +197,23 @@
                     # keep going
                     word += letter
                 else:
-                    # acronym
-                    # we're processing the lowercase letter after the acronym-then-capital
-                    lastWord = word[:-1]
-                    firstLetter = word[-1]
-                    labelList.append(lastWord)
-                    word = firstLetter + letter
+                    #acronym
+                    labelList.append(word)
+                    word = letter.upper()
             else:
                 # definitely breaking: lower to upper
                 labelList.append(word)
                 word = letter
-        lastWasUpper = letter.isupper()
+        lastWasUpper = currentIsUpper
     if labelList:
         labelList[0] = labelList[0].capitalize()
     else:
         return mname.capitalize()
     labelList.append(word)
-    return ' '.join(labelList)
+
+    # removes excess spaces
+    labelList = map(lambda a_string : a_string.strip(), labelList)
+    labelList = filter(lambda char :char not in string.whitespace, labelList)
+    final_name = ' '.join(labelList).strip()
+    
+    return final_name
Only in Twisted-New/twisted/python: compat.pyc
Only in Twisted-New/twisted/python: dist.pyc
Only in Twisted-New/twisted/python: hashlib.pyc
Only in Twisted-New/twisted/python/test: test_util.pyc
diff -ur Twisted/twisted/python/test/test_utilpy3.py Twisted-New/twisted/python/test/test_utilpy3.py
--- Twisted/twisted/python/test/test_utilpy3.py	Sat Oct 27 04:03:05 2012
+++ Twisted-New/twisted/python/test/test_utilpy3.py	Sat Oct 27 05:52:57 2012
@@ -398,6 +398,14 @@
             ('foo', 'Foo'),
             ('fooBar', 'Foo Bar'),
             ('fooBarBaz', 'Foo Bar Baz'),
+            ('FOObar', 'FOO Bar'),
+            ('fooBAR', 'Foo BAR'),
+            ('F22BAR', 'F22BAR'),
+            ('F22jam', 'F22 Jam'),
+            ('FOO_BAR', 'FOO BAR'),
+            ('spam_AND_eggs', 'Spam AND Eggs'),
+            ('rmswaveRMSWAVErmswaveRMSWAVE', 'Rmswave RMSWAVE Rmswave RMSWAVE'),
+            ('MyMilkshakesBR1NG_AL2_th3', 'My Milkshakes BR1NG AL2 Th3'),
             ]
         for inp, out in nameData:
             got = util.nameToLabel(inp)
Only in Twisted-New/twisted/python/test: test_utilpy3.pyc
Only in Twisted-New/twisted/python: versions.pyc
