network.c 513 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338
  1. /* Generated by Cython 0.20.1 on Sun Mar 16 22:58:14 2014 */
  2. #define PY_SSIZE_T_CLEAN
  3. #ifndef CYTHON_USE_PYLONG_INTERNALS
  4. #ifdef PYLONG_BITS_IN_DIGIT
  5. #define CYTHON_USE_PYLONG_INTERNALS 0
  6. #else
  7. #include "pyconfig.h"
  8. #ifdef PYLONG_BITS_IN_DIGIT
  9. #define CYTHON_USE_PYLONG_INTERNALS 1
  10. #else
  11. #define CYTHON_USE_PYLONG_INTERNALS 0
  12. #endif
  13. #endif
  14. #endif
  15. #include "Python.h"
  16. #ifndef Py_PYTHON_H
  17. #error Python headers needed to compile C extensions, please install development version of Python.
  18. #elif PY_VERSION_HEX < 0x02040000
  19. #error Cython requires Python 2.4+.
  20. #else
  21. #define CYTHON_ABI "0_20_1"
  22. #include <stddef.h> /* For offsetof */
  23. #ifndef offsetof
  24. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  25. #endif
  26. #if !defined(WIN32) && !defined(MS_WINDOWS)
  27. #ifndef __stdcall
  28. #define __stdcall
  29. #endif
  30. #ifndef __cdecl
  31. #define __cdecl
  32. #endif
  33. #ifndef __fastcall
  34. #define __fastcall
  35. #endif
  36. #endif
  37. #ifndef DL_IMPORT
  38. #define DL_IMPORT(t) t
  39. #endif
  40. #ifndef DL_EXPORT
  41. #define DL_EXPORT(t) t
  42. #endif
  43. #ifndef PY_LONG_LONG
  44. #define PY_LONG_LONG LONG_LONG
  45. #endif
  46. #ifndef Py_HUGE_VAL
  47. #define Py_HUGE_VAL HUGE_VAL
  48. #endif
  49. #ifdef PYPY_VERSION
  50. #define CYTHON_COMPILING_IN_PYPY 1
  51. #define CYTHON_COMPILING_IN_CPYTHON 0
  52. #else
  53. #define CYTHON_COMPILING_IN_PYPY 0
  54. #define CYTHON_COMPILING_IN_CPYTHON 1
  55. #endif
  56. #if CYTHON_COMPILING_IN_PYPY
  57. #define Py_OptimizeFlag 0
  58. #endif
  59. #if PY_VERSION_HEX < 0x02050000
  60. typedef int Py_ssize_t;
  61. #define PY_SSIZE_T_MAX INT_MAX
  62. #define PY_SSIZE_T_MIN INT_MIN
  63. #define PY_FORMAT_SIZE_T ""
  64. #define CYTHON_FORMAT_SSIZE_T ""
  65. #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  66. #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o)
  67. #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
  68. (PyErr_Format(PyExc_TypeError, \
  69. "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
  70. (PyObject*)0))
  71. #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
  72. !PyComplex_Check(o))
  73. #define PyIndex_Check __Pyx_PyIndex_Check
  74. #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  75. #define __PYX_BUILD_PY_SSIZE_T "i"
  76. #else
  77. #define __PYX_BUILD_PY_SSIZE_T "n"
  78. #define CYTHON_FORMAT_SSIZE_T "z"
  79. #define __Pyx_PyIndex_Check PyIndex_Check
  80. #endif
  81. #if PY_VERSION_HEX < 0x02060000
  82. #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  83. #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
  84. #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
  85. #define PyVarObject_HEAD_INIT(type, size) \
  86. PyObject_HEAD_INIT(type) size,
  87. #define PyType_Modified(t)
  88. typedef struct {
  89. void *buf;
  90. PyObject *obj;
  91. Py_ssize_t len;
  92. Py_ssize_t itemsize;
  93. int readonly;
  94. int ndim;
  95. char *format;
  96. Py_ssize_t *shape;
  97. Py_ssize_t *strides;
  98. Py_ssize_t *suboffsets;
  99. void *internal;
  100. } Py_buffer;
  101. #define PyBUF_SIMPLE 0
  102. #define PyBUF_WRITABLE 0x0001
  103. #define PyBUF_FORMAT 0x0004
  104. #define PyBUF_ND 0x0008
  105. #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  106. #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  107. #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  108. #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  109. #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  110. #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  111. #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  112. typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  113. typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
  114. #endif
  115. #if PY_MAJOR_VERSION < 3
  116. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  117. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
  118. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  119. #define __Pyx_DefaultClassType PyClass_Type
  120. #else
  121. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  122. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
  123. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  124. #define __Pyx_DefaultClassType PyType_Type
  125. #endif
  126. #if PY_VERSION_HEX < 0x02060000
  127. #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
  128. #endif
  129. #if PY_MAJOR_VERSION >= 3
  130. #define Py_TPFLAGS_CHECKTYPES 0
  131. #define Py_TPFLAGS_HAVE_INDEX 0
  132. #endif
  133. #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  134. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  135. #endif
  136. #if PY_VERSION_HEX < 0x02060000
  137. #define Py_TPFLAGS_HAVE_VERSION_TAG 0
  138. #endif
  139. #if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
  140. #define Py_TPFLAGS_IS_ABSTRACT 0
  141. #endif
  142. #if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  143. #define Py_TPFLAGS_HAVE_FINALIZE 0
  144. #endif
  145. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  146. #define CYTHON_PEP393_ENABLED 1
  147. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
  148. 0 : _PyUnicode_Ready((PyObject *)(op)))
  149. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  150. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  151. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  152. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  153. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  154. #else
  155. #define CYTHON_PEP393_ENABLED 0
  156. #define __Pyx_PyUnicode_READY(op) (0)
  157. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  158. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  159. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  160. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  161. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  162. #endif
  163. #if CYTHON_COMPILING_IN_PYPY
  164. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  165. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  166. #else
  167. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  168. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
  169. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  170. #endif
  171. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  172. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  173. #if PY_MAJOR_VERSION >= 3
  174. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  175. #else
  176. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  177. #endif
  178. #if PY_MAJOR_VERSION >= 3
  179. #define PyBaseString_Type PyUnicode_Type
  180. #define PyStringObject PyUnicodeObject
  181. #define PyString_Type PyUnicode_Type
  182. #define PyString_Check PyUnicode_Check
  183. #define PyString_CheckExact PyUnicode_CheckExact
  184. #endif
  185. #if PY_VERSION_HEX < 0x02060000
  186. #define PyBytesObject PyStringObject
  187. #define PyBytes_Type PyString_Type
  188. #define PyBytes_Check PyString_Check
  189. #define PyBytes_CheckExact PyString_CheckExact
  190. #define PyBytes_FromString PyString_FromString
  191. #define PyBytes_FromStringAndSize PyString_FromStringAndSize
  192. #define PyBytes_FromFormat PyString_FromFormat
  193. #define PyBytes_DecodeEscape PyString_DecodeEscape
  194. #define PyBytes_AsString PyString_AsString
  195. #define PyBytes_AsStringAndSize PyString_AsStringAndSize
  196. #define PyBytes_Size PyString_Size
  197. #define PyBytes_AS_STRING PyString_AS_STRING
  198. #define PyBytes_GET_SIZE PyString_GET_SIZE
  199. #define PyBytes_Repr PyString_Repr
  200. #define PyBytes_Concat PyString_Concat
  201. #define PyBytes_ConcatAndDel PyString_ConcatAndDel
  202. #endif
  203. #if PY_MAJOR_VERSION >= 3
  204. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  205. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  206. #else
  207. #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
  208. PyString_Check(obj) || PyUnicode_Check(obj))
  209. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  210. #endif
  211. #if PY_VERSION_HEX < 0x02060000
  212. #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
  213. #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
  214. #endif
  215. #ifndef PySet_CheckExact
  216. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  217. #endif
  218. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  219. #if PY_MAJOR_VERSION >= 3
  220. #define PyIntObject PyLongObject
  221. #define PyInt_Type PyLong_Type
  222. #define PyInt_Check(op) PyLong_Check(op)
  223. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  224. #define PyInt_FromString PyLong_FromString
  225. #define PyInt_FromUnicode PyLong_FromUnicode
  226. #define PyInt_FromLong PyLong_FromLong
  227. #define PyInt_FromSize_t PyLong_FromSize_t
  228. #define PyInt_FromSsize_t PyLong_FromSsize_t
  229. #define PyInt_AsLong PyLong_AsLong
  230. #define PyInt_AS_LONG PyLong_AS_LONG
  231. #define PyInt_AsSsize_t PyLong_AsSsize_t
  232. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  233. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  234. #define PyNumber_Int PyNumber_Long
  235. #endif
  236. #if PY_MAJOR_VERSION >= 3
  237. #define PyBoolObject PyLongObject
  238. #endif
  239. #if PY_VERSION_HEX < 0x030200A4
  240. typedef long Py_hash_t;
  241. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  242. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  243. #else
  244. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  245. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  246. #endif
  247. #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  248. #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  249. #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  250. #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
  251. #else
  252. #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
  253. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
  254. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
  255. (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  256. #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
  257. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  258. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
  259. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  260. #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
  261. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  262. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
  263. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
  264. #endif
  265. #if PY_MAJOR_VERSION >= 3
  266. #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  267. #endif
  268. #if PY_VERSION_HEX < 0x02050000
  269. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
  270. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  271. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
  272. #else
  273. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
  274. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  275. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
  276. #endif
  277. #if PY_VERSION_HEX < 0x02050000
  278. #define __Pyx_NAMESTR(n) ((char *)(n))
  279. #define __Pyx_DOCSTR(n) ((char *)(n))
  280. #else
  281. #define __Pyx_NAMESTR(n) (n)
  282. #define __Pyx_DOCSTR(n) (n)
  283. #endif
  284. #ifndef CYTHON_INLINE
  285. #if defined(__GNUC__)
  286. #define CYTHON_INLINE __inline__
  287. #elif defined(_MSC_VER)
  288. #define CYTHON_INLINE __inline
  289. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  290. #define CYTHON_INLINE inline
  291. #else
  292. #define CYTHON_INLINE
  293. #endif
  294. #endif
  295. #ifndef CYTHON_RESTRICT
  296. #if defined(__GNUC__)
  297. #define CYTHON_RESTRICT __restrict__
  298. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  299. #define CYTHON_RESTRICT __restrict
  300. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  301. #define CYTHON_RESTRICT restrict
  302. #else
  303. #define CYTHON_RESTRICT
  304. #endif
  305. #endif
  306. #ifdef NAN
  307. #define __PYX_NAN() ((float) NAN)
  308. #else
  309. static CYTHON_INLINE float __PYX_NAN() {
  310. /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
  311. a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
  312. a quiet NaN. */
  313. float value;
  314. memset(&value, 0xFF, sizeof(value));
  315. return value;
  316. }
  317. #endif
  318. #if PY_MAJOR_VERSION >= 3
  319. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  320. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  321. #else
  322. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  323. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  324. #endif
  325. #ifndef __PYX_EXTERN_C
  326. #ifdef __cplusplus
  327. #define __PYX_EXTERN_C extern "C"
  328. #else
  329. #define __PYX_EXTERN_C extern
  330. #endif
  331. #endif
  332. #if defined(WIN32) || defined(MS_WINDOWS)
  333. #define _USE_MATH_DEFINES
  334. #endif
  335. #include <math.h>
  336. #define __PYX_HAVE__lib__Naked__toolshed__c__network
  337. #define __PYX_HAVE_API__lib__Naked__toolshed__c__network
  338. #ifdef _OPENMP
  339. #include <omp.h>
  340. #endif /* _OPENMP */
  341. #ifdef PYREX_WITHOUT_ASSERTIONS
  342. #define CYTHON_WITHOUT_ASSERTIONS
  343. #endif
  344. #ifndef CYTHON_UNUSED
  345. # if defined(__GNUC__)
  346. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  347. # define CYTHON_UNUSED __attribute__ ((__unused__))
  348. # else
  349. # define CYTHON_UNUSED
  350. # endif
  351. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  352. # define CYTHON_UNUSED __attribute__ ((__unused__))
  353. # else
  354. # define CYTHON_UNUSED
  355. # endif
  356. #endif
  357. typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
  358. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
  359. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  360. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  361. #define __PYX_DEFAULT_STRING_ENCODING ""
  362. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  363. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  364. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
  365. (sizeof(type) < sizeof(Py_ssize_t)) || \
  366. (sizeof(type) > sizeof(Py_ssize_t) && \
  367. likely(v < (type)PY_SSIZE_T_MAX || \
  368. v == (type)PY_SSIZE_T_MAX) && \
  369. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
  370. v == (type)PY_SSIZE_T_MIN))) || \
  371. (sizeof(type) == sizeof(Py_ssize_t) && \
  372. (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
  373. v == (type)PY_SSIZE_T_MAX))) )
  374. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
  375. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  376. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  377. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  378. #define __Pyx_PyBytes_FromString PyBytes_FromString
  379. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  380. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
  381. #if PY_MAJOR_VERSION < 3
  382. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  383. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  384. #else
  385. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  386. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  387. #endif
  388. #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  389. #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  390. #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
  391. #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
  392. #define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((char*)s)
  393. #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s)
  394. #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
  395. #if PY_MAJOR_VERSION < 3
  396. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  397. {
  398. const Py_UNICODE *u_end = u;
  399. while (*u_end++) ;
  400. return u_end - u - 1;
  401. }
  402. #else
  403. #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
  404. #endif
  405. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  406. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  407. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  408. #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
  409. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  410. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  411. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  412. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  413. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  414. #if CYTHON_COMPILING_IN_CPYTHON
  415. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  416. #else
  417. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  418. #endif
  419. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  420. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  421. static int __Pyx_sys_getdefaultencoding_not_ascii;
  422. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  423. PyObject* sys = NULL;
  424. PyObject* default_encoding = NULL;
  425. PyObject* ascii_chars_u = NULL;
  426. PyObject* ascii_chars_b = NULL;
  427. sys = PyImport_ImportModule("sys");
  428. if (sys == NULL) goto bad;
  429. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  430. if (default_encoding == NULL) goto bad;
  431. if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
  432. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  433. } else {
  434. const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
  435. char ascii_chars[128];
  436. int c;
  437. for (c = 0; c < 128; c++) {
  438. ascii_chars[c] = c;
  439. }
  440. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  441. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  442. if (ascii_chars_u == NULL) goto bad;
  443. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  444. if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  445. PyErr_Format(
  446. PyExc_ValueError,
  447. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  448. default_encoding_c);
  449. goto bad;
  450. }
  451. }
  452. Py_XDECREF(sys);
  453. Py_XDECREF(default_encoding);
  454. Py_XDECREF(ascii_chars_u);
  455. Py_XDECREF(ascii_chars_b);
  456. return 0;
  457. bad:
  458. Py_XDECREF(sys);
  459. Py_XDECREF(default_encoding);
  460. Py_XDECREF(ascii_chars_u);
  461. Py_XDECREF(ascii_chars_b);
  462. return -1;
  463. }
  464. #endif
  465. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  466. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  467. #else
  468. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  469. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  470. static char* __PYX_DEFAULT_STRING_ENCODING;
  471. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  472. PyObject* sys = NULL;
  473. PyObject* default_encoding = NULL;
  474. char* default_encoding_c;
  475. sys = PyImport_ImportModule("sys");
  476. if (sys == NULL) goto bad;
  477. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  478. if (default_encoding == NULL) goto bad;
  479. default_encoding_c = PyBytes_AS_STRING(default_encoding);
  480. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
  481. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  482. Py_DECREF(sys);
  483. Py_DECREF(default_encoding);
  484. return 0;
  485. bad:
  486. Py_XDECREF(sys);
  487. Py_XDECREF(default_encoding);
  488. return -1;
  489. }
  490. #endif
  491. #endif
  492. #ifdef __GNUC__
  493. /* Test for GCC > 2.95 */
  494. #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
  495. #define likely(x) __builtin_expect(!!(x), 1)
  496. #define unlikely(x) __builtin_expect(!!(x), 0)
  497. #else /* __GNUC__ > 2 ... */
  498. #define likely(x) (x)
  499. #define unlikely(x) (x)
  500. #endif /* __GNUC__ > 2 ... */
  501. #else /* __GNUC__ */
  502. #define likely(x) (x)
  503. #define unlikely(x) (x)
  504. #endif /* __GNUC__ */
  505. static PyObject *__pyx_m;
  506. static PyObject *__pyx_d;
  507. static PyObject *__pyx_b;
  508. static PyObject *__pyx_empty_tuple;
  509. static PyObject *__pyx_empty_bytes;
  510. static int __pyx_lineno;
  511. static int __pyx_clineno = 0;
  512. static const char * __pyx_cfilenm= __FILE__;
  513. static const char *__pyx_filename;
  514. static const char *__pyx_f[] = {
  515. "network.pyx",
  516. };
  517. /*--- Type declarations ---*/
  518. #ifndef CYTHON_REFNANNY
  519. #define CYTHON_REFNANNY 0
  520. #endif
  521. #if CYTHON_REFNANNY
  522. typedef struct {
  523. void (*INCREF)(void*, PyObject*, int);
  524. void (*DECREF)(void*, PyObject*, int);
  525. void (*GOTREF)(void*, PyObject*, int);
  526. void (*GIVEREF)(void*, PyObject*, int);
  527. void* (*SetupContext)(const char*, int, const char*);
  528. void (*FinishContext)(void**);
  529. } __Pyx_RefNannyAPIStruct;
  530. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  531. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  532. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  533. #ifdef WITH_THREAD
  534. #define __Pyx_RefNannySetupContext(name, acquire_gil) \
  535. if (acquire_gil) { \
  536. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
  537. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
  538. PyGILState_Release(__pyx_gilstate_save); \
  539. } else { \
  540. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
  541. }
  542. #else
  543. #define __Pyx_RefNannySetupContext(name, acquire_gil) \
  544. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  545. #endif
  546. #define __Pyx_RefNannyFinishContext() \
  547. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  548. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  549. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  550. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  551. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  552. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  553. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  554. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  555. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  556. #else
  557. #define __Pyx_RefNannyDeclarations
  558. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  559. #define __Pyx_RefNannyFinishContext()
  560. #define __Pyx_INCREF(r) Py_INCREF(r)
  561. #define __Pyx_DECREF(r) Py_DECREF(r)
  562. #define __Pyx_GOTREF(r)
  563. #define __Pyx_GIVEREF(r)
  564. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  565. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  566. #define __Pyx_XGOTREF(r)
  567. #define __Pyx_XGIVEREF(r)
  568. #endif /* CYTHON_REFNANNY */
  569. #define __Pyx_XDECREF_SET(r, v) do { \
  570. PyObject *tmp = (PyObject *) r; \
  571. r = v; __Pyx_XDECREF(tmp); \
  572. } while (0)
  573. #define __Pyx_DECREF_SET(r, v) do { \
  574. PyObject *tmp = (PyObject *) r; \
  575. r = v; __Pyx_DECREF(tmp); \
  576. } while (0)
  577. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  578. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  579. #if CYTHON_COMPILING_IN_CPYTHON
  580. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  581. PyTypeObject* tp = Py_TYPE(obj);
  582. if (likely(tp->tp_getattro))
  583. return tp->tp_getattro(obj, attr_name);
  584. #if PY_MAJOR_VERSION < 3
  585. if (likely(tp->tp_getattr))
  586. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  587. #endif
  588. return PyObject_GetAttr(obj, attr_name);
  589. }
  590. #else
  591. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  592. #endif
  593. static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/
  594. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
  595. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
  596. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
  597. const char* function_name); /*proto*/
  598. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  599. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
  600. #if CYTHON_COMPILING_IN_CPYTHON
  601. #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
  602. static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
  603. PyTypeObject* tp = Py_TYPE(obj);
  604. if (likely(tp->tp_setattro))
  605. return tp->tp_setattro(obj, attr_name, value);
  606. #if PY_MAJOR_VERSION < 3
  607. if (likely(tp->tp_setattr))
  608. return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
  609. #endif
  610. return PyObject_SetAttr(obj, attr_name, value);
  611. }
  612. #else
  613. #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
  614. #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
  615. #endif
  616. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/
  617. #if CYTHON_COMPILING_IN_CPYTHON
  618. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/
  619. #else
  620. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  621. #endif
  622. static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  623. static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  624. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  625. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  626. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  627. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
  628. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/
  629. #include <string.h>
  630. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
  631. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
  632. #if PY_MAJOR_VERSION >= 3
  633. #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
  634. #else
  635. #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
  636. #endif
  637. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  638. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  639. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
  640. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
  641. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  642. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  643. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  644. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
  645. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  646. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  647. int wraparound, int boundscheck);
  648. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  649. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  650. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
  651. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  652. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  653. int wraparound, int boundscheck);
  654. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  655. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  656. int is_list, int wraparound, int boundscheck);
  657. #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX >= 0x03020000 || PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000)
  658. static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
  659. PyObject *res;
  660. PyTypeObject *tp = Py_TYPE(obj);
  661. #if PY_MAJOR_VERSION < 3
  662. if (unlikely(PyInstance_Check(obj)))
  663. return __Pyx_PyObject_GetAttrStr(obj, attr_name);
  664. #endif
  665. res = _PyType_Lookup(tp, attr_name);
  666. if (likely(res)) {
  667. descrgetfunc f = Py_TYPE(res)->tp_descr_get;
  668. if (!f) {
  669. Py_INCREF(res);
  670. } else {
  671. res = f(res, obj, (PyObject *)tp);
  672. }
  673. } else {
  674. PyErr_SetObject(PyExc_AttributeError, attr_name);
  675. }
  676. return res;
  677. }
  678. #else
  679. #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
  680. #endif
  681. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
  682. #define __Pyx_CyFunction_USED 1
  683. #include <structmember.h>
  684. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  685. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  686. #define __Pyx_CYFUNCTION_CCLASS 0x04
  687. #define __Pyx_CyFunction_GetClosure(f) \
  688. (((__pyx_CyFunctionObject *) (f))->func_closure)
  689. #define __Pyx_CyFunction_GetClassObj(f) \
  690. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  691. #define __Pyx_CyFunction_Defaults(type, f) \
  692. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  693. #define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
  694. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  695. typedef struct {
  696. PyCFunctionObject func;
  697. PyObject *func_dict;
  698. PyObject *func_weakreflist;
  699. PyObject *func_name;
  700. PyObject *func_qualname;
  701. PyObject *func_doc;
  702. PyObject *func_globals;
  703. PyObject *func_code;
  704. PyObject *func_closure;
  705. PyObject *func_classobj; /* No-args super() class cell */
  706. void *defaults;
  707. int defaults_pyobjects;
  708. int flags;
  709. PyObject *defaults_tuple; /* Const defaults tuple */
  710. PyObject *defaults_kwdict; /* Const kwonly defaults dict */
  711. PyObject *(*defaults_getter)(PyObject *);
  712. PyObject *func_annotations; /* function annotations dict */
  713. } __pyx_CyFunctionObject;
  714. static PyTypeObject *__pyx_CyFunctionType = 0;
  715. #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
  716. __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
  717. static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
  718. int flags, PyObject* qualname,
  719. PyObject *self,
  720. PyObject *module, PyObject *globals,
  721. PyObject* code);
  722. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
  723. size_t size,
  724. int pyobjects);
  725. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  726. PyObject *tuple);
  727. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  728. PyObject *dict);
  729. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  730. PyObject *dict);
  731. static int __Pyx_CyFunction_init(void);
  732. static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
  733. static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
  734. PyObject *mkw, PyObject *modname, PyObject *doc); /*proto*/
  735. static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
  736. PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /*proto*/
  737. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
  738. static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
  739. #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
  740. static PyObject* __pyx_print = 0;
  741. static PyObject* __pyx_print_kwargs = 0;
  742. #endif
  743. static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
  744. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  745. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  746. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  747. static int __Pyx_check_binary_version(void);
  748. typedef struct {
  749. int code_line;
  750. PyCodeObject* code_object;
  751. } __Pyx_CodeObjectCacheEntry;
  752. struct __Pyx_CodeObjectCache {
  753. int count;
  754. int max_count;
  755. __Pyx_CodeObjectCacheEntry* entries;
  756. };
  757. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  758. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  759. static PyCodeObject *__pyx_find_code_object(int code_line);
  760. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  761. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  762. int py_line, const char *filename); /*proto*/
  763. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
  764. /* Module declarations from 'lib.Naked.toolshed.c.network' */
  765. #define __Pyx_MODULE_NAME "lib.Naked.toolshed.c.network"
  766. int __pyx_module_is_main_lib__Naked__toolshed__c__network = 0;
  767. /* Implementation of 'lib.Naked.toolshed.c.network' */
  768. static PyObject *__pyx_builtin_Exception;
  769. static PyObject *__pyx_builtin_open;
  770. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_url, PyObject *__pyx_v_request_timeout); /* proto */
  771. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_2get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_follow_redirects); /* proto */
  772. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_4get_bin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  773. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_6get_bin_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing); /* proto */
  774. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_8get_txt_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing); /* proto */
  775. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_10head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  776. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_12post(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_follow_redirects); /* proto */
  777. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_14post_bin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  778. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_16post_bin_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing); /* proto */
  779. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_18post_txt_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing); /* proto */
  780. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_20response(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  781. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_22get_status_ok(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  782. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_24post_status_ok(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
  783. static char __pyx_k_[] = "";
  784. static char __pyx_k_e[] = "e";
  785. static char __pyx_k_f[] = "f";
  786. static char __pyx_k_w[] = "w";
  787. static char __pyx_k__2[] = "/";
  788. static char __pyx_k__4[] = "...";
  789. static char __pyx_k__6[] = " ";
  790. static char __pyx_k_ce[] = "ce";
  791. static char __pyx_k_ok[] = "ok";
  792. static char __pyx_k_os[] = "os";
  793. static char __pyx_k_wb[] = "wb";
  794. static char __pyx_k_doc[] = "__doc__";
  795. static char __pyx_k_end[] = "end";
  796. static char __pyx_k_get[] = "get";
  797. static char __pyx_k_res[] = "res";
  798. static char __pyx_k_sys[] = "sys";
  799. static char __pyx_k_url[] = "url";
  800. static char __pyx_k_HTTP[] = "HTTP";
  801. static char __pyx_k_exit[] = "__exit__";
  802. static char __pyx_k_file[] = "file";
  803. static char __pyx_k_head[] = "head";
  804. static char __pyx_k_init[] = "__init__";
  805. static char __pyx_k_main[] = "__main__";
  806. static char __pyx_k_mode[] = "mode";
  807. static char __pyx_k_name[] = "__name__";
  808. static char __pyx_k_open[] = "open";
  809. static char __pyx_k_post[] = "post";
  810. static char __pyx_k_self[] = "self";
  811. static char __pyx_k_test[] = "__test__";
  812. static char __pyx_k_text[] = "text";
  813. static char __pyx_k_chunk[] = "chunk";
  814. static char __pyx_k_codes[] = "codes";
  815. static char __pyx_k_debug[] = "debug";
  816. static char __pyx_k_enter[] = "__enter__";
  817. static char __pyx_k_flush[] = "flush";
  818. static char __pyx_k_fsync[] = "fsync";
  819. static char __pyx_k_print[] = "print";
  820. static char __pyx_k_split[] = "split";
  821. static char __pyx_k_utf_8[] = "utf-8";
  822. static char __pyx_k_write[] = "write";
  823. static char __pyx_k_codecs[] = "codecs";
  824. static char __pyx_k_decode[] = "decode";
  825. static char __pyx_k_exit_2[] = "exit";
  826. static char __pyx_k_fileno[] = "fileno";
  827. static char __pyx_k_import[] = "__import__";
  828. static char __pyx_k_module[] = "__module__";
  829. static char __pyx_k_stderr[] = "stderr";
  830. static char __pyx_k_stdout[] = "stdout";
  831. static char __pyx_k_stream[] = "stream";
  832. static char __pyx_k_content[] = "content";
  833. static char __pyx_k_get_bin[] = "get_bin";
  834. static char __pyx_k_headers[] = "headers";
  835. static char __pyx_k_prepare[] = "__prepare__";
  836. static char __pyx_k_timeout[] = "timeout";
  837. static char __pyx_k_HTTP_get[] = "HTTP.get";
  838. static char __pyx_k_encoding[] = "encoding";
  839. static char __pyx_k_filepath[] = "filepath";
  840. static char __pyx_k_post_bin[] = "post_bin";
  841. static char __pyx_k_qualname[] = "__qualname__";
  842. static char __pyx_k_requests[] = "requests";
  843. static char __pyx_k_response[] = "response";
  844. static char __pyx_k_Exception[] = "Exception";
  845. static char __pyx_k_HTTP_head[] = "HTTP.head";
  846. static char __pyx_k_HTTP_post[] = "HTTP.post";
  847. static char __pyx_k_metaclass[] = "__metaclass__";
  848. static char __pyx_k_DEBUG_FLAG[] = "DEBUG_FLAG";
  849. static char __pyx_k_chunk_size[] = "chunk_size";
  850. static char __pyx_k_exceptions[] = "exceptions";
  851. static char __pyx_k_HTTP___init[] = "HTTP.__init__";
  852. static char __pyx_k_file_exists[] = "file_exists";
  853. static char __pyx_k_status_code[] = "status_code";
  854. static char __pyx_k_HTTP_get_bin[] = "HTTP.get_bin";
  855. static char __pyx_k_iter_content[] = "iter_content";
  856. static char __pyx_k_HTTP_post_bin[] = "HTTP.post_bin";
  857. static char __pyx_k_HTTP_response[] = "HTTP.response";
  858. static char __pyx_k_get_status_ok[] = "get_status_ok";
  859. static char __pyx_k_Naked_settings[] = "Naked.settings";
  860. static char __pyx_k_post_status_ok[] = "post_status_ok";
  861. static char __pyx_k_ConnectionError[] = "ConnectionError";
  862. static char __pyx_k_allow_redirects[] = "allow_redirects";
  863. static char __pyx_k_request_timeout[] = "request_timeout";
  864. static char __pyx_k_suppress_output[] = "suppress_output";
  865. static char __pyx_k_follow_redirects[] = "follow_redirects";
  866. static char __pyx_k_Download_complete[] = "Download complete.";
  867. static char __pyx_k_HTTP_get_status_ok[] = "HTTP.get_status_ok";
  868. static char __pyx_k_get_bin_write_file[] = "get_bin_write_file";
  869. static char __pyx_k_get_txt_write_file[] = "get_txt_write_file";
  870. static char __pyx_k_overwrite_existing[] = "overwrite_existing";
  871. static char __pyx_k_HTTP_post_status_ok[] = "HTTP.post_status_ok";
  872. static char __pyx_k_post_bin_write_file[] = "post_bin_write_file";
  873. static char __pyx_k_post_txt_write_file[] = "post_txt_write_file";
  874. static char __pyx_k_Downloading_file_from[] = "Downloading file from ";
  875. static char __pyx_k_Naked_toolshed_system[] = "Naked.toolshed.system";
  876. static char __pyx_k_HTTP_get_bin_write_file[] = "HTTP.get_bin_write_file";
  877. static char __pyx_k_HTTP_get_txt_write_file[] = "HTTP.get_txt_write_file";
  878. static char __pyx_k_HTTP_post_bin_write_file[] = "HTTP.post_bin_write_file";
  879. static char __pyx_k_HTTP_post_txt_write_file[] = "HTTP.post_txt_write_file";
  880. static char __pyx_k_lib_Naked_toolshed_c_network[] = "lib.Naked.toolshed.c.network";
  881. static char __pyx_k_Naked_Framework_Error_Unable_to[] = "Naked Framework Error: Unable to perform GET request with the URL ";
  882. static char __pyx_k_Users_ces_Desktop_code_naked_li[] = "/Users/ces/Desktop/code/naked/lib/Naked/toolshed/c/network.pyx";
  883. static char __pyx_k_using_the_get_bin_write_file_me[] = " using the get_bin_write_file() method (Naked.toolshed.network.py)";
  884. static char __pyx_k_using_the_get_data_method_Naked[] = " using the get_data() method (Naked.toolshed.network.py)";
  885. static char __pyx_k_using_the_get_data_write_txt_me[] = " using the get_data_write_txt() method (Naked.toolshed.network.py)";
  886. static char __pyx_k_using_the_get_method_Naked_tool[] = " using the get() method (Naked.toolshed.network.py)";
  887. static char __pyx_k_using_the_post_data_write_bin_m[] = " using the post_data_write_bin() method (Naked.toolshed.network.py)";
  888. static char __pyx_k_Download_aborted_A_local_file_wi[] = "Download aborted. A local file with the requested filename exists on the path.";
  889. static char __pyx_k_Naked_Framework_Error_Unable_to_2[] = "Naked Framework Error: Unable to perform GET request and write file with the URL ";
  890. static char __pyx_k_Naked_Framework_Error_Unable_to_3[] = "Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).";
  891. static char __pyx_k_Naked_Framework_Error_Unable_to_4[] = "Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).";
  892. static char __pyx_k_Naked_Framework_Error_Unable_to_5[] = "Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).";
  893. static char __pyx_k_Naked_Framework_Error_Unable_to_6[] = "Naked Framework Error: Unable to perform POST request and write file with the URL ";
  894. static char __pyx_k_Naked_Framework_Error_Unable_to_7[] = "Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).";
  895. static char __pyx_k_Naked_Framework_Error_Unable_to_8[] = "Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).";
  896. static char __pyx_k_Naked_Framework_Error_Unable_to_9[] = "Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).";
  897. static PyObject *__pyx_kp_s_;
  898. static PyObject *__pyx_n_s_ConnectionError;
  899. static PyObject *__pyx_n_s_DEBUG_FLAG;
  900. static PyObject *__pyx_kp_s_Download_aborted_A_local_file_wi;
  901. static PyObject *__pyx_kp_s_Download_complete;
  902. static PyObject *__pyx_kp_s_Downloading_file_from;
  903. static PyObject *__pyx_n_s_Exception;
  904. static PyObject *__pyx_n_s_HTTP;
  905. static PyObject *__pyx_n_s_HTTP___init;
  906. static PyObject *__pyx_n_s_HTTP_get;
  907. static PyObject *__pyx_n_s_HTTP_get_bin;
  908. static PyObject *__pyx_n_s_HTTP_get_bin_write_file;
  909. static PyObject *__pyx_n_s_HTTP_get_status_ok;
  910. static PyObject *__pyx_n_s_HTTP_get_txt_write_file;
  911. static PyObject *__pyx_n_s_HTTP_head;
  912. static PyObject *__pyx_n_s_HTTP_post;
  913. static PyObject *__pyx_n_s_HTTP_post_bin;
  914. static PyObject *__pyx_n_s_HTTP_post_bin_write_file;
  915. static PyObject *__pyx_n_s_HTTP_post_status_ok;
  916. static PyObject *__pyx_n_s_HTTP_post_txt_write_file;
  917. static PyObject *__pyx_n_s_HTTP_response;
  918. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to;
  919. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_2;
  920. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_3;
  921. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_4;
  922. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_5;
  923. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_6;
  924. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_7;
  925. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_8;
  926. static PyObject *__pyx_kp_s_Naked_Framework_Error_Unable_to_9;
  927. static PyObject *__pyx_n_s_Naked_settings;
  928. static PyObject *__pyx_n_s_Naked_toolshed_system;
  929. static PyObject *__pyx_kp_s_Users_ces_Desktop_code_naked_li;
  930. static PyObject *__pyx_kp_s__2;
  931. static PyObject *__pyx_kp_s__4;
  932. static PyObject *__pyx_kp_s__6;
  933. static PyObject *__pyx_n_s_allow_redirects;
  934. static PyObject *__pyx_n_s_ce;
  935. static PyObject *__pyx_n_s_chunk;
  936. static PyObject *__pyx_n_s_chunk_size;
  937. static PyObject *__pyx_n_s_codecs;
  938. static PyObject *__pyx_n_s_codes;
  939. static PyObject *__pyx_n_s_content;
  940. static PyObject *__pyx_n_s_debug;
  941. static PyObject *__pyx_n_s_decode;
  942. static PyObject *__pyx_n_s_doc;
  943. static PyObject *__pyx_n_s_e;
  944. static PyObject *__pyx_n_s_encoding;
  945. static PyObject *__pyx_n_s_end;
  946. static PyObject *__pyx_n_s_enter;
  947. static PyObject *__pyx_n_s_exceptions;
  948. static PyObject *__pyx_n_s_exit;
  949. static PyObject *__pyx_n_s_exit_2;
  950. static PyObject *__pyx_n_s_f;
  951. static PyObject *__pyx_n_s_file;
  952. static PyObject *__pyx_n_s_file_exists;
  953. static PyObject *__pyx_n_s_fileno;
  954. static PyObject *__pyx_n_s_filepath;
  955. static PyObject *__pyx_n_s_flush;
  956. static PyObject *__pyx_n_s_follow_redirects;
  957. static PyObject *__pyx_n_s_fsync;
  958. static PyObject *__pyx_n_s_get;
  959. static PyObject *__pyx_n_s_get_bin;
  960. static PyObject *__pyx_n_s_get_bin_write_file;
  961. static PyObject *__pyx_n_s_get_status_ok;
  962. static PyObject *__pyx_n_s_get_txt_write_file;
  963. static PyObject *__pyx_n_s_head;
  964. static PyObject *__pyx_n_s_headers;
  965. static PyObject *__pyx_n_s_import;
  966. static PyObject *__pyx_n_s_init;
  967. static PyObject *__pyx_n_s_iter_content;
  968. static PyObject *__pyx_n_s_lib_Naked_toolshed_c_network;
  969. static PyObject *__pyx_n_s_main;
  970. static PyObject *__pyx_n_s_metaclass;
  971. static PyObject *__pyx_n_s_mode;
  972. static PyObject *__pyx_n_s_module;
  973. static PyObject *__pyx_n_s_name;
  974. static PyObject *__pyx_n_s_ok;
  975. static PyObject *__pyx_n_s_open;
  976. static PyObject *__pyx_n_s_os;
  977. static PyObject *__pyx_n_s_overwrite_existing;
  978. static PyObject *__pyx_n_s_post;
  979. static PyObject *__pyx_n_s_post_bin;
  980. static PyObject *__pyx_n_s_post_bin_write_file;
  981. static PyObject *__pyx_n_s_post_status_ok;
  982. static PyObject *__pyx_n_s_post_txt_write_file;
  983. static PyObject *__pyx_n_s_prepare;
  984. static PyObject *__pyx_n_s_print;
  985. static PyObject *__pyx_n_s_qualname;
  986. static PyObject *__pyx_n_s_request_timeout;
  987. static PyObject *__pyx_n_s_requests;
  988. static PyObject *__pyx_n_s_res;
  989. static PyObject *__pyx_n_s_response;
  990. static PyObject *__pyx_n_s_self;
  991. static PyObject *__pyx_n_s_split;
  992. static PyObject *__pyx_n_s_status_code;
  993. static PyObject *__pyx_n_s_stderr;
  994. static PyObject *__pyx_n_s_stdout;
  995. static PyObject *__pyx_n_s_stream;
  996. static PyObject *__pyx_n_s_suppress_output;
  997. static PyObject *__pyx_n_s_sys;
  998. static PyObject *__pyx_n_s_test;
  999. static PyObject *__pyx_n_s_text;
  1000. static PyObject *__pyx_n_s_timeout;
  1001. static PyObject *__pyx_n_s_url;
  1002. static PyObject *__pyx_kp_s_using_the_get_bin_write_file_me;
  1003. static PyObject *__pyx_kp_s_using_the_get_data_method_Naked;
  1004. static PyObject *__pyx_kp_s_using_the_get_data_write_txt_me;
  1005. static PyObject *__pyx_kp_s_using_the_get_method_Naked_tool;
  1006. static PyObject *__pyx_kp_s_using_the_post_data_write_bin_m;
  1007. static PyObject *__pyx_kp_s_utf_8;
  1008. static PyObject *__pyx_n_s_w;
  1009. static PyObject *__pyx_n_s_wb;
  1010. static PyObject *__pyx_n_s_write;
  1011. static PyObject *__pyx_int_10;
  1012. static PyObject *__pyx_int_2048;
  1013. static PyObject *__pyx_tuple__3;
  1014. static PyObject *__pyx_tuple__5;
  1015. static PyObject *__pyx_tuple__7;
  1016. static PyObject *__pyx_tuple__8;
  1017. static PyObject *__pyx_tuple__9;
  1018. static PyObject *__pyx_tuple__10;
  1019. static PyObject *__pyx_tuple__11;
  1020. static PyObject *__pyx_tuple__12;
  1021. static PyObject *__pyx_tuple__13;
  1022. static PyObject *__pyx_tuple__14;
  1023. static PyObject *__pyx_tuple__15;
  1024. static PyObject *__pyx_tuple__16;
  1025. static PyObject *__pyx_tuple__17;
  1026. static PyObject *__pyx_tuple__18;
  1027. static PyObject *__pyx_tuple__19;
  1028. static PyObject *__pyx_tuple__20;
  1029. static PyObject *__pyx_tuple__21;
  1030. static PyObject *__pyx_tuple__23;
  1031. static PyObject *__pyx_tuple__24;
  1032. static PyObject *__pyx_tuple__26;
  1033. static PyObject *__pyx_tuple__27;
  1034. static PyObject *__pyx_tuple__29;
  1035. static PyObject *__pyx_tuple__31;
  1036. static PyObject *__pyx_tuple__32;
  1037. static PyObject *__pyx_tuple__34;
  1038. static PyObject *__pyx_tuple__35;
  1039. static PyObject *__pyx_tuple__37;
  1040. static PyObject *__pyx_tuple__39;
  1041. static PyObject *__pyx_tuple__40;
  1042. static PyObject *__pyx_tuple__42;
  1043. static PyObject *__pyx_tuple__44;
  1044. static PyObject *__pyx_tuple__45;
  1045. static PyObject *__pyx_tuple__47;
  1046. static PyObject *__pyx_tuple__48;
  1047. static PyObject *__pyx_tuple__50;
  1048. static PyObject *__pyx_tuple__52;
  1049. static PyObject *__pyx_codeobj__22;
  1050. static PyObject *__pyx_codeobj__25;
  1051. static PyObject *__pyx_codeobj__28;
  1052. static PyObject *__pyx_codeobj__30;
  1053. static PyObject *__pyx_codeobj__33;
  1054. static PyObject *__pyx_codeobj__36;
  1055. static PyObject *__pyx_codeobj__38;
  1056. static PyObject *__pyx_codeobj__41;
  1057. static PyObject *__pyx_codeobj__43;
  1058. static PyObject *__pyx_codeobj__46;
  1059. static PyObject *__pyx_codeobj__49;
  1060. static PyObject *__pyx_codeobj__51;
  1061. static PyObject *__pyx_codeobj__53;
  1062. /* "lib/Naked/toolshed/c/network.pyx":15
  1063. * #------------------------------------------------------------------------------
  1064. * class HTTP():
  1065. * def __init__(self, url="", request_timeout=10): # <<<<<<<<<<<<<<
  1066. * self.url = url
  1067. * self.request_timeout = request_timeout
  1068. */
  1069. /* Python wrapper */
  1070. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1071. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_1__init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_1__init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  1072. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1073. PyObject *__pyx_v_self = 0;
  1074. PyObject *__pyx_v_url = 0;
  1075. PyObject *__pyx_v_request_timeout = 0;
  1076. int __pyx_lineno = 0;
  1077. const char *__pyx_filename = NULL;
  1078. int __pyx_clineno = 0;
  1079. PyObject *__pyx_r = 0;
  1080. __Pyx_RefNannyDeclarations
  1081. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  1082. {
  1083. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_url,&__pyx_n_s_request_timeout,0};
  1084. PyObject* values[3] = {0,0,0};
  1085. values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_));
  1086. values[2] = ((PyObject *)((PyObject *)__pyx_int_10));
  1087. if (unlikely(__pyx_kwds)) {
  1088. Py_ssize_t kw_args;
  1089. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1090. switch (pos_args) {
  1091. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1092. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1093. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1094. case 0: break;
  1095. default: goto __pyx_L5_argtuple_error;
  1096. }
  1097. kw_args = PyDict_Size(__pyx_kwds);
  1098. switch (pos_args) {
  1099. case 0:
  1100. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  1101. else goto __pyx_L5_argtuple_error;
  1102. case 1:
  1103. if (kw_args > 0) {
  1104. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_url);
  1105. if (value) { values[1] = value; kw_args--; }
  1106. }
  1107. case 2:
  1108. if (kw_args > 0) {
  1109. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_request_timeout);
  1110. if (value) { values[2] = value; kw_args--; }
  1111. }
  1112. }
  1113. if (unlikely(kw_args > 0)) {
  1114. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1115. }
  1116. } else {
  1117. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1118. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1119. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1120. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1121. break;
  1122. default: goto __pyx_L5_argtuple_error;
  1123. }
  1124. }
  1125. __pyx_v_self = values[0];
  1126. __pyx_v_url = values[1];
  1127. __pyx_v_request_timeout = values[2];
  1128. }
  1129. goto __pyx_L4_argument_unpacking_done;
  1130. __pyx_L5_argtuple_error:;
  1131. __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1132. __pyx_L3_error:;
  1133. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1134. __Pyx_RefNannyFinishContext();
  1135. return NULL;
  1136. __pyx_L4_argument_unpacking_done:;
  1137. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP___init__(__pyx_self, __pyx_v_self, __pyx_v_url, __pyx_v_request_timeout);
  1138. /* function exit code */
  1139. __Pyx_RefNannyFinishContext();
  1140. return __pyx_r;
  1141. }
  1142. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_url, PyObject *__pyx_v_request_timeout) {
  1143. PyObject *__pyx_r = NULL;
  1144. __Pyx_RefNannyDeclarations
  1145. int __pyx_lineno = 0;
  1146. const char *__pyx_filename = NULL;
  1147. int __pyx_clineno = 0;
  1148. __Pyx_RefNannySetupContext("__init__", 0);
  1149. /* "lib/Naked/toolshed/c/network.pyx":16
  1150. * class HTTP():
  1151. * def __init__(self, url="", request_timeout=10):
  1152. * self.url = url # <<<<<<<<<<<<<<
  1153. * self.request_timeout = request_timeout
  1154. * #------------------------------------------------------------------------------
  1155. */
  1156. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_url, __pyx_v_url) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1157. /* "lib/Naked/toolshed/c/network.pyx":17
  1158. * def __init__(self, url="", request_timeout=10):
  1159. * self.url = url
  1160. * self.request_timeout = request_timeout # <<<<<<<<<<<<<<
  1161. * #------------------------------------------------------------------------------
  1162. * # HTTP response properties (assignment occurs with the HTTP request methods)
  1163. */
  1164. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout, __pyx_v_request_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1165. /* "lib/Naked/toolshed/c/network.pyx":21
  1166. * # HTTP response properties (assignment occurs with the HTTP request methods)
  1167. * #------------------------------------------------------------------------------
  1168. * self.res = None # assigned with the requests external library response object after a HTTP method call # <<<<<<<<<<<<<<
  1169. *
  1170. * #------------------------------------------------------------------------------
  1171. */
  1172. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1173. /* "lib/Naked/toolshed/c/network.pyx":15
  1174. * #------------------------------------------------------------------------------
  1175. * class HTTP():
  1176. * def __init__(self, url="", request_timeout=10): # <<<<<<<<<<<<<<
  1177. * self.url = url
  1178. * self.request_timeout = request_timeout
  1179. */
  1180. /* function exit code */
  1181. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1182. goto __pyx_L0;
  1183. __pyx_L1_error:;
  1184. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1185. __pyx_r = NULL;
  1186. __pyx_L0:;
  1187. __Pyx_XGIVEREF(__pyx_r);
  1188. __Pyx_RefNannyFinishContext();
  1189. return __pyx_r;
  1190. }
  1191. /* "lib/Naked/toolshed/c/network.pyx":32
  1192. * # test_http_post_reponse_change, test_http_get_response_check
  1193. * #------------------------------------------------------------------------------
  1194. * def get(self, follow_redirects=True): # <<<<<<<<<<<<<<
  1195. * try:
  1196. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  1197. */
  1198. /* Python wrapper */
  1199. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_3get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1200. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_3get = {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_3get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  1201. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_3get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1202. PyObject *__pyx_v_self = 0;
  1203. PyObject *__pyx_v_follow_redirects = 0;
  1204. int __pyx_lineno = 0;
  1205. const char *__pyx_filename = NULL;
  1206. int __pyx_clineno = 0;
  1207. PyObject *__pyx_r = 0;
  1208. __Pyx_RefNannyDeclarations
  1209. __Pyx_RefNannySetupContext("get (wrapper)", 0);
  1210. {
  1211. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_follow_redirects,0};
  1212. PyObject* values[2] = {0,0};
  1213. values[1] = ((PyObject *)((PyObject *)Py_True));
  1214. if (unlikely(__pyx_kwds)) {
  1215. Py_ssize_t kw_args;
  1216. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1217. switch (pos_args) {
  1218. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1219. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1220. case 0: break;
  1221. default: goto __pyx_L5_argtuple_error;
  1222. }
  1223. kw_args = PyDict_Size(__pyx_kwds);
  1224. switch (pos_args) {
  1225. case 0:
  1226. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  1227. else goto __pyx_L5_argtuple_error;
  1228. case 1:
  1229. if (kw_args > 0) {
  1230. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_follow_redirects);
  1231. if (value) { values[1] = value; kw_args--; }
  1232. }
  1233. }
  1234. if (unlikely(kw_args > 0)) {
  1235. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1236. }
  1237. } else {
  1238. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1239. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1240. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1241. break;
  1242. default: goto __pyx_L5_argtuple_error;
  1243. }
  1244. }
  1245. __pyx_v_self = values[0];
  1246. __pyx_v_follow_redirects = values[1];
  1247. }
  1248. goto __pyx_L4_argument_unpacking_done;
  1249. __pyx_L5_argtuple_error:;
  1250. __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1251. __pyx_L3_error:;
  1252. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1253. __Pyx_RefNannyFinishContext();
  1254. return NULL;
  1255. __pyx_L4_argument_unpacking_done:;
  1256. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_2get(__pyx_self, __pyx_v_self, __pyx_v_follow_redirects);
  1257. /* function exit code */
  1258. __Pyx_RefNannyFinishContext();
  1259. return __pyx_r;
  1260. }
  1261. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_2get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_follow_redirects) {
  1262. PyObject *__pyx_v_response = NULL;
  1263. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  1264. PyObject *__pyx_v_e = NULL;
  1265. PyObject *__pyx_r = NULL;
  1266. __Pyx_RefNannyDeclarations
  1267. PyObject *__pyx_t_1 = NULL;
  1268. PyObject *__pyx_t_2 = NULL;
  1269. PyObject *__pyx_t_3 = NULL;
  1270. PyObject *__pyx_t_4 = NULL;
  1271. PyObject *__pyx_t_5 = NULL;
  1272. PyObject *__pyx_t_6 = NULL;
  1273. PyObject *__pyx_t_7 = NULL;
  1274. int __pyx_t_8;
  1275. int __pyx_t_9;
  1276. PyObject *__pyx_t_10 = NULL;
  1277. PyObject *__pyx_t_11 = NULL;
  1278. int __pyx_lineno = 0;
  1279. const char *__pyx_filename = NULL;
  1280. int __pyx_clineno = 0;
  1281. __Pyx_RefNannySetupContext("get", 0);
  1282. /* "lib/Naked/toolshed/c/network.pyx":33
  1283. * #------------------------------------------------------------------------------
  1284. * def get(self, follow_redirects=True):
  1285. * try: # <<<<<<<<<<<<<<
  1286. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  1287. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  1288. */
  1289. {
  1290. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  1291. __Pyx_XGOTREF(__pyx_t_1);
  1292. __Pyx_XGOTREF(__pyx_t_2);
  1293. __Pyx_XGOTREF(__pyx_t_3);
  1294. /*try:*/ {
  1295. /* "lib/Naked/toolshed/c/network.pyx":34
  1296. * def get(self, follow_redirects=True):
  1297. * try:
  1298. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects) # <<<<<<<<<<<<<<
  1299. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  1300. * return response.text
  1301. */
  1302. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1303. __Pyx_GOTREF(__pyx_t_4);
  1304. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1305. __Pyx_GOTREF(__pyx_t_5);
  1306. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1307. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1308. __Pyx_GOTREF(__pyx_t_4);
  1309. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1310. __Pyx_GOTREF(__pyx_t_6);
  1311. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  1312. __Pyx_GIVEREF(__pyx_t_4);
  1313. __pyx_t_4 = 0;
  1314. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1315. __Pyx_GOTREF(__pyx_t_4);
  1316. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1317. __Pyx_GOTREF(__pyx_t_7);
  1318. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1319. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1320. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allow_redirects, __pyx_v_follow_redirects) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1321. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1322. __Pyx_GOTREF(__pyx_t_7);
  1323. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1324. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1325. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1326. __pyx_v_response = __pyx_t_7;
  1327. __pyx_t_7 = 0;
  1328. /* "lib/Naked/toolshed/c/network.pyx":35
  1329. * try:
  1330. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  1331. * self.res = response # assign the response object from requests to a property on the instance of HTTP class # <<<<<<<<<<<<<<
  1332. * return response.text
  1333. * except requests.exceptions.ConnectionError as ce:
  1334. */
  1335. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1336. /* "lib/Naked/toolshed/c/network.pyx":36
  1337. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  1338. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  1339. * return response.text # <<<<<<<<<<<<<<
  1340. * except requests.exceptions.ConnectionError as ce:
  1341. * return False
  1342. */
  1343. __Pyx_XDECREF(__pyx_r);
  1344. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_text); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1345. __Pyx_GOTREF(__pyx_t_7);
  1346. __pyx_r = __pyx_t_7;
  1347. __pyx_t_7 = 0;
  1348. goto __pyx_L7_try_return;
  1349. }
  1350. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  1351. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  1352. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  1353. goto __pyx_L10_try_end;
  1354. __pyx_L3_error:;
  1355. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  1356. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  1357. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  1358. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  1359. /* "lib/Naked/toolshed/c/network.pyx":37
  1360. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  1361. * return response.text
  1362. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  1363. * return False
  1364. * except Exception as e:
  1365. */
  1366. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1367. __Pyx_GOTREF(__pyx_t_7);
  1368. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1369. __Pyx_GOTREF(__pyx_t_4);
  1370. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1371. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1372. __Pyx_GOTREF(__pyx_t_7);
  1373. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1374. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_7);
  1375. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1376. if (__pyx_t_8) {
  1377. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1378. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1379. __Pyx_GOTREF(__pyx_t_7);
  1380. __Pyx_GOTREF(__pyx_t_4);
  1381. __Pyx_GOTREF(__pyx_t_6);
  1382. __Pyx_INCREF(__pyx_t_4);
  1383. __pyx_v_ce = __pyx_t_4;
  1384. /* "lib/Naked/toolshed/c/network.pyx":38
  1385. * return response.text
  1386. * except requests.exceptions.ConnectionError as ce:
  1387. * return False # <<<<<<<<<<<<<<
  1388. * except Exception as e:
  1389. * if DEBUG_FLAG:
  1390. */
  1391. __Pyx_XDECREF(__pyx_r);
  1392. __Pyx_INCREF(Py_False);
  1393. __pyx_r = Py_False;
  1394. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1395. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1396. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1397. goto __pyx_L6_except_return;
  1398. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1399. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1400. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1401. goto __pyx_L4_exception_handled;
  1402. }
  1403. /* "lib/Naked/toolshed/c/network.pyx":39
  1404. * except requests.exceptions.ConnectionError as ce:
  1405. * return False
  1406. * except Exception as e: # <<<<<<<<<<<<<<
  1407. * if DEBUG_FLAG:
  1408. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get() method (Naked.toolshed.network.py)")
  1409. */
  1410. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  1411. if (__pyx_t_8) {
  1412. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1413. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1414. __Pyx_GOTREF(__pyx_t_6);
  1415. __Pyx_GOTREF(__pyx_t_4);
  1416. __Pyx_GOTREF(__pyx_t_7);
  1417. __Pyx_INCREF(__pyx_t_4);
  1418. __pyx_v_e = __pyx_t_4;
  1419. /* "lib/Naked/toolshed/c/network.pyx":40
  1420. * return False
  1421. * except Exception as e:
  1422. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  1423. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get() method (Naked.toolshed.network.py)")
  1424. * raise e
  1425. */
  1426. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1427. __Pyx_GOTREF(__pyx_t_5);
  1428. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1429. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1430. if (__pyx_t_9) {
  1431. /* "lib/Naked/toolshed/c/network.pyx":41
  1432. * except Exception as e:
  1433. * if DEBUG_FLAG:
  1434. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get() method (Naked.toolshed.network.py)") # <<<<<<<<<<<<<<
  1435. * raise e
  1436. *
  1437. */
  1438. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1439. __Pyx_GOTREF(__pyx_t_5);
  1440. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1441. __Pyx_GOTREF(__pyx_t_10);
  1442. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1443. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1444. __Pyx_GOTREF(__pyx_t_5);
  1445. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  1446. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1447. __Pyx_GOTREF(__pyx_t_10);
  1448. __pyx_t_11 = PyNumber_Add(__pyx_kp_s_Naked_Framework_Error_Unable_to, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1449. __Pyx_GOTREF(__pyx_t_11);
  1450. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  1451. __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_kp_s_using_the_get_method_Naked_tool); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1452. __Pyx_GOTREF(__pyx_t_10);
  1453. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  1454. __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1455. __Pyx_GOTREF(__pyx_t_11);
  1456. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
  1457. __Pyx_GIVEREF(__pyx_t_10);
  1458. __pyx_t_10 = 0;
  1459. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1460. __Pyx_GOTREF(__pyx_t_10);
  1461. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1462. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  1463. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  1464. goto __pyx_L15;
  1465. }
  1466. __pyx_L15:;
  1467. /* "lib/Naked/toolshed/c/network.pyx":42
  1468. * if DEBUG_FLAG:
  1469. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get() method (Naked.toolshed.network.py)")
  1470. * raise e # <<<<<<<<<<<<<<
  1471. *
  1472. * #------------------------------------------------------------------------------
  1473. */
  1474. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  1475. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1476. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1477. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1478. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1479. goto __pyx_L4_exception_handled;
  1480. }
  1481. goto __pyx_L5_except_error;
  1482. __pyx_L5_except_error:;
  1483. __Pyx_XGIVEREF(__pyx_t_1);
  1484. __Pyx_XGIVEREF(__pyx_t_2);
  1485. __Pyx_XGIVEREF(__pyx_t_3);
  1486. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1487. goto __pyx_L1_error;
  1488. __pyx_L7_try_return:;
  1489. __Pyx_XGIVEREF(__pyx_t_1);
  1490. __Pyx_XGIVEREF(__pyx_t_2);
  1491. __Pyx_XGIVEREF(__pyx_t_3);
  1492. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1493. goto __pyx_L0;
  1494. __pyx_L6_except_return:;
  1495. __Pyx_XGIVEREF(__pyx_t_1);
  1496. __Pyx_XGIVEREF(__pyx_t_2);
  1497. __Pyx_XGIVEREF(__pyx_t_3);
  1498. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1499. goto __pyx_L0;
  1500. __pyx_L4_exception_handled:;
  1501. __Pyx_XGIVEREF(__pyx_t_1);
  1502. __Pyx_XGIVEREF(__pyx_t_2);
  1503. __Pyx_XGIVEREF(__pyx_t_3);
  1504. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1505. __pyx_L10_try_end:;
  1506. }
  1507. /* "lib/Naked/toolshed/c/network.pyx":32
  1508. * # test_http_post_reponse_change, test_http_get_response_check
  1509. * #------------------------------------------------------------------------------
  1510. * def get(self, follow_redirects=True): # <<<<<<<<<<<<<<
  1511. * try:
  1512. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  1513. */
  1514. /* function exit code */
  1515. __pyx_L1_error:;
  1516. __Pyx_XDECREF(__pyx_t_4);
  1517. __Pyx_XDECREF(__pyx_t_5);
  1518. __Pyx_XDECREF(__pyx_t_6);
  1519. __Pyx_XDECREF(__pyx_t_7);
  1520. __Pyx_XDECREF(__pyx_t_10);
  1521. __Pyx_XDECREF(__pyx_t_11);
  1522. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1523. __pyx_r = NULL;
  1524. __pyx_L0:;
  1525. __Pyx_XDECREF(__pyx_v_response);
  1526. __Pyx_XDECREF(__pyx_v_ce);
  1527. __Pyx_XDECREF(__pyx_v_e);
  1528. __Pyx_XGIVEREF(__pyx_r);
  1529. __Pyx_RefNannyFinishContext();
  1530. return __pyx_r;
  1531. }
  1532. /* "lib/Naked/toolshed/c/network.pyx":49
  1533. * # returns data stream with raw binary data
  1534. * #------------------------------------------------------------------------------
  1535. * def get_bin(self): # <<<<<<<<<<<<<<
  1536. * try:
  1537. * response = requests.get(self.url, timeout=self.request_timeout)
  1538. */
  1539. /* Python wrapper */
  1540. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_5get_bin(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  1541. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_5get_bin = {__Pyx_NAMESTR("get_bin"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_5get_bin, METH_O, __Pyx_DOCSTR(0)};
  1542. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_5get_bin(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  1543. PyObject *__pyx_r = 0;
  1544. __Pyx_RefNannyDeclarations
  1545. __Pyx_RefNannySetupContext("get_bin (wrapper)", 0);
  1546. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_4get_bin(__pyx_self, ((PyObject *)__pyx_v_self));
  1547. /* function exit code */
  1548. __Pyx_RefNannyFinishContext();
  1549. return __pyx_r;
  1550. }
  1551. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_4get_bin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  1552. PyObject *__pyx_v_response = NULL;
  1553. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  1554. PyObject *__pyx_v_e = NULL;
  1555. PyObject *__pyx_r = NULL;
  1556. __Pyx_RefNannyDeclarations
  1557. PyObject *__pyx_t_1 = NULL;
  1558. PyObject *__pyx_t_2 = NULL;
  1559. PyObject *__pyx_t_3 = NULL;
  1560. PyObject *__pyx_t_4 = NULL;
  1561. PyObject *__pyx_t_5 = NULL;
  1562. PyObject *__pyx_t_6 = NULL;
  1563. PyObject *__pyx_t_7 = NULL;
  1564. int __pyx_t_8;
  1565. int __pyx_t_9;
  1566. PyObject *__pyx_t_10 = NULL;
  1567. PyObject *__pyx_t_11 = NULL;
  1568. int __pyx_lineno = 0;
  1569. const char *__pyx_filename = NULL;
  1570. int __pyx_clineno = 0;
  1571. __Pyx_RefNannySetupContext("get_bin", 0);
  1572. /* "lib/Naked/toolshed/c/network.pyx":50
  1573. * #------------------------------------------------------------------------------
  1574. * def get_bin(self):
  1575. * try: # <<<<<<<<<<<<<<
  1576. * response = requests.get(self.url, timeout=self.request_timeout)
  1577. * self.res = response # assign the response object from requests to a property on the instance
  1578. */
  1579. {
  1580. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  1581. __Pyx_XGOTREF(__pyx_t_1);
  1582. __Pyx_XGOTREF(__pyx_t_2);
  1583. __Pyx_XGOTREF(__pyx_t_3);
  1584. /*try:*/ {
  1585. /* "lib/Naked/toolshed/c/network.pyx":51
  1586. * def get_bin(self):
  1587. * try:
  1588. * response = requests.get(self.url, timeout=self.request_timeout) # <<<<<<<<<<<<<<
  1589. * self.res = response # assign the response object from requests to a property on the instance
  1590. * return response.content # return binary data instead of text (get() returns text)
  1591. */
  1592. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1593. __Pyx_GOTREF(__pyx_t_4);
  1594. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1595. __Pyx_GOTREF(__pyx_t_5);
  1596. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1597. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1598. __Pyx_GOTREF(__pyx_t_4);
  1599. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1600. __Pyx_GOTREF(__pyx_t_6);
  1601. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  1602. __Pyx_GIVEREF(__pyx_t_4);
  1603. __pyx_t_4 = 0;
  1604. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1605. __Pyx_GOTREF(__pyx_t_4);
  1606. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1607. __Pyx_GOTREF(__pyx_t_7);
  1608. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1609. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1610. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1611. __Pyx_GOTREF(__pyx_t_7);
  1612. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1613. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1614. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1615. __pyx_v_response = __pyx_t_7;
  1616. __pyx_t_7 = 0;
  1617. /* "lib/Naked/toolshed/c/network.pyx":52
  1618. * try:
  1619. * response = requests.get(self.url, timeout=self.request_timeout)
  1620. * self.res = response # assign the response object from requests to a property on the instance # <<<<<<<<<<<<<<
  1621. * return response.content # return binary data instead of text (get() returns text)
  1622. * except requests.exceptions.ConnectionError as ce:
  1623. */
  1624. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1625. /* "lib/Naked/toolshed/c/network.pyx":53
  1626. * response = requests.get(self.url, timeout=self.request_timeout)
  1627. * self.res = response # assign the response object from requests to a property on the instance
  1628. * return response.content # return binary data instead of text (get() returns text) # <<<<<<<<<<<<<<
  1629. * except requests.exceptions.ConnectionError as ce:
  1630. * return False
  1631. */
  1632. __Pyx_XDECREF(__pyx_r);
  1633. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_content); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1634. __Pyx_GOTREF(__pyx_t_7);
  1635. __pyx_r = __pyx_t_7;
  1636. __pyx_t_7 = 0;
  1637. goto __pyx_L7_try_return;
  1638. }
  1639. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  1640. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  1641. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  1642. goto __pyx_L10_try_end;
  1643. __pyx_L3_error:;
  1644. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  1645. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  1646. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  1647. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  1648. /* "lib/Naked/toolshed/c/network.pyx":54
  1649. * self.res = response # assign the response object from requests to a property on the instance
  1650. * return response.content # return binary data instead of text (get() returns text)
  1651. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  1652. * return False
  1653. * except Exception as e:
  1654. */
  1655. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1656. __Pyx_GOTREF(__pyx_t_7);
  1657. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1658. __Pyx_GOTREF(__pyx_t_4);
  1659. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1660. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1661. __Pyx_GOTREF(__pyx_t_7);
  1662. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1663. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_7);
  1664. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1665. if (__pyx_t_8) {
  1666. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1667. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1668. __Pyx_GOTREF(__pyx_t_7);
  1669. __Pyx_GOTREF(__pyx_t_4);
  1670. __Pyx_GOTREF(__pyx_t_6);
  1671. __Pyx_INCREF(__pyx_t_4);
  1672. __pyx_v_ce = __pyx_t_4;
  1673. /* "lib/Naked/toolshed/c/network.pyx":55
  1674. * return response.content # return binary data instead of text (get() returns text)
  1675. * except requests.exceptions.ConnectionError as ce:
  1676. * return False # <<<<<<<<<<<<<<
  1677. * except Exception as e:
  1678. * if DEBUG_FLAG:
  1679. */
  1680. __Pyx_XDECREF(__pyx_r);
  1681. __Pyx_INCREF(Py_False);
  1682. __pyx_r = Py_False;
  1683. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1684. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1685. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1686. goto __pyx_L6_except_return;
  1687. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1688. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1689. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1690. goto __pyx_L4_exception_handled;
  1691. }
  1692. /* "lib/Naked/toolshed/c/network.pyx":56
  1693. * except requests.exceptions.ConnectionError as ce:
  1694. * return False
  1695. * except Exception as e: # <<<<<<<<<<<<<<
  1696. * if DEBUG_FLAG:
  1697. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get_data() method (Naked.toolshed.network.py)")
  1698. */
  1699. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  1700. if (__pyx_t_8) {
  1701. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1702. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1703. __Pyx_GOTREF(__pyx_t_6);
  1704. __Pyx_GOTREF(__pyx_t_4);
  1705. __Pyx_GOTREF(__pyx_t_7);
  1706. __Pyx_INCREF(__pyx_t_4);
  1707. __pyx_v_e = __pyx_t_4;
  1708. /* "lib/Naked/toolshed/c/network.pyx":57
  1709. * return False
  1710. * except Exception as e:
  1711. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  1712. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get_data() method (Naked.toolshed.network.py)")
  1713. * raise e
  1714. */
  1715. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1716. __Pyx_GOTREF(__pyx_t_5);
  1717. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1718. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1719. if (__pyx_t_9) {
  1720. /* "lib/Naked/toolshed/c/network.pyx":58
  1721. * except Exception as e:
  1722. * if DEBUG_FLAG:
  1723. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get_data() method (Naked.toolshed.network.py)") # <<<<<<<<<<<<<<
  1724. * raise e
  1725. *
  1726. */
  1727. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1728. __Pyx_GOTREF(__pyx_t_5);
  1729. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1730. __Pyx_GOTREF(__pyx_t_10);
  1731. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1732. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1733. __Pyx_GOTREF(__pyx_t_5);
  1734. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  1735. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1736. __Pyx_GOTREF(__pyx_t_10);
  1737. __pyx_t_11 = PyNumber_Add(__pyx_kp_s_Naked_Framework_Error_Unable_to, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1738. __Pyx_GOTREF(__pyx_t_11);
  1739. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  1740. __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_kp_s_using_the_get_data_method_Naked); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1741. __Pyx_GOTREF(__pyx_t_10);
  1742. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  1743. __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1744. __Pyx_GOTREF(__pyx_t_11);
  1745. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
  1746. __Pyx_GIVEREF(__pyx_t_10);
  1747. __pyx_t_10 = 0;
  1748. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1749. __Pyx_GOTREF(__pyx_t_10);
  1750. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1751. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  1752. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  1753. goto __pyx_L15;
  1754. }
  1755. __pyx_L15:;
  1756. /* "lib/Naked/toolshed/c/network.pyx":59
  1757. * if DEBUG_FLAG:
  1758. * sys.stderr.write("Naked Framework Error: Unable to perform GET request with the URL " + self.url + " using the get_data() method (Naked.toolshed.network.py)")
  1759. * raise e # <<<<<<<<<<<<<<
  1760. *
  1761. * #------------------------------------------------------------------------------
  1762. */
  1763. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  1764. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  1765. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  1766. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1767. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  1768. goto __pyx_L4_exception_handled;
  1769. }
  1770. goto __pyx_L5_except_error;
  1771. __pyx_L5_except_error:;
  1772. __Pyx_XGIVEREF(__pyx_t_1);
  1773. __Pyx_XGIVEREF(__pyx_t_2);
  1774. __Pyx_XGIVEREF(__pyx_t_3);
  1775. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1776. goto __pyx_L1_error;
  1777. __pyx_L7_try_return:;
  1778. __Pyx_XGIVEREF(__pyx_t_1);
  1779. __Pyx_XGIVEREF(__pyx_t_2);
  1780. __Pyx_XGIVEREF(__pyx_t_3);
  1781. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1782. goto __pyx_L0;
  1783. __pyx_L6_except_return:;
  1784. __Pyx_XGIVEREF(__pyx_t_1);
  1785. __Pyx_XGIVEREF(__pyx_t_2);
  1786. __Pyx_XGIVEREF(__pyx_t_3);
  1787. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1788. goto __pyx_L0;
  1789. __pyx_L4_exception_handled:;
  1790. __Pyx_XGIVEREF(__pyx_t_1);
  1791. __Pyx_XGIVEREF(__pyx_t_2);
  1792. __Pyx_XGIVEREF(__pyx_t_3);
  1793. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  1794. __pyx_L10_try_end:;
  1795. }
  1796. /* "lib/Naked/toolshed/c/network.pyx":49
  1797. * # returns data stream with raw binary data
  1798. * #------------------------------------------------------------------------------
  1799. * def get_bin(self): # <<<<<<<<<<<<<<
  1800. * try:
  1801. * response = requests.get(self.url, timeout=self.request_timeout)
  1802. */
  1803. /* function exit code */
  1804. __pyx_L1_error:;
  1805. __Pyx_XDECREF(__pyx_t_4);
  1806. __Pyx_XDECREF(__pyx_t_5);
  1807. __Pyx_XDECREF(__pyx_t_6);
  1808. __Pyx_XDECREF(__pyx_t_7);
  1809. __Pyx_XDECREF(__pyx_t_10);
  1810. __Pyx_XDECREF(__pyx_t_11);
  1811. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1812. __pyx_r = NULL;
  1813. __pyx_L0:;
  1814. __Pyx_XDECREF(__pyx_v_response);
  1815. __Pyx_XDECREF(__pyx_v_ce);
  1816. __Pyx_XDECREF(__pyx_v_e);
  1817. __Pyx_XGIVEREF(__pyx_r);
  1818. __Pyx_RefNannyFinishContext();
  1819. return __pyx_r;
  1820. }
  1821. /* "lib/Naked/toolshed/c/network.pyx":69
  1822. * # Tests: test_NETWORK.py :: test_http_get_binary
  1823. * #------------------------------------------------------------------------------
  1824. * def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  1825. * try:
  1826. * import os # used for os.fsync() method in the write
  1827. */
  1828. /* Python wrapper */
  1829. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_7get_bin_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1830. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_7get_bin_write_file = {__Pyx_NAMESTR("get_bin_write_file"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_7get_bin_write_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  1831. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_7get_bin_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1832. PyObject *__pyx_v_self = 0;
  1833. PyObject *__pyx_v_filepath = 0;
  1834. PyObject *__pyx_v_suppress_output = 0;
  1835. PyObject *__pyx_v_overwrite_existing = 0;
  1836. int __pyx_lineno = 0;
  1837. const char *__pyx_filename = NULL;
  1838. int __pyx_clineno = 0;
  1839. PyObject *__pyx_r = 0;
  1840. __Pyx_RefNannyDeclarations
  1841. __Pyx_RefNannySetupContext("get_bin_write_file (wrapper)", 0);
  1842. {
  1843. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filepath,&__pyx_n_s_suppress_output,&__pyx_n_s_overwrite_existing,0};
  1844. PyObject* values[4] = {0,0,0,0};
  1845. values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_));
  1846. values[2] = ((PyObject *)((PyObject *)Py_False));
  1847. values[3] = ((PyObject *)((PyObject *)Py_False));
  1848. if (unlikely(__pyx_kwds)) {
  1849. Py_ssize_t kw_args;
  1850. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1851. switch (pos_args) {
  1852. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  1853. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1854. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1855. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1856. case 0: break;
  1857. default: goto __pyx_L5_argtuple_error;
  1858. }
  1859. kw_args = PyDict_Size(__pyx_kwds);
  1860. switch (pos_args) {
  1861. case 0:
  1862. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  1863. else goto __pyx_L5_argtuple_error;
  1864. case 1:
  1865. if (kw_args > 0) {
  1866. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filepath);
  1867. if (value) { values[1] = value; kw_args--; }
  1868. }
  1869. case 2:
  1870. if (kw_args > 0) {
  1871. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_suppress_output);
  1872. if (value) { values[2] = value; kw_args--; }
  1873. }
  1874. case 3:
  1875. if (kw_args > 0) {
  1876. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overwrite_existing);
  1877. if (value) { values[3] = value; kw_args--; }
  1878. }
  1879. }
  1880. if (unlikely(kw_args > 0)) {
  1881. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_bin_write_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1882. }
  1883. } else {
  1884. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1885. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  1886. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1887. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1888. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1889. break;
  1890. default: goto __pyx_L5_argtuple_error;
  1891. }
  1892. }
  1893. __pyx_v_self = values[0];
  1894. __pyx_v_filepath = values[1];
  1895. __pyx_v_suppress_output = values[2];
  1896. __pyx_v_overwrite_existing = values[3];
  1897. }
  1898. goto __pyx_L4_argument_unpacking_done;
  1899. __pyx_L5_argtuple_error:;
  1900. __Pyx_RaiseArgtupleInvalid("get_bin_write_file", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1901. __pyx_L3_error:;
  1902. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1903. __Pyx_RefNannyFinishContext();
  1904. return NULL;
  1905. __pyx_L4_argument_unpacking_done:;
  1906. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_6get_bin_write_file(__pyx_self, __pyx_v_self, __pyx_v_filepath, __pyx_v_suppress_output, __pyx_v_overwrite_existing);
  1907. /* function exit code */
  1908. __Pyx_RefNannyFinishContext();
  1909. return __pyx_r;
  1910. }
  1911. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_6get_bin_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing) {
  1912. PyObject *__pyx_v_os = NULL;
  1913. PyObject *__pyx_v_file_exists = NULL;
  1914. PyObject *__pyx_v_response = NULL;
  1915. PyObject *__pyx_v_f = NULL;
  1916. PyObject *__pyx_v_chunk = NULL;
  1917. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  1918. PyObject *__pyx_v_e = NULL;
  1919. PyObject *__pyx_r = NULL;
  1920. __Pyx_RefNannyDeclarations
  1921. PyObject *__pyx_t_1 = NULL;
  1922. PyObject *__pyx_t_2 = NULL;
  1923. PyObject *__pyx_t_3 = NULL;
  1924. PyObject *__pyx_t_4 = NULL;
  1925. int __pyx_t_5;
  1926. int __pyx_t_6;
  1927. PyObject *__pyx_t_7 = NULL;
  1928. Py_ssize_t __pyx_t_8;
  1929. int __pyx_t_9;
  1930. PyObject *__pyx_t_10 = NULL;
  1931. PyObject *__pyx_t_11 = NULL;
  1932. PyObject *__pyx_t_12 = NULL;
  1933. PyObject *__pyx_t_13 = NULL;
  1934. PyObject *__pyx_t_14 = NULL;
  1935. PyObject *__pyx_t_15 = NULL;
  1936. PyObject *(*__pyx_t_16)(PyObject *);
  1937. PyObject *__pyx_t_17 = NULL;
  1938. int __pyx_t_18;
  1939. PyObject *__pyx_t_19 = NULL;
  1940. PyObject *__pyx_t_20 = NULL;
  1941. int __pyx_lineno = 0;
  1942. const char *__pyx_filename = NULL;
  1943. int __pyx_clineno = 0;
  1944. __Pyx_RefNannySetupContext("get_bin_write_file", 0);
  1945. __Pyx_INCREF(__pyx_v_filepath);
  1946. /* "lib/Naked/toolshed/c/network.pyx":70
  1947. * #------------------------------------------------------------------------------
  1948. * def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  1949. * try: # <<<<<<<<<<<<<<
  1950. * import os # used for os.fsync() method in the write
  1951. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  1952. */
  1953. {
  1954. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  1955. __Pyx_XGOTREF(__pyx_t_1);
  1956. __Pyx_XGOTREF(__pyx_t_2);
  1957. __Pyx_XGOTREF(__pyx_t_3);
  1958. /*try:*/ {
  1959. /* "lib/Naked/toolshed/c/network.pyx":71
  1960. * def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  1961. * try:
  1962. * import os # used for os.fsync() method in the write # <<<<<<<<<<<<<<
  1963. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  1964. * if not overwrite_existing:
  1965. */
  1966. __pyx_t_4 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1967. __Pyx_GOTREF(__pyx_t_4);
  1968. __pyx_v_os = __pyx_t_4;
  1969. __pyx_t_4 = 0;
  1970. /* "lib/Naked/toolshed/c/network.pyx":73
  1971. * import os # used for os.fsync() method in the write
  1972. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  1973. * if not overwrite_existing: # <<<<<<<<<<<<<<
  1974. * from Naked.toolshed.system import file_exists
  1975. * if file_exists(filepath):
  1976. */
  1977. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_overwrite_existing); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1978. __pyx_t_6 = ((!__pyx_t_5) != 0);
  1979. if (__pyx_t_6) {
  1980. /* "lib/Naked/toolshed/c/network.pyx":74
  1981. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  1982. * if not overwrite_existing:
  1983. * from Naked.toolshed.system import file_exists # <<<<<<<<<<<<<<
  1984. * if file_exists(filepath):
  1985. * if not suppress_output:
  1986. */
  1987. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1988. __Pyx_GOTREF(__pyx_t_4);
  1989. __Pyx_INCREF(__pyx_n_s_file_exists);
  1990. PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_file_exists);
  1991. __Pyx_GIVEREF(__pyx_n_s_file_exists);
  1992. __pyx_t_7 = __Pyx_Import(__pyx_n_s_Naked_toolshed_system, __pyx_t_4, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1993. __Pyx_GOTREF(__pyx_t_7);
  1994. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1995. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_file_exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1996. __Pyx_GOTREF(__pyx_t_4);
  1997. __Pyx_INCREF(__pyx_t_4);
  1998. __pyx_v_file_exists = __pyx_t_4;
  1999. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2000. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2001. /* "lib/Naked/toolshed/c/network.pyx":75
  2002. * if not overwrite_existing:
  2003. * from Naked.toolshed.system import file_exists
  2004. * if file_exists(filepath): # <<<<<<<<<<<<<<
  2005. * if not suppress_output:
  2006. * print("Download aborted. A local file with the requested filename exists on the path.")
  2007. */
  2008. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2009. __Pyx_GOTREF(__pyx_t_7);
  2010. __Pyx_INCREF(__pyx_v_filepath);
  2011. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filepath);
  2012. __Pyx_GIVEREF(__pyx_v_filepath);
  2013. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_file_exists, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2014. __Pyx_GOTREF(__pyx_t_4);
  2015. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2016. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2017. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2018. if (__pyx_t_6) {
  2019. /* "lib/Naked/toolshed/c/network.pyx":76
  2020. * from Naked.toolshed.system import file_exists
  2021. * if file_exists(filepath):
  2022. * if not suppress_output: # <<<<<<<<<<<<<<
  2023. * print("Download aborted. A local file with the requested filename exists on the path.")
  2024. * return False
  2025. */
  2026. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2027. __pyx_t_5 = ((!__pyx_t_6) != 0);
  2028. if (__pyx_t_5) {
  2029. /* "lib/Naked/toolshed/c/network.pyx":77
  2030. * if file_exists(filepath):
  2031. * if not suppress_output:
  2032. * print("Download aborted. A local file with the requested filename exists on the path.") # <<<<<<<<<<<<<<
  2033. * return False
  2034. * if (filepath == "" and len(self.url) > 1):
  2035. */
  2036. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_aborted_A_local_file_wi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2037. goto __pyx_L13;
  2038. }
  2039. __pyx_L13:;
  2040. /* "lib/Naked/toolshed/c/network.pyx":78
  2041. * if not suppress_output:
  2042. * print("Download aborted. A local file with the requested filename exists on the path.")
  2043. * return False # <<<<<<<<<<<<<<
  2044. * if (filepath == "" and len(self.url) > 1):
  2045. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2046. */
  2047. __Pyx_XDECREF(__pyx_r);
  2048. __Pyx_INCREF(Py_False);
  2049. __pyx_r = Py_False;
  2050. goto __pyx_L7_try_return;
  2051. }
  2052. goto __pyx_L11;
  2053. }
  2054. __pyx_L11:;
  2055. /* "lib/Naked/toolshed/c/network.pyx":79
  2056. * print("Download aborted. A local file with the requested filename exists on the path.")
  2057. * return False
  2058. * if (filepath == "" and len(self.url) > 1): # <<<<<<<<<<<<<<
  2059. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2060. * if not suppress_output:
  2061. */
  2062. __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_filepath, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2063. if (__pyx_t_5) {
  2064. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2065. __Pyx_GOTREF(__pyx_t_4);
  2066. __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2067. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2068. __pyx_t_6 = (__pyx_t_8 > 1);
  2069. __pyx_t_9 = __pyx_t_6;
  2070. } else {
  2071. __pyx_t_9 = __pyx_t_5;
  2072. }
  2073. if (__pyx_t_9) {
  2074. /* "lib/Naked/toolshed/c/network.pyx":80
  2075. * return False
  2076. * if (filepath == "" and len(self.url) > 1):
  2077. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  2078. * if not suppress_output:
  2079. * sys.stdout.write("Downloading file from " + self.url + "...")
  2080. */
  2081. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2082. __Pyx_GOTREF(__pyx_t_4);
  2083. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2084. __Pyx_GOTREF(__pyx_t_7);
  2085. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2086. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2087. __Pyx_GOTREF(__pyx_t_4);
  2088. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2089. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
  2090. __Pyx_GOTREF(__pyx_t_7);
  2091. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2092. __Pyx_DECREF_SET(__pyx_v_filepath, __pyx_t_7);
  2093. __pyx_t_7 = 0;
  2094. goto __pyx_L14;
  2095. }
  2096. __pyx_L14:;
  2097. /* "lib/Naked/toolshed/c/network.pyx":81
  2098. * if (filepath == "" and len(self.url) > 1):
  2099. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2100. * if not suppress_output: # <<<<<<<<<<<<<<
  2101. * sys.stdout.write("Downloading file from " + self.url + "...")
  2102. * sys.stdout.flush()
  2103. */
  2104. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2105. __pyx_t_5 = ((!__pyx_t_9) != 0);
  2106. if (__pyx_t_5) {
  2107. /* "lib/Naked/toolshed/c/network.pyx":82
  2108. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2109. * if not suppress_output:
  2110. * sys.stdout.write("Downloading file from " + self.url + "...") # <<<<<<<<<<<<<<
  2111. * sys.stdout.flush()
  2112. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2113. */
  2114. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2115. __Pyx_GOTREF(__pyx_t_7);
  2116. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2117. __Pyx_GOTREF(__pyx_t_4);
  2118. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2119. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2120. __Pyx_GOTREF(__pyx_t_7);
  2121. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2122. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2123. __Pyx_GOTREF(__pyx_t_4);
  2124. __pyx_t_10 = PyNumber_Add(__pyx_kp_s_Downloading_file_from, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2125. __Pyx_GOTREF(__pyx_t_10);
  2126. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2127. __pyx_t_4 = PyNumber_Add(__pyx_t_10, __pyx_kp_s__4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2128. __Pyx_GOTREF(__pyx_t_4);
  2129. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2130. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2131. __Pyx_GOTREF(__pyx_t_10);
  2132. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  2133. __Pyx_GIVEREF(__pyx_t_4);
  2134. __pyx_t_4 = 0;
  2135. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2136. __Pyx_GOTREF(__pyx_t_4);
  2137. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2138. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2139. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2140. /* "lib/Naked/toolshed/c/network.pyx":83
  2141. * if not suppress_output:
  2142. * sys.stdout.write("Downloading file from " + self.url + "...")
  2143. * sys.stdout.flush() # <<<<<<<<<<<<<<
  2144. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2145. * self.res = response
  2146. */
  2147. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2148. __Pyx_GOTREF(__pyx_t_4);
  2149. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_stdout); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2150. __Pyx_GOTREF(__pyx_t_10);
  2151. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2152. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2153. __Pyx_GOTREF(__pyx_t_4);
  2154. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2155. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2156. __Pyx_GOTREF(__pyx_t_10);
  2157. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2158. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2159. goto __pyx_L15;
  2160. }
  2161. __pyx_L15:;
  2162. /* "lib/Naked/toolshed/c/network.pyx":84
  2163. * sys.stdout.write("Downloading file from " + self.url + "...")
  2164. * sys.stdout.flush()
  2165. * response = requests.get(self.url, timeout=self.request_timeout, stream=True) # <<<<<<<<<<<<<<
  2166. * self.res = response
  2167. * with open(filepath, 'wb') as f: # write as binary data
  2168. */
  2169. __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2170. __Pyx_GOTREF(__pyx_t_10);
  2171. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2172. __Pyx_GOTREF(__pyx_t_4);
  2173. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2174. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2175. __Pyx_GOTREF(__pyx_t_10);
  2176. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2177. __Pyx_GOTREF(__pyx_t_7);
  2178. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
  2179. __Pyx_GIVEREF(__pyx_t_10);
  2180. __pyx_t_10 = 0;
  2181. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2182. __Pyx_GOTREF(__pyx_t_10);
  2183. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2184. __Pyx_GOTREF(__pyx_t_11);
  2185. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_timeout, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2186. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2187. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_stream, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2188. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2189. __Pyx_GOTREF(__pyx_t_11);
  2190. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2191. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2192. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2193. __pyx_v_response = __pyx_t_11;
  2194. __pyx_t_11 = 0;
  2195. /* "lib/Naked/toolshed/c/network.pyx":85
  2196. * sys.stdout.flush()
  2197. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2198. * self.res = response # <<<<<<<<<<<<<<
  2199. * with open(filepath, 'wb') as f: # write as binary data
  2200. * for chunk in response.iter_content(chunk_size=2048):
  2201. */
  2202. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2203. /* "lib/Naked/toolshed/c/network.pyx":86
  2204. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2205. * self.res = response
  2206. * with open(filepath, 'wb') as f: # write as binary data # <<<<<<<<<<<<<<
  2207. * for chunk in response.iter_content(chunk_size=2048):
  2208. * f.write(chunk)
  2209. */
  2210. /*with:*/ {
  2211. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2212. __Pyx_GOTREF(__pyx_t_11);
  2213. __Pyx_INCREF(__pyx_v_filepath);
  2214. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_filepath);
  2215. __Pyx_GIVEREF(__pyx_v_filepath);
  2216. __Pyx_INCREF(__pyx_n_s_wb);
  2217. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_n_s_wb);
  2218. __Pyx_GIVEREF(__pyx_n_s_wb);
  2219. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2220. __Pyx_GOTREF(__pyx_t_10);
  2221. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2222. __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2223. __Pyx_GOTREF(__pyx_t_12);
  2224. __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_enter); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  2225. __Pyx_GOTREF(__pyx_t_11);
  2226. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  2227. __Pyx_GOTREF(__pyx_t_7);
  2228. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2229. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2230. /*try:*/ {
  2231. {
  2232. __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  2233. __Pyx_XGOTREF(__pyx_t_13);
  2234. __Pyx_XGOTREF(__pyx_t_14);
  2235. __Pyx_XGOTREF(__pyx_t_15);
  2236. /*try:*/ {
  2237. __Pyx_INCREF(__pyx_t_7);
  2238. __pyx_v_f = __pyx_t_7;
  2239. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2240. /* "lib/Naked/toolshed/c/network.pyx":87
  2241. * self.res = response
  2242. * with open(filepath, 'wb') as f: # write as binary data
  2243. * for chunk in response.iter_content(chunk_size=2048): # <<<<<<<<<<<<<<
  2244. * f.write(chunk)
  2245. * f.flush()
  2246. */
  2247. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_iter_content); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2248. __Pyx_GOTREF(__pyx_t_7);
  2249. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2250. __Pyx_GOTREF(__pyx_t_10);
  2251. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_chunk_size, __pyx_int_2048) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2252. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2253. __Pyx_GOTREF(__pyx_t_11);
  2254. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2255. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2256. if (PyList_CheckExact(__pyx_t_11) || PyTuple_CheckExact(__pyx_t_11)) {
  2257. __pyx_t_10 = __pyx_t_11; __Pyx_INCREF(__pyx_t_10); __pyx_t_8 = 0;
  2258. __pyx_t_16 = NULL;
  2259. } else {
  2260. __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2261. __Pyx_GOTREF(__pyx_t_10);
  2262. __pyx_t_16 = Py_TYPE(__pyx_t_10)->tp_iternext;
  2263. }
  2264. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2265. for (;;) {
  2266. if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_10)) {
  2267. if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
  2268. #if CYTHON_COMPILING_IN_CPYTHON
  2269. __pyx_t_11 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2270. #else
  2271. __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2272. #endif
  2273. } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_10)) {
  2274. if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
  2275. #if CYTHON_COMPILING_IN_CPYTHON
  2276. __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2277. #else
  2278. __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2279. #endif
  2280. } else {
  2281. __pyx_t_11 = __pyx_t_16(__pyx_t_10);
  2282. if (unlikely(!__pyx_t_11)) {
  2283. PyObject* exc_type = PyErr_Occurred();
  2284. if (exc_type) {
  2285. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  2286. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2287. }
  2288. break;
  2289. }
  2290. __Pyx_GOTREF(__pyx_t_11);
  2291. }
  2292. __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_11);
  2293. __pyx_t_11 = 0;
  2294. /* "lib/Naked/toolshed/c/network.pyx":88
  2295. * with open(filepath, 'wb') as f: # write as binary data
  2296. * for chunk in response.iter_content(chunk_size=2048):
  2297. * f.write(chunk) # <<<<<<<<<<<<<<
  2298. * f.flush()
  2299. * os.fsync(f.fileno()) # flush all internal buffers to disk
  2300. */
  2301. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2302. __Pyx_GOTREF(__pyx_t_11);
  2303. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2304. __Pyx_GOTREF(__pyx_t_7);
  2305. __Pyx_INCREF(__pyx_v_chunk);
  2306. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chunk);
  2307. __Pyx_GIVEREF(__pyx_v_chunk);
  2308. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2309. __Pyx_GOTREF(__pyx_t_4);
  2310. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2311. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2312. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2313. /* "lib/Naked/toolshed/c/network.pyx":89
  2314. * for chunk in response.iter_content(chunk_size=2048):
  2315. * f.write(chunk)
  2316. * f.flush() # <<<<<<<<<<<<<<
  2317. * os.fsync(f.fileno()) # flush all internal buffers to disk
  2318. * if not suppress_output:
  2319. */
  2320. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2321. __Pyx_GOTREF(__pyx_t_4);
  2322. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2323. __Pyx_GOTREF(__pyx_t_7);
  2324. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2325. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2326. /* "lib/Naked/toolshed/c/network.pyx":90
  2327. * f.write(chunk)
  2328. * f.flush()
  2329. * os.fsync(f.fileno()) # flush all internal buffers to disk # <<<<<<<<<<<<<<
  2330. * if not suppress_output:
  2331. * print(" ")
  2332. */
  2333. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_fsync); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2334. __Pyx_GOTREF(__pyx_t_7);
  2335. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_fileno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2336. __Pyx_GOTREF(__pyx_t_4);
  2337. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2338. __Pyx_GOTREF(__pyx_t_11);
  2339. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2340. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2341. __Pyx_GOTREF(__pyx_t_4);
  2342. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11);
  2343. __Pyx_GIVEREF(__pyx_t_11);
  2344. __pyx_t_11 = 0;
  2345. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  2346. __Pyx_GOTREF(__pyx_t_11);
  2347. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2348. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2349. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2350. }
  2351. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2352. }
  2353. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  2354. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  2355. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  2356. goto __pyx_L29_try_end;
  2357. __pyx_L22_error:;
  2358. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  2359. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  2360. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  2361. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  2362. /* "lib/Naked/toolshed/c/network.pyx":86
  2363. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2364. * self.res = response
  2365. * with open(filepath, 'wb') as f: # write as binary data # <<<<<<<<<<<<<<
  2366. * for chunk in response.iter_content(chunk_size=2048):
  2367. * f.write(chunk)
  2368. */
  2369. /*except:*/ {
  2370. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2371. if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  2372. __Pyx_GOTREF(__pyx_t_10);
  2373. __Pyx_GOTREF(__pyx_t_11);
  2374. __Pyx_GOTREF(__pyx_t_4);
  2375. __pyx_t_7 = PyTuple_Pack(3, __pyx_t_10, __pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  2376. __Pyx_GOTREF(__pyx_t_7);
  2377. __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL);
  2378. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  2379. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2380. if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  2381. __Pyx_GOTREF(__pyx_t_17);
  2382. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_17);
  2383. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  2384. if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  2385. __pyx_t_9 = ((!(__pyx_t_5 != 0)) != 0);
  2386. if (__pyx_t_9) {
  2387. __Pyx_GIVEREF(__pyx_t_10);
  2388. __Pyx_GIVEREF(__pyx_t_11);
  2389. __Pyx_XGIVEREF(__pyx_t_4);
  2390. __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_4);
  2391. __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_4 = 0;
  2392. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  2393. }
  2394. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2395. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2396. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2397. goto __pyx_L23_exception_handled;
  2398. }
  2399. __pyx_L24_except_error:;
  2400. __Pyx_XGIVEREF(__pyx_t_13);
  2401. __Pyx_XGIVEREF(__pyx_t_14);
  2402. __Pyx_XGIVEREF(__pyx_t_15);
  2403. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  2404. goto __pyx_L3_error;
  2405. __pyx_L23_exception_handled:;
  2406. __Pyx_XGIVEREF(__pyx_t_13);
  2407. __Pyx_XGIVEREF(__pyx_t_14);
  2408. __Pyx_XGIVEREF(__pyx_t_15);
  2409. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  2410. __pyx_L29_try_end:;
  2411. }
  2412. }
  2413. /*finally:*/ {
  2414. /*normal exit:*/{
  2415. if (__pyx_t_12) {
  2416. __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__5, NULL);
  2417. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  2418. if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2419. __Pyx_GOTREF(__pyx_t_15);
  2420. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  2421. }
  2422. goto __pyx_L21;
  2423. }
  2424. __pyx_L21:;
  2425. }
  2426. goto __pyx_L36;
  2427. __pyx_L16_error:;
  2428. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  2429. goto __pyx_L3_error;
  2430. __pyx_L36:;
  2431. }
  2432. /* "lib/Naked/toolshed/c/network.pyx":91
  2433. * f.flush()
  2434. * os.fsync(f.fileno()) # flush all internal buffers to disk
  2435. * if not suppress_output: # <<<<<<<<<<<<<<
  2436. * print(" ")
  2437. * print("Download complete.")
  2438. */
  2439. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2440. __pyx_t_5 = ((!__pyx_t_9) != 0);
  2441. if (__pyx_t_5) {
  2442. /* "lib/Naked/toolshed/c/network.pyx":92
  2443. * os.fsync(f.fileno()) # flush all internal buffers to disk
  2444. * if not suppress_output:
  2445. * print(" ") # <<<<<<<<<<<<<<
  2446. * print("Download complete.")
  2447. * return True # return True if successful write
  2448. */
  2449. if (__Pyx_PrintOne(0, __pyx_kp_s__6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2450. /* "lib/Naked/toolshed/c/network.pyx":93
  2451. * if not suppress_output:
  2452. * print(" ")
  2453. * print("Download complete.") # <<<<<<<<<<<<<<
  2454. * return True # return True if successful write
  2455. * except requests.exceptions.ConnectionError as ce:
  2456. */
  2457. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_complete) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2458. goto __pyx_L37;
  2459. }
  2460. __pyx_L37:;
  2461. /* "lib/Naked/toolshed/c/network.pyx":94
  2462. * print(" ")
  2463. * print("Download complete.")
  2464. * return True # return True if successful write # <<<<<<<<<<<<<<
  2465. * except requests.exceptions.ConnectionError as ce:
  2466. * return False
  2467. */
  2468. __Pyx_XDECREF(__pyx_r);
  2469. __Pyx_INCREF(Py_True);
  2470. __pyx_r = Py_True;
  2471. goto __pyx_L7_try_return;
  2472. }
  2473. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  2474. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  2475. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  2476. goto __pyx_L10_try_end;
  2477. __pyx_L3_error:;
  2478. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  2479. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  2480. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  2481. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  2482. /* "lib/Naked/toolshed/c/network.pyx":95
  2483. * print("Download complete.")
  2484. * return True # return True if successful write
  2485. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  2486. * return False
  2487. * except Exception as e:
  2488. */
  2489. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2490. __Pyx_GOTREF(__pyx_t_4);
  2491. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2492. __Pyx_GOTREF(__pyx_t_11);
  2493. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2494. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2495. __Pyx_GOTREF(__pyx_t_4);
  2496. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2497. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_t_4);
  2498. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2499. if (__pyx_t_18) {
  2500. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2501. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_11, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2502. __Pyx_GOTREF(__pyx_t_4);
  2503. __Pyx_GOTREF(__pyx_t_11);
  2504. __Pyx_GOTREF(__pyx_t_10);
  2505. __Pyx_INCREF(__pyx_t_11);
  2506. __pyx_v_ce = __pyx_t_11;
  2507. /* "lib/Naked/toolshed/c/network.pyx":96
  2508. * return True # return True if successful write
  2509. * except requests.exceptions.ConnectionError as ce:
  2510. * return False # <<<<<<<<<<<<<<
  2511. * except Exception as e:
  2512. * if DEBUG_FLAG:
  2513. */
  2514. __Pyx_XDECREF(__pyx_r);
  2515. __Pyx_INCREF(Py_False);
  2516. __pyx_r = Py_False;
  2517. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2518. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2519. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2520. goto __pyx_L6_except_return;
  2521. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2522. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2523. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2524. goto __pyx_L4_exception_handled;
  2525. }
  2526. /* "lib/Naked/toolshed/c/network.pyx":97
  2527. * except requests.exceptions.ConnectionError as ce:
  2528. * return False
  2529. * except Exception as e: # <<<<<<<<<<<<<<
  2530. * if DEBUG_FLAG:
  2531. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_bin_write_file() method (Naked.toolshed.network.py)")
  2532. */
  2533. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  2534. if (__pyx_t_18) {
  2535. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2536. if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2537. __Pyx_GOTREF(__pyx_t_10);
  2538. __Pyx_GOTREF(__pyx_t_11);
  2539. __Pyx_GOTREF(__pyx_t_4);
  2540. __Pyx_INCREF(__pyx_t_11);
  2541. __pyx_v_e = __pyx_t_11;
  2542. /* "lib/Naked/toolshed/c/network.pyx":98
  2543. * return False
  2544. * except Exception as e:
  2545. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  2546. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_bin_write_file() method (Naked.toolshed.network.py)")
  2547. * raise e
  2548. */
  2549. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2550. __Pyx_GOTREF(__pyx_t_7);
  2551. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2552. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2553. if (__pyx_t_5) {
  2554. /* "lib/Naked/toolshed/c/network.pyx":99
  2555. * except Exception as e:
  2556. * if DEBUG_FLAG:
  2557. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_bin_write_file() method (Naked.toolshed.network.py)") # <<<<<<<<<<<<<<
  2558. * raise e
  2559. *
  2560. */
  2561. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2562. __Pyx_GOTREF(__pyx_t_7);
  2563. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stderr); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2564. __Pyx_GOTREF(__pyx_t_19);
  2565. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2566. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2567. __Pyx_GOTREF(__pyx_t_7);
  2568. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  2569. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2570. __Pyx_GOTREF(__pyx_t_19);
  2571. __pyx_t_20 = PyNumber_Add(__pyx_kp_s_Naked_Framework_Error_Unable_to_2, __pyx_t_19); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2572. __Pyx_GOTREF(__pyx_t_20);
  2573. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  2574. __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_kp_s_using_the_get_bin_write_file_me); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2575. __Pyx_GOTREF(__pyx_t_19);
  2576. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  2577. __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2578. __Pyx_GOTREF(__pyx_t_20);
  2579. PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
  2580. __Pyx_GIVEREF(__pyx_t_19);
  2581. __pyx_t_19 = 0;
  2582. __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_20, NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2583. __Pyx_GOTREF(__pyx_t_19);
  2584. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2585. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  2586. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  2587. goto __pyx_L42;
  2588. }
  2589. __pyx_L42:;
  2590. /* "lib/Naked/toolshed/c/network.pyx":100
  2591. * if DEBUG_FLAG:
  2592. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_bin_write_file() method (Naked.toolshed.network.py)")
  2593. * raise e # <<<<<<<<<<<<<<
  2594. *
  2595. * #------------------------------------------------------------------------------
  2596. */
  2597. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  2598. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  2599. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2600. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  2601. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2602. goto __pyx_L4_exception_handled;
  2603. }
  2604. goto __pyx_L5_except_error;
  2605. __pyx_L5_except_error:;
  2606. __Pyx_XGIVEREF(__pyx_t_1);
  2607. __Pyx_XGIVEREF(__pyx_t_2);
  2608. __Pyx_XGIVEREF(__pyx_t_3);
  2609. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2610. goto __pyx_L1_error;
  2611. __pyx_L7_try_return:;
  2612. __Pyx_XGIVEREF(__pyx_t_1);
  2613. __Pyx_XGIVEREF(__pyx_t_2);
  2614. __Pyx_XGIVEREF(__pyx_t_3);
  2615. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2616. goto __pyx_L0;
  2617. __pyx_L6_except_return:;
  2618. __Pyx_XGIVEREF(__pyx_t_1);
  2619. __Pyx_XGIVEREF(__pyx_t_2);
  2620. __Pyx_XGIVEREF(__pyx_t_3);
  2621. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2622. goto __pyx_L0;
  2623. __pyx_L4_exception_handled:;
  2624. __Pyx_XGIVEREF(__pyx_t_1);
  2625. __Pyx_XGIVEREF(__pyx_t_2);
  2626. __Pyx_XGIVEREF(__pyx_t_3);
  2627. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  2628. __pyx_L10_try_end:;
  2629. }
  2630. /* "lib/Naked/toolshed/c/network.pyx":69
  2631. * # Tests: test_NETWORK.py :: test_http_get_binary
  2632. * #------------------------------------------------------------------------------
  2633. * def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  2634. * try:
  2635. * import os # used for os.fsync() method in the write
  2636. */
  2637. /* function exit code */
  2638. __pyx_L1_error:;
  2639. __Pyx_XDECREF(__pyx_t_4);
  2640. __Pyx_XDECREF(__pyx_t_7);
  2641. __Pyx_XDECREF(__pyx_t_10);
  2642. __Pyx_XDECREF(__pyx_t_11);
  2643. __Pyx_XDECREF(__pyx_t_19);
  2644. __Pyx_XDECREF(__pyx_t_20);
  2645. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2646. __pyx_r = NULL;
  2647. __pyx_L0:;
  2648. __Pyx_XDECREF(__pyx_v_os);
  2649. __Pyx_XDECREF(__pyx_v_file_exists);
  2650. __Pyx_XDECREF(__pyx_v_response);
  2651. __Pyx_XDECREF(__pyx_v_f);
  2652. __Pyx_XDECREF(__pyx_v_chunk);
  2653. __Pyx_XDECREF(__pyx_v_ce);
  2654. __Pyx_XDECREF(__pyx_v_e);
  2655. __Pyx_XDECREF(__pyx_v_filepath);
  2656. __Pyx_XGIVEREF(__pyx_r);
  2657. __Pyx_RefNannyFinishContext();
  2658. return __pyx_r;
  2659. }
  2660. /* "lib/Naked/toolshed/c/network.pyx":109
  2661. * # Tests: test_NETWORK.py :: test_http_get_text
  2662. * #------------------------------------------------------------------------------
  2663. * def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  2664. * try:
  2665. * import os # used for os.fsync() method in the write
  2666. */
  2667. /* Python wrapper */
  2668. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_9get_txt_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2669. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_9get_txt_write_file = {__Pyx_NAMESTR("get_txt_write_file"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_9get_txt_write_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  2670. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_9get_txt_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2671. PyObject *__pyx_v_self = 0;
  2672. PyObject *__pyx_v_filepath = 0;
  2673. PyObject *__pyx_v_suppress_output = 0;
  2674. PyObject *__pyx_v_overwrite_existing = 0;
  2675. int __pyx_lineno = 0;
  2676. const char *__pyx_filename = NULL;
  2677. int __pyx_clineno = 0;
  2678. PyObject *__pyx_r = 0;
  2679. __Pyx_RefNannyDeclarations
  2680. __Pyx_RefNannySetupContext("get_txt_write_file (wrapper)", 0);
  2681. {
  2682. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filepath,&__pyx_n_s_suppress_output,&__pyx_n_s_overwrite_existing,0};
  2683. PyObject* values[4] = {0,0,0,0};
  2684. values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_));
  2685. values[2] = ((PyObject *)((PyObject *)Py_False));
  2686. values[3] = ((PyObject *)((PyObject *)Py_False));
  2687. if (unlikely(__pyx_kwds)) {
  2688. Py_ssize_t kw_args;
  2689. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2690. switch (pos_args) {
  2691. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2692. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2693. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2694. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2695. case 0: break;
  2696. default: goto __pyx_L5_argtuple_error;
  2697. }
  2698. kw_args = PyDict_Size(__pyx_kwds);
  2699. switch (pos_args) {
  2700. case 0:
  2701. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  2702. else goto __pyx_L5_argtuple_error;
  2703. case 1:
  2704. if (kw_args > 0) {
  2705. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filepath);
  2706. if (value) { values[1] = value; kw_args--; }
  2707. }
  2708. case 2:
  2709. if (kw_args > 0) {
  2710. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_suppress_output);
  2711. if (value) { values[2] = value; kw_args--; }
  2712. }
  2713. case 3:
  2714. if (kw_args > 0) {
  2715. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overwrite_existing);
  2716. if (value) { values[3] = value; kw_args--; }
  2717. }
  2718. }
  2719. if (unlikely(kw_args > 0)) {
  2720. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_txt_write_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2721. }
  2722. } else {
  2723. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2724. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2725. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2726. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2727. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2728. break;
  2729. default: goto __pyx_L5_argtuple_error;
  2730. }
  2731. }
  2732. __pyx_v_self = values[0];
  2733. __pyx_v_filepath = values[1];
  2734. __pyx_v_suppress_output = values[2];
  2735. __pyx_v_overwrite_existing = values[3];
  2736. }
  2737. goto __pyx_L4_argument_unpacking_done;
  2738. __pyx_L5_argtuple_error:;
  2739. __Pyx_RaiseArgtupleInvalid("get_txt_write_file", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2740. __pyx_L3_error:;
  2741. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2742. __Pyx_RefNannyFinishContext();
  2743. return NULL;
  2744. __pyx_L4_argument_unpacking_done:;
  2745. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_8get_txt_write_file(__pyx_self, __pyx_v_self, __pyx_v_filepath, __pyx_v_suppress_output, __pyx_v_overwrite_existing);
  2746. /* function exit code */
  2747. __Pyx_RefNannyFinishContext();
  2748. return __pyx_r;
  2749. }
  2750. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_8get_txt_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing) {
  2751. PyObject *__pyx_v_os = NULL;
  2752. PyObject *__pyx_v_file_exists = NULL;
  2753. PyObject *__pyx_v_response = NULL;
  2754. PyObject *__pyx_v_codecs = NULL;
  2755. PyObject *__pyx_v_f = NULL;
  2756. PyObject *__pyx_v_chunk = NULL;
  2757. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  2758. PyObject *__pyx_v_e = NULL;
  2759. PyObject *__pyx_r = NULL;
  2760. __Pyx_RefNannyDeclarations
  2761. PyObject *__pyx_t_1 = NULL;
  2762. PyObject *__pyx_t_2 = NULL;
  2763. PyObject *__pyx_t_3 = NULL;
  2764. PyObject *__pyx_t_4 = NULL;
  2765. int __pyx_t_5;
  2766. int __pyx_t_6;
  2767. PyObject *__pyx_t_7 = NULL;
  2768. Py_ssize_t __pyx_t_8;
  2769. int __pyx_t_9;
  2770. PyObject *__pyx_t_10 = NULL;
  2771. PyObject *__pyx_t_11 = NULL;
  2772. PyObject *__pyx_t_12 = NULL;
  2773. PyObject *__pyx_t_13 = NULL;
  2774. PyObject *__pyx_t_14 = NULL;
  2775. PyObject *__pyx_t_15 = NULL;
  2776. PyObject *(*__pyx_t_16)(PyObject *);
  2777. PyObject *__pyx_t_17 = NULL;
  2778. int __pyx_t_18;
  2779. PyObject *__pyx_t_19 = NULL;
  2780. PyObject *__pyx_t_20 = NULL;
  2781. int __pyx_lineno = 0;
  2782. const char *__pyx_filename = NULL;
  2783. int __pyx_clineno = 0;
  2784. __Pyx_RefNannySetupContext("get_txt_write_file", 0);
  2785. __Pyx_INCREF(__pyx_v_filepath);
  2786. /* "lib/Naked/toolshed/c/network.pyx":110
  2787. * #------------------------------------------------------------------------------
  2788. * def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  2789. * try: # <<<<<<<<<<<<<<
  2790. * import os # used for os.fsync() method in the write
  2791. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  2792. */
  2793. {
  2794. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  2795. __Pyx_XGOTREF(__pyx_t_1);
  2796. __Pyx_XGOTREF(__pyx_t_2);
  2797. __Pyx_XGOTREF(__pyx_t_3);
  2798. /*try:*/ {
  2799. /* "lib/Naked/toolshed/c/network.pyx":111
  2800. * def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  2801. * try:
  2802. * import os # used for os.fsync() method in the write # <<<<<<<<<<<<<<
  2803. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  2804. * if not overwrite_existing:
  2805. */
  2806. __pyx_t_4 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2807. __Pyx_GOTREF(__pyx_t_4);
  2808. __pyx_v_os = __pyx_t_4;
  2809. __pyx_t_4 = 0;
  2810. /* "lib/Naked/toolshed/c/network.pyx":113
  2811. * import os # used for os.fsync() method in the write
  2812. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  2813. * if not overwrite_existing: # <<<<<<<<<<<<<<
  2814. * from Naked.toolshed.system import file_exists
  2815. * if file_exists(filepath):
  2816. */
  2817. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_overwrite_existing); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2818. __pyx_t_6 = ((!__pyx_t_5) != 0);
  2819. if (__pyx_t_6) {
  2820. /* "lib/Naked/toolshed/c/network.pyx":114
  2821. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  2822. * if not overwrite_existing:
  2823. * from Naked.toolshed.system import file_exists # <<<<<<<<<<<<<<
  2824. * if file_exists(filepath):
  2825. * if not suppress_output:
  2826. */
  2827. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2828. __Pyx_GOTREF(__pyx_t_4);
  2829. __Pyx_INCREF(__pyx_n_s_file_exists);
  2830. PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_file_exists);
  2831. __Pyx_GIVEREF(__pyx_n_s_file_exists);
  2832. __pyx_t_7 = __Pyx_Import(__pyx_n_s_Naked_toolshed_system, __pyx_t_4, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2833. __Pyx_GOTREF(__pyx_t_7);
  2834. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2835. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_file_exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2836. __Pyx_GOTREF(__pyx_t_4);
  2837. __Pyx_INCREF(__pyx_t_4);
  2838. __pyx_v_file_exists = __pyx_t_4;
  2839. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2840. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2841. /* "lib/Naked/toolshed/c/network.pyx":115
  2842. * if not overwrite_existing:
  2843. * from Naked.toolshed.system import file_exists
  2844. * if file_exists(filepath): # <<<<<<<<<<<<<<
  2845. * if not suppress_output:
  2846. * print("Download aborted. A local file with the requested filename exists on the path.")
  2847. */
  2848. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2849. __Pyx_GOTREF(__pyx_t_7);
  2850. __Pyx_INCREF(__pyx_v_filepath);
  2851. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filepath);
  2852. __Pyx_GIVEREF(__pyx_v_filepath);
  2853. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_file_exists, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2854. __Pyx_GOTREF(__pyx_t_4);
  2855. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2856. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2857. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2858. if (__pyx_t_6) {
  2859. /* "lib/Naked/toolshed/c/network.pyx":116
  2860. * from Naked.toolshed.system import file_exists
  2861. * if file_exists(filepath):
  2862. * if not suppress_output: # <<<<<<<<<<<<<<
  2863. * print("Download aborted. A local file with the requested filename exists on the path.")
  2864. * return False
  2865. */
  2866. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2867. __pyx_t_5 = ((!__pyx_t_6) != 0);
  2868. if (__pyx_t_5) {
  2869. /* "lib/Naked/toolshed/c/network.pyx":117
  2870. * if file_exists(filepath):
  2871. * if not suppress_output:
  2872. * print("Download aborted. A local file with the requested filename exists on the path.") # <<<<<<<<<<<<<<
  2873. * return False
  2874. * if (filepath == "" and len(self.url) > 1):
  2875. */
  2876. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_aborted_A_local_file_wi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2877. goto __pyx_L13;
  2878. }
  2879. __pyx_L13:;
  2880. /* "lib/Naked/toolshed/c/network.pyx":118
  2881. * if not suppress_output:
  2882. * print("Download aborted. A local file with the requested filename exists on the path.")
  2883. * return False # <<<<<<<<<<<<<<
  2884. * if (filepath == "" and len(self.url) > 1):
  2885. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2886. */
  2887. __Pyx_XDECREF(__pyx_r);
  2888. __Pyx_INCREF(Py_False);
  2889. __pyx_r = Py_False;
  2890. goto __pyx_L7_try_return;
  2891. }
  2892. goto __pyx_L11;
  2893. }
  2894. __pyx_L11:;
  2895. /* "lib/Naked/toolshed/c/network.pyx":119
  2896. * print("Download aborted. A local file with the requested filename exists on the path.")
  2897. * return False
  2898. * if (filepath == "" and len(self.url) > 1): # <<<<<<<<<<<<<<
  2899. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2900. * if not suppress_output:
  2901. */
  2902. __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_filepath, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2903. if (__pyx_t_5) {
  2904. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2905. __Pyx_GOTREF(__pyx_t_4);
  2906. __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2907. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2908. __pyx_t_6 = (__pyx_t_8 > 1);
  2909. __pyx_t_9 = __pyx_t_6;
  2910. } else {
  2911. __pyx_t_9 = __pyx_t_5;
  2912. }
  2913. if (__pyx_t_9) {
  2914. /* "lib/Naked/toolshed/c/network.pyx":120
  2915. * return False
  2916. * if (filepath == "" and len(self.url) > 1):
  2917. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  2918. * if not suppress_output:
  2919. * sys.stdout.write("Downloading file from " + self.url + "...")
  2920. */
  2921. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2922. __Pyx_GOTREF(__pyx_t_4);
  2923. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2924. __Pyx_GOTREF(__pyx_t_7);
  2925. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2926. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2927. __Pyx_GOTREF(__pyx_t_4);
  2928. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2929. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
  2930. __Pyx_GOTREF(__pyx_t_7);
  2931. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2932. __Pyx_DECREF_SET(__pyx_v_filepath, __pyx_t_7);
  2933. __pyx_t_7 = 0;
  2934. goto __pyx_L14;
  2935. }
  2936. __pyx_L14:;
  2937. /* "lib/Naked/toolshed/c/network.pyx":121
  2938. * if (filepath == "" and len(self.url) > 1):
  2939. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2940. * if not suppress_output: # <<<<<<<<<<<<<<
  2941. * sys.stdout.write("Downloading file from " + self.url + "...")
  2942. * sys.stdout.flush()
  2943. */
  2944. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2945. __pyx_t_5 = ((!__pyx_t_9) != 0);
  2946. if (__pyx_t_5) {
  2947. /* "lib/Naked/toolshed/c/network.pyx":122
  2948. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  2949. * if not suppress_output:
  2950. * sys.stdout.write("Downloading file from " + self.url + "...") # <<<<<<<<<<<<<<
  2951. * sys.stdout.flush()
  2952. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2953. */
  2954. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2955. __Pyx_GOTREF(__pyx_t_7);
  2956. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2957. __Pyx_GOTREF(__pyx_t_4);
  2958. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2959. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2960. __Pyx_GOTREF(__pyx_t_7);
  2961. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2962. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2963. __Pyx_GOTREF(__pyx_t_4);
  2964. __pyx_t_10 = PyNumber_Add(__pyx_kp_s_Downloading_file_from, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2965. __Pyx_GOTREF(__pyx_t_10);
  2966. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2967. __pyx_t_4 = PyNumber_Add(__pyx_t_10, __pyx_kp_s__4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2968. __Pyx_GOTREF(__pyx_t_4);
  2969. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2970. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2971. __Pyx_GOTREF(__pyx_t_10);
  2972. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  2973. __Pyx_GIVEREF(__pyx_t_4);
  2974. __pyx_t_4 = 0;
  2975. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2976. __Pyx_GOTREF(__pyx_t_4);
  2977. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2978. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2979. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2980. /* "lib/Naked/toolshed/c/network.pyx":123
  2981. * if not suppress_output:
  2982. * sys.stdout.write("Downloading file from " + self.url + "...")
  2983. * sys.stdout.flush() # <<<<<<<<<<<<<<
  2984. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  2985. * self.res = response
  2986. */
  2987. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2988. __Pyx_GOTREF(__pyx_t_4);
  2989. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_stdout); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2990. __Pyx_GOTREF(__pyx_t_10);
  2991. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2992. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2993. __Pyx_GOTREF(__pyx_t_4);
  2994. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2995. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2996. __Pyx_GOTREF(__pyx_t_10);
  2997. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2998. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  2999. goto __pyx_L15;
  3000. }
  3001. __pyx_L15:;
  3002. /* "lib/Naked/toolshed/c/network.pyx":124
  3003. * sys.stdout.write("Downloading file from " + self.url + "...")
  3004. * sys.stdout.flush()
  3005. * response = requests.get(self.url, timeout=self.request_timeout, stream=True) # <<<<<<<<<<<<<<
  3006. * self.res = response
  3007. * import codecs
  3008. */
  3009. __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3010. __Pyx_GOTREF(__pyx_t_10);
  3011. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3012. __Pyx_GOTREF(__pyx_t_4);
  3013. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3014. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3015. __Pyx_GOTREF(__pyx_t_10);
  3016. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3017. __Pyx_GOTREF(__pyx_t_7);
  3018. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
  3019. __Pyx_GIVEREF(__pyx_t_10);
  3020. __pyx_t_10 = 0;
  3021. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3022. __Pyx_GOTREF(__pyx_t_10);
  3023. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3024. __Pyx_GOTREF(__pyx_t_11);
  3025. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_timeout, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3026. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3027. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_stream, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3028. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3029. __Pyx_GOTREF(__pyx_t_11);
  3030. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3031. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3032. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3033. __pyx_v_response = __pyx_t_11;
  3034. __pyx_t_11 = 0;
  3035. /* "lib/Naked/toolshed/c/network.pyx":125
  3036. * sys.stdout.flush()
  3037. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  3038. * self.res = response # <<<<<<<<<<<<<<
  3039. * import codecs
  3040. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text
  3041. */
  3042. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3043. /* "lib/Naked/toolshed/c/network.pyx":126
  3044. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  3045. * self.res = response
  3046. * import codecs # <<<<<<<<<<<<<<
  3047. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text
  3048. * for chunk in response.iter_content(chunk_size=2048):
  3049. */
  3050. __pyx_t_11 = __Pyx_Import(__pyx_n_s_codecs, 0, -1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3051. __Pyx_GOTREF(__pyx_t_11);
  3052. __pyx_v_codecs = __pyx_t_11;
  3053. __pyx_t_11 = 0;
  3054. /* "lib/Naked/toolshed/c/network.pyx":127
  3055. * self.res = response
  3056. * import codecs
  3057. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text # <<<<<<<<<<<<<<
  3058. * for chunk in response.iter_content(chunk_size=2048):
  3059. * chunk = chunk.decode('utf-8')
  3060. */
  3061. /*with:*/ {
  3062. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_codecs, __pyx_n_s_open); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3063. __Pyx_GOTREF(__pyx_t_11);
  3064. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3065. __Pyx_GOTREF(__pyx_t_10);
  3066. __Pyx_INCREF(__pyx_v_filepath);
  3067. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_filepath);
  3068. __Pyx_GIVEREF(__pyx_v_filepath);
  3069. __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3070. __Pyx_GOTREF(__pyx_t_7);
  3071. if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_mode, __pyx_n_s_w) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3072. if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_encoding, __pyx_kp_s_utf_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3073. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3074. __Pyx_GOTREF(__pyx_t_4);
  3075. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3076. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3077. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3078. __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3079. __Pyx_GOTREF(__pyx_t_12);
  3080. __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  3081. __Pyx_GOTREF(__pyx_t_7);
  3082. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  3083. __Pyx_GOTREF(__pyx_t_10);
  3084. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3085. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3086. /*try:*/ {
  3087. {
  3088. __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  3089. __Pyx_XGOTREF(__pyx_t_13);
  3090. __Pyx_XGOTREF(__pyx_t_14);
  3091. __Pyx_XGOTREF(__pyx_t_15);
  3092. /*try:*/ {
  3093. __Pyx_INCREF(__pyx_t_10);
  3094. __pyx_v_f = __pyx_t_10;
  3095. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3096. /* "lib/Naked/toolshed/c/network.pyx":128
  3097. * import codecs
  3098. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text
  3099. * for chunk in response.iter_content(chunk_size=2048): # <<<<<<<<<<<<<<
  3100. * chunk = chunk.decode('utf-8')
  3101. * f.write(chunk)
  3102. */
  3103. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_iter_content); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3104. __Pyx_GOTREF(__pyx_t_10);
  3105. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3106. __Pyx_GOTREF(__pyx_t_4);
  3107. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_chunk_size, __pyx_int_2048) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3108. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3109. __Pyx_GOTREF(__pyx_t_7);
  3110. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3111. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3112. if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
  3113. __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
  3114. __pyx_t_16 = NULL;
  3115. } else {
  3116. __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3117. __Pyx_GOTREF(__pyx_t_4);
  3118. __pyx_t_16 = Py_TYPE(__pyx_t_4)->tp_iternext;
  3119. }
  3120. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3121. for (;;) {
  3122. if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_4)) {
  3123. if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
  3124. #if CYTHON_COMPILING_IN_CPYTHON
  3125. __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3126. #else
  3127. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3128. #endif
  3129. } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_4)) {
  3130. if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
  3131. #if CYTHON_COMPILING_IN_CPYTHON
  3132. __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3133. #else
  3134. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3135. #endif
  3136. } else {
  3137. __pyx_t_7 = __pyx_t_16(__pyx_t_4);
  3138. if (unlikely(!__pyx_t_7)) {
  3139. PyObject* exc_type = PyErr_Occurred();
  3140. if (exc_type) {
  3141. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  3142. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3143. }
  3144. break;
  3145. }
  3146. __Pyx_GOTREF(__pyx_t_7);
  3147. }
  3148. __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_7);
  3149. __pyx_t_7 = 0;
  3150. /* "lib/Naked/toolshed/c/network.pyx":129
  3151. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text
  3152. * for chunk in response.iter_content(chunk_size=2048):
  3153. * chunk = chunk.decode('utf-8') # <<<<<<<<<<<<<<
  3154. * f.write(chunk)
  3155. * f.flush()
  3156. */
  3157. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_decode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3158. __Pyx_GOTREF(__pyx_t_7);
  3159. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3160. __Pyx_GOTREF(__pyx_t_10);
  3161. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3162. __Pyx_DECREF_SET(__pyx_v_chunk, __pyx_t_10);
  3163. __pyx_t_10 = 0;
  3164. /* "lib/Naked/toolshed/c/network.pyx":130
  3165. * for chunk in response.iter_content(chunk_size=2048):
  3166. * chunk = chunk.decode('utf-8')
  3167. * f.write(chunk) # <<<<<<<<<<<<<<
  3168. * f.flush()
  3169. * os.fsync(f.fileno()) # flush all internal buffers to disk
  3170. */
  3171. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3172. __Pyx_GOTREF(__pyx_t_10);
  3173. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3174. __Pyx_GOTREF(__pyx_t_7);
  3175. __Pyx_INCREF(__pyx_v_chunk);
  3176. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chunk);
  3177. __Pyx_GIVEREF(__pyx_v_chunk);
  3178. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3179. __Pyx_GOTREF(__pyx_t_11);
  3180. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3181. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3182. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3183. /* "lib/Naked/toolshed/c/network.pyx":131
  3184. * chunk = chunk.decode('utf-8')
  3185. * f.write(chunk)
  3186. * f.flush() # <<<<<<<<<<<<<<
  3187. * os.fsync(f.fileno()) # flush all internal buffers to disk
  3188. * if not suppress_output:
  3189. */
  3190. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_flush); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3191. __Pyx_GOTREF(__pyx_t_11);
  3192. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3193. __Pyx_GOTREF(__pyx_t_7);
  3194. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3195. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3196. /* "lib/Naked/toolshed/c/network.pyx":132
  3197. * f.write(chunk)
  3198. * f.flush()
  3199. * os.fsync(f.fileno()) # flush all internal buffers to disk # <<<<<<<<<<<<<<
  3200. * if not suppress_output:
  3201. * print(" ")
  3202. */
  3203. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_fsync); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3204. __Pyx_GOTREF(__pyx_t_7);
  3205. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_fileno); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3206. __Pyx_GOTREF(__pyx_t_11);
  3207. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3208. __Pyx_GOTREF(__pyx_t_10);
  3209. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3210. __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3211. __Pyx_GOTREF(__pyx_t_11);
  3212. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
  3213. __Pyx_GIVEREF(__pyx_t_10);
  3214. __pyx_t_10 = 0;
  3215. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  3216. __Pyx_GOTREF(__pyx_t_10);
  3217. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3218. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3219. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3220. }
  3221. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3222. }
  3223. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  3224. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  3225. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  3226. goto __pyx_L29_try_end;
  3227. __pyx_L22_error:;
  3228. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  3229. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  3230. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  3231. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3232. /* "lib/Naked/toolshed/c/network.pyx":127
  3233. * self.res = response
  3234. * import codecs
  3235. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text # <<<<<<<<<<<<<<
  3236. * for chunk in response.iter_content(chunk_size=2048):
  3237. * chunk = chunk.decode('utf-8')
  3238. */
  3239. /*except:*/ {
  3240. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3241. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  3242. __Pyx_GOTREF(__pyx_t_4);
  3243. __Pyx_GOTREF(__pyx_t_10);
  3244. __Pyx_GOTREF(__pyx_t_11);
  3245. __pyx_t_7 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  3246. __Pyx_GOTREF(__pyx_t_7);
  3247. __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL);
  3248. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  3249. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3250. if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  3251. __Pyx_GOTREF(__pyx_t_17);
  3252. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_17);
  3253. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  3254. if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  3255. __pyx_t_9 = ((!(__pyx_t_5 != 0)) != 0);
  3256. if (__pyx_t_9) {
  3257. __Pyx_GIVEREF(__pyx_t_4);
  3258. __Pyx_GIVEREF(__pyx_t_10);
  3259. __Pyx_XGIVEREF(__pyx_t_11);
  3260. __Pyx_ErrRestore(__pyx_t_4, __pyx_t_10, __pyx_t_11);
  3261. __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  3262. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  3263. }
  3264. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3265. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3266. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3267. goto __pyx_L23_exception_handled;
  3268. }
  3269. __pyx_L24_except_error:;
  3270. __Pyx_XGIVEREF(__pyx_t_13);
  3271. __Pyx_XGIVEREF(__pyx_t_14);
  3272. __Pyx_XGIVEREF(__pyx_t_15);
  3273. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  3274. goto __pyx_L3_error;
  3275. __pyx_L23_exception_handled:;
  3276. __Pyx_XGIVEREF(__pyx_t_13);
  3277. __Pyx_XGIVEREF(__pyx_t_14);
  3278. __Pyx_XGIVEREF(__pyx_t_15);
  3279. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  3280. __pyx_L29_try_end:;
  3281. }
  3282. }
  3283. /*finally:*/ {
  3284. /*normal exit:*/{
  3285. if (__pyx_t_12) {
  3286. __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__9, NULL);
  3287. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  3288. if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3289. __Pyx_GOTREF(__pyx_t_15);
  3290. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  3291. }
  3292. goto __pyx_L21;
  3293. }
  3294. __pyx_L21:;
  3295. }
  3296. goto __pyx_L36;
  3297. __pyx_L16_error:;
  3298. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  3299. goto __pyx_L3_error;
  3300. __pyx_L36:;
  3301. }
  3302. /* "lib/Naked/toolshed/c/network.pyx":133
  3303. * f.flush()
  3304. * os.fsync(f.fileno()) # flush all internal buffers to disk
  3305. * if not suppress_output: # <<<<<<<<<<<<<<
  3306. * print(" ")
  3307. * print("Download complete.")
  3308. */
  3309. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3310. __pyx_t_5 = ((!__pyx_t_9) != 0);
  3311. if (__pyx_t_5) {
  3312. /* "lib/Naked/toolshed/c/network.pyx":134
  3313. * os.fsync(f.fileno()) # flush all internal buffers to disk
  3314. * if not suppress_output:
  3315. * print(" ") # <<<<<<<<<<<<<<
  3316. * print("Download complete.")
  3317. * return True # return True if successful write
  3318. */
  3319. if (__Pyx_PrintOne(0, __pyx_kp_s__6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3320. /* "lib/Naked/toolshed/c/network.pyx":135
  3321. * if not suppress_output:
  3322. * print(" ")
  3323. * print("Download complete.") # <<<<<<<<<<<<<<
  3324. * return True # return True if successful write
  3325. * except requests.exceptions.ConnectionError as ce:
  3326. */
  3327. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_complete) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3328. goto __pyx_L37;
  3329. }
  3330. __pyx_L37:;
  3331. /* "lib/Naked/toolshed/c/network.pyx":136
  3332. * print(" ")
  3333. * print("Download complete.")
  3334. * return True # return True if successful write # <<<<<<<<<<<<<<
  3335. * except requests.exceptions.ConnectionError as ce:
  3336. * return False
  3337. */
  3338. __Pyx_XDECREF(__pyx_r);
  3339. __Pyx_INCREF(Py_True);
  3340. __pyx_r = Py_True;
  3341. goto __pyx_L7_try_return;
  3342. }
  3343. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  3344. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3345. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3346. goto __pyx_L10_try_end;
  3347. __pyx_L3_error:;
  3348. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  3349. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3350. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  3351. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  3352. /* "lib/Naked/toolshed/c/network.pyx":137
  3353. * print("Download complete.")
  3354. * return True # return True if successful write
  3355. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  3356. * return False
  3357. * except Exception as e:
  3358. */
  3359. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3360. __Pyx_GOTREF(__pyx_t_11);
  3361. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3362. __Pyx_GOTREF(__pyx_t_10);
  3363. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3364. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3365. __Pyx_GOTREF(__pyx_t_11);
  3366. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3367. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_t_11);
  3368. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3369. if (__pyx_t_18) {
  3370. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3371. if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3372. __Pyx_GOTREF(__pyx_t_11);
  3373. __Pyx_GOTREF(__pyx_t_10);
  3374. __Pyx_GOTREF(__pyx_t_4);
  3375. __Pyx_INCREF(__pyx_t_10);
  3376. __pyx_v_ce = __pyx_t_10;
  3377. /* "lib/Naked/toolshed/c/network.pyx":138
  3378. * return True # return True if successful write
  3379. * except requests.exceptions.ConnectionError as ce:
  3380. * return False # <<<<<<<<<<<<<<
  3381. * except Exception as e:
  3382. * if DEBUG_FLAG:
  3383. */
  3384. __Pyx_XDECREF(__pyx_r);
  3385. __Pyx_INCREF(Py_False);
  3386. __pyx_r = Py_False;
  3387. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3388. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3389. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3390. goto __pyx_L6_except_return;
  3391. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3392. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3393. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3394. goto __pyx_L4_exception_handled;
  3395. }
  3396. /* "lib/Naked/toolshed/c/network.pyx":139
  3397. * except requests.exceptions.ConnectionError as ce:
  3398. * return False
  3399. * except Exception as e: # <<<<<<<<<<<<<<
  3400. * if DEBUG_FLAG:
  3401. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_data_write_txt() method (Naked.toolshed.network.py)")
  3402. */
  3403. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  3404. if (__pyx_t_18) {
  3405. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3406. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3407. __Pyx_GOTREF(__pyx_t_4);
  3408. __Pyx_GOTREF(__pyx_t_10);
  3409. __Pyx_GOTREF(__pyx_t_11);
  3410. __Pyx_INCREF(__pyx_t_10);
  3411. __pyx_v_e = __pyx_t_10;
  3412. /* "lib/Naked/toolshed/c/network.pyx":140
  3413. * return False
  3414. * except Exception as e:
  3415. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  3416. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_data_write_txt() method (Naked.toolshed.network.py)")
  3417. * raise e
  3418. */
  3419. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3420. __Pyx_GOTREF(__pyx_t_7);
  3421. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3422. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3423. if (__pyx_t_5) {
  3424. /* "lib/Naked/toolshed/c/network.pyx":141
  3425. * except Exception as e:
  3426. * if DEBUG_FLAG:
  3427. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_data_write_txt() method (Naked.toolshed.network.py)") # <<<<<<<<<<<<<<
  3428. * raise e
  3429. *
  3430. */
  3431. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3432. __Pyx_GOTREF(__pyx_t_7);
  3433. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stderr); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3434. __Pyx_GOTREF(__pyx_t_19);
  3435. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3436. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3437. __Pyx_GOTREF(__pyx_t_7);
  3438. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  3439. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3440. __Pyx_GOTREF(__pyx_t_19);
  3441. __pyx_t_20 = PyNumber_Add(__pyx_kp_s_Naked_Framework_Error_Unable_to_2, __pyx_t_19); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3442. __Pyx_GOTREF(__pyx_t_20);
  3443. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  3444. __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_kp_s_using_the_get_data_write_txt_me); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3445. __Pyx_GOTREF(__pyx_t_19);
  3446. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  3447. __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3448. __Pyx_GOTREF(__pyx_t_20);
  3449. PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
  3450. __Pyx_GIVEREF(__pyx_t_19);
  3451. __pyx_t_19 = 0;
  3452. __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_20, NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3453. __Pyx_GOTREF(__pyx_t_19);
  3454. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3455. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  3456. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  3457. goto __pyx_L42;
  3458. }
  3459. __pyx_L42:;
  3460. /* "lib/Naked/toolshed/c/network.pyx":142
  3461. * if DEBUG_FLAG:
  3462. * sys.stderr.write("Naked Framework Error: Unable to perform GET request and write file with the URL " + self.url + " using the get_data_write_txt() method (Naked.toolshed.network.py)")
  3463. * raise e # <<<<<<<<<<<<<<
  3464. *
  3465. * #------------------------------------------------------------------------------
  3466. */
  3467. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  3468. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3469. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3470. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3471. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3472. goto __pyx_L4_exception_handled;
  3473. }
  3474. goto __pyx_L5_except_error;
  3475. __pyx_L5_except_error:;
  3476. __Pyx_XGIVEREF(__pyx_t_1);
  3477. __Pyx_XGIVEREF(__pyx_t_2);
  3478. __Pyx_XGIVEREF(__pyx_t_3);
  3479. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3480. goto __pyx_L1_error;
  3481. __pyx_L7_try_return:;
  3482. __Pyx_XGIVEREF(__pyx_t_1);
  3483. __Pyx_XGIVEREF(__pyx_t_2);
  3484. __Pyx_XGIVEREF(__pyx_t_3);
  3485. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3486. goto __pyx_L0;
  3487. __pyx_L6_except_return:;
  3488. __Pyx_XGIVEREF(__pyx_t_1);
  3489. __Pyx_XGIVEREF(__pyx_t_2);
  3490. __Pyx_XGIVEREF(__pyx_t_3);
  3491. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3492. goto __pyx_L0;
  3493. __pyx_L4_exception_handled:;
  3494. __Pyx_XGIVEREF(__pyx_t_1);
  3495. __Pyx_XGIVEREF(__pyx_t_2);
  3496. __Pyx_XGIVEREF(__pyx_t_3);
  3497. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3498. __pyx_L10_try_end:;
  3499. }
  3500. /* "lib/Naked/toolshed/c/network.pyx":109
  3501. * # Tests: test_NETWORK.py :: test_http_get_text
  3502. * #------------------------------------------------------------------------------
  3503. * def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  3504. * try:
  3505. * import os # used for os.fsync() method in the write
  3506. */
  3507. /* function exit code */
  3508. __pyx_L1_error:;
  3509. __Pyx_XDECREF(__pyx_t_4);
  3510. __Pyx_XDECREF(__pyx_t_7);
  3511. __Pyx_XDECREF(__pyx_t_10);
  3512. __Pyx_XDECREF(__pyx_t_11);
  3513. __Pyx_XDECREF(__pyx_t_19);
  3514. __Pyx_XDECREF(__pyx_t_20);
  3515. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3516. __pyx_r = NULL;
  3517. __pyx_L0:;
  3518. __Pyx_XDECREF(__pyx_v_os);
  3519. __Pyx_XDECREF(__pyx_v_file_exists);
  3520. __Pyx_XDECREF(__pyx_v_response);
  3521. __Pyx_XDECREF(__pyx_v_codecs);
  3522. __Pyx_XDECREF(__pyx_v_f);
  3523. __Pyx_XDECREF(__pyx_v_chunk);
  3524. __Pyx_XDECREF(__pyx_v_ce);
  3525. __Pyx_XDECREF(__pyx_v_e);
  3526. __Pyx_XDECREF(__pyx_v_filepath);
  3527. __Pyx_XGIVEREF(__pyx_r);
  3528. __Pyx_RefNannyFinishContext();
  3529. return __pyx_r;
  3530. }
  3531. /* "lib/Naked/toolshed/c/network.pyx":153
  3532. * # Tests: test_NETWORK.py :: test_http_head
  3533. * #------------------------------------------------------------------------------
  3534. * def head(self): # <<<<<<<<<<<<<<
  3535. * try:
  3536. * response = requests.head(self.url, timeout=self.request_timeout)
  3537. */
  3538. /* Python wrapper */
  3539. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_11head(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  3540. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_11head = {__Pyx_NAMESTR("head"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_11head, METH_O, __Pyx_DOCSTR(0)};
  3541. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_11head(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  3542. PyObject *__pyx_r = 0;
  3543. __Pyx_RefNannyDeclarations
  3544. __Pyx_RefNannySetupContext("head (wrapper)", 0);
  3545. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_10head(__pyx_self, ((PyObject *)__pyx_v_self));
  3546. /* function exit code */
  3547. __Pyx_RefNannyFinishContext();
  3548. return __pyx_r;
  3549. }
  3550. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_10head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  3551. PyObject *__pyx_v_response = NULL;
  3552. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  3553. PyObject *__pyx_v_e = NULL;
  3554. PyObject *__pyx_r = NULL;
  3555. __Pyx_RefNannyDeclarations
  3556. PyObject *__pyx_t_1 = NULL;
  3557. PyObject *__pyx_t_2 = NULL;
  3558. PyObject *__pyx_t_3 = NULL;
  3559. PyObject *__pyx_t_4 = NULL;
  3560. PyObject *__pyx_t_5 = NULL;
  3561. PyObject *__pyx_t_6 = NULL;
  3562. PyObject *__pyx_t_7 = NULL;
  3563. int __pyx_t_8;
  3564. int __pyx_t_9;
  3565. PyObject *__pyx_t_10 = NULL;
  3566. int __pyx_lineno = 0;
  3567. const char *__pyx_filename = NULL;
  3568. int __pyx_clineno = 0;
  3569. __Pyx_RefNannySetupContext("head", 0);
  3570. /* "lib/Naked/toolshed/c/network.pyx":154
  3571. * #------------------------------------------------------------------------------
  3572. * def head(self):
  3573. * try: # <<<<<<<<<<<<<<
  3574. * response = requests.head(self.url, timeout=self.request_timeout)
  3575. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3576. */
  3577. {
  3578. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  3579. __Pyx_XGOTREF(__pyx_t_1);
  3580. __Pyx_XGOTREF(__pyx_t_2);
  3581. __Pyx_XGOTREF(__pyx_t_3);
  3582. /*try:*/ {
  3583. /* "lib/Naked/toolshed/c/network.pyx":155
  3584. * def head(self):
  3585. * try:
  3586. * response = requests.head(self.url, timeout=self.request_timeout) # <<<<<<<<<<<<<<
  3587. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3588. * return response.headers
  3589. */
  3590. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3591. __Pyx_GOTREF(__pyx_t_4);
  3592. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_head); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3593. __Pyx_GOTREF(__pyx_t_5);
  3594. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3595. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3596. __Pyx_GOTREF(__pyx_t_4);
  3597. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3598. __Pyx_GOTREF(__pyx_t_6);
  3599. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  3600. __Pyx_GIVEREF(__pyx_t_4);
  3601. __pyx_t_4 = 0;
  3602. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3603. __Pyx_GOTREF(__pyx_t_4);
  3604. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3605. __Pyx_GOTREF(__pyx_t_7);
  3606. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3607. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3608. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3609. __Pyx_GOTREF(__pyx_t_7);
  3610. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3611. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3612. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3613. __pyx_v_response = __pyx_t_7;
  3614. __pyx_t_7 = 0;
  3615. /* "lib/Naked/toolshed/c/network.pyx":156
  3616. * try:
  3617. * response = requests.head(self.url, timeout=self.request_timeout)
  3618. * self.res = response # assign the response object from requests to a property on the instance of HTTP class # <<<<<<<<<<<<<<
  3619. * return response.headers
  3620. * except requests.exceptions.ConnectionError as ce:
  3621. */
  3622. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3623. /* "lib/Naked/toolshed/c/network.pyx":157
  3624. * response = requests.head(self.url, timeout=self.request_timeout)
  3625. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3626. * return response.headers # <<<<<<<<<<<<<<
  3627. * except requests.exceptions.ConnectionError as ce:
  3628. * return False
  3629. */
  3630. __Pyx_XDECREF(__pyx_r);
  3631. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_headers); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3632. __Pyx_GOTREF(__pyx_t_7);
  3633. __pyx_r = __pyx_t_7;
  3634. __pyx_t_7 = 0;
  3635. goto __pyx_L7_try_return;
  3636. }
  3637. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  3638. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3639. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3640. goto __pyx_L10_try_end;
  3641. __pyx_L3_error:;
  3642. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  3643. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3644. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3645. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  3646. /* "lib/Naked/toolshed/c/network.pyx":158
  3647. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3648. * return response.headers
  3649. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  3650. * return False
  3651. * except Exception as e:
  3652. */
  3653. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3654. __Pyx_GOTREF(__pyx_t_7);
  3655. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3656. __Pyx_GOTREF(__pyx_t_4);
  3657. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3658. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3659. __Pyx_GOTREF(__pyx_t_7);
  3660. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3661. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_7);
  3662. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3663. if (__pyx_t_8) {
  3664. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3665. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3666. __Pyx_GOTREF(__pyx_t_7);
  3667. __Pyx_GOTREF(__pyx_t_4);
  3668. __Pyx_GOTREF(__pyx_t_6);
  3669. __Pyx_INCREF(__pyx_t_4);
  3670. __pyx_v_ce = __pyx_t_4;
  3671. /* "lib/Naked/toolshed/c/network.pyx":159
  3672. * return response.headers
  3673. * except requests.exceptions.ConnectionError as ce:
  3674. * return False # <<<<<<<<<<<<<<
  3675. * except Exception as e:
  3676. * if DEBUG_FLAG:
  3677. */
  3678. __Pyx_XDECREF(__pyx_r);
  3679. __Pyx_INCREF(Py_False);
  3680. __pyx_r = Py_False;
  3681. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3682. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3683. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3684. goto __pyx_L6_except_return;
  3685. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3686. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3687. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3688. goto __pyx_L4_exception_handled;
  3689. }
  3690. /* "lib/Naked/toolshed/c/network.pyx":160
  3691. * except requests.exceptions.ConnectionError as ce:
  3692. * return False
  3693. * except Exception as e: # <<<<<<<<<<<<<<
  3694. * if DEBUG_FLAG:
  3695. * sys.stderr.write("Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).")
  3696. */
  3697. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  3698. if (__pyx_t_8) {
  3699. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3700. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3701. __Pyx_GOTREF(__pyx_t_6);
  3702. __Pyx_GOTREF(__pyx_t_4);
  3703. __Pyx_GOTREF(__pyx_t_7);
  3704. __Pyx_INCREF(__pyx_t_4);
  3705. __pyx_v_e = __pyx_t_4;
  3706. /* "lib/Naked/toolshed/c/network.pyx":161
  3707. * return False
  3708. * except Exception as e:
  3709. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  3710. * sys.stderr.write("Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).")
  3711. * raise e
  3712. */
  3713. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3714. __Pyx_GOTREF(__pyx_t_5);
  3715. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3716. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3717. if (__pyx_t_9) {
  3718. /* "lib/Naked/toolshed/c/network.pyx":162
  3719. * except Exception as e:
  3720. * if DEBUG_FLAG:
  3721. * sys.stderr.write("Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  3722. * raise e
  3723. *
  3724. */
  3725. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3726. __Pyx_GOTREF(__pyx_t_5);
  3727. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3728. __Pyx_GOTREF(__pyx_t_10);
  3729. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3730. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3731. __Pyx_GOTREF(__pyx_t_5);
  3732. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3733. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3734. __Pyx_GOTREF(__pyx_t_10);
  3735. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3736. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3737. goto __pyx_L15;
  3738. }
  3739. __pyx_L15:;
  3740. /* "lib/Naked/toolshed/c/network.pyx":163
  3741. * if DEBUG_FLAG:
  3742. * sys.stderr.write("Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).")
  3743. * raise e # <<<<<<<<<<<<<<
  3744. *
  3745. *
  3746. */
  3747. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  3748. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3749. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3750. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3751. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3752. goto __pyx_L4_exception_handled;
  3753. }
  3754. goto __pyx_L5_except_error;
  3755. __pyx_L5_except_error:;
  3756. __Pyx_XGIVEREF(__pyx_t_1);
  3757. __Pyx_XGIVEREF(__pyx_t_2);
  3758. __Pyx_XGIVEREF(__pyx_t_3);
  3759. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3760. goto __pyx_L1_error;
  3761. __pyx_L7_try_return:;
  3762. __Pyx_XGIVEREF(__pyx_t_1);
  3763. __Pyx_XGIVEREF(__pyx_t_2);
  3764. __Pyx_XGIVEREF(__pyx_t_3);
  3765. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3766. goto __pyx_L0;
  3767. __pyx_L6_except_return:;
  3768. __Pyx_XGIVEREF(__pyx_t_1);
  3769. __Pyx_XGIVEREF(__pyx_t_2);
  3770. __Pyx_XGIVEREF(__pyx_t_3);
  3771. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3772. goto __pyx_L0;
  3773. __pyx_L4_exception_handled:;
  3774. __Pyx_XGIVEREF(__pyx_t_1);
  3775. __Pyx_XGIVEREF(__pyx_t_2);
  3776. __Pyx_XGIVEREF(__pyx_t_3);
  3777. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3778. __pyx_L10_try_end:;
  3779. }
  3780. /* "lib/Naked/toolshed/c/network.pyx":153
  3781. * # Tests: test_NETWORK.py :: test_http_head
  3782. * #------------------------------------------------------------------------------
  3783. * def head(self): # <<<<<<<<<<<<<<
  3784. * try:
  3785. * response = requests.head(self.url, timeout=self.request_timeout)
  3786. */
  3787. /* function exit code */
  3788. __pyx_L1_error:;
  3789. __Pyx_XDECREF(__pyx_t_4);
  3790. __Pyx_XDECREF(__pyx_t_5);
  3791. __Pyx_XDECREF(__pyx_t_6);
  3792. __Pyx_XDECREF(__pyx_t_7);
  3793. __Pyx_XDECREF(__pyx_t_10);
  3794. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.head", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3795. __pyx_r = NULL;
  3796. __pyx_L0:;
  3797. __Pyx_XDECREF(__pyx_v_response);
  3798. __Pyx_XDECREF(__pyx_v_ce);
  3799. __Pyx_XDECREF(__pyx_v_e);
  3800. __Pyx_XGIVEREF(__pyx_r);
  3801. __Pyx_RefNannyFinishContext();
  3802. return __pyx_r;
  3803. }
  3804. /* "lib/Naked/toolshed/c/network.pyx":171
  3805. * # returns text from the URL as a string
  3806. * #------------------------------------------------------------------------------
  3807. * def post(self, follow_redirects=True): # <<<<<<<<<<<<<<
  3808. * try:
  3809. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  3810. */
  3811. /* Python wrapper */
  3812. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_13post(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3813. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_13post = {__Pyx_NAMESTR("post"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_13post, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  3814. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_13post(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3815. PyObject *__pyx_v_self = 0;
  3816. PyObject *__pyx_v_follow_redirects = 0;
  3817. int __pyx_lineno = 0;
  3818. const char *__pyx_filename = NULL;
  3819. int __pyx_clineno = 0;
  3820. PyObject *__pyx_r = 0;
  3821. __Pyx_RefNannyDeclarations
  3822. __Pyx_RefNannySetupContext("post (wrapper)", 0);
  3823. {
  3824. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_follow_redirects,0};
  3825. PyObject* values[2] = {0,0};
  3826. values[1] = ((PyObject *)((PyObject *)Py_True));
  3827. if (unlikely(__pyx_kwds)) {
  3828. Py_ssize_t kw_args;
  3829. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3830. switch (pos_args) {
  3831. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3832. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3833. case 0: break;
  3834. default: goto __pyx_L5_argtuple_error;
  3835. }
  3836. kw_args = PyDict_Size(__pyx_kwds);
  3837. switch (pos_args) {
  3838. case 0:
  3839. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  3840. else goto __pyx_L5_argtuple_error;
  3841. case 1:
  3842. if (kw_args > 0) {
  3843. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_follow_redirects);
  3844. if (value) { values[1] = value; kw_args--; }
  3845. }
  3846. }
  3847. if (unlikely(kw_args > 0)) {
  3848. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "post") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3849. }
  3850. } else {
  3851. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3852. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3853. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3854. break;
  3855. default: goto __pyx_L5_argtuple_error;
  3856. }
  3857. }
  3858. __pyx_v_self = values[0];
  3859. __pyx_v_follow_redirects = values[1];
  3860. }
  3861. goto __pyx_L4_argument_unpacking_done;
  3862. __pyx_L5_argtuple_error:;
  3863. __Pyx_RaiseArgtupleInvalid("post", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3864. __pyx_L3_error:;
  3865. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3866. __Pyx_RefNannyFinishContext();
  3867. return NULL;
  3868. __pyx_L4_argument_unpacking_done:;
  3869. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_12post(__pyx_self, __pyx_v_self, __pyx_v_follow_redirects);
  3870. /* function exit code */
  3871. __Pyx_RefNannyFinishContext();
  3872. return __pyx_r;
  3873. }
  3874. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_12post(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_follow_redirects) {
  3875. PyObject *__pyx_v_response = NULL;
  3876. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  3877. PyObject *__pyx_v_e = NULL;
  3878. PyObject *__pyx_r = NULL;
  3879. __Pyx_RefNannyDeclarations
  3880. PyObject *__pyx_t_1 = NULL;
  3881. PyObject *__pyx_t_2 = NULL;
  3882. PyObject *__pyx_t_3 = NULL;
  3883. PyObject *__pyx_t_4 = NULL;
  3884. PyObject *__pyx_t_5 = NULL;
  3885. PyObject *__pyx_t_6 = NULL;
  3886. PyObject *__pyx_t_7 = NULL;
  3887. int __pyx_t_8;
  3888. int __pyx_t_9;
  3889. PyObject *__pyx_t_10 = NULL;
  3890. int __pyx_lineno = 0;
  3891. const char *__pyx_filename = NULL;
  3892. int __pyx_clineno = 0;
  3893. __Pyx_RefNannySetupContext("post", 0);
  3894. /* "lib/Naked/toolshed/c/network.pyx":172
  3895. * #------------------------------------------------------------------------------
  3896. * def post(self, follow_redirects=True):
  3897. * try: # <<<<<<<<<<<<<<
  3898. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  3899. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3900. */
  3901. {
  3902. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  3903. __Pyx_XGOTREF(__pyx_t_1);
  3904. __Pyx_XGOTREF(__pyx_t_2);
  3905. __Pyx_XGOTREF(__pyx_t_3);
  3906. /*try:*/ {
  3907. /* "lib/Naked/toolshed/c/network.pyx":173
  3908. * def post(self, follow_redirects=True):
  3909. * try:
  3910. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects) # <<<<<<<<<<<<<<
  3911. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3912. * return response.text
  3913. */
  3914. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3915. __Pyx_GOTREF(__pyx_t_4);
  3916. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_post); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3917. __Pyx_GOTREF(__pyx_t_5);
  3918. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3919. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3920. __Pyx_GOTREF(__pyx_t_4);
  3921. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3922. __Pyx_GOTREF(__pyx_t_6);
  3923. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  3924. __Pyx_GIVEREF(__pyx_t_4);
  3925. __pyx_t_4 = 0;
  3926. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3927. __Pyx_GOTREF(__pyx_t_4);
  3928. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3929. __Pyx_GOTREF(__pyx_t_7);
  3930. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3931. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3932. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allow_redirects, __pyx_v_follow_redirects) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3933. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3934. __Pyx_GOTREF(__pyx_t_7);
  3935. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3936. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3937. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3938. __pyx_v_response = __pyx_t_7;
  3939. __pyx_t_7 = 0;
  3940. /* "lib/Naked/toolshed/c/network.pyx":174
  3941. * try:
  3942. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  3943. * self.res = response # assign the response object from requests to a property on the instance of HTTP class # <<<<<<<<<<<<<<
  3944. * return response.text
  3945. * except requests.exceptions.ConnectionError as ce:
  3946. */
  3947. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3948. /* "lib/Naked/toolshed/c/network.pyx":175
  3949. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  3950. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3951. * return response.text # <<<<<<<<<<<<<<
  3952. * except requests.exceptions.ConnectionError as ce:
  3953. * return False
  3954. */
  3955. __Pyx_XDECREF(__pyx_r);
  3956. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_text); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3957. __Pyx_GOTREF(__pyx_t_7);
  3958. __pyx_r = __pyx_t_7;
  3959. __pyx_t_7 = 0;
  3960. goto __pyx_L7_try_return;
  3961. }
  3962. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  3963. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3964. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3965. goto __pyx_L10_try_end;
  3966. __pyx_L3_error:;
  3967. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  3968. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3969. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3970. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  3971. /* "lib/Naked/toolshed/c/network.pyx":176
  3972. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  3973. * return response.text
  3974. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  3975. * return False
  3976. * except Exception as e:
  3977. */
  3978. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3979. __Pyx_GOTREF(__pyx_t_7);
  3980. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3981. __Pyx_GOTREF(__pyx_t_4);
  3982. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3983. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3984. __Pyx_GOTREF(__pyx_t_7);
  3985. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3986. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_7);
  3987. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3988. if (__pyx_t_8) {
  3989. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3990. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  3991. __Pyx_GOTREF(__pyx_t_7);
  3992. __Pyx_GOTREF(__pyx_t_4);
  3993. __Pyx_GOTREF(__pyx_t_6);
  3994. __Pyx_INCREF(__pyx_t_4);
  3995. __pyx_v_ce = __pyx_t_4;
  3996. /* "lib/Naked/toolshed/c/network.pyx":177
  3997. * return response.text
  3998. * except requests.exceptions.ConnectionError as ce:
  3999. * return False # <<<<<<<<<<<<<<
  4000. * except Exception as e:
  4001. * if DEBUG_FLAG:
  4002. */
  4003. __Pyx_XDECREF(__pyx_r);
  4004. __Pyx_INCREF(Py_False);
  4005. __pyx_r = Py_False;
  4006. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4007. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4008. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4009. goto __pyx_L6_except_return;
  4010. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4011. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4012. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4013. goto __pyx_L4_exception_handled;
  4014. }
  4015. /* "lib/Naked/toolshed/c/network.pyx":178
  4016. * except requests.exceptions.ConnectionError as ce:
  4017. * return False
  4018. * except Exception as e: # <<<<<<<<<<<<<<
  4019. * if DEBUG_FLAG:
  4020. * sys.stderr.exit("Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).")
  4021. */
  4022. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  4023. if (__pyx_t_8) {
  4024. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4025. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4026. __Pyx_GOTREF(__pyx_t_6);
  4027. __Pyx_GOTREF(__pyx_t_4);
  4028. __Pyx_GOTREF(__pyx_t_7);
  4029. __Pyx_INCREF(__pyx_t_4);
  4030. __pyx_v_e = __pyx_t_4;
  4031. /* "lib/Naked/toolshed/c/network.pyx":179
  4032. * return False
  4033. * except Exception as e:
  4034. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  4035. * sys.stderr.exit("Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).")
  4036. * raise e
  4037. */
  4038. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4039. __Pyx_GOTREF(__pyx_t_5);
  4040. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4041. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4042. if (__pyx_t_9) {
  4043. /* "lib/Naked/toolshed/c/network.pyx":180
  4044. * except Exception as e:
  4045. * if DEBUG_FLAG:
  4046. * sys.stderr.exit("Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  4047. * raise e
  4048. *
  4049. */
  4050. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4051. __Pyx_GOTREF(__pyx_t_5);
  4052. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4053. __Pyx_GOTREF(__pyx_t_10);
  4054. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4055. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4056. __Pyx_GOTREF(__pyx_t_5);
  4057. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4058. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4059. __Pyx_GOTREF(__pyx_t_10);
  4060. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4061. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4062. goto __pyx_L15;
  4063. }
  4064. __pyx_L15:;
  4065. /* "lib/Naked/toolshed/c/network.pyx":181
  4066. * if DEBUG_FLAG:
  4067. * sys.stderr.exit("Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).")
  4068. * raise e # <<<<<<<<<<<<<<
  4069. *
  4070. * #------------------------------------------------------------------------------
  4071. */
  4072. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  4073. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4074. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4075. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4076. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4077. goto __pyx_L4_exception_handled;
  4078. }
  4079. goto __pyx_L5_except_error;
  4080. __pyx_L5_except_error:;
  4081. __Pyx_XGIVEREF(__pyx_t_1);
  4082. __Pyx_XGIVEREF(__pyx_t_2);
  4083. __Pyx_XGIVEREF(__pyx_t_3);
  4084. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4085. goto __pyx_L1_error;
  4086. __pyx_L7_try_return:;
  4087. __Pyx_XGIVEREF(__pyx_t_1);
  4088. __Pyx_XGIVEREF(__pyx_t_2);
  4089. __Pyx_XGIVEREF(__pyx_t_3);
  4090. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4091. goto __pyx_L0;
  4092. __pyx_L6_except_return:;
  4093. __Pyx_XGIVEREF(__pyx_t_1);
  4094. __Pyx_XGIVEREF(__pyx_t_2);
  4095. __Pyx_XGIVEREF(__pyx_t_3);
  4096. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4097. goto __pyx_L0;
  4098. __pyx_L4_exception_handled:;
  4099. __Pyx_XGIVEREF(__pyx_t_1);
  4100. __Pyx_XGIVEREF(__pyx_t_2);
  4101. __Pyx_XGIVEREF(__pyx_t_3);
  4102. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4103. __pyx_L10_try_end:;
  4104. }
  4105. /* "lib/Naked/toolshed/c/network.pyx":171
  4106. * # returns text from the URL as a string
  4107. * #------------------------------------------------------------------------------
  4108. * def post(self, follow_redirects=True): # <<<<<<<<<<<<<<
  4109. * try:
  4110. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  4111. */
  4112. /* function exit code */
  4113. __pyx_L1_error:;
  4114. __Pyx_XDECREF(__pyx_t_4);
  4115. __Pyx_XDECREF(__pyx_t_5);
  4116. __Pyx_XDECREF(__pyx_t_6);
  4117. __Pyx_XDECREF(__pyx_t_7);
  4118. __Pyx_XDECREF(__pyx_t_10);
  4119. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4120. __pyx_r = NULL;
  4121. __pyx_L0:;
  4122. __Pyx_XDECREF(__pyx_v_response);
  4123. __Pyx_XDECREF(__pyx_v_ce);
  4124. __Pyx_XDECREF(__pyx_v_e);
  4125. __Pyx_XGIVEREF(__pyx_r);
  4126. __Pyx_RefNannyFinishContext();
  4127. return __pyx_r;
  4128. }
  4129. /* "lib/Naked/toolshed/c/network.pyx":188
  4130. * # returns binary data from the URL
  4131. * #------------------------------------------------------------------------------
  4132. * def post_bin(self): # <<<<<<<<<<<<<<
  4133. * try:
  4134. * response = requests.post(self.url, timeout=self.request_timeout)
  4135. */
  4136. /* Python wrapper */
  4137. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_15post_bin(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  4138. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_15post_bin = {__Pyx_NAMESTR("post_bin"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_15post_bin, METH_O, __Pyx_DOCSTR(0)};
  4139. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_15post_bin(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  4140. PyObject *__pyx_r = 0;
  4141. __Pyx_RefNannyDeclarations
  4142. __Pyx_RefNannySetupContext("post_bin (wrapper)", 0);
  4143. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_14post_bin(__pyx_self, ((PyObject *)__pyx_v_self));
  4144. /* function exit code */
  4145. __Pyx_RefNannyFinishContext();
  4146. return __pyx_r;
  4147. }
  4148. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_14post_bin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  4149. PyObject *__pyx_v_response = NULL;
  4150. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  4151. PyObject *__pyx_v_e = NULL;
  4152. PyObject *__pyx_r = NULL;
  4153. __Pyx_RefNannyDeclarations
  4154. PyObject *__pyx_t_1 = NULL;
  4155. PyObject *__pyx_t_2 = NULL;
  4156. PyObject *__pyx_t_3 = NULL;
  4157. PyObject *__pyx_t_4 = NULL;
  4158. PyObject *__pyx_t_5 = NULL;
  4159. PyObject *__pyx_t_6 = NULL;
  4160. PyObject *__pyx_t_7 = NULL;
  4161. int __pyx_t_8;
  4162. int __pyx_t_9;
  4163. PyObject *__pyx_t_10 = NULL;
  4164. int __pyx_lineno = 0;
  4165. const char *__pyx_filename = NULL;
  4166. int __pyx_clineno = 0;
  4167. __Pyx_RefNannySetupContext("post_bin", 0);
  4168. /* "lib/Naked/toolshed/c/network.pyx":189
  4169. * #------------------------------------------------------------------------------
  4170. * def post_bin(self):
  4171. * try: # <<<<<<<<<<<<<<
  4172. * response = requests.post(self.url, timeout=self.request_timeout)
  4173. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  4174. */
  4175. {
  4176. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4177. __Pyx_XGOTREF(__pyx_t_1);
  4178. __Pyx_XGOTREF(__pyx_t_2);
  4179. __Pyx_XGOTREF(__pyx_t_3);
  4180. /*try:*/ {
  4181. /* "lib/Naked/toolshed/c/network.pyx":190
  4182. * def post_bin(self):
  4183. * try:
  4184. * response = requests.post(self.url, timeout=self.request_timeout) # <<<<<<<<<<<<<<
  4185. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  4186. * return response.content
  4187. */
  4188. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4189. __Pyx_GOTREF(__pyx_t_4);
  4190. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_post); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4191. __Pyx_GOTREF(__pyx_t_5);
  4192. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4193. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4194. __Pyx_GOTREF(__pyx_t_4);
  4195. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4196. __Pyx_GOTREF(__pyx_t_6);
  4197. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  4198. __Pyx_GIVEREF(__pyx_t_4);
  4199. __pyx_t_4 = 0;
  4200. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4201. __Pyx_GOTREF(__pyx_t_4);
  4202. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4203. __Pyx_GOTREF(__pyx_t_7);
  4204. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_timeout, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4205. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4206. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4207. __Pyx_GOTREF(__pyx_t_7);
  4208. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4209. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4210. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4211. __pyx_v_response = __pyx_t_7;
  4212. __pyx_t_7 = 0;
  4213. /* "lib/Naked/toolshed/c/network.pyx":191
  4214. * try:
  4215. * response = requests.post(self.url, timeout=self.request_timeout)
  4216. * self.res = response # assign the response object from requests to a property on the instance of HTTP class # <<<<<<<<<<<<<<
  4217. * return response.content
  4218. * except requests.exceptions.ConnectionError as ce:
  4219. */
  4220. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4221. /* "lib/Naked/toolshed/c/network.pyx":192
  4222. * response = requests.post(self.url, timeout=self.request_timeout)
  4223. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  4224. * return response.content # <<<<<<<<<<<<<<
  4225. * except requests.exceptions.ConnectionError as ce:
  4226. * return False
  4227. */
  4228. __Pyx_XDECREF(__pyx_r);
  4229. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_content); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4230. __Pyx_GOTREF(__pyx_t_7);
  4231. __pyx_r = __pyx_t_7;
  4232. __pyx_t_7 = 0;
  4233. goto __pyx_L7_try_return;
  4234. }
  4235. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4236. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4237. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4238. goto __pyx_L10_try_end;
  4239. __pyx_L3_error:;
  4240. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  4241. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4242. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  4243. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  4244. /* "lib/Naked/toolshed/c/network.pyx":193
  4245. * self.res = response # assign the response object from requests to a property on the instance of HTTP class
  4246. * return response.content
  4247. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  4248. * return False
  4249. * except Exception as e:
  4250. */
  4251. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4252. __Pyx_GOTREF(__pyx_t_7);
  4253. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4254. __Pyx_GOTREF(__pyx_t_4);
  4255. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4256. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4257. __Pyx_GOTREF(__pyx_t_7);
  4258. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4259. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_t_7);
  4260. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4261. if (__pyx_t_8) {
  4262. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4263. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4264. __Pyx_GOTREF(__pyx_t_7);
  4265. __Pyx_GOTREF(__pyx_t_4);
  4266. __Pyx_GOTREF(__pyx_t_6);
  4267. __Pyx_INCREF(__pyx_t_4);
  4268. __pyx_v_ce = __pyx_t_4;
  4269. /* "lib/Naked/toolshed/c/network.pyx":194
  4270. * return response.content
  4271. * except requests.exceptions.ConnectionError as ce:
  4272. * return False # <<<<<<<<<<<<<<
  4273. * except Exception as e:
  4274. * if DEBUG_FLAG:
  4275. */
  4276. __Pyx_XDECREF(__pyx_r);
  4277. __Pyx_INCREF(Py_False);
  4278. __pyx_r = Py_False;
  4279. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4280. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4281. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4282. goto __pyx_L6_except_return;
  4283. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4284. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4285. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4286. goto __pyx_L4_exception_handled;
  4287. }
  4288. /* "lib/Naked/toolshed/c/network.pyx":195
  4289. * except requests.exceptions.ConnectionError as ce:
  4290. * return False
  4291. * except Exception as e: # <<<<<<<<<<<<<<
  4292. * if DEBUG_FLAG:
  4293. * sys.stderr.exit("Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).")
  4294. */
  4295. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  4296. if (__pyx_t_8) {
  4297. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4298. if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4299. __Pyx_GOTREF(__pyx_t_6);
  4300. __Pyx_GOTREF(__pyx_t_4);
  4301. __Pyx_GOTREF(__pyx_t_7);
  4302. __Pyx_INCREF(__pyx_t_4);
  4303. __pyx_v_e = __pyx_t_4;
  4304. /* "lib/Naked/toolshed/c/network.pyx":196
  4305. * return False
  4306. * except Exception as e:
  4307. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  4308. * sys.stderr.exit("Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).")
  4309. * raise e
  4310. */
  4311. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4312. __Pyx_GOTREF(__pyx_t_5);
  4313. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4314. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4315. if (__pyx_t_9) {
  4316. /* "lib/Naked/toolshed/c/network.pyx":197
  4317. * except Exception as e:
  4318. * if DEBUG_FLAG:
  4319. * sys.stderr.exit("Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  4320. * raise e
  4321. *
  4322. */
  4323. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4324. __Pyx_GOTREF(__pyx_t_5);
  4325. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4326. __Pyx_GOTREF(__pyx_t_10);
  4327. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4328. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4329. __Pyx_GOTREF(__pyx_t_5);
  4330. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4331. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4332. __Pyx_GOTREF(__pyx_t_10);
  4333. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4334. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4335. goto __pyx_L15;
  4336. }
  4337. __pyx_L15:;
  4338. /* "lib/Naked/toolshed/c/network.pyx":198
  4339. * if DEBUG_FLAG:
  4340. * sys.stderr.exit("Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).")
  4341. * raise e # <<<<<<<<<<<<<<
  4342. *
  4343. * #------------------------------------------------------------------------------
  4344. */
  4345. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  4346. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  4347. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4348. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4349. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4350. goto __pyx_L4_exception_handled;
  4351. }
  4352. goto __pyx_L5_except_error;
  4353. __pyx_L5_except_error:;
  4354. __Pyx_XGIVEREF(__pyx_t_1);
  4355. __Pyx_XGIVEREF(__pyx_t_2);
  4356. __Pyx_XGIVEREF(__pyx_t_3);
  4357. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4358. goto __pyx_L1_error;
  4359. __pyx_L7_try_return:;
  4360. __Pyx_XGIVEREF(__pyx_t_1);
  4361. __Pyx_XGIVEREF(__pyx_t_2);
  4362. __Pyx_XGIVEREF(__pyx_t_3);
  4363. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4364. goto __pyx_L0;
  4365. __pyx_L6_except_return:;
  4366. __Pyx_XGIVEREF(__pyx_t_1);
  4367. __Pyx_XGIVEREF(__pyx_t_2);
  4368. __Pyx_XGIVEREF(__pyx_t_3);
  4369. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4370. goto __pyx_L0;
  4371. __pyx_L4_exception_handled:;
  4372. __Pyx_XGIVEREF(__pyx_t_1);
  4373. __Pyx_XGIVEREF(__pyx_t_2);
  4374. __Pyx_XGIVEREF(__pyx_t_3);
  4375. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4376. __pyx_L10_try_end:;
  4377. }
  4378. /* "lib/Naked/toolshed/c/network.pyx":188
  4379. * # returns binary data from the URL
  4380. * #------------------------------------------------------------------------------
  4381. * def post_bin(self): # <<<<<<<<<<<<<<
  4382. * try:
  4383. * response = requests.post(self.url, timeout=self.request_timeout)
  4384. */
  4385. /* function exit code */
  4386. __pyx_L1_error:;
  4387. __Pyx_XDECREF(__pyx_t_4);
  4388. __Pyx_XDECREF(__pyx_t_5);
  4389. __Pyx_XDECREF(__pyx_t_6);
  4390. __Pyx_XDECREF(__pyx_t_7);
  4391. __Pyx_XDECREF(__pyx_t_10);
  4392. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4393. __pyx_r = NULL;
  4394. __pyx_L0:;
  4395. __Pyx_XDECREF(__pyx_v_response);
  4396. __Pyx_XDECREF(__pyx_v_ce);
  4397. __Pyx_XDECREF(__pyx_v_e);
  4398. __Pyx_XGIVEREF(__pyx_r);
  4399. __Pyx_RefNannyFinishContext();
  4400. return __pyx_r;
  4401. }
  4402. /* "lib/Naked/toolshed/c/network.pyx":206
  4403. * # returns a boolean that indicates the success of the file write
  4404. * #------------------------------------------------------------------------------
  4405. * def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  4406. * try:
  4407. * import os # used for os.fsync() method in the write
  4408. */
  4409. /* Python wrapper */
  4410. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_17post_bin_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4411. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_17post_bin_write_file = {__Pyx_NAMESTR("post_bin_write_file"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_17post_bin_write_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  4412. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_17post_bin_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  4413. PyObject *__pyx_v_self = 0;
  4414. PyObject *__pyx_v_filepath = 0;
  4415. PyObject *__pyx_v_suppress_output = 0;
  4416. PyObject *__pyx_v_overwrite_existing = 0;
  4417. int __pyx_lineno = 0;
  4418. const char *__pyx_filename = NULL;
  4419. int __pyx_clineno = 0;
  4420. PyObject *__pyx_r = 0;
  4421. __Pyx_RefNannyDeclarations
  4422. __Pyx_RefNannySetupContext("post_bin_write_file (wrapper)", 0);
  4423. {
  4424. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filepath,&__pyx_n_s_suppress_output,&__pyx_n_s_overwrite_existing,0};
  4425. PyObject* values[4] = {0,0,0,0};
  4426. values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_));
  4427. values[2] = ((PyObject *)((PyObject *)Py_False));
  4428. values[3] = ((PyObject *)((PyObject *)Py_False));
  4429. if (unlikely(__pyx_kwds)) {
  4430. Py_ssize_t kw_args;
  4431. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  4432. switch (pos_args) {
  4433. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  4434. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  4435. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  4436. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4437. case 0: break;
  4438. default: goto __pyx_L5_argtuple_error;
  4439. }
  4440. kw_args = PyDict_Size(__pyx_kwds);
  4441. switch (pos_args) {
  4442. case 0:
  4443. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  4444. else goto __pyx_L5_argtuple_error;
  4445. case 1:
  4446. if (kw_args > 0) {
  4447. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filepath);
  4448. if (value) { values[1] = value; kw_args--; }
  4449. }
  4450. case 2:
  4451. if (kw_args > 0) {
  4452. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_suppress_output);
  4453. if (value) { values[2] = value; kw_args--; }
  4454. }
  4455. case 3:
  4456. if (kw_args > 0) {
  4457. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overwrite_existing);
  4458. if (value) { values[3] = value; kw_args--; }
  4459. }
  4460. }
  4461. if (unlikely(kw_args > 0)) {
  4462. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "post_bin_write_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4463. }
  4464. } else {
  4465. switch (PyTuple_GET_SIZE(__pyx_args)) {
  4466. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  4467. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  4468. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  4469. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4470. break;
  4471. default: goto __pyx_L5_argtuple_error;
  4472. }
  4473. }
  4474. __pyx_v_self = values[0];
  4475. __pyx_v_filepath = values[1];
  4476. __pyx_v_suppress_output = values[2];
  4477. __pyx_v_overwrite_existing = values[3];
  4478. }
  4479. goto __pyx_L4_argument_unpacking_done;
  4480. __pyx_L5_argtuple_error:;
  4481. __Pyx_RaiseArgtupleInvalid("post_bin_write_file", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4482. __pyx_L3_error:;
  4483. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4484. __Pyx_RefNannyFinishContext();
  4485. return NULL;
  4486. __pyx_L4_argument_unpacking_done:;
  4487. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_16post_bin_write_file(__pyx_self, __pyx_v_self, __pyx_v_filepath, __pyx_v_suppress_output, __pyx_v_overwrite_existing);
  4488. /* function exit code */
  4489. __Pyx_RefNannyFinishContext();
  4490. return __pyx_r;
  4491. }
  4492. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_16post_bin_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing) {
  4493. PyObject *__pyx_v_os = NULL;
  4494. PyObject *__pyx_v_file_exists = NULL;
  4495. PyObject *__pyx_v_response = NULL;
  4496. PyObject *__pyx_v_f = NULL;
  4497. PyObject *__pyx_v_chunk = NULL;
  4498. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  4499. PyObject *__pyx_v_e = NULL;
  4500. PyObject *__pyx_r = NULL;
  4501. __Pyx_RefNannyDeclarations
  4502. PyObject *__pyx_t_1 = NULL;
  4503. PyObject *__pyx_t_2 = NULL;
  4504. PyObject *__pyx_t_3 = NULL;
  4505. PyObject *__pyx_t_4 = NULL;
  4506. int __pyx_t_5;
  4507. int __pyx_t_6;
  4508. PyObject *__pyx_t_7 = NULL;
  4509. Py_ssize_t __pyx_t_8;
  4510. int __pyx_t_9;
  4511. PyObject *__pyx_t_10 = NULL;
  4512. PyObject *__pyx_t_11 = NULL;
  4513. PyObject *__pyx_t_12 = NULL;
  4514. PyObject *__pyx_t_13 = NULL;
  4515. PyObject *__pyx_t_14 = NULL;
  4516. PyObject *__pyx_t_15 = NULL;
  4517. PyObject *(*__pyx_t_16)(PyObject *);
  4518. PyObject *__pyx_t_17 = NULL;
  4519. int __pyx_t_18;
  4520. PyObject *__pyx_t_19 = NULL;
  4521. PyObject *__pyx_t_20 = NULL;
  4522. int __pyx_lineno = 0;
  4523. const char *__pyx_filename = NULL;
  4524. int __pyx_clineno = 0;
  4525. __Pyx_RefNannySetupContext("post_bin_write_file", 0);
  4526. __Pyx_INCREF(__pyx_v_filepath);
  4527. /* "lib/Naked/toolshed/c/network.pyx":207
  4528. * #------------------------------------------------------------------------------
  4529. * def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  4530. * try: # <<<<<<<<<<<<<<
  4531. * import os # used for os.fsync() method in the write
  4532. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  4533. */
  4534. {
  4535. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4536. __Pyx_XGOTREF(__pyx_t_1);
  4537. __Pyx_XGOTREF(__pyx_t_2);
  4538. __Pyx_XGOTREF(__pyx_t_3);
  4539. /*try:*/ {
  4540. /* "lib/Naked/toolshed/c/network.pyx":208
  4541. * def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  4542. * try:
  4543. * import os # used for os.fsync() method in the write # <<<<<<<<<<<<<<
  4544. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  4545. * if not overwrite_existing:
  4546. */
  4547. __pyx_t_4 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4548. __Pyx_GOTREF(__pyx_t_4);
  4549. __pyx_v_os = __pyx_t_4;
  4550. __pyx_t_4 = 0;
  4551. /* "lib/Naked/toolshed/c/network.pyx":210
  4552. * import os # used for os.fsync() method in the write
  4553. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  4554. * if not overwrite_existing: # <<<<<<<<<<<<<<
  4555. * from Naked.toolshed.system import file_exists
  4556. * if file_exists(filepath):
  4557. */
  4558. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_overwrite_existing); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4559. __pyx_t_6 = ((!__pyx_t_5) != 0);
  4560. if (__pyx_t_6) {
  4561. /* "lib/Naked/toolshed/c/network.pyx":211
  4562. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  4563. * if not overwrite_existing:
  4564. * from Naked.toolshed.system import file_exists # <<<<<<<<<<<<<<
  4565. * if file_exists(filepath):
  4566. * if not suppress_output:
  4567. */
  4568. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4569. __Pyx_GOTREF(__pyx_t_4);
  4570. __Pyx_INCREF(__pyx_n_s_file_exists);
  4571. PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_file_exists);
  4572. __Pyx_GIVEREF(__pyx_n_s_file_exists);
  4573. __pyx_t_7 = __Pyx_Import(__pyx_n_s_Naked_toolshed_system, __pyx_t_4, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4574. __Pyx_GOTREF(__pyx_t_7);
  4575. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4576. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_file_exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4577. __Pyx_GOTREF(__pyx_t_4);
  4578. __Pyx_INCREF(__pyx_t_4);
  4579. __pyx_v_file_exists = __pyx_t_4;
  4580. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4581. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4582. /* "lib/Naked/toolshed/c/network.pyx":212
  4583. * if not overwrite_existing:
  4584. * from Naked.toolshed.system import file_exists
  4585. * if file_exists(filepath): # <<<<<<<<<<<<<<
  4586. * if not suppress_output:
  4587. * print("Download aborted. A local file with the requested filename exists on the path.")
  4588. */
  4589. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4590. __Pyx_GOTREF(__pyx_t_7);
  4591. __Pyx_INCREF(__pyx_v_filepath);
  4592. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filepath);
  4593. __Pyx_GIVEREF(__pyx_v_filepath);
  4594. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_file_exists, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4595. __Pyx_GOTREF(__pyx_t_4);
  4596. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4597. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4598. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4599. if (__pyx_t_6) {
  4600. /* "lib/Naked/toolshed/c/network.pyx":213
  4601. * from Naked.toolshed.system import file_exists
  4602. * if file_exists(filepath):
  4603. * if not suppress_output: # <<<<<<<<<<<<<<
  4604. * print("Download aborted. A local file with the requested filename exists on the path.")
  4605. * return False
  4606. */
  4607. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4608. __pyx_t_5 = ((!__pyx_t_6) != 0);
  4609. if (__pyx_t_5) {
  4610. /* "lib/Naked/toolshed/c/network.pyx":214
  4611. * if file_exists(filepath):
  4612. * if not suppress_output:
  4613. * print("Download aborted. A local file with the requested filename exists on the path.") # <<<<<<<<<<<<<<
  4614. * return False
  4615. * if (filepath == "" and len(self.url) > 1):
  4616. */
  4617. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_aborted_A_local_file_wi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4618. goto __pyx_L13;
  4619. }
  4620. __pyx_L13:;
  4621. /* "lib/Naked/toolshed/c/network.pyx":215
  4622. * if not suppress_output:
  4623. * print("Download aborted. A local file with the requested filename exists on the path.")
  4624. * return False # <<<<<<<<<<<<<<
  4625. * if (filepath == "" and len(self.url) > 1):
  4626. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  4627. */
  4628. __Pyx_XDECREF(__pyx_r);
  4629. __Pyx_INCREF(Py_False);
  4630. __pyx_r = Py_False;
  4631. goto __pyx_L7_try_return;
  4632. }
  4633. goto __pyx_L11;
  4634. }
  4635. __pyx_L11:;
  4636. /* "lib/Naked/toolshed/c/network.pyx":216
  4637. * print("Download aborted. A local file with the requested filename exists on the path.")
  4638. * return False
  4639. * if (filepath == "" and len(self.url) > 1): # <<<<<<<<<<<<<<
  4640. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  4641. * if not suppress_output:
  4642. */
  4643. __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_filepath, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4644. if (__pyx_t_5) {
  4645. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4646. __Pyx_GOTREF(__pyx_t_4);
  4647. __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4648. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4649. __pyx_t_6 = (__pyx_t_8 > 1);
  4650. __pyx_t_9 = __pyx_t_6;
  4651. } else {
  4652. __pyx_t_9 = __pyx_t_5;
  4653. }
  4654. if (__pyx_t_9) {
  4655. /* "lib/Naked/toolshed/c/network.pyx":217
  4656. * return False
  4657. * if (filepath == "" and len(self.url) > 1):
  4658. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  4659. * if not suppress_output:
  4660. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  4661. */
  4662. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4663. __Pyx_GOTREF(__pyx_t_4);
  4664. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4665. __Pyx_GOTREF(__pyx_t_7);
  4666. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4667. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4668. __Pyx_GOTREF(__pyx_t_4);
  4669. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4670. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
  4671. __Pyx_GOTREF(__pyx_t_7);
  4672. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4673. __Pyx_DECREF_SET(__pyx_v_filepath, __pyx_t_7);
  4674. __pyx_t_7 = 0;
  4675. goto __pyx_L14;
  4676. }
  4677. __pyx_L14:;
  4678. /* "lib/Naked/toolshed/c/network.pyx":218
  4679. * if (filepath == "" and len(self.url) > 1):
  4680. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  4681. * if not suppress_output: # <<<<<<<<<<<<<<
  4682. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  4683. * sys.stdout.flush()
  4684. */
  4685. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4686. __pyx_t_5 = ((!__pyx_t_9) != 0);
  4687. if (__pyx_t_5) {
  4688. /* "lib/Naked/toolshed/c/network.pyx":219
  4689. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  4690. * if not suppress_output:
  4691. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user # <<<<<<<<<<<<<<
  4692. * sys.stdout.flush()
  4693. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  4694. */
  4695. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4696. __Pyx_GOTREF(__pyx_t_7);
  4697. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4698. __Pyx_GOTREF(__pyx_t_4);
  4699. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4700. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4701. __Pyx_GOTREF(__pyx_t_7);
  4702. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4703. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4704. __Pyx_GOTREF(__pyx_t_4);
  4705. __pyx_t_10 = PyNumber_Add(__pyx_kp_s_Downloading_file_from, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4706. __Pyx_GOTREF(__pyx_t_10);
  4707. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4708. __pyx_t_4 = PyNumber_Add(__pyx_t_10, __pyx_kp_s__4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4709. __Pyx_GOTREF(__pyx_t_4);
  4710. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4711. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4712. __Pyx_GOTREF(__pyx_t_10);
  4713. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  4714. __Pyx_GIVEREF(__pyx_t_4);
  4715. __pyx_t_4 = 0;
  4716. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4717. __Pyx_GOTREF(__pyx_t_4);
  4718. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4719. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4720. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4721. /* "lib/Naked/toolshed/c/network.pyx":220
  4722. * if not suppress_output:
  4723. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  4724. * sys.stdout.flush() # <<<<<<<<<<<<<<
  4725. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  4726. * self.res = response
  4727. */
  4728. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4729. __Pyx_GOTREF(__pyx_t_4);
  4730. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_stdout); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4731. __Pyx_GOTREF(__pyx_t_10);
  4732. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4733. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4734. __Pyx_GOTREF(__pyx_t_4);
  4735. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4736. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4737. __Pyx_GOTREF(__pyx_t_10);
  4738. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4739. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4740. goto __pyx_L15;
  4741. }
  4742. __pyx_L15:;
  4743. /* "lib/Naked/toolshed/c/network.pyx":221
  4744. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  4745. * sys.stdout.flush()
  4746. * response = requests.post(self.url, timeout=self.request_timeout, stream=True) # <<<<<<<<<<<<<<
  4747. * self.res = response
  4748. * with open(filepath, 'wb') as f: # write as binary data
  4749. */
  4750. __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4751. __Pyx_GOTREF(__pyx_t_10);
  4752. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_post); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4753. __Pyx_GOTREF(__pyx_t_4);
  4754. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4755. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4756. __Pyx_GOTREF(__pyx_t_10);
  4757. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4758. __Pyx_GOTREF(__pyx_t_7);
  4759. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
  4760. __Pyx_GIVEREF(__pyx_t_10);
  4761. __pyx_t_10 = 0;
  4762. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4763. __Pyx_GOTREF(__pyx_t_10);
  4764. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4765. __Pyx_GOTREF(__pyx_t_11);
  4766. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_timeout, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4767. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4768. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_stream, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4769. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4770. __Pyx_GOTREF(__pyx_t_11);
  4771. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4772. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4773. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4774. __pyx_v_response = __pyx_t_11;
  4775. __pyx_t_11 = 0;
  4776. /* "lib/Naked/toolshed/c/network.pyx":222
  4777. * sys.stdout.flush()
  4778. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  4779. * self.res = response # <<<<<<<<<<<<<<
  4780. * with open(filepath, 'wb') as f: # write as binary data
  4781. * for chunk in response.iter_content(chunk_size=2048):
  4782. */
  4783. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4784. /* "lib/Naked/toolshed/c/network.pyx":223
  4785. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  4786. * self.res = response
  4787. * with open(filepath, 'wb') as f: # write as binary data # <<<<<<<<<<<<<<
  4788. * for chunk in response.iter_content(chunk_size=2048):
  4789. * f.write(chunk)
  4790. */
  4791. /*with:*/ {
  4792. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4793. __Pyx_GOTREF(__pyx_t_11);
  4794. __Pyx_INCREF(__pyx_v_filepath);
  4795. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_filepath);
  4796. __Pyx_GIVEREF(__pyx_v_filepath);
  4797. __Pyx_INCREF(__pyx_n_s_wb);
  4798. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_n_s_wb);
  4799. __Pyx_GIVEREF(__pyx_n_s_wb);
  4800. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4801. __Pyx_GOTREF(__pyx_t_10);
  4802. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4803. __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4804. __Pyx_GOTREF(__pyx_t_12);
  4805. __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_enter); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  4806. __Pyx_GOTREF(__pyx_t_11);
  4807. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  4808. __Pyx_GOTREF(__pyx_t_7);
  4809. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4810. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4811. /*try:*/ {
  4812. {
  4813. __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4814. __Pyx_XGOTREF(__pyx_t_13);
  4815. __Pyx_XGOTREF(__pyx_t_14);
  4816. __Pyx_XGOTREF(__pyx_t_15);
  4817. /*try:*/ {
  4818. __Pyx_INCREF(__pyx_t_7);
  4819. __pyx_v_f = __pyx_t_7;
  4820. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4821. /* "lib/Naked/toolshed/c/network.pyx":224
  4822. * self.res = response
  4823. * with open(filepath, 'wb') as f: # write as binary data
  4824. * for chunk in response.iter_content(chunk_size=2048): # <<<<<<<<<<<<<<
  4825. * f.write(chunk)
  4826. * f.flush()
  4827. */
  4828. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_iter_content); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4829. __Pyx_GOTREF(__pyx_t_7);
  4830. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4831. __Pyx_GOTREF(__pyx_t_10);
  4832. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_chunk_size, __pyx_int_2048) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4833. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4834. __Pyx_GOTREF(__pyx_t_11);
  4835. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4836. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4837. if (PyList_CheckExact(__pyx_t_11) || PyTuple_CheckExact(__pyx_t_11)) {
  4838. __pyx_t_10 = __pyx_t_11; __Pyx_INCREF(__pyx_t_10); __pyx_t_8 = 0;
  4839. __pyx_t_16 = NULL;
  4840. } else {
  4841. __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4842. __Pyx_GOTREF(__pyx_t_10);
  4843. __pyx_t_16 = Py_TYPE(__pyx_t_10)->tp_iternext;
  4844. }
  4845. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4846. for (;;) {
  4847. if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_10)) {
  4848. if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_10)) break;
  4849. #if CYTHON_COMPILING_IN_CPYTHON
  4850. __pyx_t_11 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4851. #else
  4852. __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4853. #endif
  4854. } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_10)) {
  4855. if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
  4856. #if CYTHON_COMPILING_IN_CPYTHON
  4857. __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4858. #else
  4859. __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4860. #endif
  4861. } else {
  4862. __pyx_t_11 = __pyx_t_16(__pyx_t_10);
  4863. if (unlikely(!__pyx_t_11)) {
  4864. PyObject* exc_type = PyErr_Occurred();
  4865. if (exc_type) {
  4866. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  4867. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4868. }
  4869. break;
  4870. }
  4871. __Pyx_GOTREF(__pyx_t_11);
  4872. }
  4873. __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_11);
  4874. __pyx_t_11 = 0;
  4875. /* "lib/Naked/toolshed/c/network.pyx":225
  4876. * with open(filepath, 'wb') as f: # write as binary data
  4877. * for chunk in response.iter_content(chunk_size=2048):
  4878. * f.write(chunk) # <<<<<<<<<<<<<<
  4879. * f.flush()
  4880. * os.fsync(f.fileno()) # flush all internal buffers to disk
  4881. */
  4882. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4883. __Pyx_GOTREF(__pyx_t_11);
  4884. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4885. __Pyx_GOTREF(__pyx_t_7);
  4886. __Pyx_INCREF(__pyx_v_chunk);
  4887. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chunk);
  4888. __Pyx_GIVEREF(__pyx_v_chunk);
  4889. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4890. __Pyx_GOTREF(__pyx_t_4);
  4891. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4892. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4893. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4894. /* "lib/Naked/toolshed/c/network.pyx":226
  4895. * for chunk in response.iter_content(chunk_size=2048):
  4896. * f.write(chunk)
  4897. * f.flush() # <<<<<<<<<<<<<<
  4898. * os.fsync(f.fileno()) # flush all internal buffers to disk
  4899. * if not suppress_output:
  4900. */
  4901. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4902. __Pyx_GOTREF(__pyx_t_4);
  4903. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4904. __Pyx_GOTREF(__pyx_t_7);
  4905. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4906. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4907. /* "lib/Naked/toolshed/c/network.pyx":227
  4908. * f.write(chunk)
  4909. * f.flush()
  4910. * os.fsync(f.fileno()) # flush all internal buffers to disk # <<<<<<<<<<<<<<
  4911. * if not suppress_output:
  4912. * print(" ")
  4913. */
  4914. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_fsync); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4915. __Pyx_GOTREF(__pyx_t_7);
  4916. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_fileno); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4917. __Pyx_GOTREF(__pyx_t_4);
  4918. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4919. __Pyx_GOTREF(__pyx_t_11);
  4920. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4921. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4922. __Pyx_GOTREF(__pyx_t_4);
  4923. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11);
  4924. __Pyx_GIVEREF(__pyx_t_11);
  4925. __pyx_t_11 = 0;
  4926. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  4927. __Pyx_GOTREF(__pyx_t_11);
  4928. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4929. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4930. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4931. }
  4932. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4933. }
  4934. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  4935. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  4936. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  4937. goto __pyx_L29_try_end;
  4938. __pyx_L22_error:;
  4939. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  4940. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  4941. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  4942. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  4943. /* "lib/Naked/toolshed/c/network.pyx":223
  4944. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  4945. * self.res = response
  4946. * with open(filepath, 'wb') as f: # write as binary data # <<<<<<<<<<<<<<
  4947. * for chunk in response.iter_content(chunk_size=2048):
  4948. * f.write(chunk)
  4949. */
  4950. /*except:*/ {
  4951. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4952. if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  4953. __Pyx_GOTREF(__pyx_t_10);
  4954. __Pyx_GOTREF(__pyx_t_11);
  4955. __Pyx_GOTREF(__pyx_t_4);
  4956. __pyx_t_7 = PyTuple_Pack(3, __pyx_t_10, __pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  4957. __Pyx_GOTREF(__pyx_t_7);
  4958. __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL);
  4959. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  4960. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4961. if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  4962. __Pyx_GOTREF(__pyx_t_17);
  4963. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_17);
  4964. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  4965. if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  4966. __pyx_t_9 = ((!(__pyx_t_5 != 0)) != 0);
  4967. if (__pyx_t_9) {
  4968. __Pyx_GIVEREF(__pyx_t_10);
  4969. __Pyx_GIVEREF(__pyx_t_11);
  4970. __Pyx_XGIVEREF(__pyx_t_4);
  4971. __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_4);
  4972. __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_4 = 0;
  4973. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  4974. }
  4975. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  4976. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  4977. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4978. goto __pyx_L23_exception_handled;
  4979. }
  4980. __pyx_L24_except_error:;
  4981. __Pyx_XGIVEREF(__pyx_t_13);
  4982. __Pyx_XGIVEREF(__pyx_t_14);
  4983. __Pyx_XGIVEREF(__pyx_t_15);
  4984. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4985. goto __pyx_L3_error;
  4986. __pyx_L23_exception_handled:;
  4987. __Pyx_XGIVEREF(__pyx_t_13);
  4988. __Pyx_XGIVEREF(__pyx_t_14);
  4989. __Pyx_XGIVEREF(__pyx_t_15);
  4990. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4991. __pyx_L29_try_end:;
  4992. }
  4993. }
  4994. /*finally:*/ {
  4995. /*normal exit:*/{
  4996. if (__pyx_t_12) {
  4997. __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__14, NULL);
  4998. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  4999. if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5000. __Pyx_GOTREF(__pyx_t_15);
  5001. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5002. }
  5003. goto __pyx_L21;
  5004. }
  5005. __pyx_L21:;
  5006. }
  5007. goto __pyx_L36;
  5008. __pyx_L16_error:;
  5009. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  5010. goto __pyx_L3_error;
  5011. __pyx_L36:;
  5012. }
  5013. /* "lib/Naked/toolshed/c/network.pyx":228
  5014. * f.flush()
  5015. * os.fsync(f.fileno()) # flush all internal buffers to disk
  5016. * if not suppress_output: # <<<<<<<<<<<<<<
  5017. * print(" ")
  5018. * print("Download complete.") # provide user with completion information
  5019. */
  5020. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5021. __pyx_t_5 = ((!__pyx_t_9) != 0);
  5022. if (__pyx_t_5) {
  5023. /* "lib/Naked/toolshed/c/network.pyx":229
  5024. * os.fsync(f.fileno()) # flush all internal buffers to disk
  5025. * if not suppress_output:
  5026. * print(" ") # <<<<<<<<<<<<<<
  5027. * print("Download complete.") # provide user with completion information
  5028. * return True # return True if successful write
  5029. */
  5030. if (__Pyx_PrintOne(0, __pyx_kp_s__6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5031. /* "lib/Naked/toolshed/c/network.pyx":230
  5032. * if not suppress_output:
  5033. * print(" ")
  5034. * print("Download complete.") # provide user with completion information # <<<<<<<<<<<<<<
  5035. * return True # return True if successful write
  5036. * except requests.exceptions.ConnectionError as ce:
  5037. */
  5038. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_complete) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5039. goto __pyx_L37;
  5040. }
  5041. __pyx_L37:;
  5042. /* "lib/Naked/toolshed/c/network.pyx":231
  5043. * print(" ")
  5044. * print("Download complete.") # provide user with completion information
  5045. * return True # return True if successful write # <<<<<<<<<<<<<<
  5046. * except requests.exceptions.ConnectionError as ce:
  5047. * return False
  5048. */
  5049. __Pyx_XDECREF(__pyx_r);
  5050. __Pyx_INCREF(Py_True);
  5051. __pyx_r = Py_True;
  5052. goto __pyx_L7_try_return;
  5053. }
  5054. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  5055. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5056. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  5057. goto __pyx_L10_try_end;
  5058. __pyx_L3_error:;
  5059. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  5060. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  5061. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  5062. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5063. /* "lib/Naked/toolshed/c/network.pyx":232
  5064. * print("Download complete.") # provide user with completion information
  5065. * return True # return True if successful write
  5066. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  5067. * return False
  5068. * except Exception as e:
  5069. */
  5070. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5071. __Pyx_GOTREF(__pyx_t_4);
  5072. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5073. __Pyx_GOTREF(__pyx_t_11);
  5074. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5075. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5076. __Pyx_GOTREF(__pyx_t_4);
  5077. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5078. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_t_4);
  5079. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5080. if (__pyx_t_18) {
  5081. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5082. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_11, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5083. __Pyx_GOTREF(__pyx_t_4);
  5084. __Pyx_GOTREF(__pyx_t_11);
  5085. __Pyx_GOTREF(__pyx_t_10);
  5086. __Pyx_INCREF(__pyx_t_11);
  5087. __pyx_v_ce = __pyx_t_11;
  5088. /* "lib/Naked/toolshed/c/network.pyx":233
  5089. * return True # return True if successful write
  5090. * except requests.exceptions.ConnectionError as ce:
  5091. * return False # <<<<<<<<<<<<<<
  5092. * except Exception as e:
  5093. * if DEBUG_FLAG:
  5094. */
  5095. __Pyx_XDECREF(__pyx_r);
  5096. __Pyx_INCREF(Py_False);
  5097. __pyx_r = Py_False;
  5098. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5099. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5100. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5101. goto __pyx_L6_except_return;
  5102. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5103. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5104. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5105. goto __pyx_L4_exception_handled;
  5106. }
  5107. /* "lib/Naked/toolshed/c/network.pyx":234
  5108. * except requests.exceptions.ConnectionError as ce:
  5109. * return False
  5110. * except Exception as e: # <<<<<<<<<<<<<<
  5111. * if DEBUG_FLAG:
  5112. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
  5113. */
  5114. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  5115. if (__pyx_t_18) {
  5116. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5117. if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5118. __Pyx_GOTREF(__pyx_t_10);
  5119. __Pyx_GOTREF(__pyx_t_11);
  5120. __Pyx_GOTREF(__pyx_t_4);
  5121. __Pyx_INCREF(__pyx_t_11);
  5122. __pyx_v_e = __pyx_t_11;
  5123. /* "lib/Naked/toolshed/c/network.pyx":235
  5124. * return False
  5125. * except Exception as e:
  5126. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  5127. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
  5128. * raise e
  5129. */
  5130. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5131. __Pyx_GOTREF(__pyx_t_7);
  5132. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5133. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5134. if (__pyx_t_5) {
  5135. /* "lib/Naked/toolshed/c/network.pyx":236
  5136. * except Exception as e:
  5137. * if DEBUG_FLAG:
  5138. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)") # <<<<<<<<<<<<<<
  5139. * raise e
  5140. *
  5141. */
  5142. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5143. __Pyx_GOTREF(__pyx_t_7);
  5144. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stderr); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5145. __Pyx_GOTREF(__pyx_t_19);
  5146. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5147. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5148. __Pyx_GOTREF(__pyx_t_7);
  5149. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  5150. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5151. __Pyx_GOTREF(__pyx_t_19);
  5152. __pyx_t_20 = PyNumber_Add(__pyx_kp_s_Naked_Framework_Error_Unable_to_6, __pyx_t_19); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5153. __Pyx_GOTREF(__pyx_t_20);
  5154. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  5155. __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_kp_s_using_the_post_data_write_bin_m); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5156. __Pyx_GOTREF(__pyx_t_19);
  5157. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  5158. __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5159. __Pyx_GOTREF(__pyx_t_20);
  5160. PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
  5161. __Pyx_GIVEREF(__pyx_t_19);
  5162. __pyx_t_19 = 0;
  5163. __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_20, NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5164. __Pyx_GOTREF(__pyx_t_19);
  5165. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5166. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  5167. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  5168. goto __pyx_L42;
  5169. }
  5170. __pyx_L42:;
  5171. /* "lib/Naked/toolshed/c/network.pyx":237
  5172. * if DEBUG_FLAG:
  5173. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
  5174. * raise e # <<<<<<<<<<<<<<
  5175. *
  5176. * #------------------------------------------------------------------------------
  5177. */
  5178. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  5179. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5180. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5181. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5182. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5183. goto __pyx_L4_exception_handled;
  5184. }
  5185. goto __pyx_L5_except_error;
  5186. __pyx_L5_except_error:;
  5187. __Pyx_XGIVEREF(__pyx_t_1);
  5188. __Pyx_XGIVEREF(__pyx_t_2);
  5189. __Pyx_XGIVEREF(__pyx_t_3);
  5190. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  5191. goto __pyx_L1_error;
  5192. __pyx_L7_try_return:;
  5193. __Pyx_XGIVEREF(__pyx_t_1);
  5194. __Pyx_XGIVEREF(__pyx_t_2);
  5195. __Pyx_XGIVEREF(__pyx_t_3);
  5196. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  5197. goto __pyx_L0;
  5198. __pyx_L6_except_return:;
  5199. __Pyx_XGIVEREF(__pyx_t_1);
  5200. __Pyx_XGIVEREF(__pyx_t_2);
  5201. __Pyx_XGIVEREF(__pyx_t_3);
  5202. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  5203. goto __pyx_L0;
  5204. __pyx_L4_exception_handled:;
  5205. __Pyx_XGIVEREF(__pyx_t_1);
  5206. __Pyx_XGIVEREF(__pyx_t_2);
  5207. __Pyx_XGIVEREF(__pyx_t_3);
  5208. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  5209. __pyx_L10_try_end:;
  5210. }
  5211. /* "lib/Naked/toolshed/c/network.pyx":206
  5212. * # returns a boolean that indicates the success of the file write
  5213. * #------------------------------------------------------------------------------
  5214. * def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  5215. * try:
  5216. * import os # used for os.fsync() method in the write
  5217. */
  5218. /* function exit code */
  5219. __pyx_L1_error:;
  5220. __Pyx_XDECREF(__pyx_t_4);
  5221. __Pyx_XDECREF(__pyx_t_7);
  5222. __Pyx_XDECREF(__pyx_t_10);
  5223. __Pyx_XDECREF(__pyx_t_11);
  5224. __Pyx_XDECREF(__pyx_t_19);
  5225. __Pyx_XDECREF(__pyx_t_20);
  5226. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_bin_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5227. __pyx_r = NULL;
  5228. __pyx_L0:;
  5229. __Pyx_XDECREF(__pyx_v_os);
  5230. __Pyx_XDECREF(__pyx_v_file_exists);
  5231. __Pyx_XDECREF(__pyx_v_response);
  5232. __Pyx_XDECREF(__pyx_v_f);
  5233. __Pyx_XDECREF(__pyx_v_chunk);
  5234. __Pyx_XDECREF(__pyx_v_ce);
  5235. __Pyx_XDECREF(__pyx_v_e);
  5236. __Pyx_XDECREF(__pyx_v_filepath);
  5237. __Pyx_XGIVEREF(__pyx_r);
  5238. __Pyx_RefNannyFinishContext();
  5239. return __pyx_r;
  5240. }
  5241. /* "lib/Naked/toolshed/c/network.pyx":245
  5242. * # returns a boolean that indicates the success of the file write
  5243. * #------------------------------------------------------------------------------
  5244. * def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  5245. * try:
  5246. * import os # used for os.fsync() method in the write
  5247. */
  5248. /* Python wrapper */
  5249. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_19post_txt_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5250. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_19post_txt_write_file = {__Pyx_NAMESTR("post_txt_write_file"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_19post_txt_write_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
  5251. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_19post_txt_write_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5252. PyObject *__pyx_v_self = 0;
  5253. PyObject *__pyx_v_filepath = 0;
  5254. PyObject *__pyx_v_suppress_output = 0;
  5255. PyObject *__pyx_v_overwrite_existing = 0;
  5256. int __pyx_lineno = 0;
  5257. const char *__pyx_filename = NULL;
  5258. int __pyx_clineno = 0;
  5259. PyObject *__pyx_r = 0;
  5260. __Pyx_RefNannyDeclarations
  5261. __Pyx_RefNannySetupContext("post_txt_write_file (wrapper)", 0);
  5262. {
  5263. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filepath,&__pyx_n_s_suppress_output,&__pyx_n_s_overwrite_existing,0};
  5264. PyObject* values[4] = {0,0,0,0};
  5265. values[1] = ((PyObject *)((PyObject*)__pyx_kp_s_));
  5266. values[2] = ((PyObject *)((PyObject *)Py_False));
  5267. values[3] = ((PyObject *)((PyObject *)Py_False));
  5268. if (unlikely(__pyx_kwds)) {
  5269. Py_ssize_t kw_args;
  5270. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  5271. switch (pos_args) {
  5272. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  5273. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5274. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5275. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5276. case 0: break;
  5277. default: goto __pyx_L5_argtuple_error;
  5278. }
  5279. kw_args = PyDict_Size(__pyx_kwds);
  5280. switch (pos_args) {
  5281. case 0:
  5282. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
  5283. else goto __pyx_L5_argtuple_error;
  5284. case 1:
  5285. if (kw_args > 0) {
  5286. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_filepath);
  5287. if (value) { values[1] = value; kw_args--; }
  5288. }
  5289. case 2:
  5290. if (kw_args > 0) {
  5291. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_suppress_output);
  5292. if (value) { values[2] = value; kw_args--; }
  5293. }
  5294. case 3:
  5295. if (kw_args > 0) {
  5296. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overwrite_existing);
  5297. if (value) { values[3] = value; kw_args--; }
  5298. }
  5299. }
  5300. if (unlikely(kw_args > 0)) {
  5301. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "post_txt_write_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5302. }
  5303. } else {
  5304. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5305. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  5306. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5307. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5308. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5309. break;
  5310. default: goto __pyx_L5_argtuple_error;
  5311. }
  5312. }
  5313. __pyx_v_self = values[0];
  5314. __pyx_v_filepath = values[1];
  5315. __pyx_v_suppress_output = values[2];
  5316. __pyx_v_overwrite_existing = values[3];
  5317. }
  5318. goto __pyx_L4_argument_unpacking_done;
  5319. __pyx_L5_argtuple_error:;
  5320. __Pyx_RaiseArgtupleInvalid("post_txt_write_file", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5321. __pyx_L3_error:;
  5322. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5323. __Pyx_RefNannyFinishContext();
  5324. return NULL;
  5325. __pyx_L4_argument_unpacking_done:;
  5326. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_18post_txt_write_file(__pyx_self, __pyx_v_self, __pyx_v_filepath, __pyx_v_suppress_output, __pyx_v_overwrite_existing);
  5327. /* function exit code */
  5328. __Pyx_RefNannyFinishContext();
  5329. return __pyx_r;
  5330. }
  5331. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_18post_txt_write_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath, PyObject *__pyx_v_suppress_output, PyObject *__pyx_v_overwrite_existing) {
  5332. PyObject *__pyx_v_os = NULL;
  5333. PyObject *__pyx_v_file_exists = NULL;
  5334. PyObject *__pyx_v_response = NULL;
  5335. PyObject *__pyx_v_codecs = NULL;
  5336. PyObject *__pyx_v_f = NULL;
  5337. PyObject *__pyx_v_chunk = NULL;
  5338. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  5339. PyObject *__pyx_v_e = NULL;
  5340. PyObject *__pyx_r = NULL;
  5341. __Pyx_RefNannyDeclarations
  5342. PyObject *__pyx_t_1 = NULL;
  5343. PyObject *__pyx_t_2 = NULL;
  5344. PyObject *__pyx_t_3 = NULL;
  5345. PyObject *__pyx_t_4 = NULL;
  5346. int __pyx_t_5;
  5347. int __pyx_t_6;
  5348. PyObject *__pyx_t_7 = NULL;
  5349. Py_ssize_t __pyx_t_8;
  5350. int __pyx_t_9;
  5351. PyObject *__pyx_t_10 = NULL;
  5352. PyObject *__pyx_t_11 = NULL;
  5353. PyObject *__pyx_t_12 = NULL;
  5354. PyObject *__pyx_t_13 = NULL;
  5355. PyObject *__pyx_t_14 = NULL;
  5356. PyObject *__pyx_t_15 = NULL;
  5357. PyObject *(*__pyx_t_16)(PyObject *);
  5358. PyObject *__pyx_t_17 = NULL;
  5359. int __pyx_t_18;
  5360. PyObject *__pyx_t_19 = NULL;
  5361. PyObject *__pyx_t_20 = NULL;
  5362. int __pyx_lineno = 0;
  5363. const char *__pyx_filename = NULL;
  5364. int __pyx_clineno = 0;
  5365. __Pyx_RefNannySetupContext("post_txt_write_file", 0);
  5366. __Pyx_INCREF(__pyx_v_filepath);
  5367. /* "lib/Naked/toolshed/c/network.pyx":246
  5368. * #------------------------------------------------------------------------------
  5369. * def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  5370. * try: # <<<<<<<<<<<<<<
  5371. * import os # used for os.fsync() method in the write
  5372. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  5373. */
  5374. {
  5375. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  5376. __Pyx_XGOTREF(__pyx_t_1);
  5377. __Pyx_XGOTREF(__pyx_t_2);
  5378. __Pyx_XGOTREF(__pyx_t_3);
  5379. /*try:*/ {
  5380. /* "lib/Naked/toolshed/c/network.pyx":247
  5381. * def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False):
  5382. * try:
  5383. * import os # used for os.fsync() method in the write # <<<<<<<<<<<<<<
  5384. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  5385. * if not overwrite_existing:
  5386. */
  5387. __pyx_t_4 = __Pyx_Import(__pyx_n_s_os, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5388. __Pyx_GOTREF(__pyx_t_4);
  5389. __pyx_v_os = __pyx_t_4;
  5390. __pyx_t_4 = 0;
  5391. /* "lib/Naked/toolshed/c/network.pyx":249
  5392. * import os # used for os.fsync() method in the write
  5393. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  5394. * if not overwrite_existing: # <<<<<<<<<<<<<<
  5395. * from Naked.toolshed.system import file_exists
  5396. * if file_exists(filepath):
  5397. */
  5398. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_overwrite_existing); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5399. __pyx_t_6 = ((!__pyx_t_5) != 0);
  5400. if (__pyx_t_6) {
  5401. /* "lib/Naked/toolshed/c/network.pyx":250
  5402. * # Confirm that the file does not exist and prevent overwrite if it does (unless developer indicates otherwise)
  5403. * if not overwrite_existing:
  5404. * from Naked.toolshed.system import file_exists # <<<<<<<<<<<<<<
  5405. * if file_exists(filepath):
  5406. * if not suppress_output:
  5407. */
  5408. __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5409. __Pyx_GOTREF(__pyx_t_4);
  5410. __Pyx_INCREF(__pyx_n_s_file_exists);
  5411. PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_file_exists);
  5412. __Pyx_GIVEREF(__pyx_n_s_file_exists);
  5413. __pyx_t_7 = __Pyx_Import(__pyx_n_s_Naked_toolshed_system, __pyx_t_4, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5414. __Pyx_GOTREF(__pyx_t_7);
  5415. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5416. __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_7, __pyx_n_s_file_exists); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5417. __Pyx_GOTREF(__pyx_t_4);
  5418. __Pyx_INCREF(__pyx_t_4);
  5419. __pyx_v_file_exists = __pyx_t_4;
  5420. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5421. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5422. /* "lib/Naked/toolshed/c/network.pyx":251
  5423. * if not overwrite_existing:
  5424. * from Naked.toolshed.system import file_exists
  5425. * if file_exists(filepath): # <<<<<<<<<<<<<<
  5426. * if not suppress_output:
  5427. * print("Download aborted. A local file with the requested filename exists on the path.")
  5428. */
  5429. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5430. __Pyx_GOTREF(__pyx_t_7);
  5431. __Pyx_INCREF(__pyx_v_filepath);
  5432. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_filepath);
  5433. __Pyx_GIVEREF(__pyx_v_filepath);
  5434. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_file_exists, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5435. __Pyx_GOTREF(__pyx_t_4);
  5436. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5437. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5438. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5439. if (__pyx_t_6) {
  5440. /* "lib/Naked/toolshed/c/network.pyx":252
  5441. * from Naked.toolshed.system import file_exists
  5442. * if file_exists(filepath):
  5443. * if not suppress_output: # <<<<<<<<<<<<<<
  5444. * print("Download aborted. A local file with the requested filename exists on the path.")
  5445. * return False
  5446. */
  5447. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5448. __pyx_t_5 = ((!__pyx_t_6) != 0);
  5449. if (__pyx_t_5) {
  5450. /* "lib/Naked/toolshed/c/network.pyx":253
  5451. * if file_exists(filepath):
  5452. * if not suppress_output:
  5453. * print("Download aborted. A local file with the requested filename exists on the path.") # <<<<<<<<<<<<<<
  5454. * return False
  5455. * if (filepath == "" and len(self.url) > 1):
  5456. */
  5457. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_aborted_A_local_file_wi) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5458. goto __pyx_L13;
  5459. }
  5460. __pyx_L13:;
  5461. /* "lib/Naked/toolshed/c/network.pyx":254
  5462. * if not suppress_output:
  5463. * print("Download aborted. A local file with the requested filename exists on the path.")
  5464. * return False # <<<<<<<<<<<<<<
  5465. * if (filepath == "" and len(self.url) > 1):
  5466. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  5467. */
  5468. __Pyx_XDECREF(__pyx_r);
  5469. __Pyx_INCREF(Py_False);
  5470. __pyx_r = Py_False;
  5471. goto __pyx_L7_try_return;
  5472. }
  5473. goto __pyx_L11;
  5474. }
  5475. __pyx_L11:;
  5476. /* "lib/Naked/toolshed/c/network.pyx":255
  5477. * print("Download aborted. A local file with the requested filename exists on the path.")
  5478. * return False
  5479. * if (filepath == "" and len(self.url) > 1): # <<<<<<<<<<<<<<
  5480. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  5481. * if not suppress_output:
  5482. */
  5483. __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_filepath, __pyx_kp_s_, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5484. if (__pyx_t_5) {
  5485. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5486. __Pyx_GOTREF(__pyx_t_4);
  5487. __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5488. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5489. __pyx_t_6 = (__pyx_t_8 > 1);
  5490. __pyx_t_9 = __pyx_t_6;
  5491. } else {
  5492. __pyx_t_9 = __pyx_t_5;
  5493. }
  5494. if (__pyx_t_9) {
  5495. /* "lib/Naked/toolshed/c/network.pyx":256
  5496. * return False
  5497. * if (filepath == "" and len(self.url) > 1):
  5498. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  5499. * if not suppress_output:
  5500. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  5501. */
  5502. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5503. __Pyx_GOTREF(__pyx_t_4);
  5504. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5505. __Pyx_GOTREF(__pyx_t_7);
  5506. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5507. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5508. __Pyx_GOTREF(__pyx_t_4);
  5509. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5510. __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;};
  5511. __Pyx_GOTREF(__pyx_t_7);
  5512. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5513. __Pyx_DECREF_SET(__pyx_v_filepath, __pyx_t_7);
  5514. __pyx_t_7 = 0;
  5515. goto __pyx_L14;
  5516. }
  5517. __pyx_L14:;
  5518. /* "lib/Naked/toolshed/c/network.pyx":257
  5519. * if (filepath == "" and len(self.url) > 1):
  5520. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  5521. * if not suppress_output: # <<<<<<<<<<<<<<
  5522. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  5523. * sys.stdout.flush()
  5524. */
  5525. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5526. __pyx_t_5 = ((!__pyx_t_9) != 0);
  5527. if (__pyx_t_5) {
  5528. /* "lib/Naked/toolshed/c/network.pyx":258
  5529. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified
  5530. * if not suppress_output:
  5531. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user # <<<<<<<<<<<<<<
  5532. * sys.stdout.flush()
  5533. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  5534. */
  5535. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5536. __Pyx_GOTREF(__pyx_t_7);
  5537. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stdout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5538. __Pyx_GOTREF(__pyx_t_4);
  5539. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5540. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5541. __Pyx_GOTREF(__pyx_t_7);
  5542. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5543. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5544. __Pyx_GOTREF(__pyx_t_4);
  5545. __pyx_t_10 = PyNumber_Add(__pyx_kp_s_Downloading_file_from, __pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5546. __Pyx_GOTREF(__pyx_t_10);
  5547. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5548. __pyx_t_4 = PyNumber_Add(__pyx_t_10, __pyx_kp_s__4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5549. __Pyx_GOTREF(__pyx_t_4);
  5550. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5551. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5552. __Pyx_GOTREF(__pyx_t_10);
  5553. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  5554. __Pyx_GIVEREF(__pyx_t_4);
  5555. __pyx_t_4 = 0;
  5556. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5557. __Pyx_GOTREF(__pyx_t_4);
  5558. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5559. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5560. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5561. /* "lib/Naked/toolshed/c/network.pyx":259
  5562. * if not suppress_output:
  5563. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  5564. * sys.stdout.flush() # <<<<<<<<<<<<<<
  5565. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  5566. * self.res = response
  5567. */
  5568. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5569. __Pyx_GOTREF(__pyx_t_4);
  5570. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_stdout); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5571. __Pyx_GOTREF(__pyx_t_10);
  5572. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5573. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_flush); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5574. __Pyx_GOTREF(__pyx_t_4);
  5575. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5576. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5577. __Pyx_GOTREF(__pyx_t_10);
  5578. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5579. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5580. goto __pyx_L15;
  5581. }
  5582. __pyx_L15:;
  5583. /* "lib/Naked/toolshed/c/network.pyx":260
  5584. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  5585. * sys.stdout.flush()
  5586. * response = requests.post(self.url, timeout=self.request_timeout, stream=True) # <<<<<<<<<<<<<<
  5587. * self.res = response
  5588. * import codecs
  5589. */
  5590. __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5591. __Pyx_GOTREF(__pyx_t_10);
  5592. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_post); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5593. __Pyx_GOTREF(__pyx_t_4);
  5594. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5595. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5596. __Pyx_GOTREF(__pyx_t_10);
  5597. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5598. __Pyx_GOTREF(__pyx_t_7);
  5599. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_10);
  5600. __Pyx_GIVEREF(__pyx_t_10);
  5601. __pyx_t_10 = 0;
  5602. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5603. __Pyx_GOTREF(__pyx_t_10);
  5604. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_request_timeout); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5605. __Pyx_GOTREF(__pyx_t_11);
  5606. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_timeout, __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5607. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5608. if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_stream, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5609. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5610. __Pyx_GOTREF(__pyx_t_11);
  5611. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5612. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5613. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5614. __pyx_v_response = __pyx_t_11;
  5615. __pyx_t_11 = 0;
  5616. /* "lib/Naked/toolshed/c/network.pyx":261
  5617. * sys.stdout.flush()
  5618. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  5619. * self.res = response # <<<<<<<<<<<<<<
  5620. * import codecs
  5621. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data
  5622. */
  5623. if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_res, __pyx_v_response) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5624. /* "lib/Naked/toolshed/c/network.pyx":262
  5625. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  5626. * self.res = response
  5627. * import codecs # <<<<<<<<<<<<<<
  5628. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data
  5629. * for chunk in response.iter_content(chunk_size=2048):
  5630. */
  5631. __pyx_t_11 = __Pyx_Import(__pyx_n_s_codecs, 0, -1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5632. __Pyx_GOTREF(__pyx_t_11);
  5633. __pyx_v_codecs = __pyx_t_11;
  5634. __pyx_t_11 = 0;
  5635. /* "lib/Naked/toolshed/c/network.pyx":263
  5636. * self.res = response
  5637. * import codecs
  5638. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data # <<<<<<<<<<<<<<
  5639. * for chunk in response.iter_content(chunk_size=2048):
  5640. * chunk = chunk.decode('utf-8')
  5641. */
  5642. /*with:*/ {
  5643. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_codecs, __pyx_n_s_open); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5644. __Pyx_GOTREF(__pyx_t_11);
  5645. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5646. __Pyx_GOTREF(__pyx_t_10);
  5647. __Pyx_INCREF(__pyx_v_filepath);
  5648. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_filepath);
  5649. __Pyx_GIVEREF(__pyx_v_filepath);
  5650. __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5651. __Pyx_GOTREF(__pyx_t_7);
  5652. if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_mode, __pyx_n_s_w) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5653. if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_encoding, __pyx_kp_s_utf_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5654. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5655. __Pyx_GOTREF(__pyx_t_4);
  5656. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5657. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5658. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5659. __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5660. __Pyx_GOTREF(__pyx_t_12);
  5661. __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_4, __pyx_n_s_enter); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  5662. __Pyx_GOTREF(__pyx_t_7);
  5663. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
  5664. __Pyx_GOTREF(__pyx_t_10);
  5665. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5666. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5667. /*try:*/ {
  5668. {
  5669. __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  5670. __Pyx_XGOTREF(__pyx_t_13);
  5671. __Pyx_XGOTREF(__pyx_t_14);
  5672. __Pyx_XGOTREF(__pyx_t_15);
  5673. /*try:*/ {
  5674. __Pyx_INCREF(__pyx_t_10);
  5675. __pyx_v_f = __pyx_t_10;
  5676. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5677. /* "lib/Naked/toolshed/c/network.pyx":264
  5678. * import codecs
  5679. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data
  5680. * for chunk in response.iter_content(chunk_size=2048): # <<<<<<<<<<<<<<
  5681. * chunk = chunk.decode('utf-8')
  5682. * f.write(chunk)
  5683. */
  5684. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_response, __pyx_n_s_iter_content); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5685. __Pyx_GOTREF(__pyx_t_10);
  5686. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5687. __Pyx_GOTREF(__pyx_t_4);
  5688. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_chunk_size, __pyx_int_2048) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5689. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5690. __Pyx_GOTREF(__pyx_t_7);
  5691. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5692. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5693. if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) {
  5694. __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0;
  5695. __pyx_t_16 = NULL;
  5696. } else {
  5697. __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5698. __Pyx_GOTREF(__pyx_t_4);
  5699. __pyx_t_16 = Py_TYPE(__pyx_t_4)->tp_iternext;
  5700. }
  5701. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5702. for (;;) {
  5703. if (!__pyx_t_16 && PyList_CheckExact(__pyx_t_4)) {
  5704. if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break;
  5705. #if CYTHON_COMPILING_IN_CPYTHON
  5706. __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5707. #else
  5708. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5709. #endif
  5710. } else if (!__pyx_t_16 && PyTuple_CheckExact(__pyx_t_4)) {
  5711. if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
  5712. #if CYTHON_COMPILING_IN_CPYTHON
  5713. __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5714. #else
  5715. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5716. #endif
  5717. } else {
  5718. __pyx_t_7 = __pyx_t_16(__pyx_t_4);
  5719. if (unlikely(!__pyx_t_7)) {
  5720. PyObject* exc_type = PyErr_Occurred();
  5721. if (exc_type) {
  5722. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  5723. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5724. }
  5725. break;
  5726. }
  5727. __Pyx_GOTREF(__pyx_t_7);
  5728. }
  5729. __Pyx_XDECREF_SET(__pyx_v_chunk, __pyx_t_7);
  5730. __pyx_t_7 = 0;
  5731. /* "lib/Naked/toolshed/c/network.pyx":265
  5732. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data
  5733. * for chunk in response.iter_content(chunk_size=2048):
  5734. * chunk = chunk.decode('utf-8') # <<<<<<<<<<<<<<
  5735. * f.write(chunk)
  5736. * f.flush()
  5737. */
  5738. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_chunk, __pyx_n_s_decode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5739. __Pyx_GOTREF(__pyx_t_7);
  5740. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5741. __Pyx_GOTREF(__pyx_t_10);
  5742. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5743. __Pyx_DECREF_SET(__pyx_v_chunk, __pyx_t_10);
  5744. __pyx_t_10 = 0;
  5745. /* "lib/Naked/toolshed/c/network.pyx":266
  5746. * for chunk in response.iter_content(chunk_size=2048):
  5747. * chunk = chunk.decode('utf-8')
  5748. * f.write(chunk) # <<<<<<<<<<<<<<
  5749. * f.flush()
  5750. * os.fsync(f.fileno()) # flush all internal buffers to disk
  5751. */
  5752. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5753. __Pyx_GOTREF(__pyx_t_10);
  5754. __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5755. __Pyx_GOTREF(__pyx_t_7);
  5756. __Pyx_INCREF(__pyx_v_chunk);
  5757. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_chunk);
  5758. __Pyx_GIVEREF(__pyx_v_chunk);
  5759. __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5760. __Pyx_GOTREF(__pyx_t_11);
  5761. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5762. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5763. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5764. /* "lib/Naked/toolshed/c/network.pyx":267
  5765. * chunk = chunk.decode('utf-8')
  5766. * f.write(chunk)
  5767. * f.flush() # <<<<<<<<<<<<<<
  5768. * os.fsync(f.fileno()) # flush all internal buffers to disk
  5769. * if not suppress_output:
  5770. */
  5771. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_flush); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5772. __Pyx_GOTREF(__pyx_t_11);
  5773. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5774. __Pyx_GOTREF(__pyx_t_7);
  5775. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5776. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5777. /* "lib/Naked/toolshed/c/network.pyx":268
  5778. * f.write(chunk)
  5779. * f.flush()
  5780. * os.fsync(f.fileno()) # flush all internal buffers to disk # <<<<<<<<<<<<<<
  5781. * if not suppress_output:
  5782. * print(" ")
  5783. */
  5784. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_os, __pyx_n_s_fsync); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5785. __Pyx_GOTREF(__pyx_t_7);
  5786. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_fileno); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5787. __Pyx_GOTREF(__pyx_t_11);
  5788. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5789. __Pyx_GOTREF(__pyx_t_10);
  5790. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5791. __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5792. __Pyx_GOTREF(__pyx_t_11);
  5793. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
  5794. __Pyx_GIVEREF(__pyx_t_10);
  5795. __pyx_t_10 = 0;
  5796. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
  5797. __Pyx_GOTREF(__pyx_t_10);
  5798. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5799. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5800. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5801. }
  5802. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5803. }
  5804. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  5805. __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  5806. __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  5807. goto __pyx_L29_try_end;
  5808. __pyx_L22_error:;
  5809. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  5810. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  5811. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  5812. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5813. /* "lib/Naked/toolshed/c/network.pyx":263
  5814. * self.res = response
  5815. * import codecs
  5816. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data # <<<<<<<<<<<<<<
  5817. * for chunk in response.iter_content(chunk_size=2048):
  5818. * chunk = chunk.decode('utf-8')
  5819. */
  5820. /*except:*/ {
  5821. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5822. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  5823. __Pyx_GOTREF(__pyx_t_4);
  5824. __Pyx_GOTREF(__pyx_t_10);
  5825. __Pyx_GOTREF(__pyx_t_11);
  5826. __pyx_t_7 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  5827. __Pyx_GOTREF(__pyx_t_7);
  5828. __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL);
  5829. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  5830. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5831. if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  5832. __Pyx_GOTREF(__pyx_t_17);
  5833. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_17);
  5834. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  5835. if (__pyx_t_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  5836. __pyx_t_9 = ((!(__pyx_t_5 != 0)) != 0);
  5837. if (__pyx_t_9) {
  5838. __Pyx_GIVEREF(__pyx_t_4);
  5839. __Pyx_GIVEREF(__pyx_t_10);
  5840. __Pyx_XGIVEREF(__pyx_t_11);
  5841. __Pyx_ErrRestore(__pyx_t_4, __pyx_t_10, __pyx_t_11);
  5842. __pyx_t_4 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
  5843. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
  5844. }
  5845. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5846. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5847. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5848. goto __pyx_L23_exception_handled;
  5849. }
  5850. __pyx_L24_except_error:;
  5851. __Pyx_XGIVEREF(__pyx_t_13);
  5852. __Pyx_XGIVEREF(__pyx_t_14);
  5853. __Pyx_XGIVEREF(__pyx_t_15);
  5854. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  5855. goto __pyx_L3_error;
  5856. __pyx_L23_exception_handled:;
  5857. __Pyx_XGIVEREF(__pyx_t_13);
  5858. __Pyx_XGIVEREF(__pyx_t_14);
  5859. __Pyx_XGIVEREF(__pyx_t_15);
  5860. __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  5861. __pyx_L29_try_end:;
  5862. }
  5863. }
  5864. /*finally:*/ {
  5865. /*normal exit:*/{
  5866. if (__pyx_t_12) {
  5867. __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__17, NULL);
  5868. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  5869. if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5870. __Pyx_GOTREF(__pyx_t_15);
  5871. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  5872. }
  5873. goto __pyx_L21;
  5874. }
  5875. __pyx_L21:;
  5876. }
  5877. goto __pyx_L36;
  5878. __pyx_L16_error:;
  5879. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  5880. goto __pyx_L3_error;
  5881. __pyx_L36:;
  5882. }
  5883. /* "lib/Naked/toolshed/c/network.pyx":269
  5884. * f.flush()
  5885. * os.fsync(f.fileno()) # flush all internal buffers to disk
  5886. * if not suppress_output: # <<<<<<<<<<<<<<
  5887. * print(" ")
  5888. * print("Download complete.") # provide user with completion information
  5889. */
  5890. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_suppress_output); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5891. __pyx_t_5 = ((!__pyx_t_9) != 0);
  5892. if (__pyx_t_5) {
  5893. /* "lib/Naked/toolshed/c/network.pyx":270
  5894. * os.fsync(f.fileno()) # flush all internal buffers to disk
  5895. * if not suppress_output:
  5896. * print(" ") # <<<<<<<<<<<<<<
  5897. * print("Download complete.") # provide user with completion information
  5898. * return True # return True if successful write
  5899. */
  5900. if (__Pyx_PrintOne(0, __pyx_kp_s__6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5901. /* "lib/Naked/toolshed/c/network.pyx":271
  5902. * if not suppress_output:
  5903. * print(" ")
  5904. * print("Download complete.") # provide user with completion information # <<<<<<<<<<<<<<
  5905. * return True # return True if successful write
  5906. * except requests.exceptions.ConnectionError as ce:
  5907. */
  5908. if (__Pyx_PrintOne(0, __pyx_kp_s_Download_complete) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5909. goto __pyx_L37;
  5910. }
  5911. __pyx_L37:;
  5912. /* "lib/Naked/toolshed/c/network.pyx":272
  5913. * print(" ")
  5914. * print("Download complete.") # provide user with completion information
  5915. * return True # return True if successful write # <<<<<<<<<<<<<<
  5916. * except requests.exceptions.ConnectionError as ce:
  5917. * return False
  5918. */
  5919. __Pyx_XDECREF(__pyx_r);
  5920. __Pyx_INCREF(Py_True);
  5921. __pyx_r = Py_True;
  5922. goto __pyx_L7_try_return;
  5923. }
  5924. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  5925. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5926. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  5927. goto __pyx_L10_try_end;
  5928. __pyx_L3_error:;
  5929. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  5930. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  5931. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  5932. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  5933. /* "lib/Naked/toolshed/c/network.pyx":273
  5934. * print("Download complete.") # provide user with completion information
  5935. * return True # return True if successful write
  5936. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  5937. * return False
  5938. * except Exception as e:
  5939. */
  5940. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5941. __Pyx_GOTREF(__pyx_t_11);
  5942. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5943. __Pyx_GOTREF(__pyx_t_10);
  5944. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5945. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5946. __Pyx_GOTREF(__pyx_t_11);
  5947. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5948. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_t_11);
  5949. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5950. if (__pyx_t_18) {
  5951. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5952. if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5953. __Pyx_GOTREF(__pyx_t_11);
  5954. __Pyx_GOTREF(__pyx_t_10);
  5955. __Pyx_GOTREF(__pyx_t_4);
  5956. __Pyx_INCREF(__pyx_t_10);
  5957. __pyx_v_ce = __pyx_t_10;
  5958. /* "lib/Naked/toolshed/c/network.pyx":274
  5959. * return True # return True if successful write
  5960. * except requests.exceptions.ConnectionError as ce:
  5961. * return False # <<<<<<<<<<<<<<
  5962. * except Exception as e:
  5963. * if DEBUG_FLAG:
  5964. */
  5965. __Pyx_XDECREF(__pyx_r);
  5966. __Pyx_INCREF(Py_False);
  5967. __pyx_r = Py_False;
  5968. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5969. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5970. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5971. goto __pyx_L6_except_return;
  5972. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  5973. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  5974. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5975. goto __pyx_L4_exception_handled;
  5976. }
  5977. /* "lib/Naked/toolshed/c/network.pyx":275
  5978. * except requests.exceptions.ConnectionError as ce:
  5979. * return False
  5980. * except Exception as e: # <<<<<<<<<<<<<<
  5981. * if DEBUG_FLAG:
  5982. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
  5983. */
  5984. __pyx_t_18 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  5985. if (__pyx_t_18) {
  5986. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5987. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_10, &__pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  5988. __Pyx_GOTREF(__pyx_t_4);
  5989. __Pyx_GOTREF(__pyx_t_10);
  5990. __Pyx_GOTREF(__pyx_t_11);
  5991. __Pyx_INCREF(__pyx_t_10);
  5992. __pyx_v_e = __pyx_t_10;
  5993. /* "lib/Naked/toolshed/c/network.pyx":276
  5994. * return False
  5995. * except Exception as e:
  5996. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  5997. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
  5998. * raise e
  5999. */
  6000. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6001. __Pyx_GOTREF(__pyx_t_7);
  6002. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6003. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6004. if (__pyx_t_5) {
  6005. /* "lib/Naked/toolshed/c/network.pyx":277
  6006. * except Exception as e:
  6007. * if DEBUG_FLAG:
  6008. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)") # <<<<<<<<<<<<<<
  6009. * raise e
  6010. *
  6011. */
  6012. __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6013. __Pyx_GOTREF(__pyx_t_7);
  6014. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stderr); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6015. __Pyx_GOTREF(__pyx_t_19);
  6016. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6017. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_19, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6018. __Pyx_GOTREF(__pyx_t_7);
  6019. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  6020. __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_url); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6021. __Pyx_GOTREF(__pyx_t_19);
  6022. __pyx_t_20 = PyNumber_Add(__pyx_kp_s_Naked_Framework_Error_Unable_to_6, __pyx_t_19); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6023. __Pyx_GOTREF(__pyx_t_20);
  6024. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  6025. __pyx_t_19 = PyNumber_Add(__pyx_t_20, __pyx_kp_s_using_the_post_data_write_bin_m); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6026. __Pyx_GOTREF(__pyx_t_19);
  6027. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  6028. __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6029. __Pyx_GOTREF(__pyx_t_20);
  6030. PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
  6031. __Pyx_GIVEREF(__pyx_t_19);
  6032. __pyx_t_19 = 0;
  6033. __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_20, NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6034. __Pyx_GOTREF(__pyx_t_19);
  6035. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6036. __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  6037. __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  6038. goto __pyx_L42;
  6039. }
  6040. __pyx_L42:;
  6041. /* "lib/Naked/toolshed/c/network.pyx":278
  6042. * if DEBUG_FLAG:
  6043. * sys.stderr.write("Naked Framework Error: Unable to perform POST request and write file with the URL " + self.url + " using the post_data_write_bin() method (Naked.toolshed.network.py)")
  6044. * raise e # <<<<<<<<<<<<<<
  6045. *
  6046. * #------------------------------------------------------------------------------
  6047. */
  6048. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  6049. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6050. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6051. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6052. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6053. goto __pyx_L4_exception_handled;
  6054. }
  6055. goto __pyx_L5_except_error;
  6056. __pyx_L5_except_error:;
  6057. __Pyx_XGIVEREF(__pyx_t_1);
  6058. __Pyx_XGIVEREF(__pyx_t_2);
  6059. __Pyx_XGIVEREF(__pyx_t_3);
  6060. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6061. goto __pyx_L1_error;
  6062. __pyx_L7_try_return:;
  6063. __Pyx_XGIVEREF(__pyx_t_1);
  6064. __Pyx_XGIVEREF(__pyx_t_2);
  6065. __Pyx_XGIVEREF(__pyx_t_3);
  6066. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6067. goto __pyx_L0;
  6068. __pyx_L6_except_return:;
  6069. __Pyx_XGIVEREF(__pyx_t_1);
  6070. __Pyx_XGIVEREF(__pyx_t_2);
  6071. __Pyx_XGIVEREF(__pyx_t_3);
  6072. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6073. goto __pyx_L0;
  6074. __pyx_L4_exception_handled:;
  6075. __Pyx_XGIVEREF(__pyx_t_1);
  6076. __Pyx_XGIVEREF(__pyx_t_2);
  6077. __Pyx_XGIVEREF(__pyx_t_3);
  6078. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6079. __pyx_L10_try_end:;
  6080. }
  6081. /* "lib/Naked/toolshed/c/network.pyx":245
  6082. * # returns a boolean that indicates the success of the file write
  6083. * #------------------------------------------------------------------------------
  6084. * def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  6085. * try:
  6086. * import os # used for os.fsync() method in the write
  6087. */
  6088. /* function exit code */
  6089. __pyx_L1_error:;
  6090. __Pyx_XDECREF(__pyx_t_4);
  6091. __Pyx_XDECREF(__pyx_t_7);
  6092. __Pyx_XDECREF(__pyx_t_10);
  6093. __Pyx_XDECREF(__pyx_t_11);
  6094. __Pyx_XDECREF(__pyx_t_19);
  6095. __Pyx_XDECREF(__pyx_t_20);
  6096. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_txt_write_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6097. __pyx_r = NULL;
  6098. __pyx_L0:;
  6099. __Pyx_XDECREF(__pyx_v_os);
  6100. __Pyx_XDECREF(__pyx_v_file_exists);
  6101. __Pyx_XDECREF(__pyx_v_response);
  6102. __Pyx_XDECREF(__pyx_v_codecs);
  6103. __Pyx_XDECREF(__pyx_v_f);
  6104. __Pyx_XDECREF(__pyx_v_chunk);
  6105. __Pyx_XDECREF(__pyx_v_ce);
  6106. __Pyx_XDECREF(__pyx_v_e);
  6107. __Pyx_XDECREF(__pyx_v_filepath);
  6108. __Pyx_XGIVEREF(__pyx_r);
  6109. __Pyx_RefNannyFinishContext();
  6110. return __pyx_r;
  6111. }
  6112. /* "lib/Naked/toolshed/c/network.pyx":287
  6113. * # Tests: test_NETWORK.py :: test_http_get_response_check
  6114. * #------------------------------------------------------------------------------
  6115. * def response(self): # <<<<<<<<<<<<<<
  6116. * try:
  6117. * return self.res
  6118. */
  6119. /* Python wrapper */
  6120. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_21response(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  6121. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_21response = {__Pyx_NAMESTR("response"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_21response, METH_O, __Pyx_DOCSTR(0)};
  6122. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_21response(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  6123. PyObject *__pyx_r = 0;
  6124. __Pyx_RefNannyDeclarations
  6125. __Pyx_RefNannySetupContext("response (wrapper)", 0);
  6126. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_20response(__pyx_self, ((PyObject *)__pyx_v_self));
  6127. /* function exit code */
  6128. __Pyx_RefNannyFinishContext();
  6129. return __pyx_r;
  6130. }
  6131. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_20response(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  6132. PyObject *__pyx_v_e = NULL;
  6133. PyObject *__pyx_r = NULL;
  6134. __Pyx_RefNannyDeclarations
  6135. PyObject *__pyx_t_1 = NULL;
  6136. PyObject *__pyx_t_2 = NULL;
  6137. PyObject *__pyx_t_3 = NULL;
  6138. PyObject *__pyx_t_4 = NULL;
  6139. int __pyx_t_5;
  6140. PyObject *__pyx_t_6 = NULL;
  6141. PyObject *__pyx_t_7 = NULL;
  6142. PyObject *__pyx_t_8 = NULL;
  6143. int __pyx_t_9;
  6144. PyObject *__pyx_t_10 = NULL;
  6145. int __pyx_lineno = 0;
  6146. const char *__pyx_filename = NULL;
  6147. int __pyx_clineno = 0;
  6148. __Pyx_RefNannySetupContext("response", 0);
  6149. /* "lib/Naked/toolshed/c/network.pyx":288
  6150. * #------------------------------------------------------------------------------
  6151. * def response(self):
  6152. * try: # <<<<<<<<<<<<<<
  6153. * return self.res
  6154. * except Exception as e:
  6155. */
  6156. {
  6157. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  6158. __Pyx_XGOTREF(__pyx_t_1);
  6159. __Pyx_XGOTREF(__pyx_t_2);
  6160. __Pyx_XGOTREF(__pyx_t_3);
  6161. /*try:*/ {
  6162. /* "lib/Naked/toolshed/c/network.pyx":289
  6163. * def response(self):
  6164. * try:
  6165. * return self.res # <<<<<<<<<<<<<<
  6166. * except Exception as e:
  6167. * if DEBUG_FLAG:
  6168. */
  6169. __Pyx_XDECREF(__pyx_r);
  6170. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6171. __Pyx_GOTREF(__pyx_t_4);
  6172. __pyx_r = __pyx_t_4;
  6173. __pyx_t_4 = 0;
  6174. goto __pyx_L7_try_return;
  6175. }
  6176. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  6177. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6178. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6179. goto __pyx_L10_try_end;
  6180. __pyx_L3_error:;
  6181. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6182. /* "lib/Naked/toolshed/c/network.pyx":290
  6183. * try:
  6184. * return self.res
  6185. * except Exception as e: # <<<<<<<<<<<<<<
  6186. * if DEBUG_FLAG:
  6187. * sys.stderr.write("Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).")
  6188. */
  6189. __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  6190. if (__pyx_t_5) {
  6191. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6192. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6193. __Pyx_GOTREF(__pyx_t_4);
  6194. __Pyx_GOTREF(__pyx_t_6);
  6195. __Pyx_GOTREF(__pyx_t_7);
  6196. __Pyx_INCREF(__pyx_t_6);
  6197. __pyx_v_e = __pyx_t_6;
  6198. /* "lib/Naked/toolshed/c/network.pyx":291
  6199. * return self.res
  6200. * except Exception as e:
  6201. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  6202. * sys.stderr.write("Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).")
  6203. * raise e
  6204. */
  6205. __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6206. __Pyx_GOTREF(__pyx_t_8);
  6207. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6208. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6209. if (__pyx_t_9) {
  6210. /* "lib/Naked/toolshed/c/network.pyx":292
  6211. * except Exception as e:
  6212. * if DEBUG_FLAG:
  6213. * sys.stderr.write("Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  6214. * raise e
  6215. *
  6216. */
  6217. __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6218. __Pyx_GOTREF(__pyx_t_8);
  6219. __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6220. __Pyx_GOTREF(__pyx_t_10);
  6221. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6222. __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6223. __Pyx_GOTREF(__pyx_t_8);
  6224. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6225. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6226. __Pyx_GOTREF(__pyx_t_10);
  6227. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6228. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6229. goto __pyx_L13;
  6230. }
  6231. __pyx_L13:;
  6232. /* "lib/Naked/toolshed/c/network.pyx":293
  6233. * if DEBUG_FLAG:
  6234. * sys.stderr.write("Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).")
  6235. * raise e # <<<<<<<<<<<<<<
  6236. *
  6237. * #------------------------------------------------------------------------------
  6238. */
  6239. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  6240. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6241. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6242. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6243. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6244. goto __pyx_L4_exception_handled;
  6245. }
  6246. goto __pyx_L5_except_error;
  6247. __pyx_L5_except_error:;
  6248. __Pyx_XGIVEREF(__pyx_t_1);
  6249. __Pyx_XGIVEREF(__pyx_t_2);
  6250. __Pyx_XGIVEREF(__pyx_t_3);
  6251. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6252. goto __pyx_L1_error;
  6253. __pyx_L7_try_return:;
  6254. __Pyx_XGIVEREF(__pyx_t_1);
  6255. __Pyx_XGIVEREF(__pyx_t_2);
  6256. __Pyx_XGIVEREF(__pyx_t_3);
  6257. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6258. goto __pyx_L0;
  6259. __pyx_L4_exception_handled:;
  6260. __Pyx_XGIVEREF(__pyx_t_1);
  6261. __Pyx_XGIVEREF(__pyx_t_2);
  6262. __Pyx_XGIVEREF(__pyx_t_3);
  6263. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6264. __pyx_L10_try_end:;
  6265. }
  6266. /* "lib/Naked/toolshed/c/network.pyx":287
  6267. * # Tests: test_NETWORK.py :: test_http_get_response_check
  6268. * #------------------------------------------------------------------------------
  6269. * def response(self): # <<<<<<<<<<<<<<
  6270. * try:
  6271. * return self.res
  6272. */
  6273. /* function exit code */
  6274. __pyx_L1_error:;
  6275. __Pyx_XDECREF(__pyx_t_4);
  6276. __Pyx_XDECREF(__pyx_t_6);
  6277. __Pyx_XDECREF(__pyx_t_7);
  6278. __Pyx_XDECREF(__pyx_t_8);
  6279. __Pyx_XDECREF(__pyx_t_10);
  6280. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6281. __pyx_r = NULL;
  6282. __pyx_L0:;
  6283. __Pyx_XDECREF(__pyx_v_e);
  6284. __Pyx_XGIVEREF(__pyx_r);
  6285. __Pyx_RefNannyFinishContext();
  6286. return __pyx_r;
  6287. }
  6288. /* "lib/Naked/toolshed/c/network.pyx":301
  6289. * # Tests: test_NETWORK.py ::
  6290. * #------------------------------------------------------------------------------
  6291. * def get_status_ok(self): # <<<<<<<<<<<<<<
  6292. * try:
  6293. * self.get() #run the get request
  6294. */
  6295. /* Python wrapper */
  6296. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_23get_status_ok(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  6297. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_23get_status_ok = {__Pyx_NAMESTR("get_status_ok"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_23get_status_ok, METH_O, __Pyx_DOCSTR(0)};
  6298. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_23get_status_ok(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  6299. PyObject *__pyx_r = 0;
  6300. __Pyx_RefNannyDeclarations
  6301. __Pyx_RefNannySetupContext("get_status_ok (wrapper)", 0);
  6302. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_22get_status_ok(__pyx_self, ((PyObject *)__pyx_v_self));
  6303. /* function exit code */
  6304. __Pyx_RefNannyFinishContext();
  6305. return __pyx_r;
  6306. }
  6307. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_22get_status_ok(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  6308. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  6309. PyObject *__pyx_v_e = NULL;
  6310. PyObject *__pyx_r = NULL;
  6311. __Pyx_RefNannyDeclarations
  6312. PyObject *__pyx_t_1 = NULL;
  6313. PyObject *__pyx_t_2 = NULL;
  6314. PyObject *__pyx_t_3 = NULL;
  6315. PyObject *__pyx_t_4 = NULL;
  6316. PyObject *__pyx_t_5 = NULL;
  6317. int __pyx_t_6;
  6318. int __pyx_t_7;
  6319. int __pyx_t_8;
  6320. PyObject *__pyx_t_9 = NULL;
  6321. int __pyx_t_10;
  6322. PyObject *__pyx_t_11 = NULL;
  6323. PyObject *__pyx_t_12 = NULL;
  6324. int __pyx_lineno = 0;
  6325. const char *__pyx_filename = NULL;
  6326. int __pyx_clineno = 0;
  6327. __Pyx_RefNannySetupContext("get_status_ok", 0);
  6328. /* "lib/Naked/toolshed/c/network.pyx":302
  6329. * #------------------------------------------------------------------------------
  6330. * def get_status_ok(self):
  6331. * try: # <<<<<<<<<<<<<<
  6332. * self.get() #run the get request
  6333. * if self.res and self.res.status_code:
  6334. */
  6335. {
  6336. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  6337. __Pyx_XGOTREF(__pyx_t_1);
  6338. __Pyx_XGOTREF(__pyx_t_2);
  6339. __Pyx_XGOTREF(__pyx_t_3);
  6340. /*try:*/ {
  6341. /* "lib/Naked/toolshed/c/network.pyx":303
  6342. * def get_status_ok(self):
  6343. * try:
  6344. * self.get() #run the get request # <<<<<<<<<<<<<<
  6345. * if self.res and self.res.status_code:
  6346. * return (self.res.status_code == requests.codes.ok)
  6347. */
  6348. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6349. __Pyx_GOTREF(__pyx_t_4);
  6350. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6351. __Pyx_GOTREF(__pyx_t_5);
  6352. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6353. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6354. /* "lib/Naked/toolshed/c/network.pyx":304
  6355. * try:
  6356. * self.get() #run the get request
  6357. * if self.res and self.res.status_code: # <<<<<<<<<<<<<<
  6358. * return (self.res.status_code == requests.codes.ok)
  6359. * else:
  6360. */
  6361. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6362. __Pyx_GOTREF(__pyx_t_5);
  6363. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6364. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6365. if (__pyx_t_6) {
  6366. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6367. __Pyx_GOTREF(__pyx_t_5);
  6368. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_status_code); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6369. __Pyx_GOTREF(__pyx_t_4);
  6370. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6371. __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6372. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6373. __pyx_t_8 = __pyx_t_7;
  6374. } else {
  6375. __pyx_t_8 = __pyx_t_6;
  6376. }
  6377. if (__pyx_t_8) {
  6378. /* "lib/Naked/toolshed/c/network.pyx":305
  6379. * self.get() #run the get request
  6380. * if self.res and self.res.status_code:
  6381. * return (self.res.status_code == requests.codes.ok) # <<<<<<<<<<<<<<
  6382. * else:
  6383. * return False
  6384. */
  6385. __Pyx_XDECREF(__pyx_r);
  6386. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6387. __Pyx_GOTREF(__pyx_t_4);
  6388. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_status_code); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6389. __Pyx_GOTREF(__pyx_t_5);
  6390. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6391. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6392. __Pyx_GOTREF(__pyx_t_4);
  6393. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_codes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6394. __Pyx_GOTREF(__pyx_t_9);
  6395. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6396. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ok); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6397. __Pyx_GOTREF(__pyx_t_4);
  6398. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6399. __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6400. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6401. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6402. __pyx_r = __pyx_t_9;
  6403. __pyx_t_9 = 0;
  6404. goto __pyx_L7_try_return;
  6405. }
  6406. /*else*/ {
  6407. /* "lib/Naked/toolshed/c/network.pyx":307
  6408. * return (self.res.status_code == requests.codes.ok)
  6409. * else:
  6410. * return False # <<<<<<<<<<<<<<
  6411. * except requests.exceptions.ConnectionError as ce:
  6412. * return False
  6413. */
  6414. __Pyx_XDECREF(__pyx_r);
  6415. __Pyx_INCREF(Py_False);
  6416. __pyx_r = Py_False;
  6417. goto __pyx_L7_try_return;
  6418. }
  6419. }
  6420. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  6421. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6422. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6423. goto __pyx_L10_try_end;
  6424. __pyx_L3_error:;
  6425. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6426. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6427. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  6428. /* "lib/Naked/toolshed/c/network.pyx":308
  6429. * else:
  6430. * return False
  6431. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  6432. * return False
  6433. * except Exception as e:
  6434. */
  6435. __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6436. __Pyx_GOTREF(__pyx_t_9);
  6437. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6438. __Pyx_GOTREF(__pyx_t_4);
  6439. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6440. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6441. __Pyx_GOTREF(__pyx_t_9);
  6442. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6443. __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_9);
  6444. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6445. if (__pyx_t_10) {
  6446. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_status_ok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6447. if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6448. __Pyx_GOTREF(__pyx_t_9);
  6449. __Pyx_GOTREF(__pyx_t_4);
  6450. __Pyx_GOTREF(__pyx_t_5);
  6451. __Pyx_INCREF(__pyx_t_4);
  6452. __pyx_v_ce = __pyx_t_4;
  6453. /* "lib/Naked/toolshed/c/network.pyx":309
  6454. * return False
  6455. * except requests.exceptions.ConnectionError as ce:
  6456. * return False # <<<<<<<<<<<<<<
  6457. * except Exception as e:
  6458. * if DEBUG_FLAG:
  6459. */
  6460. __Pyx_XDECREF(__pyx_r);
  6461. __Pyx_INCREF(Py_False);
  6462. __pyx_r = Py_False;
  6463. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6464. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6465. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6466. goto __pyx_L6_except_return;
  6467. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6468. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6469. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6470. goto __pyx_L4_exception_handled;
  6471. }
  6472. /* "lib/Naked/toolshed/c/network.pyx":310
  6473. * except requests.exceptions.ConnectionError as ce:
  6474. * return False
  6475. * except Exception as e: # <<<<<<<<<<<<<<
  6476. * if DEBUG_FLAG:
  6477. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).")
  6478. */
  6479. __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  6480. if (__pyx_t_10) {
  6481. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_status_ok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6482. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6483. __Pyx_GOTREF(__pyx_t_5);
  6484. __Pyx_GOTREF(__pyx_t_4);
  6485. __Pyx_GOTREF(__pyx_t_9);
  6486. __Pyx_INCREF(__pyx_t_4);
  6487. __pyx_v_e = __pyx_t_4;
  6488. /* "lib/Naked/toolshed/c/network.pyx":311
  6489. * return False
  6490. * except Exception as e:
  6491. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  6492. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).")
  6493. * raise e
  6494. */
  6495. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6496. __Pyx_GOTREF(__pyx_t_11);
  6497. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6498. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6499. if (__pyx_t_8) {
  6500. /* "lib/Naked/toolshed/c/network.pyx":312
  6501. * except Exception as e:
  6502. * if DEBUG_FLAG:
  6503. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  6504. * raise e
  6505. *
  6506. */
  6507. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6508. __Pyx_GOTREF(__pyx_t_11);
  6509. __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_stderr); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6510. __Pyx_GOTREF(__pyx_t_12);
  6511. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6512. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6513. __Pyx_GOTREF(__pyx_t_11);
  6514. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6515. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6516. __Pyx_GOTREF(__pyx_t_12);
  6517. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6518. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6519. goto __pyx_L16;
  6520. }
  6521. __pyx_L16:;
  6522. /* "lib/Naked/toolshed/c/network.pyx":313
  6523. * if DEBUG_FLAG:
  6524. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).")
  6525. * raise e # <<<<<<<<<<<<<<
  6526. *
  6527. * #------------------------------------------------------------------------------
  6528. */
  6529. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  6530. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6531. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6532. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6533. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6534. goto __pyx_L4_exception_handled;
  6535. }
  6536. goto __pyx_L5_except_error;
  6537. __pyx_L5_except_error:;
  6538. __Pyx_XGIVEREF(__pyx_t_1);
  6539. __Pyx_XGIVEREF(__pyx_t_2);
  6540. __Pyx_XGIVEREF(__pyx_t_3);
  6541. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6542. goto __pyx_L1_error;
  6543. __pyx_L7_try_return:;
  6544. __Pyx_XGIVEREF(__pyx_t_1);
  6545. __Pyx_XGIVEREF(__pyx_t_2);
  6546. __Pyx_XGIVEREF(__pyx_t_3);
  6547. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6548. goto __pyx_L0;
  6549. __pyx_L6_except_return:;
  6550. __Pyx_XGIVEREF(__pyx_t_1);
  6551. __Pyx_XGIVEREF(__pyx_t_2);
  6552. __Pyx_XGIVEREF(__pyx_t_3);
  6553. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6554. goto __pyx_L0;
  6555. __pyx_L4_exception_handled:;
  6556. __Pyx_XGIVEREF(__pyx_t_1);
  6557. __Pyx_XGIVEREF(__pyx_t_2);
  6558. __Pyx_XGIVEREF(__pyx_t_3);
  6559. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6560. __pyx_L10_try_end:;
  6561. }
  6562. /* "lib/Naked/toolshed/c/network.pyx":301
  6563. * # Tests: test_NETWORK.py ::
  6564. * #------------------------------------------------------------------------------
  6565. * def get_status_ok(self): # <<<<<<<<<<<<<<
  6566. * try:
  6567. * self.get() #run the get request
  6568. */
  6569. /* function exit code */
  6570. __pyx_L1_error:;
  6571. __Pyx_XDECREF(__pyx_t_4);
  6572. __Pyx_XDECREF(__pyx_t_5);
  6573. __Pyx_XDECREF(__pyx_t_9);
  6574. __Pyx_XDECREF(__pyx_t_11);
  6575. __Pyx_XDECREF(__pyx_t_12);
  6576. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.get_status_ok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6577. __pyx_r = NULL;
  6578. __pyx_L0:;
  6579. __Pyx_XDECREF(__pyx_v_ce);
  6580. __Pyx_XDECREF(__pyx_v_e);
  6581. __Pyx_XGIVEREF(__pyx_r);
  6582. __Pyx_RefNannyFinishContext();
  6583. return __pyx_r;
  6584. }
  6585. /* "lib/Naked/toolshed/c/network.pyx":320
  6586. * # Note: method runs its own post method, not necessary to run separately
  6587. * #------------------------------------------------------------------------------
  6588. * def post_status_ok(self): # <<<<<<<<<<<<<<
  6589. * try:
  6590. * self.post() #run the post request
  6591. */
  6592. /* Python wrapper */
  6593. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_25post_status_ok(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  6594. static PyMethodDef __pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_25post_status_ok = {__Pyx_NAMESTR("post_status_ok"), (PyCFunction)__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_25post_status_ok, METH_O, __Pyx_DOCSTR(0)};
  6595. static PyObject *__pyx_pw_3lib_5Naked_8toolshed_1c_7network_4HTTP_25post_status_ok(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  6596. PyObject *__pyx_r = 0;
  6597. __Pyx_RefNannyDeclarations
  6598. __Pyx_RefNannySetupContext("post_status_ok (wrapper)", 0);
  6599. __pyx_r = __pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_24post_status_ok(__pyx_self, ((PyObject *)__pyx_v_self));
  6600. /* function exit code */
  6601. __Pyx_RefNannyFinishContext();
  6602. return __pyx_r;
  6603. }
  6604. static PyObject *__pyx_pf_3lib_5Naked_8toolshed_1c_7network_4HTTP_24post_status_ok(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  6605. CYTHON_UNUSED PyObject *__pyx_v_ce = NULL;
  6606. PyObject *__pyx_v_e = NULL;
  6607. PyObject *__pyx_r = NULL;
  6608. __Pyx_RefNannyDeclarations
  6609. PyObject *__pyx_t_1 = NULL;
  6610. PyObject *__pyx_t_2 = NULL;
  6611. PyObject *__pyx_t_3 = NULL;
  6612. PyObject *__pyx_t_4 = NULL;
  6613. PyObject *__pyx_t_5 = NULL;
  6614. int __pyx_t_6;
  6615. int __pyx_t_7;
  6616. int __pyx_t_8;
  6617. PyObject *__pyx_t_9 = NULL;
  6618. int __pyx_t_10;
  6619. PyObject *__pyx_t_11 = NULL;
  6620. PyObject *__pyx_t_12 = NULL;
  6621. int __pyx_lineno = 0;
  6622. const char *__pyx_filename = NULL;
  6623. int __pyx_clineno = 0;
  6624. __Pyx_RefNannySetupContext("post_status_ok", 0);
  6625. /* "lib/Naked/toolshed/c/network.pyx":321
  6626. * #------------------------------------------------------------------------------
  6627. * def post_status_ok(self):
  6628. * try: # <<<<<<<<<<<<<<
  6629. * self.post() #run the post request
  6630. * if self.res and self.res.status_code:
  6631. */
  6632. {
  6633. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  6634. __Pyx_XGOTREF(__pyx_t_1);
  6635. __Pyx_XGOTREF(__pyx_t_2);
  6636. __Pyx_XGOTREF(__pyx_t_3);
  6637. /*try:*/ {
  6638. /* "lib/Naked/toolshed/c/network.pyx":322
  6639. * def post_status_ok(self):
  6640. * try:
  6641. * self.post() #run the post request # <<<<<<<<<<<<<<
  6642. * if self.res and self.res.status_code:
  6643. * return (self.res.status_code == requests.codes.ok)
  6644. */
  6645. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_post); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6646. __Pyx_GOTREF(__pyx_t_4);
  6647. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6648. __Pyx_GOTREF(__pyx_t_5);
  6649. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6650. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6651. /* "lib/Naked/toolshed/c/network.pyx":323
  6652. * try:
  6653. * self.post() #run the post request
  6654. * if self.res and self.res.status_code: # <<<<<<<<<<<<<<
  6655. * return (self.res.status_code == requests.codes.ok)
  6656. * else:
  6657. */
  6658. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6659. __Pyx_GOTREF(__pyx_t_5);
  6660. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6661. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6662. if (__pyx_t_6) {
  6663. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6664. __Pyx_GOTREF(__pyx_t_5);
  6665. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_status_code); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6666. __Pyx_GOTREF(__pyx_t_4);
  6667. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6668. __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6669. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6670. __pyx_t_8 = __pyx_t_7;
  6671. } else {
  6672. __pyx_t_8 = __pyx_t_6;
  6673. }
  6674. if (__pyx_t_8) {
  6675. /* "lib/Naked/toolshed/c/network.pyx":324
  6676. * self.post() #run the post request
  6677. * if self.res and self.res.status_code:
  6678. * return (self.res.status_code == requests.codes.ok) # <<<<<<<<<<<<<<
  6679. * else:
  6680. * return False
  6681. */
  6682. __Pyx_XDECREF(__pyx_r);
  6683. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_res); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6684. __Pyx_GOTREF(__pyx_t_4);
  6685. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_status_code); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6686. __Pyx_GOTREF(__pyx_t_5);
  6687. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6688. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6689. __Pyx_GOTREF(__pyx_t_4);
  6690. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_codes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6691. __Pyx_GOTREF(__pyx_t_9);
  6692. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6693. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ok); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6694. __Pyx_GOTREF(__pyx_t_4);
  6695. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6696. __pyx_t_9 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6697. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6698. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6699. __pyx_r = __pyx_t_9;
  6700. __pyx_t_9 = 0;
  6701. goto __pyx_L7_try_return;
  6702. }
  6703. /*else*/ {
  6704. /* "lib/Naked/toolshed/c/network.pyx":326
  6705. * return (self.res.status_code == requests.codes.ok)
  6706. * else:
  6707. * return False # <<<<<<<<<<<<<<
  6708. * except requests.exceptions.ConnectionError as ce:
  6709. * return False
  6710. */
  6711. __Pyx_XDECREF(__pyx_r);
  6712. __Pyx_INCREF(Py_False);
  6713. __pyx_r = Py_False;
  6714. goto __pyx_L7_try_return;
  6715. }
  6716. }
  6717. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  6718. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6719. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6720. goto __pyx_L10_try_end;
  6721. __pyx_L3_error:;
  6722. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6723. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6724. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  6725. /* "lib/Naked/toolshed/c/network.pyx":327
  6726. * else:
  6727. * return False
  6728. * except requests.exceptions.ConnectionError as ce: # <<<<<<<<<<<<<<
  6729. * return False
  6730. * except Exception as e:
  6731. */
  6732. __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_requests); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6733. __Pyx_GOTREF(__pyx_t_9);
  6734. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_exceptions); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6735. __Pyx_GOTREF(__pyx_t_4);
  6736. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6737. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ConnectionError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6738. __Pyx_GOTREF(__pyx_t_9);
  6739. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6740. __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_9);
  6741. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6742. if (__pyx_t_10) {
  6743. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_status_ok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6744. if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6745. __Pyx_GOTREF(__pyx_t_9);
  6746. __Pyx_GOTREF(__pyx_t_4);
  6747. __Pyx_GOTREF(__pyx_t_5);
  6748. __Pyx_INCREF(__pyx_t_4);
  6749. __pyx_v_ce = __pyx_t_4;
  6750. /* "lib/Naked/toolshed/c/network.pyx":328
  6751. * return False
  6752. * except requests.exceptions.ConnectionError as ce:
  6753. * return False # <<<<<<<<<<<<<<
  6754. * except Exception as e:
  6755. * if DEBUG_FLAG:
  6756. */
  6757. __Pyx_XDECREF(__pyx_r);
  6758. __Pyx_INCREF(Py_False);
  6759. __pyx_r = Py_False;
  6760. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6761. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6762. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6763. goto __pyx_L6_except_return;
  6764. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6765. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6766. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6767. goto __pyx_L4_exception_handled;
  6768. }
  6769. /* "lib/Naked/toolshed/c/network.pyx":329
  6770. * except requests.exceptions.ConnectionError as ce:
  6771. * return False
  6772. * except Exception as e: # <<<<<<<<<<<<<<
  6773. * if DEBUG_FLAG:
  6774. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).")
  6775. */
  6776. __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
  6777. if (__pyx_t_10) {
  6778. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_status_ok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6779. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6780. __Pyx_GOTREF(__pyx_t_5);
  6781. __Pyx_GOTREF(__pyx_t_4);
  6782. __Pyx_GOTREF(__pyx_t_9);
  6783. __Pyx_INCREF(__pyx_t_4);
  6784. __pyx_v_e = __pyx_t_4;
  6785. /* "lib/Naked/toolshed/c/network.pyx":330
  6786. * return False
  6787. * except Exception as e:
  6788. * if DEBUG_FLAG: # <<<<<<<<<<<<<<
  6789. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).")
  6790. * raise e
  6791. */
  6792. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_FLAG); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6793. __Pyx_GOTREF(__pyx_t_11);
  6794. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6795. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6796. if (__pyx_t_8) {
  6797. /* "lib/Naked/toolshed/c/network.pyx":331
  6798. * except Exception as e:
  6799. * if DEBUG_FLAG:
  6800. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  6801. * raise e
  6802. *
  6803. */
  6804. __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6805. __Pyx_GOTREF(__pyx_t_11);
  6806. __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_stderr); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6807. __Pyx_GOTREF(__pyx_t_12);
  6808. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6809. __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_write); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6810. __Pyx_GOTREF(__pyx_t_11);
  6811. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6812. __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6813. __Pyx_GOTREF(__pyx_t_12);
  6814. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  6815. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  6816. goto __pyx_L16;
  6817. }
  6818. __pyx_L16:;
  6819. /* "lib/Naked/toolshed/c/network.pyx":332
  6820. * if DEBUG_FLAG:
  6821. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).")
  6822. * raise e # <<<<<<<<<<<<<<
  6823. *
  6824. * if __name__ == '__main__':
  6825. */
  6826. __Pyx_Raise(__pyx_v_e, 0, 0, 0);
  6827. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
  6828. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6829. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6830. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6831. goto __pyx_L4_exception_handled;
  6832. }
  6833. goto __pyx_L5_except_error;
  6834. __pyx_L5_except_error:;
  6835. __Pyx_XGIVEREF(__pyx_t_1);
  6836. __Pyx_XGIVEREF(__pyx_t_2);
  6837. __Pyx_XGIVEREF(__pyx_t_3);
  6838. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6839. goto __pyx_L1_error;
  6840. __pyx_L7_try_return:;
  6841. __Pyx_XGIVEREF(__pyx_t_1);
  6842. __Pyx_XGIVEREF(__pyx_t_2);
  6843. __Pyx_XGIVEREF(__pyx_t_3);
  6844. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6845. goto __pyx_L0;
  6846. __pyx_L6_except_return:;
  6847. __Pyx_XGIVEREF(__pyx_t_1);
  6848. __Pyx_XGIVEREF(__pyx_t_2);
  6849. __Pyx_XGIVEREF(__pyx_t_3);
  6850. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6851. goto __pyx_L0;
  6852. __pyx_L4_exception_handled:;
  6853. __Pyx_XGIVEREF(__pyx_t_1);
  6854. __Pyx_XGIVEREF(__pyx_t_2);
  6855. __Pyx_XGIVEREF(__pyx_t_3);
  6856. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6857. __pyx_L10_try_end:;
  6858. }
  6859. /* "lib/Naked/toolshed/c/network.pyx":320
  6860. * # Note: method runs its own post method, not necessary to run separately
  6861. * #------------------------------------------------------------------------------
  6862. * def post_status_ok(self): # <<<<<<<<<<<<<<
  6863. * try:
  6864. * self.post() #run the post request
  6865. */
  6866. /* function exit code */
  6867. __pyx_L1_error:;
  6868. __Pyx_XDECREF(__pyx_t_4);
  6869. __Pyx_XDECREF(__pyx_t_5);
  6870. __Pyx_XDECREF(__pyx_t_9);
  6871. __Pyx_XDECREF(__pyx_t_11);
  6872. __Pyx_XDECREF(__pyx_t_12);
  6873. __Pyx_AddTraceback("lib.Naked.toolshed.c.network.HTTP.post_status_ok", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6874. __pyx_r = NULL;
  6875. __pyx_L0:;
  6876. __Pyx_XDECREF(__pyx_v_ce);
  6877. __Pyx_XDECREF(__pyx_v_e);
  6878. __Pyx_XGIVEREF(__pyx_r);
  6879. __Pyx_RefNannyFinishContext();
  6880. return __pyx_r;
  6881. }
  6882. static PyMethodDef __pyx_methods[] = {
  6883. {0, 0, 0, 0}
  6884. };
  6885. #if PY_MAJOR_VERSION >= 3
  6886. static struct PyModuleDef __pyx_moduledef = {
  6887. #if PY_VERSION_HEX < 0x03020000
  6888. { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  6889. #else
  6890. PyModuleDef_HEAD_INIT,
  6891. #endif
  6892. __Pyx_NAMESTR("network"),
  6893. 0, /* m_doc */
  6894. -1, /* m_size */
  6895. __pyx_methods /* m_methods */,
  6896. NULL, /* m_reload */
  6897. NULL, /* m_traverse */
  6898. NULL, /* m_clear */
  6899. NULL /* m_free */
  6900. };
  6901. #endif
  6902. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  6903. {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  6904. {&__pyx_n_s_ConnectionError, __pyx_k_ConnectionError, sizeof(__pyx_k_ConnectionError), 0, 0, 1, 1},
  6905. {&__pyx_n_s_DEBUG_FLAG, __pyx_k_DEBUG_FLAG, sizeof(__pyx_k_DEBUG_FLAG), 0, 0, 1, 1},
  6906. {&__pyx_kp_s_Download_aborted_A_local_file_wi, __pyx_k_Download_aborted_A_local_file_wi, sizeof(__pyx_k_Download_aborted_A_local_file_wi), 0, 0, 1, 0},
  6907. {&__pyx_kp_s_Download_complete, __pyx_k_Download_complete, sizeof(__pyx_k_Download_complete), 0, 0, 1, 0},
  6908. {&__pyx_kp_s_Downloading_file_from, __pyx_k_Downloading_file_from, sizeof(__pyx_k_Downloading_file_from), 0, 0, 1, 0},
  6909. {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  6910. {&__pyx_n_s_HTTP, __pyx_k_HTTP, sizeof(__pyx_k_HTTP), 0, 0, 1, 1},
  6911. {&__pyx_n_s_HTTP___init, __pyx_k_HTTP___init, sizeof(__pyx_k_HTTP___init), 0, 0, 1, 1},
  6912. {&__pyx_n_s_HTTP_get, __pyx_k_HTTP_get, sizeof(__pyx_k_HTTP_get), 0, 0, 1, 1},
  6913. {&__pyx_n_s_HTTP_get_bin, __pyx_k_HTTP_get_bin, sizeof(__pyx_k_HTTP_get_bin), 0, 0, 1, 1},
  6914. {&__pyx_n_s_HTTP_get_bin_write_file, __pyx_k_HTTP_get_bin_write_file, sizeof(__pyx_k_HTTP_get_bin_write_file), 0, 0, 1, 1},
  6915. {&__pyx_n_s_HTTP_get_status_ok, __pyx_k_HTTP_get_status_ok, sizeof(__pyx_k_HTTP_get_status_ok), 0, 0, 1, 1},
  6916. {&__pyx_n_s_HTTP_get_txt_write_file, __pyx_k_HTTP_get_txt_write_file, sizeof(__pyx_k_HTTP_get_txt_write_file), 0, 0, 1, 1},
  6917. {&__pyx_n_s_HTTP_head, __pyx_k_HTTP_head, sizeof(__pyx_k_HTTP_head), 0, 0, 1, 1},
  6918. {&__pyx_n_s_HTTP_post, __pyx_k_HTTP_post, sizeof(__pyx_k_HTTP_post), 0, 0, 1, 1},
  6919. {&__pyx_n_s_HTTP_post_bin, __pyx_k_HTTP_post_bin, sizeof(__pyx_k_HTTP_post_bin), 0, 0, 1, 1},
  6920. {&__pyx_n_s_HTTP_post_bin_write_file, __pyx_k_HTTP_post_bin_write_file, sizeof(__pyx_k_HTTP_post_bin_write_file), 0, 0, 1, 1},
  6921. {&__pyx_n_s_HTTP_post_status_ok, __pyx_k_HTTP_post_status_ok, sizeof(__pyx_k_HTTP_post_status_ok), 0, 0, 1, 1},
  6922. {&__pyx_n_s_HTTP_post_txt_write_file, __pyx_k_HTTP_post_txt_write_file, sizeof(__pyx_k_HTTP_post_txt_write_file), 0, 0, 1, 1},
  6923. {&__pyx_n_s_HTTP_response, __pyx_k_HTTP_response, sizeof(__pyx_k_HTTP_response), 0, 0, 1, 1},
  6924. {&__pyx_kp_s_Naked_Framework_Error_Unable_to, __pyx_k_Naked_Framework_Error_Unable_to, sizeof(__pyx_k_Naked_Framework_Error_Unable_to), 0, 0, 1, 0},
  6925. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_2, __pyx_k_Naked_Framework_Error_Unable_to_2, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_2), 0, 0, 1, 0},
  6926. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_3, __pyx_k_Naked_Framework_Error_Unable_to_3, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_3), 0, 0, 1, 0},
  6927. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_4, __pyx_k_Naked_Framework_Error_Unable_to_4, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_4), 0, 0, 1, 0},
  6928. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_5, __pyx_k_Naked_Framework_Error_Unable_to_5, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_5), 0, 0, 1, 0},
  6929. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_6, __pyx_k_Naked_Framework_Error_Unable_to_6, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_6), 0, 0, 1, 0},
  6930. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_7, __pyx_k_Naked_Framework_Error_Unable_to_7, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_7), 0, 0, 1, 0},
  6931. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_8, __pyx_k_Naked_Framework_Error_Unable_to_8, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_8), 0, 0, 1, 0},
  6932. {&__pyx_kp_s_Naked_Framework_Error_Unable_to_9, __pyx_k_Naked_Framework_Error_Unable_to_9, sizeof(__pyx_k_Naked_Framework_Error_Unable_to_9), 0, 0, 1, 0},
  6933. {&__pyx_n_s_Naked_settings, __pyx_k_Naked_settings, sizeof(__pyx_k_Naked_settings), 0, 0, 1, 1},
  6934. {&__pyx_n_s_Naked_toolshed_system, __pyx_k_Naked_toolshed_system, sizeof(__pyx_k_Naked_toolshed_system), 0, 0, 1, 1},
  6935. {&__pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_k_Users_ces_Desktop_code_naked_li, sizeof(__pyx_k_Users_ces_Desktop_code_naked_li), 0, 0, 1, 0},
  6936. {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  6937. {&__pyx_kp_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 0},
  6938. {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0},
  6939. {&__pyx_n_s_allow_redirects, __pyx_k_allow_redirects, sizeof(__pyx_k_allow_redirects), 0, 0, 1, 1},
  6940. {&__pyx_n_s_ce, __pyx_k_ce, sizeof(__pyx_k_ce), 0, 0, 1, 1},
  6941. {&__pyx_n_s_chunk, __pyx_k_chunk, sizeof(__pyx_k_chunk), 0, 0, 1, 1},
  6942. {&__pyx_n_s_chunk_size, __pyx_k_chunk_size, sizeof(__pyx_k_chunk_size), 0, 0, 1, 1},
  6943. {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
  6944. {&__pyx_n_s_codes, __pyx_k_codes, sizeof(__pyx_k_codes), 0, 0, 1, 1},
  6945. {&__pyx_n_s_content, __pyx_k_content, sizeof(__pyx_k_content), 0, 0, 1, 1},
  6946. {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  6947. {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  6948. {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  6949. {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  6950. {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
  6951. {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  6952. {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  6953. {&__pyx_n_s_exceptions, __pyx_k_exceptions, sizeof(__pyx_k_exceptions), 0, 0, 1, 1},
  6954. {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  6955. {&__pyx_n_s_exit_2, __pyx_k_exit_2, sizeof(__pyx_k_exit_2), 0, 0, 1, 1},
  6956. {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  6957. {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  6958. {&__pyx_n_s_file_exists, __pyx_k_file_exists, sizeof(__pyx_k_file_exists), 0, 0, 1, 1},
  6959. {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1},
  6960. {&__pyx_n_s_filepath, __pyx_k_filepath, sizeof(__pyx_k_filepath), 0, 0, 1, 1},
  6961. {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
  6962. {&__pyx_n_s_follow_redirects, __pyx_k_follow_redirects, sizeof(__pyx_k_follow_redirects), 0, 0, 1, 1},
  6963. {&__pyx_n_s_fsync, __pyx_k_fsync, sizeof(__pyx_k_fsync), 0, 0, 1, 1},
  6964. {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  6965. {&__pyx_n_s_get_bin, __pyx_k_get_bin, sizeof(__pyx_k_get_bin), 0, 0, 1, 1},
  6966. {&__pyx_n_s_get_bin_write_file, __pyx_k_get_bin_write_file, sizeof(__pyx_k_get_bin_write_file), 0, 0, 1, 1},
  6967. {&__pyx_n_s_get_status_ok, __pyx_k_get_status_ok, sizeof(__pyx_k_get_status_ok), 0, 0, 1, 1},
  6968. {&__pyx_n_s_get_txt_write_file, __pyx_k_get_txt_write_file, sizeof(__pyx_k_get_txt_write_file), 0, 0, 1, 1},
  6969. {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1},
  6970. {&__pyx_n_s_headers, __pyx_k_headers, sizeof(__pyx_k_headers), 0, 0, 1, 1},
  6971. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  6972. {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  6973. {&__pyx_n_s_iter_content, __pyx_k_iter_content, sizeof(__pyx_k_iter_content), 0, 0, 1, 1},
  6974. {&__pyx_n_s_lib_Naked_toolshed_c_network, __pyx_k_lib_Naked_toolshed_c_network, sizeof(__pyx_k_lib_Naked_toolshed_c_network), 0, 0, 1, 1},
  6975. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  6976. {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  6977. {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  6978. {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  6979. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  6980. {&__pyx_n_s_ok, __pyx_k_ok, sizeof(__pyx_k_ok), 0, 0, 1, 1},
  6981. {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
  6982. {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
  6983. {&__pyx_n_s_overwrite_existing, __pyx_k_overwrite_existing, sizeof(__pyx_k_overwrite_existing), 0, 0, 1, 1},
  6984. {&__pyx_n_s_post, __pyx_k_post, sizeof(__pyx_k_post), 0, 0, 1, 1},
  6985. {&__pyx_n_s_post_bin, __pyx_k_post_bin, sizeof(__pyx_k_post_bin), 0, 0, 1, 1},
  6986. {&__pyx_n_s_post_bin_write_file, __pyx_k_post_bin_write_file, sizeof(__pyx_k_post_bin_write_file), 0, 0, 1, 1},
  6987. {&__pyx_n_s_post_status_ok, __pyx_k_post_status_ok, sizeof(__pyx_k_post_status_ok), 0, 0, 1, 1},
  6988. {&__pyx_n_s_post_txt_write_file, __pyx_k_post_txt_write_file, sizeof(__pyx_k_post_txt_write_file), 0, 0, 1, 1},
  6989. {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  6990. {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  6991. {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  6992. {&__pyx_n_s_request_timeout, __pyx_k_request_timeout, sizeof(__pyx_k_request_timeout), 0, 0, 1, 1},
  6993. {&__pyx_n_s_requests, __pyx_k_requests, sizeof(__pyx_k_requests), 0, 0, 1, 1},
  6994. {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
  6995. {&__pyx_n_s_response, __pyx_k_response, sizeof(__pyx_k_response), 0, 0, 1, 1},
  6996. {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  6997. {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  6998. {&__pyx_n_s_status_code, __pyx_k_status_code, sizeof(__pyx_k_status_code), 0, 0, 1, 1},
  6999. {&__pyx_n_s_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 0, 0, 1, 1},
  7000. {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
  7001. {&__pyx_n_s_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 0, 0, 1, 1},
  7002. {&__pyx_n_s_suppress_output, __pyx_k_suppress_output, sizeof(__pyx_k_suppress_output), 0, 0, 1, 1},
  7003. {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  7004. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  7005. {&__pyx_n_s_text, __pyx_k_text, sizeof(__pyx_k_text), 0, 0, 1, 1},
  7006. {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1},
  7007. {&__pyx_n_s_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 0, 1, 1},
  7008. {&__pyx_kp_s_using_the_get_bin_write_file_me, __pyx_k_using_the_get_bin_write_file_me, sizeof(__pyx_k_using_the_get_bin_write_file_me), 0, 0, 1, 0},
  7009. {&__pyx_kp_s_using_the_get_data_method_Naked, __pyx_k_using_the_get_data_method_Naked, sizeof(__pyx_k_using_the_get_data_method_Naked), 0, 0, 1, 0},
  7010. {&__pyx_kp_s_using_the_get_data_write_txt_me, __pyx_k_using_the_get_data_write_txt_me, sizeof(__pyx_k_using_the_get_data_write_txt_me), 0, 0, 1, 0},
  7011. {&__pyx_kp_s_using_the_get_method_Naked_tool, __pyx_k_using_the_get_method_Naked_tool, sizeof(__pyx_k_using_the_get_method_Naked_tool), 0, 0, 1, 0},
  7012. {&__pyx_kp_s_using_the_post_data_write_bin_m, __pyx_k_using_the_post_data_write_bin_m, sizeof(__pyx_k_using_the_post_data_write_bin_m), 0, 0, 1, 0},
  7013. {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  7014. {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  7015. {&__pyx_n_s_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 0, 1, 1},
  7016. {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  7017. {0, 0, 0, 0, 0, 0, 0}
  7018. };
  7019. static int __Pyx_InitCachedBuiltins(void) {
  7020. __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7021. __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7022. return 0;
  7023. __pyx_L1_error:;
  7024. return -1;
  7025. }
  7026. static int __Pyx_InitCachedConstants(void) {
  7027. __Pyx_RefNannyDeclarations
  7028. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  7029. /* "lib/Naked/toolshed/c/network.pyx":80
  7030. * return False
  7031. * if (filepath == "" and len(self.url) > 1):
  7032. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  7033. * if not suppress_output:
  7034. * sys.stdout.write("Downloading file from " + self.url + "...")
  7035. */
  7036. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7037. __Pyx_GOTREF(__pyx_tuple__3);
  7038. __Pyx_GIVEREF(__pyx_tuple__3);
  7039. /* "lib/Naked/toolshed/c/network.pyx":86
  7040. * response = requests.get(self.url, timeout=self.request_timeout, stream=True)
  7041. * self.res = response
  7042. * with open(filepath, 'wb') as f: # write as binary data # <<<<<<<<<<<<<<
  7043. * for chunk in response.iter_content(chunk_size=2048):
  7044. * f.write(chunk)
  7045. */
  7046. __pyx_tuple__5 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7047. __Pyx_GOTREF(__pyx_tuple__5);
  7048. __Pyx_GIVEREF(__pyx_tuple__5);
  7049. /* "lib/Naked/toolshed/c/network.pyx":120
  7050. * return False
  7051. * if (filepath == "" and len(self.url) > 1):
  7052. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  7053. * if not suppress_output:
  7054. * sys.stdout.write("Downloading file from " + self.url + "...")
  7055. */
  7056. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7057. __Pyx_GOTREF(__pyx_tuple__7);
  7058. __Pyx_GIVEREF(__pyx_tuple__7);
  7059. /* "lib/Naked/toolshed/c/network.pyx":129
  7060. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text
  7061. * for chunk in response.iter_content(chunk_size=2048):
  7062. * chunk = chunk.decode('utf-8') # <<<<<<<<<<<<<<
  7063. * f.write(chunk)
  7064. * f.flush()
  7065. */
  7066. __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7067. __Pyx_GOTREF(__pyx_tuple__8);
  7068. __Pyx_GIVEREF(__pyx_tuple__8);
  7069. /* "lib/Naked/toolshed/c/network.pyx":127
  7070. * self.res = response
  7071. * import codecs
  7072. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: #write as text # <<<<<<<<<<<<<<
  7073. * for chunk in response.iter_content(chunk_size=2048):
  7074. * chunk = chunk.decode('utf-8')
  7075. */
  7076. __pyx_tuple__9 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7077. __Pyx_GOTREF(__pyx_tuple__9);
  7078. __Pyx_GIVEREF(__pyx_tuple__9);
  7079. /* "lib/Naked/toolshed/c/network.pyx":162
  7080. * except Exception as e:
  7081. * if DEBUG_FLAG:
  7082. * sys.stderr.write("Naked Framework Error: Unable to perform a HEAD request with the head() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  7083. * raise e
  7084. *
  7085. */
  7086. __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Naked_Framework_Error_Unable_to_3); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7087. __Pyx_GOTREF(__pyx_tuple__10);
  7088. __Pyx_GIVEREF(__pyx_tuple__10);
  7089. /* "lib/Naked/toolshed/c/network.pyx":180
  7090. * except Exception as e:
  7091. * if DEBUG_FLAG:
  7092. * sys.stderr.exit("Naked Framework Error: Unable to perform a POST request with the post() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  7093. * raise e
  7094. *
  7095. */
  7096. __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Naked_Framework_Error_Unable_to_4); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7097. __Pyx_GOTREF(__pyx_tuple__11);
  7098. __Pyx_GIVEREF(__pyx_tuple__11);
  7099. /* "lib/Naked/toolshed/c/network.pyx":197
  7100. * except Exception as e:
  7101. * if DEBUG_FLAG:
  7102. * sys.stderr.exit("Naked Framework Error: Unable to perform POST request with the post_bin() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  7103. * raise e
  7104. *
  7105. */
  7106. __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Naked_Framework_Error_Unable_to_5); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7107. __Pyx_GOTREF(__pyx_tuple__12);
  7108. __Pyx_GIVEREF(__pyx_tuple__12);
  7109. /* "lib/Naked/toolshed/c/network.pyx":217
  7110. * return False
  7111. * if (filepath == "" and len(self.url) > 1):
  7112. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  7113. * if not suppress_output:
  7114. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  7115. */
  7116. __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7117. __Pyx_GOTREF(__pyx_tuple__13);
  7118. __Pyx_GIVEREF(__pyx_tuple__13);
  7119. /* "lib/Naked/toolshed/c/network.pyx":223
  7120. * response = requests.post(self.url, timeout=self.request_timeout, stream=True)
  7121. * self.res = response
  7122. * with open(filepath, 'wb') as f: # write as binary data # <<<<<<<<<<<<<<
  7123. * for chunk in response.iter_content(chunk_size=2048):
  7124. * f.write(chunk)
  7125. */
  7126. __pyx_tuple__14 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7127. __Pyx_GOTREF(__pyx_tuple__14);
  7128. __Pyx_GIVEREF(__pyx_tuple__14);
  7129. /* "lib/Naked/toolshed/c/network.pyx":256
  7130. * return False
  7131. * if (filepath == "" and len(self.url) > 1):
  7132. * filepath = self.url.split('/')[-1] # use the filename from URL and working directory as default if not specified # <<<<<<<<<<<<<<
  7133. * if not suppress_output:
  7134. * sys.stdout.write("Downloading file from " + self.url + "...") #provide information about the download to user
  7135. */
  7136. __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s__2); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7137. __Pyx_GOTREF(__pyx_tuple__15);
  7138. __Pyx_GIVEREF(__pyx_tuple__15);
  7139. /* "lib/Naked/toolshed/c/network.pyx":265
  7140. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data
  7141. * for chunk in response.iter_content(chunk_size=2048):
  7142. * chunk = chunk.decode('utf-8') # <<<<<<<<<<<<<<
  7143. * f.write(chunk)
  7144. * f.flush()
  7145. */
  7146. __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7147. __Pyx_GOTREF(__pyx_tuple__16);
  7148. __Pyx_GIVEREF(__pyx_tuple__16);
  7149. /* "lib/Naked/toolshed/c/network.pyx":263
  7150. * self.res = response
  7151. * import codecs
  7152. * with codecs.open(filepath, mode='w', encoding="utf-8") as f: # write as binary data # <<<<<<<<<<<<<<
  7153. * for chunk in response.iter_content(chunk_size=2048):
  7154. * chunk = chunk.decode('utf-8')
  7155. */
  7156. __pyx_tuple__17 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7157. __Pyx_GOTREF(__pyx_tuple__17);
  7158. __Pyx_GIVEREF(__pyx_tuple__17);
  7159. /* "lib/Naked/toolshed/c/network.pyx":292
  7160. * except Exception as e:
  7161. * if DEBUG_FLAG:
  7162. * sys.stderr.write("Naked Framework Error: Unable to return the response from your HTTP request with the response() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  7163. * raise e
  7164. *
  7165. */
  7166. __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Naked_Framework_Error_Unable_to_7); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7167. __Pyx_GOTREF(__pyx_tuple__18);
  7168. __Pyx_GIVEREF(__pyx_tuple__18);
  7169. /* "lib/Naked/toolshed/c/network.pyx":312
  7170. * except Exception as e:
  7171. * if DEBUG_FLAG:
  7172. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the get_status_ok() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  7173. * raise e
  7174. *
  7175. */
  7176. __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Naked_Framework_Error_Unable_to_8); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7177. __Pyx_GOTREF(__pyx_tuple__19);
  7178. __Pyx_GIVEREF(__pyx_tuple__19);
  7179. /* "lib/Naked/toolshed/c/network.pyx":331
  7180. * except Exception as e:
  7181. * if DEBUG_FLAG:
  7182. * sys.stderr.write("Naked Framework Error: Unable to obtain the HTTP status with the post_status_ok() method (Naked.toolshed.network.py).") # <<<<<<<<<<<<<<
  7183. * raise e
  7184. *
  7185. */
  7186. __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Naked_Framework_Error_Unable_to_9); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7187. __Pyx_GOTREF(__pyx_tuple__20);
  7188. __Pyx_GIVEREF(__pyx_tuple__20);
  7189. /* "lib/Naked/toolshed/c/network.pyx":15
  7190. * #------------------------------------------------------------------------------
  7191. * class HTTP():
  7192. * def __init__(self, url="", request_timeout=10): # <<<<<<<<<<<<<<
  7193. * self.url = url
  7194. * self.request_timeout = request_timeout
  7195. */
  7196. __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_url, __pyx_n_s_request_timeout); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7197. __Pyx_GOTREF(__pyx_tuple__21);
  7198. __Pyx_GIVEREF(__pyx_tuple__21);
  7199. __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_init, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7200. __pyx_tuple__23 = PyTuple_Pack(2, ((PyObject*)__pyx_kp_s_), ((PyObject *)__pyx_int_10)); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7201. __Pyx_GOTREF(__pyx_tuple__23);
  7202. __Pyx_GIVEREF(__pyx_tuple__23);
  7203. /* "lib/Naked/toolshed/c/network.pyx":32
  7204. * # test_http_post_reponse_change, test_http_get_response_check
  7205. * #------------------------------------------------------------------------------
  7206. * def get(self, follow_redirects=True): # <<<<<<<<<<<<<<
  7207. * try:
  7208. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  7209. */
  7210. __pyx_tuple__24 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_follow_redirects, __pyx_n_s_response, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7211. __Pyx_GOTREF(__pyx_tuple__24);
  7212. __Pyx_GIVEREF(__pyx_tuple__24);
  7213. __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_get, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7214. __pyx_tuple__26 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7215. __Pyx_GOTREF(__pyx_tuple__26);
  7216. __Pyx_GIVEREF(__pyx_tuple__26);
  7217. /* "lib/Naked/toolshed/c/network.pyx":49
  7218. * # returns data stream with raw binary data
  7219. * #------------------------------------------------------------------------------
  7220. * def get_bin(self): # <<<<<<<<<<<<<<
  7221. * try:
  7222. * response = requests.get(self.url, timeout=self.request_timeout)
  7223. */
  7224. __pyx_tuple__27 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7225. __Pyx_GOTREF(__pyx_tuple__27);
  7226. __Pyx_GIVEREF(__pyx_tuple__27);
  7227. __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_get_bin, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7228. /* "lib/Naked/toolshed/c/network.pyx":69
  7229. * # Tests: test_NETWORK.py :: test_http_get_binary
  7230. * #------------------------------------------------------------------------------
  7231. * def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7232. * try:
  7233. * import os # used for os.fsync() method in the write
  7234. */
  7235. __pyx_tuple__29 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_filepath, __pyx_n_s_suppress_output, __pyx_n_s_overwrite_existing, __pyx_n_s_os, __pyx_n_s_file_exists, __pyx_n_s_response, __pyx_n_s_f, __pyx_n_s_chunk, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7236. __Pyx_GOTREF(__pyx_tuple__29);
  7237. __Pyx_GIVEREF(__pyx_tuple__29);
  7238. __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_get_bin_write_file, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7239. __pyx_tuple__31 = PyTuple_Pack(3, ((PyObject*)__pyx_kp_s_), ((PyObject *)Py_False), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7240. __Pyx_GOTREF(__pyx_tuple__31);
  7241. __Pyx_GIVEREF(__pyx_tuple__31);
  7242. /* "lib/Naked/toolshed/c/network.pyx":109
  7243. * # Tests: test_NETWORK.py :: test_http_get_text
  7244. * #------------------------------------------------------------------------------
  7245. * def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7246. * try:
  7247. * import os # used for os.fsync() method in the write
  7248. */
  7249. __pyx_tuple__32 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_filepath, __pyx_n_s_suppress_output, __pyx_n_s_overwrite_existing, __pyx_n_s_os, __pyx_n_s_file_exists, __pyx_n_s_response, __pyx_n_s_codecs, __pyx_n_s_f, __pyx_n_s_chunk, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7250. __Pyx_GOTREF(__pyx_tuple__32);
  7251. __Pyx_GIVEREF(__pyx_tuple__32);
  7252. __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_get_txt_write_file, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7253. __pyx_tuple__34 = PyTuple_Pack(3, ((PyObject*)__pyx_kp_s_), ((PyObject *)Py_False), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7254. __Pyx_GOTREF(__pyx_tuple__34);
  7255. __Pyx_GIVEREF(__pyx_tuple__34);
  7256. /* "lib/Naked/toolshed/c/network.pyx":153
  7257. * # Tests: test_NETWORK.py :: test_http_head
  7258. * #------------------------------------------------------------------------------
  7259. * def head(self): # <<<<<<<<<<<<<<
  7260. * try:
  7261. * response = requests.head(self.url, timeout=self.request_timeout)
  7262. */
  7263. __pyx_tuple__35 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7264. __Pyx_GOTREF(__pyx_tuple__35);
  7265. __Pyx_GIVEREF(__pyx_tuple__35);
  7266. __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_head, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7267. /* "lib/Naked/toolshed/c/network.pyx":171
  7268. * # returns text from the URL as a string
  7269. * #------------------------------------------------------------------------------
  7270. * def post(self, follow_redirects=True): # <<<<<<<<<<<<<<
  7271. * try:
  7272. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  7273. */
  7274. __pyx_tuple__37 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_follow_redirects, __pyx_n_s_response, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7275. __Pyx_GOTREF(__pyx_tuple__37);
  7276. __Pyx_GIVEREF(__pyx_tuple__37);
  7277. __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_post, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7278. __pyx_tuple__39 = PyTuple_Pack(1, ((PyObject *)Py_True)); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7279. __Pyx_GOTREF(__pyx_tuple__39);
  7280. __Pyx_GIVEREF(__pyx_tuple__39);
  7281. /* "lib/Naked/toolshed/c/network.pyx":188
  7282. * # returns binary data from the URL
  7283. * #------------------------------------------------------------------------------
  7284. * def post_bin(self): # <<<<<<<<<<<<<<
  7285. * try:
  7286. * response = requests.post(self.url, timeout=self.request_timeout)
  7287. */
  7288. __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_response, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7289. __Pyx_GOTREF(__pyx_tuple__40);
  7290. __Pyx_GIVEREF(__pyx_tuple__40);
  7291. __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_post_bin, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7292. /* "lib/Naked/toolshed/c/network.pyx":206
  7293. * # returns a boolean that indicates the success of the file write
  7294. * #------------------------------------------------------------------------------
  7295. * def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7296. * try:
  7297. * import os # used for os.fsync() method in the write
  7298. */
  7299. __pyx_tuple__42 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_filepath, __pyx_n_s_suppress_output, __pyx_n_s_overwrite_existing, __pyx_n_s_os, __pyx_n_s_file_exists, __pyx_n_s_response, __pyx_n_s_f, __pyx_n_s_chunk, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7300. __Pyx_GOTREF(__pyx_tuple__42);
  7301. __Pyx_GIVEREF(__pyx_tuple__42);
  7302. __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_post_bin_write_file, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7303. __pyx_tuple__44 = PyTuple_Pack(3, ((PyObject*)__pyx_kp_s_), ((PyObject *)Py_False), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7304. __Pyx_GOTREF(__pyx_tuple__44);
  7305. __Pyx_GIVEREF(__pyx_tuple__44);
  7306. /* "lib/Naked/toolshed/c/network.pyx":245
  7307. * # returns a boolean that indicates the success of the file write
  7308. * #------------------------------------------------------------------------------
  7309. * def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7310. * try:
  7311. * import os # used for os.fsync() method in the write
  7312. */
  7313. __pyx_tuple__45 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_filepath, __pyx_n_s_suppress_output, __pyx_n_s_overwrite_existing, __pyx_n_s_os, __pyx_n_s_file_exists, __pyx_n_s_response, __pyx_n_s_codecs, __pyx_n_s_f, __pyx_n_s_chunk, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7314. __Pyx_GOTREF(__pyx_tuple__45);
  7315. __Pyx_GIVEREF(__pyx_tuple__45);
  7316. __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_post_txt_write_file, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7317. __pyx_tuple__47 = PyTuple_Pack(3, ((PyObject*)__pyx_kp_s_), ((PyObject *)Py_False), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7318. __Pyx_GOTREF(__pyx_tuple__47);
  7319. __Pyx_GIVEREF(__pyx_tuple__47);
  7320. /* "lib/Naked/toolshed/c/network.pyx":287
  7321. * # Tests: test_NETWORK.py :: test_http_get_response_check
  7322. * #------------------------------------------------------------------------------
  7323. * def response(self): # <<<<<<<<<<<<<<
  7324. * try:
  7325. * return self.res
  7326. */
  7327. __pyx_tuple__48 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_e); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7328. __Pyx_GOTREF(__pyx_tuple__48);
  7329. __Pyx_GIVEREF(__pyx_tuple__48);
  7330. __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_response, 287, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7331. /* "lib/Naked/toolshed/c/network.pyx":301
  7332. * # Tests: test_NETWORK.py ::
  7333. * #------------------------------------------------------------------------------
  7334. * def get_status_ok(self): # <<<<<<<<<<<<<<
  7335. * try:
  7336. * self.get() #run the get request
  7337. */
  7338. __pyx_tuple__50 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7339. __Pyx_GOTREF(__pyx_tuple__50);
  7340. __Pyx_GIVEREF(__pyx_tuple__50);
  7341. __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_get_status_ok, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7342. /* "lib/Naked/toolshed/c/network.pyx":320
  7343. * # Note: method runs its own post method, not necessary to run separately
  7344. * #------------------------------------------------------------------------------
  7345. * def post_status_ok(self): # <<<<<<<<<<<<<<
  7346. * try:
  7347. * self.post() #run the post request
  7348. */
  7349. __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_ce, __pyx_n_s_e); if (unlikely(!__pyx_tuple__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7350. __Pyx_GOTREF(__pyx_tuple__52);
  7351. __Pyx_GIVEREF(__pyx_tuple__52);
  7352. __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ces_Desktop_code_naked_li, __pyx_n_s_post_status_ok, 320, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7353. __Pyx_RefNannyFinishContext();
  7354. return 0;
  7355. __pyx_L1_error:;
  7356. __Pyx_RefNannyFinishContext();
  7357. return -1;
  7358. }
  7359. static int __Pyx_InitGlobals(void) {
  7360. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7361. __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7362. __pyx_int_2048 = PyInt_FromLong(2048); if (unlikely(!__pyx_int_2048)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7363. return 0;
  7364. __pyx_L1_error:;
  7365. return -1;
  7366. }
  7367. #if PY_MAJOR_VERSION < 3
  7368. PyMODINIT_FUNC initnetwork(void); /*proto*/
  7369. PyMODINIT_FUNC initnetwork(void)
  7370. #else
  7371. PyMODINIT_FUNC PyInit_network(void); /*proto*/
  7372. PyMODINIT_FUNC PyInit_network(void)
  7373. #endif
  7374. {
  7375. PyObject *__pyx_t_1 = NULL;
  7376. PyObject *__pyx_t_2 = NULL;
  7377. int __pyx_t_3;
  7378. int __pyx_lineno = 0;
  7379. const char *__pyx_filename = NULL;
  7380. int __pyx_clineno = 0;
  7381. __Pyx_RefNannyDeclarations
  7382. #if CYTHON_REFNANNY
  7383. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  7384. if (!__Pyx_RefNanny) {
  7385. PyErr_Clear();
  7386. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  7387. if (!__Pyx_RefNanny)
  7388. Py_FatalError("failed to import 'refnanny' module");
  7389. }
  7390. #endif
  7391. __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_network(void)", 0);
  7392. if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7393. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7394. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7395. #ifdef __Pyx_CyFunction_USED
  7396. if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7397. #endif
  7398. #ifdef __Pyx_FusedFunction_USED
  7399. if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7400. #endif
  7401. #ifdef __Pyx_Generator_USED
  7402. if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7403. #endif
  7404. /*--- Library function declarations ---*/
  7405. /*--- Threads initialization code ---*/
  7406. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  7407. #ifdef WITH_THREAD /* Python build with threading support? */
  7408. PyEval_InitThreads();
  7409. #endif
  7410. #endif
  7411. /*--- Module creation code ---*/
  7412. #if PY_MAJOR_VERSION < 3
  7413. __pyx_m = Py_InitModule4(__Pyx_NAMESTR("network"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  7414. #else
  7415. __pyx_m = PyModule_Create(&__pyx_moduledef);
  7416. #endif
  7417. if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7418. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7419. Py_INCREF(__pyx_d);
  7420. __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7421. #if CYTHON_COMPILING_IN_PYPY
  7422. Py_INCREF(__pyx_b);
  7423. #endif
  7424. if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7425. /*--- Initialize various global constants etc. ---*/
  7426. if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7427. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  7428. if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7429. #endif
  7430. if (__pyx_module_is_main_lib__Naked__toolshed__c__network) {
  7431. if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7432. }
  7433. #if PY_MAJOR_VERSION >= 3
  7434. {
  7435. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7436. if (!PyDict_GetItemString(modules, "lib.Naked.toolshed.c.network")) {
  7437. if (unlikely(PyDict_SetItemString(modules, "lib.Naked.toolshed.c.network", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7438. }
  7439. }
  7440. #endif
  7441. /*--- Builtin init code ---*/
  7442. if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7443. /*--- Constants init code ---*/
  7444. if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7445. /*--- Global init code ---*/
  7446. /*--- Variable export code ---*/
  7447. /*--- Function export code ---*/
  7448. /*--- Type init code ---*/
  7449. /*--- Type import code ---*/
  7450. /*--- Variable import code ---*/
  7451. /*--- Function import code ---*/
  7452. /*--- Execution code ---*/
  7453. /* "lib/Naked/toolshed/c/network.pyx":5
  7454. * # cython: profile=False
  7455. *
  7456. * import sys # <<<<<<<<<<<<<<
  7457. * import requests
  7458. * from Naked.settings import debug as DEBUG_FLAG
  7459. */
  7460. __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7461. __Pyx_GOTREF(__pyx_t_1);
  7462. if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7463. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7464. /* "lib/Naked/toolshed/c/network.pyx":6
  7465. *
  7466. * import sys
  7467. * import requests # <<<<<<<<<<<<<<
  7468. * from Naked.settings import debug as DEBUG_FLAG
  7469. *
  7470. */
  7471. __pyx_t_1 = __Pyx_Import(__pyx_n_s_requests, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7472. __Pyx_GOTREF(__pyx_t_1);
  7473. if (PyDict_SetItem(__pyx_d, __pyx_n_s_requests, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7474. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7475. /* "lib/Naked/toolshed/c/network.pyx":7
  7476. * import sys
  7477. * import requests
  7478. * from Naked.settings import debug as DEBUG_FLAG # <<<<<<<<<<<<<<
  7479. *
  7480. * #------------------------------------------------------------------------------
  7481. */
  7482. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7483. __Pyx_GOTREF(__pyx_t_1);
  7484. __Pyx_INCREF(__pyx_n_s_debug);
  7485. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_debug);
  7486. __Pyx_GIVEREF(__pyx_n_s_debug);
  7487. __pyx_t_2 = __Pyx_Import(__pyx_n_s_Naked_settings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7488. __Pyx_GOTREF(__pyx_t_2);
  7489. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7490. __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7491. __Pyx_GOTREF(__pyx_t_1);
  7492. if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_FLAG, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7493. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7494. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7495. /* "lib/Naked/toolshed/c/network.pyx":14
  7496. * # Uses the requests external library to handle HTTP requests and response object (available on PyPI)
  7497. * #------------------------------------------------------------------------------
  7498. * class HTTP(): # <<<<<<<<<<<<<<
  7499. * def __init__(self, url="", request_timeout=10):
  7500. * self.url = url
  7501. */
  7502. __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HTTP, __pyx_n_s_HTTP, (PyObject *) NULL, __pyx_n_s_lib_Naked_toolshed_c_network, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7503. __Pyx_GOTREF(__pyx_t_2);
  7504. /* "lib/Naked/toolshed/c/network.pyx":15
  7505. * #------------------------------------------------------------------------------
  7506. * class HTTP():
  7507. * def __init__(self, url="", request_timeout=10): # <<<<<<<<<<<<<<
  7508. * self.url = url
  7509. * self.request_timeout = request_timeout
  7510. */
  7511. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_1__init__, 0, __pyx_n_s_HTTP___init, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7512. __Pyx_GOTREF(__pyx_t_1);
  7513. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__23);
  7514. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7515. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7516. /* "lib/Naked/toolshed/c/network.pyx":32
  7517. * # test_http_post_reponse_change, test_http_get_response_check
  7518. * #------------------------------------------------------------------------------
  7519. * def get(self, follow_redirects=True): # <<<<<<<<<<<<<<
  7520. * try:
  7521. * response = requests.get(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  7522. */
  7523. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_3get, 0, __pyx_n_s_HTTP_get, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7524. __Pyx_GOTREF(__pyx_t_1);
  7525. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__26);
  7526. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7527. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7528. /* "lib/Naked/toolshed/c/network.pyx":49
  7529. * # returns data stream with raw binary data
  7530. * #------------------------------------------------------------------------------
  7531. * def get_bin(self): # <<<<<<<<<<<<<<
  7532. * try:
  7533. * response = requests.get(self.url, timeout=self.request_timeout)
  7534. */
  7535. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_5get_bin, 0, __pyx_n_s_HTTP_get_bin, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7536. __Pyx_GOTREF(__pyx_t_1);
  7537. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_bin, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7538. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7539. /* "lib/Naked/toolshed/c/network.pyx":69
  7540. * # Tests: test_NETWORK.py :: test_http_get_binary
  7541. * #------------------------------------------------------------------------------
  7542. * def get_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7543. * try:
  7544. * import os # used for os.fsync() method in the write
  7545. */
  7546. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_7get_bin_write_file, 0, __pyx_n_s_HTTP_get_bin_write_file, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7547. __Pyx_GOTREF(__pyx_t_1);
  7548. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__31);
  7549. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_bin_write_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7550. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7551. /* "lib/Naked/toolshed/c/network.pyx":109
  7552. * # Tests: test_NETWORK.py :: test_http_get_text
  7553. * #------------------------------------------------------------------------------
  7554. * def get_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7555. * try:
  7556. * import os # used for os.fsync() method in the write
  7557. */
  7558. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_9get_txt_write_file, 0, __pyx_n_s_HTTP_get_txt_write_file, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7559. __Pyx_GOTREF(__pyx_t_1);
  7560. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__34);
  7561. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_txt_write_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7562. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7563. /* "lib/Naked/toolshed/c/network.pyx":153
  7564. * # Tests: test_NETWORK.py :: test_http_head
  7565. * #------------------------------------------------------------------------------
  7566. * def head(self): # <<<<<<<<<<<<<<
  7567. * try:
  7568. * response = requests.head(self.url, timeout=self.request_timeout)
  7569. */
  7570. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_11head, 0, __pyx_n_s_HTTP_head, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7571. __Pyx_GOTREF(__pyx_t_1);
  7572. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_head, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7573. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7574. /* "lib/Naked/toolshed/c/network.pyx":171
  7575. * # returns text from the URL as a string
  7576. * #------------------------------------------------------------------------------
  7577. * def post(self, follow_redirects=True): # <<<<<<<<<<<<<<
  7578. * try:
  7579. * response = requests.post(self.url, timeout=self.request_timeout, allow_redirects=follow_redirects)
  7580. */
  7581. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_13post, 0, __pyx_n_s_HTTP_post, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7582. __Pyx_GOTREF(__pyx_t_1);
  7583. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__39);
  7584. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_post, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7585. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7586. /* "lib/Naked/toolshed/c/network.pyx":188
  7587. * # returns binary data from the URL
  7588. * #------------------------------------------------------------------------------
  7589. * def post_bin(self): # <<<<<<<<<<<<<<
  7590. * try:
  7591. * response = requests.post(self.url, timeout=self.request_timeout)
  7592. */
  7593. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_15post_bin, 0, __pyx_n_s_HTTP_post_bin, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7594. __Pyx_GOTREF(__pyx_t_1);
  7595. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_post_bin, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7596. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7597. /* "lib/Naked/toolshed/c/network.pyx":206
  7598. * # returns a boolean that indicates the success of the file write
  7599. * #------------------------------------------------------------------------------
  7600. * def post_bin_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7601. * try:
  7602. * import os # used for os.fsync() method in the write
  7603. */
  7604. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_17post_bin_write_file, 0, __pyx_n_s_HTTP_post_bin_write_file, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7605. __Pyx_GOTREF(__pyx_t_1);
  7606. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__44);
  7607. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_post_bin_write_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7608. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7609. /* "lib/Naked/toolshed/c/network.pyx":245
  7610. * # returns a boolean that indicates the success of the file write
  7611. * #------------------------------------------------------------------------------
  7612. * def post_txt_write_file(self, filepath="", suppress_output = False, overwrite_existing = False): # <<<<<<<<<<<<<<
  7613. * try:
  7614. * import os # used for os.fsync() method in the write
  7615. */
  7616. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_19post_txt_write_file, 0, __pyx_n_s_HTTP_post_txt_write_file, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7617. __Pyx_GOTREF(__pyx_t_1);
  7618. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__47);
  7619. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_post_txt_write_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7620. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7621. /* "lib/Naked/toolshed/c/network.pyx":287
  7622. * # Tests: test_NETWORK.py :: test_http_get_response_check
  7623. * #------------------------------------------------------------------------------
  7624. * def response(self): # <<<<<<<<<<<<<<
  7625. * try:
  7626. * return self.res
  7627. */
  7628. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_21response, 0, __pyx_n_s_HTTP_response, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7629. __Pyx_GOTREF(__pyx_t_1);
  7630. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_response, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7631. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7632. /* "lib/Naked/toolshed/c/network.pyx":301
  7633. * # Tests: test_NETWORK.py ::
  7634. * #------------------------------------------------------------------------------
  7635. * def get_status_ok(self): # <<<<<<<<<<<<<<
  7636. * try:
  7637. * self.get() #run the get request
  7638. */
  7639. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_23get_status_ok, 0, __pyx_n_s_HTTP_get_status_ok, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7640. __Pyx_GOTREF(__pyx_t_1);
  7641. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_get_status_ok, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7642. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7643. /* "lib/Naked/toolshed/c/network.pyx":320
  7644. * # Note: method runs its own post method, not necessary to run separately
  7645. * #------------------------------------------------------------------------------
  7646. * def post_status_ok(self): # <<<<<<<<<<<<<<
  7647. * try:
  7648. * self.post() #run the post request
  7649. */
  7650. __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_3lib_5Naked_8toolshed_1c_7network_4HTTP_25post_status_ok, 0, __pyx_n_s_HTTP_post_status_ok, NULL, __pyx_n_s_lib_Naked_toolshed_c_network, PyModule_GetDict(__pyx_m), ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7651. __Pyx_GOTREF(__pyx_t_1);
  7652. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_post_status_ok, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7653. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7654. /* "lib/Naked/toolshed/c/network.pyx":14
  7655. * # Uses the requests external library to handle HTTP requests and response object (available on PyPI)
  7656. * #------------------------------------------------------------------------------
  7657. * class HTTP(): # <<<<<<<<<<<<<<
  7658. * def __init__(self, url="", request_timeout=10):
  7659. * self.url = url
  7660. */
  7661. __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HTTP, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7662. __Pyx_GOTREF(__pyx_t_1);
  7663. if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7664. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7665. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7666. /* "lib/Naked/toolshed/c/network.pyx":334
  7667. * raise e
  7668. *
  7669. * if __name__ == '__main__': # <<<<<<<<<<<<<<
  7670. * pass
  7671. * #------------------------------------------------------------------------------
  7672. */
  7673. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7674. __Pyx_GOTREF(__pyx_t_2);
  7675. __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_main, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7676. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7677. if (__pyx_t_3) {
  7678. goto __pyx_L2;
  7679. }
  7680. __pyx_L2:;
  7681. /* "lib/Naked/toolshed/c/network.pyx":1
  7682. * #!/usr/bin/env python # <<<<<<<<<<<<<<
  7683. * # encoding: utf-8
  7684. * # cython: profile=False
  7685. */
  7686. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7687. __Pyx_GOTREF(__pyx_t_2);
  7688. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7689. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7690. goto __pyx_L0;
  7691. __pyx_L1_error:;
  7692. __Pyx_XDECREF(__pyx_t_1);
  7693. __Pyx_XDECREF(__pyx_t_2);
  7694. if (__pyx_m) {
  7695. __Pyx_AddTraceback("init lib.Naked.toolshed.c.network", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7696. Py_DECREF(__pyx_m); __pyx_m = 0;
  7697. } else if (!PyErr_Occurred()) {
  7698. PyErr_SetString(PyExc_ImportError, "init lib.Naked.toolshed.c.network");
  7699. }
  7700. __pyx_L0:;
  7701. __Pyx_RefNannyFinishContext();
  7702. #if PY_MAJOR_VERSION < 3
  7703. return;
  7704. #else
  7705. return __pyx_m;
  7706. #endif
  7707. }
  7708. /* Runtime support code */
  7709. #if CYTHON_REFNANNY
  7710. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  7711. PyObject *m = NULL, *p = NULL;
  7712. void *r = NULL;
  7713. m = PyImport_ImportModule((char *)modname);
  7714. if (!m) goto end;
  7715. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  7716. if (!p) goto end;
  7717. r = PyLong_AsVoidPtr(p);
  7718. end:
  7719. Py_XDECREF(p);
  7720. Py_XDECREF(m);
  7721. return (__Pyx_RefNannyAPIStruct *)r;
  7722. }
  7723. #endif /* CYTHON_REFNANNY */
  7724. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  7725. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  7726. if (unlikely(!result)) {
  7727. PyErr_Format(PyExc_NameError,
  7728. #if PY_MAJOR_VERSION >= 3
  7729. "name '%U' is not defined", name);
  7730. #else
  7731. "name '%.200s' is not defined", PyString_AS_STRING(name));
  7732. #endif
  7733. }
  7734. return result;
  7735. }
  7736. static void __Pyx_RaiseDoubleKeywordsError(
  7737. const char* func_name,
  7738. PyObject* kw_name)
  7739. {
  7740. PyErr_Format(PyExc_TypeError,
  7741. #if PY_MAJOR_VERSION >= 3
  7742. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  7743. #else
  7744. "%s() got multiple values for keyword argument '%s'", func_name,
  7745. PyString_AsString(kw_name));
  7746. #endif
  7747. }
  7748. static int __Pyx_ParseOptionalKeywords(
  7749. PyObject *kwds,
  7750. PyObject **argnames[],
  7751. PyObject *kwds2,
  7752. PyObject *values[],
  7753. Py_ssize_t num_pos_args,
  7754. const char* function_name)
  7755. {
  7756. PyObject *key = 0, *value = 0;
  7757. Py_ssize_t pos = 0;
  7758. PyObject*** name;
  7759. PyObject*** first_kw_arg = argnames + num_pos_args;
  7760. while (PyDict_Next(kwds, &pos, &key, &value)) {
  7761. name = first_kw_arg;
  7762. while (*name && (**name != key)) name++;
  7763. if (*name) {
  7764. values[name-argnames] = value;
  7765. continue;
  7766. }
  7767. name = first_kw_arg;
  7768. #if PY_MAJOR_VERSION < 3
  7769. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  7770. while (*name) {
  7771. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  7772. && _PyString_Eq(**name, key)) {
  7773. values[name-argnames] = value;
  7774. break;
  7775. }
  7776. name++;
  7777. }
  7778. if (*name) continue;
  7779. else {
  7780. PyObject*** argname = argnames;
  7781. while (argname != first_kw_arg) {
  7782. if ((**argname == key) || (
  7783. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  7784. && _PyString_Eq(**argname, key))) {
  7785. goto arg_passed_twice;
  7786. }
  7787. argname++;
  7788. }
  7789. }
  7790. } else
  7791. #endif
  7792. if (likely(PyUnicode_Check(key))) {
  7793. while (*name) {
  7794. int cmp = (**name == key) ? 0 :
  7795. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  7796. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  7797. #endif
  7798. PyUnicode_Compare(**name, key);
  7799. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  7800. if (cmp == 0) {
  7801. values[name-argnames] = value;
  7802. break;
  7803. }
  7804. name++;
  7805. }
  7806. if (*name) continue;
  7807. else {
  7808. PyObject*** argname = argnames;
  7809. while (argname != first_kw_arg) {
  7810. int cmp = (**argname == key) ? 0 :
  7811. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  7812. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  7813. #endif
  7814. PyUnicode_Compare(**argname, key);
  7815. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  7816. if (cmp == 0) goto arg_passed_twice;
  7817. argname++;
  7818. }
  7819. }
  7820. } else
  7821. goto invalid_keyword_type;
  7822. if (kwds2) {
  7823. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  7824. } else {
  7825. goto invalid_keyword;
  7826. }
  7827. }
  7828. return 0;
  7829. arg_passed_twice:
  7830. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  7831. goto bad;
  7832. invalid_keyword_type:
  7833. PyErr_Format(PyExc_TypeError,
  7834. "%.200s() keywords must be strings", function_name);
  7835. goto bad;
  7836. invalid_keyword:
  7837. PyErr_Format(PyExc_TypeError,
  7838. #if PY_MAJOR_VERSION < 3
  7839. "%.200s() got an unexpected keyword argument '%.200s'",
  7840. function_name, PyString_AsString(key));
  7841. #else
  7842. "%s() got an unexpected keyword argument '%U'",
  7843. function_name, key);
  7844. #endif
  7845. bad:
  7846. return -1;
  7847. }
  7848. static void __Pyx_RaiseArgtupleInvalid(
  7849. const char* func_name,
  7850. int exact,
  7851. Py_ssize_t num_min,
  7852. Py_ssize_t num_max,
  7853. Py_ssize_t num_found)
  7854. {
  7855. Py_ssize_t num_expected;
  7856. const char *more_or_less;
  7857. if (num_found < num_min) {
  7858. num_expected = num_min;
  7859. more_or_less = "at least";
  7860. } else {
  7861. num_expected = num_max;
  7862. more_or_less = "at most";
  7863. }
  7864. if (exact) {
  7865. more_or_less = "exactly";
  7866. }
  7867. PyErr_Format(PyExc_TypeError,
  7868. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  7869. func_name, more_or_less, num_expected,
  7870. (num_expected == 1) ? "" : "s", num_found);
  7871. }
  7872. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
  7873. PyObject *result;
  7874. #if CYTHON_COMPILING_IN_CPYTHON
  7875. result = PyDict_GetItem(__pyx_d, name);
  7876. if (result) {
  7877. Py_INCREF(result);
  7878. } else {
  7879. #else
  7880. result = PyObject_GetItem(__pyx_d, name);
  7881. if (!result) {
  7882. PyErr_Clear();
  7883. #endif
  7884. result = __Pyx_GetBuiltinName(name);
  7885. }
  7886. return result;
  7887. }
  7888. #if CYTHON_COMPILING_IN_CPYTHON
  7889. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  7890. PyObject *result;
  7891. ternaryfunc call = func->ob_type->tp_call;
  7892. if (unlikely(!call))
  7893. return PyObject_Call(func, arg, kw);
  7894. #if PY_VERSION_HEX >= 0x02060000
  7895. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  7896. return NULL;
  7897. #endif
  7898. result = (*call)(func, arg, kw);
  7899. #if PY_VERSION_HEX >= 0x02060000
  7900. Py_LeaveRecursiveCall();
  7901. #endif
  7902. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  7903. PyErr_SetString(
  7904. PyExc_SystemError,
  7905. "NULL result without error in PyObject_Call");
  7906. }
  7907. return result;
  7908. }
  7909. #endif
  7910. static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
  7911. #if CYTHON_COMPILING_IN_CPYTHON
  7912. PyThreadState *tstate = PyThreadState_GET();
  7913. *type = tstate->exc_type;
  7914. *value = tstate->exc_value;
  7915. *tb = tstate->exc_traceback;
  7916. Py_XINCREF(*type);
  7917. Py_XINCREF(*value);
  7918. Py_XINCREF(*tb);
  7919. #else
  7920. PyErr_GetExcInfo(type, value, tb);
  7921. #endif
  7922. }
  7923. static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
  7924. #if CYTHON_COMPILING_IN_CPYTHON
  7925. PyObject *tmp_type, *tmp_value, *tmp_tb;
  7926. PyThreadState *tstate = PyThreadState_GET();
  7927. tmp_type = tstate->exc_type;
  7928. tmp_value = tstate->exc_value;
  7929. tmp_tb = tstate->exc_traceback;
  7930. tstate->exc_type = type;
  7931. tstate->exc_value = value;
  7932. tstate->exc_traceback = tb;
  7933. Py_XDECREF(tmp_type);
  7934. Py_XDECREF(tmp_value);
  7935. Py_XDECREF(tmp_tb);
  7936. #else
  7937. PyErr_SetExcInfo(type, value, tb);
  7938. #endif
  7939. }
  7940. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
  7941. PyObject *local_type, *local_value, *local_tb;
  7942. #if CYTHON_COMPILING_IN_CPYTHON
  7943. PyObject *tmp_type, *tmp_value, *tmp_tb;
  7944. PyThreadState *tstate = PyThreadState_GET();
  7945. local_type = tstate->curexc_type;
  7946. local_value = tstate->curexc_value;
  7947. local_tb = tstate->curexc_traceback;
  7948. tstate->curexc_type = 0;
  7949. tstate->curexc_value = 0;
  7950. tstate->curexc_traceback = 0;
  7951. #else
  7952. PyErr_Fetch(&local_type, &local_value, &local_tb);
  7953. #endif
  7954. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  7955. #if CYTHON_COMPILING_IN_CPYTHON
  7956. if (unlikely(tstate->curexc_type))
  7957. #else
  7958. if (unlikely(PyErr_Occurred()))
  7959. #endif
  7960. goto bad;
  7961. #if PY_MAJOR_VERSION >= 3
  7962. if (local_tb) {
  7963. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  7964. goto bad;
  7965. }
  7966. #endif
  7967. Py_XINCREF(local_tb);
  7968. Py_XINCREF(local_type);
  7969. Py_XINCREF(local_value);
  7970. *type = local_type;
  7971. *value = local_value;
  7972. *tb = local_tb;
  7973. #if CYTHON_COMPILING_IN_CPYTHON
  7974. tmp_type = tstate->exc_type;
  7975. tmp_value = tstate->exc_value;
  7976. tmp_tb = tstate->exc_traceback;
  7977. tstate->exc_type = local_type;
  7978. tstate->exc_value = local_value;
  7979. tstate->exc_traceback = local_tb;
  7980. Py_XDECREF(tmp_type);
  7981. Py_XDECREF(tmp_value);
  7982. Py_XDECREF(tmp_tb);
  7983. #else
  7984. PyErr_SetExcInfo(local_type, local_value, local_tb);
  7985. #endif
  7986. return 0;
  7987. bad:
  7988. *type = 0;
  7989. *value = 0;
  7990. *tb = 0;
  7991. Py_XDECREF(local_type);
  7992. Py_XDECREF(local_value);
  7993. Py_XDECREF(local_tb);
  7994. return -1;
  7995. }
  7996. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
  7997. #if CYTHON_COMPILING_IN_CPYTHON
  7998. PyObject *tmp_type, *tmp_value, *tmp_tb;
  7999. PyThreadState *tstate = PyThreadState_GET();
  8000. tmp_type = tstate->curexc_type;
  8001. tmp_value = tstate->curexc_value;
  8002. tmp_tb = tstate->curexc_traceback;
  8003. tstate->curexc_type = type;
  8004. tstate->curexc_value = value;
  8005. tstate->curexc_traceback = tb;
  8006. Py_XDECREF(tmp_type);
  8007. Py_XDECREF(tmp_value);
  8008. Py_XDECREF(tmp_tb);
  8009. #else
  8010. PyErr_Restore(type, value, tb);
  8011. #endif
  8012. }
  8013. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
  8014. #if CYTHON_COMPILING_IN_CPYTHON
  8015. PyThreadState *tstate = PyThreadState_GET();
  8016. *type = tstate->curexc_type;
  8017. *value = tstate->curexc_value;
  8018. *tb = tstate->curexc_traceback;
  8019. tstate->curexc_type = 0;
  8020. tstate->curexc_value = 0;
  8021. tstate->curexc_traceback = 0;
  8022. #else
  8023. PyErr_Fetch(type, value, tb);
  8024. #endif
  8025. }
  8026. #if PY_MAJOR_VERSION < 3
  8027. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  8028. CYTHON_UNUSED PyObject *cause) {
  8029. Py_XINCREF(type);
  8030. if (!value || value == Py_None)
  8031. value = NULL;
  8032. else
  8033. Py_INCREF(value);
  8034. if (!tb || tb == Py_None)
  8035. tb = NULL;
  8036. else {
  8037. Py_INCREF(tb);
  8038. if (!PyTraceBack_Check(tb)) {
  8039. PyErr_SetString(PyExc_TypeError,
  8040. "raise: arg 3 must be a traceback or None");
  8041. goto raise_error;
  8042. }
  8043. }
  8044. #if PY_VERSION_HEX < 0x02050000
  8045. if (PyClass_Check(type)) {
  8046. #else
  8047. if (PyType_Check(type)) {
  8048. #endif
  8049. #if CYTHON_COMPILING_IN_PYPY
  8050. if (!value) {
  8051. Py_INCREF(Py_None);
  8052. value = Py_None;
  8053. }
  8054. #endif
  8055. PyErr_NormalizeException(&type, &value, &tb);
  8056. } else {
  8057. if (value) {
  8058. PyErr_SetString(PyExc_TypeError,
  8059. "instance exception may not have a separate value");
  8060. goto raise_error;
  8061. }
  8062. value = type;
  8063. #if PY_VERSION_HEX < 0x02050000
  8064. if (PyInstance_Check(type)) {
  8065. type = (PyObject*) ((PyInstanceObject*)type)->in_class;
  8066. Py_INCREF(type);
  8067. } else {
  8068. type = 0;
  8069. PyErr_SetString(PyExc_TypeError,
  8070. "raise: exception must be an old-style class or instance");
  8071. goto raise_error;
  8072. }
  8073. #else
  8074. type = (PyObject*) Py_TYPE(type);
  8075. Py_INCREF(type);
  8076. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  8077. PyErr_SetString(PyExc_TypeError,
  8078. "raise: exception class must be a subclass of BaseException");
  8079. goto raise_error;
  8080. }
  8081. #endif
  8082. }
  8083. __Pyx_ErrRestore(type, value, tb);
  8084. return;
  8085. raise_error:
  8086. Py_XDECREF(value);
  8087. Py_XDECREF(type);
  8088. Py_XDECREF(tb);
  8089. return;
  8090. }
  8091. #else /* Python 3+ */
  8092. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  8093. PyObject* owned_instance = NULL;
  8094. if (tb == Py_None) {
  8095. tb = 0;
  8096. } else if (tb && !PyTraceBack_Check(tb)) {
  8097. PyErr_SetString(PyExc_TypeError,
  8098. "raise: arg 3 must be a traceback or None");
  8099. goto bad;
  8100. }
  8101. if (value == Py_None)
  8102. value = 0;
  8103. if (PyExceptionInstance_Check(type)) {
  8104. if (value) {
  8105. PyErr_SetString(PyExc_TypeError,
  8106. "instance exception may not have a separate value");
  8107. goto bad;
  8108. }
  8109. value = type;
  8110. type = (PyObject*) Py_TYPE(value);
  8111. } else if (PyExceptionClass_Check(type)) {
  8112. PyObject *instance_class = NULL;
  8113. if (value && PyExceptionInstance_Check(value)) {
  8114. instance_class = (PyObject*) Py_TYPE(value);
  8115. if (instance_class != type) {
  8116. if (PyObject_IsSubclass(instance_class, type)) {
  8117. type = instance_class;
  8118. } else {
  8119. instance_class = NULL;
  8120. }
  8121. }
  8122. }
  8123. if (!instance_class) {
  8124. PyObject *args;
  8125. if (!value)
  8126. args = PyTuple_New(0);
  8127. else if (PyTuple_Check(value)) {
  8128. Py_INCREF(value);
  8129. args = value;
  8130. } else
  8131. args = PyTuple_Pack(1, value);
  8132. if (!args)
  8133. goto bad;
  8134. owned_instance = PyObject_Call(type, args, NULL);
  8135. Py_DECREF(args);
  8136. if (!owned_instance)
  8137. goto bad;
  8138. value = owned_instance;
  8139. if (!PyExceptionInstance_Check(value)) {
  8140. PyErr_Format(PyExc_TypeError,
  8141. "calling %R should have returned an instance of "
  8142. "BaseException, not %R",
  8143. type, Py_TYPE(value));
  8144. goto bad;
  8145. }
  8146. }
  8147. } else {
  8148. PyErr_SetString(PyExc_TypeError,
  8149. "raise: exception class must be a subclass of BaseException");
  8150. goto bad;
  8151. }
  8152. #if PY_VERSION_HEX >= 0x03030000
  8153. if (cause) {
  8154. #else
  8155. if (cause && cause != Py_None) {
  8156. #endif
  8157. PyObject *fixed_cause;
  8158. if (cause == Py_None) {
  8159. fixed_cause = NULL;
  8160. } else if (PyExceptionClass_Check(cause)) {
  8161. fixed_cause = PyObject_CallObject(cause, NULL);
  8162. if (fixed_cause == NULL)
  8163. goto bad;
  8164. } else if (PyExceptionInstance_Check(cause)) {
  8165. fixed_cause = cause;
  8166. Py_INCREF(fixed_cause);
  8167. } else {
  8168. PyErr_SetString(PyExc_TypeError,
  8169. "exception causes must derive from "
  8170. "BaseException");
  8171. goto bad;
  8172. }
  8173. PyException_SetCause(value, fixed_cause);
  8174. }
  8175. PyErr_SetObject(type, value);
  8176. if (tb) {
  8177. PyThreadState *tstate = PyThreadState_GET();
  8178. PyObject* tmp_tb = tstate->curexc_traceback;
  8179. if (tb != tmp_tb) {
  8180. Py_INCREF(tb);
  8181. tstate->curexc_traceback = tb;
  8182. Py_XDECREF(tmp_tb);
  8183. }
  8184. }
  8185. bad:
  8186. Py_XDECREF(owned_instance);
  8187. return;
  8188. }
  8189. #endif
  8190. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  8191. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  8192. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  8193. PyErr_Format(PyExc_ImportError,
  8194. #if PY_MAJOR_VERSION < 3
  8195. "cannot import name %.230s", PyString_AS_STRING(name));
  8196. #else
  8197. "cannot import name %S", name);
  8198. #endif
  8199. }
  8200. return value;
  8201. }
  8202. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  8203. #if CYTHON_COMPILING_IN_PYPY
  8204. return PyObject_RichCompareBool(s1, s2, equals);
  8205. #else
  8206. if (s1 == s2) {
  8207. return (equals == Py_EQ);
  8208. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  8209. const char *ps1, *ps2;
  8210. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  8211. if (length != PyBytes_GET_SIZE(s2))
  8212. return (equals == Py_NE);
  8213. ps1 = PyBytes_AS_STRING(s1);
  8214. ps2 = PyBytes_AS_STRING(s2);
  8215. if (ps1[0] != ps2[0]) {
  8216. return (equals == Py_NE);
  8217. } else if (length == 1) {
  8218. return (equals == Py_EQ);
  8219. } else {
  8220. int result = memcmp(ps1, ps2, (size_t)length);
  8221. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  8222. }
  8223. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  8224. return (equals == Py_NE);
  8225. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  8226. return (equals == Py_NE);
  8227. } else {
  8228. int result;
  8229. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  8230. if (!py_result)
  8231. return -1;
  8232. result = __Pyx_PyObject_IsTrue(py_result);
  8233. Py_DECREF(py_result);
  8234. return result;
  8235. }
  8236. #endif
  8237. }
  8238. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  8239. #if CYTHON_COMPILING_IN_PYPY
  8240. return PyObject_RichCompareBool(s1, s2, equals);
  8241. #else
  8242. #if PY_MAJOR_VERSION < 3
  8243. PyObject* owned_ref = NULL;
  8244. #endif
  8245. int s1_is_unicode, s2_is_unicode;
  8246. if (s1 == s2) {
  8247. goto return_eq;
  8248. }
  8249. s1_is_unicode = PyUnicode_CheckExact(s1);
  8250. s2_is_unicode = PyUnicode_CheckExact(s2);
  8251. #if PY_MAJOR_VERSION < 3
  8252. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  8253. owned_ref = PyUnicode_FromObject(s2);
  8254. if (unlikely(!owned_ref))
  8255. return -1;
  8256. s2 = owned_ref;
  8257. s2_is_unicode = 1;
  8258. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  8259. owned_ref = PyUnicode_FromObject(s1);
  8260. if (unlikely(!owned_ref))
  8261. return -1;
  8262. s1 = owned_ref;
  8263. s1_is_unicode = 1;
  8264. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  8265. return __Pyx_PyBytes_Equals(s1, s2, equals);
  8266. }
  8267. #endif
  8268. if (s1_is_unicode & s2_is_unicode) {
  8269. Py_ssize_t length;
  8270. int kind;
  8271. void *data1, *data2;
  8272. #if CYTHON_PEP393_ENABLED
  8273. if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0))
  8274. return -1;
  8275. #endif
  8276. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  8277. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  8278. goto return_ne;
  8279. }
  8280. kind = __Pyx_PyUnicode_KIND(s1);
  8281. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  8282. goto return_ne;
  8283. }
  8284. data1 = __Pyx_PyUnicode_DATA(s1);
  8285. data2 = __Pyx_PyUnicode_DATA(s2);
  8286. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  8287. goto return_ne;
  8288. } else if (length == 1) {
  8289. goto return_eq;
  8290. } else {
  8291. int result = memcmp(data1, data2, length * kind);
  8292. #if PY_MAJOR_VERSION < 3
  8293. Py_XDECREF(owned_ref);
  8294. #endif
  8295. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  8296. }
  8297. } else if ((s1 == Py_None) & s2_is_unicode) {
  8298. goto return_ne;
  8299. } else if ((s2 == Py_None) & s1_is_unicode) {
  8300. goto return_ne;
  8301. } else {
  8302. int result;
  8303. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  8304. if (!py_result)
  8305. return -1;
  8306. result = __Pyx_PyObject_IsTrue(py_result);
  8307. Py_DECREF(py_result);
  8308. return result;
  8309. }
  8310. return_eq:
  8311. #if PY_MAJOR_VERSION < 3
  8312. Py_XDECREF(owned_ref);
  8313. #endif
  8314. return (equals == Py_EQ);
  8315. return_ne:
  8316. #if PY_MAJOR_VERSION < 3
  8317. Py_XDECREF(owned_ref);
  8318. #endif
  8319. return (equals == Py_NE);
  8320. #endif
  8321. }
  8322. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  8323. PyObject *r;
  8324. if (!j) return NULL;
  8325. r = PyObject_GetItem(o, j);
  8326. Py_DECREF(j);
  8327. return r;
  8328. }
  8329. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  8330. int wraparound, int boundscheck) {
  8331. #if CYTHON_COMPILING_IN_CPYTHON
  8332. if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
  8333. if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  8334. PyObject *r = PyList_GET_ITEM(o, i);
  8335. Py_INCREF(r);
  8336. return r;
  8337. }
  8338. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8339. #else
  8340. return PySequence_GetItem(o, i);
  8341. #endif
  8342. }
  8343. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  8344. int wraparound, int boundscheck) {
  8345. #if CYTHON_COMPILING_IN_CPYTHON
  8346. if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
  8347. if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  8348. PyObject *r = PyTuple_GET_ITEM(o, i);
  8349. Py_INCREF(r);
  8350. return r;
  8351. }
  8352. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8353. #else
  8354. return PySequence_GetItem(o, i);
  8355. #endif
  8356. }
  8357. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  8358. int is_list, int wraparound, int boundscheck) {
  8359. #if CYTHON_COMPILING_IN_CPYTHON
  8360. if (is_list || PyList_CheckExact(o)) {
  8361. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  8362. if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
  8363. PyObject *r = PyList_GET_ITEM(o, n);
  8364. Py_INCREF(r);
  8365. return r;
  8366. }
  8367. }
  8368. else if (PyTuple_CheckExact(o)) {
  8369. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  8370. if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
  8371. PyObject *r = PyTuple_GET_ITEM(o, n);
  8372. Py_INCREF(r);
  8373. return r;
  8374. }
  8375. } else {
  8376. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  8377. if (likely(m && m->sq_item)) {
  8378. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  8379. Py_ssize_t l = m->sq_length(o);
  8380. if (likely(l >= 0)) {
  8381. i += l;
  8382. } else {
  8383. if (PyErr_ExceptionMatches(PyExc_OverflowError))
  8384. PyErr_Clear();
  8385. else
  8386. return NULL;
  8387. }
  8388. }
  8389. return m->sq_item(o, i);
  8390. }
  8391. }
  8392. #else
  8393. if (is_list || PySequence_Check(o)) {
  8394. return PySequence_GetItem(o, i);
  8395. }
  8396. #endif
  8397. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8398. }
  8399. static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  8400. PyObject* fake_module;
  8401. PyTypeObject* cached_type = NULL;
  8402. fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
  8403. if (!fake_module) return NULL;
  8404. Py_INCREF(fake_module);
  8405. cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
  8406. if (cached_type) {
  8407. if (!PyType_Check((PyObject*)cached_type)) {
  8408. PyErr_Format(PyExc_TypeError,
  8409. "Shared Cython type %.200s is not a type object",
  8410. type->tp_name);
  8411. goto bad;
  8412. }
  8413. if (cached_type->tp_basicsize != type->tp_basicsize) {
  8414. PyErr_Format(PyExc_TypeError,
  8415. "Shared Cython type %.200s has the wrong size, try recompiling",
  8416. type->tp_name);
  8417. goto bad;
  8418. }
  8419. } else {
  8420. if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
  8421. PyErr_Clear();
  8422. if (PyType_Ready(type) < 0) goto bad;
  8423. if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
  8424. goto bad;
  8425. Py_INCREF(type);
  8426. cached_type = type;
  8427. }
  8428. done:
  8429. Py_DECREF(fake_module);
  8430. return cached_type;
  8431. bad:
  8432. Py_XDECREF(cached_type);
  8433. cached_type = NULL;
  8434. goto done;
  8435. }
  8436. static PyObject *
  8437. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
  8438. {
  8439. if (unlikely(op->func_doc == NULL)) {
  8440. if (op->func.m_ml->ml_doc) {
  8441. #if PY_MAJOR_VERSION >= 3
  8442. op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
  8443. #else
  8444. op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
  8445. #endif
  8446. if (unlikely(op->func_doc == NULL))
  8447. return NULL;
  8448. } else {
  8449. Py_INCREF(Py_None);
  8450. return Py_None;
  8451. }
  8452. }
  8453. Py_INCREF(op->func_doc);
  8454. return op->func_doc;
  8455. }
  8456. static int
  8457. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
  8458. {
  8459. PyObject *tmp = op->func_doc;
  8460. if (value == NULL)
  8461. value = Py_None; /* Mark as deleted */
  8462. Py_INCREF(value);
  8463. op->func_doc = value;
  8464. Py_XDECREF(tmp);
  8465. return 0;
  8466. }
  8467. static PyObject *
  8468. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
  8469. {
  8470. if (unlikely(op->func_name == NULL)) {
  8471. #if PY_MAJOR_VERSION >= 3
  8472. op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
  8473. #else
  8474. op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
  8475. #endif
  8476. if (unlikely(op->func_name == NULL))
  8477. return NULL;
  8478. }
  8479. Py_INCREF(op->func_name);
  8480. return op->func_name;
  8481. }
  8482. static int
  8483. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
  8484. {
  8485. PyObject *tmp;
  8486. #if PY_MAJOR_VERSION >= 3
  8487. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  8488. #else
  8489. if (unlikely(value == NULL || !PyString_Check(value))) {
  8490. #endif
  8491. PyErr_SetString(PyExc_TypeError,
  8492. "__name__ must be set to a string object");
  8493. return -1;
  8494. }
  8495. tmp = op->func_name;
  8496. Py_INCREF(value);
  8497. op->func_name = value;
  8498. Py_XDECREF(tmp);
  8499. return 0;
  8500. }
  8501. static PyObject *
  8502. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
  8503. {
  8504. Py_INCREF(op->func_qualname);
  8505. return op->func_qualname;
  8506. }
  8507. static int
  8508. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
  8509. {
  8510. PyObject *tmp;
  8511. #if PY_MAJOR_VERSION >= 3
  8512. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  8513. #else
  8514. if (unlikely(value == NULL || !PyString_Check(value))) {
  8515. #endif
  8516. PyErr_SetString(PyExc_TypeError,
  8517. "__qualname__ must be set to a string object");
  8518. return -1;
  8519. }
  8520. tmp = op->func_qualname;
  8521. Py_INCREF(value);
  8522. op->func_qualname = value;
  8523. Py_XDECREF(tmp);
  8524. return 0;
  8525. }
  8526. static PyObject *
  8527. __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
  8528. {
  8529. PyObject *self;
  8530. self = m->func_closure;
  8531. if (self == NULL)
  8532. self = Py_None;
  8533. Py_INCREF(self);
  8534. return self;
  8535. }
  8536. static PyObject *
  8537. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
  8538. {
  8539. if (unlikely(op->func_dict == NULL)) {
  8540. op->func_dict = PyDict_New();
  8541. if (unlikely(op->func_dict == NULL))
  8542. return NULL;
  8543. }
  8544. Py_INCREF(op->func_dict);
  8545. return op->func_dict;
  8546. }
  8547. static int
  8548. __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
  8549. {
  8550. PyObject *tmp;
  8551. if (unlikely(value == NULL)) {
  8552. PyErr_SetString(PyExc_TypeError,
  8553. "function's dictionary may not be deleted");
  8554. return -1;
  8555. }
  8556. if (unlikely(!PyDict_Check(value))) {
  8557. PyErr_SetString(PyExc_TypeError,
  8558. "setting function's dictionary to a non-dict");
  8559. return -1;
  8560. }
  8561. tmp = op->func_dict;
  8562. Py_INCREF(value);
  8563. op->func_dict = value;
  8564. Py_XDECREF(tmp);
  8565. return 0;
  8566. }
  8567. static PyObject *
  8568. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
  8569. {
  8570. Py_INCREF(op->func_globals);
  8571. return op->func_globals;
  8572. }
  8573. static PyObject *
  8574. __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
  8575. {
  8576. Py_INCREF(Py_None);
  8577. return Py_None;
  8578. }
  8579. static PyObject *
  8580. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
  8581. {
  8582. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  8583. Py_INCREF(result);
  8584. return result;
  8585. }
  8586. static int
  8587. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  8588. PyObject *res = op->defaults_getter((PyObject *) op);
  8589. if (unlikely(!res))
  8590. return -1;
  8591. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  8592. Py_INCREF(op->defaults_tuple);
  8593. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  8594. Py_INCREF(op->defaults_kwdict);
  8595. Py_DECREF(res);
  8596. return 0;
  8597. }
  8598. static int
  8599. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
  8600. PyObject* tmp;
  8601. if (!value) {
  8602. value = Py_None;
  8603. } else if (value != Py_None && !PyTuple_Check(value)) {
  8604. PyErr_SetString(PyExc_TypeError,
  8605. "__defaults__ must be set to a tuple object");
  8606. return -1;
  8607. }
  8608. Py_INCREF(value);
  8609. tmp = op->defaults_tuple;
  8610. op->defaults_tuple = value;
  8611. Py_XDECREF(tmp);
  8612. return 0;
  8613. }
  8614. static PyObject *
  8615. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
  8616. PyObject* result = op->defaults_tuple;
  8617. if (unlikely(!result)) {
  8618. if (op->defaults_getter) {
  8619. if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  8620. result = op->defaults_tuple;
  8621. } else {
  8622. result = Py_None;
  8623. }
  8624. }
  8625. Py_INCREF(result);
  8626. return result;
  8627. }
  8628. static int
  8629. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
  8630. PyObject* tmp;
  8631. if (!value) {
  8632. value = Py_None;
  8633. } else if (value != Py_None && !PyDict_Check(value)) {
  8634. PyErr_SetString(PyExc_TypeError,
  8635. "__kwdefaults__ must be set to a dict object");
  8636. return -1;
  8637. }
  8638. Py_INCREF(value);
  8639. tmp = op->defaults_kwdict;
  8640. op->defaults_kwdict = value;
  8641. Py_XDECREF(tmp);
  8642. return 0;
  8643. }
  8644. static PyObject *
  8645. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
  8646. PyObject* result = op->defaults_kwdict;
  8647. if (unlikely(!result)) {
  8648. if (op->defaults_getter) {
  8649. if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
  8650. result = op->defaults_kwdict;
  8651. } else {
  8652. result = Py_None;
  8653. }
  8654. }
  8655. Py_INCREF(result);
  8656. return result;
  8657. }
  8658. static int
  8659. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
  8660. PyObject* tmp;
  8661. if (!value || value == Py_None) {
  8662. value = NULL;
  8663. } else if (!PyDict_Check(value)) {
  8664. PyErr_SetString(PyExc_TypeError,
  8665. "__annotations__ must be set to a dict object");
  8666. return -1;
  8667. }
  8668. Py_XINCREF(value);
  8669. tmp = op->func_annotations;
  8670. op->func_annotations = value;
  8671. Py_XDECREF(tmp);
  8672. return 0;
  8673. }
  8674. static PyObject *
  8675. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
  8676. PyObject* result = op->func_annotations;
  8677. if (unlikely(!result)) {
  8678. result = PyDict_New();
  8679. if (unlikely(!result)) return NULL;
  8680. op->func_annotations = result;
  8681. }
  8682. Py_INCREF(result);
  8683. return result;
  8684. }
  8685. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  8686. {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  8687. {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  8688. {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  8689. {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  8690. {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  8691. {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
  8692. {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  8693. {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
  8694. {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  8695. {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  8696. {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  8697. {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  8698. {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  8699. {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  8700. {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  8701. {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  8702. {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  8703. {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  8704. {0, 0, 0, 0, 0}
  8705. };
  8706. #ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
  8707. #define PY_WRITE_RESTRICTED WRITE_RESTRICTED
  8708. #endif
  8709. static PyMemberDef __pyx_CyFunction_members[] = {
  8710. {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
  8711. {0, 0, 0, 0, 0}
  8712. };
  8713. static PyObject *
  8714. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
  8715. {
  8716. #if PY_MAJOR_VERSION >= 3
  8717. return PyUnicode_FromString(m->func.m_ml->ml_name);
  8718. #else
  8719. return PyString_FromString(m->func.m_ml->ml_name);
  8720. #endif
  8721. }
  8722. static PyMethodDef __pyx_CyFunction_methods[] = {
  8723. {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  8724. {0, 0, 0, 0}
  8725. };
  8726. static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
  8727. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  8728. __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
  8729. if (op == NULL)
  8730. return NULL;
  8731. op->flags = flags;
  8732. op->func_weakreflist = NULL;
  8733. op->func.m_ml = ml;
  8734. op->func.m_self = (PyObject *) op;
  8735. Py_XINCREF(closure);
  8736. op->func_closure = closure;
  8737. Py_XINCREF(module);
  8738. op->func.m_module = module;
  8739. op->func_dict = NULL;
  8740. op->func_name = NULL;
  8741. Py_INCREF(qualname);
  8742. op->func_qualname = qualname;
  8743. op->func_doc = NULL;
  8744. op->func_classobj = NULL;
  8745. op->func_globals = globals;
  8746. Py_INCREF(op->func_globals);
  8747. Py_XINCREF(code);
  8748. op->func_code = code;
  8749. op->defaults_pyobjects = 0;
  8750. op->defaults = NULL;
  8751. op->defaults_tuple = NULL;
  8752. op->defaults_kwdict = NULL;
  8753. op->defaults_getter = NULL;
  8754. op->func_annotations = NULL;
  8755. PyObject_GC_Track(op);
  8756. return (PyObject *) op;
  8757. }
  8758. static int
  8759. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  8760. {
  8761. Py_CLEAR(m->func_closure);
  8762. Py_CLEAR(m->func.m_module);
  8763. Py_CLEAR(m->func_dict);
  8764. Py_CLEAR(m->func_name);
  8765. Py_CLEAR(m->func_qualname);
  8766. Py_CLEAR(m->func_doc);
  8767. Py_CLEAR(m->func_globals);
  8768. Py_CLEAR(m->func_code);
  8769. Py_CLEAR(m->func_classobj);
  8770. Py_CLEAR(m->defaults_tuple);
  8771. Py_CLEAR(m->defaults_kwdict);
  8772. Py_CLEAR(m->func_annotations);
  8773. if (m->defaults) {
  8774. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  8775. int i;
  8776. for (i = 0; i < m->defaults_pyobjects; i++)
  8777. Py_XDECREF(pydefaults[i]);
  8778. PyMem_Free(m->defaults);
  8779. m->defaults = NULL;
  8780. }
  8781. return 0;
  8782. }
  8783. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  8784. {
  8785. PyObject_GC_UnTrack(m);
  8786. if (m->func_weakreflist != NULL)
  8787. PyObject_ClearWeakRefs((PyObject *) m);
  8788. __Pyx_CyFunction_clear(m);
  8789. PyObject_GC_Del(m);
  8790. }
  8791. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  8792. {
  8793. Py_VISIT(m->func_closure);
  8794. Py_VISIT(m->func.m_module);
  8795. Py_VISIT(m->func_dict);
  8796. Py_VISIT(m->func_name);
  8797. Py_VISIT(m->func_qualname);
  8798. Py_VISIT(m->func_doc);
  8799. Py_VISIT(m->func_globals);
  8800. Py_VISIT(m->func_code);
  8801. Py_VISIT(m->func_classobj);
  8802. Py_VISIT(m->defaults_tuple);
  8803. Py_VISIT(m->defaults_kwdict);
  8804. if (m->defaults) {
  8805. PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
  8806. int i;
  8807. for (i = 0; i < m->defaults_pyobjects; i++)
  8808. Py_VISIT(pydefaults[i]);
  8809. }
  8810. return 0;
  8811. }
  8812. static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
  8813. {
  8814. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  8815. if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
  8816. Py_INCREF(func);
  8817. return func;
  8818. }
  8819. if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
  8820. if (type == NULL)
  8821. type = (PyObject *)(Py_TYPE(obj));
  8822. return PyMethod_New(func,
  8823. type, (PyObject *)(Py_TYPE(type)));
  8824. }
  8825. if (obj == Py_None)
  8826. obj = NULL;
  8827. return PyMethod_New(func, obj, type);
  8828. }
  8829. static PyObject*
  8830. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  8831. {
  8832. #if PY_MAJOR_VERSION >= 3
  8833. return PyUnicode_FromFormat("<cyfunction %U at %p>",
  8834. op->func_qualname, (void *)op);
  8835. #else
  8836. return PyString_FromFormat("<cyfunction %s at %p>",
  8837. PyString_AsString(op->func_qualname), (void *)op);
  8838. #endif
  8839. }
  8840. #if CYTHON_COMPILING_IN_PYPY
  8841. static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  8842. PyCFunctionObject* f = (PyCFunctionObject*)func;
  8843. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  8844. PyObject *self = PyCFunction_GET_SELF(func);
  8845. Py_ssize_t size;
  8846. switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
  8847. case METH_VARARGS:
  8848. if (likely(kw == NULL) || PyDict_Size(kw) == 0)
  8849. return (*meth)(self, arg);
  8850. break;
  8851. case METH_VARARGS | METH_KEYWORDS:
  8852. return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
  8853. case METH_NOARGS:
  8854. if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
  8855. size = PyTuple_GET_SIZE(arg);
  8856. if (size == 0)
  8857. return (*meth)(self, NULL);
  8858. PyErr_Format(PyExc_TypeError,
  8859. "%.200s() takes no arguments (%zd given)",
  8860. f->m_ml->ml_name, size);
  8861. return NULL;
  8862. }
  8863. break;
  8864. case METH_O:
  8865. if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
  8866. size = PyTuple_GET_SIZE(arg);
  8867. if (size == 1)
  8868. return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
  8869. PyErr_Format(PyExc_TypeError,
  8870. "%.200s() takes exactly one argument (%zd given)",
  8871. f->m_ml->ml_name, size);
  8872. return NULL;
  8873. }
  8874. break;
  8875. default:
  8876. PyErr_SetString(PyExc_SystemError, "Bad call flags in "
  8877. "__Pyx_CyFunction_Call. METH_OLDARGS is no "
  8878. "longer supported!");
  8879. return NULL;
  8880. }
  8881. PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
  8882. f->m_ml->ml_name);
  8883. return NULL;
  8884. }
  8885. #else
  8886. static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  8887. return PyCFunction_Call(func, arg, kw);
  8888. }
  8889. #endif
  8890. static PyTypeObject __pyx_CyFunctionType_type = {
  8891. PyVarObject_HEAD_INIT(0, 0)
  8892. __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
  8893. sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
  8894. 0, /*tp_itemsize*/
  8895. (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
  8896. 0, /*tp_print*/
  8897. 0, /*tp_getattr*/
  8898. 0, /*tp_setattr*/
  8899. #if PY_MAJOR_VERSION < 3
  8900. 0, /*tp_compare*/
  8901. #else
  8902. 0, /*reserved*/
  8903. #endif
  8904. (reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
  8905. 0, /*tp_as_number*/
  8906. 0, /*tp_as_sequence*/
  8907. 0, /*tp_as_mapping*/
  8908. 0, /*tp_hash*/
  8909. __Pyx_CyFunction_Call, /*tp_call*/
  8910. 0, /*tp_str*/
  8911. 0, /*tp_getattro*/
  8912. 0, /*tp_setattro*/
  8913. 0, /*tp_as_buffer*/
  8914. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
  8915. 0, /*tp_doc*/
  8916. (traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
  8917. (inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
  8918. 0, /*tp_richcompare*/
  8919. offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
  8920. 0, /*tp_iter*/
  8921. 0, /*tp_iternext*/
  8922. __pyx_CyFunction_methods, /*tp_methods*/
  8923. __pyx_CyFunction_members, /*tp_members*/
  8924. __pyx_CyFunction_getsets, /*tp_getset*/
  8925. 0, /*tp_base*/
  8926. 0, /*tp_dict*/
  8927. __Pyx_CyFunction_descr_get, /*tp_descr_get*/
  8928. 0, /*tp_descr_set*/
  8929. offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
  8930. 0, /*tp_init*/
  8931. 0, /*tp_alloc*/
  8932. 0, /*tp_new*/
  8933. 0, /*tp_free*/
  8934. 0, /*tp_is_gc*/
  8935. 0, /*tp_bases*/
  8936. 0, /*tp_mro*/
  8937. 0, /*tp_cache*/
  8938. 0, /*tp_subclasses*/
  8939. 0, /*tp_weaklist*/
  8940. 0, /*tp_del*/
  8941. #if PY_VERSION_HEX >= 0x02060000
  8942. 0, /*tp_version_tag*/
  8943. #endif
  8944. #if PY_VERSION_HEX >= 0x030400a1
  8945. 0, /*tp_finalize*/
  8946. #endif
  8947. };
  8948. static int __Pyx_CyFunction_init(void) {
  8949. #if !CYTHON_COMPILING_IN_PYPY
  8950. __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
  8951. #endif
  8952. __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
  8953. if (__pyx_CyFunctionType == NULL) {
  8954. return -1;
  8955. }
  8956. return 0;
  8957. }
  8958. static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
  8959. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  8960. m->defaults = PyMem_Malloc(size);
  8961. if (!m->defaults)
  8962. return PyErr_NoMemory();
  8963. memset(m->defaults, 0, size);
  8964. m->defaults_pyobjects = pyobjects;
  8965. return m->defaults;
  8966. }
  8967. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  8968. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  8969. m->defaults_tuple = tuple;
  8970. Py_INCREF(tuple);
  8971. }
  8972. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  8973. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  8974. m->defaults_kwdict = dict;
  8975. Py_INCREF(dict);
  8976. }
  8977. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  8978. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  8979. m->func_annotations = dict;
  8980. Py_INCREF(dict);
  8981. }
  8982. static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
  8983. Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
  8984. for (i=0; i < nbases; i++) {
  8985. PyTypeObject *tmptype;
  8986. PyObject *tmp = PyTuple_GET_ITEM(bases, i);
  8987. tmptype = Py_TYPE(tmp);
  8988. #if PY_MAJOR_VERSION < 3
  8989. if (tmptype == &PyClass_Type)
  8990. continue;
  8991. #endif
  8992. if (!metaclass) {
  8993. metaclass = tmptype;
  8994. continue;
  8995. }
  8996. if (PyType_IsSubtype(metaclass, tmptype))
  8997. continue;
  8998. if (PyType_IsSubtype(tmptype, metaclass)) {
  8999. metaclass = tmptype;
  9000. continue;
  9001. }
  9002. PyErr_SetString(PyExc_TypeError,
  9003. "metaclass conflict: "
  9004. "the metaclass of a derived class "
  9005. "must be a (non-strict) subclass "
  9006. "of the metaclasses of all its bases");
  9007. return NULL;
  9008. }
  9009. if (!metaclass) {
  9010. #if PY_MAJOR_VERSION < 3
  9011. metaclass = &PyClass_Type;
  9012. #else
  9013. metaclass = &PyType_Type;
  9014. #endif
  9015. }
  9016. Py_INCREF((PyObject*) metaclass);
  9017. return (PyObject*) metaclass;
  9018. }
  9019. static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
  9020. PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
  9021. PyObject *ns;
  9022. if (metaclass) {
  9023. PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
  9024. if (prep) {
  9025. PyObject *pargs = PyTuple_Pack(2, name, bases);
  9026. if (unlikely(!pargs)) {
  9027. Py_DECREF(prep);
  9028. return NULL;
  9029. }
  9030. ns = PyObject_Call(prep, pargs, mkw);
  9031. Py_DECREF(prep);
  9032. Py_DECREF(pargs);
  9033. } else {
  9034. if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
  9035. return NULL;
  9036. PyErr_Clear();
  9037. ns = PyDict_New();
  9038. }
  9039. } else {
  9040. ns = PyDict_New();
  9041. }
  9042. if (unlikely(!ns))
  9043. return NULL;
  9044. if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
  9045. if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
  9046. if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
  9047. return ns;
  9048. bad:
  9049. Py_DECREF(ns);
  9050. return NULL;
  9051. }
  9052. static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
  9053. PyObject *dict, PyObject *mkw,
  9054. int calculate_metaclass, int allow_py2_metaclass) {
  9055. PyObject *result, *margs;
  9056. PyObject *owned_metaclass = NULL;
  9057. if (allow_py2_metaclass) {
  9058. owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
  9059. if (owned_metaclass) {
  9060. metaclass = owned_metaclass;
  9061. } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
  9062. PyErr_Clear();
  9063. } else {
  9064. return NULL;
  9065. }
  9066. }
  9067. if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
  9068. metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
  9069. Py_XDECREF(owned_metaclass);
  9070. if (unlikely(!metaclass))
  9071. return NULL;
  9072. owned_metaclass = metaclass;
  9073. }
  9074. margs = PyTuple_Pack(3, name, bases, dict);
  9075. if (unlikely(!margs)) {
  9076. result = NULL;
  9077. } else {
  9078. result = PyObject_Call(metaclass, margs, mkw);
  9079. Py_DECREF(margs);
  9080. }
  9081. Py_XDECREF(owned_metaclass);
  9082. return result;
  9083. }
  9084. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  9085. PyObject *empty_list = 0;
  9086. PyObject *module = 0;
  9087. PyObject *global_dict = 0;
  9088. PyObject *empty_dict = 0;
  9089. PyObject *list;
  9090. #if PY_VERSION_HEX < 0x03030000
  9091. PyObject *py_import;
  9092. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  9093. if (!py_import)
  9094. goto bad;
  9095. #endif
  9096. if (from_list)
  9097. list = from_list;
  9098. else {
  9099. empty_list = PyList_New(0);
  9100. if (!empty_list)
  9101. goto bad;
  9102. list = empty_list;
  9103. }
  9104. global_dict = PyModule_GetDict(__pyx_m);
  9105. if (!global_dict)
  9106. goto bad;
  9107. empty_dict = PyDict_New();
  9108. if (!empty_dict)
  9109. goto bad;
  9110. #if PY_VERSION_HEX >= 0x02050000
  9111. {
  9112. #if PY_MAJOR_VERSION >= 3
  9113. if (level == -1) {
  9114. if (strchr(__Pyx_MODULE_NAME, '.')) {
  9115. #if PY_VERSION_HEX < 0x03030000
  9116. PyObject *py_level = PyInt_FromLong(1);
  9117. if (!py_level)
  9118. goto bad;
  9119. module = PyObject_CallFunctionObjArgs(py_import,
  9120. name, global_dict, empty_dict, list, py_level, NULL);
  9121. Py_DECREF(py_level);
  9122. #else
  9123. module = PyImport_ImportModuleLevelObject(
  9124. name, global_dict, empty_dict, list, 1);
  9125. #endif
  9126. if (!module) {
  9127. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  9128. goto bad;
  9129. PyErr_Clear();
  9130. }
  9131. }
  9132. level = 0; /* try absolute import on failure */
  9133. }
  9134. #endif
  9135. if (!module) {
  9136. #if PY_VERSION_HEX < 0x03030000
  9137. PyObject *py_level = PyInt_FromLong(level);
  9138. if (!py_level)
  9139. goto bad;
  9140. module = PyObject_CallFunctionObjArgs(py_import,
  9141. name, global_dict, empty_dict, list, py_level, NULL);
  9142. Py_DECREF(py_level);
  9143. #else
  9144. module = PyImport_ImportModuleLevelObject(
  9145. name, global_dict, empty_dict, list, level);
  9146. #endif
  9147. }
  9148. }
  9149. #else
  9150. if (level>0) {
  9151. PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
  9152. goto bad;
  9153. }
  9154. module = PyObject_CallFunctionObjArgs(py_import,
  9155. name, global_dict, empty_dict, list, NULL);
  9156. #endif
  9157. bad:
  9158. #if PY_VERSION_HEX < 0x03030000
  9159. Py_XDECREF(py_import);
  9160. #endif
  9161. Py_XDECREF(empty_list);
  9162. Py_XDECREF(empty_dict);
  9163. return module;
  9164. }
  9165. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
  9166. static PyObject *__Pyx_GetStdout(void) {
  9167. PyObject *f = PySys_GetObject((char *)"stdout");
  9168. if (!f) {
  9169. PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
  9170. }
  9171. return f;
  9172. }
  9173. static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
  9174. int i;
  9175. if (!f) {
  9176. if (!(f = __Pyx_GetStdout()))
  9177. return -1;
  9178. }
  9179. Py_INCREF(f);
  9180. for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
  9181. PyObject* v;
  9182. if (PyFile_SoftSpace(f, 1)) {
  9183. if (PyFile_WriteString(" ", f) < 0)
  9184. goto error;
  9185. }
  9186. v = PyTuple_GET_ITEM(arg_tuple, i);
  9187. if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
  9188. goto error;
  9189. if (PyString_Check(v)) {
  9190. char *s = PyString_AsString(v);
  9191. Py_ssize_t len = PyString_Size(v);
  9192. if (len > 0) {
  9193. switch (s[len-1]) {
  9194. case ' ': break;
  9195. case '\f': case '\r': case '\n': case '\t': case '\v':
  9196. PyFile_SoftSpace(f, 0);
  9197. break;
  9198. default: break;
  9199. }
  9200. }
  9201. }
  9202. }
  9203. if (newline) {
  9204. if (PyFile_WriteString("\n", f) < 0)
  9205. goto error;
  9206. PyFile_SoftSpace(f, 0);
  9207. }
  9208. Py_DECREF(f);
  9209. return 0;
  9210. error:
  9211. Py_DECREF(f);
  9212. return -1;
  9213. }
  9214. #else /* Python 3 has a print function */
  9215. static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
  9216. PyObject* kwargs = 0;
  9217. PyObject* result = 0;
  9218. PyObject* end_string;
  9219. if (unlikely(!__pyx_print)) {
  9220. __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
  9221. if (!__pyx_print)
  9222. return -1;
  9223. }
  9224. if (stream) {
  9225. kwargs = PyDict_New();
  9226. if (unlikely(!kwargs))
  9227. return -1;
  9228. if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
  9229. goto bad;
  9230. if (!newline) {
  9231. end_string = PyUnicode_FromStringAndSize(" ", 1);
  9232. if (unlikely(!end_string))
  9233. goto bad;
  9234. if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
  9235. Py_DECREF(end_string);
  9236. goto bad;
  9237. }
  9238. Py_DECREF(end_string);
  9239. }
  9240. } else if (!newline) {
  9241. if (unlikely(!__pyx_print_kwargs)) {
  9242. __pyx_print_kwargs = PyDict_New();
  9243. if (unlikely(!__pyx_print_kwargs))
  9244. return -1;
  9245. end_string = PyUnicode_FromStringAndSize(" ", 1);
  9246. if (unlikely(!end_string))
  9247. return -1;
  9248. if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
  9249. Py_DECREF(end_string);
  9250. return -1;
  9251. }
  9252. Py_DECREF(end_string);
  9253. }
  9254. kwargs = __pyx_print_kwargs;
  9255. }
  9256. result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
  9257. if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
  9258. Py_DECREF(kwargs);
  9259. if (!result)
  9260. return -1;
  9261. Py_DECREF(result);
  9262. return 0;
  9263. bad:
  9264. if (kwargs != __pyx_print_kwargs)
  9265. Py_XDECREF(kwargs);
  9266. return -1;
  9267. }
  9268. #endif
  9269. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
  9270. static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
  9271. if (!f) {
  9272. if (!(f = __Pyx_GetStdout()))
  9273. return -1;
  9274. }
  9275. Py_INCREF(f);
  9276. if (PyFile_SoftSpace(f, 0)) {
  9277. if (PyFile_WriteString(" ", f) < 0)
  9278. goto error;
  9279. }
  9280. if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
  9281. goto error;
  9282. if (PyFile_WriteString("\n", f) < 0)
  9283. goto error;
  9284. Py_DECREF(f);
  9285. return 0;
  9286. error:
  9287. Py_DECREF(f);
  9288. return -1;
  9289. /* the line below is just to avoid C compiler
  9290. * warnings about unused functions */
  9291. return __Pyx_Print(f, NULL, 0);
  9292. }
  9293. #else /* Python 3 has a print function */
  9294. static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
  9295. int res;
  9296. PyObject* arg_tuple = PyTuple_Pack(1, o);
  9297. if (unlikely(!arg_tuple))
  9298. return -1;
  9299. res = __Pyx_Print(stream, arg_tuple, 1);
  9300. Py_DECREF(arg_tuple);
  9301. return res;
  9302. }
  9303. #endif
  9304. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  9305. const long neg_one = (long) -1, const_zero = 0;
  9306. const int is_unsigned = neg_one > const_zero;
  9307. if (is_unsigned) {
  9308. if (sizeof(long) < sizeof(long)) {
  9309. return PyInt_FromLong((long) value);
  9310. } else if (sizeof(long) <= sizeof(unsigned long)) {
  9311. return PyLong_FromUnsignedLong((unsigned long) value);
  9312. } else if (sizeof(long) <= sizeof(unsigned long long)) {
  9313. return PyLong_FromUnsignedLongLong((unsigned long long) value);
  9314. }
  9315. } else {
  9316. if (sizeof(long) <= sizeof(long)) {
  9317. return PyInt_FromLong((long) value);
  9318. } else if (sizeof(long) <= sizeof(long long)) {
  9319. return PyLong_FromLongLong((long long) value);
  9320. }
  9321. }
  9322. {
  9323. int one = 1; int little = (int)*(unsigned char *)&one;
  9324. unsigned char *bytes = (unsigned char *)&value;
  9325. return _PyLong_FromByteArray(bytes, sizeof(long),
  9326. little, !is_unsigned);
  9327. }
  9328. }
  9329. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \
  9330. { \
  9331. func_type value = func(x); \
  9332. if (sizeof(target_type) < sizeof(func_type)) { \
  9333. if (unlikely(value != (func_type) (target_type) value)) { \
  9334. func_type zero = 0; \
  9335. PyErr_SetString(PyExc_OverflowError, \
  9336. (is_unsigned && unlikely(value < zero)) ? \
  9337. "can't convert negative value to " #target_type : \
  9338. "value too large to convert to " #target_type); \
  9339. return (target_type) -1; \
  9340. } \
  9341. } \
  9342. return (target_type) value; \
  9343. }
  9344. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9345. #if CYTHON_USE_PYLONG_INTERNALS
  9346. #include "longintrepr.h"
  9347. #endif
  9348. #endif
  9349. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  9350. const long neg_one = (long) -1, const_zero = 0;
  9351. const int is_unsigned = neg_one > const_zero;
  9352. #if PY_MAJOR_VERSION < 3
  9353. if (likely(PyInt_Check(x))) {
  9354. if (sizeof(long) < sizeof(long)) {
  9355. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG)
  9356. } else {
  9357. long val = PyInt_AS_LONG(x);
  9358. if (is_unsigned && unlikely(val < 0)) {
  9359. PyErr_SetString(PyExc_OverflowError,
  9360. "can't convert negative value to long");
  9361. return (long) -1;
  9362. }
  9363. return (long) val;
  9364. }
  9365. } else
  9366. #endif
  9367. if (likely(PyLong_Check(x))) {
  9368. if (is_unsigned) {
  9369. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9370. #if CYTHON_USE_PYLONG_INTERNALS
  9371. if (sizeof(digit) <= sizeof(long)) {
  9372. switch (Py_SIZE(x)) {
  9373. case 0: return 0;
  9374. case 1: return (long) ((PyLongObject*)x)->ob_digit[0];
  9375. }
  9376. }
  9377. #endif
  9378. #endif
  9379. if (unlikely(Py_SIZE(x) < 0)) {
  9380. PyErr_SetString(PyExc_OverflowError,
  9381. "can't convert negative value to long");
  9382. return (long) -1;
  9383. }
  9384. if (sizeof(long) <= sizeof(unsigned long)) {
  9385. __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong)
  9386. } else if (sizeof(long) <= sizeof(unsigned long long)) {
  9387. __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong)
  9388. }
  9389. } else {
  9390. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9391. #if CYTHON_USE_PYLONG_INTERNALS
  9392. if (sizeof(digit) <= sizeof(long)) {
  9393. switch (Py_SIZE(x)) {
  9394. case 0: return 0;
  9395. case 1: return +(long) ((PyLongObject*)x)->ob_digit[0];
  9396. case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
  9397. }
  9398. }
  9399. #endif
  9400. #endif
  9401. if (sizeof(long) <= sizeof(long)) {
  9402. __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong)
  9403. } else if (sizeof(long) <= sizeof(long long)) {
  9404. __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong)
  9405. }
  9406. }
  9407. {
  9408. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9409. PyErr_SetString(PyExc_RuntimeError,
  9410. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9411. #else
  9412. long val;
  9413. PyObject *v = __Pyx_PyNumber_Int(x);
  9414. #if PY_MAJOR_VERSION < 3
  9415. if (likely(v) && !PyLong_Check(v)) {
  9416. PyObject *tmp = v;
  9417. v = PyNumber_Long(tmp);
  9418. Py_DECREF(tmp);
  9419. }
  9420. #endif
  9421. if (likely(v)) {
  9422. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9423. unsigned char *bytes = (unsigned char *)&val;
  9424. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9425. bytes, sizeof(val),
  9426. is_little, !is_unsigned);
  9427. Py_DECREF(v);
  9428. if (likely(!ret))
  9429. return val;
  9430. }
  9431. #endif
  9432. return (long) -1;
  9433. }
  9434. } else {
  9435. long val;
  9436. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9437. if (!tmp) return (long) -1;
  9438. val = __Pyx_PyInt_As_long(tmp);
  9439. Py_DECREF(tmp);
  9440. return val;
  9441. }
  9442. }
  9443. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9444. #if CYTHON_USE_PYLONG_INTERNALS
  9445. #include "longintrepr.h"
  9446. #endif
  9447. #endif
  9448. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  9449. const int neg_one = (int) -1, const_zero = 0;
  9450. const int is_unsigned = neg_one > const_zero;
  9451. #if PY_MAJOR_VERSION < 3
  9452. if (likely(PyInt_Check(x))) {
  9453. if (sizeof(int) < sizeof(long)) {
  9454. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG)
  9455. } else {
  9456. long val = PyInt_AS_LONG(x);
  9457. if (is_unsigned && unlikely(val < 0)) {
  9458. PyErr_SetString(PyExc_OverflowError,
  9459. "can't convert negative value to int");
  9460. return (int) -1;
  9461. }
  9462. return (int) val;
  9463. }
  9464. } else
  9465. #endif
  9466. if (likely(PyLong_Check(x))) {
  9467. if (is_unsigned) {
  9468. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9469. #if CYTHON_USE_PYLONG_INTERNALS
  9470. if (sizeof(digit) <= sizeof(int)) {
  9471. switch (Py_SIZE(x)) {
  9472. case 0: return 0;
  9473. case 1: return (int) ((PyLongObject*)x)->ob_digit[0];
  9474. }
  9475. }
  9476. #endif
  9477. #endif
  9478. if (unlikely(Py_SIZE(x) < 0)) {
  9479. PyErr_SetString(PyExc_OverflowError,
  9480. "can't convert negative value to int");
  9481. return (int) -1;
  9482. }
  9483. if (sizeof(int) <= sizeof(unsigned long)) {
  9484. __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong)
  9485. } else if (sizeof(int) <= sizeof(unsigned long long)) {
  9486. __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong)
  9487. }
  9488. } else {
  9489. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9490. #if CYTHON_USE_PYLONG_INTERNALS
  9491. if (sizeof(digit) <= sizeof(int)) {
  9492. switch (Py_SIZE(x)) {
  9493. case 0: return 0;
  9494. case 1: return +(int) ((PyLongObject*)x)->ob_digit[0];
  9495. case -1: return -(int) ((PyLongObject*)x)->ob_digit[0];
  9496. }
  9497. }
  9498. #endif
  9499. #endif
  9500. if (sizeof(int) <= sizeof(long)) {
  9501. __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong)
  9502. } else if (sizeof(int) <= sizeof(long long)) {
  9503. __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong)
  9504. }
  9505. }
  9506. {
  9507. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9508. PyErr_SetString(PyExc_RuntimeError,
  9509. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9510. #else
  9511. int val;
  9512. PyObject *v = __Pyx_PyNumber_Int(x);
  9513. #if PY_MAJOR_VERSION < 3
  9514. if (likely(v) && !PyLong_Check(v)) {
  9515. PyObject *tmp = v;
  9516. v = PyNumber_Long(tmp);
  9517. Py_DECREF(tmp);
  9518. }
  9519. #endif
  9520. if (likely(v)) {
  9521. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9522. unsigned char *bytes = (unsigned char *)&val;
  9523. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9524. bytes, sizeof(val),
  9525. is_little, !is_unsigned);
  9526. Py_DECREF(v);
  9527. if (likely(!ret))
  9528. return val;
  9529. }
  9530. #endif
  9531. return (int) -1;
  9532. }
  9533. } else {
  9534. int val;
  9535. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9536. if (!tmp) return (int) -1;
  9537. val = __Pyx_PyInt_As_int(tmp);
  9538. Py_DECREF(tmp);
  9539. return val;
  9540. }
  9541. }
  9542. static int __Pyx_check_binary_version(void) {
  9543. char ctversion[4], rtversion[4];
  9544. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  9545. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  9546. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  9547. char message[200];
  9548. PyOS_snprintf(message, sizeof(message),
  9549. "compiletime version %s of module '%.100s' "
  9550. "does not match runtime version %s",
  9551. ctversion, __Pyx_MODULE_NAME, rtversion);
  9552. #if PY_VERSION_HEX < 0x02050000
  9553. return PyErr_Warn(NULL, message);
  9554. #else
  9555. return PyErr_WarnEx(NULL, message, 1);
  9556. #endif
  9557. }
  9558. return 0;
  9559. }
  9560. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  9561. int start = 0, mid = 0, end = count - 1;
  9562. if (end >= 0 && code_line > entries[end].code_line) {
  9563. return count;
  9564. }
  9565. while (start < end) {
  9566. mid = (start + end) / 2;
  9567. if (code_line < entries[mid].code_line) {
  9568. end = mid;
  9569. } else if (code_line > entries[mid].code_line) {
  9570. start = mid + 1;
  9571. } else {
  9572. return mid;
  9573. }
  9574. }
  9575. if (code_line <= entries[mid].code_line) {
  9576. return mid;
  9577. } else {
  9578. return mid + 1;
  9579. }
  9580. }
  9581. static PyCodeObject *__pyx_find_code_object(int code_line) {
  9582. PyCodeObject* code_object;
  9583. int pos;
  9584. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  9585. return NULL;
  9586. }
  9587. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  9588. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  9589. return NULL;
  9590. }
  9591. code_object = __pyx_code_cache.entries[pos].code_object;
  9592. Py_INCREF(code_object);
  9593. return code_object;
  9594. }
  9595. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  9596. int pos, i;
  9597. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  9598. if (unlikely(!code_line)) {
  9599. return;
  9600. }
  9601. if (unlikely(!entries)) {
  9602. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  9603. if (likely(entries)) {
  9604. __pyx_code_cache.entries = entries;
  9605. __pyx_code_cache.max_count = 64;
  9606. __pyx_code_cache.count = 1;
  9607. entries[0].code_line = code_line;
  9608. entries[0].code_object = code_object;
  9609. Py_INCREF(code_object);
  9610. }
  9611. return;
  9612. }
  9613. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  9614. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  9615. PyCodeObject* tmp = entries[pos].code_object;
  9616. entries[pos].code_object = code_object;
  9617. Py_DECREF(tmp);
  9618. return;
  9619. }
  9620. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  9621. int new_max = __pyx_code_cache.max_count + 64;
  9622. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  9623. __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  9624. if (unlikely(!entries)) {
  9625. return;
  9626. }
  9627. __pyx_code_cache.entries = entries;
  9628. __pyx_code_cache.max_count = new_max;
  9629. }
  9630. for (i=__pyx_code_cache.count; i>pos; i--) {
  9631. entries[i] = entries[i-1];
  9632. }
  9633. entries[pos].code_line = code_line;
  9634. entries[pos].code_object = code_object;
  9635. __pyx_code_cache.count++;
  9636. Py_INCREF(code_object);
  9637. }
  9638. #include "compile.h"
  9639. #include "frameobject.h"
  9640. #include "traceback.h"
  9641. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  9642. const char *funcname, int c_line,
  9643. int py_line, const char *filename) {
  9644. PyCodeObject *py_code = 0;
  9645. PyObject *py_srcfile = 0;
  9646. PyObject *py_funcname = 0;
  9647. #if PY_MAJOR_VERSION < 3
  9648. py_srcfile = PyString_FromString(filename);
  9649. #else
  9650. py_srcfile = PyUnicode_FromString(filename);
  9651. #endif
  9652. if (!py_srcfile) goto bad;
  9653. if (c_line) {
  9654. #if PY_MAJOR_VERSION < 3
  9655. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  9656. #else
  9657. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  9658. #endif
  9659. }
  9660. else {
  9661. #if PY_MAJOR_VERSION < 3
  9662. py_funcname = PyString_FromString(funcname);
  9663. #else
  9664. py_funcname = PyUnicode_FromString(funcname);
  9665. #endif
  9666. }
  9667. if (!py_funcname) goto bad;
  9668. py_code = __Pyx_PyCode_New(
  9669. 0, /*int argcount,*/
  9670. 0, /*int kwonlyargcount,*/
  9671. 0, /*int nlocals,*/
  9672. 0, /*int stacksize,*/
  9673. 0, /*int flags,*/
  9674. __pyx_empty_bytes, /*PyObject *code,*/
  9675. __pyx_empty_tuple, /*PyObject *consts,*/
  9676. __pyx_empty_tuple, /*PyObject *names,*/
  9677. __pyx_empty_tuple, /*PyObject *varnames,*/
  9678. __pyx_empty_tuple, /*PyObject *freevars,*/
  9679. __pyx_empty_tuple, /*PyObject *cellvars,*/
  9680. py_srcfile, /*PyObject *filename,*/
  9681. py_funcname, /*PyObject *name,*/
  9682. py_line, /*int firstlineno,*/
  9683. __pyx_empty_bytes /*PyObject *lnotab*/
  9684. );
  9685. Py_DECREF(py_srcfile);
  9686. Py_DECREF(py_funcname);
  9687. return py_code;
  9688. bad:
  9689. Py_XDECREF(py_srcfile);
  9690. Py_XDECREF(py_funcname);
  9691. return NULL;
  9692. }
  9693. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  9694. int py_line, const char *filename) {
  9695. PyCodeObject *py_code = 0;
  9696. PyObject *py_globals = 0;
  9697. PyFrameObject *py_frame = 0;
  9698. py_code = __pyx_find_code_object(c_line ? c_line : py_line);
  9699. if (!py_code) {
  9700. py_code = __Pyx_CreateCodeObjectForTraceback(
  9701. funcname, c_line, py_line, filename);
  9702. if (!py_code) goto bad;
  9703. __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
  9704. }
  9705. py_globals = PyModule_GetDict(__pyx_m);
  9706. if (!py_globals) goto bad;
  9707. py_frame = PyFrame_New(
  9708. PyThreadState_GET(), /*PyThreadState *tstate,*/
  9709. py_code, /*PyCodeObject *code,*/
  9710. py_globals, /*PyObject *globals,*/
  9711. 0 /*PyObject *locals*/
  9712. );
  9713. if (!py_frame) goto bad;
  9714. py_frame->f_lineno = py_line;
  9715. PyTraceBack_Here(py_frame);
  9716. bad:
  9717. Py_XDECREF(py_code);
  9718. Py_XDECREF(py_frame);
  9719. }
  9720. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  9721. while (t->p) {
  9722. #if PY_MAJOR_VERSION < 3
  9723. if (t->is_unicode) {
  9724. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  9725. } else if (t->intern) {
  9726. *t->p = PyString_InternFromString(t->s);
  9727. } else {
  9728. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  9729. }
  9730. #else /* Python 3+ has unicode identifiers */
  9731. if (t->is_unicode | t->is_str) {
  9732. if (t->intern) {
  9733. *t->p = PyUnicode_InternFromString(t->s);
  9734. } else if (t->encoding) {
  9735. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  9736. } else {
  9737. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  9738. }
  9739. } else {
  9740. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  9741. }
  9742. #endif
  9743. if (!*t->p)
  9744. return -1;
  9745. ++t;
  9746. }
  9747. return 0;
  9748. }
  9749. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
  9750. return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
  9751. }
  9752. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
  9753. Py_ssize_t ignore;
  9754. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  9755. }
  9756. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  9757. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  9758. if (
  9759. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9760. __Pyx_sys_getdefaultencoding_not_ascii &&
  9761. #endif
  9762. PyUnicode_Check(o)) {
  9763. #if PY_VERSION_HEX < 0x03030000
  9764. char* defenc_c;
  9765. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  9766. if (!defenc) return NULL;
  9767. defenc_c = PyBytes_AS_STRING(defenc);
  9768. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9769. {
  9770. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  9771. char* c;
  9772. for (c = defenc_c; c < end; c++) {
  9773. if ((unsigned char) (*c) >= 128) {
  9774. PyUnicode_AsASCIIString(o);
  9775. return NULL;
  9776. }
  9777. }
  9778. }
  9779. #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
  9780. *length = PyBytes_GET_SIZE(defenc);
  9781. return defenc_c;
  9782. #else /* PY_VERSION_HEX < 0x03030000 */
  9783. if (PyUnicode_READY(o) == -1) return NULL;
  9784. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9785. if (PyUnicode_IS_ASCII(o)) {
  9786. *length = PyUnicode_GET_DATA_SIZE(o);
  9787. return PyUnicode_AsUTF8(o);
  9788. } else {
  9789. PyUnicode_AsASCIIString(o);
  9790. return NULL;
  9791. }
  9792. #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
  9793. return PyUnicode_AsUTF8AndSize(o, length);
  9794. #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
  9795. #endif /* PY_VERSION_HEX < 0x03030000 */
  9796. } else
  9797. #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
  9798. #if !CYTHON_COMPILING_IN_PYPY
  9799. #if PY_VERSION_HEX >= 0x02060000
  9800. if (PyByteArray_Check(o)) {
  9801. *length = PyByteArray_GET_SIZE(o);
  9802. return PyByteArray_AS_STRING(o);
  9803. } else
  9804. #endif
  9805. #endif
  9806. {
  9807. char* result;
  9808. int r = PyBytes_AsStringAndSize(o, &result, length);
  9809. if (unlikely(r < 0)) {
  9810. return NULL;
  9811. } else {
  9812. return result;
  9813. }
  9814. }
  9815. }
  9816. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  9817. int is_true = x == Py_True;
  9818. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  9819. else return PyObject_IsTrue(x);
  9820. }
  9821. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  9822. PyNumberMethods *m;
  9823. const char *name = NULL;
  9824. PyObject *res = NULL;
  9825. #if PY_MAJOR_VERSION < 3
  9826. if (PyInt_Check(x) || PyLong_Check(x))
  9827. #else
  9828. if (PyLong_Check(x))
  9829. #endif
  9830. return Py_INCREF(x), x;
  9831. m = Py_TYPE(x)->tp_as_number;
  9832. #if PY_MAJOR_VERSION < 3
  9833. if (m && m->nb_int) {
  9834. name = "int";
  9835. res = PyNumber_Int(x);
  9836. }
  9837. else if (m && m->nb_long) {
  9838. name = "long";
  9839. res = PyNumber_Long(x);
  9840. }
  9841. #else
  9842. if (m && m->nb_int) {
  9843. name = "int";
  9844. res = PyNumber_Long(x);
  9845. }
  9846. #endif
  9847. if (res) {
  9848. #if PY_MAJOR_VERSION < 3
  9849. if (!PyInt_Check(res) && !PyLong_Check(res)) {
  9850. #else
  9851. if (!PyLong_Check(res)) {
  9852. #endif
  9853. PyErr_Format(PyExc_TypeError,
  9854. "__%.4s__ returned non-%.4s (type %.200s)",
  9855. name, name, Py_TYPE(res)->tp_name);
  9856. Py_DECREF(res);
  9857. return NULL;
  9858. }
  9859. }
  9860. else if (!PyErr_Occurred()) {
  9861. PyErr_SetString(PyExc_TypeError,
  9862. "an integer is required");
  9863. }
  9864. return res;
  9865. }
  9866. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9867. #if CYTHON_USE_PYLONG_INTERNALS
  9868. #include "longintrepr.h"
  9869. #endif
  9870. #endif
  9871. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  9872. Py_ssize_t ival;
  9873. PyObject *x;
  9874. #if PY_MAJOR_VERSION < 3
  9875. if (likely(PyInt_CheckExact(b)))
  9876. return PyInt_AS_LONG(b);
  9877. #endif
  9878. if (likely(PyLong_CheckExact(b))) {
  9879. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9880. #if CYTHON_USE_PYLONG_INTERNALS
  9881. switch (Py_SIZE(b)) {
  9882. case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
  9883. case 0: return 0;
  9884. case 1: return ((PyLongObject*)b)->ob_digit[0];
  9885. }
  9886. #endif
  9887. #endif
  9888. #if PY_VERSION_HEX < 0x02060000
  9889. return PyInt_AsSsize_t(b);
  9890. #else
  9891. return PyLong_AsSsize_t(b);
  9892. #endif
  9893. }
  9894. x = PyNumber_Index(b);
  9895. if (!x) return -1;
  9896. ival = PyInt_AsSsize_t(x);
  9897. Py_DECREF(x);
  9898. return ival;
  9899. }
  9900. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  9901. #if PY_VERSION_HEX < 0x02050000
  9902. if (ival <= LONG_MAX)
  9903. return PyInt_FromLong((long)ival);
  9904. else {
  9905. unsigned char *bytes = (unsigned char *) &ival;
  9906. int one = 1; int little = (int)*(unsigned char*)&one;
  9907. return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
  9908. }
  9909. #else
  9910. return PyInt_FromSize_t(ival);
  9911. #endif
  9912. }
  9913. #endif /* Py_PYTHON_H */