PK!Ɖ--std_encode/__init__.py__version__ = '0.1.0' from . import console PK!|^  std_encode/console.pyfrom __future__ import print_function import os import fileinput import argparse import base64 START_ENCODING = '>>>>>>>>>> START' END_ENCODING = '<<<<<<<<<< END' def run_sd(): ''' Read from the standard input to filter ''' display = True mode = None for line in fileinput.input(): if line.startswith(START_ENCODING): # Decode the start file mode_filename = line.split(START_ENCODING)[-1].strip() mode, filename = mode_filename.split() if mode == 'b': fp = open(filename, 'wb') elif mode == 't': fp = open(filename, 'w') else: raise Exception('Invalid mode {}'.format(mode)) display = False elif line.startswith(END_ENCODING): print('######### DECODED FILE {}'.format(filename)) display = True fp.close() elif display: print(line, end='') elif not display and mode == 'b': data = line.encode('ascii') data = base64.standard_b64decode(data) fp.write(data) elif not display and mode == 't': fp.write(line) else: raise Exception('Unexpected case') def run_se(): ''' Read and dump a file with the proper format so it will be encoded back with se ''' help_string = 'Encode a file in stdout. Recover it with std_decode' parser = argparse.ArgumentParser(description=help_string) parser.add_argument('file', type=argparse.FileType('rb'), help='file') parser.add_argument('-t', dest='text', action='store_true', default=False) args = parser.parse_args() filename = args.file.name mode = 'b' if args.text: mode = 't' args.file.close() args.file = open(filename, 'r') shortfilename = os.path.basename(filename) start_tmpl = '{start} {mode} {filename}' print(start_tmpl.format(start=START_ENCODING, mode=mode, filename=shortfilename)) if mode == 't': for line in args.file: print(line, end='') elif mode == 'b': data = base64.standard_b64encode(args.file.read()) print(data.decode('ascii')) print(END_ENCODING) PK!Hٷ]6]+std_encode-0.2.0.dist-info/entry_points.txtN+I/N.,()*.IOIMOI1S@L+2Ҽ. NE\\PK!Ìm^  &std_encode-0.2.0.dist-info/LICENSE.txtCopyright (c) 2018 Jaime Buelta Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!H9VWX std_encode-0.2.0.dist-info/WHEEL A н#f."jm)!fb҅~ܴA,mTD}E n0H饹*|D[¬c i=0(q3PK!H #std_encode-0.2.0.dist-info/METADATAVao6_qC;,qЦvi`6HQĴDl$R%8H)h<}%wݻ 3x0Vj0gx).Ju&ju˒&L\ep;FnMFRUKU `yBV:m: Y9H6zE㦂ps}h&Kڰb&okYdt師gFɷmffJG%N1vn+H } ~5d˂&,a4MѦMSt\W'vw^]t5>v\?1Om^.:0 q "P̈́dϖq ]{\ htdDg'?G%3*EQ/xibYEl]WG jzsrD01:'K/ @-k.u{JgRaZw#*mx~֭p{1l7٥ yuԪO=|^zȪBjXy].K  #B<"[v )͵yؙ"+r+lJGVBỈ@ඡ%o<&VILct 6 ʲ*PjC^ƒ6iF=5uFޝ]"@a<>A!S+c?0J@1}:K Yikv 4Honzj8J@O H;o$uM^`<u[:)ܭD{ @nD4iѶ+=A/{K8K[wj+ Z(QtévĿCw:ϛheiŧ7'jaZ_ЄyW 5j?R](,{ !vׄ?d=]Mh|ͦ+,1NoB[x4 =<Ç~vsBk~5J_5;~?lk(a;pʶ v6ỲضkgN߷GPK!H]]3!std_encode-0.2.0.dist-info/RECORD}Kr0}(A\tA!Q,4n~%8ucΛ"u"߂>$\a`)VCc~S C~Yg|Aa=nkﶥL!MV>"?k˜3?O 0gl mͻ\K~myUiJʠ=Ƨ;0[PUY.;hmv6/PK!Ɖ--std_encode/__init__.pyPK!|^  astd_encode/console.pyPK!Hٷ]6]+ std_encode-0.2.0.dist-info/entry_points.txtPK!Ìm^  & std_encode-0.2.0.dist-info/LICENSE.txtPK!H9VWX }std_encode-0.2.0.dist-info/WHEELPK!H #std_encode-0.2.0.dist-info/METADATAPK!H]]3!Qstd_encode-0.2.0.dist-info/RECORDPK"