/Users/andrea/_magisterarbeit/korpus/clean/testkorpus/32/file17.html NN ----------------------------------------- : sign VV in IN join VV Cookbooks NNS Documentation NN Mailing NN Lists VVZ Modules NNS News NP Feeds VVZ Products NP User NP Groups NNS Web NP Services NPS Submit VVP Recipe NN My PP$ Recipes NNS All DT Recipes NNS All DT Cookbooks NNS View NN by IN Category NN Algorithms NNS CGI NP Databases NNS and NP . SENT . SENT . SENT Debugging VVG and CC Testing NP Distributed NP Programming NN . SENT . SENT . SENT Extending VVG and CC Embedding VVG . SENT . SENT . SENT Files NNS Image NN and CC scientific JJ . SENT . SENT . SENT Jython NP Network NP Resources NPS Object VVP Oriented VVN . SENT . SENT . SENT Programs NNS about IN programs NNS . SENT . SENT . SENT Searching VVG and CC Sorting VVG Shortcuts NNS System NP Administration NP Text NN Including VVG . SENT . SENT . SENT Threads NNS , , Processes VVZ , , . SENT . SENT . SENT User NN Interfaces NNS Web NP Programming NN XML NP Programming NN Title NN . SENT Simple JJ File NP Splitter NN Combiner NN module NN Submitter NN . SENT Anand NP Pillai NP other JJ recipes NNS Last JJ Updated VVN . SENT 2003 CD 11 CD 06 CD Version NP no RB . SENT 1 LS . SENT 3 CD Category NN . SENT Files NNS 1 CD vote NN s NN Description NN . SENT This DT module NN can MD be VB used VVN to TO split VV any DT file NN , , text NN or CC binary NN to TO equal VV sized JJ chunks NNS . SENT It PP can MD also RB combine VV the DT chunks NNS back RB to TO recreate VV the DT original JJ file NN . SENT Source NN . SENT Text NN Source NN FileSplitter NP Simple JJ Python NN file NN split NN concat NN module NN . SENT What WP it PP does VVZ 1 CD . SENT Split VV a DT text NN binary NN file NN into IN equal JJ sized VVD chunks NNS and CC save VV them PP separately RB . SENT 2 LS . SENT Concat NP existing JJ chunks NNS and CC recreate VV original JJ file NN . SENT Author NN . SENT Anand NP Pillai NP Copyright NP . SENT None NN , , Public NP Domain NN import NN os NN , , sys NP class NN FileSplitterException NN Exception NN . SENT def NP init NN self NN , , value NN . SENT self NN . SENT value NN value NN def NP str NN self NN . SENT return NN str NN self NN . SENT value NN def NP usage NN . SENT return NN nUsage NN . SENT FileSplitter NP . SENT py NP i NP inputfile NN n NN chunksize JJ option NN n NN Options NNS . SENT n NN s PP , , split VV Split NP file VV into IN chunks NNS j NN , , join VV Join VV chunks NNS back RB to TO file VV . SENT class NN FileSplitter NN . SENT File VV splitter NN class NN def NP init NN self NN . SENT cache NN filename NN self NN . SENT filename NN number NN of IN equal JJ sized VVD chunks NNS self NN . SENT numchunks NNS 5 CD Size NN of IN each DT chunk NN self NN . SENT chunksize VV 0 CD Optional JJ postfix NN string NN for IN the DT chunk NN filename NN self NN . SENT postfix NN Program NN name NN self NN . SENT progname NP FileSplitter NP . SENT py NP Action NP self NN . SENT action NN 0 CD split NN def NP parseOptions NNS self NN , , args NNS . SENT import NN getopt NN try VV . SENT optlist NN , , arglist NN getopt NN . SENT getopt JJ args NNS , , sji NP . SENT n NN . SENT , , split VV , , join VV except IN getopt NN . SENT GetoptError NP , , e NN . SENT print NN e SYM return NN None NN for IN option NN , , value NN in IN optlist NN . SENT if IN option NN . SENT lower JJR in IN i NP , , . SENT self NN . SENT filename NN value NN elif NN option NN . SENT lower JJR in IN n NN , , . SENT self NN . SENT numchunks NP int NP value NN elif NN option NN . SENT lower JJR in IN s PP , , split NN . SENT self NN . SENT action NN 0 CD split NN elif NN option NN . SENT lower JJR in IN j NN , , join VV . SENT self NN . SENT action NN 1 CD combine VVP if IN not RB self NN . SENT filename NN . SENT sys NP . SENT exit NN Error NN . SENT filename NN not RB given VVN def NP do VVP work NN self NN . SENT if IN self NN . SENT action NN 0 CD . SENT self NN . SENT split NN elif NN self NN . SENT action NN 1 CD . SENT self NN . SENT combine VV else RB . SENT return NN None NN def NP split NN self NN . SENT Split VV the DT file NN and CC save VV chunks NNS to TO separate JJ files NNS print VVP Splitting JJ file NN , , self NN . SENT filename NN print NN Number NP of IN chunks NNS , , self NN . SENT numchunks NNS , , n NN try NN . SENT f SYM open JJ self NN . SENT filename NN , , rb NN except IN OSError NP , , IOError NP , , e NN . SENT raise VV FileSplitterException NP , , str NN e NN bname NN os NN . SENT path NN . SENT split NN self NN . SENT filename NN 1 CD Get VVP the DT file NN size NN fsize NN os NN . SENT path NN . SENT getsize JJ self NN . SENT filename NNS Get VVP size NN of IN each DT chunk NN self NN . SENT chunksize JJ int NP float NN fsize NN float NN self NN . SENT numchunks NNS chunksz NN self NN . SENT chunksize JJ total JJ bytes NNS 0 CD for IN x NN in IN range NN self NN . SENT numchunks NNS . SENT chunkfilename JJ bname JJ str NN x SYM 1 CD self NN . SENT postfix NN if IN reading VVG the DT last JJ section NN , , calculate VVP correct JJ chunk NN size NN . SENT if IN x NN self NN . SENT numchunks NNS 1 CD . SENT chunksz NP fsize NN total NN bytes NNS try VVP . SENT print VV Writing VVG file NN , , chunkfilename JJ data NNS f SYM . SENT read VV chunksz NP total JJ bytes NNS len NP data NNS chunkf NN file NN chunkfilename NN , , wb NN chunkf NN . SENT write VV data NN chunkf NN . SENT close NN except IN OSError NP , , IOError NP , , e NN . SENT print NN e NN continue VVP except IN EOFError NP , , e NN . SENT print NN e SYM break NN print NN Done NP . SENT def NP sort NN index NN self NN , , f LS 1 CD , , f NN 2 CD . SENT index NN 1 CD f SYM 1 CD . SENT rfind NN index NN 2 CD f SYM 2 CD . SENT rfind NN if IN index NN 1 CD . SENT 1 CD and CC index NN 2 CD . SENT 1 CD . SENT i NP 1 CD int NP f NN 1 CD index NN 1 CD . SENT len NP f SYM 1 CD i NP 2 CD int NP f NN 2 CD index NN 2 CD . SENT len NP f SYM 2 CD return NN i NP 2 CD i NP 1 CD def NP combine VV self NN . SENT Combine VV existing VVG chunks NNS to TO recreate VV the DT file NN . SENT The DT chunks NNS must MD be VB present JJ in IN the DT cwd NN . SENT The DT new JJ file NN will MD be VB written VVN to TO cwd VV . SENT import NN re IN print NN Creating VVG file NN , , self NN . SENT filename NN bname NN os NN . SENT path NN . SENT split NN self NN . SENT filename NN 1 CD bname NN 2 CD bname NN bugfix NN . SENT if IN file NN contains VVZ characters NNS like JJ , , . SENT , , properly RB escape VV them PP , , otherwise RB re NN will MD fail VV to TO match VV . SENT for IN a DT , , b NN in IN zip NN , , . SENT , , , , , , , , , , , , , , . SENT , , , , , , , , , , . SENT bname NN 2 CD bname NN 2 CD . SENT replace VV a DT , , b NN chunkre NN re NN . SENT compile VV bname JJ 2 CD 0 CD 9 CD chunkfiles NNS for IN f NN in IN os NN . SENT listdir NN . SENT . SENT print NN f SYM if IN chunkre NN . SENT match NN f SYM . SENT chunkfiles NNS . SENT append VV f NN print NN Number NP of IN chunks NNS , , len NP chunkfiles NNS , , n NN chunkfiles NNS . SENT sort NN self NN . SENT sort NN index NN data NNS for IN f NN in IN chunkfiles NNS . SENT try VV . SENT print VV Appending VVG chunk NN , , os NN . SENT path NN . SENT join VV . SENT , , f NN data NN open NN f SYM , , rb NP . SENT read VVN except IN OSError NP , , IOError NP , , EOFError NP , , e NN . SENT print NN e NN continue VVP try VV . SENT f SYM open JJ bname NN , , wb NN f NN . SENT write VV data NNS f SYM . SENT close NN except IN OSError NP , , IOError NP , , EOFError NP , , e NN . SENT raise VV FileSplitterException NP , , str NN e NN print NN Wrote VVD file VV , , bname JJ def NP main JJ . SENT import NN sys NP if IN len NP sys NP . SENT argv NP 2 CD . SENT sys NP . SENT exit NN usage NN fsp NN FileSplitter NP fsp NN . SENT parseOptions NNS sys NP . SENT argv NP 1 CD . SENT fsp NN . SENT do VV work NN if IN name NN main JJ . SENT main JJ Discussion NN . SENT Often RB we PP need VVP to TO split VV big JJ files NNS into IN many JJ chunks NNS either CC for IN saving VVG them PP to TO disks NNS , , uploading VVG to TO a DT web NN site NN or CC for IN some DT other JJ reason NN . SENT I PP used VVD to TO rely VV on IN 3 CD rd NN party NN programs NNS before IN for IN this DT task NN , , but CC never RB could MD find VV a DT program NN handy JJ when WRB needed VVN . SENT As IN usual JJ python NN excels VVZ in IN such JJ scripting VVG tasks NNS and CC this DT script NN makes VVZ the DT job NN a DT breeze NN . SENT . SENT Add VV comment VV Number NP of IN comments NNS . SENT 5 CD Refactored NN . SENT . SENT . SENT , , Anand NP Pillai NP , , 2003 CD 10 CD 17 CD Modified VVN on IN 18 CD th NN Oct NP I PP have VHP modified VVN this DT recipe NN to TO print VV a DT Usage RB string NN , , and CC it PP now RB takes VVZ command NN line NN options NNS . SENT While IN combining VVG it PP does VVZ not RB need VV the DT number NN of IN chunks NNS and CC works NNS with IN all PDT the DT chunks NNS in IN the DT current JJ directory NN . SENT Anand NP Add VV comment VV Files NP larger JJR than IN physical JJ memory NN on IN machine NN , , Anthony NP DiGregorio NP , , 2004 CD 03 CD 24 CD I PP made VVD a DT slight JJ modification NN to TO the DT combine VV function NN . SENT See VV how WRB I PP appended VVN data NNS to TO the DT file NN from IN each DT chuck NN , , instead RB of IN holding VVG a DT large JJ data NNS object VVP in IN memory NN . SENT Add VV comment VV File NP size NN larger JJR than IN Physical NP Memory NP available JJ , , Anthony NP DiGregorio NP , , 2004 CD 03 CD 24 CD Here RB is VBZ the DT code NN . SENT try VV . SENT cmbf JJ open JJ bname NN , , ab NP for IN f NN in IN chunkfiles NNS . SENT try VV . SENT print VV Appending VVG chunk NN , , os NN . SENT path NN . SENT join VV . SENT , , f NN data NN open NN f SYM , , rb NP . SENT read VVN data NN open NN f SYM , , rb NP . SENT read VVN cmbf NN . SENT write VV data NNS except IN OSError NP , , IOError NP , , EOFError NP , , e NN . SENT print NN e NN continue VVP cmbf NN . SENT close NN except IN OSError NP , , IOError NP , , EOFError NP , , e NN . SENT raise VV FileSplitterException NP , , str NN e NN try VV . SENT f SYM open JJ bname NN , , wb NN f NN . SENT write VV data NNS f SYM . SENT close NN except IN OSError NP , , IOError NP , , EOFError NP , , e NN . SENT raise VV FileSplitterException NP , , str NN e NN print NN Wrote VVD file VV , , bname VV Add VV comment VV constant JJ filename NN length NN , , jc NP Not RB specified VVN , , 2005 CD 02 CD 05 CD Here RB is VBZ the DT code NN to TO get VV 3 CD digits NNS for IN numeration NN of IN each DT file NN for IN split NN mode NN , , near IN of IN line NN 107 CD for IN me PP . SENT chunkfilename NN bname VVD 03 CD d NN x SYM 1 CD self NN . SENT postfix VV Add VV comment NN Output NN to TO the DT same JJ directory NN , , jc NP Not RB specified VVN , , 2005 CD 02 CD 05 CD Here RB is VBZ the DT code NN to TO generate VV each DT files NNS in IN the DT same JJ directory NN the DT the DT source NN near IN line NN 94 CD for IN me PP . SENT bname JJ os NN . SENT path NN . SENT split NN self NN . SENT filename NN 1 CD output NN to TO the DT same JJ directory NN bname NN self NN . SENT filename NN Add VV comment VV advanced JJ search NN help NN Highest RB rated VVN recipes NNS . SENT 1 LS . SENT Network NP Ping NP Pong NP using VVG . SENT . SENT . SENT 2 LS . SENT SOLVING VVG THE DT METACLASS NN . SENT . SENT . SENT 3 LS . SENT The DT Secret JJ Name NN of IN List NP . SENT . SENT . SENT 4 LS . SENT Metaclass NP for IN Interface NP . SENT . SENT . SENT 5 LS . SENT Povray NP for IN python NN 6 CD . SENT Calling VVG Windows NNS API NP . SENT . SENT . SENT 7 CD . SENT Watching VVG a DT directory NN . SENT . SENT . SENT 8 CD . SENT Generic JJ filter NN logic NN . SENT . SENT . SENT 9 CD . SENT Implementation NN of IN sets NNS . SENT . SENT . SENT 10 CD . SENT HTML NN colors NNS to TO from IN RGB NP . SENT . SENT . SENT Privacy NN Policy NP Email NP Opt VVP out IN Feedback NN Syndication NN 2005 CD ActiveState NN , , a DT division NN of IN Sophos NP All NP rights NNS reserved VVD