sys.stdin.read.rstrip

Here are the examples of the python api sys.stdin.read.rstrip taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: Voodoo-Mock Source File: main.py
def main( args ):
    input = sys.stdin.read().rstrip()
    if "" in input.split( "\n" ):
        sys.stdout.write( "ERROR: Empty lines are not allowed in input" )
        exit( 1 )

    if args.filename.endswith( ".py" ):
        if args.cmd == "indent":
            parse = parsesimplecall.ParseSimpleCall( input )
            print formatcolums.FormatColums( parse, args ).format()
        elif args.cmd == "indentCPPDeclaration":
            assert False, "Command 'indentCPPDeclaration' not valid for .py files"
        elif args.cmd == "constructorReferenceArguments":
            print constructorreferenceargumentspy.ConstructorReferenceArgumentsPy( input, args ).format()
        else:
            assert False
    elif args.filename.endswith( ".cpp" ) or args.filename.endswith( ".h" ) or args.filename.endswith( ".c" ):
        if args.cmd == "indent":
            classify = parsecpp.Classification( input )
            if classify.memberList():
                parse = parsecppmemberlist.ParseCPPMemberList( input )
            elif input.rstrip().endswith( ';' ):
                #guess: ends with ; is a call, not a declaration
                parse = parsesimplecall.ParseSimpleCall( input )
            else:
                parse = parsecppfunctionsignature.ParseCPPFunctionSignature( input )
            print formatcolums.FormatColums( parse, args ).format()
        elif args.cmd == "indentCPPDeclaration":
            parse = parsecppfunctionsignature.ParseCPPFunctionSignature( input )
            print formatcolums.FormatColums( parse, args ).format()
        elif args.cmd == "constructorReferenceArguments":
            print constructorreferenceargumentscpp.ConstructorReferenceArgumentsCPP( input, args ).format()
        else:
            assert False
    else:
        raise Exception( "Unfamiliar with extension of file '%s'" % args.filename )