Fix for older version of six
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Tue, 11 Feb 2014 16:28:46 +0000 (16:28 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Tue, 11 Feb 2014 16:28:46 +0000 (16:28 +0000)
decoratedstr.py

index d226d42b592a743790a150387c14d53c5e009d1c..0672138d710a488f2fa1faa23ec47ed5512010ab 100755 (executable)
@@ -125,20 +125,20 @@ if __name__ == '__main__':
     if not args:
         print('Missing required parameter. Try "Œuf"', file=sys.stderr)
         sys.exit(1)
-    if six.PY2:
-        input = unicode(b' '.join(args), options.charset)
-    else:
+    if six.PY3:
         input = ' '.join(args)
+    else:
+        input = unicode(b' '.join(args), options.charset)
     #print("input:", input)                            # Œuf
     #print("undecorated:", remove_decoration(input))   # Oeuf
     #print("regex:", decorated_match(input))           # (œ|Œ|[oòóôöøōŏőOÒÓÔÖØŌŎŐ][eèéêëēĕėęěEÈÉÊËĒĔĖĘĚ])[uùúûüũūŭůűųUÙÚÛÜŨŪŬŮŰŲ][fF]
     if options.regexp:
-        if six.PY2:
-            print(decorated_match(input, options.casesensitive).encode(options.charset))
-        else:
+        if six.PY3:
             print(decorated_match(input, options.casesensitive))
-    else:
-        if six.PY2:
-            print(remove_decoration(input).encode(options.charset))
         else:
+            print(decorated_match(input, options.casesensitive).encode(options.charset))
+    else:
+        if six.PY3:
             print(remove_decoration(input))
+        else:
+            print(remove_decoration(input).encode(options.charset))