else:
return Colors.Null
+ @staticmethod
+ def Default (argv = []):
+ return Colors.ANSI
+
class FancyDiffer:
for l in f1:
sys.stdout.writelines (["-", colors.green, l1, colors.end])
+
class DiffFilters:
@staticmethod
sys.stdout.writelines (l)
+class ShapeFilters:
+
+ @staticmethod
+ def filter_failures (f):
+ for l in f:
+ if l[0] in '-+':
+ sys.stdout.writelines (l)
+
+
class UtilMains:
@staticmethod
sys.exit (1)
for s in sys.argv[1:]:
- callback (open_file_or_stdin (s))
+ callback (FileHelpers.open_file_or_stdin (s))
@staticmethod
def filter_multiple_strings_or_stdin (callback, string_mnemonic, \
if '--stdin' in sys.argv:
sys.argv.remove ('--stdin')
- for line in sys.stdin.readlines ():
+ while (1):
+ line = sys.stdin.readline ()
+ if not len (line):
+ break
print callback (line)
else:
args = sys.argv[1:]
s = [unichr (int (x, 16)) for x in re.split ('[, \n]', s) if len (x)]
return ' + '.join (Unicode.pretty_name (x) for x in s)
-def open_file_or_stdin (f):
- if f == '-':
- return sys.stdin
- return file (f)
+
+class FileHelprs:
+
+ @staticmethod
+ def open_file_or_stdin (f):
+ if f == '-':
+ return sys.stdin
+ return file (f)
if __name__ == '__main__':
pass