Lines Matching +full:write +full:- +full:output
3 """Conversions to/from quoted-printable transport encoding as per RFC 1521."""
25 quoted. Note that line-ending tabs and spaces are always encoded, as per
42 def encode(input, output, quotetabs, header = 0): argument
43 """Read 'input', apply quoted-printable encoding, and write to 'output'.
45 'input' and 'output' are files with readline() and write() methods.
47 quoted. Note that line-ending tabs and spaces are always encoded, as per
56 output.write(odata)
59 def write(s, output=output, lineEnd='\n'): argument
62 if s and s[-1:] in ' \t':
63 output.write(s[:-1] + quote(s[-1]) + lineEnd)
65 output.write(quote(s) + lineEnd)
67 output.write(s + lineEnd)
77 if line[-1:] == '\n':
78 line = line[:-1]
80 # Calculate the un-length-limited encoded line
88 # First, write out the previous line
90 write(prevline)
91 # Now see if we need any soft line breaks because of RFC-imposed
92 # length limitations. Then do the thisline->prevline dance.
97 write(thisline[:MAXLINESIZE-1], lineEnd='=\n')
98 thisline = thisline[MAXLINESIZE-1:]
99 # Write out the current line
101 # Write out the last line, without a trailing newline
103 write(prevline, lineEnd=stripped)
116 def decode(input, output, header = 0): argument
117 """Read 'input', apply quoted-printable decoding, and write to 'output'.
118 'input' and 'output' are files with readline() and write() methods.
124 output.write(odata)
132 if n > 0 and line[n-1] == '\n':
133 partial = 0; n = n-1
135 while n > 0 and line[n-1] in " \t\r":
136 n = n-1
151 else: # Bad escape sequence -- leave it in
154 output.write(new + '\n')
157 output.write(new)
182 i = ord('a')-10
184 i = ord('A')-10
187 bits = bits*16 + (ord(c) - i)
200 print "usage: quopri [-t | -d] [file] ..."
201 print "-t: quote tabs"
202 print "-d: decode; default encode"
207 if o == '-t': tabs = 1
208 if o == '-d': deco = 1
211 print "-t and -d are mutually exclusive"
213 if not args: args = ['-']
216 if file == '-':
222 sys.stderr.write("%s: can't open (%s)\n" % (file, msg))