From db939f2cece528a0746e8e1f4a0eaf3626b97f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Fri, 10 Jun 2005 11:00:30 +0000 Subject: [PATCH] =?UTF-8?q?d=C3=BCzenleme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libbuild/shell.py | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/libbuild/shell.py b/src/libbuild/shell.py index 2f33d41f..fc3dcb49 100644 --- a/src/libbuild/shell.py +++ b/src/libbuild/shell.py @@ -5,37 +5,37 @@ import sys, re from itertools import izip, imap, count, ifilter, ifilterfalse def cat( filename ): - return file( filename ).xreadlines() + return file( filename ).xreadlines() class grep: - """keep only lines that match the regexp""" - def __init__( self,pat, flags = 0 ): - self.fun = re.compile( pat, flags ).match - def __ror__( self, input ): - return ifilter( self.fun, input ) + """keep only lines that match the regexp""" + def __init__( self,pat, flags = 0 ): + self.fun = re.compile( pat, flags ).match + def __ror__( self, input ): + return ifilter( self.fun, input ) class tr: - """apply arbitrary transform to each sequence element""" - def __init__( self, transform ): - self.tr = transform - def __ror__( self, input ): - return imap( self.tr, input ) + """apply arbitrary transform to each sequence element""" + def __init__( self, transform ): + self.tr = transform + def __ror__( self, input ): + return imap( self.tr, input ) class printto: - """print sequence elements one per line""" - def __init__( self, out = sys.stdout ): - self.out=out - def __ror__( self,input ): - for l in input: - print >> self.out, l + """print sequence elements one per line""" + def __init__( self, out = sys.stdout ): + self.out = out + def __ror__( self,input ): + for l in input: + print >> self.out, l printlines = printto( sys.stdout ) class terminator: - def __init__( self,method ): - self.process = method - def __ror__( self,input ): - return self.process( input ) + def __init__( self,method ): + self.process = method + def __ror__( self,input ): + return self.process( input ) aslist = terminator( list ) asdict = terminator( dict ) @@ -44,20 +44,20 @@ join = terminator( "".join ) enum = terminator( enumerate ) class sort: - def __ror__( self,input ): - ll = list( input ) - ll.sort() - return ll + def __ror__( self,input ): + ll = list( input ) + ll.sort() + return ll sort = sort() class uniq: - def __ror__( self,input ): - for i in input: - try: - if i == prev: - continue - except NameError: - pass - prev = i - yield i + def __ror__( self,input ): + for i in input: + try: + if i == prev: + continue + except NameError: + pass + prev = i + yield i uniq = uniq()