colormap.c 856 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453
  1. /* Generated by Cython 0.29.15 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "name": "app.colormap.colormap",
  6. "sources": [
  7. "app/colormap/colormap.pyx"
  8. ]
  9. },
  10. "module_name": "app.colormap.colormap"
  11. }
  12. END: Cython Metadata */
  13. #define PY_SSIZE_T_CLEAN
  14. #include "Python.h"
  15. #ifndef Py_PYTHON_H
  16. #error Python headers needed to compile C extensions, please install development version of Python.
  17. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  18. #error Cython requires Python 2.6+ or Python 3.3+.
  19. #else
  20. #define CYTHON_ABI "0_29_15"
  21. #define CYTHON_HEX_VERSION 0x001D0FF0
  22. #define CYTHON_FUTURE_DIVISION 1
  23. #include <stddef.h>
  24. #ifndef offsetof
  25. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  26. #endif
  27. #if !defined(WIN32) && !defined(MS_WINDOWS)
  28. #ifndef __stdcall
  29. #define __stdcall
  30. #endif
  31. #ifndef __cdecl
  32. #define __cdecl
  33. #endif
  34. #ifndef __fastcall
  35. #define __fastcall
  36. #endif
  37. #endif
  38. #ifndef DL_IMPORT
  39. #define DL_IMPORT(t) t
  40. #endif
  41. #ifndef DL_EXPORT
  42. #define DL_EXPORT(t) t
  43. #endif
  44. #define __PYX_COMMA ,
  45. #ifndef HAVE_LONG_LONG
  46. #if PY_VERSION_HEX >= 0x02070000
  47. #define HAVE_LONG_LONG
  48. #endif
  49. #endif
  50. #ifndef PY_LONG_LONG
  51. #define PY_LONG_LONG LONG_LONG
  52. #endif
  53. #ifndef Py_HUGE_VAL
  54. #define Py_HUGE_VAL HUGE_VAL
  55. #endif
  56. #ifdef PYPY_VERSION
  57. #define CYTHON_COMPILING_IN_PYPY 1
  58. #define CYTHON_COMPILING_IN_PYSTON 0
  59. #define CYTHON_COMPILING_IN_CPYTHON 0
  60. #undef CYTHON_USE_TYPE_SLOTS
  61. #define CYTHON_USE_TYPE_SLOTS 0
  62. #undef CYTHON_USE_PYTYPE_LOOKUP
  63. #define CYTHON_USE_PYTYPE_LOOKUP 0
  64. #if PY_VERSION_HEX < 0x03050000
  65. #undef CYTHON_USE_ASYNC_SLOTS
  66. #define CYTHON_USE_ASYNC_SLOTS 0
  67. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  68. #define CYTHON_USE_ASYNC_SLOTS 1
  69. #endif
  70. #undef CYTHON_USE_PYLIST_INTERNALS
  71. #define CYTHON_USE_PYLIST_INTERNALS 0
  72. #undef CYTHON_USE_UNICODE_INTERNALS
  73. #define CYTHON_USE_UNICODE_INTERNALS 0
  74. #undef CYTHON_USE_UNICODE_WRITER
  75. #define CYTHON_USE_UNICODE_WRITER 0
  76. #undef CYTHON_USE_PYLONG_INTERNALS
  77. #define CYTHON_USE_PYLONG_INTERNALS 0
  78. #undef CYTHON_AVOID_BORROWED_REFS
  79. #define CYTHON_AVOID_BORROWED_REFS 1
  80. #undef CYTHON_ASSUME_SAFE_MACROS
  81. #define CYTHON_ASSUME_SAFE_MACROS 0
  82. #undef CYTHON_UNPACK_METHODS
  83. #define CYTHON_UNPACK_METHODS 0
  84. #undef CYTHON_FAST_THREAD_STATE
  85. #define CYTHON_FAST_THREAD_STATE 0
  86. #undef CYTHON_FAST_PYCALL
  87. #define CYTHON_FAST_PYCALL 0
  88. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  89. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  90. #undef CYTHON_USE_TP_FINALIZE
  91. #define CYTHON_USE_TP_FINALIZE 0
  92. #undef CYTHON_USE_DICT_VERSIONS
  93. #define CYTHON_USE_DICT_VERSIONS 0
  94. #undef CYTHON_USE_EXC_INFO_STACK
  95. #define CYTHON_USE_EXC_INFO_STACK 0
  96. #elif defined(PYSTON_VERSION)
  97. #define CYTHON_COMPILING_IN_PYPY 0
  98. #define CYTHON_COMPILING_IN_PYSTON 1
  99. #define CYTHON_COMPILING_IN_CPYTHON 0
  100. #ifndef CYTHON_USE_TYPE_SLOTS
  101. #define CYTHON_USE_TYPE_SLOTS 1
  102. #endif
  103. #undef CYTHON_USE_PYTYPE_LOOKUP
  104. #define CYTHON_USE_PYTYPE_LOOKUP 0
  105. #undef CYTHON_USE_ASYNC_SLOTS
  106. #define CYTHON_USE_ASYNC_SLOTS 0
  107. #undef CYTHON_USE_PYLIST_INTERNALS
  108. #define CYTHON_USE_PYLIST_INTERNALS 0
  109. #ifndef CYTHON_USE_UNICODE_INTERNALS
  110. #define CYTHON_USE_UNICODE_INTERNALS 1
  111. #endif
  112. #undef CYTHON_USE_UNICODE_WRITER
  113. #define CYTHON_USE_UNICODE_WRITER 0
  114. #undef CYTHON_USE_PYLONG_INTERNALS
  115. #define CYTHON_USE_PYLONG_INTERNALS 0
  116. #ifndef CYTHON_AVOID_BORROWED_REFS
  117. #define CYTHON_AVOID_BORROWED_REFS 0
  118. #endif
  119. #ifndef CYTHON_ASSUME_SAFE_MACROS
  120. #define CYTHON_ASSUME_SAFE_MACROS 1
  121. #endif
  122. #ifndef CYTHON_UNPACK_METHODS
  123. #define CYTHON_UNPACK_METHODS 1
  124. #endif
  125. #undef CYTHON_FAST_THREAD_STATE
  126. #define CYTHON_FAST_THREAD_STATE 0
  127. #undef CYTHON_FAST_PYCALL
  128. #define CYTHON_FAST_PYCALL 0
  129. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  130. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  131. #undef CYTHON_USE_TP_FINALIZE
  132. #define CYTHON_USE_TP_FINALIZE 0
  133. #undef CYTHON_USE_DICT_VERSIONS
  134. #define CYTHON_USE_DICT_VERSIONS 0
  135. #undef CYTHON_USE_EXC_INFO_STACK
  136. #define CYTHON_USE_EXC_INFO_STACK 0
  137. #else
  138. #define CYTHON_COMPILING_IN_PYPY 0
  139. #define CYTHON_COMPILING_IN_PYSTON 0
  140. #define CYTHON_COMPILING_IN_CPYTHON 1
  141. #ifndef CYTHON_USE_TYPE_SLOTS
  142. #define CYTHON_USE_TYPE_SLOTS 1
  143. #endif
  144. #if PY_VERSION_HEX < 0x02070000
  145. #undef CYTHON_USE_PYTYPE_LOOKUP
  146. #define CYTHON_USE_PYTYPE_LOOKUP 0
  147. #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  148. #define CYTHON_USE_PYTYPE_LOOKUP 1
  149. #endif
  150. #if PY_MAJOR_VERSION < 3
  151. #undef CYTHON_USE_ASYNC_SLOTS
  152. #define CYTHON_USE_ASYNC_SLOTS 0
  153. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  154. #define CYTHON_USE_ASYNC_SLOTS 1
  155. #endif
  156. #if PY_VERSION_HEX < 0x02070000
  157. #undef CYTHON_USE_PYLONG_INTERNALS
  158. #define CYTHON_USE_PYLONG_INTERNALS 0
  159. #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  160. #define CYTHON_USE_PYLONG_INTERNALS 1
  161. #endif
  162. #ifndef CYTHON_USE_PYLIST_INTERNALS
  163. #define CYTHON_USE_PYLIST_INTERNALS 1
  164. #endif
  165. #ifndef CYTHON_USE_UNICODE_INTERNALS
  166. #define CYTHON_USE_UNICODE_INTERNALS 1
  167. #endif
  168. #if PY_VERSION_HEX < 0x030300F0
  169. #undef CYTHON_USE_UNICODE_WRITER
  170. #define CYTHON_USE_UNICODE_WRITER 0
  171. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  172. #define CYTHON_USE_UNICODE_WRITER 1
  173. #endif
  174. #ifndef CYTHON_AVOID_BORROWED_REFS
  175. #define CYTHON_AVOID_BORROWED_REFS 0
  176. #endif
  177. #ifndef CYTHON_ASSUME_SAFE_MACROS
  178. #define CYTHON_ASSUME_SAFE_MACROS 1
  179. #endif
  180. #ifndef CYTHON_UNPACK_METHODS
  181. #define CYTHON_UNPACK_METHODS 1
  182. #endif
  183. #ifndef CYTHON_FAST_THREAD_STATE
  184. #define CYTHON_FAST_THREAD_STATE 1
  185. #endif
  186. #ifndef CYTHON_FAST_PYCALL
  187. #define CYTHON_FAST_PYCALL 1
  188. #endif
  189. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  190. #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  191. #endif
  192. #ifndef CYTHON_USE_TP_FINALIZE
  193. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  194. #endif
  195. #ifndef CYTHON_USE_DICT_VERSIONS
  196. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  197. #endif
  198. #ifndef CYTHON_USE_EXC_INFO_STACK
  199. #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  200. #endif
  201. #endif
  202. #if !defined(CYTHON_FAST_PYCCALL)
  203. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  204. #endif
  205. #if CYTHON_USE_PYLONG_INTERNALS
  206. #include "longintrepr.h"
  207. #undef SHIFT
  208. #undef BASE
  209. #undef MASK
  210. #ifdef SIZEOF_VOID_P
  211. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  212. #endif
  213. #endif
  214. #ifndef __has_attribute
  215. #define __has_attribute(x) 0
  216. #endif
  217. #ifndef __has_cpp_attribute
  218. #define __has_cpp_attribute(x) 0
  219. #endif
  220. #ifndef CYTHON_RESTRICT
  221. #if defined(__GNUC__)
  222. #define CYTHON_RESTRICT __restrict__
  223. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  224. #define CYTHON_RESTRICT __restrict
  225. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  226. #define CYTHON_RESTRICT restrict
  227. #else
  228. #define CYTHON_RESTRICT
  229. #endif
  230. #endif
  231. #ifndef CYTHON_UNUSED
  232. # if defined(__GNUC__)
  233. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  234. # define CYTHON_UNUSED __attribute__ ((__unused__))
  235. # else
  236. # define CYTHON_UNUSED
  237. # endif
  238. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  239. # define CYTHON_UNUSED __attribute__ ((__unused__))
  240. # else
  241. # define CYTHON_UNUSED
  242. # endif
  243. #endif
  244. #ifndef CYTHON_MAYBE_UNUSED_VAR
  245. # if defined(__cplusplus)
  246. template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  247. # else
  248. # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  249. # endif
  250. #endif
  251. #ifndef CYTHON_NCP_UNUSED
  252. # if CYTHON_COMPILING_IN_CPYTHON
  253. # define CYTHON_NCP_UNUSED
  254. # else
  255. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  256. # endif
  257. #endif
  258. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  259. #ifdef _MSC_VER
  260. #ifndef _MSC_STDINT_H_
  261. #if _MSC_VER < 1300
  262. typedef unsigned char uint8_t;
  263. typedef unsigned int uint32_t;
  264. #else
  265. typedef unsigned __int8 uint8_t;
  266. typedef unsigned __int32 uint32_t;
  267. #endif
  268. #endif
  269. #else
  270. #include <stdint.h>
  271. #endif
  272. #ifndef CYTHON_FALLTHROUGH
  273. #if defined(__cplusplus) && __cplusplus >= 201103L
  274. #if __has_cpp_attribute(fallthrough)
  275. #define CYTHON_FALLTHROUGH [[fallthrough]]
  276. #elif __has_cpp_attribute(clang::fallthrough)
  277. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  278. #elif __has_cpp_attribute(gnu::fallthrough)
  279. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  280. #endif
  281. #endif
  282. #ifndef CYTHON_FALLTHROUGH
  283. #if __has_attribute(fallthrough)
  284. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  285. #else
  286. #define CYTHON_FALLTHROUGH
  287. #endif
  288. #endif
  289. #if defined(__clang__ ) && defined(__apple_build_version__)
  290. #if __apple_build_version__ < 7000000
  291. #undef CYTHON_FALLTHROUGH
  292. #define CYTHON_FALLTHROUGH
  293. #endif
  294. #endif
  295. #endif
  296. #ifndef CYTHON_INLINE
  297. #if defined(__clang__)
  298. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  299. #elif defined(__GNUC__)
  300. #define CYTHON_INLINE __inline__
  301. #elif defined(_MSC_VER)
  302. #define CYTHON_INLINE __inline
  303. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  304. #define CYTHON_INLINE inline
  305. #else
  306. #define CYTHON_INLINE
  307. #endif
  308. #endif
  309. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  310. #define Py_OptimizeFlag 0
  311. #endif
  312. #define __PYX_BUILD_PY_SSIZE_T "n"
  313. #define CYTHON_FORMAT_SSIZE_T "z"
  314. #if PY_MAJOR_VERSION < 3
  315. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  316. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  317. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  318. #define __Pyx_DefaultClassType PyClass_Type
  319. #else
  320. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  321. #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  322. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  323. PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  324. #else
  325. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  326. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  327. #endif
  328. #define __Pyx_DefaultClassType PyType_Type
  329. #endif
  330. #ifndef Py_TPFLAGS_CHECKTYPES
  331. #define Py_TPFLAGS_CHECKTYPES 0
  332. #endif
  333. #ifndef Py_TPFLAGS_HAVE_INDEX
  334. #define Py_TPFLAGS_HAVE_INDEX 0
  335. #endif
  336. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  337. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  338. #endif
  339. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  340. #define Py_TPFLAGS_HAVE_FINALIZE 0
  341. #endif
  342. #ifndef METH_STACKLESS
  343. #define METH_STACKLESS 0
  344. #endif
  345. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  346. #ifndef METH_FASTCALL
  347. #define METH_FASTCALL 0x80
  348. #endif
  349. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  350. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  351. Py_ssize_t nargs, PyObject *kwnames);
  352. #else
  353. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  354. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  355. #endif
  356. #if CYTHON_FAST_PYCCALL
  357. #define __Pyx_PyFastCFunction_Check(func)\
  358. ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
  359. #else
  360. #define __Pyx_PyFastCFunction_Check(func) 0
  361. #endif
  362. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  363. #define PyObject_Malloc(s) PyMem_Malloc(s)
  364. #define PyObject_Free(p) PyMem_Free(p)
  365. #define PyObject_Realloc(p) PyMem_Realloc(p)
  366. #endif
  367. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  368. #define PyMem_RawMalloc(n) PyMem_Malloc(n)
  369. #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
  370. #define PyMem_RawFree(p) PyMem_Free(p)
  371. #endif
  372. #if CYTHON_COMPILING_IN_PYSTON
  373. #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
  374. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  375. #else
  376. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  377. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  378. #endif
  379. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  380. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  381. #elif PY_VERSION_HEX >= 0x03060000
  382. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  383. #elif PY_VERSION_HEX >= 0x03000000
  384. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  385. #else
  386. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  387. #endif
  388. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  389. #include "pythread.h"
  390. #define Py_tss_NEEDS_INIT 0
  391. typedef int Py_tss_t;
  392. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  393. *key = PyThread_create_key();
  394. return 0;
  395. }
  396. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  397. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  398. *key = Py_tss_NEEDS_INIT;
  399. return key;
  400. }
  401. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  402. PyObject_Free(key);
  403. }
  404. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  405. return *key != Py_tss_NEEDS_INIT;
  406. }
  407. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  408. PyThread_delete_key(*key);
  409. *key = Py_tss_NEEDS_INIT;
  410. }
  411. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  412. return PyThread_set_key_value(*key, value);
  413. }
  414. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  415. return PyThread_get_key_value(*key);
  416. }
  417. #endif
  418. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  419. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  420. #else
  421. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  422. #endif
  423. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  424. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  425. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  426. #else
  427. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  428. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  429. #endif
  430. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  431. #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  432. #else
  433. #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
  434. #endif
  435. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  436. #define CYTHON_PEP393_ENABLED 1
  437. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  438. 0 : _PyUnicode_Ready((PyObject *)(op)))
  439. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  440. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  441. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  442. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  443. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  444. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  445. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
  446. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  447. #else
  448. #define CYTHON_PEP393_ENABLED 0
  449. #define PyUnicode_1BYTE_KIND 1
  450. #define PyUnicode_2BYTE_KIND 2
  451. #define PyUnicode_4BYTE_KIND 4
  452. #define __Pyx_PyUnicode_READY(op) (0)
  453. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  454. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  455. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  456. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  457. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  458. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  459. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  460. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  461. #endif
  462. #if CYTHON_COMPILING_IN_PYPY
  463. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  464. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  465. #else
  466. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  467. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  468. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  469. #endif
  470. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  471. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  472. #endif
  473. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  474. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  475. #endif
  476. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  477. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  478. #endif
  479. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  480. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  481. #if PY_MAJOR_VERSION >= 3
  482. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  483. #else
  484. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  485. #endif
  486. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  487. #define PyObject_ASCII(o) PyObject_Repr(o)
  488. #endif
  489. #if PY_MAJOR_VERSION >= 3
  490. #define PyBaseString_Type PyUnicode_Type
  491. #define PyStringObject PyUnicodeObject
  492. #define PyString_Type PyUnicode_Type
  493. #define PyString_Check PyUnicode_Check
  494. #define PyString_CheckExact PyUnicode_CheckExact
  495. #define PyObject_Unicode PyObject_Str
  496. #endif
  497. #if PY_MAJOR_VERSION >= 3
  498. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  499. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  500. #else
  501. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  502. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  503. #endif
  504. #ifndef PySet_CheckExact
  505. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  506. #endif
  507. #if CYTHON_ASSUME_SAFE_MACROS
  508. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  509. #else
  510. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  511. #endif
  512. #if PY_MAJOR_VERSION >= 3
  513. #define PyIntObject PyLongObject
  514. #define PyInt_Type PyLong_Type
  515. #define PyInt_Check(op) PyLong_Check(op)
  516. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  517. #define PyInt_FromString PyLong_FromString
  518. #define PyInt_FromUnicode PyLong_FromUnicode
  519. #define PyInt_FromLong PyLong_FromLong
  520. #define PyInt_FromSize_t PyLong_FromSize_t
  521. #define PyInt_FromSsize_t PyLong_FromSsize_t
  522. #define PyInt_AsLong PyLong_AsLong
  523. #define PyInt_AS_LONG PyLong_AS_LONG
  524. #define PyInt_AsSsize_t PyLong_AsSsize_t
  525. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  526. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  527. #define PyNumber_Int PyNumber_Long
  528. #endif
  529. #if PY_MAJOR_VERSION >= 3
  530. #define PyBoolObject PyLongObject
  531. #endif
  532. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  533. #ifndef PyUnicode_InternFromString
  534. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  535. #endif
  536. #endif
  537. #if PY_VERSION_HEX < 0x030200A4
  538. typedef long Py_hash_t;
  539. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  540. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  541. #else
  542. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  543. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  544. #endif
  545. #if PY_MAJOR_VERSION >= 3
  546. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
  547. #else
  548. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  549. #endif
  550. #if CYTHON_USE_ASYNC_SLOTS
  551. #if PY_VERSION_HEX >= 0x030500B1
  552. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  553. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  554. #else
  555. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  556. #endif
  557. #else
  558. #define __Pyx_PyType_AsAsync(obj) NULL
  559. #endif
  560. #ifndef __Pyx_PyAsyncMethodsStruct
  561. typedef struct {
  562. unaryfunc am_await;
  563. unaryfunc am_aiter;
  564. unaryfunc am_anext;
  565. } __Pyx_PyAsyncMethodsStruct;
  566. #endif
  567. #if defined(WIN32) || defined(MS_WINDOWS)
  568. #define _USE_MATH_DEFINES
  569. #endif
  570. #include <math.h>
  571. #ifdef NAN
  572. #define __PYX_NAN() ((float) NAN)
  573. #else
  574. static CYTHON_INLINE float __PYX_NAN() {
  575. float value;
  576. memset(&value, 0xFF, sizeof(value));
  577. return value;
  578. }
  579. #endif
  580. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  581. #define __Pyx_truncl trunc
  582. #else
  583. #define __Pyx_truncl truncl
  584. #endif
  585. #define __PYX_ERR(f_index, lineno, Ln_error) \
  586. { \
  587. __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
  588. }
  589. #ifndef __PYX_EXTERN_C
  590. #ifdef __cplusplus
  591. #define __PYX_EXTERN_C extern "C"
  592. #else
  593. #define __PYX_EXTERN_C extern
  594. #endif
  595. #endif
  596. #define __PYX_HAVE__app__colormap__colormap
  597. #define __PYX_HAVE_API__app__colormap__colormap
  598. /* Early includes */
  599. #include "pythread.h"
  600. #include <string.h>
  601. #include <stdlib.h>
  602. #include <stdio.h>
  603. #include "pystate.h"
  604. #ifdef _OPENMP
  605. #include <omp.h>
  606. #endif /* _OPENMP */
  607. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  608. #define CYTHON_WITHOUT_ASSERTIONS
  609. #endif
  610. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  611. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  612. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  613. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  614. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  615. #define __PYX_DEFAULT_STRING_ENCODING ""
  616. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  617. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  618. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  619. #define __Pyx_long_cast(x) ((long)x)
  620. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  621. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  622. (sizeof(type) > sizeof(Py_ssize_t) &&\
  623. likely(v < (type)PY_SSIZE_T_MAX ||\
  624. v == (type)PY_SSIZE_T_MAX) &&\
  625. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  626. v == (type)PY_SSIZE_T_MIN))) ||\
  627. (sizeof(type) == sizeof(Py_ssize_t) &&\
  628. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  629. v == (type)PY_SSIZE_T_MAX))) )
  630. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  631. return (size_t) i < (size_t) limit;
  632. }
  633. #if defined (__cplusplus) && __cplusplus >= 201103L
  634. #include <cstdlib>
  635. #define __Pyx_sst_abs(value) std::abs(value)
  636. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  637. #define __Pyx_sst_abs(value) abs(value)
  638. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  639. #define __Pyx_sst_abs(value) labs(value)
  640. #elif defined (_MSC_VER)
  641. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  642. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  643. #define __Pyx_sst_abs(value) llabs(value)
  644. #elif defined (__GNUC__)
  645. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  646. #else
  647. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  648. #endif
  649. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  650. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  651. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  652. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  653. #define __Pyx_PyBytes_FromString PyBytes_FromString
  654. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  655. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  656. #if PY_MAJOR_VERSION < 3
  657. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  658. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  659. #else
  660. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  661. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  662. #endif
  663. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  664. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  665. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  666. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  667. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  668. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  669. #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
  670. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  671. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  672. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  673. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  674. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  675. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  676. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  677. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  678. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  679. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  680. const Py_UNICODE *u_end = u;
  681. while (*u_end++) ;
  682. return (size_t)(u_end - u - 1);
  683. }
  684. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  685. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  686. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  687. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  688. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  689. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  690. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  691. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  692. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  693. #define __Pyx_PySequence_Tuple(obj)\
  694. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  695. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  696. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  697. #if CYTHON_ASSUME_SAFE_MACROS
  698. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  699. #else
  700. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  701. #endif
  702. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  703. #if PY_MAJOR_VERSION >= 3
  704. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  705. #else
  706. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  707. #endif
  708. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  709. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  710. static int __Pyx_sys_getdefaultencoding_not_ascii;
  711. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  712. PyObject* sys;
  713. PyObject* default_encoding = NULL;
  714. PyObject* ascii_chars_u = NULL;
  715. PyObject* ascii_chars_b = NULL;
  716. const char* default_encoding_c;
  717. sys = PyImport_ImportModule("sys");
  718. if (!sys) goto bad;
  719. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  720. Py_DECREF(sys);
  721. if (!default_encoding) goto bad;
  722. default_encoding_c = PyBytes_AsString(default_encoding);
  723. if (!default_encoding_c) goto bad;
  724. if (strcmp(default_encoding_c, "ascii") == 0) {
  725. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  726. } else {
  727. char ascii_chars[128];
  728. int c;
  729. for (c = 0; c < 128; c++) {
  730. ascii_chars[c] = c;
  731. }
  732. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  733. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  734. if (!ascii_chars_u) goto bad;
  735. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  736. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  737. PyErr_Format(
  738. PyExc_ValueError,
  739. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  740. default_encoding_c);
  741. goto bad;
  742. }
  743. Py_DECREF(ascii_chars_u);
  744. Py_DECREF(ascii_chars_b);
  745. }
  746. Py_DECREF(default_encoding);
  747. return 0;
  748. bad:
  749. Py_XDECREF(default_encoding);
  750. Py_XDECREF(ascii_chars_u);
  751. Py_XDECREF(ascii_chars_b);
  752. return -1;
  753. }
  754. #endif
  755. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  756. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  757. #else
  758. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  759. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  760. static char* __PYX_DEFAULT_STRING_ENCODING;
  761. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  762. PyObject* sys;
  763. PyObject* default_encoding = NULL;
  764. char* default_encoding_c;
  765. sys = PyImport_ImportModule("sys");
  766. if (!sys) goto bad;
  767. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  768. Py_DECREF(sys);
  769. if (!default_encoding) goto bad;
  770. default_encoding_c = PyBytes_AsString(default_encoding);
  771. if (!default_encoding_c) goto bad;
  772. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  773. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  774. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  775. Py_DECREF(default_encoding);
  776. return 0;
  777. bad:
  778. Py_XDECREF(default_encoding);
  779. return -1;
  780. }
  781. #endif
  782. #endif
  783. /* Test for GCC > 2.95 */
  784. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  785. #define likely(x) __builtin_expect(!!(x), 1)
  786. #define unlikely(x) __builtin_expect(!!(x), 0)
  787. #else /* !__GNUC__ or GCC < 2.95 */
  788. #define likely(x) (x)
  789. #define unlikely(x) (x)
  790. #endif /* __GNUC__ */
  791. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  792. static PyObject *__pyx_m = NULL;
  793. static PyObject *__pyx_d;
  794. static PyObject *__pyx_b;
  795. static PyObject *__pyx_cython_runtime = NULL;
  796. static PyObject *__pyx_empty_tuple;
  797. static PyObject *__pyx_empty_bytes;
  798. static PyObject *__pyx_empty_unicode;
  799. static int __pyx_lineno;
  800. static int __pyx_clineno = 0;
  801. static const char * __pyx_cfilenm= __FILE__;
  802. static const char *__pyx_filename;
  803. static const char *__pyx_f[] = {
  804. "app/colormap/colormap.pyx",
  805. "stringsource",
  806. };
  807. /* MemviewSliceStruct.proto */
  808. struct __pyx_memoryview_obj;
  809. typedef struct {
  810. struct __pyx_memoryview_obj *memview;
  811. char *data;
  812. Py_ssize_t shape[8];
  813. Py_ssize_t strides[8];
  814. Py_ssize_t suboffsets[8];
  815. } __Pyx_memviewslice;
  816. #define __Pyx_MemoryView_Len(m) (m.shape[0])
  817. /* Atomics.proto */
  818. #include <pythread.h>
  819. #ifndef CYTHON_ATOMICS
  820. #define CYTHON_ATOMICS 1
  821. #endif
  822. #define __pyx_atomic_int_type int
  823. #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
  824. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
  825. !defined(__i386__)
  826. #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
  827. #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
  828. #ifdef __PYX_DEBUG_ATOMICS
  829. #warning "Using GNU atomics"
  830. #endif
  831. #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
  832. #include <Windows.h>
  833. #undef __pyx_atomic_int_type
  834. #define __pyx_atomic_int_type LONG
  835. #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
  836. #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
  837. #ifdef __PYX_DEBUG_ATOMICS
  838. #pragma message ("Using MSVC atomics")
  839. #endif
  840. #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
  841. #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
  842. #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
  843. #ifdef __PYX_DEBUG_ATOMICS
  844. #warning "Using Intel atomics"
  845. #endif
  846. #else
  847. #undef CYTHON_ATOMICS
  848. #define CYTHON_ATOMICS 0
  849. #ifdef __PYX_DEBUG_ATOMICS
  850. #warning "Not using atomics"
  851. #endif
  852. #endif
  853. typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
  854. #if CYTHON_ATOMICS
  855. #define __pyx_add_acquisition_count(memview)\
  856. __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
  857. #define __pyx_sub_acquisition_count(memview)\
  858. __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
  859. #else
  860. #define __pyx_add_acquisition_count(memview)\
  861. __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
  862. #define __pyx_sub_acquisition_count(memview)\
  863. __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
  864. #endif
  865. /* ForceInitThreads.proto */
  866. #ifndef __PYX_FORCE_INIT_THREADS
  867. #define __PYX_FORCE_INIT_THREADS 0
  868. #endif
  869. /* NoFastGil.proto */
  870. #define __Pyx_PyGILState_Ensure PyGILState_Ensure
  871. #define __Pyx_PyGILState_Release PyGILState_Release
  872. #define __Pyx_FastGIL_Remember()
  873. #define __Pyx_FastGIL_Forget()
  874. #define __Pyx_FastGilFuncInit()
  875. /* BufferFormatStructs.proto */
  876. #define IS_UNSIGNED(type) (((type) -1) > 0)
  877. struct __Pyx_StructField_;
  878. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  879. typedef struct {
  880. const char* name;
  881. struct __Pyx_StructField_* fields;
  882. size_t size;
  883. size_t arraysize[8];
  884. int ndim;
  885. char typegroup;
  886. char is_unsigned;
  887. int flags;
  888. } __Pyx_TypeInfo;
  889. typedef struct __Pyx_StructField_ {
  890. __Pyx_TypeInfo* type;
  891. const char* name;
  892. size_t offset;
  893. } __Pyx_StructField;
  894. typedef struct {
  895. __Pyx_StructField* field;
  896. size_t parent_offset;
  897. } __Pyx_BufFmt_StackElem;
  898. typedef struct {
  899. __Pyx_StructField root;
  900. __Pyx_BufFmt_StackElem* head;
  901. size_t fmt_offset;
  902. size_t new_count, enc_count;
  903. size_t struct_alignment;
  904. int is_complex;
  905. char enc_type;
  906. char new_packmode;
  907. char enc_packmode;
  908. char is_valid_array;
  909. } __Pyx_BufFmt_Context;
  910. /*--- Type declarations ---*/
  911. struct __pyx_array_obj;
  912. struct __pyx_MemviewEnum_obj;
  913. struct __pyx_memoryview_obj;
  914. struct __pyx_memoryviewslice_obj;
  915. /* "View.MemoryView":105
  916. *
  917. * @cname("__pyx_array")
  918. * cdef class array: # <<<<<<<<<<<<<<
  919. *
  920. * cdef:
  921. */
  922. struct __pyx_array_obj {
  923. PyObject_HEAD
  924. struct __pyx_vtabstruct_array *__pyx_vtab;
  925. char *data;
  926. Py_ssize_t len;
  927. char *format;
  928. int ndim;
  929. Py_ssize_t *_shape;
  930. Py_ssize_t *_strides;
  931. Py_ssize_t itemsize;
  932. PyObject *mode;
  933. PyObject *_format;
  934. void (*callback_free_data)(void *);
  935. int free_data;
  936. int dtype_is_object;
  937. };
  938. /* "View.MemoryView":279
  939. *
  940. * @cname('__pyx_MemviewEnum')
  941. * cdef class Enum(object): # <<<<<<<<<<<<<<
  942. * cdef object name
  943. * def __init__(self, name):
  944. */
  945. struct __pyx_MemviewEnum_obj {
  946. PyObject_HEAD
  947. PyObject *name;
  948. };
  949. /* "View.MemoryView":330
  950. *
  951. * @cname('__pyx_memoryview')
  952. * cdef class memoryview(object): # <<<<<<<<<<<<<<
  953. *
  954. * cdef object obj
  955. */
  956. struct __pyx_memoryview_obj {
  957. PyObject_HEAD
  958. struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  959. PyObject *obj;
  960. PyObject *_size;
  961. PyObject *_array_interface;
  962. PyThread_type_lock lock;
  963. __pyx_atomic_int acquisition_count[2];
  964. __pyx_atomic_int *acquisition_count_aligned_p;
  965. Py_buffer view;
  966. int flags;
  967. int dtype_is_object;
  968. __Pyx_TypeInfo *typeinfo;
  969. };
  970. /* "View.MemoryView":965
  971. *
  972. * @cname('__pyx_memoryviewslice')
  973. * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
  974. * "Internal class for passing memoryview slices to Python"
  975. *
  976. */
  977. struct __pyx_memoryviewslice_obj {
  978. struct __pyx_memoryview_obj __pyx_base;
  979. __Pyx_memviewslice from_slice;
  980. PyObject *from_object;
  981. PyObject *(*to_object_func)(char *);
  982. int (*to_dtype_func)(char *, PyObject *);
  983. };
  984. /* "View.MemoryView":105
  985. *
  986. * @cname("__pyx_array")
  987. * cdef class array: # <<<<<<<<<<<<<<
  988. *
  989. * cdef:
  990. */
  991. struct __pyx_vtabstruct_array {
  992. PyObject *(*get_memview)(struct __pyx_array_obj *);
  993. };
  994. static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
  995. /* "View.MemoryView":330
  996. *
  997. * @cname('__pyx_memoryview')
  998. * cdef class memoryview(object): # <<<<<<<<<<<<<<
  999. *
  1000. * cdef object obj
  1001. */
  1002. struct __pyx_vtabstruct_memoryview {
  1003. char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  1004. PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  1005. PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  1006. PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  1007. PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  1008. PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  1009. PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
  1010. };
  1011. static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
  1012. /* "View.MemoryView":965
  1013. *
  1014. * @cname('__pyx_memoryviewslice')
  1015. * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
  1016. * "Internal class for passing memoryview slices to Python"
  1017. *
  1018. */
  1019. struct __pyx_vtabstruct__memoryviewslice {
  1020. struct __pyx_vtabstruct_memoryview __pyx_base;
  1021. };
  1022. static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
  1023. /* --- Runtime support code (head) --- */
  1024. /* Refnanny.proto */
  1025. #ifndef CYTHON_REFNANNY
  1026. #define CYTHON_REFNANNY 0
  1027. #endif
  1028. #if CYTHON_REFNANNY
  1029. typedef struct {
  1030. void (*INCREF)(void*, PyObject*, int);
  1031. void (*DECREF)(void*, PyObject*, int);
  1032. void (*GOTREF)(void*, PyObject*, int);
  1033. void (*GIVEREF)(void*, PyObject*, int);
  1034. void* (*SetupContext)(const char*, int, const char*);
  1035. void (*FinishContext)(void**);
  1036. } __Pyx_RefNannyAPIStruct;
  1037. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1038. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1039. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1040. #ifdef WITH_THREAD
  1041. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1042. if (acquire_gil) {\
  1043. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1044. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1045. PyGILState_Release(__pyx_gilstate_save);\
  1046. } else {\
  1047. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1048. }
  1049. #else
  1050. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1051. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  1052. #endif
  1053. #define __Pyx_RefNannyFinishContext()\
  1054. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1055. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1056. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1057. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1058. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1059. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1060. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1061. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1062. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1063. #else
  1064. #define __Pyx_RefNannyDeclarations
  1065. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1066. #define __Pyx_RefNannyFinishContext()
  1067. #define __Pyx_INCREF(r) Py_INCREF(r)
  1068. #define __Pyx_DECREF(r) Py_DECREF(r)
  1069. #define __Pyx_GOTREF(r)
  1070. #define __Pyx_GIVEREF(r)
  1071. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1072. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1073. #define __Pyx_XGOTREF(r)
  1074. #define __Pyx_XGIVEREF(r)
  1075. #endif
  1076. #define __Pyx_XDECREF_SET(r, v) do {\
  1077. PyObject *tmp = (PyObject *) r;\
  1078. r = v; __Pyx_XDECREF(tmp);\
  1079. } while (0)
  1080. #define __Pyx_DECREF_SET(r, v) do {\
  1081. PyObject *tmp = (PyObject *) r;\
  1082. r = v; __Pyx_DECREF(tmp);\
  1083. } while (0)
  1084. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1085. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1086. /* PyObjectGetAttrStr.proto */
  1087. #if CYTHON_USE_TYPE_SLOTS
  1088. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1089. #else
  1090. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1091. #endif
  1092. /* GetBuiltinName.proto */
  1093. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1094. /* RaiseArgTupleInvalid.proto */
  1095. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1096. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1097. /* RaiseDoubleKeywords.proto */
  1098. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1099. /* ParseKeywords.proto */
  1100. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1101. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1102. const char* function_name);
  1103. /* ArgTypeTest.proto */
  1104. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1105. ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1106. __Pyx__ArgTypeTest(obj, type, name, exact))
  1107. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1108. /* PyDictVersioning.proto */
  1109. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1110. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1111. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1112. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1113. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1114. (cache_var) = (value);
  1115. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1116. static PY_UINT64_T __pyx_dict_version = 0;\
  1117. static PyObject *__pyx_dict_cached_value = NULL;\
  1118. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1119. (VAR) = __pyx_dict_cached_value;\
  1120. } else {\
  1121. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1122. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1123. }\
  1124. }
  1125. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1126. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1127. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1128. #else
  1129. #define __PYX_GET_DICT_VERSION(dict) (0)
  1130. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1131. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1132. #endif
  1133. /* GetModuleGlobalName.proto */
  1134. #if CYTHON_USE_DICT_VERSIONS
  1135. #define __Pyx_GetModuleGlobalName(var, name) {\
  1136. static PY_UINT64_T __pyx_dict_version = 0;\
  1137. static PyObject *__pyx_dict_cached_value = NULL;\
  1138. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1139. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1140. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1141. }
  1142. #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
  1143. PY_UINT64_T __pyx_dict_version;\
  1144. PyObject *__pyx_dict_cached_value;\
  1145. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1146. }
  1147. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1148. #else
  1149. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1150. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1151. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1152. #endif
  1153. /* PyCFunctionFastCall.proto */
  1154. #if CYTHON_FAST_PYCCALL
  1155. static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
  1156. #else
  1157. #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
  1158. #endif
  1159. /* PyFunctionFastCall.proto */
  1160. #if CYTHON_FAST_PYCALL
  1161. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1162. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1163. #if 1 || PY_VERSION_HEX < 0x030600B1
  1164. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
  1165. #else
  1166. #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
  1167. #endif
  1168. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1169. (sizeof(char [1 - 2*!(cond)]) - 1)
  1170. #ifndef Py_MEMBER_SIZE
  1171. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1172. #endif
  1173. static size_t __pyx_pyframe_localsplus_offset = 0;
  1174. #include "frameobject.h"
  1175. #define __Pxy_PyFrame_Initialize_Offsets()\
  1176. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1177. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1178. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1179. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1180. #endif
  1181. /* PyObjectCall.proto */
  1182. #if CYTHON_COMPILING_IN_CPYTHON
  1183. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1184. #else
  1185. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1186. #endif
  1187. /* PyObjectCall2Args.proto */
  1188. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  1189. /* PyObjectCallMethO.proto */
  1190. #if CYTHON_COMPILING_IN_CPYTHON
  1191. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1192. #endif
  1193. /* PyObjectCallOneArg.proto */
  1194. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1195. /* PyIntCompare.proto */
  1196. static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  1197. /* GetItemInt.proto */
  1198. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1199. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1200. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1201. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1202. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1203. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1204. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1205. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1206. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1207. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1208. int wraparound, int boundscheck);
  1209. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1210. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1211. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1212. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1213. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1214. int wraparound, int boundscheck);
  1215. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1216. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1217. int is_list, int wraparound, int boundscheck);
  1218. /* DictGetItem.proto */
  1219. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  1220. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  1221. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  1222. (likely(PyDict_CheckExact(obj)) ?\
  1223. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  1224. #else
  1225. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  1226. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  1227. #endif
  1228. /* MemviewSliceInit.proto */
  1229. #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
  1230. #define __Pyx_MEMVIEW_DIRECT 1
  1231. #define __Pyx_MEMVIEW_PTR 2
  1232. #define __Pyx_MEMVIEW_FULL 4
  1233. #define __Pyx_MEMVIEW_CONTIG 8
  1234. #define __Pyx_MEMVIEW_STRIDED 16
  1235. #define __Pyx_MEMVIEW_FOLLOW 32
  1236. #define __Pyx_IS_C_CONTIG 1
  1237. #define __Pyx_IS_F_CONTIG 2
  1238. static int __Pyx_init_memviewslice(
  1239. struct __pyx_memoryview_obj *memview,
  1240. int ndim,
  1241. __Pyx_memviewslice *memviewslice,
  1242. int memview_is_new_reference);
  1243. static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
  1244. __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
  1245. static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
  1246. __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
  1247. #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
  1248. #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
  1249. #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
  1250. #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
  1251. static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
  1252. static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
  1253. /* ObjectGetItem.proto */
  1254. #if CYTHON_USE_TYPE_SLOTS
  1255. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
  1256. #else
  1257. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  1258. #endif
  1259. /* PyThreadStateGet.proto */
  1260. #if CYTHON_FAST_THREAD_STATE
  1261. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1262. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1263. #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
  1264. #else
  1265. #define __Pyx_PyThreadState_declare
  1266. #define __Pyx_PyThreadState_assign
  1267. #define __Pyx_PyErr_Occurred() PyErr_Occurred()
  1268. #endif
  1269. /* PyErrFetchRestore.proto */
  1270. #if CYTHON_FAST_THREAD_STATE
  1271. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1272. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1273. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1274. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1275. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1276. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1277. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1278. #if CYTHON_COMPILING_IN_CPYTHON
  1279. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1280. #else
  1281. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1282. #endif
  1283. #else
  1284. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1285. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1286. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1287. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1288. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1289. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1290. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1291. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1292. #endif
  1293. /* RaiseException.proto */
  1294. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1295. /* IncludeStringH.proto */
  1296. #include <string.h>
  1297. /* BytesEquals.proto */
  1298. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1299. /* UnicodeEquals.proto */
  1300. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1301. /* StrEquals.proto */
  1302. #if PY_MAJOR_VERSION >= 3
  1303. #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
  1304. #else
  1305. #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
  1306. #endif
  1307. /* None.proto */
  1308. static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
  1309. /* UnaryNegOverflows.proto */
  1310. #define UNARY_NEG_WOULD_OVERFLOW(x)\
  1311. (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
  1312. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  1313. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
  1314. /* GetAttr.proto */
  1315. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
  1316. /* decode_c_string_utf16.proto */
  1317. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
  1318. int byteorder = 0;
  1319. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1320. }
  1321. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
  1322. int byteorder = -1;
  1323. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1324. }
  1325. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
  1326. int byteorder = 1;
  1327. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1328. }
  1329. /* decode_c_string.proto */
  1330. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  1331. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  1332. const char* encoding, const char* errors,
  1333. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
  1334. /* PyErrExceptionMatches.proto */
  1335. #if CYTHON_FAST_THREAD_STATE
  1336. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1337. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1338. #else
  1339. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1340. #endif
  1341. /* GetAttr3.proto */
  1342. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
  1343. /* RaiseTooManyValuesToUnpack.proto */
  1344. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1345. /* RaiseNeedMoreValuesToUnpack.proto */
  1346. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1347. /* RaiseNoneIterError.proto */
  1348. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  1349. /* ExtTypeTest.proto */
  1350. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1351. /* GetTopmostException.proto */
  1352. #if CYTHON_USE_EXC_INFO_STACK
  1353. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  1354. #endif
  1355. /* SaveResetException.proto */
  1356. #if CYTHON_FAST_THREAD_STATE
  1357. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1358. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1359. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1360. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1361. #else
  1362. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  1363. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  1364. #endif
  1365. /* GetException.proto */
  1366. #if CYTHON_FAST_THREAD_STATE
  1367. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1368. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1369. #else
  1370. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1371. #endif
  1372. /* SwapException.proto */
  1373. #if CYTHON_FAST_THREAD_STATE
  1374. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  1375. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1376. #else
  1377. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  1378. #endif
  1379. /* Import.proto */
  1380. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1381. /* FastTypeChecks.proto */
  1382. #if CYTHON_COMPILING_IN_CPYTHON
  1383. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1384. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1385. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1386. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1387. #else
  1388. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1389. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1390. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1391. #endif
  1392. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1393. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  1394. /* ListCompAppend.proto */
  1395. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1396. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  1397. PyListObject* L = (PyListObject*) list;
  1398. Py_ssize_t len = Py_SIZE(list);
  1399. if (likely(L->allocated > len)) {
  1400. Py_INCREF(x);
  1401. PyList_SET_ITEM(list, len, x);
  1402. Py_SIZE(list) = len+1;
  1403. return 0;
  1404. }
  1405. return PyList_Append(list, x);
  1406. }
  1407. #else
  1408. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  1409. #endif
  1410. /* PyIntBinop.proto */
  1411. #if !CYTHON_COMPILING_IN_PYPY
  1412. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1413. #else
  1414. #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  1415. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  1416. #endif
  1417. /* ListExtend.proto */
  1418. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  1419. #if CYTHON_COMPILING_IN_CPYTHON
  1420. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  1421. if (unlikely(!none))
  1422. return -1;
  1423. Py_DECREF(none);
  1424. return 0;
  1425. #else
  1426. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  1427. #endif
  1428. }
  1429. /* ListAppend.proto */
  1430. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1431. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1432. PyListObject* L = (PyListObject*) list;
  1433. Py_ssize_t len = Py_SIZE(list);
  1434. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1435. Py_INCREF(x);
  1436. PyList_SET_ITEM(list, len, x);
  1437. Py_SIZE(list) = len+1;
  1438. return 0;
  1439. }
  1440. return PyList_Append(list, x);
  1441. }
  1442. #else
  1443. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1444. #endif
  1445. /* None.proto */
  1446. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
  1447. /* None.proto */
  1448. static CYTHON_INLINE long __Pyx_div_long(long, long);
  1449. /* ImportFrom.proto */
  1450. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  1451. /* HasAttr.proto */
  1452. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  1453. /* PyObject_GenericGetAttrNoDict.proto */
  1454. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1455. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  1456. #else
  1457. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  1458. #endif
  1459. /* PyObject_GenericGetAttr.proto */
  1460. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1461. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
  1462. #else
  1463. #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
  1464. #endif
  1465. /* SetVTable.proto */
  1466. static int __Pyx_SetVtable(PyObject *dict, void *vtable);
  1467. /* SetupReduce.proto */
  1468. static int __Pyx_setup_reduce(PyObject* type_obj);
  1469. /* CLineInTraceback.proto */
  1470. #ifdef CYTHON_CLINE_IN_TRACEBACK
  1471. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  1472. #else
  1473. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  1474. #endif
  1475. /* CodeObjectCache.proto */
  1476. typedef struct {
  1477. PyCodeObject* code_object;
  1478. int code_line;
  1479. } __Pyx_CodeObjectCacheEntry;
  1480. struct __Pyx_CodeObjectCache {
  1481. int count;
  1482. int max_count;
  1483. __Pyx_CodeObjectCacheEntry* entries;
  1484. };
  1485. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1486. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1487. static PyCodeObject *__pyx_find_code_object(int code_line);
  1488. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1489. /* AddTraceback.proto */
  1490. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1491. int py_line, const char *filename);
  1492. #if PY_MAJOR_VERSION < 3
  1493. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  1494. static void __Pyx_ReleaseBuffer(Py_buffer *view);
  1495. #else
  1496. #define __Pyx_GetBuffer PyObject_GetBuffer
  1497. #define __Pyx_ReleaseBuffer PyBuffer_Release
  1498. #endif
  1499. /* BufferStructDeclare.proto */
  1500. typedef struct {
  1501. Py_ssize_t shape, strides, suboffsets;
  1502. } __Pyx_Buf_DimInfo;
  1503. typedef struct {
  1504. size_t refcount;
  1505. Py_buffer pybuffer;
  1506. } __Pyx_Buffer;
  1507. typedef struct {
  1508. __Pyx_Buffer *rcbuffer;
  1509. char *data;
  1510. __Pyx_Buf_DimInfo diminfo[8];
  1511. } __Pyx_LocalBuf_ND;
  1512. /* MemviewSliceIsContig.proto */
  1513. static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
  1514. /* OverlappingSlices.proto */
  1515. static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
  1516. __Pyx_memviewslice *slice2,
  1517. int ndim, size_t itemsize);
  1518. /* Capsule.proto */
  1519. static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
  1520. /* CIntToPy.proto */
  1521. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1522. /* CIntToPy.proto */
  1523. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1524. /* MemviewSliceCopyTemplate.proto */
  1525. static __Pyx_memviewslice
  1526. __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
  1527. const char *mode, int ndim,
  1528. size_t sizeof_dtype, int contig_flag,
  1529. int dtype_is_object);
  1530. /* CIntFromPy.proto */
  1531. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1532. /* CIntFromPy.proto */
  1533. static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
  1534. /* CIntFromPy.proto */
  1535. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1536. /* CIntFromPy.proto */
  1537. static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
  1538. /* IsLittleEndian.proto */
  1539. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
  1540. /* BufferFormatCheck.proto */
  1541. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
  1542. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  1543. __Pyx_BufFmt_StackElem* stack,
  1544. __Pyx_TypeInfo* type);
  1545. /* TypeInfoCompare.proto */
  1546. static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
  1547. /* MemviewSliceValidateAndInit.proto */
  1548. static int __Pyx_ValidateAndInit_memviewslice(
  1549. int *axes_specs,
  1550. int c_or_f_flag,
  1551. int buf_flags,
  1552. int ndim,
  1553. __Pyx_TypeInfo *dtype,
  1554. __Pyx_BufFmt_StackElem stack[],
  1555. __Pyx_memviewslice *memviewslice,
  1556. PyObject *original_obj);
  1557. /* ObjectToMemviewSlice.proto */
  1558. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *, int writable_flag);
  1559. /* ObjectToMemviewSlice.proto */
  1560. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(PyObject *, int writable_flag);
  1561. /* ObjectToMemviewSlice.proto */
  1562. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *, int writable_flag);
  1563. /* CheckBinaryVersion.proto */
  1564. static int __Pyx_check_binary_version(void);
  1565. /* InitStrings.proto */
  1566. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1567. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
  1568. static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
  1569. static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
  1570. static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
  1571. static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
  1572. static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
  1573. static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
  1574. static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
  1575. static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
  1576. static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
  1577. /* Module declarations from 'cython.view' */
  1578. /* Module declarations from 'cython' */
  1579. /* Module declarations from 'app.colormap.colormap' */
  1580. static PyTypeObject *__pyx_array_type = 0;
  1581. static PyTypeObject *__pyx_MemviewEnum_type = 0;
  1582. static PyTypeObject *__pyx_memoryview_type = 0;
  1583. static PyTypeObject *__pyx_memoryviewslice_type = 0;
  1584. static float __pyx_v_3app_8colormap_8colormap__magma_data[16][3];
  1585. static float __pyx_v_3app_8colormap_8colormap__inferno_data[16][3];
  1586. static float __pyx_v_3app_8colormap_8colormap__plasma_data[16][3];
  1587. static float __pyx_v_3app_8colormap_8colormap__viridis_data[16][3];
  1588. static PyObject *generic = 0;
  1589. static PyObject *strided = 0;
  1590. static PyObject *indirect = 0;
  1591. static PyObject *contiguous = 0;
  1592. static PyObject *indirect_contiguous = 0;
  1593. static int __pyx_memoryview_thread_locks_used;
  1594. static PyThread_type_lock __pyx_memoryview_thread_locks[8];
  1595. static PyObject *__pyx_f_3app_8colormap_8colormap_map_many(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
  1596. static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float(float *, Py_ssize_t); /*proto*/
  1597. static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float(float *, Py_ssize_t); /*proto*/
  1598. static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float___5b_3_5d_(float (*)[3], Py_ssize_t); /*proto*/
  1599. static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float___5b_3_5d_(float (*)[3], Py_ssize_t); /*proto*/
  1600. static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
  1601. static void *__pyx_align_pointer(void *, size_t); /*proto*/
  1602. static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
  1603. static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
  1604. static PyObject *_unellipsify(PyObject *, int); /*proto*/
  1605. static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
  1606. static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
  1607. static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
  1608. static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
  1609. static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
  1610. static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
  1611. static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  1612. static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  1613. static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
  1614. static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  1615. static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
  1616. static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
  1617. static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
  1618. static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
  1619. static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
  1620. static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
  1621. static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
  1622. static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
  1623. static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
  1624. static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
  1625. static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
  1626. static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
  1627. static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
  1628. static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
  1629. static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
  1630. static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
  1631. static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
  1632. static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
  1633. static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
  1634. static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
  1635. #define __Pyx_MODULE_NAME "app.colormap.colormap"
  1636. extern int __pyx_module_is_main_app__colormap__colormap;
  1637. int __pyx_module_is_main_app__colormap__colormap = 0;
  1638. /* Implementation of 'app.colormap.colormap' */
  1639. static PyObject *__pyx_builtin_range;
  1640. static PyObject *__pyx_builtin_ValueError;
  1641. static PyObject *__pyx_builtin_MemoryError;
  1642. static PyObject *__pyx_builtin_enumerate;
  1643. static PyObject *__pyx_builtin_TypeError;
  1644. static PyObject *__pyx_builtin_Ellipsis;
  1645. static PyObject *__pyx_builtin_id;
  1646. static PyObject *__pyx_builtin_IndexError;
  1647. static const char __pyx_k_O[] = "O";
  1648. static const char __pyx_k_c[] = "c";
  1649. static const char __pyx_k_id[] = "id";
  1650. static const char __pyx_k_np[] = "np";
  1651. static const char __pyx_k_all[] = "__all__";
  1652. static const char __pyx_k_idx[] = "idx";
  1653. static const char __pyx_k_max[] = "max_";
  1654. static const char __pyx_k_min[] = "min_";
  1655. static const char __pyx_k_new[] = "__new__";
  1656. static const char __pyx_k_obj[] = "obj";
  1657. static const char __pyx_k_out[] = "out";
  1658. static const char __pyx_k_base[] = "base";
  1659. static const char __pyx_k_clip[] = "clip";
  1660. static const char __pyx_k_data[] = "data";
  1661. static const char __pyx_k_dict[] = "__dict__";
  1662. static const char __pyx_k_idxs[] = "idxs";
  1663. static const char __pyx_k_main[] = "__main__";
  1664. static const char __pyx_k_mode[] = "mode";
  1665. static const char __pyx_k_name[] = "name";
  1666. static const char __pyx_k_ndim[] = "ndim";
  1667. static const char __pyx_k_pack[] = "pack";
  1668. static const char __pyx_k_size[] = "size";
  1669. static const char __pyx_k_step[] = "step";
  1670. static const char __pyx_k_stop[] = "stop";
  1671. static const char __pyx_k_test[] = "__test__";
  1672. static const char __pyx_k_ASCII[] = "ASCII";
  1673. static const char __pyx_k_array[] = "array";
  1674. static const char __pyx_k_class[] = "__class__";
  1675. static const char __pyx_k_cmaps[] = "cmaps";
  1676. static const char __pyx_k_color[] = "color";
  1677. static const char __pyx_k_dtype[] = "dtype";
  1678. static const char __pyx_k_error[] = "error";
  1679. static const char __pyx_k_flags[] = "flags";
  1680. static const char __pyx_k_input[] = "input_";
  1681. static const char __pyx_k_int32[] = "int32";
  1682. static const char __pyx_k_magma[] = "magma";
  1683. static const char __pyx_k_max_2[] = "max";
  1684. static const char __pyx_k_min_2[] = "min";
  1685. static const char __pyx_k_numpy[] = "numpy";
  1686. static const char __pyx_k_range[] = "range";
  1687. static const char __pyx_k_shape[] = "shape";
  1688. static const char __pyx_k_start[] = "start";
  1689. static const char __pyx_k_zeros[] = "zeros";
  1690. static const char __pyx_k_astype[] = "astype";
  1691. static const char __pyx_k_colors[] = "colors";
  1692. static const char __pyx_k_encode[] = "encode";
  1693. static const char __pyx_k_format[] = "format";
  1694. static const char __pyx_k_import[] = "__import__";
  1695. static const char __pyx_k_name_2[] = "__name__";
  1696. static const char __pyx_k_pickle[] = "pickle";
  1697. static const char __pyx_k_plasma[] = "plasma";
  1698. static const char __pyx_k_reduce[] = "__reduce__";
  1699. static const char __pyx_k_struct[] = "struct";
  1700. static const char __pyx_k_unpack[] = "unpack";
  1701. static const char __pyx_k_update[] = "update";
  1702. static const char __pyx_k_float32[] = "float32";
  1703. static const char __pyx_k_fortran[] = "fortran";
  1704. static const char __pyx_k_inferno[] = "inferno";
  1705. static const char __pyx_k_memview[] = "memview";
  1706. static const char __pyx_k_range_2[] = "range_";
  1707. static const char __pyx_k_viridis[] = "viridis";
  1708. static const char __pyx_k_Ellipsis[] = "Ellipsis";
  1709. static const char __pyx_k_colormap[] = "colormap";
  1710. static const char __pyx_k_getstate[] = "__getstate__";
  1711. static const char __pyx_k_itemsize[] = "itemsize";
  1712. static const char __pyx_k_pyx_type[] = "__pyx_type";
  1713. static const char __pyx_k_setstate[] = "__setstate__";
  1714. static const char __pyx_k_TypeError[] = "TypeError";
  1715. static const char __pyx_k_enumerate[] = "enumerate";
  1716. static const char __pyx_k_pyx_state[] = "__pyx_state";
  1717. static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
  1718. static const char __pyx_k_IndexError[] = "IndexError";
  1719. static const char __pyx_k_ValueError[] = "ValueError";
  1720. static const char __pyx_k_normalized[] = "normalized";
  1721. static const char __pyx_k_pyx_result[] = "__pyx_result";
  1722. static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
  1723. static const char __pyx_k_MemoryError[] = "MemoryError";
  1724. static const char __pyx_k_PickleError[] = "PickleError";
  1725. static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
  1726. static const char __pyx_k_stringsource[] = "stringsource";
  1727. static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
  1728. static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
  1729. static const char __pyx_k_apply_colormap[] = "apply_colormap";
  1730. static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
  1731. static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
  1732. static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
  1733. static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
  1734. static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
  1735. static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
  1736. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  1737. static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
  1738. static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
  1739. static const char __pyx_k_app_colormap_colormap[] = "app.colormap.colormap";
  1740. static const char __pyx_k_apply_colormap_single[] = "apply_colormap_single";
  1741. static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
  1742. static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
  1743. static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
  1744. static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
  1745. static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
  1746. static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
  1747. static const char __pyx_k_app_colormap_colormap_pyx[] = "app/colormap/colormap.pyx";
  1748. static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
  1749. static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
  1750. static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
  1751. static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
  1752. static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
  1753. static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
  1754. static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
  1755. static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
  1756. static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
  1757. static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
  1758. static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
  1759. static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
  1760. static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
  1761. static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
  1762. static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
  1763. static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
  1764. static PyObject *__pyx_n_s_ASCII;
  1765. static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
  1766. static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
  1767. static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
  1768. static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
  1769. static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
  1770. static PyObject *__pyx_n_s_Ellipsis;
  1771. static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
  1772. static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
  1773. static PyObject *__pyx_n_s_IndexError;
  1774. static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
  1775. static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
  1776. static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
  1777. static PyObject *__pyx_n_s_MemoryError;
  1778. static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
  1779. static PyObject *__pyx_kp_s_MemoryView_of_r_object;
  1780. static PyObject *__pyx_n_b_O;
  1781. static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
  1782. static PyObject *__pyx_n_s_PickleError;
  1783. static PyObject *__pyx_n_s_TypeError;
  1784. static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
  1785. static PyObject *__pyx_n_s_ValueError;
  1786. static PyObject *__pyx_n_s_View_MemoryView;
  1787. static PyObject *__pyx_n_s_all;
  1788. static PyObject *__pyx_n_s_allocate_buffer;
  1789. static PyObject *__pyx_n_s_app_colormap_colormap;
  1790. static PyObject *__pyx_kp_s_app_colormap_colormap_pyx;
  1791. static PyObject *__pyx_n_s_apply_colormap;
  1792. static PyObject *__pyx_n_u_apply_colormap;
  1793. static PyObject *__pyx_n_s_apply_colormap_single;
  1794. static PyObject *__pyx_n_u_apply_colormap_single;
  1795. static PyObject *__pyx_n_s_array;
  1796. static PyObject *__pyx_n_s_astype;
  1797. static PyObject *__pyx_n_s_base;
  1798. static PyObject *__pyx_n_s_c;
  1799. static PyObject *__pyx_n_u_c;
  1800. static PyObject *__pyx_n_s_class;
  1801. static PyObject *__pyx_n_s_cline_in_traceback;
  1802. static PyObject *__pyx_n_s_clip;
  1803. static PyObject *__pyx_n_s_cmaps;
  1804. static PyObject *__pyx_n_s_color;
  1805. static PyObject *__pyx_n_s_colormap;
  1806. static PyObject *__pyx_n_s_colors;
  1807. static PyObject *__pyx_kp_s_contiguous_and_direct;
  1808. static PyObject *__pyx_kp_s_contiguous_and_indirect;
  1809. static PyObject *__pyx_n_s_data;
  1810. static PyObject *__pyx_n_s_dict;
  1811. static PyObject *__pyx_n_s_dtype;
  1812. static PyObject *__pyx_n_s_dtype_is_object;
  1813. static PyObject *__pyx_n_s_encode;
  1814. static PyObject *__pyx_n_s_enumerate;
  1815. static PyObject *__pyx_n_s_error;
  1816. static PyObject *__pyx_n_s_flags;
  1817. static PyObject *__pyx_n_s_float32;
  1818. static PyObject *__pyx_n_s_format;
  1819. static PyObject *__pyx_n_s_fortran;
  1820. static PyObject *__pyx_n_u_fortran;
  1821. static PyObject *__pyx_n_s_getstate;
  1822. static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
  1823. static PyObject *__pyx_n_s_id;
  1824. static PyObject *__pyx_n_s_idx;
  1825. static PyObject *__pyx_n_s_idxs;
  1826. static PyObject *__pyx_n_s_import;
  1827. static PyObject *__pyx_n_s_inferno;
  1828. static PyObject *__pyx_n_u_inferno;
  1829. static PyObject *__pyx_n_s_input;
  1830. static PyObject *__pyx_n_s_int32;
  1831. static PyObject *__pyx_n_s_itemsize;
  1832. static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
  1833. static PyObject *__pyx_n_s_magma;
  1834. static PyObject *__pyx_n_u_magma;
  1835. static PyObject *__pyx_n_s_main;
  1836. static PyObject *__pyx_n_s_max;
  1837. static PyObject *__pyx_n_s_max_2;
  1838. static PyObject *__pyx_n_s_memview;
  1839. static PyObject *__pyx_n_s_min;
  1840. static PyObject *__pyx_n_s_min_2;
  1841. static PyObject *__pyx_n_s_mode;
  1842. static PyObject *__pyx_n_s_name;
  1843. static PyObject *__pyx_n_s_name_2;
  1844. static PyObject *__pyx_n_s_ndim;
  1845. static PyObject *__pyx_n_s_new;
  1846. static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
  1847. static PyObject *__pyx_n_s_normalized;
  1848. static PyObject *__pyx_n_s_np;
  1849. static PyObject *__pyx_n_s_numpy;
  1850. static PyObject *__pyx_n_s_obj;
  1851. static PyObject *__pyx_n_s_out;
  1852. static PyObject *__pyx_n_s_pack;
  1853. static PyObject *__pyx_n_s_pickle;
  1854. static PyObject *__pyx_n_s_plasma;
  1855. static PyObject *__pyx_n_u_plasma;
  1856. static PyObject *__pyx_n_s_pyx_PickleError;
  1857. static PyObject *__pyx_n_s_pyx_checksum;
  1858. static PyObject *__pyx_n_s_pyx_getbuffer;
  1859. static PyObject *__pyx_n_s_pyx_result;
  1860. static PyObject *__pyx_n_s_pyx_state;
  1861. static PyObject *__pyx_n_s_pyx_type;
  1862. static PyObject *__pyx_n_s_pyx_unpickle_Enum;
  1863. static PyObject *__pyx_n_s_pyx_vtable;
  1864. static PyObject *__pyx_n_s_range;
  1865. static PyObject *__pyx_n_s_range_2;
  1866. static PyObject *__pyx_n_s_reduce;
  1867. static PyObject *__pyx_n_s_reduce_cython;
  1868. static PyObject *__pyx_n_s_reduce_ex;
  1869. static PyObject *__pyx_n_s_setstate;
  1870. static PyObject *__pyx_n_s_setstate_cython;
  1871. static PyObject *__pyx_n_s_shape;
  1872. static PyObject *__pyx_n_s_size;
  1873. static PyObject *__pyx_n_s_start;
  1874. static PyObject *__pyx_n_s_step;
  1875. static PyObject *__pyx_n_s_stop;
  1876. static PyObject *__pyx_kp_s_strided_and_direct;
  1877. static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
  1878. static PyObject *__pyx_kp_s_strided_and_indirect;
  1879. static PyObject *__pyx_kp_s_stringsource;
  1880. static PyObject *__pyx_n_s_struct;
  1881. static PyObject *__pyx_n_s_test;
  1882. static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
  1883. static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
  1884. static PyObject *__pyx_n_s_unpack;
  1885. static PyObject *__pyx_n_s_update;
  1886. static PyObject *__pyx_n_s_viridis;
  1887. static PyObject *__pyx_n_u_viridis;
  1888. static PyObject *__pyx_n_s_zeros;
  1889. static PyObject *__pyx_pf_3app_8colormap_8colormap_apply_colormap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_, PyObject *__pyx_v_colormap, PyObject *__pyx_v_min_, PyObject *__pyx_v_max_); /* proto */
  1890. static PyObject *__pyx_pf_3app_8colormap_8colormap_2apply_colormap_single(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_, PyObject *__pyx_v_colormap, PyObject *__pyx_v_min_, PyObject *__pyx_v_max_); /* proto */
  1891. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
  1892. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  1893. static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  1894. static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  1895. static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  1896. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
  1897. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  1898. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
  1899. static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
  1900. static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  1901. static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
  1902. static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
  1903. static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
  1904. static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
  1905. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
  1906. static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1907. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
  1908. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
  1909. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  1910. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1911. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1912. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1913. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1914. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1915. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1916. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1917. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1918. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1919. static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1920. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1921. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1922. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1923. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1924. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1925. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1926. static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  1927. static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  1928. static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  1929. static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  1930. static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  1931. static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
  1932. static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
  1933. static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1934. static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1935. static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1936. static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  1937. static PyObject *__pyx_int_0;
  1938. static PyObject *__pyx_int_1;
  1939. static PyObject *__pyx_int_3;
  1940. static PyObject *__pyx_int_15;
  1941. static PyObject *__pyx_int_255;
  1942. static PyObject *__pyx_int_184977713;
  1943. static PyObject *__pyx_int_neg_1;
  1944. static PyObject *__pyx_tuple_;
  1945. static PyObject *__pyx_tuple__2;
  1946. static PyObject *__pyx_tuple__3;
  1947. static PyObject *__pyx_tuple__4;
  1948. static PyObject *__pyx_tuple__5;
  1949. static PyObject *__pyx_tuple__6;
  1950. static PyObject *__pyx_tuple__7;
  1951. static PyObject *__pyx_tuple__8;
  1952. static PyObject *__pyx_tuple__9;
  1953. static PyObject *__pyx_slice__15;
  1954. static PyObject *__pyx_tuple__10;
  1955. static PyObject *__pyx_tuple__11;
  1956. static PyObject *__pyx_tuple__12;
  1957. static PyObject *__pyx_tuple__13;
  1958. static PyObject *__pyx_tuple__14;
  1959. static PyObject *__pyx_tuple__16;
  1960. static PyObject *__pyx_tuple__17;
  1961. static PyObject *__pyx_tuple__18;
  1962. static PyObject *__pyx_tuple__19;
  1963. static PyObject *__pyx_tuple__21;
  1964. static PyObject *__pyx_tuple__23;
  1965. static PyObject *__pyx_tuple__24;
  1966. static PyObject *__pyx_tuple__25;
  1967. static PyObject *__pyx_tuple__26;
  1968. static PyObject *__pyx_tuple__27;
  1969. static PyObject *__pyx_tuple__28;
  1970. static PyObject *__pyx_codeobj__20;
  1971. static PyObject *__pyx_codeobj__22;
  1972. static PyObject *__pyx_codeobj__29;
  1973. /* Late includes */
  1974. /* "app/colormap/colormap.pyx":111
  1975. * @cython.boundscheck(False)
  1976. * @cython.wraparound(False)
  1977. * cdef map_many(int[:, :] idxs, float[:, :, :] dst, float[:,:] cmap): # <<<<<<<<<<<<<<
  1978. * cdef int height = idxs.shape[0]
  1979. * cdef int width = idxs.shape[1]
  1980. */
  1981. static PyObject *__pyx_f_3app_8colormap_8colormap_map_many(__Pyx_memviewslice __pyx_v_idxs, __Pyx_memviewslice __pyx_v_dst, __Pyx_memviewslice __pyx_v_cmap) {
  1982. int __pyx_v_height;
  1983. int __pyx_v_width;
  1984. int __pyx_v_i;
  1985. int __pyx_v_j;
  1986. PyObject *__pyx_r = NULL;
  1987. __Pyx_RefNannyDeclarations
  1988. int __pyx_t_1;
  1989. int __pyx_t_2;
  1990. int __pyx_t_3;
  1991. int __pyx_t_4;
  1992. int __pyx_t_5;
  1993. int __pyx_t_6;
  1994. Py_ssize_t __pyx_t_7;
  1995. Py_ssize_t __pyx_t_8;
  1996. Py_ssize_t __pyx_t_9;
  1997. Py_ssize_t __pyx_t_10;
  1998. Py_ssize_t __pyx_t_11;
  1999. Py_ssize_t __pyx_t_12;
  2000. Py_ssize_t __pyx_t_13;
  2001. Py_ssize_t __pyx_t_14;
  2002. Py_ssize_t __pyx_t_15;
  2003. Py_ssize_t __pyx_t_16;
  2004. Py_ssize_t __pyx_t_17;
  2005. Py_ssize_t __pyx_t_18;
  2006. Py_ssize_t __pyx_t_19;
  2007. Py_ssize_t __pyx_t_20;
  2008. Py_ssize_t __pyx_t_21;
  2009. Py_ssize_t __pyx_t_22;
  2010. Py_ssize_t __pyx_t_23;
  2011. Py_ssize_t __pyx_t_24;
  2012. Py_ssize_t __pyx_t_25;
  2013. Py_ssize_t __pyx_t_26;
  2014. Py_ssize_t __pyx_t_27;
  2015. __Pyx_RefNannySetupContext("map_many", 0);
  2016. /* "app/colormap/colormap.pyx":112
  2017. * @cython.wraparound(False)
  2018. * cdef map_many(int[:, :] idxs, float[:, :, :] dst, float[:,:] cmap):
  2019. * cdef int height = idxs.shape[0] # <<<<<<<<<<<<<<
  2020. * cdef int width = idxs.shape[1]
  2021. * for i in range(height):
  2022. */
  2023. __pyx_v_height = (__pyx_v_idxs.shape[0]);
  2024. /* "app/colormap/colormap.pyx":113
  2025. * cdef map_many(int[:, :] idxs, float[:, :, :] dst, float[:,:] cmap):
  2026. * cdef int height = idxs.shape[0]
  2027. * cdef int width = idxs.shape[1] # <<<<<<<<<<<<<<
  2028. * for i in range(height):
  2029. * for j in range(width):
  2030. */
  2031. __pyx_v_width = (__pyx_v_idxs.shape[1]);
  2032. /* "app/colormap/colormap.pyx":114
  2033. * cdef int height = idxs.shape[0]
  2034. * cdef int width = idxs.shape[1]
  2035. * for i in range(height): # <<<<<<<<<<<<<<
  2036. * for j in range(width):
  2037. * dst[i][j][0] = cmap[idxs[i][j]][0]
  2038. */
  2039. __pyx_t_1 = __pyx_v_height;
  2040. __pyx_t_2 = __pyx_t_1;
  2041. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  2042. __pyx_v_i = __pyx_t_3;
  2043. /* "app/colormap/colormap.pyx":115
  2044. * cdef int width = idxs.shape[1]
  2045. * for i in range(height):
  2046. * for j in range(width): # <<<<<<<<<<<<<<
  2047. * dst[i][j][0] = cmap[idxs[i][j]][0]
  2048. * dst[i][j][1] = cmap[idxs[i][j]][1]
  2049. */
  2050. __pyx_t_4 = __pyx_v_width;
  2051. __pyx_t_5 = __pyx_t_4;
  2052. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  2053. __pyx_v_j = __pyx_t_6;
  2054. /* "app/colormap/colormap.pyx":116
  2055. * for i in range(height):
  2056. * for j in range(width):
  2057. * dst[i][j][0] = cmap[idxs[i][j]][0] # <<<<<<<<<<<<<<
  2058. * dst[i][j][1] = cmap[idxs[i][j]][1]
  2059. * dst[i][j][2] = cmap[idxs[i][j]][2]
  2060. */
  2061. __pyx_t_7 = __pyx_v_i;
  2062. __pyx_t_8 = __pyx_v_j;
  2063. __pyx_t_9 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_idxs.data + __pyx_t_7 * __pyx_v_idxs.strides[0]) ) + __pyx_t_8 * __pyx_v_idxs.strides[1]) )));
  2064. __pyx_t_10 = 0;
  2065. __pyx_t_11 = __pyx_v_i;
  2066. __pyx_t_12 = __pyx_v_j;
  2067. __pyx_t_13 = 0;
  2068. *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dst.data + __pyx_t_11 * __pyx_v_dst.strides[0]) ) + __pyx_t_12 * __pyx_v_dst.strides[1]) ) + __pyx_t_13 * __pyx_v_dst.strides[2]) )) = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cmap.data + __pyx_t_9 * __pyx_v_cmap.strides[0]) ) + __pyx_t_10 * __pyx_v_cmap.strides[1]) )));
  2069. /* "app/colormap/colormap.pyx":117
  2070. * for j in range(width):
  2071. * dst[i][j][0] = cmap[idxs[i][j]][0]
  2072. * dst[i][j][1] = cmap[idxs[i][j]][1] # <<<<<<<<<<<<<<
  2073. * dst[i][j][2] = cmap[idxs[i][j]][2]
  2074. *
  2075. */
  2076. __pyx_t_14 = __pyx_v_i;
  2077. __pyx_t_15 = __pyx_v_j;
  2078. __pyx_t_16 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_idxs.data + __pyx_t_14 * __pyx_v_idxs.strides[0]) ) + __pyx_t_15 * __pyx_v_idxs.strides[1]) )));
  2079. __pyx_t_17 = 1;
  2080. __pyx_t_18 = __pyx_v_i;
  2081. __pyx_t_19 = __pyx_v_j;
  2082. __pyx_t_20 = 1;
  2083. *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dst.data + __pyx_t_18 * __pyx_v_dst.strides[0]) ) + __pyx_t_19 * __pyx_v_dst.strides[1]) ) + __pyx_t_20 * __pyx_v_dst.strides[2]) )) = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cmap.data + __pyx_t_16 * __pyx_v_cmap.strides[0]) ) + __pyx_t_17 * __pyx_v_cmap.strides[1]) )));
  2084. /* "app/colormap/colormap.pyx":118
  2085. * dst[i][j][0] = cmap[idxs[i][j]][0]
  2086. * dst[i][j][1] = cmap[idxs[i][j]][1]
  2087. * dst[i][j][2] = cmap[idxs[i][j]][2] # <<<<<<<<<<<<<<
  2088. *
  2089. *
  2090. */
  2091. __pyx_t_21 = __pyx_v_i;
  2092. __pyx_t_22 = __pyx_v_j;
  2093. __pyx_t_23 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_idxs.data + __pyx_t_21 * __pyx_v_idxs.strides[0]) ) + __pyx_t_22 * __pyx_v_idxs.strides[1]) )));
  2094. __pyx_t_24 = 2;
  2095. __pyx_t_25 = __pyx_v_i;
  2096. __pyx_t_26 = __pyx_v_j;
  2097. __pyx_t_27 = 2;
  2098. *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dst.data + __pyx_t_25 * __pyx_v_dst.strides[0]) ) + __pyx_t_26 * __pyx_v_dst.strides[1]) ) + __pyx_t_27 * __pyx_v_dst.strides[2]) )) = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_cmap.data + __pyx_t_23 * __pyx_v_cmap.strides[0]) ) + __pyx_t_24 * __pyx_v_cmap.strides[1]) )));
  2099. }
  2100. }
  2101. /* "app/colormap/colormap.pyx":111
  2102. * @cython.boundscheck(False)
  2103. * @cython.wraparound(False)
  2104. * cdef map_many(int[:, :] idxs, float[:, :, :] dst, float[:,:] cmap): # <<<<<<<<<<<<<<
  2105. * cdef int height = idxs.shape[0]
  2106. * cdef int width = idxs.shape[1]
  2107. */
  2108. /* function exit code */
  2109. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2110. __Pyx_XGIVEREF(__pyx_r);
  2111. __Pyx_RefNannyFinishContext();
  2112. return __pyx_r;
  2113. }
  2114. /* "app/colormap/colormap.pyx":121
  2115. *
  2116. *
  2117. * def apply_colormap(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  2118. *
  2119. * if max_ is None:
  2120. */
  2121. /* Python wrapper */
  2122. static PyObject *__pyx_pw_3app_8colormap_8colormap_1apply_colormap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2123. static PyMethodDef __pyx_mdef_3app_8colormap_8colormap_1apply_colormap = {"apply_colormap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3app_8colormap_8colormap_1apply_colormap, METH_VARARGS|METH_KEYWORDS, 0};
  2124. static PyObject *__pyx_pw_3app_8colormap_8colormap_1apply_colormap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2125. PyObject *__pyx_v_input_ = 0;
  2126. PyObject *__pyx_v_colormap = 0;
  2127. PyObject *__pyx_v_min_ = 0;
  2128. PyObject *__pyx_v_max_ = 0;
  2129. PyObject *__pyx_r = 0;
  2130. __Pyx_RefNannyDeclarations
  2131. __Pyx_RefNannySetupContext("apply_colormap (wrapper)", 0);
  2132. {
  2133. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input,&__pyx_n_s_colormap,&__pyx_n_s_min,&__pyx_n_s_max,0};
  2134. PyObject* values[4] = {0,0,0,0};
  2135. values[2] = ((PyObject *)Py_None);
  2136. values[3] = ((PyObject *)Py_None);
  2137. if (unlikely(__pyx_kwds)) {
  2138. Py_ssize_t kw_args;
  2139. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2140. switch (pos_args) {
  2141. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2142. CYTHON_FALLTHROUGH;
  2143. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2144. CYTHON_FALLTHROUGH;
  2145. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2146. CYTHON_FALLTHROUGH;
  2147. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2148. CYTHON_FALLTHROUGH;
  2149. case 0: break;
  2150. default: goto __pyx_L5_argtuple_error;
  2151. }
  2152. kw_args = PyDict_Size(__pyx_kwds);
  2153. switch (pos_args) {
  2154. case 0:
  2155. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input)) != 0)) kw_args--;
  2156. else goto __pyx_L5_argtuple_error;
  2157. CYTHON_FALLTHROUGH;
  2158. case 1:
  2159. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colormap)) != 0)) kw_args--;
  2160. else {
  2161. __Pyx_RaiseArgtupleInvalid("apply_colormap", 0, 2, 4, 1); __PYX_ERR(0, 121, __pyx_L3_error)
  2162. }
  2163. CYTHON_FALLTHROUGH;
  2164. case 2:
  2165. if (kw_args > 0) {
  2166. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min);
  2167. if (value) { values[2] = value; kw_args--; }
  2168. }
  2169. CYTHON_FALLTHROUGH;
  2170. case 3:
  2171. if (kw_args > 0) {
  2172. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max);
  2173. if (value) { values[3] = value; kw_args--; }
  2174. }
  2175. }
  2176. if (unlikely(kw_args > 0)) {
  2177. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_colormap") < 0)) __PYX_ERR(0, 121, __pyx_L3_error)
  2178. }
  2179. } else {
  2180. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2181. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2182. CYTHON_FALLTHROUGH;
  2183. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2184. CYTHON_FALLTHROUGH;
  2185. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2186. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2187. break;
  2188. default: goto __pyx_L5_argtuple_error;
  2189. }
  2190. }
  2191. __pyx_v_input_ = values[0];
  2192. __pyx_v_colormap = ((PyObject*)values[1]);
  2193. __pyx_v_min_ = values[2];
  2194. __pyx_v_max_ = values[3];
  2195. }
  2196. goto __pyx_L4_argument_unpacking_done;
  2197. __pyx_L5_argtuple_error:;
  2198. __Pyx_RaiseArgtupleInvalid("apply_colormap", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error)
  2199. __pyx_L3_error:;
  2200. __Pyx_AddTraceback("app.colormap.colormap.apply_colormap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2201. __Pyx_RefNannyFinishContext();
  2202. return NULL;
  2203. __pyx_L4_argument_unpacking_done:;
  2204. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colormap), (&PyUnicode_Type), 1, "colormap", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
  2205. __pyx_r = __pyx_pf_3app_8colormap_8colormap_apply_colormap(__pyx_self, __pyx_v_input_, __pyx_v_colormap, __pyx_v_min_, __pyx_v_max_);
  2206. /* function exit code */
  2207. goto __pyx_L0;
  2208. __pyx_L1_error:;
  2209. __pyx_r = NULL;
  2210. __pyx_L0:;
  2211. __Pyx_RefNannyFinishContext();
  2212. return __pyx_r;
  2213. }
  2214. static PyObject *__pyx_pf_3app_8colormap_8colormap_apply_colormap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_, PyObject *__pyx_v_colormap, PyObject *__pyx_v_min_, PyObject *__pyx_v_max_) {
  2215. PyObject *__pyx_v_range_ = NULL;
  2216. PyObject *__pyx_v_idxs = NULL;
  2217. PyObject *__pyx_v_normalized = NULL;
  2218. PyObject *__pyx_v_colors = NULL;
  2219. PyObject *__pyx_r = NULL;
  2220. __Pyx_RefNannyDeclarations
  2221. int __pyx_t_1;
  2222. int __pyx_t_2;
  2223. PyObject *__pyx_t_3 = NULL;
  2224. PyObject *__pyx_t_4 = NULL;
  2225. PyObject *__pyx_t_5 = NULL;
  2226. PyObject *__pyx_t_6 = NULL;
  2227. PyObject *__pyx_t_7 = NULL;
  2228. __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  2229. __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  2230. __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  2231. __Pyx_RefNannySetupContext("apply_colormap", 0);
  2232. __Pyx_INCREF(__pyx_v_min_);
  2233. __Pyx_INCREF(__pyx_v_max_);
  2234. /* "app/colormap/colormap.pyx":123
  2235. * def apply_colormap(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None):
  2236. *
  2237. * if max_ is None: # <<<<<<<<<<<<<<
  2238. * max_ = np.max(input_)
  2239. * if min_ is None:
  2240. */
  2241. __pyx_t_1 = (__pyx_v_max_ == Py_None);
  2242. __pyx_t_2 = (__pyx_t_1 != 0);
  2243. if (__pyx_t_2) {
  2244. /* "app/colormap/colormap.pyx":124
  2245. *
  2246. * if max_ is None:
  2247. * max_ = np.max(input_) # <<<<<<<<<<<<<<
  2248. * if min_ is None:
  2249. * min_ = np.min(input_)
  2250. */
  2251. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L1_error)
  2252. __Pyx_GOTREF(__pyx_t_4);
  2253. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_max_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
  2254. __Pyx_GOTREF(__pyx_t_5);
  2255. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2256. __pyx_t_4 = NULL;
  2257. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
  2258. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  2259. if (likely(__pyx_t_4)) {
  2260. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  2261. __Pyx_INCREF(__pyx_t_4);
  2262. __Pyx_INCREF(function);
  2263. __Pyx_DECREF_SET(__pyx_t_5, function);
  2264. }
  2265. }
  2266. __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_input_) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_input_);
  2267. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  2268. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)
  2269. __Pyx_GOTREF(__pyx_t_3);
  2270. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2271. __Pyx_DECREF_SET(__pyx_v_max_, __pyx_t_3);
  2272. __pyx_t_3 = 0;
  2273. /* "app/colormap/colormap.pyx":123
  2274. * def apply_colormap(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None):
  2275. *
  2276. * if max_ is None: # <<<<<<<<<<<<<<
  2277. * max_ = np.max(input_)
  2278. * if min_ is None:
  2279. */
  2280. }
  2281. /* "app/colormap/colormap.pyx":125
  2282. * if max_ is None:
  2283. * max_ = np.max(input_)
  2284. * if min_ is None: # <<<<<<<<<<<<<<
  2285. * min_ = np.min(input_)
  2286. * range_ = max_ - min_
  2287. */
  2288. __pyx_t_2 = (__pyx_v_min_ == Py_None);
  2289. __pyx_t_1 = (__pyx_t_2 != 0);
  2290. if (__pyx_t_1) {
  2291. /* "app/colormap/colormap.pyx":126
  2292. * max_ = np.max(input_)
  2293. * if min_ is None:
  2294. * min_ = np.min(input_) # <<<<<<<<<<<<<<
  2295. * range_ = max_ - min_
  2296. * if range_ == 0:
  2297. */
  2298. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
  2299. __Pyx_GOTREF(__pyx_t_5);
  2300. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error)
  2301. __Pyx_GOTREF(__pyx_t_4);
  2302. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2303. __pyx_t_5 = NULL;
  2304. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  2305. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
  2306. if (likely(__pyx_t_5)) {
  2307. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  2308. __Pyx_INCREF(__pyx_t_5);
  2309. __Pyx_INCREF(function);
  2310. __Pyx_DECREF_SET(__pyx_t_4, function);
  2311. }
  2312. }
  2313. __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_input_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_input_);
  2314. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  2315. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  2316. __Pyx_GOTREF(__pyx_t_3);
  2317. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2318. __Pyx_DECREF_SET(__pyx_v_min_, __pyx_t_3);
  2319. __pyx_t_3 = 0;
  2320. /* "app/colormap/colormap.pyx":125
  2321. * if max_ is None:
  2322. * max_ = np.max(input_)
  2323. * if min_ is None: # <<<<<<<<<<<<<<
  2324. * min_ = np.min(input_)
  2325. * range_ = max_ - min_
  2326. */
  2327. }
  2328. /* "app/colormap/colormap.pyx":127
  2329. * if min_ is None:
  2330. * min_ = np.min(input_)
  2331. * range_ = max_ - min_ # <<<<<<<<<<<<<<
  2332. * if range_ == 0:
  2333. * idxs = np.zeros((input_.shape[0], input_.shape[1]), dtype=np.int32)
  2334. */
  2335. __pyx_t_3 = PyNumber_Subtract(__pyx_v_max_, __pyx_v_min_); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error)
  2336. __Pyx_GOTREF(__pyx_t_3);
  2337. __pyx_v_range_ = __pyx_t_3;
  2338. __pyx_t_3 = 0;
  2339. /* "app/colormap/colormap.pyx":128
  2340. * min_ = np.min(input_)
  2341. * range_ = max_ - min_
  2342. * if range_ == 0: # <<<<<<<<<<<<<<
  2343. * idxs = np.zeros((input_.shape[0], input_.shape[1]), dtype=np.int32)
  2344. * else:
  2345. */
  2346. __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_range_, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error)
  2347. __Pyx_GOTREF(__pyx_t_3);
  2348. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
  2349. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2350. if (__pyx_t_1) {
  2351. /* "app/colormap/colormap.pyx":129
  2352. * range_ = max_ - min_
  2353. * if range_ == 0:
  2354. * idxs = np.zeros((input_.shape[0], input_.shape[1]), dtype=np.int32) # <<<<<<<<<<<<<<
  2355. * else:
  2356. * normalized = 15*(input_ - min_) / range_
  2357. */
  2358. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
  2359. __Pyx_GOTREF(__pyx_t_3);
  2360. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 129, __pyx_L1_error)
  2361. __Pyx_GOTREF(__pyx_t_4);
  2362. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2363. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_input_, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
  2364. __Pyx_GOTREF(__pyx_t_3);
  2365. __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error)
  2366. __Pyx_GOTREF(__pyx_t_5);
  2367. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2368. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_input_, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
  2369. __Pyx_GOTREF(__pyx_t_3);
  2370. __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error)
  2371. __Pyx_GOTREF(__pyx_t_6);
  2372. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2373. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
  2374. __Pyx_GOTREF(__pyx_t_3);
  2375. __Pyx_GIVEREF(__pyx_t_5);
  2376. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  2377. __Pyx_GIVEREF(__pyx_t_6);
  2378. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
  2379. __pyx_t_5 = 0;
  2380. __pyx_t_6 = 0;
  2381. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 129, __pyx_L1_error)
  2382. __Pyx_GOTREF(__pyx_t_6);
  2383. __Pyx_GIVEREF(__pyx_t_3);
  2384. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
  2385. __pyx_t_3 = 0;
  2386. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error)
  2387. __Pyx_GOTREF(__pyx_t_3);
  2388. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error)
  2389. __Pyx_GOTREF(__pyx_t_5);
  2390. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 129, __pyx_L1_error)
  2391. __Pyx_GOTREF(__pyx_t_7);
  2392. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2393. if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 129, __pyx_L1_error)
  2394. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2395. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 129, __pyx_L1_error)
  2396. __Pyx_GOTREF(__pyx_t_7);
  2397. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2398. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2399. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2400. __pyx_v_idxs = __pyx_t_7;
  2401. __pyx_t_7 = 0;
  2402. /* "app/colormap/colormap.pyx":128
  2403. * min_ = np.min(input_)
  2404. * range_ = max_ - min_
  2405. * if range_ == 0: # <<<<<<<<<<<<<<
  2406. * idxs = np.zeros((input_.shape[0], input_.shape[1]), dtype=np.int32)
  2407. * else:
  2408. */
  2409. goto __pyx_L5;
  2410. }
  2411. /* "app/colormap/colormap.pyx":131
  2412. * idxs = np.zeros((input_.shape[0], input_.shape[1]), dtype=np.int32)
  2413. * else:
  2414. * normalized = 15*(input_ - min_) / range_ # <<<<<<<<<<<<<<
  2415. * idxs = normalized.astype(np.int32)
  2416. * np.clip(idxs, 0, 15, out=idxs)
  2417. */
  2418. /*else*/ {
  2419. __pyx_t_7 = PyNumber_Subtract(__pyx_v_input_, __pyx_v_min_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L1_error)
  2420. __Pyx_GOTREF(__pyx_t_7);
  2421. __pyx_t_3 = PyNumber_Multiply(__pyx_int_15, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error)
  2422. __Pyx_GOTREF(__pyx_t_3);
  2423. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2424. __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_range_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L1_error)
  2425. __Pyx_GOTREF(__pyx_t_7);
  2426. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2427. __pyx_v_normalized = __pyx_t_7;
  2428. __pyx_t_7 = 0;
  2429. /* "app/colormap/colormap.pyx":132
  2430. * else:
  2431. * normalized = 15*(input_ - min_) / range_
  2432. * idxs = normalized.astype(np.int32) # <<<<<<<<<<<<<<
  2433. * np.clip(idxs, 0, 15, out=idxs)
  2434. * colors = np.zeros(shape=(input_.shape[0], input_.shape[1], 3), dtype=np.float32)
  2435. */
  2436. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_normalized, __pyx_n_s_astype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error)
  2437. __Pyx_GOTREF(__pyx_t_3);
  2438. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error)
  2439. __Pyx_GOTREF(__pyx_t_6);
  2440. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error)
  2441. __Pyx_GOTREF(__pyx_t_4);
  2442. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2443. __pyx_t_6 = NULL;
  2444. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
  2445. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  2446. if (likely(__pyx_t_6)) {
  2447. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  2448. __Pyx_INCREF(__pyx_t_6);
  2449. __Pyx_INCREF(function);
  2450. __Pyx_DECREF_SET(__pyx_t_3, function);
  2451. }
  2452. }
  2453. __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  2454. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  2455. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2456. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error)
  2457. __Pyx_GOTREF(__pyx_t_7);
  2458. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2459. __pyx_v_idxs = __pyx_t_7;
  2460. __pyx_t_7 = 0;
  2461. /* "app/colormap/colormap.pyx":133
  2462. * normalized = 15*(input_ - min_) / range_
  2463. * idxs = normalized.astype(np.int32)
  2464. * np.clip(idxs, 0, 15, out=idxs) # <<<<<<<<<<<<<<
  2465. * colors = np.zeros(shape=(input_.shape[0], input_.shape[1], 3), dtype=np.float32)
  2466. * map_many(idxs, colors, cmaps[colormap])
  2467. */
  2468. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error)
  2469. __Pyx_GOTREF(__pyx_t_7);
  2470. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_clip); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error)
  2471. __Pyx_GOTREF(__pyx_t_3);
  2472. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2473. __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 133, __pyx_L1_error)
  2474. __Pyx_GOTREF(__pyx_t_7);
  2475. __Pyx_INCREF(__pyx_v_idxs);
  2476. __Pyx_GIVEREF(__pyx_v_idxs);
  2477. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_idxs);
  2478. __Pyx_INCREF(__pyx_int_0);
  2479. __Pyx_GIVEREF(__pyx_int_0);
  2480. PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_0);
  2481. __Pyx_INCREF(__pyx_int_15);
  2482. __Pyx_GIVEREF(__pyx_int_15);
  2483. PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_15);
  2484. __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)
  2485. __Pyx_GOTREF(__pyx_t_4);
  2486. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_out, __pyx_v_idxs) < 0) __PYX_ERR(0, 133, __pyx_L1_error)
  2487. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 133, __pyx_L1_error)
  2488. __Pyx_GOTREF(__pyx_t_6);
  2489. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2490. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2491. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2492. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2493. }
  2494. __pyx_L5:;
  2495. /* "app/colormap/colormap.pyx":134
  2496. * idxs = normalized.astype(np.int32)
  2497. * np.clip(idxs, 0, 15, out=idxs)
  2498. * colors = np.zeros(shape=(input_.shape[0], input_.shape[1], 3), dtype=np.float32) # <<<<<<<<<<<<<<
  2499. * map_many(idxs, colors, cmaps[colormap])
  2500. * return colors
  2501. */
  2502. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 134, __pyx_L1_error)
  2503. __Pyx_GOTREF(__pyx_t_6);
  2504. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error)
  2505. __Pyx_GOTREF(__pyx_t_4);
  2506. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2507. __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 134, __pyx_L1_error)
  2508. __Pyx_GOTREF(__pyx_t_6);
  2509. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_input_, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 134, __pyx_L1_error)
  2510. __Pyx_GOTREF(__pyx_t_7);
  2511. __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
  2512. __Pyx_GOTREF(__pyx_t_3);
  2513. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2514. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_input_, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 134, __pyx_L1_error)
  2515. __Pyx_GOTREF(__pyx_t_7);
  2516. __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_7, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error)
  2517. __Pyx_GOTREF(__pyx_t_5);
  2518. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2519. __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 134, __pyx_L1_error)
  2520. __Pyx_GOTREF(__pyx_t_7);
  2521. __Pyx_GIVEREF(__pyx_t_3);
  2522. PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  2523. __Pyx_GIVEREF(__pyx_t_5);
  2524. PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
  2525. __Pyx_INCREF(__pyx_int_3);
  2526. __Pyx_GIVEREF(__pyx_int_3);
  2527. PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_3);
  2528. __pyx_t_3 = 0;
  2529. __pyx_t_5 = 0;
  2530. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_shape, __pyx_t_7) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
  2531. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2532. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 134, __pyx_L1_error)
  2533. __Pyx_GOTREF(__pyx_t_7);
  2534. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error)
  2535. __Pyx_GOTREF(__pyx_t_5);
  2536. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2537. if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 134, __pyx_L1_error)
  2538. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2539. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error)
  2540. __Pyx_GOTREF(__pyx_t_5);
  2541. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2542. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2543. __pyx_v_colors = __pyx_t_5;
  2544. __pyx_t_5 = 0;
  2545. /* "app/colormap/colormap.pyx":135
  2546. * np.clip(idxs, 0, 15, out=idxs)
  2547. * colors = np.zeros(shape=(input_.shape[0], input_.shape[1], 3), dtype=np.float32)
  2548. * map_many(idxs, colors, cmaps[colormap]) # <<<<<<<<<<<<<<
  2549. * return colors
  2550. *
  2551. */
  2552. __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_v_idxs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 135, __pyx_L1_error)
  2553. __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(__pyx_v_colors, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 135, __pyx_L1_error)
  2554. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
  2555. __Pyx_GOTREF(__pyx_t_5);
  2556. __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_v_colormap); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error)
  2557. __Pyx_GOTREF(__pyx_t_6);
  2558. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2559. __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 135, __pyx_L1_error)
  2560. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2561. __pyx_t_6 = __pyx_f_3app_8colormap_8colormap_map_many(__pyx_t_8, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 135, __pyx_L1_error)
  2562. __Pyx_GOTREF(__pyx_t_6);
  2563. __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  2564. __pyx_t_8.memview = NULL;
  2565. __pyx_t_8.data = NULL;
  2566. __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  2567. __pyx_t_9.memview = NULL;
  2568. __pyx_t_9.data = NULL;
  2569. __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  2570. __pyx_t_10.memview = NULL;
  2571. __pyx_t_10.data = NULL;
  2572. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2573. /* "app/colormap/colormap.pyx":136
  2574. * colors = np.zeros(shape=(input_.shape[0], input_.shape[1], 3), dtype=np.float32)
  2575. * map_many(idxs, colors, cmaps[colormap])
  2576. * return colors # <<<<<<<<<<<<<<
  2577. *
  2578. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None):
  2579. */
  2580. __Pyx_XDECREF(__pyx_r);
  2581. __Pyx_INCREF(__pyx_v_colors);
  2582. __pyx_r = __pyx_v_colors;
  2583. goto __pyx_L0;
  2584. /* "app/colormap/colormap.pyx":121
  2585. *
  2586. *
  2587. * def apply_colormap(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  2588. *
  2589. * if max_ is None:
  2590. */
  2591. /* function exit code */
  2592. __pyx_L1_error:;
  2593. __Pyx_XDECREF(__pyx_t_3);
  2594. __Pyx_XDECREF(__pyx_t_4);
  2595. __Pyx_XDECREF(__pyx_t_5);
  2596. __Pyx_XDECREF(__pyx_t_6);
  2597. __Pyx_XDECREF(__pyx_t_7);
  2598. __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  2599. __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  2600. __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  2601. __Pyx_AddTraceback("app.colormap.colormap.apply_colormap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2602. __pyx_r = NULL;
  2603. __pyx_L0:;
  2604. __Pyx_XDECREF(__pyx_v_range_);
  2605. __Pyx_XDECREF(__pyx_v_idxs);
  2606. __Pyx_XDECREF(__pyx_v_normalized);
  2607. __Pyx_XDECREF(__pyx_v_colors);
  2608. __Pyx_XDECREF(__pyx_v_min_);
  2609. __Pyx_XDECREF(__pyx_v_max_);
  2610. __Pyx_XGIVEREF(__pyx_r);
  2611. __Pyx_RefNannyFinishContext();
  2612. return __pyx_r;
  2613. }
  2614. /* "app/colormap/colormap.pyx":138
  2615. * return colors
  2616. *
  2617. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  2618. * range_ = max_ - min_
  2619. * if range_ == 0:
  2620. */
  2621. /* Python wrapper */
  2622. static PyObject *__pyx_pw_3app_8colormap_8colormap_3apply_colormap_single(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2623. static PyMethodDef __pyx_mdef_3app_8colormap_8colormap_3apply_colormap_single = {"apply_colormap_single", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3app_8colormap_8colormap_3apply_colormap_single, METH_VARARGS|METH_KEYWORDS, 0};
  2624. static PyObject *__pyx_pw_3app_8colormap_8colormap_3apply_colormap_single(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2625. PyObject *__pyx_v_input_ = 0;
  2626. PyObject *__pyx_v_colormap = 0;
  2627. PyObject *__pyx_v_min_ = 0;
  2628. PyObject *__pyx_v_max_ = 0;
  2629. PyObject *__pyx_r = 0;
  2630. __Pyx_RefNannyDeclarations
  2631. __Pyx_RefNannySetupContext("apply_colormap_single (wrapper)", 0);
  2632. {
  2633. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input,&__pyx_n_s_colormap,&__pyx_n_s_min,&__pyx_n_s_max,0};
  2634. PyObject* values[4] = {0,0,0,0};
  2635. values[2] = ((PyObject *)Py_None);
  2636. values[3] = ((PyObject *)Py_None);
  2637. if (unlikely(__pyx_kwds)) {
  2638. Py_ssize_t kw_args;
  2639. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2640. switch (pos_args) {
  2641. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2642. CYTHON_FALLTHROUGH;
  2643. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2644. CYTHON_FALLTHROUGH;
  2645. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2646. CYTHON_FALLTHROUGH;
  2647. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2648. CYTHON_FALLTHROUGH;
  2649. case 0: break;
  2650. default: goto __pyx_L5_argtuple_error;
  2651. }
  2652. kw_args = PyDict_Size(__pyx_kwds);
  2653. switch (pos_args) {
  2654. case 0:
  2655. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input)) != 0)) kw_args--;
  2656. else goto __pyx_L5_argtuple_error;
  2657. CYTHON_FALLTHROUGH;
  2658. case 1:
  2659. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colormap)) != 0)) kw_args--;
  2660. else {
  2661. __Pyx_RaiseArgtupleInvalid("apply_colormap_single", 0, 2, 4, 1); __PYX_ERR(0, 138, __pyx_L3_error)
  2662. }
  2663. CYTHON_FALLTHROUGH;
  2664. case 2:
  2665. if (kw_args > 0) {
  2666. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min);
  2667. if (value) { values[2] = value; kw_args--; }
  2668. }
  2669. CYTHON_FALLTHROUGH;
  2670. case 3:
  2671. if (kw_args > 0) {
  2672. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max);
  2673. if (value) { values[3] = value; kw_args--; }
  2674. }
  2675. }
  2676. if (unlikely(kw_args > 0)) {
  2677. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_colormap_single") < 0)) __PYX_ERR(0, 138, __pyx_L3_error)
  2678. }
  2679. } else {
  2680. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2681. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2682. CYTHON_FALLTHROUGH;
  2683. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2684. CYTHON_FALLTHROUGH;
  2685. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2686. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2687. break;
  2688. default: goto __pyx_L5_argtuple_error;
  2689. }
  2690. }
  2691. __pyx_v_input_ = values[0];
  2692. __pyx_v_colormap = ((PyObject*)values[1]);
  2693. __pyx_v_min_ = values[2];
  2694. __pyx_v_max_ = values[3];
  2695. }
  2696. goto __pyx_L4_argument_unpacking_done;
  2697. __pyx_L5_argtuple_error:;
  2698. __Pyx_RaiseArgtupleInvalid("apply_colormap_single", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 138, __pyx_L3_error)
  2699. __pyx_L3_error:;
  2700. __Pyx_AddTraceback("app.colormap.colormap.apply_colormap_single", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2701. __Pyx_RefNannyFinishContext();
  2702. return NULL;
  2703. __pyx_L4_argument_unpacking_done:;
  2704. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colormap), (&PyUnicode_Type), 1, "colormap", 1))) __PYX_ERR(0, 138, __pyx_L1_error)
  2705. __pyx_r = __pyx_pf_3app_8colormap_8colormap_2apply_colormap_single(__pyx_self, __pyx_v_input_, __pyx_v_colormap, __pyx_v_min_, __pyx_v_max_);
  2706. /* function exit code */
  2707. goto __pyx_L0;
  2708. __pyx_L1_error:;
  2709. __pyx_r = NULL;
  2710. __pyx_L0:;
  2711. __Pyx_RefNannyFinishContext();
  2712. return __pyx_r;
  2713. }
  2714. static PyObject *__pyx_pf_3app_8colormap_8colormap_2apply_colormap_single(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_, PyObject *__pyx_v_colormap, PyObject *__pyx_v_min_, PyObject *__pyx_v_max_) {
  2715. PyObject *__pyx_v_range_ = NULL;
  2716. PyObject *__pyx_v_idx = NULL;
  2717. PyObject *__pyx_v_color = NULL;
  2718. PyObject *__pyx_r = NULL;
  2719. __Pyx_RefNannyDeclarations
  2720. PyObject *__pyx_t_1 = NULL;
  2721. int __pyx_t_2;
  2722. PyObject *__pyx_t_3 = NULL;
  2723. PyObject *__pyx_t_4 = NULL;
  2724. int __pyx_t_5;
  2725. PyObject *__pyx_t_6 = NULL;
  2726. __Pyx_RefNannySetupContext("apply_colormap_single", 0);
  2727. /* "app/colormap/colormap.pyx":139
  2728. *
  2729. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None):
  2730. * range_ = max_ - min_ # <<<<<<<<<<<<<<
  2731. * if range_ == 0:
  2732. * idx = 0
  2733. */
  2734. __pyx_t_1 = PyNumber_Subtract(__pyx_v_max_, __pyx_v_min_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
  2735. __Pyx_GOTREF(__pyx_t_1);
  2736. __pyx_v_range_ = __pyx_t_1;
  2737. __pyx_t_1 = 0;
  2738. /* "app/colormap/colormap.pyx":140
  2739. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None):
  2740. * range_ = max_ - min_
  2741. * if range_ == 0: # <<<<<<<<<<<<<<
  2742. * idx = 0
  2743. * else:
  2744. */
  2745. __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_range_, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
  2746. __Pyx_GOTREF(__pyx_t_1);
  2747. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 140, __pyx_L1_error)
  2748. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2749. if (__pyx_t_2) {
  2750. /* "app/colormap/colormap.pyx":141
  2751. * range_ = max_ - min_
  2752. * if range_ == 0:
  2753. * idx = 0 # <<<<<<<<<<<<<<
  2754. * else:
  2755. * idx = int(15*(input_ - min_) / range_)
  2756. */
  2757. __Pyx_INCREF(__pyx_int_0);
  2758. __pyx_v_idx = __pyx_int_0;
  2759. /* "app/colormap/colormap.pyx":140
  2760. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None):
  2761. * range_ = max_ - min_
  2762. * if range_ == 0: # <<<<<<<<<<<<<<
  2763. * idx = 0
  2764. * else:
  2765. */
  2766. goto __pyx_L3;
  2767. }
  2768. /* "app/colormap/colormap.pyx":143
  2769. * idx = 0
  2770. * else:
  2771. * idx = int(15*(input_ - min_) / range_) # <<<<<<<<<<<<<<
  2772. * idx = np.clip(idx, 0, 15)
  2773. * color = tuple(cmaps[colormap][idx])
  2774. */
  2775. /*else*/ {
  2776. __pyx_t_1 = PyNumber_Subtract(__pyx_v_input_, __pyx_v_min_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  2777. __Pyx_GOTREF(__pyx_t_1);
  2778. __pyx_t_3 = PyNumber_Multiply(__pyx_int_15, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  2779. __Pyx_GOTREF(__pyx_t_3);
  2780. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2781. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_range_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  2782. __Pyx_GOTREF(__pyx_t_1);
  2783. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2784. __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
  2785. __Pyx_GOTREF(__pyx_t_3);
  2786. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2787. __pyx_v_idx = __pyx_t_3;
  2788. __pyx_t_3 = 0;
  2789. }
  2790. __pyx_L3:;
  2791. /* "app/colormap/colormap.pyx":144
  2792. * else:
  2793. * idx = int(15*(input_ - min_) / range_)
  2794. * idx = np.clip(idx, 0, 15) # <<<<<<<<<<<<<<
  2795. * color = tuple(cmaps[colormap][idx])
  2796. * return color
  2797. */
  2798. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
  2799. __Pyx_GOTREF(__pyx_t_1);
  2800. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_clip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 144, __pyx_L1_error)
  2801. __Pyx_GOTREF(__pyx_t_4);
  2802. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2803. __pyx_t_1 = NULL;
  2804. __pyx_t_5 = 0;
  2805. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  2806. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
  2807. if (likely(__pyx_t_1)) {
  2808. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  2809. __Pyx_INCREF(__pyx_t_1);
  2810. __Pyx_INCREF(function);
  2811. __Pyx_DECREF_SET(__pyx_t_4, function);
  2812. __pyx_t_5 = 1;
  2813. }
  2814. }
  2815. #if CYTHON_FAST_PYCALL
  2816. if (PyFunction_Check(__pyx_t_4)) {
  2817. PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_idx, __pyx_int_0, __pyx_int_15};
  2818. __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
  2819. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  2820. __Pyx_GOTREF(__pyx_t_3);
  2821. } else
  2822. #endif
  2823. #if CYTHON_FAST_PYCCALL
  2824. if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
  2825. PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_v_idx, __pyx_int_0, __pyx_int_15};
  2826. __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
  2827. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  2828. __Pyx_GOTREF(__pyx_t_3);
  2829. } else
  2830. #endif
  2831. {
  2832. __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error)
  2833. __Pyx_GOTREF(__pyx_t_6);
  2834. if (__pyx_t_1) {
  2835. __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
  2836. }
  2837. __Pyx_INCREF(__pyx_v_idx);
  2838. __Pyx_GIVEREF(__pyx_v_idx);
  2839. PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_idx);
  2840. __Pyx_INCREF(__pyx_int_0);
  2841. __Pyx_GIVEREF(__pyx_int_0);
  2842. PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_0);
  2843. __Pyx_INCREF(__pyx_int_15);
  2844. __Pyx_GIVEREF(__pyx_int_15);
  2845. PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_int_15);
  2846. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error)
  2847. __Pyx_GOTREF(__pyx_t_3);
  2848. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2849. }
  2850. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2851. __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_3);
  2852. __pyx_t_3 = 0;
  2853. /* "app/colormap/colormap.pyx":145
  2854. * idx = int(15*(input_ - min_) / range_)
  2855. * idx = np.clip(idx, 0, 15)
  2856. * color = tuple(cmaps[colormap][idx]) # <<<<<<<<<<<<<<
  2857. * return color
  2858. */
  2859. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
  2860. __Pyx_GOTREF(__pyx_t_3);
  2861. __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_3, __pyx_v_colormap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error)
  2862. __Pyx_GOTREF(__pyx_t_4);
  2863. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2864. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
  2865. __Pyx_GOTREF(__pyx_t_3);
  2866. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2867. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error)
  2868. __Pyx_GOTREF(__pyx_t_4);
  2869. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2870. __pyx_v_color = ((PyObject*)__pyx_t_4);
  2871. __pyx_t_4 = 0;
  2872. /* "app/colormap/colormap.pyx":146
  2873. * idx = np.clip(idx, 0, 15)
  2874. * color = tuple(cmaps[colormap][idx])
  2875. * return color # <<<<<<<<<<<<<<
  2876. */
  2877. __Pyx_XDECREF(__pyx_r);
  2878. __Pyx_INCREF(__pyx_v_color);
  2879. __pyx_r = __pyx_v_color;
  2880. goto __pyx_L0;
  2881. /* "app/colormap/colormap.pyx":138
  2882. * return colors
  2883. *
  2884. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  2885. * range_ = max_ - min_
  2886. * if range_ == 0:
  2887. */
  2888. /* function exit code */
  2889. __pyx_L1_error:;
  2890. __Pyx_XDECREF(__pyx_t_1);
  2891. __Pyx_XDECREF(__pyx_t_3);
  2892. __Pyx_XDECREF(__pyx_t_4);
  2893. __Pyx_XDECREF(__pyx_t_6);
  2894. __Pyx_AddTraceback("app.colormap.colormap.apply_colormap_single", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2895. __pyx_r = NULL;
  2896. __pyx_L0:;
  2897. __Pyx_XDECREF(__pyx_v_range_);
  2898. __Pyx_XDECREF(__pyx_v_idx);
  2899. __Pyx_XDECREF(__pyx_v_color);
  2900. __Pyx_XGIVEREF(__pyx_r);
  2901. __Pyx_RefNannyFinishContext();
  2902. return __pyx_r;
  2903. }
  2904. /* "carray.to_py":112
  2905. *
  2906. * @cname("__Pyx_carray_to_py_float")
  2907. * cdef inline list __Pyx_carray_to_py_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  2908. * cdef size_t i
  2909. * cdef object value
  2910. */
  2911. static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float(float *__pyx_v_v, Py_ssize_t __pyx_v_length) {
  2912. size_t __pyx_v_i;
  2913. PyObject *__pyx_v_value = 0;
  2914. PyObject *__pyx_v_l = NULL;
  2915. PyObject *__pyx_r = NULL;
  2916. __Pyx_RefNannyDeclarations
  2917. PyObject *__pyx_t_1 = NULL;
  2918. size_t __pyx_t_2;
  2919. size_t __pyx_t_3;
  2920. size_t __pyx_t_4;
  2921. __Pyx_RefNannySetupContext("__Pyx_carray_to_py_float", 0);
  2922. /* "carray.to_py":115
  2923. * cdef size_t i
  2924. * cdef object value
  2925. * l = PyList_New(length) # <<<<<<<<<<<<<<
  2926. * for i in range(<size_t>length):
  2927. * value = v[i]
  2928. */
  2929. __pyx_t_1 = PyList_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error)
  2930. __Pyx_GOTREF(__pyx_t_1);
  2931. __pyx_v_l = ((PyObject*)__pyx_t_1);
  2932. __pyx_t_1 = 0;
  2933. /* "carray.to_py":116
  2934. * cdef object value
  2935. * l = PyList_New(length)
  2936. * for i in range(<size_t>length): # <<<<<<<<<<<<<<
  2937. * value = v[i]
  2938. * Py_INCREF(value)
  2939. */
  2940. __pyx_t_2 = ((size_t)__pyx_v_length);
  2941. __pyx_t_3 = __pyx_t_2;
  2942. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  2943. __pyx_v_i = __pyx_t_4;
  2944. /* "carray.to_py":117
  2945. * l = PyList_New(length)
  2946. * for i in range(<size_t>length):
  2947. * value = v[i] # <<<<<<<<<<<<<<
  2948. * Py_INCREF(value)
  2949. * PyList_SET_ITEM(l, i, value)
  2950. */
  2951. __pyx_t_1 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error)
  2952. __Pyx_GOTREF(__pyx_t_1);
  2953. __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
  2954. __pyx_t_1 = 0;
  2955. /* "carray.to_py":118
  2956. * for i in range(<size_t>length):
  2957. * value = v[i]
  2958. * Py_INCREF(value) # <<<<<<<<<<<<<<
  2959. * PyList_SET_ITEM(l, i, value)
  2960. * return l
  2961. */
  2962. Py_INCREF(__pyx_v_value);
  2963. /* "carray.to_py":119
  2964. * value = v[i]
  2965. * Py_INCREF(value)
  2966. * PyList_SET_ITEM(l, i, value) # <<<<<<<<<<<<<<
  2967. * return l
  2968. *
  2969. */
  2970. PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, __pyx_v_value);
  2971. }
  2972. /* "carray.to_py":120
  2973. * Py_INCREF(value)
  2974. * PyList_SET_ITEM(l, i, value)
  2975. * return l # <<<<<<<<<<<<<<
  2976. *
  2977. *
  2978. */
  2979. __Pyx_XDECREF(__pyx_r);
  2980. __Pyx_INCREF(__pyx_v_l);
  2981. __pyx_r = __pyx_v_l;
  2982. goto __pyx_L0;
  2983. /* "carray.to_py":112
  2984. *
  2985. * @cname("__Pyx_carray_to_py_float")
  2986. * cdef inline list __Pyx_carray_to_py_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  2987. * cdef size_t i
  2988. * cdef object value
  2989. */
  2990. /* function exit code */
  2991. __pyx_L1_error:;
  2992. __Pyx_XDECREF(__pyx_t_1);
  2993. __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2994. __pyx_r = 0;
  2995. __pyx_L0:;
  2996. __Pyx_XDECREF(__pyx_v_value);
  2997. __Pyx_XDECREF(__pyx_v_l);
  2998. __Pyx_XGIVEREF(__pyx_r);
  2999. __Pyx_RefNannyFinishContext();
  3000. return __pyx_r;
  3001. }
  3002. /* "carray.to_py":124
  3003. *
  3004. * @cname("__Pyx_carray_to_tuple_float")
  3005. * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  3006. * cdef size_t i
  3007. * cdef object value
  3008. */
  3009. static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float(float *__pyx_v_v, Py_ssize_t __pyx_v_length) {
  3010. size_t __pyx_v_i;
  3011. PyObject *__pyx_v_value = 0;
  3012. PyObject *__pyx_v_t = NULL;
  3013. PyObject *__pyx_r = NULL;
  3014. __Pyx_RefNannyDeclarations
  3015. PyObject *__pyx_t_1 = NULL;
  3016. size_t __pyx_t_2;
  3017. size_t __pyx_t_3;
  3018. size_t __pyx_t_4;
  3019. __Pyx_RefNannySetupContext("__Pyx_carray_to_tuple_float", 0);
  3020. /* "carray.to_py":127
  3021. * cdef size_t i
  3022. * cdef object value
  3023. * t = PyTuple_New(length) # <<<<<<<<<<<<<<
  3024. * for i in range(<size_t>length):
  3025. * value = v[i]
  3026. */
  3027. __pyx_t_1 = PyTuple_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 127, __pyx_L1_error)
  3028. __Pyx_GOTREF(__pyx_t_1);
  3029. __pyx_v_t = ((PyObject*)__pyx_t_1);
  3030. __pyx_t_1 = 0;
  3031. /* "carray.to_py":128
  3032. * cdef object value
  3033. * t = PyTuple_New(length)
  3034. * for i in range(<size_t>length): # <<<<<<<<<<<<<<
  3035. * value = v[i]
  3036. * Py_INCREF(value)
  3037. */
  3038. __pyx_t_2 = ((size_t)__pyx_v_length);
  3039. __pyx_t_3 = __pyx_t_2;
  3040. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  3041. __pyx_v_i = __pyx_t_4;
  3042. /* "carray.to_py":129
  3043. * t = PyTuple_New(length)
  3044. * for i in range(<size_t>length):
  3045. * value = v[i] # <<<<<<<<<<<<<<
  3046. * Py_INCREF(value)
  3047. * PyTuple_SET_ITEM(t, i, value)
  3048. */
  3049. __pyx_t_1 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 129, __pyx_L1_error)
  3050. __Pyx_GOTREF(__pyx_t_1);
  3051. __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
  3052. __pyx_t_1 = 0;
  3053. /* "carray.to_py":130
  3054. * for i in range(<size_t>length):
  3055. * value = v[i]
  3056. * Py_INCREF(value) # <<<<<<<<<<<<<<
  3057. * PyTuple_SET_ITEM(t, i, value)
  3058. * return t
  3059. */
  3060. Py_INCREF(__pyx_v_value);
  3061. /* "carray.to_py":131
  3062. * value = v[i]
  3063. * Py_INCREF(value)
  3064. * PyTuple_SET_ITEM(t, i, value) # <<<<<<<<<<<<<<
  3065. * return t
  3066. */
  3067. PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, __pyx_v_value);
  3068. }
  3069. /* "carray.to_py":132
  3070. * Py_INCREF(value)
  3071. * PyTuple_SET_ITEM(t, i, value)
  3072. * return t # <<<<<<<<<<<<<<
  3073. */
  3074. __Pyx_XDECREF(__pyx_r);
  3075. __Pyx_INCREF(__pyx_v_t);
  3076. __pyx_r = __pyx_v_t;
  3077. goto __pyx_L0;
  3078. /* "carray.to_py":124
  3079. *
  3080. * @cname("__Pyx_carray_to_tuple_float")
  3081. * cdef inline tuple __Pyx_carray_to_tuple_float(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  3082. * cdef size_t i
  3083. * cdef object value
  3084. */
  3085. /* function exit code */
  3086. __pyx_L1_error:;
  3087. __Pyx_XDECREF(__pyx_t_1);
  3088. __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_tuple_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3089. __pyx_r = 0;
  3090. __pyx_L0:;
  3091. __Pyx_XDECREF(__pyx_v_value);
  3092. __Pyx_XDECREF(__pyx_v_t);
  3093. __Pyx_XGIVEREF(__pyx_r);
  3094. __Pyx_RefNannyFinishContext();
  3095. return __pyx_r;
  3096. }
  3097. /* "carray.to_py":112
  3098. *
  3099. * @cname("__Pyx_carray_to_py_float___5b_3_5d_")
  3100. * cdef inline list __Pyx_carray_to_py_float___5b_3_5d_(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  3101. * cdef size_t i
  3102. * cdef object value
  3103. */
  3104. static CYTHON_INLINE PyObject *__Pyx_carray_to_py_float___5b_3_5d_(float (*__pyx_v_v)[3], Py_ssize_t __pyx_v_length) {
  3105. size_t __pyx_v_i;
  3106. PyObject *__pyx_v_value = 0;
  3107. PyObject *__pyx_v_l = NULL;
  3108. PyObject *__pyx_r = NULL;
  3109. __Pyx_RefNannyDeclarations
  3110. PyObject *__pyx_t_1 = NULL;
  3111. size_t __pyx_t_2;
  3112. size_t __pyx_t_3;
  3113. size_t __pyx_t_4;
  3114. __Pyx_RefNannySetupContext("__Pyx_carray_to_py_float___5b_3_5d_", 0);
  3115. /* "carray.to_py":115
  3116. * cdef size_t i
  3117. * cdef object value
  3118. * l = PyList_New(length) # <<<<<<<<<<<<<<
  3119. * for i in range(<size_t>length):
  3120. * value = v[i]
  3121. */
  3122. __pyx_t_1 = PyList_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error)
  3123. __Pyx_GOTREF(__pyx_t_1);
  3124. __pyx_v_l = ((PyObject*)__pyx_t_1);
  3125. __pyx_t_1 = 0;
  3126. /* "carray.to_py":116
  3127. * cdef object value
  3128. * l = PyList_New(length)
  3129. * for i in range(<size_t>length): # <<<<<<<<<<<<<<
  3130. * value = v[i]
  3131. * Py_INCREF(value)
  3132. */
  3133. __pyx_t_2 = ((size_t)__pyx_v_length);
  3134. __pyx_t_3 = __pyx_t_2;
  3135. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  3136. __pyx_v_i = __pyx_t_4;
  3137. /* "carray.to_py":117
  3138. * l = PyList_New(length)
  3139. * for i in range(<size_t>length):
  3140. * value = v[i] # <<<<<<<<<<<<<<
  3141. * Py_INCREF(value)
  3142. * PyList_SET_ITEM(l, i, value)
  3143. */
  3144. __pyx_t_1 = __Pyx_carray_to_py_float((__pyx_v_v[__pyx_v_i]), 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 117, __pyx_L1_error)
  3145. __Pyx_GOTREF(__pyx_t_1);
  3146. __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
  3147. __pyx_t_1 = 0;
  3148. /* "carray.to_py":118
  3149. * for i in range(<size_t>length):
  3150. * value = v[i]
  3151. * Py_INCREF(value) # <<<<<<<<<<<<<<
  3152. * PyList_SET_ITEM(l, i, value)
  3153. * return l
  3154. */
  3155. Py_INCREF(__pyx_v_value);
  3156. /* "carray.to_py":119
  3157. * value = v[i]
  3158. * Py_INCREF(value)
  3159. * PyList_SET_ITEM(l, i, value) # <<<<<<<<<<<<<<
  3160. * return l
  3161. *
  3162. */
  3163. PyList_SET_ITEM(__pyx_v_l, __pyx_v_i, __pyx_v_value);
  3164. }
  3165. /* "carray.to_py":120
  3166. * Py_INCREF(value)
  3167. * PyList_SET_ITEM(l, i, value)
  3168. * return l # <<<<<<<<<<<<<<
  3169. *
  3170. *
  3171. */
  3172. __Pyx_XDECREF(__pyx_r);
  3173. __Pyx_INCREF(__pyx_v_l);
  3174. __pyx_r = __pyx_v_l;
  3175. goto __pyx_L0;
  3176. /* "carray.to_py":112
  3177. *
  3178. * @cname("__Pyx_carray_to_py_float___5b_3_5d_")
  3179. * cdef inline list __Pyx_carray_to_py_float___5b_3_5d_(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  3180. * cdef size_t i
  3181. * cdef object value
  3182. */
  3183. /* function exit code */
  3184. __pyx_L1_error:;
  3185. __Pyx_XDECREF(__pyx_t_1);
  3186. __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_py_float___5b_3_5d_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3187. __pyx_r = 0;
  3188. __pyx_L0:;
  3189. __Pyx_XDECREF(__pyx_v_value);
  3190. __Pyx_XDECREF(__pyx_v_l);
  3191. __Pyx_XGIVEREF(__pyx_r);
  3192. __Pyx_RefNannyFinishContext();
  3193. return __pyx_r;
  3194. }
  3195. /* "carray.to_py":124
  3196. *
  3197. * @cname("__Pyx_carray_to_tuple_float___5b_3_5d_")
  3198. * cdef inline tuple __Pyx_carray_to_tuple_float___5b_3_5d_(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  3199. * cdef size_t i
  3200. * cdef object value
  3201. */
  3202. static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_float___5b_3_5d_(float (*__pyx_v_v)[3], Py_ssize_t __pyx_v_length) {
  3203. size_t __pyx_v_i;
  3204. PyObject *__pyx_v_value = 0;
  3205. PyObject *__pyx_v_t = NULL;
  3206. PyObject *__pyx_r = NULL;
  3207. __Pyx_RefNannyDeclarations
  3208. PyObject *__pyx_t_1 = NULL;
  3209. size_t __pyx_t_2;
  3210. size_t __pyx_t_3;
  3211. size_t __pyx_t_4;
  3212. __Pyx_RefNannySetupContext("__Pyx_carray_to_tuple_float___5b_3_5d_", 0);
  3213. /* "carray.to_py":127
  3214. * cdef size_t i
  3215. * cdef object value
  3216. * t = PyTuple_New(length) # <<<<<<<<<<<<<<
  3217. * for i in range(<size_t>length):
  3218. * value = v[i]
  3219. */
  3220. __pyx_t_1 = PyTuple_New(__pyx_v_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 127, __pyx_L1_error)
  3221. __Pyx_GOTREF(__pyx_t_1);
  3222. __pyx_v_t = ((PyObject*)__pyx_t_1);
  3223. __pyx_t_1 = 0;
  3224. /* "carray.to_py":128
  3225. * cdef object value
  3226. * t = PyTuple_New(length)
  3227. * for i in range(<size_t>length): # <<<<<<<<<<<<<<
  3228. * value = v[i]
  3229. * Py_INCREF(value)
  3230. */
  3231. __pyx_t_2 = ((size_t)__pyx_v_length);
  3232. __pyx_t_3 = __pyx_t_2;
  3233. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  3234. __pyx_v_i = __pyx_t_4;
  3235. /* "carray.to_py":129
  3236. * t = PyTuple_New(length)
  3237. * for i in range(<size_t>length):
  3238. * value = v[i] # <<<<<<<<<<<<<<
  3239. * Py_INCREF(value)
  3240. * PyTuple_SET_ITEM(t, i, value)
  3241. */
  3242. __pyx_t_1 = __Pyx_carray_to_py_float((__pyx_v_v[__pyx_v_i]), 3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 129, __pyx_L1_error)
  3243. __Pyx_GOTREF(__pyx_t_1);
  3244. __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1);
  3245. __pyx_t_1 = 0;
  3246. /* "carray.to_py":130
  3247. * for i in range(<size_t>length):
  3248. * value = v[i]
  3249. * Py_INCREF(value) # <<<<<<<<<<<<<<
  3250. * PyTuple_SET_ITEM(t, i, value)
  3251. * return t
  3252. */
  3253. Py_INCREF(__pyx_v_value);
  3254. /* "carray.to_py":131
  3255. * value = v[i]
  3256. * Py_INCREF(value)
  3257. * PyTuple_SET_ITEM(t, i, value) # <<<<<<<<<<<<<<
  3258. * return t
  3259. */
  3260. PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, __pyx_v_value);
  3261. }
  3262. /* "carray.to_py":132
  3263. * Py_INCREF(value)
  3264. * PyTuple_SET_ITEM(t, i, value)
  3265. * return t # <<<<<<<<<<<<<<
  3266. */
  3267. __Pyx_XDECREF(__pyx_r);
  3268. __Pyx_INCREF(__pyx_v_t);
  3269. __pyx_r = __pyx_v_t;
  3270. goto __pyx_L0;
  3271. /* "carray.to_py":124
  3272. *
  3273. * @cname("__Pyx_carray_to_tuple_float___5b_3_5d_")
  3274. * cdef inline tuple __Pyx_carray_to_tuple_float___5b_3_5d_(base_type *v, Py_ssize_t length): # <<<<<<<<<<<<<<
  3275. * cdef size_t i
  3276. * cdef object value
  3277. */
  3278. /* function exit code */
  3279. __pyx_L1_error:;
  3280. __Pyx_XDECREF(__pyx_t_1);
  3281. __Pyx_AddTraceback("carray.to_py.__Pyx_carray_to_tuple_float___5b_3_5d_", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3282. __pyx_r = 0;
  3283. __pyx_L0:;
  3284. __Pyx_XDECREF(__pyx_v_value);
  3285. __Pyx_XDECREF(__pyx_v_t);
  3286. __Pyx_XGIVEREF(__pyx_r);
  3287. __Pyx_RefNannyFinishContext();
  3288. return __pyx_r;
  3289. }
  3290. /* "View.MemoryView":122
  3291. * cdef bint dtype_is_object
  3292. *
  3293. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  3294. * mode="c", bint allocate_buffer=True):
  3295. *
  3296. */
  3297. /* Python wrapper */
  3298. static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3299. static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3300. PyObject *__pyx_v_shape = 0;
  3301. Py_ssize_t __pyx_v_itemsize;
  3302. PyObject *__pyx_v_format = 0;
  3303. PyObject *__pyx_v_mode = 0;
  3304. int __pyx_v_allocate_buffer;
  3305. int __pyx_r;
  3306. __Pyx_RefNannyDeclarations
  3307. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  3308. {
  3309. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
  3310. PyObject* values[5] = {0,0,0,0,0};
  3311. values[3] = ((PyObject *)__pyx_n_s_c);
  3312. if (unlikely(__pyx_kwds)) {
  3313. Py_ssize_t kw_args;
  3314. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3315. switch (pos_args) {
  3316. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3317. CYTHON_FALLTHROUGH;
  3318. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3319. CYTHON_FALLTHROUGH;
  3320. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3321. CYTHON_FALLTHROUGH;
  3322. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3323. CYTHON_FALLTHROUGH;
  3324. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3325. CYTHON_FALLTHROUGH;
  3326. case 0: break;
  3327. default: goto __pyx_L5_argtuple_error;
  3328. }
  3329. kw_args = PyDict_Size(__pyx_kwds);
  3330. switch (pos_args) {
  3331. case 0:
  3332. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
  3333. else goto __pyx_L5_argtuple_error;
  3334. CYTHON_FALLTHROUGH;
  3335. case 1:
  3336. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
  3337. else {
  3338. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
  3339. }
  3340. CYTHON_FALLTHROUGH;
  3341. case 2:
  3342. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
  3343. else {
  3344. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
  3345. }
  3346. CYTHON_FALLTHROUGH;
  3347. case 3:
  3348. if (kw_args > 0) {
  3349. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
  3350. if (value) { values[3] = value; kw_args--; }
  3351. }
  3352. CYTHON_FALLTHROUGH;
  3353. case 4:
  3354. if (kw_args > 0) {
  3355. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
  3356. if (value) { values[4] = value; kw_args--; }
  3357. }
  3358. }
  3359. if (unlikely(kw_args > 0)) {
  3360. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
  3361. }
  3362. } else {
  3363. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3364. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3365. CYTHON_FALLTHROUGH;
  3366. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3367. CYTHON_FALLTHROUGH;
  3368. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3369. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3370. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3371. break;
  3372. default: goto __pyx_L5_argtuple_error;
  3373. }
  3374. }
  3375. __pyx_v_shape = ((PyObject*)values[0]);
  3376. __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
  3377. __pyx_v_format = values[2];
  3378. __pyx_v_mode = values[3];
  3379. if (values[4]) {
  3380. __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
  3381. } else {
  3382. /* "View.MemoryView":123
  3383. *
  3384. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
  3385. * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
  3386. *
  3387. * cdef int idx
  3388. */
  3389. __pyx_v_allocate_buffer = ((int)1);
  3390. }
  3391. }
  3392. goto __pyx_L4_argument_unpacking_done;
  3393. __pyx_L5_argtuple_error:;
  3394. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
  3395. __pyx_L3_error:;
  3396. __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3397. __Pyx_RefNannyFinishContext();
  3398. return -1;
  3399. __pyx_L4_argument_unpacking_done:;
  3400. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
  3401. if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
  3402. PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 122, __pyx_L1_error)
  3403. }
  3404. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
  3405. /* "View.MemoryView":122
  3406. * cdef bint dtype_is_object
  3407. *
  3408. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  3409. * mode="c", bint allocate_buffer=True):
  3410. *
  3411. */
  3412. /* function exit code */
  3413. goto __pyx_L0;
  3414. __pyx_L1_error:;
  3415. __pyx_r = -1;
  3416. __pyx_L0:;
  3417. __Pyx_RefNannyFinishContext();
  3418. return __pyx_r;
  3419. }
  3420. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
  3421. int __pyx_v_idx;
  3422. Py_ssize_t __pyx_v_i;
  3423. Py_ssize_t __pyx_v_dim;
  3424. PyObject **__pyx_v_p;
  3425. char __pyx_v_order;
  3426. int __pyx_r;
  3427. __Pyx_RefNannyDeclarations
  3428. Py_ssize_t __pyx_t_1;
  3429. int __pyx_t_2;
  3430. PyObject *__pyx_t_3 = NULL;
  3431. int __pyx_t_4;
  3432. PyObject *__pyx_t_5 = NULL;
  3433. PyObject *__pyx_t_6 = NULL;
  3434. char *__pyx_t_7;
  3435. int __pyx_t_8;
  3436. Py_ssize_t __pyx_t_9;
  3437. PyObject *__pyx_t_10 = NULL;
  3438. Py_ssize_t __pyx_t_11;
  3439. __Pyx_RefNannySetupContext("__cinit__", 0);
  3440. __Pyx_INCREF(__pyx_v_format);
  3441. /* "View.MemoryView":129
  3442. * cdef PyObject **p
  3443. *
  3444. * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
  3445. * self.itemsize = itemsize
  3446. *
  3447. */
  3448. if (unlikely(__pyx_v_shape == Py_None)) {
  3449. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  3450. __PYX_ERR(1, 129, __pyx_L1_error)
  3451. }
  3452. __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
  3453. __pyx_v_self->ndim = ((int)__pyx_t_1);
  3454. /* "View.MemoryView":130
  3455. *
  3456. * self.ndim = <int> len(shape)
  3457. * self.itemsize = itemsize # <<<<<<<<<<<<<<
  3458. *
  3459. * if not self.ndim:
  3460. */
  3461. __pyx_v_self->itemsize = __pyx_v_itemsize;
  3462. /* "View.MemoryView":132
  3463. * self.itemsize = itemsize
  3464. *
  3465. * if not self.ndim: # <<<<<<<<<<<<<<
  3466. * raise ValueError("Empty shape tuple for cython.array")
  3467. *
  3468. */
  3469. __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  3470. if (unlikely(__pyx_t_2)) {
  3471. /* "View.MemoryView":133
  3472. *
  3473. * if not self.ndim:
  3474. * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
  3475. *
  3476. * if itemsize <= 0:
  3477. */
  3478. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
  3479. __Pyx_GOTREF(__pyx_t_3);
  3480. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3481. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3482. __PYX_ERR(1, 133, __pyx_L1_error)
  3483. /* "View.MemoryView":132
  3484. * self.itemsize = itemsize
  3485. *
  3486. * if not self.ndim: # <<<<<<<<<<<<<<
  3487. * raise ValueError("Empty shape tuple for cython.array")
  3488. *
  3489. */
  3490. }
  3491. /* "View.MemoryView":135
  3492. * raise ValueError("Empty shape tuple for cython.array")
  3493. *
  3494. * if itemsize <= 0: # <<<<<<<<<<<<<<
  3495. * raise ValueError("itemsize <= 0 for cython.array")
  3496. *
  3497. */
  3498. __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  3499. if (unlikely(__pyx_t_2)) {
  3500. /* "View.MemoryView":136
  3501. *
  3502. * if itemsize <= 0:
  3503. * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
  3504. *
  3505. * if not isinstance(format, bytes):
  3506. */
  3507. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
  3508. __Pyx_GOTREF(__pyx_t_3);
  3509. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3510. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3511. __PYX_ERR(1, 136, __pyx_L1_error)
  3512. /* "View.MemoryView":135
  3513. * raise ValueError("Empty shape tuple for cython.array")
  3514. *
  3515. * if itemsize <= 0: # <<<<<<<<<<<<<<
  3516. * raise ValueError("itemsize <= 0 for cython.array")
  3517. *
  3518. */
  3519. }
  3520. /* "View.MemoryView":138
  3521. * raise ValueError("itemsize <= 0 for cython.array")
  3522. *
  3523. * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
  3524. * format = format.encode('ASCII')
  3525. * self._format = format # keep a reference to the byte string
  3526. */
  3527. __pyx_t_2 = PyBytes_Check(__pyx_v_format);
  3528. __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  3529. if (__pyx_t_4) {
  3530. /* "View.MemoryView":139
  3531. *
  3532. * if not isinstance(format, bytes):
  3533. * format = format.encode('ASCII') # <<<<<<<<<<<<<<
  3534. * self._format = format # keep a reference to the byte string
  3535. * self.format = self._format
  3536. */
  3537. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
  3538. __Pyx_GOTREF(__pyx_t_5);
  3539. __pyx_t_6 = NULL;
  3540. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  3541. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  3542. if (likely(__pyx_t_6)) {
  3543. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  3544. __Pyx_INCREF(__pyx_t_6);
  3545. __Pyx_INCREF(function);
  3546. __Pyx_DECREF_SET(__pyx_t_5, function);
  3547. }
  3548. }
  3549. __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
  3550. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3551. if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
  3552. __Pyx_GOTREF(__pyx_t_3);
  3553. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3554. __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
  3555. __pyx_t_3 = 0;
  3556. /* "View.MemoryView":138
  3557. * raise ValueError("itemsize <= 0 for cython.array")
  3558. *
  3559. * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
  3560. * format = format.encode('ASCII')
  3561. * self._format = format # keep a reference to the byte string
  3562. */
  3563. }
  3564. /* "View.MemoryView":140
  3565. * if not isinstance(format, bytes):
  3566. * format = format.encode('ASCII')
  3567. * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
  3568. * self.format = self._format
  3569. *
  3570. */
  3571. if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
  3572. __pyx_t_3 = __pyx_v_format;
  3573. __Pyx_INCREF(__pyx_t_3);
  3574. __Pyx_GIVEREF(__pyx_t_3);
  3575. __Pyx_GOTREF(__pyx_v_self->_format);
  3576. __Pyx_DECREF(__pyx_v_self->_format);
  3577. __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
  3578. __pyx_t_3 = 0;
  3579. /* "View.MemoryView":141
  3580. * format = format.encode('ASCII')
  3581. * self._format = format # keep a reference to the byte string
  3582. * self.format = self._format # <<<<<<<<<<<<<<
  3583. *
  3584. *
  3585. */
  3586. if (unlikely(__pyx_v_self->_format == Py_None)) {
  3587. PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
  3588. __PYX_ERR(1, 141, __pyx_L1_error)
  3589. }
  3590. __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
  3591. __pyx_v_self->format = __pyx_t_7;
  3592. /* "View.MemoryView":144
  3593. *
  3594. *
  3595. * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
  3596. * self._strides = self._shape + self.ndim
  3597. *
  3598. */
  3599. __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
  3600. /* "View.MemoryView":145
  3601. *
  3602. * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
  3603. * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
  3604. *
  3605. * if not self._shape:
  3606. */
  3607. __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
  3608. /* "View.MemoryView":147
  3609. * self._strides = self._shape + self.ndim
  3610. *
  3611. * if not self._shape: # <<<<<<<<<<<<<<
  3612. * raise MemoryError("unable to allocate shape and strides.")
  3613. *
  3614. */
  3615. __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  3616. if (unlikely(__pyx_t_4)) {
  3617. /* "View.MemoryView":148
  3618. *
  3619. * if not self._shape:
  3620. * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
  3621. *
  3622. *
  3623. */
  3624. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
  3625. __Pyx_GOTREF(__pyx_t_3);
  3626. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3627. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3628. __PYX_ERR(1, 148, __pyx_L1_error)
  3629. /* "View.MemoryView":147
  3630. * self._strides = self._shape + self.ndim
  3631. *
  3632. * if not self._shape: # <<<<<<<<<<<<<<
  3633. * raise MemoryError("unable to allocate shape and strides.")
  3634. *
  3635. */
  3636. }
  3637. /* "View.MemoryView":151
  3638. *
  3639. *
  3640. * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
  3641. * if dim <= 0:
  3642. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3643. */
  3644. __pyx_t_8 = 0;
  3645. __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  3646. for (;;) {
  3647. if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  3648. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3649. __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
  3650. #else
  3651. __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
  3652. __Pyx_GOTREF(__pyx_t_5);
  3653. #endif
  3654. __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
  3655. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3656. __pyx_v_dim = __pyx_t_9;
  3657. __pyx_v_idx = __pyx_t_8;
  3658. __pyx_t_8 = (__pyx_t_8 + 1);
  3659. /* "View.MemoryView":152
  3660. *
  3661. * for idx, dim in enumerate(shape):
  3662. * if dim <= 0: # <<<<<<<<<<<<<<
  3663. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3664. * self._shape[idx] = dim
  3665. */
  3666. __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
  3667. if (unlikely(__pyx_t_4)) {
  3668. /* "View.MemoryView":153
  3669. * for idx, dim in enumerate(shape):
  3670. * if dim <= 0:
  3671. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
  3672. * self._shape[idx] = dim
  3673. *
  3674. */
  3675. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
  3676. __Pyx_GOTREF(__pyx_t_5);
  3677. __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
  3678. __Pyx_GOTREF(__pyx_t_6);
  3679. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
  3680. __Pyx_GOTREF(__pyx_t_10);
  3681. __Pyx_GIVEREF(__pyx_t_5);
  3682. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  3683. __Pyx_GIVEREF(__pyx_t_6);
  3684. PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
  3685. __pyx_t_5 = 0;
  3686. __pyx_t_6 = 0;
  3687. __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
  3688. __Pyx_GOTREF(__pyx_t_6);
  3689. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3690. __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
  3691. __Pyx_GOTREF(__pyx_t_10);
  3692. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3693. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  3694. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3695. __PYX_ERR(1, 153, __pyx_L1_error)
  3696. /* "View.MemoryView":152
  3697. *
  3698. * for idx, dim in enumerate(shape):
  3699. * if dim <= 0: # <<<<<<<<<<<<<<
  3700. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3701. * self._shape[idx] = dim
  3702. */
  3703. }
  3704. /* "View.MemoryView":154
  3705. * if dim <= 0:
  3706. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3707. * self._shape[idx] = dim # <<<<<<<<<<<<<<
  3708. *
  3709. * cdef char order
  3710. */
  3711. (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
  3712. /* "View.MemoryView":151
  3713. *
  3714. *
  3715. * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
  3716. * if dim <= 0:
  3717. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  3718. */
  3719. }
  3720. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3721. /* "View.MemoryView":157
  3722. *
  3723. * cdef char order
  3724. * if mode == 'fortran': # <<<<<<<<<<<<<<
  3725. * order = b'F'
  3726. * self.mode = u'fortran'
  3727. */
  3728. __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
  3729. if (__pyx_t_4) {
  3730. /* "View.MemoryView":158
  3731. * cdef char order
  3732. * if mode == 'fortran':
  3733. * order = b'F' # <<<<<<<<<<<<<<
  3734. * self.mode = u'fortran'
  3735. * elif mode == 'c':
  3736. */
  3737. __pyx_v_order = 'F';
  3738. /* "View.MemoryView":159
  3739. * if mode == 'fortran':
  3740. * order = b'F'
  3741. * self.mode = u'fortran' # <<<<<<<<<<<<<<
  3742. * elif mode == 'c':
  3743. * order = b'C'
  3744. */
  3745. __Pyx_INCREF(__pyx_n_u_fortran);
  3746. __Pyx_GIVEREF(__pyx_n_u_fortran);
  3747. __Pyx_GOTREF(__pyx_v_self->mode);
  3748. __Pyx_DECREF(__pyx_v_self->mode);
  3749. __pyx_v_self->mode = __pyx_n_u_fortran;
  3750. /* "View.MemoryView":157
  3751. *
  3752. * cdef char order
  3753. * if mode == 'fortran': # <<<<<<<<<<<<<<
  3754. * order = b'F'
  3755. * self.mode = u'fortran'
  3756. */
  3757. goto __pyx_L10;
  3758. }
  3759. /* "View.MemoryView":160
  3760. * order = b'F'
  3761. * self.mode = u'fortran'
  3762. * elif mode == 'c': # <<<<<<<<<<<<<<
  3763. * order = b'C'
  3764. * self.mode = u'c'
  3765. */
  3766. __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
  3767. if (likely(__pyx_t_4)) {
  3768. /* "View.MemoryView":161
  3769. * self.mode = u'fortran'
  3770. * elif mode == 'c':
  3771. * order = b'C' # <<<<<<<<<<<<<<
  3772. * self.mode = u'c'
  3773. * else:
  3774. */
  3775. __pyx_v_order = 'C';
  3776. /* "View.MemoryView":162
  3777. * elif mode == 'c':
  3778. * order = b'C'
  3779. * self.mode = u'c' # <<<<<<<<<<<<<<
  3780. * else:
  3781. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  3782. */
  3783. __Pyx_INCREF(__pyx_n_u_c);
  3784. __Pyx_GIVEREF(__pyx_n_u_c);
  3785. __Pyx_GOTREF(__pyx_v_self->mode);
  3786. __Pyx_DECREF(__pyx_v_self->mode);
  3787. __pyx_v_self->mode = __pyx_n_u_c;
  3788. /* "View.MemoryView":160
  3789. * order = b'F'
  3790. * self.mode = u'fortran'
  3791. * elif mode == 'c': # <<<<<<<<<<<<<<
  3792. * order = b'C'
  3793. * self.mode = u'c'
  3794. */
  3795. goto __pyx_L10;
  3796. }
  3797. /* "View.MemoryView":164
  3798. * self.mode = u'c'
  3799. * else:
  3800. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
  3801. *
  3802. * self.len = fill_contig_strides_array(self._shape, self._strides,
  3803. */
  3804. /*else*/ {
  3805. __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
  3806. __Pyx_GOTREF(__pyx_t_3);
  3807. __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
  3808. __Pyx_GOTREF(__pyx_t_10);
  3809. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3810. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  3811. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3812. __PYX_ERR(1, 164, __pyx_L1_error)
  3813. }
  3814. __pyx_L10:;
  3815. /* "View.MemoryView":166
  3816. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  3817. *
  3818. * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
  3819. * itemsize, self.ndim, order)
  3820. *
  3821. */
  3822. __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
  3823. /* "View.MemoryView":169
  3824. * itemsize, self.ndim, order)
  3825. *
  3826. * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
  3827. * self.dtype_is_object = format == b'O'
  3828. * if allocate_buffer:
  3829. */
  3830. __pyx_v_self->free_data = __pyx_v_allocate_buffer;
  3831. /* "View.MemoryView":170
  3832. *
  3833. * self.free_data = allocate_buffer
  3834. * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
  3835. * if allocate_buffer:
  3836. *
  3837. */
  3838. __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
  3839. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
  3840. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3841. __pyx_v_self->dtype_is_object = __pyx_t_4;
  3842. /* "View.MemoryView":171
  3843. * self.free_data = allocate_buffer
  3844. * self.dtype_is_object = format == b'O'
  3845. * if allocate_buffer: # <<<<<<<<<<<<<<
  3846. *
  3847. *
  3848. */
  3849. __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  3850. if (__pyx_t_4) {
  3851. /* "View.MemoryView":174
  3852. *
  3853. *
  3854. * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
  3855. * if not self.data:
  3856. * raise MemoryError("unable to allocate array data.")
  3857. */
  3858. __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
  3859. /* "View.MemoryView":175
  3860. *
  3861. * self.data = <char *>malloc(self.len)
  3862. * if not self.data: # <<<<<<<<<<<<<<
  3863. * raise MemoryError("unable to allocate array data.")
  3864. *
  3865. */
  3866. __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
  3867. if (unlikely(__pyx_t_4)) {
  3868. /* "View.MemoryView":176
  3869. * self.data = <char *>malloc(self.len)
  3870. * if not self.data:
  3871. * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
  3872. *
  3873. * if self.dtype_is_object:
  3874. */
  3875. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
  3876. __Pyx_GOTREF(__pyx_t_10);
  3877. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  3878. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  3879. __PYX_ERR(1, 176, __pyx_L1_error)
  3880. /* "View.MemoryView":175
  3881. *
  3882. * self.data = <char *>malloc(self.len)
  3883. * if not self.data: # <<<<<<<<<<<<<<
  3884. * raise MemoryError("unable to allocate array data.")
  3885. *
  3886. */
  3887. }
  3888. /* "View.MemoryView":178
  3889. * raise MemoryError("unable to allocate array data.")
  3890. *
  3891. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  3892. * p = <PyObject **> self.data
  3893. * for i in range(self.len / itemsize):
  3894. */
  3895. __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
  3896. if (__pyx_t_4) {
  3897. /* "View.MemoryView":179
  3898. *
  3899. * if self.dtype_is_object:
  3900. * p = <PyObject **> self.data # <<<<<<<<<<<<<<
  3901. * for i in range(self.len / itemsize):
  3902. * p[i] = Py_None
  3903. */
  3904. __pyx_v_p = ((PyObject **)__pyx_v_self->data);
  3905. /* "View.MemoryView":180
  3906. * if self.dtype_is_object:
  3907. * p = <PyObject **> self.data
  3908. * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
  3909. * p[i] = Py_None
  3910. * Py_INCREF(Py_None)
  3911. */
  3912. if (unlikely(__pyx_v_itemsize == 0)) {
  3913. PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
  3914. __PYX_ERR(1, 180, __pyx_L1_error)
  3915. }
  3916. else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
  3917. PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
  3918. __PYX_ERR(1, 180, __pyx_L1_error)
  3919. }
  3920. __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
  3921. __pyx_t_9 = __pyx_t_1;
  3922. for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
  3923. __pyx_v_i = __pyx_t_11;
  3924. /* "View.MemoryView":181
  3925. * p = <PyObject **> self.data
  3926. * for i in range(self.len / itemsize):
  3927. * p[i] = Py_None # <<<<<<<<<<<<<<
  3928. * Py_INCREF(Py_None)
  3929. *
  3930. */
  3931. (__pyx_v_p[__pyx_v_i]) = Py_None;
  3932. /* "View.MemoryView":182
  3933. * for i in range(self.len / itemsize):
  3934. * p[i] = Py_None
  3935. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  3936. *
  3937. * @cname('getbuffer')
  3938. */
  3939. Py_INCREF(Py_None);
  3940. }
  3941. /* "View.MemoryView":178
  3942. * raise MemoryError("unable to allocate array data.")
  3943. *
  3944. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  3945. * p = <PyObject **> self.data
  3946. * for i in range(self.len / itemsize):
  3947. */
  3948. }
  3949. /* "View.MemoryView":171
  3950. * self.free_data = allocate_buffer
  3951. * self.dtype_is_object = format == b'O'
  3952. * if allocate_buffer: # <<<<<<<<<<<<<<
  3953. *
  3954. *
  3955. */
  3956. }
  3957. /* "View.MemoryView":122
  3958. * cdef bint dtype_is_object
  3959. *
  3960. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  3961. * mode="c", bint allocate_buffer=True):
  3962. *
  3963. */
  3964. /* function exit code */
  3965. __pyx_r = 0;
  3966. goto __pyx_L0;
  3967. __pyx_L1_error:;
  3968. __Pyx_XDECREF(__pyx_t_3);
  3969. __Pyx_XDECREF(__pyx_t_5);
  3970. __Pyx_XDECREF(__pyx_t_6);
  3971. __Pyx_XDECREF(__pyx_t_10);
  3972. __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3973. __pyx_r = -1;
  3974. __pyx_L0:;
  3975. __Pyx_XDECREF(__pyx_v_format);
  3976. __Pyx_RefNannyFinishContext();
  3977. return __pyx_r;
  3978. }
  3979. /* "View.MemoryView":185
  3980. *
  3981. * @cname('getbuffer')
  3982. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  3983. * cdef int bufmode = -1
  3984. * if self.mode == u"c":
  3985. */
  3986. /* Python wrapper */
  3987. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  3988. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3989. int __pyx_r;
  3990. __Pyx_RefNannyDeclarations
  3991. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  3992. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  3993. /* function exit code */
  3994. __Pyx_RefNannyFinishContext();
  3995. return __pyx_r;
  3996. }
  3997. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3998. int __pyx_v_bufmode;
  3999. int __pyx_r;
  4000. __Pyx_RefNannyDeclarations
  4001. int __pyx_t_1;
  4002. int __pyx_t_2;
  4003. PyObject *__pyx_t_3 = NULL;
  4004. char *__pyx_t_4;
  4005. Py_ssize_t __pyx_t_5;
  4006. int __pyx_t_6;
  4007. Py_ssize_t *__pyx_t_7;
  4008. if (__pyx_v_info == NULL) {
  4009. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  4010. return -1;
  4011. }
  4012. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  4013. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  4014. __Pyx_GIVEREF(__pyx_v_info->obj);
  4015. /* "View.MemoryView":186
  4016. * @cname('getbuffer')
  4017. * def __getbuffer__(self, Py_buffer *info, int flags):
  4018. * cdef int bufmode = -1 # <<<<<<<<<<<<<<
  4019. * if self.mode == u"c":
  4020. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4021. */
  4022. __pyx_v_bufmode = -1;
  4023. /* "View.MemoryView":187
  4024. * def __getbuffer__(self, Py_buffer *info, int flags):
  4025. * cdef int bufmode = -1
  4026. * if self.mode == u"c": # <<<<<<<<<<<<<<
  4027. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4028. * elif self.mode == u"fortran":
  4029. */
  4030. __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
  4031. __pyx_t_2 = (__pyx_t_1 != 0);
  4032. if (__pyx_t_2) {
  4033. /* "View.MemoryView":188
  4034. * cdef int bufmode = -1
  4035. * if self.mode == u"c":
  4036. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  4037. * elif self.mode == u"fortran":
  4038. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4039. */
  4040. __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
  4041. /* "View.MemoryView":187
  4042. * def __getbuffer__(self, Py_buffer *info, int flags):
  4043. * cdef int bufmode = -1
  4044. * if self.mode == u"c": # <<<<<<<<<<<<<<
  4045. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4046. * elif self.mode == u"fortran":
  4047. */
  4048. goto __pyx_L3;
  4049. }
  4050. /* "View.MemoryView":189
  4051. * if self.mode == u"c":
  4052. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4053. * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
  4054. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4055. * if not (flags & bufmode):
  4056. */
  4057. __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
  4058. __pyx_t_1 = (__pyx_t_2 != 0);
  4059. if (__pyx_t_1) {
  4060. /* "View.MemoryView":190
  4061. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4062. * elif self.mode == u"fortran":
  4063. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  4064. * if not (flags & bufmode):
  4065. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  4066. */
  4067. __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
  4068. /* "View.MemoryView":189
  4069. * if self.mode == u"c":
  4070. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4071. * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
  4072. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4073. * if not (flags & bufmode):
  4074. */
  4075. }
  4076. __pyx_L3:;
  4077. /* "View.MemoryView":191
  4078. * elif self.mode == u"fortran":
  4079. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4080. * if not (flags & bufmode): # <<<<<<<<<<<<<<
  4081. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  4082. * info.buf = self.data
  4083. */
  4084. __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  4085. if (unlikely(__pyx_t_1)) {
  4086. /* "View.MemoryView":192
  4087. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4088. * if not (flags & bufmode):
  4089. * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
  4090. * info.buf = self.data
  4091. * info.len = self.len
  4092. */
  4093. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
  4094. __Pyx_GOTREF(__pyx_t_3);
  4095. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4096. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4097. __PYX_ERR(1, 192, __pyx_L1_error)
  4098. /* "View.MemoryView":191
  4099. * elif self.mode == u"fortran":
  4100. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  4101. * if not (flags & bufmode): # <<<<<<<<<<<<<<
  4102. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  4103. * info.buf = self.data
  4104. */
  4105. }
  4106. /* "View.MemoryView":193
  4107. * if not (flags & bufmode):
  4108. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  4109. * info.buf = self.data # <<<<<<<<<<<<<<
  4110. * info.len = self.len
  4111. * info.ndim = self.ndim
  4112. */
  4113. __pyx_t_4 = __pyx_v_self->data;
  4114. __pyx_v_info->buf = __pyx_t_4;
  4115. /* "View.MemoryView":194
  4116. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  4117. * info.buf = self.data
  4118. * info.len = self.len # <<<<<<<<<<<<<<
  4119. * info.ndim = self.ndim
  4120. * info.shape = self._shape
  4121. */
  4122. __pyx_t_5 = __pyx_v_self->len;
  4123. __pyx_v_info->len = __pyx_t_5;
  4124. /* "View.MemoryView":195
  4125. * info.buf = self.data
  4126. * info.len = self.len
  4127. * info.ndim = self.ndim # <<<<<<<<<<<<<<
  4128. * info.shape = self._shape
  4129. * info.strides = self._strides
  4130. */
  4131. __pyx_t_6 = __pyx_v_self->ndim;
  4132. __pyx_v_info->ndim = __pyx_t_6;
  4133. /* "View.MemoryView":196
  4134. * info.len = self.len
  4135. * info.ndim = self.ndim
  4136. * info.shape = self._shape # <<<<<<<<<<<<<<
  4137. * info.strides = self._strides
  4138. * info.suboffsets = NULL
  4139. */
  4140. __pyx_t_7 = __pyx_v_self->_shape;
  4141. __pyx_v_info->shape = __pyx_t_7;
  4142. /* "View.MemoryView":197
  4143. * info.ndim = self.ndim
  4144. * info.shape = self._shape
  4145. * info.strides = self._strides # <<<<<<<<<<<<<<
  4146. * info.suboffsets = NULL
  4147. * info.itemsize = self.itemsize
  4148. */
  4149. __pyx_t_7 = __pyx_v_self->_strides;
  4150. __pyx_v_info->strides = __pyx_t_7;
  4151. /* "View.MemoryView":198
  4152. * info.shape = self._shape
  4153. * info.strides = self._strides
  4154. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  4155. * info.itemsize = self.itemsize
  4156. * info.readonly = 0
  4157. */
  4158. __pyx_v_info->suboffsets = NULL;
  4159. /* "View.MemoryView":199
  4160. * info.strides = self._strides
  4161. * info.suboffsets = NULL
  4162. * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
  4163. * info.readonly = 0
  4164. *
  4165. */
  4166. __pyx_t_5 = __pyx_v_self->itemsize;
  4167. __pyx_v_info->itemsize = __pyx_t_5;
  4168. /* "View.MemoryView":200
  4169. * info.suboffsets = NULL
  4170. * info.itemsize = self.itemsize
  4171. * info.readonly = 0 # <<<<<<<<<<<<<<
  4172. *
  4173. * if flags & PyBUF_FORMAT:
  4174. */
  4175. __pyx_v_info->readonly = 0;
  4176. /* "View.MemoryView":202
  4177. * info.readonly = 0
  4178. *
  4179. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  4180. * info.format = self.format
  4181. * else:
  4182. */
  4183. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  4184. if (__pyx_t_1) {
  4185. /* "View.MemoryView":203
  4186. *
  4187. * if flags & PyBUF_FORMAT:
  4188. * info.format = self.format # <<<<<<<<<<<<<<
  4189. * else:
  4190. * info.format = NULL
  4191. */
  4192. __pyx_t_4 = __pyx_v_self->format;
  4193. __pyx_v_info->format = __pyx_t_4;
  4194. /* "View.MemoryView":202
  4195. * info.readonly = 0
  4196. *
  4197. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  4198. * info.format = self.format
  4199. * else:
  4200. */
  4201. goto __pyx_L5;
  4202. }
  4203. /* "View.MemoryView":205
  4204. * info.format = self.format
  4205. * else:
  4206. * info.format = NULL # <<<<<<<<<<<<<<
  4207. *
  4208. * info.obj = self
  4209. */
  4210. /*else*/ {
  4211. __pyx_v_info->format = NULL;
  4212. }
  4213. __pyx_L5:;
  4214. /* "View.MemoryView":207
  4215. * info.format = NULL
  4216. *
  4217. * info.obj = self # <<<<<<<<<<<<<<
  4218. *
  4219. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  4220. */
  4221. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  4222. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  4223. __Pyx_GOTREF(__pyx_v_info->obj);
  4224. __Pyx_DECREF(__pyx_v_info->obj);
  4225. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  4226. /* "View.MemoryView":185
  4227. *
  4228. * @cname('getbuffer')
  4229. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  4230. * cdef int bufmode = -1
  4231. * if self.mode == u"c":
  4232. */
  4233. /* function exit code */
  4234. __pyx_r = 0;
  4235. goto __pyx_L0;
  4236. __pyx_L1_error:;
  4237. __Pyx_XDECREF(__pyx_t_3);
  4238. __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4239. __pyx_r = -1;
  4240. if (__pyx_v_info->obj != NULL) {
  4241. __Pyx_GOTREF(__pyx_v_info->obj);
  4242. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  4243. }
  4244. goto __pyx_L2;
  4245. __pyx_L0:;
  4246. if (__pyx_v_info->obj == Py_None) {
  4247. __Pyx_GOTREF(__pyx_v_info->obj);
  4248. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  4249. }
  4250. __pyx_L2:;
  4251. __Pyx_RefNannyFinishContext();
  4252. return __pyx_r;
  4253. }
  4254. /* "View.MemoryView":211
  4255. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  4256. *
  4257. * def __dealloc__(array self): # <<<<<<<<<<<<<<
  4258. * if self.callback_free_data != NULL:
  4259. * self.callback_free_data(self.data)
  4260. */
  4261. /* Python wrapper */
  4262. static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
  4263. static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  4264. __Pyx_RefNannyDeclarations
  4265. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  4266. __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
  4267. /* function exit code */
  4268. __Pyx_RefNannyFinishContext();
  4269. }
  4270. static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  4271. __Pyx_RefNannyDeclarations
  4272. int __pyx_t_1;
  4273. __Pyx_RefNannySetupContext("__dealloc__", 0);
  4274. /* "View.MemoryView":212
  4275. *
  4276. * def __dealloc__(array self):
  4277. * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
  4278. * self.callback_free_data(self.data)
  4279. * elif self.free_data:
  4280. */
  4281. __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  4282. if (__pyx_t_1) {
  4283. /* "View.MemoryView":213
  4284. * def __dealloc__(array self):
  4285. * if self.callback_free_data != NULL:
  4286. * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
  4287. * elif self.free_data:
  4288. * if self.dtype_is_object:
  4289. */
  4290. __pyx_v_self->callback_free_data(__pyx_v_self->data);
  4291. /* "View.MemoryView":212
  4292. *
  4293. * def __dealloc__(array self):
  4294. * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
  4295. * self.callback_free_data(self.data)
  4296. * elif self.free_data:
  4297. */
  4298. goto __pyx_L3;
  4299. }
  4300. /* "View.MemoryView":214
  4301. * if self.callback_free_data != NULL:
  4302. * self.callback_free_data(self.data)
  4303. * elif self.free_data: # <<<<<<<<<<<<<<
  4304. * if self.dtype_is_object:
  4305. * refcount_objects_in_slice(self.data, self._shape,
  4306. */
  4307. __pyx_t_1 = (__pyx_v_self->free_data != 0);
  4308. if (__pyx_t_1) {
  4309. /* "View.MemoryView":215
  4310. * self.callback_free_data(self.data)
  4311. * elif self.free_data:
  4312. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  4313. * refcount_objects_in_slice(self.data, self._shape,
  4314. * self._strides, self.ndim, False)
  4315. */
  4316. __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
  4317. if (__pyx_t_1) {
  4318. /* "View.MemoryView":216
  4319. * elif self.free_data:
  4320. * if self.dtype_is_object:
  4321. * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
  4322. * self._strides, self.ndim, False)
  4323. * free(self.data)
  4324. */
  4325. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
  4326. /* "View.MemoryView":215
  4327. * self.callback_free_data(self.data)
  4328. * elif self.free_data:
  4329. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  4330. * refcount_objects_in_slice(self.data, self._shape,
  4331. * self._strides, self.ndim, False)
  4332. */
  4333. }
  4334. /* "View.MemoryView":218
  4335. * refcount_objects_in_slice(self.data, self._shape,
  4336. * self._strides, self.ndim, False)
  4337. * free(self.data) # <<<<<<<<<<<<<<
  4338. * PyObject_Free(self._shape)
  4339. *
  4340. */
  4341. free(__pyx_v_self->data);
  4342. /* "View.MemoryView":214
  4343. * if self.callback_free_data != NULL:
  4344. * self.callback_free_data(self.data)
  4345. * elif self.free_data: # <<<<<<<<<<<<<<
  4346. * if self.dtype_is_object:
  4347. * refcount_objects_in_slice(self.data, self._shape,
  4348. */
  4349. }
  4350. __pyx_L3:;
  4351. /* "View.MemoryView":219
  4352. * self._strides, self.ndim, False)
  4353. * free(self.data)
  4354. * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
  4355. *
  4356. * @property
  4357. */
  4358. PyObject_Free(__pyx_v_self->_shape);
  4359. /* "View.MemoryView":211
  4360. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  4361. *
  4362. * def __dealloc__(array self): # <<<<<<<<<<<<<<
  4363. * if self.callback_free_data != NULL:
  4364. * self.callback_free_data(self.data)
  4365. */
  4366. /* function exit code */
  4367. __Pyx_RefNannyFinishContext();
  4368. }
  4369. /* "View.MemoryView":222
  4370. *
  4371. * @property
  4372. * def memview(self): # <<<<<<<<<<<<<<
  4373. * return self.get_memview()
  4374. *
  4375. */
  4376. /* Python wrapper */
  4377. static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
  4378. static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  4379. PyObject *__pyx_r = 0;
  4380. __Pyx_RefNannyDeclarations
  4381. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  4382. __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
  4383. /* function exit code */
  4384. __Pyx_RefNannyFinishContext();
  4385. return __pyx_r;
  4386. }
  4387. static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  4388. PyObject *__pyx_r = NULL;
  4389. __Pyx_RefNannyDeclarations
  4390. PyObject *__pyx_t_1 = NULL;
  4391. __Pyx_RefNannySetupContext("__get__", 0);
  4392. /* "View.MemoryView":223
  4393. * @property
  4394. * def memview(self):
  4395. * return self.get_memview() # <<<<<<<<<<<<<<
  4396. *
  4397. * @cname('get_memview')
  4398. */
  4399. __Pyx_XDECREF(__pyx_r);
  4400. __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
  4401. __Pyx_GOTREF(__pyx_t_1);
  4402. __pyx_r = __pyx_t_1;
  4403. __pyx_t_1 = 0;
  4404. goto __pyx_L0;
  4405. /* "View.MemoryView":222
  4406. *
  4407. * @property
  4408. * def memview(self): # <<<<<<<<<<<<<<
  4409. * return self.get_memview()
  4410. *
  4411. */
  4412. /* function exit code */
  4413. __pyx_L1_error:;
  4414. __Pyx_XDECREF(__pyx_t_1);
  4415. __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4416. __pyx_r = NULL;
  4417. __pyx_L0:;
  4418. __Pyx_XGIVEREF(__pyx_r);
  4419. __Pyx_RefNannyFinishContext();
  4420. return __pyx_r;
  4421. }
  4422. /* "View.MemoryView":226
  4423. *
  4424. * @cname('get_memview')
  4425. * cdef get_memview(self): # <<<<<<<<<<<<<<
  4426. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  4427. * return memoryview(self, flags, self.dtype_is_object)
  4428. */
  4429. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  4430. int __pyx_v_flags;
  4431. PyObject *__pyx_r = NULL;
  4432. __Pyx_RefNannyDeclarations
  4433. PyObject *__pyx_t_1 = NULL;
  4434. PyObject *__pyx_t_2 = NULL;
  4435. PyObject *__pyx_t_3 = NULL;
  4436. __Pyx_RefNannySetupContext("get_memview", 0);
  4437. /* "View.MemoryView":227
  4438. * @cname('get_memview')
  4439. * cdef get_memview(self):
  4440. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
  4441. * return memoryview(self, flags, self.dtype_is_object)
  4442. *
  4443. */
  4444. __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
  4445. /* "View.MemoryView":228
  4446. * cdef get_memview(self):
  4447. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  4448. * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
  4449. *
  4450. * def __len__(self):
  4451. */
  4452. __Pyx_XDECREF(__pyx_r);
  4453. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
  4454. __Pyx_GOTREF(__pyx_t_1);
  4455. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
  4456. __Pyx_GOTREF(__pyx_t_2);
  4457. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
  4458. __Pyx_GOTREF(__pyx_t_3);
  4459. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  4460. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  4461. PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  4462. __Pyx_GIVEREF(__pyx_t_1);
  4463. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  4464. __Pyx_GIVEREF(__pyx_t_2);
  4465. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  4466. __pyx_t_1 = 0;
  4467. __pyx_t_2 = 0;
  4468. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
  4469. __Pyx_GOTREF(__pyx_t_2);
  4470. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4471. __pyx_r = __pyx_t_2;
  4472. __pyx_t_2 = 0;
  4473. goto __pyx_L0;
  4474. /* "View.MemoryView":226
  4475. *
  4476. * @cname('get_memview')
  4477. * cdef get_memview(self): # <<<<<<<<<<<<<<
  4478. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  4479. * return memoryview(self, flags, self.dtype_is_object)
  4480. */
  4481. /* function exit code */
  4482. __pyx_L1_error:;
  4483. __Pyx_XDECREF(__pyx_t_1);
  4484. __Pyx_XDECREF(__pyx_t_2);
  4485. __Pyx_XDECREF(__pyx_t_3);
  4486. __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4487. __pyx_r = 0;
  4488. __pyx_L0:;
  4489. __Pyx_XGIVEREF(__pyx_r);
  4490. __Pyx_RefNannyFinishContext();
  4491. return __pyx_r;
  4492. }
  4493. /* "View.MemoryView":230
  4494. * return memoryview(self, flags, self.dtype_is_object)
  4495. *
  4496. * def __len__(self): # <<<<<<<<<<<<<<
  4497. * return self._shape[0]
  4498. *
  4499. */
  4500. /* Python wrapper */
  4501. static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
  4502. static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  4503. Py_ssize_t __pyx_r;
  4504. __Pyx_RefNannyDeclarations
  4505. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  4506. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
  4507. /* function exit code */
  4508. __Pyx_RefNannyFinishContext();
  4509. return __pyx_r;
  4510. }
  4511. static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  4512. Py_ssize_t __pyx_r;
  4513. __Pyx_RefNannyDeclarations
  4514. __Pyx_RefNannySetupContext("__len__", 0);
  4515. /* "View.MemoryView":231
  4516. *
  4517. * def __len__(self):
  4518. * return self._shape[0] # <<<<<<<<<<<<<<
  4519. *
  4520. * def __getattr__(self, attr):
  4521. */
  4522. __pyx_r = (__pyx_v_self->_shape[0]);
  4523. goto __pyx_L0;
  4524. /* "View.MemoryView":230
  4525. * return memoryview(self, flags, self.dtype_is_object)
  4526. *
  4527. * def __len__(self): # <<<<<<<<<<<<<<
  4528. * return self._shape[0]
  4529. *
  4530. */
  4531. /* function exit code */
  4532. __pyx_L0:;
  4533. __Pyx_RefNannyFinishContext();
  4534. return __pyx_r;
  4535. }
  4536. /* "View.MemoryView":233
  4537. * return self._shape[0]
  4538. *
  4539. * def __getattr__(self, attr): # <<<<<<<<<<<<<<
  4540. * return getattr(self.memview, attr)
  4541. *
  4542. */
  4543. /* Python wrapper */
  4544. static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
  4545. static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  4546. PyObject *__pyx_r = 0;
  4547. __Pyx_RefNannyDeclarations
  4548. __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  4549. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
  4550. /* function exit code */
  4551. __Pyx_RefNannyFinishContext();
  4552. return __pyx_r;
  4553. }
  4554. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  4555. PyObject *__pyx_r = NULL;
  4556. __Pyx_RefNannyDeclarations
  4557. PyObject *__pyx_t_1 = NULL;
  4558. PyObject *__pyx_t_2 = NULL;
  4559. __Pyx_RefNannySetupContext("__getattr__", 0);
  4560. /* "View.MemoryView":234
  4561. *
  4562. * def __getattr__(self, attr):
  4563. * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
  4564. *
  4565. * def __getitem__(self, item):
  4566. */
  4567. __Pyx_XDECREF(__pyx_r);
  4568. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
  4569. __Pyx_GOTREF(__pyx_t_1);
  4570. __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
  4571. __Pyx_GOTREF(__pyx_t_2);
  4572. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4573. __pyx_r = __pyx_t_2;
  4574. __pyx_t_2 = 0;
  4575. goto __pyx_L0;
  4576. /* "View.MemoryView":233
  4577. * return self._shape[0]
  4578. *
  4579. * def __getattr__(self, attr): # <<<<<<<<<<<<<<
  4580. * return getattr(self.memview, attr)
  4581. *
  4582. */
  4583. /* function exit code */
  4584. __pyx_L1_error:;
  4585. __Pyx_XDECREF(__pyx_t_1);
  4586. __Pyx_XDECREF(__pyx_t_2);
  4587. __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4588. __pyx_r = NULL;
  4589. __pyx_L0:;
  4590. __Pyx_XGIVEREF(__pyx_r);
  4591. __Pyx_RefNannyFinishContext();
  4592. return __pyx_r;
  4593. }
  4594. /* "View.MemoryView":236
  4595. * return getattr(self.memview, attr)
  4596. *
  4597. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  4598. * return self.memview[item]
  4599. *
  4600. */
  4601. /* Python wrapper */
  4602. static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  4603. static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  4604. PyObject *__pyx_r = 0;
  4605. __Pyx_RefNannyDeclarations
  4606. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  4607. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  4608. /* function exit code */
  4609. __Pyx_RefNannyFinishContext();
  4610. return __pyx_r;
  4611. }
  4612. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  4613. PyObject *__pyx_r = NULL;
  4614. __Pyx_RefNannyDeclarations
  4615. PyObject *__pyx_t_1 = NULL;
  4616. PyObject *__pyx_t_2 = NULL;
  4617. __Pyx_RefNannySetupContext("__getitem__", 0);
  4618. /* "View.MemoryView":237
  4619. *
  4620. * def __getitem__(self, item):
  4621. * return self.memview[item] # <<<<<<<<<<<<<<
  4622. *
  4623. * def __setitem__(self, item, value):
  4624. */
  4625. __Pyx_XDECREF(__pyx_r);
  4626. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
  4627. __Pyx_GOTREF(__pyx_t_1);
  4628. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
  4629. __Pyx_GOTREF(__pyx_t_2);
  4630. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4631. __pyx_r = __pyx_t_2;
  4632. __pyx_t_2 = 0;
  4633. goto __pyx_L0;
  4634. /* "View.MemoryView":236
  4635. * return getattr(self.memview, attr)
  4636. *
  4637. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  4638. * return self.memview[item]
  4639. *
  4640. */
  4641. /* function exit code */
  4642. __pyx_L1_error:;
  4643. __Pyx_XDECREF(__pyx_t_1);
  4644. __Pyx_XDECREF(__pyx_t_2);
  4645. __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4646. __pyx_r = NULL;
  4647. __pyx_L0:;
  4648. __Pyx_XGIVEREF(__pyx_r);
  4649. __Pyx_RefNannyFinishContext();
  4650. return __pyx_r;
  4651. }
  4652. /* "View.MemoryView":239
  4653. * return self.memview[item]
  4654. *
  4655. * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
  4656. * self.memview[item] = value
  4657. *
  4658. */
  4659. /* Python wrapper */
  4660. static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
  4661. static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  4662. int __pyx_r;
  4663. __Pyx_RefNannyDeclarations
  4664. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  4665. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
  4666. /* function exit code */
  4667. __Pyx_RefNannyFinishContext();
  4668. return __pyx_r;
  4669. }
  4670. static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  4671. int __pyx_r;
  4672. __Pyx_RefNannyDeclarations
  4673. PyObject *__pyx_t_1 = NULL;
  4674. __Pyx_RefNannySetupContext("__setitem__", 0);
  4675. /* "View.MemoryView":240
  4676. *
  4677. * def __setitem__(self, item, value):
  4678. * self.memview[item] = value # <<<<<<<<<<<<<<
  4679. *
  4680. *
  4681. */
  4682. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
  4683. __Pyx_GOTREF(__pyx_t_1);
  4684. if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
  4685. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4686. /* "View.MemoryView":239
  4687. * return self.memview[item]
  4688. *
  4689. * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
  4690. * self.memview[item] = value
  4691. *
  4692. */
  4693. /* function exit code */
  4694. __pyx_r = 0;
  4695. goto __pyx_L0;
  4696. __pyx_L1_error:;
  4697. __Pyx_XDECREF(__pyx_t_1);
  4698. __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4699. __pyx_r = -1;
  4700. __pyx_L0:;
  4701. __Pyx_RefNannyFinishContext();
  4702. return __pyx_r;
  4703. }
  4704. /* "(tree fragment)":1
  4705. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  4706. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4707. * def __setstate_cython__(self, __pyx_state):
  4708. */
  4709. /* Python wrapper */
  4710. static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  4711. static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  4712. PyObject *__pyx_r = 0;
  4713. __Pyx_RefNannyDeclarations
  4714. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  4715. __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
  4716. /* function exit code */
  4717. __Pyx_RefNannyFinishContext();
  4718. return __pyx_r;
  4719. }
  4720. static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  4721. PyObject *__pyx_r = NULL;
  4722. __Pyx_RefNannyDeclarations
  4723. PyObject *__pyx_t_1 = NULL;
  4724. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  4725. /* "(tree fragment)":2
  4726. * def __reduce_cython__(self):
  4727. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  4728. * def __setstate_cython__(self, __pyx_state):
  4729. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4730. */
  4731. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  4732. __Pyx_GOTREF(__pyx_t_1);
  4733. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4734. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4735. __PYX_ERR(1, 2, __pyx_L1_error)
  4736. /* "(tree fragment)":1
  4737. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  4738. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4739. * def __setstate_cython__(self, __pyx_state):
  4740. */
  4741. /* function exit code */
  4742. __pyx_L1_error:;
  4743. __Pyx_XDECREF(__pyx_t_1);
  4744. __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4745. __pyx_r = NULL;
  4746. __Pyx_XGIVEREF(__pyx_r);
  4747. __Pyx_RefNannyFinishContext();
  4748. return __pyx_r;
  4749. }
  4750. /* "(tree fragment)":3
  4751. * def __reduce_cython__(self):
  4752. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4753. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  4754. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4755. */
  4756. /* Python wrapper */
  4757. static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  4758. static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  4759. PyObject *__pyx_r = 0;
  4760. __Pyx_RefNannyDeclarations
  4761. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  4762. __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  4763. /* function exit code */
  4764. __Pyx_RefNannyFinishContext();
  4765. return __pyx_r;
  4766. }
  4767. static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  4768. PyObject *__pyx_r = NULL;
  4769. __Pyx_RefNannyDeclarations
  4770. PyObject *__pyx_t_1 = NULL;
  4771. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  4772. /* "(tree fragment)":4
  4773. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4774. * def __setstate_cython__(self, __pyx_state):
  4775. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  4776. */
  4777. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  4778. __Pyx_GOTREF(__pyx_t_1);
  4779. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4780. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4781. __PYX_ERR(1, 4, __pyx_L1_error)
  4782. /* "(tree fragment)":3
  4783. * def __reduce_cython__(self):
  4784. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4785. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  4786. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  4787. */
  4788. /* function exit code */
  4789. __pyx_L1_error:;
  4790. __Pyx_XDECREF(__pyx_t_1);
  4791. __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4792. __pyx_r = NULL;
  4793. __Pyx_XGIVEREF(__pyx_r);
  4794. __Pyx_RefNannyFinishContext();
  4795. return __pyx_r;
  4796. }
  4797. /* "View.MemoryView":244
  4798. *
  4799. * @cname("__pyx_array_new")
  4800. * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
  4801. * char *mode, char *buf):
  4802. * cdef array result
  4803. */
  4804. static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
  4805. struct __pyx_array_obj *__pyx_v_result = 0;
  4806. struct __pyx_array_obj *__pyx_r = NULL;
  4807. __Pyx_RefNannyDeclarations
  4808. int __pyx_t_1;
  4809. PyObject *__pyx_t_2 = NULL;
  4810. PyObject *__pyx_t_3 = NULL;
  4811. PyObject *__pyx_t_4 = NULL;
  4812. PyObject *__pyx_t_5 = NULL;
  4813. __Pyx_RefNannySetupContext("array_cwrapper", 0);
  4814. /* "View.MemoryView":248
  4815. * cdef array result
  4816. *
  4817. * if buf == NULL: # <<<<<<<<<<<<<<
  4818. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4819. * else:
  4820. */
  4821. __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  4822. if (__pyx_t_1) {
  4823. /* "View.MemoryView":249
  4824. *
  4825. * if buf == NULL:
  4826. * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
  4827. * else:
  4828. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  4829. */
  4830. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
  4831. __Pyx_GOTREF(__pyx_t_2);
  4832. __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
  4833. __Pyx_GOTREF(__pyx_t_3);
  4834. __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
  4835. __Pyx_GOTREF(__pyx_t_4);
  4836. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
  4837. __Pyx_GOTREF(__pyx_t_5);
  4838. __Pyx_INCREF(__pyx_v_shape);
  4839. __Pyx_GIVEREF(__pyx_v_shape);
  4840. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
  4841. __Pyx_GIVEREF(__pyx_t_2);
  4842. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  4843. __Pyx_GIVEREF(__pyx_t_3);
  4844. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  4845. __Pyx_GIVEREF(__pyx_t_4);
  4846. PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  4847. __pyx_t_2 = 0;
  4848. __pyx_t_3 = 0;
  4849. __pyx_t_4 = 0;
  4850. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
  4851. __Pyx_GOTREF(__pyx_t_4);
  4852. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4853. __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
  4854. __pyx_t_4 = 0;
  4855. /* "View.MemoryView":248
  4856. * cdef array result
  4857. *
  4858. * if buf == NULL: # <<<<<<<<<<<<<<
  4859. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4860. * else:
  4861. */
  4862. goto __pyx_L3;
  4863. }
  4864. /* "View.MemoryView":251
  4865. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4866. * else:
  4867. * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
  4868. * allocate_buffer=False)
  4869. * result.data = buf
  4870. */
  4871. /*else*/ {
  4872. __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
  4873. __Pyx_GOTREF(__pyx_t_4);
  4874. __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
  4875. __Pyx_GOTREF(__pyx_t_5);
  4876. __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
  4877. __Pyx_GOTREF(__pyx_t_3);
  4878. __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
  4879. __Pyx_GOTREF(__pyx_t_2);
  4880. __Pyx_INCREF(__pyx_v_shape);
  4881. __Pyx_GIVEREF(__pyx_v_shape);
  4882. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
  4883. __Pyx_GIVEREF(__pyx_t_4);
  4884. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  4885. __Pyx_GIVEREF(__pyx_t_5);
  4886. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
  4887. __Pyx_GIVEREF(__pyx_t_3);
  4888. PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
  4889. __pyx_t_4 = 0;
  4890. __pyx_t_5 = 0;
  4891. __pyx_t_3 = 0;
  4892. /* "View.MemoryView":252
  4893. * else:
  4894. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  4895. * allocate_buffer=False) # <<<<<<<<<<<<<<
  4896. * result.data = buf
  4897. *
  4898. */
  4899. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
  4900. __Pyx_GOTREF(__pyx_t_3);
  4901. if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
  4902. /* "View.MemoryView":251
  4903. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  4904. * else:
  4905. * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
  4906. * allocate_buffer=False)
  4907. * result.data = buf
  4908. */
  4909. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
  4910. __Pyx_GOTREF(__pyx_t_5);
  4911. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4912. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4913. __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
  4914. __pyx_t_5 = 0;
  4915. /* "View.MemoryView":253
  4916. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  4917. * allocate_buffer=False)
  4918. * result.data = buf # <<<<<<<<<<<<<<
  4919. *
  4920. * return result
  4921. */
  4922. __pyx_v_result->data = __pyx_v_buf;
  4923. }
  4924. __pyx_L3:;
  4925. /* "View.MemoryView":255
  4926. * result.data = buf
  4927. *
  4928. * return result # <<<<<<<<<<<<<<
  4929. *
  4930. *
  4931. */
  4932. __Pyx_XDECREF(((PyObject *)__pyx_r));
  4933. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  4934. __pyx_r = __pyx_v_result;
  4935. goto __pyx_L0;
  4936. /* "View.MemoryView":244
  4937. *
  4938. * @cname("__pyx_array_new")
  4939. * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
  4940. * char *mode, char *buf):
  4941. * cdef array result
  4942. */
  4943. /* function exit code */
  4944. __pyx_L1_error:;
  4945. __Pyx_XDECREF(__pyx_t_2);
  4946. __Pyx_XDECREF(__pyx_t_3);
  4947. __Pyx_XDECREF(__pyx_t_4);
  4948. __Pyx_XDECREF(__pyx_t_5);
  4949. __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4950. __pyx_r = 0;
  4951. __pyx_L0:;
  4952. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  4953. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  4954. __Pyx_RefNannyFinishContext();
  4955. return __pyx_r;
  4956. }
  4957. /* "View.MemoryView":281
  4958. * cdef class Enum(object):
  4959. * cdef object name
  4960. * def __init__(self, name): # <<<<<<<<<<<<<<
  4961. * self.name = name
  4962. * def __repr__(self):
  4963. */
  4964. /* Python wrapper */
  4965. static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4966. static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  4967. PyObject *__pyx_v_name = 0;
  4968. int __pyx_r;
  4969. __Pyx_RefNannyDeclarations
  4970. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  4971. {
  4972. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
  4973. PyObject* values[1] = {0};
  4974. if (unlikely(__pyx_kwds)) {
  4975. Py_ssize_t kw_args;
  4976. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  4977. switch (pos_args) {
  4978. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4979. CYTHON_FALLTHROUGH;
  4980. case 0: break;
  4981. default: goto __pyx_L5_argtuple_error;
  4982. }
  4983. kw_args = PyDict_Size(__pyx_kwds);
  4984. switch (pos_args) {
  4985. case 0:
  4986. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
  4987. else goto __pyx_L5_argtuple_error;
  4988. }
  4989. if (unlikely(kw_args > 0)) {
  4990. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
  4991. }
  4992. } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
  4993. goto __pyx_L5_argtuple_error;
  4994. } else {
  4995. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4996. }
  4997. __pyx_v_name = values[0];
  4998. }
  4999. goto __pyx_L4_argument_unpacking_done;
  5000. __pyx_L5_argtuple_error:;
  5001. __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
  5002. __pyx_L3_error:;
  5003. __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5004. __Pyx_RefNannyFinishContext();
  5005. return -1;
  5006. __pyx_L4_argument_unpacking_done:;
  5007. __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
  5008. /* function exit code */
  5009. __Pyx_RefNannyFinishContext();
  5010. return __pyx_r;
  5011. }
  5012. static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  5013. int __pyx_r;
  5014. __Pyx_RefNannyDeclarations
  5015. __Pyx_RefNannySetupContext("__init__", 0);
  5016. /* "View.MemoryView":282
  5017. * cdef object name
  5018. * def __init__(self, name):
  5019. * self.name = name # <<<<<<<<<<<<<<
  5020. * def __repr__(self):
  5021. * return self.name
  5022. */
  5023. __Pyx_INCREF(__pyx_v_name);
  5024. __Pyx_GIVEREF(__pyx_v_name);
  5025. __Pyx_GOTREF(__pyx_v_self->name);
  5026. __Pyx_DECREF(__pyx_v_self->name);
  5027. __pyx_v_self->name = __pyx_v_name;
  5028. /* "View.MemoryView":281
  5029. * cdef class Enum(object):
  5030. * cdef object name
  5031. * def __init__(self, name): # <<<<<<<<<<<<<<
  5032. * self.name = name
  5033. * def __repr__(self):
  5034. */
  5035. /* function exit code */
  5036. __pyx_r = 0;
  5037. __Pyx_RefNannyFinishContext();
  5038. return __pyx_r;
  5039. }
  5040. /* "View.MemoryView":283
  5041. * def __init__(self, name):
  5042. * self.name = name
  5043. * def __repr__(self): # <<<<<<<<<<<<<<
  5044. * return self.name
  5045. *
  5046. */
  5047. /* Python wrapper */
  5048. static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
  5049. static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  5050. PyObject *__pyx_r = 0;
  5051. __Pyx_RefNannyDeclarations
  5052. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  5053. __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
  5054. /* function exit code */
  5055. __Pyx_RefNannyFinishContext();
  5056. return __pyx_r;
  5057. }
  5058. static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  5059. PyObject *__pyx_r = NULL;
  5060. __Pyx_RefNannyDeclarations
  5061. __Pyx_RefNannySetupContext("__repr__", 0);
  5062. /* "View.MemoryView":284
  5063. * self.name = name
  5064. * def __repr__(self):
  5065. * return self.name # <<<<<<<<<<<<<<
  5066. *
  5067. * cdef generic = Enum("<strided and direct or indirect>")
  5068. */
  5069. __Pyx_XDECREF(__pyx_r);
  5070. __Pyx_INCREF(__pyx_v_self->name);
  5071. __pyx_r = __pyx_v_self->name;
  5072. goto __pyx_L0;
  5073. /* "View.MemoryView":283
  5074. * def __init__(self, name):
  5075. * self.name = name
  5076. * def __repr__(self): # <<<<<<<<<<<<<<
  5077. * return self.name
  5078. *
  5079. */
  5080. /* function exit code */
  5081. __pyx_L0:;
  5082. __Pyx_XGIVEREF(__pyx_r);
  5083. __Pyx_RefNannyFinishContext();
  5084. return __pyx_r;
  5085. }
  5086. /* "(tree fragment)":1
  5087. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  5088. * cdef tuple state
  5089. * cdef object _dict
  5090. */
  5091. /* Python wrapper */
  5092. static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  5093. static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  5094. PyObject *__pyx_r = 0;
  5095. __Pyx_RefNannyDeclarations
  5096. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  5097. __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
  5098. /* function exit code */
  5099. __Pyx_RefNannyFinishContext();
  5100. return __pyx_r;
  5101. }
  5102. static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  5103. PyObject *__pyx_v_state = 0;
  5104. PyObject *__pyx_v__dict = 0;
  5105. int __pyx_v_use_setstate;
  5106. PyObject *__pyx_r = NULL;
  5107. __Pyx_RefNannyDeclarations
  5108. PyObject *__pyx_t_1 = NULL;
  5109. int __pyx_t_2;
  5110. int __pyx_t_3;
  5111. PyObject *__pyx_t_4 = NULL;
  5112. PyObject *__pyx_t_5 = NULL;
  5113. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  5114. /* "(tree fragment)":5
  5115. * cdef object _dict
  5116. * cdef bint use_setstate
  5117. * state = (self.name,) # <<<<<<<<<<<<<<
  5118. * _dict = getattr(self, '__dict__', None)
  5119. * if _dict is not None:
  5120. */
  5121. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
  5122. __Pyx_GOTREF(__pyx_t_1);
  5123. __Pyx_INCREF(__pyx_v_self->name);
  5124. __Pyx_GIVEREF(__pyx_v_self->name);
  5125. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  5126. __pyx_v_state = ((PyObject*)__pyx_t_1);
  5127. __pyx_t_1 = 0;
  5128. /* "(tree fragment)":6
  5129. * cdef bint use_setstate
  5130. * state = (self.name,)
  5131. * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
  5132. * if _dict is not None:
  5133. * state += (_dict,)
  5134. */
  5135. __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
  5136. __Pyx_GOTREF(__pyx_t_1);
  5137. __pyx_v__dict = __pyx_t_1;
  5138. __pyx_t_1 = 0;
  5139. /* "(tree fragment)":7
  5140. * state = (self.name,)
  5141. * _dict = getattr(self, '__dict__', None)
  5142. * if _dict is not None: # <<<<<<<<<<<<<<
  5143. * state += (_dict,)
  5144. * use_setstate = True
  5145. */
  5146. __pyx_t_2 = (__pyx_v__dict != Py_None);
  5147. __pyx_t_3 = (__pyx_t_2 != 0);
  5148. if (__pyx_t_3) {
  5149. /* "(tree fragment)":8
  5150. * _dict = getattr(self, '__dict__', None)
  5151. * if _dict is not None:
  5152. * state += (_dict,) # <<<<<<<<<<<<<<
  5153. * use_setstate = True
  5154. * else:
  5155. */
  5156. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
  5157. __Pyx_GOTREF(__pyx_t_1);
  5158. __Pyx_INCREF(__pyx_v__dict);
  5159. __Pyx_GIVEREF(__pyx_v__dict);
  5160. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
  5161. __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
  5162. __Pyx_GOTREF(__pyx_t_4);
  5163. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5164. __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
  5165. __pyx_t_4 = 0;
  5166. /* "(tree fragment)":9
  5167. * if _dict is not None:
  5168. * state += (_dict,)
  5169. * use_setstate = True # <<<<<<<<<<<<<<
  5170. * else:
  5171. * use_setstate = self.name is not None
  5172. */
  5173. __pyx_v_use_setstate = 1;
  5174. /* "(tree fragment)":7
  5175. * state = (self.name,)
  5176. * _dict = getattr(self, '__dict__', None)
  5177. * if _dict is not None: # <<<<<<<<<<<<<<
  5178. * state += (_dict,)
  5179. * use_setstate = True
  5180. */
  5181. goto __pyx_L3;
  5182. }
  5183. /* "(tree fragment)":11
  5184. * use_setstate = True
  5185. * else:
  5186. * use_setstate = self.name is not None # <<<<<<<<<<<<<<
  5187. * if use_setstate:
  5188. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  5189. */
  5190. /*else*/ {
  5191. __pyx_t_3 = (__pyx_v_self->name != Py_None);
  5192. __pyx_v_use_setstate = __pyx_t_3;
  5193. }
  5194. __pyx_L3:;
  5195. /* "(tree fragment)":12
  5196. * else:
  5197. * use_setstate = self.name is not None
  5198. * if use_setstate: # <<<<<<<<<<<<<<
  5199. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  5200. * else:
  5201. */
  5202. __pyx_t_3 = (__pyx_v_use_setstate != 0);
  5203. if (__pyx_t_3) {
  5204. /* "(tree fragment)":13
  5205. * use_setstate = self.name is not None
  5206. * if use_setstate:
  5207. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
  5208. * else:
  5209. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5210. */
  5211. __Pyx_XDECREF(__pyx_r);
  5212. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
  5213. __Pyx_GOTREF(__pyx_t_4);
  5214. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
  5215. __Pyx_GOTREF(__pyx_t_1);
  5216. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5217. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5218. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5219. __Pyx_INCREF(__pyx_int_184977713);
  5220. __Pyx_GIVEREF(__pyx_int_184977713);
  5221. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
  5222. __Pyx_INCREF(Py_None);
  5223. __Pyx_GIVEREF(Py_None);
  5224. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  5225. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
  5226. __Pyx_GOTREF(__pyx_t_5);
  5227. __Pyx_GIVEREF(__pyx_t_4);
  5228. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  5229. __Pyx_GIVEREF(__pyx_t_1);
  5230. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  5231. __Pyx_INCREF(__pyx_v_state);
  5232. __Pyx_GIVEREF(__pyx_v_state);
  5233. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
  5234. __pyx_t_4 = 0;
  5235. __pyx_t_1 = 0;
  5236. __pyx_r = __pyx_t_5;
  5237. __pyx_t_5 = 0;
  5238. goto __pyx_L0;
  5239. /* "(tree fragment)":12
  5240. * else:
  5241. * use_setstate = self.name is not None
  5242. * if use_setstate: # <<<<<<<<<<<<<<
  5243. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  5244. * else:
  5245. */
  5246. }
  5247. /* "(tree fragment)":15
  5248. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  5249. * else:
  5250. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
  5251. * def __setstate_cython__(self, __pyx_state):
  5252. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  5253. */
  5254. /*else*/ {
  5255. __Pyx_XDECREF(__pyx_r);
  5256. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
  5257. __Pyx_GOTREF(__pyx_t_5);
  5258. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
  5259. __Pyx_GOTREF(__pyx_t_1);
  5260. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5261. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5262. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  5263. __Pyx_INCREF(__pyx_int_184977713);
  5264. __Pyx_GIVEREF(__pyx_int_184977713);
  5265. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
  5266. __Pyx_INCREF(__pyx_v_state);
  5267. __Pyx_GIVEREF(__pyx_v_state);
  5268. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
  5269. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
  5270. __Pyx_GOTREF(__pyx_t_4);
  5271. __Pyx_GIVEREF(__pyx_t_5);
  5272. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  5273. __Pyx_GIVEREF(__pyx_t_1);
  5274. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  5275. __pyx_t_5 = 0;
  5276. __pyx_t_1 = 0;
  5277. __pyx_r = __pyx_t_4;
  5278. __pyx_t_4 = 0;
  5279. goto __pyx_L0;
  5280. }
  5281. /* "(tree fragment)":1
  5282. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  5283. * cdef tuple state
  5284. * cdef object _dict
  5285. */
  5286. /* function exit code */
  5287. __pyx_L1_error:;
  5288. __Pyx_XDECREF(__pyx_t_1);
  5289. __Pyx_XDECREF(__pyx_t_4);
  5290. __Pyx_XDECREF(__pyx_t_5);
  5291. __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5292. __pyx_r = NULL;
  5293. __pyx_L0:;
  5294. __Pyx_XDECREF(__pyx_v_state);
  5295. __Pyx_XDECREF(__pyx_v__dict);
  5296. __Pyx_XGIVEREF(__pyx_r);
  5297. __Pyx_RefNannyFinishContext();
  5298. return __pyx_r;
  5299. }
  5300. /* "(tree fragment)":16
  5301. * else:
  5302. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5303. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  5304. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  5305. */
  5306. /* Python wrapper */
  5307. static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  5308. static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  5309. PyObject *__pyx_r = 0;
  5310. __Pyx_RefNannyDeclarations
  5311. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  5312. __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  5313. /* function exit code */
  5314. __Pyx_RefNannyFinishContext();
  5315. return __pyx_r;
  5316. }
  5317. static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  5318. PyObject *__pyx_r = NULL;
  5319. __Pyx_RefNannyDeclarations
  5320. PyObject *__pyx_t_1 = NULL;
  5321. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  5322. /* "(tree fragment)":17
  5323. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5324. * def __setstate_cython__(self, __pyx_state):
  5325. * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
  5326. */
  5327. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
  5328. __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
  5329. __Pyx_GOTREF(__pyx_t_1);
  5330. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5331. /* "(tree fragment)":16
  5332. * else:
  5333. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  5334. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  5335. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  5336. */
  5337. /* function exit code */
  5338. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5339. goto __pyx_L0;
  5340. __pyx_L1_error:;
  5341. __Pyx_XDECREF(__pyx_t_1);
  5342. __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5343. __pyx_r = NULL;
  5344. __pyx_L0:;
  5345. __Pyx_XGIVEREF(__pyx_r);
  5346. __Pyx_RefNannyFinishContext();
  5347. return __pyx_r;
  5348. }
  5349. /* "View.MemoryView":298
  5350. *
  5351. * @cname('__pyx_align_pointer')
  5352. * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
  5353. * "Align pointer memory on a given boundary"
  5354. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
  5355. */
  5356. static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  5357. Py_intptr_t __pyx_v_aligned_p;
  5358. size_t __pyx_v_offset;
  5359. void *__pyx_r;
  5360. int __pyx_t_1;
  5361. /* "View.MemoryView":300
  5362. * cdef void *align_pointer(void *memory, size_t alignment) nogil:
  5363. * "Align pointer memory on a given boundary"
  5364. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
  5365. * cdef size_t offset
  5366. *
  5367. */
  5368. __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
  5369. /* "View.MemoryView":304
  5370. *
  5371. * with cython.cdivision(True):
  5372. * offset = aligned_p % alignment # <<<<<<<<<<<<<<
  5373. *
  5374. * if offset > 0:
  5375. */
  5376. __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
  5377. /* "View.MemoryView":306
  5378. * offset = aligned_p % alignment
  5379. *
  5380. * if offset > 0: # <<<<<<<<<<<<<<
  5381. * aligned_p += alignment - offset
  5382. *
  5383. */
  5384. __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  5385. if (__pyx_t_1) {
  5386. /* "View.MemoryView":307
  5387. *
  5388. * if offset > 0:
  5389. * aligned_p += alignment - offset # <<<<<<<<<<<<<<
  5390. *
  5391. * return <void *> aligned_p
  5392. */
  5393. __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
  5394. /* "View.MemoryView":306
  5395. * offset = aligned_p % alignment
  5396. *
  5397. * if offset > 0: # <<<<<<<<<<<<<<
  5398. * aligned_p += alignment - offset
  5399. *
  5400. */
  5401. }
  5402. /* "View.MemoryView":309
  5403. * aligned_p += alignment - offset
  5404. *
  5405. * return <void *> aligned_p # <<<<<<<<<<<<<<
  5406. *
  5407. *
  5408. */
  5409. __pyx_r = ((void *)__pyx_v_aligned_p);
  5410. goto __pyx_L0;
  5411. /* "View.MemoryView":298
  5412. *
  5413. * @cname('__pyx_align_pointer')
  5414. * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
  5415. * "Align pointer memory on a given boundary"
  5416. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
  5417. */
  5418. /* function exit code */
  5419. __pyx_L0:;
  5420. return __pyx_r;
  5421. }
  5422. /* "View.MemoryView":345
  5423. * cdef __Pyx_TypeInfo *typeinfo
  5424. *
  5425. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
  5426. * self.obj = obj
  5427. * self.flags = flags
  5428. */
  5429. /* Python wrapper */
  5430. static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5431. static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5432. PyObject *__pyx_v_obj = 0;
  5433. int __pyx_v_flags;
  5434. int __pyx_v_dtype_is_object;
  5435. int __pyx_r;
  5436. __Pyx_RefNannyDeclarations
  5437. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  5438. {
  5439. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
  5440. PyObject* values[3] = {0,0,0};
  5441. if (unlikely(__pyx_kwds)) {
  5442. Py_ssize_t kw_args;
  5443. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  5444. switch (pos_args) {
  5445. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5446. CYTHON_FALLTHROUGH;
  5447. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5448. CYTHON_FALLTHROUGH;
  5449. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5450. CYTHON_FALLTHROUGH;
  5451. case 0: break;
  5452. default: goto __pyx_L5_argtuple_error;
  5453. }
  5454. kw_args = PyDict_Size(__pyx_kwds);
  5455. switch (pos_args) {
  5456. case 0:
  5457. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
  5458. else goto __pyx_L5_argtuple_error;
  5459. CYTHON_FALLTHROUGH;
  5460. case 1:
  5461. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
  5462. else {
  5463. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
  5464. }
  5465. CYTHON_FALLTHROUGH;
  5466. case 2:
  5467. if (kw_args > 0) {
  5468. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
  5469. if (value) { values[2] = value; kw_args--; }
  5470. }
  5471. }
  5472. if (unlikely(kw_args > 0)) {
  5473. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
  5474. }
  5475. } else {
  5476. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5477. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5478. CYTHON_FALLTHROUGH;
  5479. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5480. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5481. break;
  5482. default: goto __pyx_L5_argtuple_error;
  5483. }
  5484. }
  5485. __pyx_v_obj = values[0];
  5486. __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
  5487. if (values[2]) {
  5488. __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
  5489. } else {
  5490. __pyx_v_dtype_is_object = ((int)0);
  5491. }
  5492. }
  5493. goto __pyx_L4_argument_unpacking_done;
  5494. __pyx_L5_argtuple_error:;
  5495. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
  5496. __pyx_L3_error:;
  5497. __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5498. __Pyx_RefNannyFinishContext();
  5499. return -1;
  5500. __pyx_L4_argument_unpacking_done:;
  5501. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
  5502. /* function exit code */
  5503. __Pyx_RefNannyFinishContext();
  5504. return __pyx_r;
  5505. }
  5506. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
  5507. int __pyx_r;
  5508. __Pyx_RefNannyDeclarations
  5509. int __pyx_t_1;
  5510. int __pyx_t_2;
  5511. int __pyx_t_3;
  5512. int __pyx_t_4;
  5513. __Pyx_RefNannySetupContext("__cinit__", 0);
  5514. /* "View.MemoryView":346
  5515. *
  5516. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
  5517. * self.obj = obj # <<<<<<<<<<<<<<
  5518. * self.flags = flags
  5519. * if type(self) is memoryview or obj is not None:
  5520. */
  5521. __Pyx_INCREF(__pyx_v_obj);
  5522. __Pyx_GIVEREF(__pyx_v_obj);
  5523. __Pyx_GOTREF(__pyx_v_self->obj);
  5524. __Pyx_DECREF(__pyx_v_self->obj);
  5525. __pyx_v_self->obj = __pyx_v_obj;
  5526. /* "View.MemoryView":347
  5527. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
  5528. * self.obj = obj
  5529. * self.flags = flags # <<<<<<<<<<<<<<
  5530. * if type(self) is memoryview or obj is not None:
  5531. * __Pyx_GetBuffer(obj, &self.view, flags)
  5532. */
  5533. __pyx_v_self->flags = __pyx_v_flags;
  5534. /* "View.MemoryView":348
  5535. * self.obj = obj
  5536. * self.flags = flags
  5537. * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
  5538. * __Pyx_GetBuffer(obj, &self.view, flags)
  5539. * if <PyObject *> self.view.obj == NULL:
  5540. */
  5541. __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  5542. __pyx_t_3 = (__pyx_t_2 != 0);
  5543. if (!__pyx_t_3) {
  5544. } else {
  5545. __pyx_t_1 = __pyx_t_3;
  5546. goto __pyx_L4_bool_binop_done;
  5547. }
  5548. __pyx_t_3 = (__pyx_v_obj != Py_None);
  5549. __pyx_t_2 = (__pyx_t_3 != 0);
  5550. __pyx_t_1 = __pyx_t_2;
  5551. __pyx_L4_bool_binop_done:;
  5552. if (__pyx_t_1) {
  5553. /* "View.MemoryView":349
  5554. * self.flags = flags
  5555. * if type(self) is memoryview or obj is not None:
  5556. * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
  5557. * if <PyObject *> self.view.obj == NULL:
  5558. * (<__pyx_buffer *> &self.view).obj = Py_None
  5559. */
  5560. __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
  5561. /* "View.MemoryView":350
  5562. * if type(self) is memoryview or obj is not None:
  5563. * __Pyx_GetBuffer(obj, &self.view, flags)
  5564. * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
  5565. * (<__pyx_buffer *> &self.view).obj = Py_None
  5566. * Py_INCREF(Py_None)
  5567. */
  5568. __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
  5569. if (__pyx_t_1) {
  5570. /* "View.MemoryView":351
  5571. * __Pyx_GetBuffer(obj, &self.view, flags)
  5572. * if <PyObject *> self.view.obj == NULL:
  5573. * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
  5574. * Py_INCREF(Py_None)
  5575. *
  5576. */
  5577. ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
  5578. /* "View.MemoryView":352
  5579. * if <PyObject *> self.view.obj == NULL:
  5580. * (<__pyx_buffer *> &self.view).obj = Py_None
  5581. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  5582. *
  5583. * global __pyx_memoryview_thread_locks_used
  5584. */
  5585. Py_INCREF(Py_None);
  5586. /* "View.MemoryView":350
  5587. * if type(self) is memoryview or obj is not None:
  5588. * __Pyx_GetBuffer(obj, &self.view, flags)
  5589. * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
  5590. * (<__pyx_buffer *> &self.view).obj = Py_None
  5591. * Py_INCREF(Py_None)
  5592. */
  5593. }
  5594. /* "View.MemoryView":348
  5595. * self.obj = obj
  5596. * self.flags = flags
  5597. * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
  5598. * __Pyx_GetBuffer(obj, &self.view, flags)
  5599. * if <PyObject *> self.view.obj == NULL:
  5600. */
  5601. }
  5602. /* "View.MemoryView":355
  5603. *
  5604. * global __pyx_memoryview_thread_locks_used
  5605. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
  5606. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5607. * __pyx_memoryview_thread_locks_used += 1
  5608. */
  5609. __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  5610. if (__pyx_t_1) {
  5611. /* "View.MemoryView":356
  5612. * global __pyx_memoryview_thread_locks_used
  5613. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
  5614. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
  5615. * __pyx_memoryview_thread_locks_used += 1
  5616. * if self.lock is NULL:
  5617. */
  5618. __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
  5619. /* "View.MemoryView":357
  5620. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
  5621. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5622. * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
  5623. * if self.lock is NULL:
  5624. * self.lock = PyThread_allocate_lock()
  5625. */
  5626. __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
  5627. /* "View.MemoryView":355
  5628. *
  5629. * global __pyx_memoryview_thread_locks_used
  5630. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
  5631. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5632. * __pyx_memoryview_thread_locks_used += 1
  5633. */
  5634. }
  5635. /* "View.MemoryView":358
  5636. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5637. * __pyx_memoryview_thread_locks_used += 1
  5638. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5639. * self.lock = PyThread_allocate_lock()
  5640. * if self.lock is NULL:
  5641. */
  5642. __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  5643. if (__pyx_t_1) {
  5644. /* "View.MemoryView":359
  5645. * __pyx_memoryview_thread_locks_used += 1
  5646. * if self.lock is NULL:
  5647. * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
  5648. * if self.lock is NULL:
  5649. * raise MemoryError
  5650. */
  5651. __pyx_v_self->lock = PyThread_allocate_lock();
  5652. /* "View.MemoryView":360
  5653. * if self.lock is NULL:
  5654. * self.lock = PyThread_allocate_lock()
  5655. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5656. * raise MemoryError
  5657. *
  5658. */
  5659. __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  5660. if (unlikely(__pyx_t_1)) {
  5661. /* "View.MemoryView":361
  5662. * self.lock = PyThread_allocate_lock()
  5663. * if self.lock is NULL:
  5664. * raise MemoryError # <<<<<<<<<<<<<<
  5665. *
  5666. * if flags & PyBUF_FORMAT:
  5667. */
  5668. PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
  5669. /* "View.MemoryView":360
  5670. * if self.lock is NULL:
  5671. * self.lock = PyThread_allocate_lock()
  5672. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5673. * raise MemoryError
  5674. *
  5675. */
  5676. }
  5677. /* "View.MemoryView":358
  5678. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  5679. * __pyx_memoryview_thread_locks_used += 1
  5680. * if self.lock is NULL: # <<<<<<<<<<<<<<
  5681. * self.lock = PyThread_allocate_lock()
  5682. * if self.lock is NULL:
  5683. */
  5684. }
  5685. /* "View.MemoryView":363
  5686. * raise MemoryError
  5687. *
  5688. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  5689. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  5690. * else:
  5691. */
  5692. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  5693. if (__pyx_t_1) {
  5694. /* "View.MemoryView":364
  5695. *
  5696. * if flags & PyBUF_FORMAT:
  5697. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
  5698. * else:
  5699. * self.dtype_is_object = dtype_is_object
  5700. */
  5701. __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
  5702. if (__pyx_t_2) {
  5703. } else {
  5704. __pyx_t_1 = __pyx_t_2;
  5705. goto __pyx_L11_bool_binop_done;
  5706. }
  5707. __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
  5708. __pyx_t_1 = __pyx_t_2;
  5709. __pyx_L11_bool_binop_done:;
  5710. __pyx_v_self->dtype_is_object = __pyx_t_1;
  5711. /* "View.MemoryView":363
  5712. * raise MemoryError
  5713. *
  5714. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  5715. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  5716. * else:
  5717. */
  5718. goto __pyx_L10;
  5719. }
  5720. /* "View.MemoryView":366
  5721. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  5722. * else:
  5723. * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
  5724. *
  5725. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
  5726. */
  5727. /*else*/ {
  5728. __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  5729. }
  5730. __pyx_L10:;
  5731. /* "View.MemoryView":368
  5732. * self.dtype_is_object = dtype_is_object
  5733. *
  5734. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
  5735. * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
  5736. * self.typeinfo = NULL
  5737. */
  5738. __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
  5739. /* "View.MemoryView":370
  5740. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
  5741. * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
  5742. * self.typeinfo = NULL # <<<<<<<<<<<<<<
  5743. *
  5744. * def __dealloc__(memoryview self):
  5745. */
  5746. __pyx_v_self->typeinfo = NULL;
  5747. /* "View.MemoryView":345
  5748. * cdef __Pyx_TypeInfo *typeinfo
  5749. *
  5750. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
  5751. * self.obj = obj
  5752. * self.flags = flags
  5753. */
  5754. /* function exit code */
  5755. __pyx_r = 0;
  5756. goto __pyx_L0;
  5757. __pyx_L1_error:;
  5758. __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5759. __pyx_r = -1;
  5760. __pyx_L0:;
  5761. __Pyx_RefNannyFinishContext();
  5762. return __pyx_r;
  5763. }
  5764. /* "View.MemoryView":372
  5765. * self.typeinfo = NULL
  5766. *
  5767. * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
  5768. * if self.obj is not None:
  5769. * __Pyx_ReleaseBuffer(&self.view)
  5770. */
  5771. /* Python wrapper */
  5772. static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
  5773. static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  5774. __Pyx_RefNannyDeclarations
  5775. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  5776. __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  5777. /* function exit code */
  5778. __Pyx_RefNannyFinishContext();
  5779. }
  5780. static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  5781. int __pyx_v_i;
  5782. __Pyx_RefNannyDeclarations
  5783. int __pyx_t_1;
  5784. int __pyx_t_2;
  5785. int __pyx_t_3;
  5786. int __pyx_t_4;
  5787. int __pyx_t_5;
  5788. PyThread_type_lock __pyx_t_6;
  5789. PyThread_type_lock __pyx_t_7;
  5790. __Pyx_RefNannySetupContext("__dealloc__", 0);
  5791. /* "View.MemoryView":373
  5792. *
  5793. * def __dealloc__(memoryview self):
  5794. * if self.obj is not None: # <<<<<<<<<<<<<<
  5795. * __Pyx_ReleaseBuffer(&self.view)
  5796. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5797. */
  5798. __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  5799. __pyx_t_2 = (__pyx_t_1 != 0);
  5800. if (__pyx_t_2) {
  5801. /* "View.MemoryView":374
  5802. * def __dealloc__(memoryview self):
  5803. * if self.obj is not None:
  5804. * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
  5805. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5806. *
  5807. */
  5808. __Pyx_ReleaseBuffer((&__pyx_v_self->view));
  5809. /* "View.MemoryView":373
  5810. *
  5811. * def __dealloc__(memoryview self):
  5812. * if self.obj is not None: # <<<<<<<<<<<<<<
  5813. * __Pyx_ReleaseBuffer(&self.view)
  5814. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5815. */
  5816. goto __pyx_L3;
  5817. }
  5818. /* "View.MemoryView":375
  5819. * if self.obj is not None:
  5820. * __Pyx_ReleaseBuffer(&self.view)
  5821. * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
  5822. *
  5823. * (<__pyx_buffer *> &self.view).obj = NULL
  5824. */
  5825. __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
  5826. if (__pyx_t_2) {
  5827. /* "View.MemoryView":377
  5828. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  5829. *
  5830. * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
  5831. * Py_DECREF(Py_None)
  5832. *
  5833. */
  5834. ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
  5835. /* "View.MemoryView":378
  5836. *
  5837. * (<__pyx_buffer *> &self.view).obj = NULL
  5838. * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
  5839. *
  5840. * cdef int i
  5841. */
  5842. Py_DECREF(Py_None);
  5843. /* "View.MemoryView":375
  5844. * if self.obj is not None:
  5845. * __Pyx_ReleaseBuffer(&self.view)
  5846. * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
  5847. *
  5848. * (<__pyx_buffer *> &self.view).obj = NULL
  5849. */
  5850. }
  5851. __pyx_L3:;
  5852. /* "View.MemoryView":382
  5853. * cdef int i
  5854. * global __pyx_memoryview_thread_locks_used
  5855. * if self.lock != NULL: # <<<<<<<<<<<<<<
  5856. * for i in range(__pyx_memoryview_thread_locks_used):
  5857. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5858. */
  5859. __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  5860. if (__pyx_t_2) {
  5861. /* "View.MemoryView":383
  5862. * global __pyx_memoryview_thread_locks_used
  5863. * if self.lock != NULL:
  5864. * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
  5865. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5866. * __pyx_memoryview_thread_locks_used -= 1
  5867. */
  5868. __pyx_t_3 = __pyx_memoryview_thread_locks_used;
  5869. __pyx_t_4 = __pyx_t_3;
  5870. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  5871. __pyx_v_i = __pyx_t_5;
  5872. /* "View.MemoryView":384
  5873. * if self.lock != NULL:
  5874. * for i in range(__pyx_memoryview_thread_locks_used):
  5875. * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
  5876. * __pyx_memoryview_thread_locks_used -= 1
  5877. * if i != __pyx_memoryview_thread_locks_used:
  5878. */
  5879. __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
  5880. if (__pyx_t_2) {
  5881. /* "View.MemoryView":385
  5882. * for i in range(__pyx_memoryview_thread_locks_used):
  5883. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5884. * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
  5885. * if i != __pyx_memoryview_thread_locks_used:
  5886. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5887. */
  5888. __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
  5889. /* "View.MemoryView":386
  5890. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5891. * __pyx_memoryview_thread_locks_used -= 1
  5892. * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
  5893. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5894. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5895. */
  5896. __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
  5897. if (__pyx_t_2) {
  5898. /* "View.MemoryView":388
  5899. * if i != __pyx_memoryview_thread_locks_used:
  5900. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5901. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
  5902. * break
  5903. * else:
  5904. */
  5905. __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
  5906. __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
  5907. /* "View.MemoryView":387
  5908. * __pyx_memoryview_thread_locks_used -= 1
  5909. * if i != __pyx_memoryview_thread_locks_used:
  5910. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
  5911. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5912. * break
  5913. */
  5914. (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
  5915. (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
  5916. /* "View.MemoryView":386
  5917. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5918. * __pyx_memoryview_thread_locks_used -= 1
  5919. * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
  5920. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5921. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5922. */
  5923. }
  5924. /* "View.MemoryView":389
  5925. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  5926. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  5927. * break # <<<<<<<<<<<<<<
  5928. * else:
  5929. * PyThread_free_lock(self.lock)
  5930. */
  5931. goto __pyx_L6_break;
  5932. /* "View.MemoryView":384
  5933. * if self.lock != NULL:
  5934. * for i in range(__pyx_memoryview_thread_locks_used):
  5935. * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
  5936. * __pyx_memoryview_thread_locks_used -= 1
  5937. * if i != __pyx_memoryview_thread_locks_used:
  5938. */
  5939. }
  5940. }
  5941. /*else*/ {
  5942. /* "View.MemoryView":391
  5943. * break
  5944. * else:
  5945. * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
  5946. *
  5947. * cdef char *get_item_pointer(memoryview self, object index) except NULL:
  5948. */
  5949. PyThread_free_lock(__pyx_v_self->lock);
  5950. }
  5951. __pyx_L6_break:;
  5952. /* "View.MemoryView":382
  5953. * cdef int i
  5954. * global __pyx_memoryview_thread_locks_used
  5955. * if self.lock != NULL: # <<<<<<<<<<<<<<
  5956. * for i in range(__pyx_memoryview_thread_locks_used):
  5957. * if __pyx_memoryview_thread_locks[i] is self.lock:
  5958. */
  5959. }
  5960. /* "View.MemoryView":372
  5961. * self.typeinfo = NULL
  5962. *
  5963. * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
  5964. * if self.obj is not None:
  5965. * __Pyx_ReleaseBuffer(&self.view)
  5966. */
  5967. /* function exit code */
  5968. __Pyx_RefNannyFinishContext();
  5969. }
  5970. /* "View.MemoryView":393
  5971. * PyThread_free_lock(self.lock)
  5972. *
  5973. * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
  5974. * cdef Py_ssize_t dim
  5975. * cdef char *itemp = <char *> self.view.buf
  5976. */
  5977. static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  5978. Py_ssize_t __pyx_v_dim;
  5979. char *__pyx_v_itemp;
  5980. PyObject *__pyx_v_idx = NULL;
  5981. char *__pyx_r;
  5982. __Pyx_RefNannyDeclarations
  5983. Py_ssize_t __pyx_t_1;
  5984. PyObject *__pyx_t_2 = NULL;
  5985. Py_ssize_t __pyx_t_3;
  5986. PyObject *(*__pyx_t_4)(PyObject *);
  5987. PyObject *__pyx_t_5 = NULL;
  5988. Py_ssize_t __pyx_t_6;
  5989. char *__pyx_t_7;
  5990. __Pyx_RefNannySetupContext("get_item_pointer", 0);
  5991. /* "View.MemoryView":395
  5992. * cdef char *get_item_pointer(memoryview self, object index) except NULL:
  5993. * cdef Py_ssize_t dim
  5994. * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
  5995. *
  5996. * for dim, idx in enumerate(index):
  5997. */
  5998. __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
  5999. /* "View.MemoryView":397
  6000. * cdef char *itemp = <char *> self.view.buf
  6001. *
  6002. * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
  6003. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  6004. *
  6005. */
  6006. __pyx_t_1 = 0;
  6007. if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
  6008. __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  6009. __pyx_t_4 = NULL;
  6010. } else {
  6011. __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
  6012. __Pyx_GOTREF(__pyx_t_2);
  6013. __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
  6014. }
  6015. for (;;) {
  6016. if (likely(!__pyx_t_4)) {
  6017. if (likely(PyList_CheckExact(__pyx_t_2))) {
  6018. if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
  6019. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6020. __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
  6021. #else
  6022. __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
  6023. __Pyx_GOTREF(__pyx_t_5);
  6024. #endif
  6025. } else {
  6026. if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
  6027. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6028. __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
  6029. #else
  6030. __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
  6031. __Pyx_GOTREF(__pyx_t_5);
  6032. #endif
  6033. }
  6034. } else {
  6035. __pyx_t_5 = __pyx_t_4(__pyx_t_2);
  6036. if (unlikely(!__pyx_t_5)) {
  6037. PyObject* exc_type = PyErr_Occurred();
  6038. if (exc_type) {
  6039. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  6040. else __PYX_ERR(1, 397, __pyx_L1_error)
  6041. }
  6042. break;
  6043. }
  6044. __Pyx_GOTREF(__pyx_t_5);
  6045. }
  6046. __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
  6047. __pyx_t_5 = 0;
  6048. __pyx_v_dim = __pyx_t_1;
  6049. __pyx_t_1 = (__pyx_t_1 + 1);
  6050. /* "View.MemoryView":398
  6051. *
  6052. * for dim, idx in enumerate(index):
  6053. * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
  6054. *
  6055. * return itemp
  6056. */
  6057. __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
  6058. __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
  6059. __pyx_v_itemp = __pyx_t_7;
  6060. /* "View.MemoryView":397
  6061. * cdef char *itemp = <char *> self.view.buf
  6062. *
  6063. * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
  6064. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  6065. *
  6066. */
  6067. }
  6068. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6069. /* "View.MemoryView":400
  6070. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  6071. *
  6072. * return itemp # <<<<<<<<<<<<<<
  6073. *
  6074. *
  6075. */
  6076. __pyx_r = __pyx_v_itemp;
  6077. goto __pyx_L0;
  6078. /* "View.MemoryView":393
  6079. * PyThread_free_lock(self.lock)
  6080. *
  6081. * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
  6082. * cdef Py_ssize_t dim
  6083. * cdef char *itemp = <char *> self.view.buf
  6084. */
  6085. /* function exit code */
  6086. __pyx_L1_error:;
  6087. __Pyx_XDECREF(__pyx_t_2);
  6088. __Pyx_XDECREF(__pyx_t_5);
  6089. __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6090. __pyx_r = NULL;
  6091. __pyx_L0:;
  6092. __Pyx_XDECREF(__pyx_v_idx);
  6093. __Pyx_RefNannyFinishContext();
  6094. return __pyx_r;
  6095. }
  6096. /* "View.MemoryView":403
  6097. *
  6098. *
  6099. * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
  6100. * if index is Ellipsis:
  6101. * return self
  6102. */
  6103. /* Python wrapper */
  6104. static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
  6105. static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  6106. PyObject *__pyx_r = 0;
  6107. __Pyx_RefNannyDeclarations
  6108. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  6109. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
  6110. /* function exit code */
  6111. __Pyx_RefNannyFinishContext();
  6112. return __pyx_r;
  6113. }
  6114. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  6115. PyObject *__pyx_v_have_slices = NULL;
  6116. PyObject *__pyx_v_indices = NULL;
  6117. char *__pyx_v_itemp;
  6118. PyObject *__pyx_r = NULL;
  6119. __Pyx_RefNannyDeclarations
  6120. int __pyx_t_1;
  6121. int __pyx_t_2;
  6122. PyObject *__pyx_t_3 = NULL;
  6123. PyObject *__pyx_t_4 = NULL;
  6124. PyObject *__pyx_t_5 = NULL;
  6125. char *__pyx_t_6;
  6126. __Pyx_RefNannySetupContext("__getitem__", 0);
  6127. /* "View.MemoryView":404
  6128. *
  6129. * def __getitem__(memoryview self, object index):
  6130. * if index is Ellipsis: # <<<<<<<<<<<<<<
  6131. * return self
  6132. *
  6133. */
  6134. __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  6135. __pyx_t_2 = (__pyx_t_1 != 0);
  6136. if (__pyx_t_2) {
  6137. /* "View.MemoryView":405
  6138. * def __getitem__(memoryview self, object index):
  6139. * if index is Ellipsis:
  6140. * return self # <<<<<<<<<<<<<<
  6141. *
  6142. * have_slices, indices = _unellipsify(index, self.view.ndim)
  6143. */
  6144. __Pyx_XDECREF(__pyx_r);
  6145. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  6146. __pyx_r = ((PyObject *)__pyx_v_self);
  6147. goto __pyx_L0;
  6148. /* "View.MemoryView":404
  6149. *
  6150. * def __getitem__(memoryview self, object index):
  6151. * if index is Ellipsis: # <<<<<<<<<<<<<<
  6152. * return self
  6153. *
  6154. */
  6155. }
  6156. /* "View.MemoryView":407
  6157. * return self
  6158. *
  6159. * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
  6160. *
  6161. * cdef char *itemp
  6162. */
  6163. __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
  6164. __Pyx_GOTREF(__pyx_t_3);
  6165. if (likely(__pyx_t_3 != Py_None)) {
  6166. PyObject* sequence = __pyx_t_3;
  6167. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6168. if (unlikely(size != 2)) {
  6169. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6170. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6171. __PYX_ERR(1, 407, __pyx_L1_error)
  6172. }
  6173. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6174. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
  6175. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
  6176. __Pyx_INCREF(__pyx_t_4);
  6177. __Pyx_INCREF(__pyx_t_5);
  6178. #else
  6179. __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
  6180. __Pyx_GOTREF(__pyx_t_4);
  6181. __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
  6182. __Pyx_GOTREF(__pyx_t_5);
  6183. #endif
  6184. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6185. } else {
  6186. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
  6187. }
  6188. __pyx_v_have_slices = __pyx_t_4;
  6189. __pyx_t_4 = 0;
  6190. __pyx_v_indices = __pyx_t_5;
  6191. __pyx_t_5 = 0;
  6192. /* "View.MemoryView":410
  6193. *
  6194. * cdef char *itemp
  6195. * if have_slices: # <<<<<<<<<<<<<<
  6196. * return memview_slice(self, indices)
  6197. * else:
  6198. */
  6199. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
  6200. if (__pyx_t_2) {
  6201. /* "View.MemoryView":411
  6202. * cdef char *itemp
  6203. * if have_slices:
  6204. * return memview_slice(self, indices) # <<<<<<<<<<<<<<
  6205. * else:
  6206. * itemp = self.get_item_pointer(indices)
  6207. */
  6208. __Pyx_XDECREF(__pyx_r);
  6209. __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
  6210. __Pyx_GOTREF(__pyx_t_3);
  6211. __pyx_r = __pyx_t_3;
  6212. __pyx_t_3 = 0;
  6213. goto __pyx_L0;
  6214. /* "View.MemoryView":410
  6215. *
  6216. * cdef char *itemp
  6217. * if have_slices: # <<<<<<<<<<<<<<
  6218. * return memview_slice(self, indices)
  6219. * else:
  6220. */
  6221. }
  6222. /* "View.MemoryView":413
  6223. * return memview_slice(self, indices)
  6224. * else:
  6225. * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
  6226. * return self.convert_item_to_object(itemp)
  6227. *
  6228. */
  6229. /*else*/ {
  6230. __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
  6231. __pyx_v_itemp = __pyx_t_6;
  6232. /* "View.MemoryView":414
  6233. * else:
  6234. * itemp = self.get_item_pointer(indices)
  6235. * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
  6236. *
  6237. * def __setitem__(memoryview self, object index, object value):
  6238. */
  6239. __Pyx_XDECREF(__pyx_r);
  6240. __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
  6241. __Pyx_GOTREF(__pyx_t_3);
  6242. __pyx_r = __pyx_t_3;
  6243. __pyx_t_3 = 0;
  6244. goto __pyx_L0;
  6245. }
  6246. /* "View.MemoryView":403
  6247. *
  6248. *
  6249. * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
  6250. * if index is Ellipsis:
  6251. * return self
  6252. */
  6253. /* function exit code */
  6254. __pyx_L1_error:;
  6255. __Pyx_XDECREF(__pyx_t_3);
  6256. __Pyx_XDECREF(__pyx_t_4);
  6257. __Pyx_XDECREF(__pyx_t_5);
  6258. __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6259. __pyx_r = NULL;
  6260. __pyx_L0:;
  6261. __Pyx_XDECREF(__pyx_v_have_slices);
  6262. __Pyx_XDECREF(__pyx_v_indices);
  6263. __Pyx_XGIVEREF(__pyx_r);
  6264. __Pyx_RefNannyFinishContext();
  6265. return __pyx_r;
  6266. }
  6267. /* "View.MemoryView":416
  6268. * return self.convert_item_to_object(itemp)
  6269. *
  6270. * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
  6271. * if self.view.readonly:
  6272. * raise TypeError("Cannot assign to read-only memoryview")
  6273. */
  6274. /* Python wrapper */
  6275. static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
  6276. static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  6277. int __pyx_r;
  6278. __Pyx_RefNannyDeclarations
  6279. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  6280. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
  6281. /* function exit code */
  6282. __Pyx_RefNannyFinishContext();
  6283. return __pyx_r;
  6284. }
  6285. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  6286. PyObject *__pyx_v_have_slices = NULL;
  6287. PyObject *__pyx_v_obj = NULL;
  6288. int __pyx_r;
  6289. __Pyx_RefNannyDeclarations
  6290. int __pyx_t_1;
  6291. PyObject *__pyx_t_2 = NULL;
  6292. PyObject *__pyx_t_3 = NULL;
  6293. PyObject *__pyx_t_4 = NULL;
  6294. __Pyx_RefNannySetupContext("__setitem__", 0);
  6295. __Pyx_INCREF(__pyx_v_index);
  6296. /* "View.MemoryView":417
  6297. *
  6298. * def __setitem__(memoryview self, object index, object value):
  6299. * if self.view.readonly: # <<<<<<<<<<<<<<
  6300. * raise TypeError("Cannot assign to read-only memoryview")
  6301. *
  6302. */
  6303. __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
  6304. if (unlikely(__pyx_t_1)) {
  6305. /* "View.MemoryView":418
  6306. * def __setitem__(memoryview self, object index, object value):
  6307. * if self.view.readonly:
  6308. * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
  6309. *
  6310. * have_slices, index = _unellipsify(index, self.view.ndim)
  6311. */
  6312. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
  6313. __Pyx_GOTREF(__pyx_t_2);
  6314. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  6315. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6316. __PYX_ERR(1, 418, __pyx_L1_error)
  6317. /* "View.MemoryView":417
  6318. *
  6319. * def __setitem__(memoryview self, object index, object value):
  6320. * if self.view.readonly: # <<<<<<<<<<<<<<
  6321. * raise TypeError("Cannot assign to read-only memoryview")
  6322. *
  6323. */
  6324. }
  6325. /* "View.MemoryView":420
  6326. * raise TypeError("Cannot assign to read-only memoryview")
  6327. *
  6328. * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
  6329. *
  6330. * if have_slices:
  6331. */
  6332. __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
  6333. __Pyx_GOTREF(__pyx_t_2);
  6334. if (likely(__pyx_t_2 != Py_None)) {
  6335. PyObject* sequence = __pyx_t_2;
  6336. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6337. if (unlikely(size != 2)) {
  6338. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6339. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6340. __PYX_ERR(1, 420, __pyx_L1_error)
  6341. }
  6342. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6343. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6344. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  6345. __Pyx_INCREF(__pyx_t_3);
  6346. __Pyx_INCREF(__pyx_t_4);
  6347. #else
  6348. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
  6349. __Pyx_GOTREF(__pyx_t_3);
  6350. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
  6351. __Pyx_GOTREF(__pyx_t_4);
  6352. #endif
  6353. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6354. } else {
  6355. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
  6356. }
  6357. __pyx_v_have_slices = __pyx_t_3;
  6358. __pyx_t_3 = 0;
  6359. __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  6360. __pyx_t_4 = 0;
  6361. /* "View.MemoryView":422
  6362. * have_slices, index = _unellipsify(index, self.view.ndim)
  6363. *
  6364. * if have_slices: # <<<<<<<<<<<<<<
  6365. * obj = self.is_slice(value)
  6366. * if obj:
  6367. */
  6368. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
  6369. if (__pyx_t_1) {
  6370. /* "View.MemoryView":423
  6371. *
  6372. * if have_slices:
  6373. * obj = self.is_slice(value) # <<<<<<<<<<<<<<
  6374. * if obj:
  6375. * self.setitem_slice_assignment(self[index], obj)
  6376. */
  6377. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
  6378. __Pyx_GOTREF(__pyx_t_2);
  6379. __pyx_v_obj = __pyx_t_2;
  6380. __pyx_t_2 = 0;
  6381. /* "View.MemoryView":424
  6382. * if have_slices:
  6383. * obj = self.is_slice(value)
  6384. * if obj: # <<<<<<<<<<<<<<
  6385. * self.setitem_slice_assignment(self[index], obj)
  6386. * else:
  6387. */
  6388. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
  6389. if (__pyx_t_1) {
  6390. /* "View.MemoryView":425
  6391. * obj = self.is_slice(value)
  6392. * if obj:
  6393. * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
  6394. * else:
  6395. * self.setitem_slice_assign_scalar(self[index], value)
  6396. */
  6397. __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
  6398. __Pyx_GOTREF(__pyx_t_2);
  6399. __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
  6400. __Pyx_GOTREF(__pyx_t_4);
  6401. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6402. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6403. /* "View.MemoryView":424
  6404. * if have_slices:
  6405. * obj = self.is_slice(value)
  6406. * if obj: # <<<<<<<<<<<<<<
  6407. * self.setitem_slice_assignment(self[index], obj)
  6408. * else:
  6409. */
  6410. goto __pyx_L5;
  6411. }
  6412. /* "View.MemoryView":427
  6413. * self.setitem_slice_assignment(self[index], obj)
  6414. * else:
  6415. * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
  6416. * else:
  6417. * self.setitem_indexed(index, value)
  6418. */
  6419. /*else*/ {
  6420. __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
  6421. __Pyx_GOTREF(__pyx_t_4);
  6422. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
  6423. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
  6424. __Pyx_GOTREF(__pyx_t_2);
  6425. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6426. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6427. }
  6428. __pyx_L5:;
  6429. /* "View.MemoryView":422
  6430. * have_slices, index = _unellipsify(index, self.view.ndim)
  6431. *
  6432. * if have_slices: # <<<<<<<<<<<<<<
  6433. * obj = self.is_slice(value)
  6434. * if obj:
  6435. */
  6436. goto __pyx_L4;
  6437. }
  6438. /* "View.MemoryView":429
  6439. * self.setitem_slice_assign_scalar(self[index], value)
  6440. * else:
  6441. * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
  6442. *
  6443. * cdef is_slice(self, obj):
  6444. */
  6445. /*else*/ {
  6446. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
  6447. __Pyx_GOTREF(__pyx_t_2);
  6448. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6449. }
  6450. __pyx_L4:;
  6451. /* "View.MemoryView":416
  6452. * return self.convert_item_to_object(itemp)
  6453. *
  6454. * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
  6455. * if self.view.readonly:
  6456. * raise TypeError("Cannot assign to read-only memoryview")
  6457. */
  6458. /* function exit code */
  6459. __pyx_r = 0;
  6460. goto __pyx_L0;
  6461. __pyx_L1_error:;
  6462. __Pyx_XDECREF(__pyx_t_2);
  6463. __Pyx_XDECREF(__pyx_t_3);
  6464. __Pyx_XDECREF(__pyx_t_4);
  6465. __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6466. __pyx_r = -1;
  6467. __pyx_L0:;
  6468. __Pyx_XDECREF(__pyx_v_have_slices);
  6469. __Pyx_XDECREF(__pyx_v_obj);
  6470. __Pyx_XDECREF(__pyx_v_index);
  6471. __Pyx_RefNannyFinishContext();
  6472. return __pyx_r;
  6473. }
  6474. /* "View.MemoryView":431
  6475. * self.setitem_indexed(index, value)
  6476. *
  6477. * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
  6478. * if not isinstance(obj, memoryview):
  6479. * try:
  6480. */
  6481. static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  6482. PyObject *__pyx_r = NULL;
  6483. __Pyx_RefNannyDeclarations
  6484. int __pyx_t_1;
  6485. int __pyx_t_2;
  6486. PyObject *__pyx_t_3 = NULL;
  6487. PyObject *__pyx_t_4 = NULL;
  6488. PyObject *__pyx_t_5 = NULL;
  6489. PyObject *__pyx_t_6 = NULL;
  6490. PyObject *__pyx_t_7 = NULL;
  6491. PyObject *__pyx_t_8 = NULL;
  6492. int __pyx_t_9;
  6493. __Pyx_RefNannySetupContext("is_slice", 0);
  6494. __Pyx_INCREF(__pyx_v_obj);
  6495. /* "View.MemoryView":432
  6496. *
  6497. * cdef is_slice(self, obj):
  6498. * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
  6499. * try:
  6500. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6501. */
  6502. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
  6503. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  6504. if (__pyx_t_2) {
  6505. /* "View.MemoryView":433
  6506. * cdef is_slice(self, obj):
  6507. * if not isinstance(obj, memoryview):
  6508. * try: # <<<<<<<<<<<<<<
  6509. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6510. * self.dtype_is_object)
  6511. */
  6512. {
  6513. __Pyx_PyThreadState_declare
  6514. __Pyx_PyThreadState_assign
  6515. __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
  6516. __Pyx_XGOTREF(__pyx_t_3);
  6517. __Pyx_XGOTREF(__pyx_t_4);
  6518. __Pyx_XGOTREF(__pyx_t_5);
  6519. /*try:*/ {
  6520. /* "View.MemoryView":434
  6521. * if not isinstance(obj, memoryview):
  6522. * try:
  6523. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
  6524. * self.dtype_is_object)
  6525. * except TypeError:
  6526. */
  6527. __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
  6528. __Pyx_GOTREF(__pyx_t_6);
  6529. /* "View.MemoryView":435
  6530. * try:
  6531. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6532. * self.dtype_is_object) # <<<<<<<<<<<<<<
  6533. * except TypeError:
  6534. * return None
  6535. */
  6536. __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
  6537. __Pyx_GOTREF(__pyx_t_7);
  6538. /* "View.MemoryView":434
  6539. * if not isinstance(obj, memoryview):
  6540. * try:
  6541. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
  6542. * self.dtype_is_object)
  6543. * except TypeError:
  6544. */
  6545. __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
  6546. __Pyx_GOTREF(__pyx_t_8);
  6547. __Pyx_INCREF(__pyx_v_obj);
  6548. __Pyx_GIVEREF(__pyx_v_obj);
  6549. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
  6550. __Pyx_GIVEREF(__pyx_t_6);
  6551. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
  6552. __Pyx_GIVEREF(__pyx_t_7);
  6553. PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
  6554. __pyx_t_6 = 0;
  6555. __pyx_t_7 = 0;
  6556. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
  6557. __Pyx_GOTREF(__pyx_t_7);
  6558. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6559. __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
  6560. __pyx_t_7 = 0;
  6561. /* "View.MemoryView":433
  6562. * cdef is_slice(self, obj):
  6563. * if not isinstance(obj, memoryview):
  6564. * try: # <<<<<<<<<<<<<<
  6565. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6566. * self.dtype_is_object)
  6567. */
  6568. }
  6569. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6570. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  6571. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6572. goto __pyx_L9_try_end;
  6573. __pyx_L4_error:;
  6574. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  6575. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  6576. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  6577. /* "View.MemoryView":436
  6578. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6579. * self.dtype_is_object)
  6580. * except TypeError: # <<<<<<<<<<<<<<
  6581. * return None
  6582. *
  6583. */
  6584. __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
  6585. if (__pyx_t_9) {
  6586. __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6587. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
  6588. __Pyx_GOTREF(__pyx_t_7);
  6589. __Pyx_GOTREF(__pyx_t_8);
  6590. __Pyx_GOTREF(__pyx_t_6);
  6591. /* "View.MemoryView":437
  6592. * self.dtype_is_object)
  6593. * except TypeError:
  6594. * return None # <<<<<<<<<<<<<<
  6595. *
  6596. * return obj
  6597. */
  6598. __Pyx_XDECREF(__pyx_r);
  6599. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6600. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6601. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6602. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6603. goto __pyx_L7_except_return;
  6604. }
  6605. goto __pyx_L6_except_error;
  6606. __pyx_L6_except_error:;
  6607. /* "View.MemoryView":433
  6608. * cdef is_slice(self, obj):
  6609. * if not isinstance(obj, memoryview):
  6610. * try: # <<<<<<<<<<<<<<
  6611. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6612. * self.dtype_is_object)
  6613. */
  6614. __Pyx_XGIVEREF(__pyx_t_3);
  6615. __Pyx_XGIVEREF(__pyx_t_4);
  6616. __Pyx_XGIVEREF(__pyx_t_5);
  6617. __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  6618. goto __pyx_L1_error;
  6619. __pyx_L7_except_return:;
  6620. __Pyx_XGIVEREF(__pyx_t_3);
  6621. __Pyx_XGIVEREF(__pyx_t_4);
  6622. __Pyx_XGIVEREF(__pyx_t_5);
  6623. __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  6624. goto __pyx_L0;
  6625. __pyx_L9_try_end:;
  6626. }
  6627. /* "View.MemoryView":432
  6628. *
  6629. * cdef is_slice(self, obj):
  6630. * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
  6631. * try:
  6632. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  6633. */
  6634. }
  6635. /* "View.MemoryView":439
  6636. * return None
  6637. *
  6638. * return obj # <<<<<<<<<<<<<<
  6639. *
  6640. * cdef setitem_slice_assignment(self, dst, src):
  6641. */
  6642. __Pyx_XDECREF(__pyx_r);
  6643. __Pyx_INCREF(__pyx_v_obj);
  6644. __pyx_r = __pyx_v_obj;
  6645. goto __pyx_L0;
  6646. /* "View.MemoryView":431
  6647. * self.setitem_indexed(index, value)
  6648. *
  6649. * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
  6650. * if not isinstance(obj, memoryview):
  6651. * try:
  6652. */
  6653. /* function exit code */
  6654. __pyx_L1_error:;
  6655. __Pyx_XDECREF(__pyx_t_6);
  6656. __Pyx_XDECREF(__pyx_t_7);
  6657. __Pyx_XDECREF(__pyx_t_8);
  6658. __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6659. __pyx_r = 0;
  6660. __pyx_L0:;
  6661. __Pyx_XDECREF(__pyx_v_obj);
  6662. __Pyx_XGIVEREF(__pyx_r);
  6663. __Pyx_RefNannyFinishContext();
  6664. return __pyx_r;
  6665. }
  6666. /* "View.MemoryView":441
  6667. * return obj
  6668. *
  6669. * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
  6670. * cdef __Pyx_memviewslice dst_slice
  6671. * cdef __Pyx_memviewslice src_slice
  6672. */
  6673. static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  6674. __Pyx_memviewslice __pyx_v_dst_slice;
  6675. __Pyx_memviewslice __pyx_v_src_slice;
  6676. PyObject *__pyx_r = NULL;
  6677. __Pyx_RefNannyDeclarations
  6678. __Pyx_memviewslice *__pyx_t_1;
  6679. __Pyx_memviewslice *__pyx_t_2;
  6680. PyObject *__pyx_t_3 = NULL;
  6681. int __pyx_t_4;
  6682. int __pyx_t_5;
  6683. int __pyx_t_6;
  6684. __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
  6685. /* "View.MemoryView":445
  6686. * cdef __Pyx_memviewslice src_slice
  6687. *
  6688. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
  6689. * get_slice_from_memview(dst, &dst_slice)[0],
  6690. * src.ndim, dst.ndim, self.dtype_is_object)
  6691. */
  6692. if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
  6693. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 445, __pyx_L1_error)
  6694. /* "View.MemoryView":446
  6695. *
  6696. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
  6697. * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
  6698. * src.ndim, dst.ndim, self.dtype_is_object)
  6699. *
  6700. */
  6701. if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
  6702. __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 446, __pyx_L1_error)
  6703. /* "View.MemoryView":447
  6704. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
  6705. * get_slice_from_memview(dst, &dst_slice)[0],
  6706. * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
  6707. *
  6708. * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  6709. */
  6710. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
  6711. __Pyx_GOTREF(__pyx_t_3);
  6712. __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
  6713. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6714. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
  6715. __Pyx_GOTREF(__pyx_t_3);
  6716. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
  6717. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6718. /* "View.MemoryView":445
  6719. * cdef __Pyx_memviewslice src_slice
  6720. *
  6721. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
  6722. * get_slice_from_memview(dst, &dst_slice)[0],
  6723. * src.ndim, dst.ndim, self.dtype_is_object)
  6724. */
  6725. __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
  6726. /* "View.MemoryView":441
  6727. * return obj
  6728. *
  6729. * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
  6730. * cdef __Pyx_memviewslice dst_slice
  6731. * cdef __Pyx_memviewslice src_slice
  6732. */
  6733. /* function exit code */
  6734. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6735. goto __pyx_L0;
  6736. __pyx_L1_error:;
  6737. __Pyx_XDECREF(__pyx_t_3);
  6738. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6739. __pyx_r = 0;
  6740. __pyx_L0:;
  6741. __Pyx_XGIVEREF(__pyx_r);
  6742. __Pyx_RefNannyFinishContext();
  6743. return __pyx_r;
  6744. }
  6745. /* "View.MemoryView":449
  6746. * src.ndim, dst.ndim, self.dtype_is_object)
  6747. *
  6748. * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
  6749. * cdef int array[128]
  6750. * cdef void *tmp = NULL
  6751. */
  6752. static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
  6753. int __pyx_v_array[0x80];
  6754. void *__pyx_v_tmp;
  6755. void *__pyx_v_item;
  6756. __Pyx_memviewslice *__pyx_v_dst_slice;
  6757. __Pyx_memviewslice __pyx_v_tmp_slice;
  6758. PyObject *__pyx_r = NULL;
  6759. __Pyx_RefNannyDeclarations
  6760. __Pyx_memviewslice *__pyx_t_1;
  6761. int __pyx_t_2;
  6762. PyObject *__pyx_t_3 = NULL;
  6763. int __pyx_t_4;
  6764. int __pyx_t_5;
  6765. char const *__pyx_t_6;
  6766. PyObject *__pyx_t_7 = NULL;
  6767. PyObject *__pyx_t_8 = NULL;
  6768. PyObject *__pyx_t_9 = NULL;
  6769. PyObject *__pyx_t_10 = NULL;
  6770. PyObject *__pyx_t_11 = NULL;
  6771. PyObject *__pyx_t_12 = NULL;
  6772. __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
  6773. /* "View.MemoryView":451
  6774. * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  6775. * cdef int array[128]
  6776. * cdef void *tmp = NULL # <<<<<<<<<<<<<<
  6777. * cdef void *item
  6778. *
  6779. */
  6780. __pyx_v_tmp = NULL;
  6781. /* "View.MemoryView":456
  6782. * cdef __Pyx_memviewslice *dst_slice
  6783. * cdef __Pyx_memviewslice tmp_slice
  6784. * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
  6785. *
  6786. * if <size_t>self.view.itemsize > sizeof(array):
  6787. */
  6788. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 456, __pyx_L1_error)
  6789. __pyx_v_dst_slice = __pyx_t_1;
  6790. /* "View.MemoryView":458
  6791. * dst_slice = get_slice_from_memview(dst, &tmp_slice)
  6792. *
  6793. * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
  6794. * tmp = PyMem_Malloc(self.view.itemsize)
  6795. * if tmp == NULL:
  6796. */
  6797. __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  6798. if (__pyx_t_2) {
  6799. /* "View.MemoryView":459
  6800. *
  6801. * if <size_t>self.view.itemsize > sizeof(array):
  6802. * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
  6803. * if tmp == NULL:
  6804. * raise MemoryError
  6805. */
  6806. __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
  6807. /* "View.MemoryView":460
  6808. * if <size_t>self.view.itemsize > sizeof(array):
  6809. * tmp = PyMem_Malloc(self.view.itemsize)
  6810. * if tmp == NULL: # <<<<<<<<<<<<<<
  6811. * raise MemoryError
  6812. * item = tmp
  6813. */
  6814. __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
  6815. if (unlikely(__pyx_t_2)) {
  6816. /* "View.MemoryView":461
  6817. * tmp = PyMem_Malloc(self.view.itemsize)
  6818. * if tmp == NULL:
  6819. * raise MemoryError # <<<<<<<<<<<<<<
  6820. * item = tmp
  6821. * else:
  6822. */
  6823. PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
  6824. /* "View.MemoryView":460
  6825. * if <size_t>self.view.itemsize > sizeof(array):
  6826. * tmp = PyMem_Malloc(self.view.itemsize)
  6827. * if tmp == NULL: # <<<<<<<<<<<<<<
  6828. * raise MemoryError
  6829. * item = tmp
  6830. */
  6831. }
  6832. /* "View.MemoryView":462
  6833. * if tmp == NULL:
  6834. * raise MemoryError
  6835. * item = tmp # <<<<<<<<<<<<<<
  6836. * else:
  6837. * item = <void *> array
  6838. */
  6839. __pyx_v_item = __pyx_v_tmp;
  6840. /* "View.MemoryView":458
  6841. * dst_slice = get_slice_from_memview(dst, &tmp_slice)
  6842. *
  6843. * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
  6844. * tmp = PyMem_Malloc(self.view.itemsize)
  6845. * if tmp == NULL:
  6846. */
  6847. goto __pyx_L3;
  6848. }
  6849. /* "View.MemoryView":464
  6850. * item = tmp
  6851. * else:
  6852. * item = <void *> array # <<<<<<<<<<<<<<
  6853. *
  6854. * try:
  6855. */
  6856. /*else*/ {
  6857. __pyx_v_item = ((void *)__pyx_v_array);
  6858. }
  6859. __pyx_L3:;
  6860. /* "View.MemoryView":466
  6861. * item = <void *> array
  6862. *
  6863. * try: # <<<<<<<<<<<<<<
  6864. * if self.dtype_is_object:
  6865. * (<PyObject **> item)[0] = <PyObject *> value
  6866. */
  6867. /*try:*/ {
  6868. /* "View.MemoryView":467
  6869. *
  6870. * try:
  6871. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  6872. * (<PyObject **> item)[0] = <PyObject *> value
  6873. * else:
  6874. */
  6875. __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
  6876. if (__pyx_t_2) {
  6877. /* "View.MemoryView":468
  6878. * try:
  6879. * if self.dtype_is_object:
  6880. * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
  6881. * else:
  6882. * self.assign_item_from_object(<char *> item, value)
  6883. */
  6884. (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
  6885. /* "View.MemoryView":467
  6886. *
  6887. * try:
  6888. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  6889. * (<PyObject **> item)[0] = <PyObject *> value
  6890. * else:
  6891. */
  6892. goto __pyx_L8;
  6893. }
  6894. /* "View.MemoryView":470
  6895. * (<PyObject **> item)[0] = <PyObject *> value
  6896. * else:
  6897. * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
  6898. *
  6899. *
  6900. */
  6901. /*else*/ {
  6902. __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 470, __pyx_L6_error)
  6903. __Pyx_GOTREF(__pyx_t_3);
  6904. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6905. }
  6906. __pyx_L8:;
  6907. /* "View.MemoryView":474
  6908. *
  6909. *
  6910. * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
  6911. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  6912. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  6913. */
  6914. __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
  6915. if (__pyx_t_2) {
  6916. /* "View.MemoryView":475
  6917. *
  6918. * if self.view.suboffsets != NULL:
  6919. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
  6920. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  6921. * item, self.dtype_is_object)
  6922. */
  6923. __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
  6924. __Pyx_GOTREF(__pyx_t_3);
  6925. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6926. /* "View.MemoryView":474
  6927. *
  6928. *
  6929. * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
  6930. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  6931. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  6932. */
  6933. }
  6934. /* "View.MemoryView":476
  6935. * if self.view.suboffsets != NULL:
  6936. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  6937. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
  6938. * item, self.dtype_is_object)
  6939. * finally:
  6940. */
  6941. __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
  6942. }
  6943. /* "View.MemoryView":479
  6944. * item, self.dtype_is_object)
  6945. * finally:
  6946. * PyMem_Free(tmp) # <<<<<<<<<<<<<<
  6947. *
  6948. * cdef setitem_indexed(self, index, value):
  6949. */
  6950. /*finally:*/ {
  6951. /*normal exit:*/{
  6952. PyMem_Free(__pyx_v_tmp);
  6953. goto __pyx_L7;
  6954. }
  6955. __pyx_L6_error:;
  6956. /*exception exit:*/{
  6957. __Pyx_PyThreadState_declare
  6958. __Pyx_PyThreadState_assign
  6959. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
  6960. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6961. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
  6962. if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
  6963. __Pyx_XGOTREF(__pyx_t_7);
  6964. __Pyx_XGOTREF(__pyx_t_8);
  6965. __Pyx_XGOTREF(__pyx_t_9);
  6966. __Pyx_XGOTREF(__pyx_t_10);
  6967. __Pyx_XGOTREF(__pyx_t_11);
  6968. __Pyx_XGOTREF(__pyx_t_12);
  6969. __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
  6970. {
  6971. PyMem_Free(__pyx_v_tmp);
  6972. }
  6973. if (PY_MAJOR_VERSION >= 3) {
  6974. __Pyx_XGIVEREF(__pyx_t_10);
  6975. __Pyx_XGIVEREF(__pyx_t_11);
  6976. __Pyx_XGIVEREF(__pyx_t_12);
  6977. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
  6978. }
  6979. __Pyx_XGIVEREF(__pyx_t_7);
  6980. __Pyx_XGIVEREF(__pyx_t_8);
  6981. __Pyx_XGIVEREF(__pyx_t_9);
  6982. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
  6983. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
  6984. __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
  6985. goto __pyx_L1_error;
  6986. }
  6987. __pyx_L7:;
  6988. }
  6989. /* "View.MemoryView":449
  6990. * src.ndim, dst.ndim, self.dtype_is_object)
  6991. *
  6992. * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
  6993. * cdef int array[128]
  6994. * cdef void *tmp = NULL
  6995. */
  6996. /* function exit code */
  6997. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6998. goto __pyx_L0;
  6999. __pyx_L1_error:;
  7000. __Pyx_XDECREF(__pyx_t_3);
  7001. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7002. __pyx_r = 0;
  7003. __pyx_L0:;
  7004. __Pyx_XGIVEREF(__pyx_r);
  7005. __Pyx_RefNannyFinishContext();
  7006. return __pyx_r;
  7007. }
  7008. /* "View.MemoryView":481
  7009. * PyMem_Free(tmp)
  7010. *
  7011. * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
  7012. * cdef char *itemp = self.get_item_pointer(index)
  7013. * self.assign_item_from_object(itemp, value)
  7014. */
  7015. static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  7016. char *__pyx_v_itemp;
  7017. PyObject *__pyx_r = NULL;
  7018. __Pyx_RefNannyDeclarations
  7019. char *__pyx_t_1;
  7020. PyObject *__pyx_t_2 = NULL;
  7021. __Pyx_RefNannySetupContext("setitem_indexed", 0);
  7022. /* "View.MemoryView":482
  7023. *
  7024. * cdef setitem_indexed(self, index, value):
  7025. * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
  7026. * self.assign_item_from_object(itemp, value)
  7027. *
  7028. */
  7029. __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
  7030. __pyx_v_itemp = __pyx_t_1;
  7031. /* "View.MemoryView":483
  7032. * cdef setitem_indexed(self, index, value):
  7033. * cdef char *itemp = self.get_item_pointer(index)
  7034. * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
  7035. *
  7036. * cdef convert_item_to_object(self, char *itemp):
  7037. */
  7038. __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
  7039. __Pyx_GOTREF(__pyx_t_2);
  7040. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7041. /* "View.MemoryView":481
  7042. * PyMem_Free(tmp)
  7043. *
  7044. * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
  7045. * cdef char *itemp = self.get_item_pointer(index)
  7046. * self.assign_item_from_object(itemp, value)
  7047. */
  7048. /* function exit code */
  7049. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7050. goto __pyx_L0;
  7051. __pyx_L1_error:;
  7052. __Pyx_XDECREF(__pyx_t_2);
  7053. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7054. __pyx_r = 0;
  7055. __pyx_L0:;
  7056. __Pyx_XGIVEREF(__pyx_r);
  7057. __Pyx_RefNannyFinishContext();
  7058. return __pyx_r;
  7059. }
  7060. /* "View.MemoryView":485
  7061. * self.assign_item_from_object(itemp, value)
  7062. *
  7063. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  7064. * """Only used if instantiated manually by the user, or if Cython doesn't
  7065. * know how to convert the type"""
  7066. */
  7067. static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  7068. PyObject *__pyx_v_struct = NULL;
  7069. PyObject *__pyx_v_bytesitem = 0;
  7070. PyObject *__pyx_v_result = NULL;
  7071. PyObject *__pyx_r = NULL;
  7072. __Pyx_RefNannyDeclarations
  7073. PyObject *__pyx_t_1 = NULL;
  7074. PyObject *__pyx_t_2 = NULL;
  7075. PyObject *__pyx_t_3 = NULL;
  7076. PyObject *__pyx_t_4 = NULL;
  7077. PyObject *__pyx_t_5 = NULL;
  7078. PyObject *__pyx_t_6 = NULL;
  7079. PyObject *__pyx_t_7 = NULL;
  7080. int __pyx_t_8;
  7081. PyObject *__pyx_t_9 = NULL;
  7082. size_t __pyx_t_10;
  7083. int __pyx_t_11;
  7084. __Pyx_RefNannySetupContext("convert_item_to_object", 0);
  7085. /* "View.MemoryView":488
  7086. * """Only used if instantiated manually by the user, or if Cython doesn't
  7087. * know how to convert the type"""
  7088. * import struct # <<<<<<<<<<<<<<
  7089. * cdef bytes bytesitem
  7090. *
  7091. */
  7092. __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
  7093. __Pyx_GOTREF(__pyx_t_1);
  7094. __pyx_v_struct = __pyx_t_1;
  7095. __pyx_t_1 = 0;
  7096. /* "View.MemoryView":491
  7097. * cdef bytes bytesitem
  7098. *
  7099. * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
  7100. * try:
  7101. * result = struct.unpack(self.view.format, bytesitem)
  7102. */
  7103. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
  7104. __Pyx_GOTREF(__pyx_t_1);
  7105. __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  7106. __pyx_t_1 = 0;
  7107. /* "View.MemoryView":492
  7108. *
  7109. * bytesitem = itemp[:self.view.itemsize]
  7110. * try: # <<<<<<<<<<<<<<
  7111. * result = struct.unpack(self.view.format, bytesitem)
  7112. * except struct.error:
  7113. */
  7114. {
  7115. __Pyx_PyThreadState_declare
  7116. __Pyx_PyThreadState_assign
  7117. __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
  7118. __Pyx_XGOTREF(__pyx_t_2);
  7119. __Pyx_XGOTREF(__pyx_t_3);
  7120. __Pyx_XGOTREF(__pyx_t_4);
  7121. /*try:*/ {
  7122. /* "View.MemoryView":493
  7123. * bytesitem = itemp[:self.view.itemsize]
  7124. * try:
  7125. * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
  7126. * except struct.error:
  7127. * raise ValueError("Unable to convert item to object")
  7128. */
  7129. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
  7130. __Pyx_GOTREF(__pyx_t_5);
  7131. __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
  7132. __Pyx_GOTREF(__pyx_t_6);
  7133. __pyx_t_7 = NULL;
  7134. __pyx_t_8 = 0;
  7135. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  7136. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
  7137. if (likely(__pyx_t_7)) {
  7138. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  7139. __Pyx_INCREF(__pyx_t_7);
  7140. __Pyx_INCREF(function);
  7141. __Pyx_DECREF_SET(__pyx_t_5, function);
  7142. __pyx_t_8 = 1;
  7143. }
  7144. }
  7145. #if CYTHON_FAST_PYCALL
  7146. if (PyFunction_Check(__pyx_t_5)) {
  7147. PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
  7148. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
  7149. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  7150. __Pyx_GOTREF(__pyx_t_1);
  7151. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7152. } else
  7153. #endif
  7154. #if CYTHON_FAST_PYCCALL
  7155. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  7156. PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
  7157. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
  7158. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  7159. __Pyx_GOTREF(__pyx_t_1);
  7160. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7161. } else
  7162. #endif
  7163. {
  7164. __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
  7165. __Pyx_GOTREF(__pyx_t_9);
  7166. if (__pyx_t_7) {
  7167. __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
  7168. }
  7169. __Pyx_GIVEREF(__pyx_t_6);
  7170. PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
  7171. __Pyx_INCREF(__pyx_v_bytesitem);
  7172. __Pyx_GIVEREF(__pyx_v_bytesitem);
  7173. PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
  7174. __pyx_t_6 = 0;
  7175. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
  7176. __Pyx_GOTREF(__pyx_t_1);
  7177. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  7178. }
  7179. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7180. __pyx_v_result = __pyx_t_1;
  7181. __pyx_t_1 = 0;
  7182. /* "View.MemoryView":492
  7183. *
  7184. * bytesitem = itemp[:self.view.itemsize]
  7185. * try: # <<<<<<<<<<<<<<
  7186. * result = struct.unpack(self.view.format, bytesitem)
  7187. * except struct.error:
  7188. */
  7189. }
  7190. /* "View.MemoryView":497
  7191. * raise ValueError("Unable to convert item to object")
  7192. * else:
  7193. * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
  7194. * return result[0]
  7195. * return result
  7196. */
  7197. /*else:*/ {
  7198. __pyx_t_10 = strlen(__pyx_v_self->view.format);
  7199. __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
  7200. if (__pyx_t_11) {
  7201. /* "View.MemoryView":498
  7202. * else:
  7203. * if len(self.view.format) == 1:
  7204. * return result[0] # <<<<<<<<<<<<<<
  7205. * return result
  7206. *
  7207. */
  7208. __Pyx_XDECREF(__pyx_r);
  7209. __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
  7210. __Pyx_GOTREF(__pyx_t_1);
  7211. __pyx_r = __pyx_t_1;
  7212. __pyx_t_1 = 0;
  7213. goto __pyx_L6_except_return;
  7214. /* "View.MemoryView":497
  7215. * raise ValueError("Unable to convert item to object")
  7216. * else:
  7217. * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
  7218. * return result[0]
  7219. * return result
  7220. */
  7221. }
  7222. /* "View.MemoryView":499
  7223. * if len(self.view.format) == 1:
  7224. * return result[0]
  7225. * return result # <<<<<<<<<<<<<<
  7226. *
  7227. * cdef assign_item_from_object(self, char *itemp, object value):
  7228. */
  7229. __Pyx_XDECREF(__pyx_r);
  7230. __Pyx_INCREF(__pyx_v_result);
  7231. __pyx_r = __pyx_v_result;
  7232. goto __pyx_L6_except_return;
  7233. }
  7234. __pyx_L3_error:;
  7235. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  7236. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7237. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  7238. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  7239. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  7240. /* "View.MemoryView":494
  7241. * try:
  7242. * result = struct.unpack(self.view.format, bytesitem)
  7243. * except struct.error: # <<<<<<<<<<<<<<
  7244. * raise ValueError("Unable to convert item to object")
  7245. * else:
  7246. */
  7247. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
  7248. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
  7249. __Pyx_GOTREF(__pyx_t_6);
  7250. __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  7251. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7252. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
  7253. __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
  7254. if (__pyx_t_8) {
  7255. __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7256. if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
  7257. __Pyx_GOTREF(__pyx_t_9);
  7258. __Pyx_GOTREF(__pyx_t_5);
  7259. __Pyx_GOTREF(__pyx_t_1);
  7260. /* "View.MemoryView":495
  7261. * result = struct.unpack(self.view.format, bytesitem)
  7262. * except struct.error:
  7263. * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
  7264. * else:
  7265. * if len(self.view.format) == 1:
  7266. */
  7267. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
  7268. __Pyx_GOTREF(__pyx_t_6);
  7269. __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  7270. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7271. __PYX_ERR(1, 495, __pyx_L5_except_error)
  7272. }
  7273. goto __pyx_L5_except_error;
  7274. __pyx_L5_except_error:;
  7275. /* "View.MemoryView":492
  7276. *
  7277. * bytesitem = itemp[:self.view.itemsize]
  7278. * try: # <<<<<<<<<<<<<<
  7279. * result = struct.unpack(self.view.format, bytesitem)
  7280. * except struct.error:
  7281. */
  7282. __Pyx_XGIVEREF(__pyx_t_2);
  7283. __Pyx_XGIVEREF(__pyx_t_3);
  7284. __Pyx_XGIVEREF(__pyx_t_4);
  7285. __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
  7286. goto __pyx_L1_error;
  7287. __pyx_L6_except_return:;
  7288. __Pyx_XGIVEREF(__pyx_t_2);
  7289. __Pyx_XGIVEREF(__pyx_t_3);
  7290. __Pyx_XGIVEREF(__pyx_t_4);
  7291. __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
  7292. goto __pyx_L0;
  7293. }
  7294. /* "View.MemoryView":485
  7295. * self.assign_item_from_object(itemp, value)
  7296. *
  7297. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  7298. * """Only used if instantiated manually by the user, or if Cython doesn't
  7299. * know how to convert the type"""
  7300. */
  7301. /* function exit code */
  7302. __pyx_L1_error:;
  7303. __Pyx_XDECREF(__pyx_t_1);
  7304. __Pyx_XDECREF(__pyx_t_5);
  7305. __Pyx_XDECREF(__pyx_t_6);
  7306. __Pyx_XDECREF(__pyx_t_7);
  7307. __Pyx_XDECREF(__pyx_t_9);
  7308. __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7309. __pyx_r = 0;
  7310. __pyx_L0:;
  7311. __Pyx_XDECREF(__pyx_v_struct);
  7312. __Pyx_XDECREF(__pyx_v_bytesitem);
  7313. __Pyx_XDECREF(__pyx_v_result);
  7314. __Pyx_XGIVEREF(__pyx_r);
  7315. __Pyx_RefNannyFinishContext();
  7316. return __pyx_r;
  7317. }
  7318. /* "View.MemoryView":501
  7319. * return result
  7320. *
  7321. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  7322. * """Only used if instantiated manually by the user, or if Cython doesn't
  7323. * know how to convert the type"""
  7324. */
  7325. static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  7326. PyObject *__pyx_v_struct = NULL;
  7327. char __pyx_v_c;
  7328. PyObject *__pyx_v_bytesvalue = 0;
  7329. Py_ssize_t __pyx_v_i;
  7330. PyObject *__pyx_r = NULL;
  7331. __Pyx_RefNannyDeclarations
  7332. PyObject *__pyx_t_1 = NULL;
  7333. int __pyx_t_2;
  7334. int __pyx_t_3;
  7335. PyObject *__pyx_t_4 = NULL;
  7336. PyObject *__pyx_t_5 = NULL;
  7337. PyObject *__pyx_t_6 = NULL;
  7338. int __pyx_t_7;
  7339. PyObject *__pyx_t_8 = NULL;
  7340. Py_ssize_t __pyx_t_9;
  7341. PyObject *__pyx_t_10 = NULL;
  7342. char *__pyx_t_11;
  7343. char *__pyx_t_12;
  7344. char *__pyx_t_13;
  7345. char *__pyx_t_14;
  7346. __Pyx_RefNannySetupContext("assign_item_from_object", 0);
  7347. /* "View.MemoryView":504
  7348. * """Only used if instantiated manually by the user, or if Cython doesn't
  7349. * know how to convert the type"""
  7350. * import struct # <<<<<<<<<<<<<<
  7351. * cdef char c
  7352. * cdef bytes bytesvalue
  7353. */
  7354. __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
  7355. __Pyx_GOTREF(__pyx_t_1);
  7356. __pyx_v_struct = __pyx_t_1;
  7357. __pyx_t_1 = 0;
  7358. /* "View.MemoryView":509
  7359. * cdef Py_ssize_t i
  7360. *
  7361. * if isinstance(value, tuple): # <<<<<<<<<<<<<<
  7362. * bytesvalue = struct.pack(self.view.format, *value)
  7363. * else:
  7364. */
  7365. __pyx_t_2 = PyTuple_Check(__pyx_v_value);
  7366. __pyx_t_3 = (__pyx_t_2 != 0);
  7367. if (__pyx_t_3) {
  7368. /* "View.MemoryView":510
  7369. *
  7370. * if isinstance(value, tuple):
  7371. * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
  7372. * else:
  7373. * bytesvalue = struct.pack(self.view.format, value)
  7374. */
  7375. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
  7376. __Pyx_GOTREF(__pyx_t_1);
  7377. __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
  7378. __Pyx_GOTREF(__pyx_t_4);
  7379. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
  7380. __Pyx_GOTREF(__pyx_t_5);
  7381. __Pyx_GIVEREF(__pyx_t_4);
  7382. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  7383. __pyx_t_4 = 0;
  7384. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
  7385. __Pyx_GOTREF(__pyx_t_4);
  7386. __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
  7387. __Pyx_GOTREF(__pyx_t_6);
  7388. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7389. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7390. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
  7391. __Pyx_GOTREF(__pyx_t_4);
  7392. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7393. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7394. if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
  7395. __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
  7396. __pyx_t_4 = 0;
  7397. /* "View.MemoryView":509
  7398. * cdef Py_ssize_t i
  7399. *
  7400. * if isinstance(value, tuple): # <<<<<<<<<<<<<<
  7401. * bytesvalue = struct.pack(self.view.format, *value)
  7402. * else:
  7403. */
  7404. goto __pyx_L3;
  7405. }
  7406. /* "View.MemoryView":512
  7407. * bytesvalue = struct.pack(self.view.format, *value)
  7408. * else:
  7409. * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
  7410. *
  7411. * for i, c in enumerate(bytesvalue):
  7412. */
  7413. /*else*/ {
  7414. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
  7415. __Pyx_GOTREF(__pyx_t_6);
  7416. __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
  7417. __Pyx_GOTREF(__pyx_t_1);
  7418. __pyx_t_5 = NULL;
  7419. __pyx_t_7 = 0;
  7420. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  7421. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
  7422. if (likely(__pyx_t_5)) {
  7423. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  7424. __Pyx_INCREF(__pyx_t_5);
  7425. __Pyx_INCREF(function);
  7426. __Pyx_DECREF_SET(__pyx_t_6, function);
  7427. __pyx_t_7 = 1;
  7428. }
  7429. }
  7430. #if CYTHON_FAST_PYCALL
  7431. if (PyFunction_Check(__pyx_t_6)) {
  7432. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
  7433. __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
  7434. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7435. __Pyx_GOTREF(__pyx_t_4);
  7436. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7437. } else
  7438. #endif
  7439. #if CYTHON_FAST_PYCCALL
  7440. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  7441. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
  7442. __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
  7443. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7444. __Pyx_GOTREF(__pyx_t_4);
  7445. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7446. } else
  7447. #endif
  7448. {
  7449. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
  7450. __Pyx_GOTREF(__pyx_t_8);
  7451. if (__pyx_t_5) {
  7452. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
  7453. }
  7454. __Pyx_GIVEREF(__pyx_t_1);
  7455. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
  7456. __Pyx_INCREF(__pyx_v_value);
  7457. __Pyx_GIVEREF(__pyx_v_value);
  7458. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
  7459. __pyx_t_1 = 0;
  7460. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
  7461. __Pyx_GOTREF(__pyx_t_4);
  7462. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  7463. }
  7464. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7465. if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
  7466. __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
  7467. __pyx_t_4 = 0;
  7468. }
  7469. __pyx_L3:;
  7470. /* "View.MemoryView":514
  7471. * bytesvalue = struct.pack(self.view.format, value)
  7472. *
  7473. * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
  7474. * itemp[i] = c
  7475. *
  7476. */
  7477. __pyx_t_9 = 0;
  7478. if (unlikely(__pyx_v_bytesvalue == Py_None)) {
  7479. PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
  7480. __PYX_ERR(1, 514, __pyx_L1_error)
  7481. }
  7482. __Pyx_INCREF(__pyx_v_bytesvalue);
  7483. __pyx_t_10 = __pyx_v_bytesvalue;
  7484. __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  7485. __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  7486. for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
  7487. __pyx_t_11 = __pyx_t_14;
  7488. __pyx_v_c = (__pyx_t_11[0]);
  7489. /* "View.MemoryView":515
  7490. *
  7491. * for i, c in enumerate(bytesvalue):
  7492. * itemp[i] = c # <<<<<<<<<<<<<<
  7493. *
  7494. * @cname('getbuffer')
  7495. */
  7496. __pyx_v_i = __pyx_t_9;
  7497. /* "View.MemoryView":514
  7498. * bytesvalue = struct.pack(self.view.format, value)
  7499. *
  7500. * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
  7501. * itemp[i] = c
  7502. *
  7503. */
  7504. __pyx_t_9 = (__pyx_t_9 + 1);
  7505. /* "View.MemoryView":515
  7506. *
  7507. * for i, c in enumerate(bytesvalue):
  7508. * itemp[i] = c # <<<<<<<<<<<<<<
  7509. *
  7510. * @cname('getbuffer')
  7511. */
  7512. (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  7513. }
  7514. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7515. /* "View.MemoryView":501
  7516. * return result
  7517. *
  7518. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  7519. * """Only used if instantiated manually by the user, or if Cython doesn't
  7520. * know how to convert the type"""
  7521. */
  7522. /* function exit code */
  7523. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7524. goto __pyx_L0;
  7525. __pyx_L1_error:;
  7526. __Pyx_XDECREF(__pyx_t_1);
  7527. __Pyx_XDECREF(__pyx_t_4);
  7528. __Pyx_XDECREF(__pyx_t_5);
  7529. __Pyx_XDECREF(__pyx_t_6);
  7530. __Pyx_XDECREF(__pyx_t_8);
  7531. __Pyx_XDECREF(__pyx_t_10);
  7532. __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7533. __pyx_r = 0;
  7534. __pyx_L0:;
  7535. __Pyx_XDECREF(__pyx_v_struct);
  7536. __Pyx_XDECREF(__pyx_v_bytesvalue);
  7537. __Pyx_XGIVEREF(__pyx_r);
  7538. __Pyx_RefNannyFinishContext();
  7539. return __pyx_r;
  7540. }
  7541. /* "View.MemoryView":518
  7542. *
  7543. * @cname('getbuffer')
  7544. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  7545. * if flags & PyBUF_WRITABLE and self.view.readonly:
  7546. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7547. */
  7548. /* Python wrapper */
  7549. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  7550. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  7551. int __pyx_r;
  7552. __Pyx_RefNannyDeclarations
  7553. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  7554. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  7555. /* function exit code */
  7556. __Pyx_RefNannyFinishContext();
  7557. return __pyx_r;
  7558. }
  7559. static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  7560. int __pyx_r;
  7561. __Pyx_RefNannyDeclarations
  7562. int __pyx_t_1;
  7563. int __pyx_t_2;
  7564. PyObject *__pyx_t_3 = NULL;
  7565. Py_ssize_t *__pyx_t_4;
  7566. char *__pyx_t_5;
  7567. void *__pyx_t_6;
  7568. int __pyx_t_7;
  7569. Py_ssize_t __pyx_t_8;
  7570. if (__pyx_v_info == NULL) {
  7571. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  7572. return -1;
  7573. }
  7574. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  7575. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  7576. __Pyx_GIVEREF(__pyx_v_info->obj);
  7577. /* "View.MemoryView":519
  7578. * @cname('getbuffer')
  7579. * def __getbuffer__(self, Py_buffer *info, int flags):
  7580. * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
  7581. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7582. *
  7583. */
  7584. __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  7585. if (__pyx_t_2) {
  7586. } else {
  7587. __pyx_t_1 = __pyx_t_2;
  7588. goto __pyx_L4_bool_binop_done;
  7589. }
  7590. __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
  7591. __pyx_t_1 = __pyx_t_2;
  7592. __pyx_L4_bool_binop_done:;
  7593. if (unlikely(__pyx_t_1)) {
  7594. /* "View.MemoryView":520
  7595. * def __getbuffer__(self, Py_buffer *info, int flags):
  7596. * if flags & PyBUF_WRITABLE and self.view.readonly:
  7597. * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
  7598. *
  7599. * if flags & PyBUF_ND:
  7600. */
  7601. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
  7602. __Pyx_GOTREF(__pyx_t_3);
  7603. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  7604. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7605. __PYX_ERR(1, 520, __pyx_L1_error)
  7606. /* "View.MemoryView":519
  7607. * @cname('getbuffer')
  7608. * def __getbuffer__(self, Py_buffer *info, int flags):
  7609. * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
  7610. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7611. *
  7612. */
  7613. }
  7614. /* "View.MemoryView":522
  7615. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7616. *
  7617. * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
  7618. * info.shape = self.view.shape
  7619. * else:
  7620. */
  7621. __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  7622. if (__pyx_t_1) {
  7623. /* "View.MemoryView":523
  7624. *
  7625. * if flags & PyBUF_ND:
  7626. * info.shape = self.view.shape # <<<<<<<<<<<<<<
  7627. * else:
  7628. * info.shape = NULL
  7629. */
  7630. __pyx_t_4 = __pyx_v_self->view.shape;
  7631. __pyx_v_info->shape = __pyx_t_4;
  7632. /* "View.MemoryView":522
  7633. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7634. *
  7635. * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
  7636. * info.shape = self.view.shape
  7637. * else:
  7638. */
  7639. goto __pyx_L6;
  7640. }
  7641. /* "View.MemoryView":525
  7642. * info.shape = self.view.shape
  7643. * else:
  7644. * info.shape = NULL # <<<<<<<<<<<<<<
  7645. *
  7646. * if flags & PyBUF_STRIDES:
  7647. */
  7648. /*else*/ {
  7649. __pyx_v_info->shape = NULL;
  7650. }
  7651. __pyx_L6:;
  7652. /* "View.MemoryView":527
  7653. * info.shape = NULL
  7654. *
  7655. * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
  7656. * info.strides = self.view.strides
  7657. * else:
  7658. */
  7659. __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  7660. if (__pyx_t_1) {
  7661. /* "View.MemoryView":528
  7662. *
  7663. * if flags & PyBUF_STRIDES:
  7664. * info.strides = self.view.strides # <<<<<<<<<<<<<<
  7665. * else:
  7666. * info.strides = NULL
  7667. */
  7668. __pyx_t_4 = __pyx_v_self->view.strides;
  7669. __pyx_v_info->strides = __pyx_t_4;
  7670. /* "View.MemoryView":527
  7671. * info.shape = NULL
  7672. *
  7673. * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
  7674. * info.strides = self.view.strides
  7675. * else:
  7676. */
  7677. goto __pyx_L7;
  7678. }
  7679. /* "View.MemoryView":530
  7680. * info.strides = self.view.strides
  7681. * else:
  7682. * info.strides = NULL # <<<<<<<<<<<<<<
  7683. *
  7684. * if flags & PyBUF_INDIRECT:
  7685. */
  7686. /*else*/ {
  7687. __pyx_v_info->strides = NULL;
  7688. }
  7689. __pyx_L7:;
  7690. /* "View.MemoryView":532
  7691. * info.strides = NULL
  7692. *
  7693. * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
  7694. * info.suboffsets = self.view.suboffsets
  7695. * else:
  7696. */
  7697. __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  7698. if (__pyx_t_1) {
  7699. /* "View.MemoryView":533
  7700. *
  7701. * if flags & PyBUF_INDIRECT:
  7702. * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
  7703. * else:
  7704. * info.suboffsets = NULL
  7705. */
  7706. __pyx_t_4 = __pyx_v_self->view.suboffsets;
  7707. __pyx_v_info->suboffsets = __pyx_t_4;
  7708. /* "View.MemoryView":532
  7709. * info.strides = NULL
  7710. *
  7711. * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
  7712. * info.suboffsets = self.view.suboffsets
  7713. * else:
  7714. */
  7715. goto __pyx_L8;
  7716. }
  7717. /* "View.MemoryView":535
  7718. * info.suboffsets = self.view.suboffsets
  7719. * else:
  7720. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  7721. *
  7722. * if flags & PyBUF_FORMAT:
  7723. */
  7724. /*else*/ {
  7725. __pyx_v_info->suboffsets = NULL;
  7726. }
  7727. __pyx_L8:;
  7728. /* "View.MemoryView":537
  7729. * info.suboffsets = NULL
  7730. *
  7731. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  7732. * info.format = self.view.format
  7733. * else:
  7734. */
  7735. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  7736. if (__pyx_t_1) {
  7737. /* "View.MemoryView":538
  7738. *
  7739. * if flags & PyBUF_FORMAT:
  7740. * info.format = self.view.format # <<<<<<<<<<<<<<
  7741. * else:
  7742. * info.format = NULL
  7743. */
  7744. __pyx_t_5 = __pyx_v_self->view.format;
  7745. __pyx_v_info->format = __pyx_t_5;
  7746. /* "View.MemoryView":537
  7747. * info.suboffsets = NULL
  7748. *
  7749. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  7750. * info.format = self.view.format
  7751. * else:
  7752. */
  7753. goto __pyx_L9;
  7754. }
  7755. /* "View.MemoryView":540
  7756. * info.format = self.view.format
  7757. * else:
  7758. * info.format = NULL # <<<<<<<<<<<<<<
  7759. *
  7760. * info.buf = self.view.buf
  7761. */
  7762. /*else*/ {
  7763. __pyx_v_info->format = NULL;
  7764. }
  7765. __pyx_L9:;
  7766. /* "View.MemoryView":542
  7767. * info.format = NULL
  7768. *
  7769. * info.buf = self.view.buf # <<<<<<<<<<<<<<
  7770. * info.ndim = self.view.ndim
  7771. * info.itemsize = self.view.itemsize
  7772. */
  7773. __pyx_t_6 = __pyx_v_self->view.buf;
  7774. __pyx_v_info->buf = __pyx_t_6;
  7775. /* "View.MemoryView":543
  7776. *
  7777. * info.buf = self.view.buf
  7778. * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
  7779. * info.itemsize = self.view.itemsize
  7780. * info.len = self.view.len
  7781. */
  7782. __pyx_t_7 = __pyx_v_self->view.ndim;
  7783. __pyx_v_info->ndim = __pyx_t_7;
  7784. /* "View.MemoryView":544
  7785. * info.buf = self.view.buf
  7786. * info.ndim = self.view.ndim
  7787. * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
  7788. * info.len = self.view.len
  7789. * info.readonly = self.view.readonly
  7790. */
  7791. __pyx_t_8 = __pyx_v_self->view.itemsize;
  7792. __pyx_v_info->itemsize = __pyx_t_8;
  7793. /* "View.MemoryView":545
  7794. * info.ndim = self.view.ndim
  7795. * info.itemsize = self.view.itemsize
  7796. * info.len = self.view.len # <<<<<<<<<<<<<<
  7797. * info.readonly = self.view.readonly
  7798. * info.obj = self
  7799. */
  7800. __pyx_t_8 = __pyx_v_self->view.len;
  7801. __pyx_v_info->len = __pyx_t_8;
  7802. /* "View.MemoryView":546
  7803. * info.itemsize = self.view.itemsize
  7804. * info.len = self.view.len
  7805. * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
  7806. * info.obj = self
  7807. *
  7808. */
  7809. __pyx_t_1 = __pyx_v_self->view.readonly;
  7810. __pyx_v_info->readonly = __pyx_t_1;
  7811. /* "View.MemoryView":547
  7812. * info.len = self.view.len
  7813. * info.readonly = self.view.readonly
  7814. * info.obj = self # <<<<<<<<<<<<<<
  7815. *
  7816. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
  7817. */
  7818. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  7819. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  7820. __Pyx_GOTREF(__pyx_v_info->obj);
  7821. __Pyx_DECREF(__pyx_v_info->obj);
  7822. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  7823. /* "View.MemoryView":518
  7824. *
  7825. * @cname('getbuffer')
  7826. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  7827. * if flags & PyBUF_WRITABLE and self.view.readonly:
  7828. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  7829. */
  7830. /* function exit code */
  7831. __pyx_r = 0;
  7832. goto __pyx_L0;
  7833. __pyx_L1_error:;
  7834. __Pyx_XDECREF(__pyx_t_3);
  7835. __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7836. __pyx_r = -1;
  7837. if (__pyx_v_info->obj != NULL) {
  7838. __Pyx_GOTREF(__pyx_v_info->obj);
  7839. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  7840. }
  7841. goto __pyx_L2;
  7842. __pyx_L0:;
  7843. if (__pyx_v_info->obj == Py_None) {
  7844. __Pyx_GOTREF(__pyx_v_info->obj);
  7845. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  7846. }
  7847. __pyx_L2:;
  7848. __Pyx_RefNannyFinishContext();
  7849. return __pyx_r;
  7850. }
  7851. /* "View.MemoryView":553
  7852. *
  7853. * @property
  7854. * def T(self): # <<<<<<<<<<<<<<
  7855. * cdef _memoryviewslice result = memoryview_copy(self)
  7856. * transpose_memslice(&result.from_slice)
  7857. */
  7858. /* Python wrapper */
  7859. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
  7860. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  7861. PyObject *__pyx_r = 0;
  7862. __Pyx_RefNannyDeclarations
  7863. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7864. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7865. /* function exit code */
  7866. __Pyx_RefNannyFinishContext();
  7867. return __pyx_r;
  7868. }
  7869. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7870. struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  7871. PyObject *__pyx_r = NULL;
  7872. __Pyx_RefNannyDeclarations
  7873. PyObject *__pyx_t_1 = NULL;
  7874. int __pyx_t_2;
  7875. __Pyx_RefNannySetupContext("__get__", 0);
  7876. /* "View.MemoryView":554
  7877. * @property
  7878. * def T(self):
  7879. * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
  7880. * transpose_memslice(&result.from_slice)
  7881. * return result
  7882. */
  7883. __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
  7884. __Pyx_GOTREF(__pyx_t_1);
  7885. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
  7886. __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  7887. __pyx_t_1 = 0;
  7888. /* "View.MemoryView":555
  7889. * def T(self):
  7890. * cdef _memoryviewslice result = memoryview_copy(self)
  7891. * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
  7892. * return result
  7893. *
  7894. */
  7895. __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
  7896. /* "View.MemoryView":556
  7897. * cdef _memoryviewslice result = memoryview_copy(self)
  7898. * transpose_memslice(&result.from_slice)
  7899. * return result # <<<<<<<<<<<<<<
  7900. *
  7901. * @property
  7902. */
  7903. __Pyx_XDECREF(__pyx_r);
  7904. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  7905. __pyx_r = ((PyObject *)__pyx_v_result);
  7906. goto __pyx_L0;
  7907. /* "View.MemoryView":553
  7908. *
  7909. * @property
  7910. * def T(self): # <<<<<<<<<<<<<<
  7911. * cdef _memoryviewslice result = memoryview_copy(self)
  7912. * transpose_memslice(&result.from_slice)
  7913. */
  7914. /* function exit code */
  7915. __pyx_L1_error:;
  7916. __Pyx_XDECREF(__pyx_t_1);
  7917. __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7918. __pyx_r = NULL;
  7919. __pyx_L0:;
  7920. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  7921. __Pyx_XGIVEREF(__pyx_r);
  7922. __Pyx_RefNannyFinishContext();
  7923. return __pyx_r;
  7924. }
  7925. /* "View.MemoryView":559
  7926. *
  7927. * @property
  7928. * def base(self): # <<<<<<<<<<<<<<
  7929. * return self.obj
  7930. *
  7931. */
  7932. /* Python wrapper */
  7933. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
  7934. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  7935. PyObject *__pyx_r = 0;
  7936. __Pyx_RefNannyDeclarations
  7937. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7938. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7939. /* function exit code */
  7940. __Pyx_RefNannyFinishContext();
  7941. return __pyx_r;
  7942. }
  7943. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7944. PyObject *__pyx_r = NULL;
  7945. __Pyx_RefNannyDeclarations
  7946. __Pyx_RefNannySetupContext("__get__", 0);
  7947. /* "View.MemoryView":560
  7948. * @property
  7949. * def base(self):
  7950. * return self.obj # <<<<<<<<<<<<<<
  7951. *
  7952. * @property
  7953. */
  7954. __Pyx_XDECREF(__pyx_r);
  7955. __Pyx_INCREF(__pyx_v_self->obj);
  7956. __pyx_r = __pyx_v_self->obj;
  7957. goto __pyx_L0;
  7958. /* "View.MemoryView":559
  7959. *
  7960. * @property
  7961. * def base(self): # <<<<<<<<<<<<<<
  7962. * return self.obj
  7963. *
  7964. */
  7965. /* function exit code */
  7966. __pyx_L0:;
  7967. __Pyx_XGIVEREF(__pyx_r);
  7968. __Pyx_RefNannyFinishContext();
  7969. return __pyx_r;
  7970. }
  7971. /* "View.MemoryView":563
  7972. *
  7973. * @property
  7974. * def shape(self): # <<<<<<<<<<<<<<
  7975. * return tuple([length for length in self.view.shape[:self.view.ndim]])
  7976. *
  7977. */
  7978. /* Python wrapper */
  7979. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
  7980. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  7981. PyObject *__pyx_r = 0;
  7982. __Pyx_RefNannyDeclarations
  7983. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7984. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  7985. /* function exit code */
  7986. __Pyx_RefNannyFinishContext();
  7987. return __pyx_r;
  7988. }
  7989. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  7990. Py_ssize_t __pyx_v_length;
  7991. PyObject *__pyx_r = NULL;
  7992. __Pyx_RefNannyDeclarations
  7993. PyObject *__pyx_t_1 = NULL;
  7994. Py_ssize_t *__pyx_t_2;
  7995. Py_ssize_t *__pyx_t_3;
  7996. Py_ssize_t *__pyx_t_4;
  7997. PyObject *__pyx_t_5 = NULL;
  7998. __Pyx_RefNannySetupContext("__get__", 0);
  7999. /* "View.MemoryView":564
  8000. * @property
  8001. * def shape(self):
  8002. * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
  8003. *
  8004. * @property
  8005. */
  8006. __Pyx_XDECREF(__pyx_r);
  8007. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
  8008. __Pyx_GOTREF(__pyx_t_1);
  8009. __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  8010. for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
  8011. __pyx_t_2 = __pyx_t_4;
  8012. __pyx_v_length = (__pyx_t_2[0]);
  8013. __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
  8014. __Pyx_GOTREF(__pyx_t_5);
  8015. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
  8016. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  8017. }
  8018. __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
  8019. __Pyx_GOTREF(__pyx_t_5);
  8020. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8021. __pyx_r = __pyx_t_5;
  8022. __pyx_t_5 = 0;
  8023. goto __pyx_L0;
  8024. /* "View.MemoryView":563
  8025. *
  8026. * @property
  8027. * def shape(self): # <<<<<<<<<<<<<<
  8028. * return tuple([length for length in self.view.shape[:self.view.ndim]])
  8029. *
  8030. */
  8031. /* function exit code */
  8032. __pyx_L1_error:;
  8033. __Pyx_XDECREF(__pyx_t_1);
  8034. __Pyx_XDECREF(__pyx_t_5);
  8035. __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8036. __pyx_r = NULL;
  8037. __pyx_L0:;
  8038. __Pyx_XGIVEREF(__pyx_r);
  8039. __Pyx_RefNannyFinishContext();
  8040. return __pyx_r;
  8041. }
  8042. /* "View.MemoryView":567
  8043. *
  8044. * @property
  8045. * def strides(self): # <<<<<<<<<<<<<<
  8046. * if self.view.strides == NULL:
  8047. *
  8048. */
  8049. /* Python wrapper */
  8050. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
  8051. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  8052. PyObject *__pyx_r = 0;
  8053. __Pyx_RefNannyDeclarations
  8054. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8055. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8056. /* function exit code */
  8057. __Pyx_RefNannyFinishContext();
  8058. return __pyx_r;
  8059. }
  8060. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8061. Py_ssize_t __pyx_v_stride;
  8062. PyObject *__pyx_r = NULL;
  8063. __Pyx_RefNannyDeclarations
  8064. int __pyx_t_1;
  8065. PyObject *__pyx_t_2 = NULL;
  8066. Py_ssize_t *__pyx_t_3;
  8067. Py_ssize_t *__pyx_t_4;
  8068. Py_ssize_t *__pyx_t_5;
  8069. PyObject *__pyx_t_6 = NULL;
  8070. __Pyx_RefNannySetupContext("__get__", 0);
  8071. /* "View.MemoryView":568
  8072. * @property
  8073. * def strides(self):
  8074. * if self.view.strides == NULL: # <<<<<<<<<<<<<<
  8075. *
  8076. * raise ValueError("Buffer view does not expose strides")
  8077. */
  8078. __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  8079. if (unlikely(__pyx_t_1)) {
  8080. /* "View.MemoryView":570
  8081. * if self.view.strides == NULL:
  8082. *
  8083. * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
  8084. *
  8085. * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
  8086. */
  8087. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
  8088. __Pyx_GOTREF(__pyx_t_2);
  8089. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  8090. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8091. __PYX_ERR(1, 570, __pyx_L1_error)
  8092. /* "View.MemoryView":568
  8093. * @property
  8094. * def strides(self):
  8095. * if self.view.strides == NULL: # <<<<<<<<<<<<<<
  8096. *
  8097. * raise ValueError("Buffer view does not expose strides")
  8098. */
  8099. }
  8100. /* "View.MemoryView":572
  8101. * raise ValueError("Buffer view does not expose strides")
  8102. *
  8103. * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
  8104. *
  8105. * @property
  8106. */
  8107. __Pyx_XDECREF(__pyx_r);
  8108. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
  8109. __Pyx_GOTREF(__pyx_t_2);
  8110. __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  8111. for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
  8112. __pyx_t_3 = __pyx_t_5;
  8113. __pyx_v_stride = (__pyx_t_3[0]);
  8114. __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
  8115. __Pyx_GOTREF(__pyx_t_6);
  8116. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
  8117. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8118. }
  8119. __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
  8120. __Pyx_GOTREF(__pyx_t_6);
  8121. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8122. __pyx_r = __pyx_t_6;
  8123. __pyx_t_6 = 0;
  8124. goto __pyx_L0;
  8125. /* "View.MemoryView":567
  8126. *
  8127. * @property
  8128. * def strides(self): # <<<<<<<<<<<<<<
  8129. * if self.view.strides == NULL:
  8130. *
  8131. */
  8132. /* function exit code */
  8133. __pyx_L1_error:;
  8134. __Pyx_XDECREF(__pyx_t_2);
  8135. __Pyx_XDECREF(__pyx_t_6);
  8136. __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8137. __pyx_r = NULL;
  8138. __pyx_L0:;
  8139. __Pyx_XGIVEREF(__pyx_r);
  8140. __Pyx_RefNannyFinishContext();
  8141. return __pyx_r;
  8142. }
  8143. /* "View.MemoryView":575
  8144. *
  8145. * @property
  8146. * def suboffsets(self): # <<<<<<<<<<<<<<
  8147. * if self.view.suboffsets == NULL:
  8148. * return (-1,) * self.view.ndim
  8149. */
  8150. /* Python wrapper */
  8151. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
  8152. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  8153. PyObject *__pyx_r = 0;
  8154. __Pyx_RefNannyDeclarations
  8155. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8156. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8157. /* function exit code */
  8158. __Pyx_RefNannyFinishContext();
  8159. return __pyx_r;
  8160. }
  8161. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8162. Py_ssize_t __pyx_v_suboffset;
  8163. PyObject *__pyx_r = NULL;
  8164. __Pyx_RefNannyDeclarations
  8165. int __pyx_t_1;
  8166. PyObject *__pyx_t_2 = NULL;
  8167. PyObject *__pyx_t_3 = NULL;
  8168. Py_ssize_t *__pyx_t_4;
  8169. Py_ssize_t *__pyx_t_5;
  8170. Py_ssize_t *__pyx_t_6;
  8171. __Pyx_RefNannySetupContext("__get__", 0);
  8172. /* "View.MemoryView":576
  8173. * @property
  8174. * def suboffsets(self):
  8175. * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
  8176. * return (-1,) * self.view.ndim
  8177. *
  8178. */
  8179. __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  8180. if (__pyx_t_1) {
  8181. /* "View.MemoryView":577
  8182. * def suboffsets(self):
  8183. * if self.view.suboffsets == NULL:
  8184. * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
  8185. *
  8186. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
  8187. */
  8188. __Pyx_XDECREF(__pyx_r);
  8189. __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
  8190. __Pyx_GOTREF(__pyx_t_2);
  8191. __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__12, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
  8192. __Pyx_GOTREF(__pyx_t_3);
  8193. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8194. __pyx_r = __pyx_t_3;
  8195. __pyx_t_3 = 0;
  8196. goto __pyx_L0;
  8197. /* "View.MemoryView":576
  8198. * @property
  8199. * def suboffsets(self):
  8200. * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
  8201. * return (-1,) * self.view.ndim
  8202. *
  8203. */
  8204. }
  8205. /* "View.MemoryView":579
  8206. * return (-1,) * self.view.ndim
  8207. *
  8208. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
  8209. *
  8210. * @property
  8211. */
  8212. __Pyx_XDECREF(__pyx_r);
  8213. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
  8214. __Pyx_GOTREF(__pyx_t_3);
  8215. __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  8216. for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
  8217. __pyx_t_4 = __pyx_t_6;
  8218. __pyx_v_suboffset = (__pyx_t_4[0]);
  8219. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
  8220. __Pyx_GOTREF(__pyx_t_2);
  8221. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
  8222. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8223. }
  8224. __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
  8225. __Pyx_GOTREF(__pyx_t_2);
  8226. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8227. __pyx_r = __pyx_t_2;
  8228. __pyx_t_2 = 0;
  8229. goto __pyx_L0;
  8230. /* "View.MemoryView":575
  8231. *
  8232. * @property
  8233. * def suboffsets(self): # <<<<<<<<<<<<<<
  8234. * if self.view.suboffsets == NULL:
  8235. * return (-1,) * self.view.ndim
  8236. */
  8237. /* function exit code */
  8238. __pyx_L1_error:;
  8239. __Pyx_XDECREF(__pyx_t_2);
  8240. __Pyx_XDECREF(__pyx_t_3);
  8241. __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8242. __pyx_r = NULL;
  8243. __pyx_L0:;
  8244. __Pyx_XGIVEREF(__pyx_r);
  8245. __Pyx_RefNannyFinishContext();
  8246. return __pyx_r;
  8247. }
  8248. /* "View.MemoryView":582
  8249. *
  8250. * @property
  8251. * def ndim(self): # <<<<<<<<<<<<<<
  8252. * return self.view.ndim
  8253. *
  8254. */
  8255. /* Python wrapper */
  8256. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
  8257. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  8258. PyObject *__pyx_r = 0;
  8259. __Pyx_RefNannyDeclarations
  8260. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8261. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8262. /* function exit code */
  8263. __Pyx_RefNannyFinishContext();
  8264. return __pyx_r;
  8265. }
  8266. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8267. PyObject *__pyx_r = NULL;
  8268. __Pyx_RefNannyDeclarations
  8269. PyObject *__pyx_t_1 = NULL;
  8270. __Pyx_RefNannySetupContext("__get__", 0);
  8271. /* "View.MemoryView":583
  8272. * @property
  8273. * def ndim(self):
  8274. * return self.view.ndim # <<<<<<<<<<<<<<
  8275. *
  8276. * @property
  8277. */
  8278. __Pyx_XDECREF(__pyx_r);
  8279. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
  8280. __Pyx_GOTREF(__pyx_t_1);
  8281. __pyx_r = __pyx_t_1;
  8282. __pyx_t_1 = 0;
  8283. goto __pyx_L0;
  8284. /* "View.MemoryView":582
  8285. *
  8286. * @property
  8287. * def ndim(self): # <<<<<<<<<<<<<<
  8288. * return self.view.ndim
  8289. *
  8290. */
  8291. /* function exit code */
  8292. __pyx_L1_error:;
  8293. __Pyx_XDECREF(__pyx_t_1);
  8294. __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8295. __pyx_r = NULL;
  8296. __pyx_L0:;
  8297. __Pyx_XGIVEREF(__pyx_r);
  8298. __Pyx_RefNannyFinishContext();
  8299. return __pyx_r;
  8300. }
  8301. /* "View.MemoryView":586
  8302. *
  8303. * @property
  8304. * def itemsize(self): # <<<<<<<<<<<<<<
  8305. * return self.view.itemsize
  8306. *
  8307. */
  8308. /* Python wrapper */
  8309. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
  8310. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  8311. PyObject *__pyx_r = 0;
  8312. __Pyx_RefNannyDeclarations
  8313. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8314. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8315. /* function exit code */
  8316. __Pyx_RefNannyFinishContext();
  8317. return __pyx_r;
  8318. }
  8319. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8320. PyObject *__pyx_r = NULL;
  8321. __Pyx_RefNannyDeclarations
  8322. PyObject *__pyx_t_1 = NULL;
  8323. __Pyx_RefNannySetupContext("__get__", 0);
  8324. /* "View.MemoryView":587
  8325. * @property
  8326. * def itemsize(self):
  8327. * return self.view.itemsize # <<<<<<<<<<<<<<
  8328. *
  8329. * @property
  8330. */
  8331. __Pyx_XDECREF(__pyx_r);
  8332. __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
  8333. __Pyx_GOTREF(__pyx_t_1);
  8334. __pyx_r = __pyx_t_1;
  8335. __pyx_t_1 = 0;
  8336. goto __pyx_L0;
  8337. /* "View.MemoryView":586
  8338. *
  8339. * @property
  8340. * def itemsize(self): # <<<<<<<<<<<<<<
  8341. * return self.view.itemsize
  8342. *
  8343. */
  8344. /* function exit code */
  8345. __pyx_L1_error:;
  8346. __Pyx_XDECREF(__pyx_t_1);
  8347. __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8348. __pyx_r = NULL;
  8349. __pyx_L0:;
  8350. __Pyx_XGIVEREF(__pyx_r);
  8351. __Pyx_RefNannyFinishContext();
  8352. return __pyx_r;
  8353. }
  8354. /* "View.MemoryView":590
  8355. *
  8356. * @property
  8357. * def nbytes(self): # <<<<<<<<<<<<<<
  8358. * return self.size * self.view.itemsize
  8359. *
  8360. */
  8361. /* Python wrapper */
  8362. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
  8363. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  8364. PyObject *__pyx_r = 0;
  8365. __Pyx_RefNannyDeclarations
  8366. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8367. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8368. /* function exit code */
  8369. __Pyx_RefNannyFinishContext();
  8370. return __pyx_r;
  8371. }
  8372. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8373. PyObject *__pyx_r = NULL;
  8374. __Pyx_RefNannyDeclarations
  8375. PyObject *__pyx_t_1 = NULL;
  8376. PyObject *__pyx_t_2 = NULL;
  8377. PyObject *__pyx_t_3 = NULL;
  8378. __Pyx_RefNannySetupContext("__get__", 0);
  8379. /* "View.MemoryView":591
  8380. * @property
  8381. * def nbytes(self):
  8382. * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
  8383. *
  8384. * @property
  8385. */
  8386. __Pyx_XDECREF(__pyx_r);
  8387. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
  8388. __Pyx_GOTREF(__pyx_t_1);
  8389. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
  8390. __Pyx_GOTREF(__pyx_t_2);
  8391. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
  8392. __Pyx_GOTREF(__pyx_t_3);
  8393. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8394. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8395. __pyx_r = __pyx_t_3;
  8396. __pyx_t_3 = 0;
  8397. goto __pyx_L0;
  8398. /* "View.MemoryView":590
  8399. *
  8400. * @property
  8401. * def nbytes(self): # <<<<<<<<<<<<<<
  8402. * return self.size * self.view.itemsize
  8403. *
  8404. */
  8405. /* function exit code */
  8406. __pyx_L1_error:;
  8407. __Pyx_XDECREF(__pyx_t_1);
  8408. __Pyx_XDECREF(__pyx_t_2);
  8409. __Pyx_XDECREF(__pyx_t_3);
  8410. __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8411. __pyx_r = NULL;
  8412. __pyx_L0:;
  8413. __Pyx_XGIVEREF(__pyx_r);
  8414. __Pyx_RefNannyFinishContext();
  8415. return __pyx_r;
  8416. }
  8417. /* "View.MemoryView":594
  8418. *
  8419. * @property
  8420. * def size(self): # <<<<<<<<<<<<<<
  8421. * if self._size is None:
  8422. * result = 1
  8423. */
  8424. /* Python wrapper */
  8425. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
  8426. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  8427. PyObject *__pyx_r = 0;
  8428. __Pyx_RefNannyDeclarations
  8429. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  8430. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8431. /* function exit code */
  8432. __Pyx_RefNannyFinishContext();
  8433. return __pyx_r;
  8434. }
  8435. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8436. PyObject *__pyx_v_result = NULL;
  8437. PyObject *__pyx_v_length = NULL;
  8438. PyObject *__pyx_r = NULL;
  8439. __Pyx_RefNannyDeclarations
  8440. int __pyx_t_1;
  8441. int __pyx_t_2;
  8442. Py_ssize_t *__pyx_t_3;
  8443. Py_ssize_t *__pyx_t_4;
  8444. Py_ssize_t *__pyx_t_5;
  8445. PyObject *__pyx_t_6 = NULL;
  8446. __Pyx_RefNannySetupContext("__get__", 0);
  8447. /* "View.MemoryView":595
  8448. * @property
  8449. * def size(self):
  8450. * if self._size is None: # <<<<<<<<<<<<<<
  8451. * result = 1
  8452. *
  8453. */
  8454. __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  8455. __pyx_t_2 = (__pyx_t_1 != 0);
  8456. if (__pyx_t_2) {
  8457. /* "View.MemoryView":596
  8458. * def size(self):
  8459. * if self._size is None:
  8460. * result = 1 # <<<<<<<<<<<<<<
  8461. *
  8462. * for length in self.view.shape[:self.view.ndim]:
  8463. */
  8464. __Pyx_INCREF(__pyx_int_1);
  8465. __pyx_v_result = __pyx_int_1;
  8466. /* "View.MemoryView":598
  8467. * result = 1
  8468. *
  8469. * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
  8470. * result *= length
  8471. *
  8472. */
  8473. __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  8474. for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
  8475. __pyx_t_3 = __pyx_t_5;
  8476. __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
  8477. __Pyx_GOTREF(__pyx_t_6);
  8478. __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
  8479. __pyx_t_6 = 0;
  8480. /* "View.MemoryView":599
  8481. *
  8482. * for length in self.view.shape[:self.view.ndim]:
  8483. * result *= length # <<<<<<<<<<<<<<
  8484. *
  8485. * self._size = result
  8486. */
  8487. __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
  8488. __Pyx_GOTREF(__pyx_t_6);
  8489. __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
  8490. __pyx_t_6 = 0;
  8491. }
  8492. /* "View.MemoryView":601
  8493. * result *= length
  8494. *
  8495. * self._size = result # <<<<<<<<<<<<<<
  8496. *
  8497. * return self._size
  8498. */
  8499. __Pyx_INCREF(__pyx_v_result);
  8500. __Pyx_GIVEREF(__pyx_v_result);
  8501. __Pyx_GOTREF(__pyx_v_self->_size);
  8502. __Pyx_DECREF(__pyx_v_self->_size);
  8503. __pyx_v_self->_size = __pyx_v_result;
  8504. /* "View.MemoryView":595
  8505. * @property
  8506. * def size(self):
  8507. * if self._size is None: # <<<<<<<<<<<<<<
  8508. * result = 1
  8509. *
  8510. */
  8511. }
  8512. /* "View.MemoryView":603
  8513. * self._size = result
  8514. *
  8515. * return self._size # <<<<<<<<<<<<<<
  8516. *
  8517. * def __len__(self):
  8518. */
  8519. __Pyx_XDECREF(__pyx_r);
  8520. __Pyx_INCREF(__pyx_v_self->_size);
  8521. __pyx_r = __pyx_v_self->_size;
  8522. goto __pyx_L0;
  8523. /* "View.MemoryView":594
  8524. *
  8525. * @property
  8526. * def size(self): # <<<<<<<<<<<<<<
  8527. * if self._size is None:
  8528. * result = 1
  8529. */
  8530. /* function exit code */
  8531. __pyx_L1_error:;
  8532. __Pyx_XDECREF(__pyx_t_6);
  8533. __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8534. __pyx_r = NULL;
  8535. __pyx_L0:;
  8536. __Pyx_XDECREF(__pyx_v_result);
  8537. __Pyx_XDECREF(__pyx_v_length);
  8538. __Pyx_XGIVEREF(__pyx_r);
  8539. __Pyx_RefNannyFinishContext();
  8540. return __pyx_r;
  8541. }
  8542. /* "View.MemoryView":605
  8543. * return self._size
  8544. *
  8545. * def __len__(self): # <<<<<<<<<<<<<<
  8546. * if self.view.ndim >= 1:
  8547. * return self.view.shape[0]
  8548. */
  8549. /* Python wrapper */
  8550. static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
  8551. static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  8552. Py_ssize_t __pyx_r;
  8553. __Pyx_RefNannyDeclarations
  8554. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  8555. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8556. /* function exit code */
  8557. __Pyx_RefNannyFinishContext();
  8558. return __pyx_r;
  8559. }
  8560. static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8561. Py_ssize_t __pyx_r;
  8562. __Pyx_RefNannyDeclarations
  8563. int __pyx_t_1;
  8564. __Pyx_RefNannySetupContext("__len__", 0);
  8565. /* "View.MemoryView":606
  8566. *
  8567. * def __len__(self):
  8568. * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
  8569. * return self.view.shape[0]
  8570. *
  8571. */
  8572. __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  8573. if (__pyx_t_1) {
  8574. /* "View.MemoryView":607
  8575. * def __len__(self):
  8576. * if self.view.ndim >= 1:
  8577. * return self.view.shape[0] # <<<<<<<<<<<<<<
  8578. *
  8579. * return 0
  8580. */
  8581. __pyx_r = (__pyx_v_self->view.shape[0]);
  8582. goto __pyx_L0;
  8583. /* "View.MemoryView":606
  8584. *
  8585. * def __len__(self):
  8586. * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
  8587. * return self.view.shape[0]
  8588. *
  8589. */
  8590. }
  8591. /* "View.MemoryView":609
  8592. * return self.view.shape[0]
  8593. *
  8594. * return 0 # <<<<<<<<<<<<<<
  8595. *
  8596. * def __repr__(self):
  8597. */
  8598. __pyx_r = 0;
  8599. goto __pyx_L0;
  8600. /* "View.MemoryView":605
  8601. * return self._size
  8602. *
  8603. * def __len__(self): # <<<<<<<<<<<<<<
  8604. * if self.view.ndim >= 1:
  8605. * return self.view.shape[0]
  8606. */
  8607. /* function exit code */
  8608. __pyx_L0:;
  8609. __Pyx_RefNannyFinishContext();
  8610. return __pyx_r;
  8611. }
  8612. /* "View.MemoryView":611
  8613. * return 0
  8614. *
  8615. * def __repr__(self): # <<<<<<<<<<<<<<
  8616. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  8617. * id(self))
  8618. */
  8619. /* Python wrapper */
  8620. static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
  8621. static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  8622. PyObject *__pyx_r = 0;
  8623. __Pyx_RefNannyDeclarations
  8624. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  8625. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8626. /* function exit code */
  8627. __Pyx_RefNannyFinishContext();
  8628. return __pyx_r;
  8629. }
  8630. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8631. PyObject *__pyx_r = NULL;
  8632. __Pyx_RefNannyDeclarations
  8633. PyObject *__pyx_t_1 = NULL;
  8634. PyObject *__pyx_t_2 = NULL;
  8635. PyObject *__pyx_t_3 = NULL;
  8636. __Pyx_RefNannySetupContext("__repr__", 0);
  8637. /* "View.MemoryView":612
  8638. *
  8639. * def __repr__(self):
  8640. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
  8641. * id(self))
  8642. *
  8643. */
  8644. __Pyx_XDECREF(__pyx_r);
  8645. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
  8646. __Pyx_GOTREF(__pyx_t_1);
  8647. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
  8648. __Pyx_GOTREF(__pyx_t_2);
  8649. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8650. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
  8651. __Pyx_GOTREF(__pyx_t_1);
  8652. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8653. /* "View.MemoryView":613
  8654. * def __repr__(self):
  8655. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  8656. * id(self)) # <<<<<<<<<<<<<<
  8657. *
  8658. * def __str__(self):
  8659. */
  8660. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
  8661. __Pyx_GOTREF(__pyx_t_2);
  8662. /* "View.MemoryView":612
  8663. *
  8664. * def __repr__(self):
  8665. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
  8666. * id(self))
  8667. *
  8668. */
  8669. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
  8670. __Pyx_GOTREF(__pyx_t_3);
  8671. __Pyx_GIVEREF(__pyx_t_1);
  8672. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  8673. __Pyx_GIVEREF(__pyx_t_2);
  8674. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  8675. __pyx_t_1 = 0;
  8676. __pyx_t_2 = 0;
  8677. __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
  8678. __Pyx_GOTREF(__pyx_t_2);
  8679. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8680. __pyx_r = __pyx_t_2;
  8681. __pyx_t_2 = 0;
  8682. goto __pyx_L0;
  8683. /* "View.MemoryView":611
  8684. * return 0
  8685. *
  8686. * def __repr__(self): # <<<<<<<<<<<<<<
  8687. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  8688. * id(self))
  8689. */
  8690. /* function exit code */
  8691. __pyx_L1_error:;
  8692. __Pyx_XDECREF(__pyx_t_1);
  8693. __Pyx_XDECREF(__pyx_t_2);
  8694. __Pyx_XDECREF(__pyx_t_3);
  8695. __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8696. __pyx_r = NULL;
  8697. __pyx_L0:;
  8698. __Pyx_XGIVEREF(__pyx_r);
  8699. __Pyx_RefNannyFinishContext();
  8700. return __pyx_r;
  8701. }
  8702. /* "View.MemoryView":615
  8703. * id(self))
  8704. *
  8705. * def __str__(self): # <<<<<<<<<<<<<<
  8706. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
  8707. *
  8708. */
  8709. /* Python wrapper */
  8710. static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
  8711. static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  8712. PyObject *__pyx_r = 0;
  8713. __Pyx_RefNannyDeclarations
  8714. __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  8715. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8716. /* function exit code */
  8717. __Pyx_RefNannyFinishContext();
  8718. return __pyx_r;
  8719. }
  8720. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8721. PyObject *__pyx_r = NULL;
  8722. __Pyx_RefNannyDeclarations
  8723. PyObject *__pyx_t_1 = NULL;
  8724. PyObject *__pyx_t_2 = NULL;
  8725. __Pyx_RefNannySetupContext("__str__", 0);
  8726. /* "View.MemoryView":616
  8727. *
  8728. * def __str__(self):
  8729. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
  8730. *
  8731. *
  8732. */
  8733. __Pyx_XDECREF(__pyx_r);
  8734. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
  8735. __Pyx_GOTREF(__pyx_t_1);
  8736. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
  8737. __Pyx_GOTREF(__pyx_t_2);
  8738. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8739. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
  8740. __Pyx_GOTREF(__pyx_t_1);
  8741. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8742. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
  8743. __Pyx_GOTREF(__pyx_t_2);
  8744. __Pyx_GIVEREF(__pyx_t_1);
  8745. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  8746. __pyx_t_1 = 0;
  8747. __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
  8748. __Pyx_GOTREF(__pyx_t_1);
  8749. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8750. __pyx_r = __pyx_t_1;
  8751. __pyx_t_1 = 0;
  8752. goto __pyx_L0;
  8753. /* "View.MemoryView":615
  8754. * id(self))
  8755. *
  8756. * def __str__(self): # <<<<<<<<<<<<<<
  8757. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
  8758. *
  8759. */
  8760. /* function exit code */
  8761. __pyx_L1_error:;
  8762. __Pyx_XDECREF(__pyx_t_1);
  8763. __Pyx_XDECREF(__pyx_t_2);
  8764. __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8765. __pyx_r = NULL;
  8766. __pyx_L0:;
  8767. __Pyx_XGIVEREF(__pyx_r);
  8768. __Pyx_RefNannyFinishContext();
  8769. return __pyx_r;
  8770. }
  8771. /* "View.MemoryView":619
  8772. *
  8773. *
  8774. * def is_c_contig(self): # <<<<<<<<<<<<<<
  8775. * cdef __Pyx_memviewslice *mslice
  8776. * cdef __Pyx_memviewslice tmp
  8777. */
  8778. /* Python wrapper */
  8779. static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8780. static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8781. PyObject *__pyx_r = 0;
  8782. __Pyx_RefNannyDeclarations
  8783. __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  8784. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8785. /* function exit code */
  8786. __Pyx_RefNannyFinishContext();
  8787. return __pyx_r;
  8788. }
  8789. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  8790. __Pyx_memviewslice *__pyx_v_mslice;
  8791. __Pyx_memviewslice __pyx_v_tmp;
  8792. PyObject *__pyx_r = NULL;
  8793. __Pyx_RefNannyDeclarations
  8794. __Pyx_memviewslice *__pyx_t_1;
  8795. PyObject *__pyx_t_2 = NULL;
  8796. __Pyx_RefNannySetupContext("is_c_contig", 0);
  8797. /* "View.MemoryView":622
  8798. * cdef __Pyx_memviewslice *mslice
  8799. * cdef __Pyx_memviewslice tmp
  8800. * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
  8801. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  8802. *
  8803. */
  8804. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 622, __pyx_L1_error)
  8805. __pyx_v_mslice = __pyx_t_1;
  8806. /* "View.MemoryView":623
  8807. * cdef __Pyx_memviewslice tmp
  8808. * mslice = get_slice_from_memview(self, &tmp)
  8809. * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
  8810. *
  8811. * def is_f_contig(self):
  8812. */
  8813. __Pyx_XDECREF(__pyx_r);
  8814. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
  8815. __Pyx_GOTREF(__pyx_t_2);
  8816. __pyx_r = __pyx_t_2;
  8817. __pyx_t_2 = 0;
  8818. goto __pyx_L0;
  8819. /* "View.MemoryView":619
  8820. *
  8821. *
  8822. * def is_c_contig(self): # <<<<<<<<<<<<<<
  8823. * cdef __Pyx_memviewslice *mslice
  8824. * cdef __Pyx_memviewslice tmp
  8825. */
  8826. /* function exit code */
  8827. __pyx_L1_error:;
  8828. __Pyx_XDECREF(__pyx_t_2);
  8829. __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8830. __pyx_r = NULL;
  8831. __pyx_L0:;
  8832. __Pyx_XGIVEREF(__pyx_r);
  8833. __Pyx_RefNannyFinishContext();
  8834. return __pyx_r;
  8835. }
  8836. /* "View.MemoryView":625
  8837. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  8838. *
  8839. * def is_f_contig(self): # <<<<<<<<<<<<<<
  8840. * cdef __Pyx_memviewslice *mslice
  8841. * cdef __Pyx_memviewslice tmp
  8842. */
  8843. /* Python wrapper */
  8844. static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8845. static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8846. PyObject *__pyx_r = 0;
  8847. __Pyx_RefNannyDeclarations
  8848. __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  8849. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8850. /* function exit code */
  8851. __Pyx_RefNannyFinishContext();
  8852. return __pyx_r;
  8853. }
  8854. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  8855. __Pyx_memviewslice *__pyx_v_mslice;
  8856. __Pyx_memviewslice __pyx_v_tmp;
  8857. PyObject *__pyx_r = NULL;
  8858. __Pyx_RefNannyDeclarations
  8859. __Pyx_memviewslice *__pyx_t_1;
  8860. PyObject *__pyx_t_2 = NULL;
  8861. __Pyx_RefNannySetupContext("is_f_contig", 0);
  8862. /* "View.MemoryView":628
  8863. * cdef __Pyx_memviewslice *mslice
  8864. * cdef __Pyx_memviewslice tmp
  8865. * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
  8866. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  8867. *
  8868. */
  8869. __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
  8870. __pyx_v_mslice = __pyx_t_1;
  8871. /* "View.MemoryView":629
  8872. * cdef __Pyx_memviewslice tmp
  8873. * mslice = get_slice_from_memview(self, &tmp)
  8874. * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
  8875. *
  8876. * def copy(self):
  8877. */
  8878. __Pyx_XDECREF(__pyx_r);
  8879. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
  8880. __Pyx_GOTREF(__pyx_t_2);
  8881. __pyx_r = __pyx_t_2;
  8882. __pyx_t_2 = 0;
  8883. goto __pyx_L0;
  8884. /* "View.MemoryView":625
  8885. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  8886. *
  8887. * def is_f_contig(self): # <<<<<<<<<<<<<<
  8888. * cdef __Pyx_memviewslice *mslice
  8889. * cdef __Pyx_memviewslice tmp
  8890. */
  8891. /* function exit code */
  8892. __pyx_L1_error:;
  8893. __Pyx_XDECREF(__pyx_t_2);
  8894. __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8895. __pyx_r = NULL;
  8896. __pyx_L0:;
  8897. __Pyx_XGIVEREF(__pyx_r);
  8898. __Pyx_RefNannyFinishContext();
  8899. return __pyx_r;
  8900. }
  8901. /* "View.MemoryView":631
  8902. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  8903. *
  8904. * def copy(self): # <<<<<<<<<<<<<<
  8905. * cdef __Pyx_memviewslice mslice
  8906. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  8907. */
  8908. /* Python wrapper */
  8909. static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8910. static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8911. PyObject *__pyx_r = 0;
  8912. __Pyx_RefNannyDeclarations
  8913. __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  8914. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8915. /* function exit code */
  8916. __Pyx_RefNannyFinishContext();
  8917. return __pyx_r;
  8918. }
  8919. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  8920. __Pyx_memviewslice __pyx_v_mslice;
  8921. int __pyx_v_flags;
  8922. PyObject *__pyx_r = NULL;
  8923. __Pyx_RefNannyDeclarations
  8924. __Pyx_memviewslice __pyx_t_1;
  8925. PyObject *__pyx_t_2 = NULL;
  8926. __Pyx_RefNannySetupContext("copy", 0);
  8927. /* "View.MemoryView":633
  8928. * def copy(self):
  8929. * cdef __Pyx_memviewslice mslice
  8930. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
  8931. *
  8932. * slice_copy(self, &mslice)
  8933. */
  8934. __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
  8935. /* "View.MemoryView":635
  8936. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  8937. *
  8938. * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
  8939. * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
  8940. * self.view.itemsize,
  8941. */
  8942. __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
  8943. /* "View.MemoryView":636
  8944. *
  8945. * slice_copy(self, &mslice)
  8946. * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
  8947. * self.view.itemsize,
  8948. * flags|PyBUF_C_CONTIGUOUS,
  8949. */
  8950. __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
  8951. __pyx_v_mslice = __pyx_t_1;
  8952. /* "View.MemoryView":641
  8953. * self.dtype_is_object)
  8954. *
  8955. * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
  8956. *
  8957. * def copy_fortran(self):
  8958. */
  8959. __Pyx_XDECREF(__pyx_r);
  8960. __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
  8961. __Pyx_GOTREF(__pyx_t_2);
  8962. __pyx_r = __pyx_t_2;
  8963. __pyx_t_2 = 0;
  8964. goto __pyx_L0;
  8965. /* "View.MemoryView":631
  8966. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  8967. *
  8968. * def copy(self): # <<<<<<<<<<<<<<
  8969. * cdef __Pyx_memviewslice mslice
  8970. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  8971. */
  8972. /* function exit code */
  8973. __pyx_L1_error:;
  8974. __Pyx_XDECREF(__pyx_t_2);
  8975. __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8976. __pyx_r = NULL;
  8977. __pyx_L0:;
  8978. __Pyx_XGIVEREF(__pyx_r);
  8979. __Pyx_RefNannyFinishContext();
  8980. return __pyx_r;
  8981. }
  8982. /* "View.MemoryView":643
  8983. * return memoryview_copy_from_slice(self, &mslice)
  8984. *
  8985. * def copy_fortran(self): # <<<<<<<<<<<<<<
  8986. * cdef __Pyx_memviewslice src, dst
  8987. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  8988. */
  8989. /* Python wrapper */
  8990. static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  8991. static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  8992. PyObject *__pyx_r = 0;
  8993. __Pyx_RefNannyDeclarations
  8994. __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  8995. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8996. /* function exit code */
  8997. __Pyx_RefNannyFinishContext();
  8998. return __pyx_r;
  8999. }
  9000. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  9001. __Pyx_memviewslice __pyx_v_src;
  9002. __Pyx_memviewslice __pyx_v_dst;
  9003. int __pyx_v_flags;
  9004. PyObject *__pyx_r = NULL;
  9005. __Pyx_RefNannyDeclarations
  9006. __Pyx_memviewslice __pyx_t_1;
  9007. PyObject *__pyx_t_2 = NULL;
  9008. __Pyx_RefNannySetupContext("copy_fortran", 0);
  9009. /* "View.MemoryView":645
  9010. * def copy_fortran(self):
  9011. * cdef __Pyx_memviewslice src, dst
  9012. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
  9013. *
  9014. * slice_copy(self, &src)
  9015. */
  9016. __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
  9017. /* "View.MemoryView":647
  9018. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  9019. *
  9020. * slice_copy(self, &src) # <<<<<<<<<<<<<<
  9021. * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
  9022. * self.view.itemsize,
  9023. */
  9024. __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
  9025. /* "View.MemoryView":648
  9026. *
  9027. * slice_copy(self, &src)
  9028. * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
  9029. * self.view.itemsize,
  9030. * flags|PyBUF_F_CONTIGUOUS,
  9031. */
  9032. __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
  9033. __pyx_v_dst = __pyx_t_1;
  9034. /* "View.MemoryView":653
  9035. * self.dtype_is_object)
  9036. *
  9037. * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
  9038. *
  9039. *
  9040. */
  9041. __Pyx_XDECREF(__pyx_r);
  9042. __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
  9043. __Pyx_GOTREF(__pyx_t_2);
  9044. __pyx_r = __pyx_t_2;
  9045. __pyx_t_2 = 0;
  9046. goto __pyx_L0;
  9047. /* "View.MemoryView":643
  9048. * return memoryview_copy_from_slice(self, &mslice)
  9049. *
  9050. * def copy_fortran(self): # <<<<<<<<<<<<<<
  9051. * cdef __Pyx_memviewslice src, dst
  9052. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  9053. */
  9054. /* function exit code */
  9055. __pyx_L1_error:;
  9056. __Pyx_XDECREF(__pyx_t_2);
  9057. __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9058. __pyx_r = NULL;
  9059. __pyx_L0:;
  9060. __Pyx_XGIVEREF(__pyx_r);
  9061. __Pyx_RefNannyFinishContext();
  9062. return __pyx_r;
  9063. }
  9064. /* "(tree fragment)":1
  9065. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  9066. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9067. * def __setstate_cython__(self, __pyx_state):
  9068. */
  9069. /* Python wrapper */
  9070. static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  9071. static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  9072. PyObject *__pyx_r = 0;
  9073. __Pyx_RefNannyDeclarations
  9074. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  9075. __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  9076. /* function exit code */
  9077. __Pyx_RefNannyFinishContext();
  9078. return __pyx_r;
  9079. }
  9080. static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  9081. PyObject *__pyx_r = NULL;
  9082. __Pyx_RefNannyDeclarations
  9083. PyObject *__pyx_t_1 = NULL;
  9084. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  9085. /* "(tree fragment)":2
  9086. * def __reduce_cython__(self):
  9087. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  9088. * def __setstate_cython__(self, __pyx_state):
  9089. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9090. */
  9091. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  9092. __Pyx_GOTREF(__pyx_t_1);
  9093. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  9094. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9095. __PYX_ERR(1, 2, __pyx_L1_error)
  9096. /* "(tree fragment)":1
  9097. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  9098. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9099. * def __setstate_cython__(self, __pyx_state):
  9100. */
  9101. /* function exit code */
  9102. __pyx_L1_error:;
  9103. __Pyx_XDECREF(__pyx_t_1);
  9104. __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9105. __pyx_r = NULL;
  9106. __Pyx_XGIVEREF(__pyx_r);
  9107. __Pyx_RefNannyFinishContext();
  9108. return __pyx_r;
  9109. }
  9110. /* "(tree fragment)":3
  9111. * def __reduce_cython__(self):
  9112. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9113. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  9114. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9115. */
  9116. /* Python wrapper */
  9117. static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  9118. static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  9119. PyObject *__pyx_r = 0;
  9120. __Pyx_RefNannyDeclarations
  9121. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  9122. __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  9123. /* function exit code */
  9124. __Pyx_RefNannyFinishContext();
  9125. return __pyx_r;
  9126. }
  9127. static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  9128. PyObject *__pyx_r = NULL;
  9129. __Pyx_RefNannyDeclarations
  9130. PyObject *__pyx_t_1 = NULL;
  9131. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  9132. /* "(tree fragment)":4
  9133. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9134. * def __setstate_cython__(self, __pyx_state):
  9135. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  9136. */
  9137. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  9138. __Pyx_GOTREF(__pyx_t_1);
  9139. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  9140. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9141. __PYX_ERR(1, 4, __pyx_L1_error)
  9142. /* "(tree fragment)":3
  9143. * def __reduce_cython__(self):
  9144. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9145. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  9146. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  9147. */
  9148. /* function exit code */
  9149. __pyx_L1_error:;
  9150. __Pyx_XDECREF(__pyx_t_1);
  9151. __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9152. __pyx_r = NULL;
  9153. __Pyx_XGIVEREF(__pyx_r);
  9154. __Pyx_RefNannyFinishContext();
  9155. return __pyx_r;
  9156. }
  9157. /* "View.MemoryView":657
  9158. *
  9159. * @cname('__pyx_memoryview_new')
  9160. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
  9161. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9162. * result.typeinfo = typeinfo
  9163. */
  9164. static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  9165. struct __pyx_memoryview_obj *__pyx_v_result = 0;
  9166. PyObject *__pyx_r = NULL;
  9167. __Pyx_RefNannyDeclarations
  9168. PyObject *__pyx_t_1 = NULL;
  9169. PyObject *__pyx_t_2 = NULL;
  9170. PyObject *__pyx_t_3 = NULL;
  9171. __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
  9172. /* "View.MemoryView":658
  9173. * @cname('__pyx_memoryview_new')
  9174. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
  9175. * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
  9176. * result.typeinfo = typeinfo
  9177. * return result
  9178. */
  9179. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
  9180. __Pyx_GOTREF(__pyx_t_1);
  9181. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
  9182. __Pyx_GOTREF(__pyx_t_2);
  9183. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
  9184. __Pyx_GOTREF(__pyx_t_3);
  9185. __Pyx_INCREF(__pyx_v_o);
  9186. __Pyx_GIVEREF(__pyx_v_o);
  9187. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  9188. __Pyx_GIVEREF(__pyx_t_1);
  9189. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  9190. __Pyx_GIVEREF(__pyx_t_2);
  9191. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  9192. __pyx_t_1 = 0;
  9193. __pyx_t_2 = 0;
  9194. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
  9195. __Pyx_GOTREF(__pyx_t_2);
  9196. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9197. __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  9198. __pyx_t_2 = 0;
  9199. /* "View.MemoryView":659
  9200. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
  9201. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9202. * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
  9203. * return result
  9204. *
  9205. */
  9206. __pyx_v_result->typeinfo = __pyx_v_typeinfo;
  9207. /* "View.MemoryView":660
  9208. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9209. * result.typeinfo = typeinfo
  9210. * return result # <<<<<<<<<<<<<<
  9211. *
  9212. * @cname('__pyx_memoryview_check')
  9213. */
  9214. __Pyx_XDECREF(__pyx_r);
  9215. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  9216. __pyx_r = ((PyObject *)__pyx_v_result);
  9217. goto __pyx_L0;
  9218. /* "View.MemoryView":657
  9219. *
  9220. * @cname('__pyx_memoryview_new')
  9221. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
  9222. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  9223. * result.typeinfo = typeinfo
  9224. */
  9225. /* function exit code */
  9226. __pyx_L1_error:;
  9227. __Pyx_XDECREF(__pyx_t_1);
  9228. __Pyx_XDECREF(__pyx_t_2);
  9229. __Pyx_XDECREF(__pyx_t_3);
  9230. __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9231. __pyx_r = 0;
  9232. __pyx_L0:;
  9233. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  9234. __Pyx_XGIVEREF(__pyx_r);
  9235. __Pyx_RefNannyFinishContext();
  9236. return __pyx_r;
  9237. }
  9238. /* "View.MemoryView":663
  9239. *
  9240. * @cname('__pyx_memoryview_check')
  9241. * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
  9242. * return isinstance(o, memoryview)
  9243. *
  9244. */
  9245. static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  9246. int __pyx_r;
  9247. __Pyx_RefNannyDeclarations
  9248. int __pyx_t_1;
  9249. __Pyx_RefNannySetupContext("memoryview_check", 0);
  9250. /* "View.MemoryView":664
  9251. * @cname('__pyx_memoryview_check')
  9252. * cdef inline bint memoryview_check(object o):
  9253. * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
  9254. *
  9255. * cdef tuple _unellipsify(object index, int ndim):
  9256. */
  9257. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
  9258. __pyx_r = __pyx_t_1;
  9259. goto __pyx_L0;
  9260. /* "View.MemoryView":663
  9261. *
  9262. * @cname('__pyx_memoryview_check')
  9263. * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
  9264. * return isinstance(o, memoryview)
  9265. *
  9266. */
  9267. /* function exit code */
  9268. __pyx_L0:;
  9269. __Pyx_RefNannyFinishContext();
  9270. return __pyx_r;
  9271. }
  9272. /* "View.MemoryView":666
  9273. * return isinstance(o, memoryview)
  9274. *
  9275. * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
  9276. * """
  9277. * Replace all ellipses with full slices and fill incomplete indices with
  9278. */
  9279. static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  9280. PyObject *__pyx_v_tup = NULL;
  9281. PyObject *__pyx_v_result = NULL;
  9282. int __pyx_v_have_slices;
  9283. int __pyx_v_seen_ellipsis;
  9284. CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  9285. PyObject *__pyx_v_item = NULL;
  9286. Py_ssize_t __pyx_v_nslices;
  9287. PyObject *__pyx_r = NULL;
  9288. __Pyx_RefNannyDeclarations
  9289. int __pyx_t_1;
  9290. int __pyx_t_2;
  9291. PyObject *__pyx_t_3 = NULL;
  9292. PyObject *__pyx_t_4 = NULL;
  9293. Py_ssize_t __pyx_t_5;
  9294. PyObject *(*__pyx_t_6)(PyObject *);
  9295. PyObject *__pyx_t_7 = NULL;
  9296. Py_ssize_t __pyx_t_8;
  9297. int __pyx_t_9;
  9298. int __pyx_t_10;
  9299. PyObject *__pyx_t_11 = NULL;
  9300. __Pyx_RefNannySetupContext("_unellipsify", 0);
  9301. /* "View.MemoryView":671
  9302. * full slices.
  9303. * """
  9304. * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
  9305. * tup = (index,)
  9306. * else:
  9307. */
  9308. __pyx_t_1 = PyTuple_Check(__pyx_v_index);
  9309. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  9310. if (__pyx_t_2) {
  9311. /* "View.MemoryView":672
  9312. * """
  9313. * if not isinstance(index, tuple):
  9314. * tup = (index,) # <<<<<<<<<<<<<<
  9315. * else:
  9316. * tup = index
  9317. */
  9318. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
  9319. __Pyx_GOTREF(__pyx_t_3);
  9320. __Pyx_INCREF(__pyx_v_index);
  9321. __Pyx_GIVEREF(__pyx_v_index);
  9322. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
  9323. __pyx_v_tup = __pyx_t_3;
  9324. __pyx_t_3 = 0;
  9325. /* "View.MemoryView":671
  9326. * full slices.
  9327. * """
  9328. * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
  9329. * tup = (index,)
  9330. * else:
  9331. */
  9332. goto __pyx_L3;
  9333. }
  9334. /* "View.MemoryView":674
  9335. * tup = (index,)
  9336. * else:
  9337. * tup = index # <<<<<<<<<<<<<<
  9338. *
  9339. * result = []
  9340. */
  9341. /*else*/ {
  9342. __Pyx_INCREF(__pyx_v_index);
  9343. __pyx_v_tup = __pyx_v_index;
  9344. }
  9345. __pyx_L3:;
  9346. /* "View.MemoryView":676
  9347. * tup = index
  9348. *
  9349. * result = [] # <<<<<<<<<<<<<<
  9350. * have_slices = False
  9351. * seen_ellipsis = False
  9352. */
  9353. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
  9354. __Pyx_GOTREF(__pyx_t_3);
  9355. __pyx_v_result = ((PyObject*)__pyx_t_3);
  9356. __pyx_t_3 = 0;
  9357. /* "View.MemoryView":677
  9358. *
  9359. * result = []
  9360. * have_slices = False # <<<<<<<<<<<<<<
  9361. * seen_ellipsis = False
  9362. * for idx, item in enumerate(tup):
  9363. */
  9364. __pyx_v_have_slices = 0;
  9365. /* "View.MemoryView":678
  9366. * result = []
  9367. * have_slices = False
  9368. * seen_ellipsis = False # <<<<<<<<<<<<<<
  9369. * for idx, item in enumerate(tup):
  9370. * if item is Ellipsis:
  9371. */
  9372. __pyx_v_seen_ellipsis = 0;
  9373. /* "View.MemoryView":679
  9374. * have_slices = False
  9375. * seen_ellipsis = False
  9376. * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
  9377. * if item is Ellipsis:
  9378. * if not seen_ellipsis:
  9379. */
  9380. __Pyx_INCREF(__pyx_int_0);
  9381. __pyx_t_3 = __pyx_int_0;
  9382. if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
  9383. __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  9384. __pyx_t_6 = NULL;
  9385. } else {
  9386. __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
  9387. __Pyx_GOTREF(__pyx_t_4);
  9388. __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
  9389. }
  9390. for (;;) {
  9391. if (likely(!__pyx_t_6)) {
  9392. if (likely(PyList_CheckExact(__pyx_t_4))) {
  9393. if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
  9394. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9395. __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
  9396. #else
  9397. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
  9398. __Pyx_GOTREF(__pyx_t_7);
  9399. #endif
  9400. } else {
  9401. if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
  9402. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9403. __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
  9404. #else
  9405. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
  9406. __Pyx_GOTREF(__pyx_t_7);
  9407. #endif
  9408. }
  9409. } else {
  9410. __pyx_t_7 = __pyx_t_6(__pyx_t_4);
  9411. if (unlikely(!__pyx_t_7)) {
  9412. PyObject* exc_type = PyErr_Occurred();
  9413. if (exc_type) {
  9414. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9415. else __PYX_ERR(1, 679, __pyx_L1_error)
  9416. }
  9417. break;
  9418. }
  9419. __Pyx_GOTREF(__pyx_t_7);
  9420. }
  9421. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
  9422. __pyx_t_7 = 0;
  9423. __Pyx_INCREF(__pyx_t_3);
  9424. __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
  9425. __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
  9426. __Pyx_GOTREF(__pyx_t_7);
  9427. __Pyx_DECREF(__pyx_t_3);
  9428. __pyx_t_3 = __pyx_t_7;
  9429. __pyx_t_7 = 0;
  9430. /* "View.MemoryView":680
  9431. * seen_ellipsis = False
  9432. * for idx, item in enumerate(tup):
  9433. * if item is Ellipsis: # <<<<<<<<<<<<<<
  9434. * if not seen_ellipsis:
  9435. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9436. */
  9437. __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
  9438. __pyx_t_1 = (__pyx_t_2 != 0);
  9439. if (__pyx_t_1) {
  9440. /* "View.MemoryView":681
  9441. * for idx, item in enumerate(tup):
  9442. * if item is Ellipsis:
  9443. * if not seen_ellipsis: # <<<<<<<<<<<<<<
  9444. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9445. * seen_ellipsis = True
  9446. */
  9447. __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
  9448. if (__pyx_t_1) {
  9449. /* "View.MemoryView":682
  9450. * if item is Ellipsis:
  9451. * if not seen_ellipsis:
  9452. * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
  9453. * seen_ellipsis = True
  9454. * else:
  9455. */
  9456. __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
  9457. __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
  9458. __Pyx_GOTREF(__pyx_t_7);
  9459. { Py_ssize_t __pyx_temp;
  9460. for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
  9461. __Pyx_INCREF(__pyx_slice__15);
  9462. __Pyx_GIVEREF(__pyx_slice__15);
  9463. PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__15);
  9464. }
  9465. }
  9466. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
  9467. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9468. /* "View.MemoryView":683
  9469. * if not seen_ellipsis:
  9470. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9471. * seen_ellipsis = True # <<<<<<<<<<<<<<
  9472. * else:
  9473. * result.append(slice(None))
  9474. */
  9475. __pyx_v_seen_ellipsis = 1;
  9476. /* "View.MemoryView":681
  9477. * for idx, item in enumerate(tup):
  9478. * if item is Ellipsis:
  9479. * if not seen_ellipsis: # <<<<<<<<<<<<<<
  9480. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9481. * seen_ellipsis = True
  9482. */
  9483. goto __pyx_L7;
  9484. }
  9485. /* "View.MemoryView":685
  9486. * seen_ellipsis = True
  9487. * else:
  9488. * result.append(slice(None)) # <<<<<<<<<<<<<<
  9489. * have_slices = True
  9490. * else:
  9491. */
  9492. /*else*/ {
  9493. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__15); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
  9494. }
  9495. __pyx_L7:;
  9496. /* "View.MemoryView":686
  9497. * else:
  9498. * result.append(slice(None))
  9499. * have_slices = True # <<<<<<<<<<<<<<
  9500. * else:
  9501. * if not isinstance(item, slice) and not PyIndex_Check(item):
  9502. */
  9503. __pyx_v_have_slices = 1;
  9504. /* "View.MemoryView":680
  9505. * seen_ellipsis = False
  9506. * for idx, item in enumerate(tup):
  9507. * if item is Ellipsis: # <<<<<<<<<<<<<<
  9508. * if not seen_ellipsis:
  9509. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  9510. */
  9511. goto __pyx_L6;
  9512. }
  9513. /* "View.MemoryView":688
  9514. * have_slices = True
  9515. * else:
  9516. * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
  9517. * raise TypeError("Cannot index with type '%s'" % type(item))
  9518. *
  9519. */
  9520. /*else*/ {
  9521. __pyx_t_2 = PySlice_Check(__pyx_v_item);
  9522. __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
  9523. if (__pyx_t_10) {
  9524. } else {
  9525. __pyx_t_1 = __pyx_t_10;
  9526. goto __pyx_L9_bool_binop_done;
  9527. }
  9528. __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
  9529. __pyx_t_1 = __pyx_t_10;
  9530. __pyx_L9_bool_binop_done:;
  9531. if (unlikely(__pyx_t_1)) {
  9532. /* "View.MemoryView":689
  9533. * else:
  9534. * if not isinstance(item, slice) and not PyIndex_Check(item):
  9535. * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
  9536. *
  9537. * have_slices = have_slices or isinstance(item, slice)
  9538. */
  9539. __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
  9540. __Pyx_GOTREF(__pyx_t_7);
  9541. __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
  9542. __Pyx_GOTREF(__pyx_t_11);
  9543. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9544. __Pyx_Raise(__pyx_t_11, 0, 0, 0);
  9545. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  9546. __PYX_ERR(1, 689, __pyx_L1_error)
  9547. /* "View.MemoryView":688
  9548. * have_slices = True
  9549. * else:
  9550. * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
  9551. * raise TypeError("Cannot index with type '%s'" % type(item))
  9552. *
  9553. */
  9554. }
  9555. /* "View.MemoryView":691
  9556. * raise TypeError("Cannot index with type '%s'" % type(item))
  9557. *
  9558. * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
  9559. * result.append(item)
  9560. *
  9561. */
  9562. __pyx_t_10 = (__pyx_v_have_slices != 0);
  9563. if (!__pyx_t_10) {
  9564. } else {
  9565. __pyx_t_1 = __pyx_t_10;
  9566. goto __pyx_L11_bool_binop_done;
  9567. }
  9568. __pyx_t_10 = PySlice_Check(__pyx_v_item);
  9569. __pyx_t_2 = (__pyx_t_10 != 0);
  9570. __pyx_t_1 = __pyx_t_2;
  9571. __pyx_L11_bool_binop_done:;
  9572. __pyx_v_have_slices = __pyx_t_1;
  9573. /* "View.MemoryView":692
  9574. *
  9575. * have_slices = have_slices or isinstance(item, slice)
  9576. * result.append(item) # <<<<<<<<<<<<<<
  9577. *
  9578. * nslices = ndim - len(result)
  9579. */
  9580. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
  9581. }
  9582. __pyx_L6:;
  9583. /* "View.MemoryView":679
  9584. * have_slices = False
  9585. * seen_ellipsis = False
  9586. * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
  9587. * if item is Ellipsis:
  9588. * if not seen_ellipsis:
  9589. */
  9590. }
  9591. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9592. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9593. /* "View.MemoryView":694
  9594. * result.append(item)
  9595. *
  9596. * nslices = ndim - len(result) # <<<<<<<<<<<<<<
  9597. * if nslices:
  9598. * result.extend([slice(None)] * nslices)
  9599. */
  9600. __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
  9601. __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
  9602. /* "View.MemoryView":695
  9603. *
  9604. * nslices = ndim - len(result)
  9605. * if nslices: # <<<<<<<<<<<<<<
  9606. * result.extend([slice(None)] * nslices)
  9607. *
  9608. */
  9609. __pyx_t_1 = (__pyx_v_nslices != 0);
  9610. if (__pyx_t_1) {
  9611. /* "View.MemoryView":696
  9612. * nslices = ndim - len(result)
  9613. * if nslices:
  9614. * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
  9615. *
  9616. * return have_slices or nslices, tuple(result)
  9617. */
  9618. __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
  9619. __Pyx_GOTREF(__pyx_t_3);
  9620. { Py_ssize_t __pyx_temp;
  9621. for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
  9622. __Pyx_INCREF(__pyx_slice__15);
  9623. __Pyx_GIVEREF(__pyx_slice__15);
  9624. PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__15);
  9625. }
  9626. }
  9627. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
  9628. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9629. /* "View.MemoryView":695
  9630. *
  9631. * nslices = ndim - len(result)
  9632. * if nslices: # <<<<<<<<<<<<<<
  9633. * result.extend([slice(None)] * nslices)
  9634. *
  9635. */
  9636. }
  9637. /* "View.MemoryView":698
  9638. * result.extend([slice(None)] * nslices)
  9639. *
  9640. * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
  9641. *
  9642. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9643. */
  9644. __Pyx_XDECREF(__pyx_r);
  9645. if (!__pyx_v_have_slices) {
  9646. } else {
  9647. __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
  9648. __Pyx_GOTREF(__pyx_t_4);
  9649. __pyx_t_3 = __pyx_t_4;
  9650. __pyx_t_4 = 0;
  9651. goto __pyx_L14_bool_binop_done;
  9652. }
  9653. __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
  9654. __Pyx_GOTREF(__pyx_t_4);
  9655. __pyx_t_3 = __pyx_t_4;
  9656. __pyx_t_4 = 0;
  9657. __pyx_L14_bool_binop_done:;
  9658. __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
  9659. __Pyx_GOTREF(__pyx_t_4);
  9660. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
  9661. __Pyx_GOTREF(__pyx_t_11);
  9662. __Pyx_GIVEREF(__pyx_t_3);
  9663. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  9664. __Pyx_GIVEREF(__pyx_t_4);
  9665. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  9666. __pyx_t_3 = 0;
  9667. __pyx_t_4 = 0;
  9668. __pyx_r = ((PyObject*)__pyx_t_11);
  9669. __pyx_t_11 = 0;
  9670. goto __pyx_L0;
  9671. /* "View.MemoryView":666
  9672. * return isinstance(o, memoryview)
  9673. *
  9674. * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
  9675. * """
  9676. * Replace all ellipses with full slices and fill incomplete indices with
  9677. */
  9678. /* function exit code */
  9679. __pyx_L1_error:;
  9680. __Pyx_XDECREF(__pyx_t_3);
  9681. __Pyx_XDECREF(__pyx_t_4);
  9682. __Pyx_XDECREF(__pyx_t_7);
  9683. __Pyx_XDECREF(__pyx_t_11);
  9684. __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9685. __pyx_r = 0;
  9686. __pyx_L0:;
  9687. __Pyx_XDECREF(__pyx_v_tup);
  9688. __Pyx_XDECREF(__pyx_v_result);
  9689. __Pyx_XDECREF(__pyx_v_idx);
  9690. __Pyx_XDECREF(__pyx_v_item);
  9691. __Pyx_XGIVEREF(__pyx_r);
  9692. __Pyx_RefNannyFinishContext();
  9693. return __pyx_r;
  9694. }
  9695. /* "View.MemoryView":700
  9696. * return have_slices or nslices, tuple(result)
  9697. *
  9698. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
  9699. * for suboffset in suboffsets[:ndim]:
  9700. * if suboffset >= 0:
  9701. */
  9702. static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  9703. Py_ssize_t __pyx_v_suboffset;
  9704. PyObject *__pyx_r = NULL;
  9705. __Pyx_RefNannyDeclarations
  9706. Py_ssize_t *__pyx_t_1;
  9707. Py_ssize_t *__pyx_t_2;
  9708. Py_ssize_t *__pyx_t_3;
  9709. int __pyx_t_4;
  9710. PyObject *__pyx_t_5 = NULL;
  9711. __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
  9712. /* "View.MemoryView":701
  9713. *
  9714. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9715. * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
  9716. * if suboffset >= 0:
  9717. * raise ValueError("Indirect dimensions not supported")
  9718. */
  9719. __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  9720. for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
  9721. __pyx_t_1 = __pyx_t_3;
  9722. __pyx_v_suboffset = (__pyx_t_1[0]);
  9723. /* "View.MemoryView":702
  9724. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9725. * for suboffset in suboffsets[:ndim]:
  9726. * if suboffset >= 0: # <<<<<<<<<<<<<<
  9727. * raise ValueError("Indirect dimensions not supported")
  9728. *
  9729. */
  9730. __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
  9731. if (unlikely(__pyx_t_4)) {
  9732. /* "View.MemoryView":703
  9733. * for suboffset in suboffsets[:ndim]:
  9734. * if suboffset >= 0:
  9735. * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
  9736. *
  9737. *
  9738. */
  9739. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
  9740. __Pyx_GOTREF(__pyx_t_5);
  9741. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  9742. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9743. __PYX_ERR(1, 703, __pyx_L1_error)
  9744. /* "View.MemoryView":702
  9745. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  9746. * for suboffset in suboffsets[:ndim]:
  9747. * if suboffset >= 0: # <<<<<<<<<<<<<<
  9748. * raise ValueError("Indirect dimensions not supported")
  9749. *
  9750. */
  9751. }
  9752. }
  9753. /* "View.MemoryView":700
  9754. * return have_slices or nslices, tuple(result)
  9755. *
  9756. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
  9757. * for suboffset in suboffsets[:ndim]:
  9758. * if suboffset >= 0:
  9759. */
  9760. /* function exit code */
  9761. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9762. goto __pyx_L0;
  9763. __pyx_L1_error:;
  9764. __Pyx_XDECREF(__pyx_t_5);
  9765. __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9766. __pyx_r = 0;
  9767. __pyx_L0:;
  9768. __Pyx_XGIVEREF(__pyx_r);
  9769. __Pyx_RefNannyFinishContext();
  9770. return __pyx_r;
  9771. }
  9772. /* "View.MemoryView":710
  9773. *
  9774. * @cname('__pyx_memview_slice')
  9775. * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
  9776. * cdef int new_ndim = 0, suboffset_dim = -1, dim
  9777. * cdef bint negative_step
  9778. */
  9779. static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  9780. int __pyx_v_new_ndim;
  9781. int __pyx_v_suboffset_dim;
  9782. int __pyx_v_dim;
  9783. __Pyx_memviewslice __pyx_v_src;
  9784. __Pyx_memviewslice __pyx_v_dst;
  9785. __Pyx_memviewslice *__pyx_v_p_src;
  9786. struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  9787. __Pyx_memviewslice *__pyx_v_p_dst;
  9788. int *__pyx_v_p_suboffset_dim;
  9789. Py_ssize_t __pyx_v_start;
  9790. Py_ssize_t __pyx_v_stop;
  9791. Py_ssize_t __pyx_v_step;
  9792. int __pyx_v_have_start;
  9793. int __pyx_v_have_stop;
  9794. int __pyx_v_have_step;
  9795. PyObject *__pyx_v_index = NULL;
  9796. struct __pyx_memoryview_obj *__pyx_r = NULL;
  9797. __Pyx_RefNannyDeclarations
  9798. int __pyx_t_1;
  9799. int __pyx_t_2;
  9800. PyObject *__pyx_t_3 = NULL;
  9801. struct __pyx_memoryview_obj *__pyx_t_4;
  9802. char *__pyx_t_5;
  9803. int __pyx_t_6;
  9804. Py_ssize_t __pyx_t_7;
  9805. PyObject *(*__pyx_t_8)(PyObject *);
  9806. PyObject *__pyx_t_9 = NULL;
  9807. Py_ssize_t __pyx_t_10;
  9808. int __pyx_t_11;
  9809. Py_ssize_t __pyx_t_12;
  9810. __Pyx_RefNannySetupContext("memview_slice", 0);
  9811. /* "View.MemoryView":711
  9812. * @cname('__pyx_memview_slice')
  9813. * cdef memoryview memview_slice(memoryview memview, object indices):
  9814. * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
  9815. * cdef bint negative_step
  9816. * cdef __Pyx_memviewslice src, dst
  9817. */
  9818. __pyx_v_new_ndim = 0;
  9819. __pyx_v_suboffset_dim = -1;
  9820. /* "View.MemoryView":718
  9821. *
  9822. *
  9823. * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
  9824. *
  9825. * cdef _memoryviewslice memviewsliceobj
  9826. */
  9827. (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
  9828. /* "View.MemoryView":722
  9829. * cdef _memoryviewslice memviewsliceobj
  9830. *
  9831. * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
  9832. *
  9833. * if isinstance(memview, _memoryviewslice):
  9834. */
  9835. #ifndef CYTHON_WITHOUT_ASSERTIONS
  9836. if (unlikely(!Py_OptimizeFlag)) {
  9837. if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
  9838. PyErr_SetNone(PyExc_AssertionError);
  9839. __PYX_ERR(1, 722, __pyx_L1_error)
  9840. }
  9841. }
  9842. #endif
  9843. /* "View.MemoryView":724
  9844. * assert memview.view.ndim > 0
  9845. *
  9846. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  9847. * memviewsliceobj = memview
  9848. * p_src = &memviewsliceobj.from_slice
  9849. */
  9850. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  9851. __pyx_t_2 = (__pyx_t_1 != 0);
  9852. if (__pyx_t_2) {
  9853. /* "View.MemoryView":725
  9854. *
  9855. * if isinstance(memview, _memoryviewslice):
  9856. * memviewsliceobj = memview # <<<<<<<<<<<<<<
  9857. * p_src = &memviewsliceobj.from_slice
  9858. * else:
  9859. */
  9860. if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
  9861. __pyx_t_3 = ((PyObject *)__pyx_v_memview);
  9862. __Pyx_INCREF(__pyx_t_3);
  9863. __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
  9864. __pyx_t_3 = 0;
  9865. /* "View.MemoryView":726
  9866. * if isinstance(memview, _memoryviewslice):
  9867. * memviewsliceobj = memview
  9868. * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
  9869. * else:
  9870. * slice_copy(memview, &src)
  9871. */
  9872. __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
  9873. /* "View.MemoryView":724
  9874. * assert memview.view.ndim > 0
  9875. *
  9876. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  9877. * memviewsliceobj = memview
  9878. * p_src = &memviewsliceobj.from_slice
  9879. */
  9880. goto __pyx_L3;
  9881. }
  9882. /* "View.MemoryView":728
  9883. * p_src = &memviewsliceobj.from_slice
  9884. * else:
  9885. * slice_copy(memview, &src) # <<<<<<<<<<<<<<
  9886. * p_src = &src
  9887. *
  9888. */
  9889. /*else*/ {
  9890. __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
  9891. /* "View.MemoryView":729
  9892. * else:
  9893. * slice_copy(memview, &src)
  9894. * p_src = &src # <<<<<<<<<<<<<<
  9895. *
  9896. *
  9897. */
  9898. __pyx_v_p_src = (&__pyx_v_src);
  9899. }
  9900. __pyx_L3:;
  9901. /* "View.MemoryView":735
  9902. *
  9903. *
  9904. * dst.memview = p_src.memview # <<<<<<<<<<<<<<
  9905. * dst.data = p_src.data
  9906. *
  9907. */
  9908. __pyx_t_4 = __pyx_v_p_src->memview;
  9909. __pyx_v_dst.memview = __pyx_t_4;
  9910. /* "View.MemoryView":736
  9911. *
  9912. * dst.memview = p_src.memview
  9913. * dst.data = p_src.data # <<<<<<<<<<<<<<
  9914. *
  9915. *
  9916. */
  9917. __pyx_t_5 = __pyx_v_p_src->data;
  9918. __pyx_v_dst.data = __pyx_t_5;
  9919. /* "View.MemoryView":741
  9920. *
  9921. *
  9922. * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
  9923. * cdef int *p_suboffset_dim = &suboffset_dim
  9924. * cdef Py_ssize_t start, stop, step
  9925. */
  9926. __pyx_v_p_dst = (&__pyx_v_dst);
  9927. /* "View.MemoryView":742
  9928. *
  9929. * cdef __Pyx_memviewslice *p_dst = &dst
  9930. * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
  9931. * cdef Py_ssize_t start, stop, step
  9932. * cdef bint have_start, have_stop, have_step
  9933. */
  9934. __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
  9935. /* "View.MemoryView":746
  9936. * cdef bint have_start, have_stop, have_step
  9937. *
  9938. * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
  9939. * if PyIndex_Check(index):
  9940. * slice_memviewslice(
  9941. */
  9942. __pyx_t_6 = 0;
  9943. if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
  9944. __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
  9945. __pyx_t_8 = NULL;
  9946. } else {
  9947. __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
  9948. __Pyx_GOTREF(__pyx_t_3);
  9949. __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
  9950. }
  9951. for (;;) {
  9952. if (likely(!__pyx_t_8)) {
  9953. if (likely(PyList_CheckExact(__pyx_t_3))) {
  9954. if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
  9955. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9956. __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
  9957. #else
  9958. __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
  9959. __Pyx_GOTREF(__pyx_t_9);
  9960. #endif
  9961. } else {
  9962. if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  9963. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9964. __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
  9965. #else
  9966. __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
  9967. __Pyx_GOTREF(__pyx_t_9);
  9968. #endif
  9969. }
  9970. } else {
  9971. __pyx_t_9 = __pyx_t_8(__pyx_t_3);
  9972. if (unlikely(!__pyx_t_9)) {
  9973. PyObject* exc_type = PyErr_Occurred();
  9974. if (exc_type) {
  9975. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  9976. else __PYX_ERR(1, 746, __pyx_L1_error)
  9977. }
  9978. break;
  9979. }
  9980. __Pyx_GOTREF(__pyx_t_9);
  9981. }
  9982. __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
  9983. __pyx_t_9 = 0;
  9984. __pyx_v_dim = __pyx_t_6;
  9985. __pyx_t_6 = (__pyx_t_6 + 1);
  9986. /* "View.MemoryView":747
  9987. *
  9988. * for dim, index in enumerate(indices):
  9989. * if PyIndex_Check(index): # <<<<<<<<<<<<<<
  9990. * slice_memviewslice(
  9991. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  9992. */
  9993. __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
  9994. if (__pyx_t_2) {
  9995. /* "View.MemoryView":751
  9996. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  9997. * dim, new_ndim, p_suboffset_dim,
  9998. * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
  9999. * 0, 0, 0, # have_{start,stop,step}
  10000. * False)
  10001. */
  10002. __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
  10003. /* "View.MemoryView":748
  10004. * for dim, index in enumerate(indices):
  10005. * if PyIndex_Check(index):
  10006. * slice_memviewslice( # <<<<<<<<<<<<<<
  10007. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  10008. * dim, new_ndim, p_suboffset_dim,
  10009. */
  10010. __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
  10011. /* "View.MemoryView":747
  10012. *
  10013. * for dim, index in enumerate(indices):
  10014. * if PyIndex_Check(index): # <<<<<<<<<<<<<<
  10015. * slice_memviewslice(
  10016. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  10017. */
  10018. goto __pyx_L6;
  10019. }
  10020. /* "View.MemoryView":754
  10021. * 0, 0, 0, # have_{start,stop,step}
  10022. * False)
  10023. * elif index is None: # <<<<<<<<<<<<<<
  10024. * p_dst.shape[new_ndim] = 1
  10025. * p_dst.strides[new_ndim] = 0
  10026. */
  10027. __pyx_t_2 = (__pyx_v_index == Py_None);
  10028. __pyx_t_1 = (__pyx_t_2 != 0);
  10029. if (__pyx_t_1) {
  10030. /* "View.MemoryView":755
  10031. * False)
  10032. * elif index is None:
  10033. * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
  10034. * p_dst.strides[new_ndim] = 0
  10035. * p_dst.suboffsets[new_ndim] = -1
  10036. */
  10037. (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
  10038. /* "View.MemoryView":756
  10039. * elif index is None:
  10040. * p_dst.shape[new_ndim] = 1
  10041. * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
  10042. * p_dst.suboffsets[new_ndim] = -1
  10043. * new_ndim += 1
  10044. */
  10045. (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
  10046. /* "View.MemoryView":757
  10047. * p_dst.shape[new_ndim] = 1
  10048. * p_dst.strides[new_ndim] = 0
  10049. * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
  10050. * new_ndim += 1
  10051. * else:
  10052. */
  10053. (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
  10054. /* "View.MemoryView":758
  10055. * p_dst.strides[new_ndim] = 0
  10056. * p_dst.suboffsets[new_ndim] = -1
  10057. * new_ndim += 1 # <<<<<<<<<<<<<<
  10058. * else:
  10059. * start = index.start or 0
  10060. */
  10061. __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
  10062. /* "View.MemoryView":754
  10063. * 0, 0, 0, # have_{start,stop,step}
  10064. * False)
  10065. * elif index is None: # <<<<<<<<<<<<<<
  10066. * p_dst.shape[new_ndim] = 1
  10067. * p_dst.strides[new_ndim] = 0
  10068. */
  10069. goto __pyx_L6;
  10070. }
  10071. /* "View.MemoryView":760
  10072. * new_ndim += 1
  10073. * else:
  10074. * start = index.start or 0 # <<<<<<<<<<<<<<
  10075. * stop = index.stop or 0
  10076. * step = index.step or 0
  10077. */
  10078. /*else*/ {
  10079. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
  10080. __Pyx_GOTREF(__pyx_t_9);
  10081. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
  10082. if (!__pyx_t_1) {
  10083. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10084. } else {
  10085. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
  10086. __pyx_t_10 = __pyx_t_12;
  10087. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10088. goto __pyx_L7_bool_binop_done;
  10089. }
  10090. __pyx_t_10 = 0;
  10091. __pyx_L7_bool_binop_done:;
  10092. __pyx_v_start = __pyx_t_10;
  10093. /* "View.MemoryView":761
  10094. * else:
  10095. * start = index.start or 0
  10096. * stop = index.stop or 0 # <<<<<<<<<<<<<<
  10097. * step = index.step or 0
  10098. *
  10099. */
  10100. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
  10101. __Pyx_GOTREF(__pyx_t_9);
  10102. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
  10103. if (!__pyx_t_1) {
  10104. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10105. } else {
  10106. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
  10107. __pyx_t_10 = __pyx_t_12;
  10108. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10109. goto __pyx_L9_bool_binop_done;
  10110. }
  10111. __pyx_t_10 = 0;
  10112. __pyx_L9_bool_binop_done:;
  10113. __pyx_v_stop = __pyx_t_10;
  10114. /* "View.MemoryView":762
  10115. * start = index.start or 0
  10116. * stop = index.stop or 0
  10117. * step = index.step or 0 # <<<<<<<<<<<<<<
  10118. *
  10119. * have_start = index.start is not None
  10120. */
  10121. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
  10122. __Pyx_GOTREF(__pyx_t_9);
  10123. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
  10124. if (!__pyx_t_1) {
  10125. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10126. } else {
  10127. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
  10128. __pyx_t_10 = __pyx_t_12;
  10129. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10130. goto __pyx_L11_bool_binop_done;
  10131. }
  10132. __pyx_t_10 = 0;
  10133. __pyx_L11_bool_binop_done:;
  10134. __pyx_v_step = __pyx_t_10;
  10135. /* "View.MemoryView":764
  10136. * step = index.step or 0
  10137. *
  10138. * have_start = index.start is not None # <<<<<<<<<<<<<<
  10139. * have_stop = index.stop is not None
  10140. * have_step = index.step is not None
  10141. */
  10142. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
  10143. __Pyx_GOTREF(__pyx_t_9);
  10144. __pyx_t_1 = (__pyx_t_9 != Py_None);
  10145. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10146. __pyx_v_have_start = __pyx_t_1;
  10147. /* "View.MemoryView":765
  10148. *
  10149. * have_start = index.start is not None
  10150. * have_stop = index.stop is not None # <<<<<<<<<<<<<<
  10151. * have_step = index.step is not None
  10152. *
  10153. */
  10154. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
  10155. __Pyx_GOTREF(__pyx_t_9);
  10156. __pyx_t_1 = (__pyx_t_9 != Py_None);
  10157. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10158. __pyx_v_have_stop = __pyx_t_1;
  10159. /* "View.MemoryView":766
  10160. * have_start = index.start is not None
  10161. * have_stop = index.stop is not None
  10162. * have_step = index.step is not None # <<<<<<<<<<<<<<
  10163. *
  10164. * slice_memviewslice(
  10165. */
  10166. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
  10167. __Pyx_GOTREF(__pyx_t_9);
  10168. __pyx_t_1 = (__pyx_t_9 != Py_None);
  10169. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  10170. __pyx_v_have_step = __pyx_t_1;
  10171. /* "View.MemoryView":768
  10172. * have_step = index.step is not None
  10173. *
  10174. * slice_memviewslice( # <<<<<<<<<<<<<<
  10175. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  10176. * dim, new_ndim, p_suboffset_dim,
  10177. */
  10178. __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
  10179. /* "View.MemoryView":774
  10180. * have_start, have_stop, have_step,
  10181. * True)
  10182. * new_ndim += 1 # <<<<<<<<<<<<<<
  10183. *
  10184. * if isinstance(memview, _memoryviewslice):
  10185. */
  10186. __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
  10187. }
  10188. __pyx_L6:;
  10189. /* "View.MemoryView":746
  10190. * cdef bint have_start, have_stop, have_step
  10191. *
  10192. * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
  10193. * if PyIndex_Check(index):
  10194. * slice_memviewslice(
  10195. */
  10196. }
  10197. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10198. /* "View.MemoryView":776
  10199. * new_ndim += 1
  10200. *
  10201. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  10202. * return memoryview_fromslice(dst, new_ndim,
  10203. * memviewsliceobj.to_object_func,
  10204. */
  10205. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  10206. __pyx_t_2 = (__pyx_t_1 != 0);
  10207. if (__pyx_t_2) {
  10208. /* "View.MemoryView":777
  10209. *
  10210. * if isinstance(memview, _memoryviewslice):
  10211. * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
  10212. * memviewsliceobj.to_object_func,
  10213. * memviewsliceobj.to_dtype_func,
  10214. */
  10215. __Pyx_XDECREF(((PyObject *)__pyx_r));
  10216. /* "View.MemoryView":778
  10217. * if isinstance(memview, _memoryviewslice):
  10218. * return memoryview_fromslice(dst, new_ndim,
  10219. * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
  10220. * memviewsliceobj.to_dtype_func,
  10221. * memview.dtype_is_object)
  10222. */
  10223. if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
  10224. /* "View.MemoryView":779
  10225. * return memoryview_fromslice(dst, new_ndim,
  10226. * memviewsliceobj.to_object_func,
  10227. * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
  10228. * memview.dtype_is_object)
  10229. * else:
  10230. */
  10231. if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
  10232. /* "View.MemoryView":777
  10233. *
  10234. * if isinstance(memview, _memoryviewslice):
  10235. * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
  10236. * memviewsliceobj.to_object_func,
  10237. * memviewsliceobj.to_dtype_func,
  10238. */
  10239. __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
  10240. __Pyx_GOTREF(__pyx_t_3);
  10241. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
  10242. __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
  10243. __pyx_t_3 = 0;
  10244. goto __pyx_L0;
  10245. /* "View.MemoryView":776
  10246. * new_ndim += 1
  10247. *
  10248. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  10249. * return memoryview_fromslice(dst, new_ndim,
  10250. * memviewsliceobj.to_object_func,
  10251. */
  10252. }
  10253. /* "View.MemoryView":782
  10254. * memview.dtype_is_object)
  10255. * else:
  10256. * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
  10257. * memview.dtype_is_object)
  10258. *
  10259. */
  10260. /*else*/ {
  10261. __Pyx_XDECREF(((PyObject *)__pyx_r));
  10262. /* "View.MemoryView":783
  10263. * else:
  10264. * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  10265. * memview.dtype_is_object) # <<<<<<<<<<<<<<
  10266. *
  10267. *
  10268. */
  10269. __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
  10270. __Pyx_GOTREF(__pyx_t_3);
  10271. /* "View.MemoryView":782
  10272. * memview.dtype_is_object)
  10273. * else:
  10274. * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
  10275. * memview.dtype_is_object)
  10276. *
  10277. */
  10278. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
  10279. __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
  10280. __pyx_t_3 = 0;
  10281. goto __pyx_L0;
  10282. }
  10283. /* "View.MemoryView":710
  10284. *
  10285. * @cname('__pyx_memview_slice')
  10286. * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
  10287. * cdef int new_ndim = 0, suboffset_dim = -1, dim
  10288. * cdef bint negative_step
  10289. */
  10290. /* function exit code */
  10291. __pyx_L1_error:;
  10292. __Pyx_XDECREF(__pyx_t_3);
  10293. __Pyx_XDECREF(__pyx_t_9);
  10294. __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10295. __pyx_r = 0;
  10296. __pyx_L0:;
  10297. __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  10298. __Pyx_XDECREF(__pyx_v_index);
  10299. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  10300. __Pyx_RefNannyFinishContext();
  10301. return __pyx_r;
  10302. }
  10303. /* "View.MemoryView":807
  10304. *
  10305. * @cname('__pyx_memoryview_slice_memviewslice')
  10306. * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
  10307. * __Pyx_memviewslice *dst,
  10308. * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
  10309. */
  10310. static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
  10311. Py_ssize_t __pyx_v_new_shape;
  10312. int __pyx_v_negative_step;
  10313. int __pyx_r;
  10314. int __pyx_t_1;
  10315. int __pyx_t_2;
  10316. int __pyx_t_3;
  10317. /* "View.MemoryView":827
  10318. * cdef bint negative_step
  10319. *
  10320. * if not is_slice: # <<<<<<<<<<<<<<
  10321. *
  10322. * if start < 0:
  10323. */
  10324. __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  10325. if (__pyx_t_1) {
  10326. /* "View.MemoryView":829
  10327. * if not is_slice:
  10328. *
  10329. * if start < 0: # <<<<<<<<<<<<<<
  10330. * start += shape
  10331. * if not 0 <= start < shape:
  10332. */
  10333. __pyx_t_1 = ((__pyx_v_start < 0) != 0);
  10334. if (__pyx_t_1) {
  10335. /* "View.MemoryView":830
  10336. *
  10337. * if start < 0:
  10338. * start += shape # <<<<<<<<<<<<<<
  10339. * if not 0 <= start < shape:
  10340. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  10341. */
  10342. __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
  10343. /* "View.MemoryView":829
  10344. * if not is_slice:
  10345. *
  10346. * if start < 0: # <<<<<<<<<<<<<<
  10347. * start += shape
  10348. * if not 0 <= start < shape:
  10349. */
  10350. }
  10351. /* "View.MemoryView":831
  10352. * if start < 0:
  10353. * start += shape
  10354. * if not 0 <= start < shape: # <<<<<<<<<<<<<<
  10355. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  10356. * else:
  10357. */
  10358. __pyx_t_1 = (0 <= __pyx_v_start);
  10359. if (__pyx_t_1) {
  10360. __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
  10361. }
  10362. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  10363. if (__pyx_t_2) {
  10364. /* "View.MemoryView":832
  10365. * start += shape
  10366. * if not 0 <= start < shape:
  10367. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
  10368. * else:
  10369. *
  10370. */
  10371. __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
  10372. /* "View.MemoryView":831
  10373. * if start < 0:
  10374. * start += shape
  10375. * if not 0 <= start < shape: # <<<<<<<<<<<<<<
  10376. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  10377. * else:
  10378. */
  10379. }
  10380. /* "View.MemoryView":827
  10381. * cdef bint negative_step
  10382. *
  10383. * if not is_slice: # <<<<<<<<<<<<<<
  10384. *
  10385. * if start < 0:
  10386. */
  10387. goto __pyx_L3;
  10388. }
  10389. /* "View.MemoryView":835
  10390. * else:
  10391. *
  10392. * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
  10393. *
  10394. * if have_step and step == 0:
  10395. */
  10396. /*else*/ {
  10397. __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
  10398. if (__pyx_t_1) {
  10399. } else {
  10400. __pyx_t_2 = __pyx_t_1;
  10401. goto __pyx_L6_bool_binop_done;
  10402. }
  10403. __pyx_t_1 = ((__pyx_v_step < 0) != 0);
  10404. __pyx_t_2 = __pyx_t_1;
  10405. __pyx_L6_bool_binop_done:;
  10406. __pyx_v_negative_step = __pyx_t_2;
  10407. /* "View.MemoryView":837
  10408. * negative_step = have_step != 0 and step < 0
  10409. *
  10410. * if have_step and step == 0: # <<<<<<<<<<<<<<
  10411. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  10412. *
  10413. */
  10414. __pyx_t_1 = (__pyx_v_have_step != 0);
  10415. if (__pyx_t_1) {
  10416. } else {
  10417. __pyx_t_2 = __pyx_t_1;
  10418. goto __pyx_L9_bool_binop_done;
  10419. }
  10420. __pyx_t_1 = ((__pyx_v_step == 0) != 0);
  10421. __pyx_t_2 = __pyx_t_1;
  10422. __pyx_L9_bool_binop_done:;
  10423. if (__pyx_t_2) {
  10424. /* "View.MemoryView":838
  10425. *
  10426. * if have_step and step == 0:
  10427. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
  10428. *
  10429. *
  10430. */
  10431. __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
  10432. /* "View.MemoryView":837
  10433. * negative_step = have_step != 0 and step < 0
  10434. *
  10435. * if have_step and step == 0: # <<<<<<<<<<<<<<
  10436. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  10437. *
  10438. */
  10439. }
  10440. /* "View.MemoryView":841
  10441. *
  10442. *
  10443. * if have_start: # <<<<<<<<<<<<<<
  10444. * if start < 0:
  10445. * start += shape
  10446. */
  10447. __pyx_t_2 = (__pyx_v_have_start != 0);
  10448. if (__pyx_t_2) {
  10449. /* "View.MemoryView":842
  10450. *
  10451. * if have_start:
  10452. * if start < 0: # <<<<<<<<<<<<<<
  10453. * start += shape
  10454. * if start < 0:
  10455. */
  10456. __pyx_t_2 = ((__pyx_v_start < 0) != 0);
  10457. if (__pyx_t_2) {
  10458. /* "View.MemoryView":843
  10459. * if have_start:
  10460. * if start < 0:
  10461. * start += shape # <<<<<<<<<<<<<<
  10462. * if start < 0:
  10463. * start = 0
  10464. */
  10465. __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
  10466. /* "View.MemoryView":844
  10467. * if start < 0:
  10468. * start += shape
  10469. * if start < 0: # <<<<<<<<<<<<<<
  10470. * start = 0
  10471. * elif start >= shape:
  10472. */
  10473. __pyx_t_2 = ((__pyx_v_start < 0) != 0);
  10474. if (__pyx_t_2) {
  10475. /* "View.MemoryView":845
  10476. * start += shape
  10477. * if start < 0:
  10478. * start = 0 # <<<<<<<<<<<<<<
  10479. * elif start >= shape:
  10480. * if negative_step:
  10481. */
  10482. __pyx_v_start = 0;
  10483. /* "View.MemoryView":844
  10484. * if start < 0:
  10485. * start += shape
  10486. * if start < 0: # <<<<<<<<<<<<<<
  10487. * start = 0
  10488. * elif start >= shape:
  10489. */
  10490. }
  10491. /* "View.MemoryView":842
  10492. *
  10493. * if have_start:
  10494. * if start < 0: # <<<<<<<<<<<<<<
  10495. * start += shape
  10496. * if start < 0:
  10497. */
  10498. goto __pyx_L12;
  10499. }
  10500. /* "View.MemoryView":846
  10501. * if start < 0:
  10502. * start = 0
  10503. * elif start >= shape: # <<<<<<<<<<<<<<
  10504. * if negative_step:
  10505. * start = shape - 1
  10506. */
  10507. __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
  10508. if (__pyx_t_2) {
  10509. /* "View.MemoryView":847
  10510. * start = 0
  10511. * elif start >= shape:
  10512. * if negative_step: # <<<<<<<<<<<<<<
  10513. * start = shape - 1
  10514. * else:
  10515. */
  10516. __pyx_t_2 = (__pyx_v_negative_step != 0);
  10517. if (__pyx_t_2) {
  10518. /* "View.MemoryView":848
  10519. * elif start >= shape:
  10520. * if negative_step:
  10521. * start = shape - 1 # <<<<<<<<<<<<<<
  10522. * else:
  10523. * start = shape
  10524. */
  10525. __pyx_v_start = (__pyx_v_shape - 1);
  10526. /* "View.MemoryView":847
  10527. * start = 0
  10528. * elif start >= shape:
  10529. * if negative_step: # <<<<<<<<<<<<<<
  10530. * start = shape - 1
  10531. * else:
  10532. */
  10533. goto __pyx_L14;
  10534. }
  10535. /* "View.MemoryView":850
  10536. * start = shape - 1
  10537. * else:
  10538. * start = shape # <<<<<<<<<<<<<<
  10539. * else:
  10540. * if negative_step:
  10541. */
  10542. /*else*/ {
  10543. __pyx_v_start = __pyx_v_shape;
  10544. }
  10545. __pyx_L14:;
  10546. /* "View.MemoryView":846
  10547. * if start < 0:
  10548. * start = 0
  10549. * elif start >= shape: # <<<<<<<<<<<<<<
  10550. * if negative_step:
  10551. * start = shape - 1
  10552. */
  10553. }
  10554. __pyx_L12:;
  10555. /* "View.MemoryView":841
  10556. *
  10557. *
  10558. * if have_start: # <<<<<<<<<<<<<<
  10559. * if start < 0:
  10560. * start += shape
  10561. */
  10562. goto __pyx_L11;
  10563. }
  10564. /* "View.MemoryView":852
  10565. * start = shape
  10566. * else:
  10567. * if negative_step: # <<<<<<<<<<<<<<
  10568. * start = shape - 1
  10569. * else:
  10570. */
  10571. /*else*/ {
  10572. __pyx_t_2 = (__pyx_v_negative_step != 0);
  10573. if (__pyx_t_2) {
  10574. /* "View.MemoryView":853
  10575. * else:
  10576. * if negative_step:
  10577. * start = shape - 1 # <<<<<<<<<<<<<<
  10578. * else:
  10579. * start = 0
  10580. */
  10581. __pyx_v_start = (__pyx_v_shape - 1);
  10582. /* "View.MemoryView":852
  10583. * start = shape
  10584. * else:
  10585. * if negative_step: # <<<<<<<<<<<<<<
  10586. * start = shape - 1
  10587. * else:
  10588. */
  10589. goto __pyx_L15;
  10590. }
  10591. /* "View.MemoryView":855
  10592. * start = shape - 1
  10593. * else:
  10594. * start = 0 # <<<<<<<<<<<<<<
  10595. *
  10596. * if have_stop:
  10597. */
  10598. /*else*/ {
  10599. __pyx_v_start = 0;
  10600. }
  10601. __pyx_L15:;
  10602. }
  10603. __pyx_L11:;
  10604. /* "View.MemoryView":857
  10605. * start = 0
  10606. *
  10607. * if have_stop: # <<<<<<<<<<<<<<
  10608. * if stop < 0:
  10609. * stop += shape
  10610. */
  10611. __pyx_t_2 = (__pyx_v_have_stop != 0);
  10612. if (__pyx_t_2) {
  10613. /* "View.MemoryView":858
  10614. *
  10615. * if have_stop:
  10616. * if stop < 0: # <<<<<<<<<<<<<<
  10617. * stop += shape
  10618. * if stop < 0:
  10619. */
  10620. __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
  10621. if (__pyx_t_2) {
  10622. /* "View.MemoryView":859
  10623. * if have_stop:
  10624. * if stop < 0:
  10625. * stop += shape # <<<<<<<<<<<<<<
  10626. * if stop < 0:
  10627. * stop = 0
  10628. */
  10629. __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
  10630. /* "View.MemoryView":860
  10631. * if stop < 0:
  10632. * stop += shape
  10633. * if stop < 0: # <<<<<<<<<<<<<<
  10634. * stop = 0
  10635. * elif stop > shape:
  10636. */
  10637. __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
  10638. if (__pyx_t_2) {
  10639. /* "View.MemoryView":861
  10640. * stop += shape
  10641. * if stop < 0:
  10642. * stop = 0 # <<<<<<<<<<<<<<
  10643. * elif stop > shape:
  10644. * stop = shape
  10645. */
  10646. __pyx_v_stop = 0;
  10647. /* "View.MemoryView":860
  10648. * if stop < 0:
  10649. * stop += shape
  10650. * if stop < 0: # <<<<<<<<<<<<<<
  10651. * stop = 0
  10652. * elif stop > shape:
  10653. */
  10654. }
  10655. /* "View.MemoryView":858
  10656. *
  10657. * if have_stop:
  10658. * if stop < 0: # <<<<<<<<<<<<<<
  10659. * stop += shape
  10660. * if stop < 0:
  10661. */
  10662. goto __pyx_L17;
  10663. }
  10664. /* "View.MemoryView":862
  10665. * if stop < 0:
  10666. * stop = 0
  10667. * elif stop > shape: # <<<<<<<<<<<<<<
  10668. * stop = shape
  10669. * else:
  10670. */
  10671. __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
  10672. if (__pyx_t_2) {
  10673. /* "View.MemoryView":863
  10674. * stop = 0
  10675. * elif stop > shape:
  10676. * stop = shape # <<<<<<<<<<<<<<
  10677. * else:
  10678. * if negative_step:
  10679. */
  10680. __pyx_v_stop = __pyx_v_shape;
  10681. /* "View.MemoryView":862
  10682. * if stop < 0:
  10683. * stop = 0
  10684. * elif stop > shape: # <<<<<<<<<<<<<<
  10685. * stop = shape
  10686. * else:
  10687. */
  10688. }
  10689. __pyx_L17:;
  10690. /* "View.MemoryView":857
  10691. * start = 0
  10692. *
  10693. * if have_stop: # <<<<<<<<<<<<<<
  10694. * if stop < 0:
  10695. * stop += shape
  10696. */
  10697. goto __pyx_L16;
  10698. }
  10699. /* "View.MemoryView":865
  10700. * stop = shape
  10701. * else:
  10702. * if negative_step: # <<<<<<<<<<<<<<
  10703. * stop = -1
  10704. * else:
  10705. */
  10706. /*else*/ {
  10707. __pyx_t_2 = (__pyx_v_negative_step != 0);
  10708. if (__pyx_t_2) {
  10709. /* "View.MemoryView":866
  10710. * else:
  10711. * if negative_step:
  10712. * stop = -1 # <<<<<<<<<<<<<<
  10713. * else:
  10714. * stop = shape
  10715. */
  10716. __pyx_v_stop = -1L;
  10717. /* "View.MemoryView":865
  10718. * stop = shape
  10719. * else:
  10720. * if negative_step: # <<<<<<<<<<<<<<
  10721. * stop = -1
  10722. * else:
  10723. */
  10724. goto __pyx_L19;
  10725. }
  10726. /* "View.MemoryView":868
  10727. * stop = -1
  10728. * else:
  10729. * stop = shape # <<<<<<<<<<<<<<
  10730. *
  10731. * if not have_step:
  10732. */
  10733. /*else*/ {
  10734. __pyx_v_stop = __pyx_v_shape;
  10735. }
  10736. __pyx_L19:;
  10737. }
  10738. __pyx_L16:;
  10739. /* "View.MemoryView":870
  10740. * stop = shape
  10741. *
  10742. * if not have_step: # <<<<<<<<<<<<<<
  10743. * step = 1
  10744. *
  10745. */
  10746. __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
  10747. if (__pyx_t_2) {
  10748. /* "View.MemoryView":871
  10749. *
  10750. * if not have_step:
  10751. * step = 1 # <<<<<<<<<<<<<<
  10752. *
  10753. *
  10754. */
  10755. __pyx_v_step = 1;
  10756. /* "View.MemoryView":870
  10757. * stop = shape
  10758. *
  10759. * if not have_step: # <<<<<<<<<<<<<<
  10760. * step = 1
  10761. *
  10762. */
  10763. }
  10764. /* "View.MemoryView":875
  10765. *
  10766. * with cython.cdivision(True):
  10767. * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
  10768. *
  10769. * if (stop - start) - step * new_shape:
  10770. */
  10771. __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
  10772. /* "View.MemoryView":877
  10773. * new_shape = (stop - start) // step
  10774. *
  10775. * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
  10776. * new_shape += 1
  10777. *
  10778. */
  10779. __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
  10780. if (__pyx_t_2) {
  10781. /* "View.MemoryView":878
  10782. *
  10783. * if (stop - start) - step * new_shape:
  10784. * new_shape += 1 # <<<<<<<<<<<<<<
  10785. *
  10786. * if new_shape < 0:
  10787. */
  10788. __pyx_v_new_shape = (__pyx_v_new_shape + 1);
  10789. /* "View.MemoryView":877
  10790. * new_shape = (stop - start) // step
  10791. *
  10792. * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
  10793. * new_shape += 1
  10794. *
  10795. */
  10796. }
  10797. /* "View.MemoryView":880
  10798. * new_shape += 1
  10799. *
  10800. * if new_shape < 0: # <<<<<<<<<<<<<<
  10801. * new_shape = 0
  10802. *
  10803. */
  10804. __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
  10805. if (__pyx_t_2) {
  10806. /* "View.MemoryView":881
  10807. *
  10808. * if new_shape < 0:
  10809. * new_shape = 0 # <<<<<<<<<<<<<<
  10810. *
  10811. *
  10812. */
  10813. __pyx_v_new_shape = 0;
  10814. /* "View.MemoryView":880
  10815. * new_shape += 1
  10816. *
  10817. * if new_shape < 0: # <<<<<<<<<<<<<<
  10818. * new_shape = 0
  10819. *
  10820. */
  10821. }
  10822. /* "View.MemoryView":884
  10823. *
  10824. *
  10825. * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
  10826. * dst.shape[new_ndim] = new_shape
  10827. * dst.suboffsets[new_ndim] = suboffset
  10828. */
  10829. (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
  10830. /* "View.MemoryView":885
  10831. *
  10832. * dst.strides[new_ndim] = stride * step
  10833. * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
  10834. * dst.suboffsets[new_ndim] = suboffset
  10835. *
  10836. */
  10837. (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
  10838. /* "View.MemoryView":886
  10839. * dst.strides[new_ndim] = stride * step
  10840. * dst.shape[new_ndim] = new_shape
  10841. * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
  10842. *
  10843. *
  10844. */
  10845. (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  10846. }
  10847. __pyx_L3:;
  10848. /* "View.MemoryView":889
  10849. *
  10850. *
  10851. * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
  10852. * dst.data += start * stride
  10853. * else:
  10854. */
  10855. __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  10856. if (__pyx_t_2) {
  10857. /* "View.MemoryView":890
  10858. *
  10859. * if suboffset_dim[0] < 0:
  10860. * dst.data += start * stride # <<<<<<<<<<<<<<
  10861. * else:
  10862. * dst.suboffsets[suboffset_dim[0]] += start * stride
  10863. */
  10864. __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
  10865. /* "View.MemoryView":889
  10866. *
  10867. *
  10868. * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
  10869. * dst.data += start * stride
  10870. * else:
  10871. */
  10872. goto __pyx_L23;
  10873. }
  10874. /* "View.MemoryView":892
  10875. * dst.data += start * stride
  10876. * else:
  10877. * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
  10878. *
  10879. * if suboffset >= 0:
  10880. */
  10881. /*else*/ {
  10882. __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
  10883. (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  10884. }
  10885. __pyx_L23:;
  10886. /* "View.MemoryView":894
  10887. * dst.suboffsets[suboffset_dim[0]] += start * stride
  10888. *
  10889. * if suboffset >= 0: # <<<<<<<<<<<<<<
  10890. * if not is_slice:
  10891. * if new_ndim == 0:
  10892. */
  10893. __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  10894. if (__pyx_t_2) {
  10895. /* "View.MemoryView":895
  10896. *
  10897. * if suboffset >= 0:
  10898. * if not is_slice: # <<<<<<<<<<<<<<
  10899. * if new_ndim == 0:
  10900. * dst.data = (<char **> dst.data)[0] + suboffset
  10901. */
  10902. __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
  10903. if (__pyx_t_2) {
  10904. /* "View.MemoryView":896
  10905. * if suboffset >= 0:
  10906. * if not is_slice:
  10907. * if new_ndim == 0: # <<<<<<<<<<<<<<
  10908. * dst.data = (<char **> dst.data)[0] + suboffset
  10909. * else:
  10910. */
  10911. __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
  10912. if (__pyx_t_2) {
  10913. /* "View.MemoryView":897
  10914. * if not is_slice:
  10915. * if new_ndim == 0:
  10916. * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
  10917. * else:
  10918. * _err_dim(IndexError, "All dimensions preceding dimension %d "
  10919. */
  10920. __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
  10921. /* "View.MemoryView":896
  10922. * if suboffset >= 0:
  10923. * if not is_slice:
  10924. * if new_ndim == 0: # <<<<<<<<<<<<<<
  10925. * dst.data = (<char **> dst.data)[0] + suboffset
  10926. * else:
  10927. */
  10928. goto __pyx_L26;
  10929. }
  10930. /* "View.MemoryView":899
  10931. * dst.data = (<char **> dst.data)[0] + suboffset
  10932. * else:
  10933. * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
  10934. * "must be indexed and not sliced", dim)
  10935. * else:
  10936. */
  10937. /*else*/ {
  10938. /* "View.MemoryView":900
  10939. * else:
  10940. * _err_dim(IndexError, "All dimensions preceding dimension %d "
  10941. * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
  10942. * else:
  10943. * suboffset_dim[0] = new_ndim
  10944. */
  10945. __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
  10946. }
  10947. __pyx_L26:;
  10948. /* "View.MemoryView":895
  10949. *
  10950. * if suboffset >= 0:
  10951. * if not is_slice: # <<<<<<<<<<<<<<
  10952. * if new_ndim == 0:
  10953. * dst.data = (<char **> dst.data)[0] + suboffset
  10954. */
  10955. goto __pyx_L25;
  10956. }
  10957. /* "View.MemoryView":902
  10958. * "must be indexed and not sliced", dim)
  10959. * else:
  10960. * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
  10961. *
  10962. * return 0
  10963. */
  10964. /*else*/ {
  10965. (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
  10966. }
  10967. __pyx_L25:;
  10968. /* "View.MemoryView":894
  10969. * dst.suboffsets[suboffset_dim[0]] += start * stride
  10970. *
  10971. * if suboffset >= 0: # <<<<<<<<<<<<<<
  10972. * if not is_slice:
  10973. * if new_ndim == 0:
  10974. */
  10975. }
  10976. /* "View.MemoryView":904
  10977. * suboffset_dim[0] = new_ndim
  10978. *
  10979. * return 0 # <<<<<<<<<<<<<<
  10980. *
  10981. *
  10982. */
  10983. __pyx_r = 0;
  10984. goto __pyx_L0;
  10985. /* "View.MemoryView":807
  10986. *
  10987. * @cname('__pyx_memoryview_slice_memviewslice')
  10988. * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
  10989. * __Pyx_memviewslice *dst,
  10990. * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
  10991. */
  10992. /* function exit code */
  10993. __pyx_L1_error:;
  10994. {
  10995. #ifdef WITH_THREAD
  10996. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  10997. #endif
  10998. __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10999. #ifdef WITH_THREAD
  11000. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  11001. #endif
  11002. }
  11003. __pyx_r = -1;
  11004. __pyx_L0:;
  11005. return __pyx_r;
  11006. }
  11007. /* "View.MemoryView":910
  11008. *
  11009. * @cname('__pyx_pybuffer_index')
  11010. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
  11011. * Py_ssize_t dim) except NULL:
  11012. * cdef Py_ssize_t shape, stride, suboffset = -1
  11013. */
  11014. static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
  11015. Py_ssize_t __pyx_v_shape;
  11016. Py_ssize_t __pyx_v_stride;
  11017. Py_ssize_t __pyx_v_suboffset;
  11018. Py_ssize_t __pyx_v_itemsize;
  11019. char *__pyx_v_resultp;
  11020. char *__pyx_r;
  11021. __Pyx_RefNannyDeclarations
  11022. Py_ssize_t __pyx_t_1;
  11023. int __pyx_t_2;
  11024. PyObject *__pyx_t_3 = NULL;
  11025. PyObject *__pyx_t_4 = NULL;
  11026. __Pyx_RefNannySetupContext("pybuffer_index", 0);
  11027. /* "View.MemoryView":912
  11028. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
  11029. * Py_ssize_t dim) except NULL:
  11030. * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
  11031. * cdef Py_ssize_t itemsize = view.itemsize
  11032. * cdef char *resultp
  11033. */
  11034. __pyx_v_suboffset = -1L;
  11035. /* "View.MemoryView":913
  11036. * Py_ssize_t dim) except NULL:
  11037. * cdef Py_ssize_t shape, stride, suboffset = -1
  11038. * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
  11039. * cdef char *resultp
  11040. *
  11041. */
  11042. __pyx_t_1 = __pyx_v_view->itemsize;
  11043. __pyx_v_itemsize = __pyx_t_1;
  11044. /* "View.MemoryView":916
  11045. * cdef char *resultp
  11046. *
  11047. * if view.ndim == 0: # <<<<<<<<<<<<<<
  11048. * shape = view.len / itemsize
  11049. * stride = itemsize
  11050. */
  11051. __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  11052. if (__pyx_t_2) {
  11053. /* "View.MemoryView":917
  11054. *
  11055. * if view.ndim == 0:
  11056. * shape = view.len / itemsize # <<<<<<<<<<<<<<
  11057. * stride = itemsize
  11058. * else:
  11059. */
  11060. if (unlikely(__pyx_v_itemsize == 0)) {
  11061. PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
  11062. __PYX_ERR(1, 917, __pyx_L1_error)
  11063. }
  11064. else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
  11065. PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
  11066. __PYX_ERR(1, 917, __pyx_L1_error)
  11067. }
  11068. __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
  11069. /* "View.MemoryView":918
  11070. * if view.ndim == 0:
  11071. * shape = view.len / itemsize
  11072. * stride = itemsize # <<<<<<<<<<<<<<
  11073. * else:
  11074. * shape = view.shape[dim]
  11075. */
  11076. __pyx_v_stride = __pyx_v_itemsize;
  11077. /* "View.MemoryView":916
  11078. * cdef char *resultp
  11079. *
  11080. * if view.ndim == 0: # <<<<<<<<<<<<<<
  11081. * shape = view.len / itemsize
  11082. * stride = itemsize
  11083. */
  11084. goto __pyx_L3;
  11085. }
  11086. /* "View.MemoryView":920
  11087. * stride = itemsize
  11088. * else:
  11089. * shape = view.shape[dim] # <<<<<<<<<<<<<<
  11090. * stride = view.strides[dim]
  11091. * if view.suboffsets != NULL:
  11092. */
  11093. /*else*/ {
  11094. __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
  11095. /* "View.MemoryView":921
  11096. * else:
  11097. * shape = view.shape[dim]
  11098. * stride = view.strides[dim] # <<<<<<<<<<<<<<
  11099. * if view.suboffsets != NULL:
  11100. * suboffset = view.suboffsets[dim]
  11101. */
  11102. __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
  11103. /* "View.MemoryView":922
  11104. * shape = view.shape[dim]
  11105. * stride = view.strides[dim]
  11106. * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
  11107. * suboffset = view.suboffsets[dim]
  11108. *
  11109. */
  11110. __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
  11111. if (__pyx_t_2) {
  11112. /* "View.MemoryView":923
  11113. * stride = view.strides[dim]
  11114. * if view.suboffsets != NULL:
  11115. * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
  11116. *
  11117. * if index < 0:
  11118. */
  11119. __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
  11120. /* "View.MemoryView":922
  11121. * shape = view.shape[dim]
  11122. * stride = view.strides[dim]
  11123. * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
  11124. * suboffset = view.suboffsets[dim]
  11125. *
  11126. */
  11127. }
  11128. }
  11129. __pyx_L3:;
  11130. /* "View.MemoryView":925
  11131. * suboffset = view.suboffsets[dim]
  11132. *
  11133. * if index < 0: # <<<<<<<<<<<<<<
  11134. * index += view.shape[dim]
  11135. * if index < 0:
  11136. */
  11137. __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  11138. if (__pyx_t_2) {
  11139. /* "View.MemoryView":926
  11140. *
  11141. * if index < 0:
  11142. * index += view.shape[dim] # <<<<<<<<<<<<<<
  11143. * if index < 0:
  11144. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11145. */
  11146. __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
  11147. /* "View.MemoryView":927
  11148. * if index < 0:
  11149. * index += view.shape[dim]
  11150. * if index < 0: # <<<<<<<<<<<<<<
  11151. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11152. *
  11153. */
  11154. __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  11155. if (unlikely(__pyx_t_2)) {
  11156. /* "View.MemoryView":928
  11157. * index += view.shape[dim]
  11158. * if index < 0:
  11159. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
  11160. *
  11161. * if index >= shape:
  11162. */
  11163. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
  11164. __Pyx_GOTREF(__pyx_t_3);
  11165. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
  11166. __Pyx_GOTREF(__pyx_t_4);
  11167. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11168. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
  11169. __Pyx_GOTREF(__pyx_t_3);
  11170. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11171. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  11172. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11173. __PYX_ERR(1, 928, __pyx_L1_error)
  11174. /* "View.MemoryView":927
  11175. * if index < 0:
  11176. * index += view.shape[dim]
  11177. * if index < 0: # <<<<<<<<<<<<<<
  11178. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11179. *
  11180. */
  11181. }
  11182. /* "View.MemoryView":925
  11183. * suboffset = view.suboffsets[dim]
  11184. *
  11185. * if index < 0: # <<<<<<<<<<<<<<
  11186. * index += view.shape[dim]
  11187. * if index < 0:
  11188. */
  11189. }
  11190. /* "View.MemoryView":930
  11191. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11192. *
  11193. * if index >= shape: # <<<<<<<<<<<<<<
  11194. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11195. *
  11196. */
  11197. __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  11198. if (unlikely(__pyx_t_2)) {
  11199. /* "View.MemoryView":931
  11200. *
  11201. * if index >= shape:
  11202. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
  11203. *
  11204. * resultp = bufp + index * stride
  11205. */
  11206. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
  11207. __Pyx_GOTREF(__pyx_t_3);
  11208. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
  11209. __Pyx_GOTREF(__pyx_t_4);
  11210. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11211. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
  11212. __Pyx_GOTREF(__pyx_t_3);
  11213. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11214. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  11215. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11216. __PYX_ERR(1, 931, __pyx_L1_error)
  11217. /* "View.MemoryView":930
  11218. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11219. *
  11220. * if index >= shape: # <<<<<<<<<<<<<<
  11221. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11222. *
  11223. */
  11224. }
  11225. /* "View.MemoryView":933
  11226. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  11227. *
  11228. * resultp = bufp + index * stride # <<<<<<<<<<<<<<
  11229. * if suboffset >= 0:
  11230. * resultp = (<char **> resultp)[0] + suboffset
  11231. */
  11232. __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
  11233. /* "View.MemoryView":934
  11234. *
  11235. * resultp = bufp + index * stride
  11236. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11237. * resultp = (<char **> resultp)[0] + suboffset
  11238. *
  11239. */
  11240. __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  11241. if (__pyx_t_2) {
  11242. /* "View.MemoryView":935
  11243. * resultp = bufp + index * stride
  11244. * if suboffset >= 0:
  11245. * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
  11246. *
  11247. * return resultp
  11248. */
  11249. __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
  11250. /* "View.MemoryView":934
  11251. *
  11252. * resultp = bufp + index * stride
  11253. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11254. * resultp = (<char **> resultp)[0] + suboffset
  11255. *
  11256. */
  11257. }
  11258. /* "View.MemoryView":937
  11259. * resultp = (<char **> resultp)[0] + suboffset
  11260. *
  11261. * return resultp # <<<<<<<<<<<<<<
  11262. *
  11263. *
  11264. */
  11265. __pyx_r = __pyx_v_resultp;
  11266. goto __pyx_L0;
  11267. /* "View.MemoryView":910
  11268. *
  11269. * @cname('__pyx_pybuffer_index')
  11270. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
  11271. * Py_ssize_t dim) except NULL:
  11272. * cdef Py_ssize_t shape, stride, suboffset = -1
  11273. */
  11274. /* function exit code */
  11275. __pyx_L1_error:;
  11276. __Pyx_XDECREF(__pyx_t_3);
  11277. __Pyx_XDECREF(__pyx_t_4);
  11278. __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11279. __pyx_r = NULL;
  11280. __pyx_L0:;
  11281. __Pyx_RefNannyFinishContext();
  11282. return __pyx_r;
  11283. }
  11284. /* "View.MemoryView":943
  11285. *
  11286. * @cname('__pyx_memslice_transpose')
  11287. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
  11288. * cdef int ndim = memslice.memview.view.ndim
  11289. *
  11290. */
  11291. static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  11292. int __pyx_v_ndim;
  11293. Py_ssize_t *__pyx_v_shape;
  11294. Py_ssize_t *__pyx_v_strides;
  11295. int __pyx_v_i;
  11296. int __pyx_v_j;
  11297. int __pyx_r;
  11298. int __pyx_t_1;
  11299. Py_ssize_t *__pyx_t_2;
  11300. long __pyx_t_3;
  11301. long __pyx_t_4;
  11302. Py_ssize_t __pyx_t_5;
  11303. Py_ssize_t __pyx_t_6;
  11304. int __pyx_t_7;
  11305. int __pyx_t_8;
  11306. int __pyx_t_9;
  11307. /* "View.MemoryView":944
  11308. * @cname('__pyx_memslice_transpose')
  11309. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
  11310. * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
  11311. *
  11312. * cdef Py_ssize_t *shape = memslice.shape
  11313. */
  11314. __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  11315. __pyx_v_ndim = __pyx_t_1;
  11316. /* "View.MemoryView":946
  11317. * cdef int ndim = memslice.memview.view.ndim
  11318. *
  11319. * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
  11320. * cdef Py_ssize_t *strides = memslice.strides
  11321. *
  11322. */
  11323. __pyx_t_2 = __pyx_v_memslice->shape;
  11324. __pyx_v_shape = __pyx_t_2;
  11325. /* "View.MemoryView":947
  11326. *
  11327. * cdef Py_ssize_t *shape = memslice.shape
  11328. * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
  11329. *
  11330. *
  11331. */
  11332. __pyx_t_2 = __pyx_v_memslice->strides;
  11333. __pyx_v_strides = __pyx_t_2;
  11334. /* "View.MemoryView":951
  11335. *
  11336. * cdef int i, j
  11337. * for i in range(ndim / 2): # <<<<<<<<<<<<<<
  11338. * j = ndim - 1 - i
  11339. * strides[i], strides[j] = strides[j], strides[i]
  11340. */
  11341. __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
  11342. __pyx_t_4 = __pyx_t_3;
  11343. for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
  11344. __pyx_v_i = __pyx_t_1;
  11345. /* "View.MemoryView":952
  11346. * cdef int i, j
  11347. * for i in range(ndim / 2):
  11348. * j = ndim - 1 - i # <<<<<<<<<<<<<<
  11349. * strides[i], strides[j] = strides[j], strides[i]
  11350. * shape[i], shape[j] = shape[j], shape[i]
  11351. */
  11352. __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
  11353. /* "View.MemoryView":953
  11354. * for i in range(ndim / 2):
  11355. * j = ndim - 1 - i
  11356. * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
  11357. * shape[i], shape[j] = shape[j], shape[i]
  11358. *
  11359. */
  11360. __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
  11361. __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
  11362. (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
  11363. (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
  11364. /* "View.MemoryView":954
  11365. * j = ndim - 1 - i
  11366. * strides[i], strides[j] = strides[j], strides[i]
  11367. * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
  11368. *
  11369. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  11370. */
  11371. __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
  11372. __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
  11373. (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
  11374. (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
  11375. /* "View.MemoryView":956
  11376. * shape[i], shape[j] = shape[j], shape[i]
  11377. *
  11378. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
  11379. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  11380. *
  11381. */
  11382. __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
  11383. if (!__pyx_t_8) {
  11384. } else {
  11385. __pyx_t_7 = __pyx_t_8;
  11386. goto __pyx_L6_bool_binop_done;
  11387. }
  11388. __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
  11389. __pyx_t_7 = __pyx_t_8;
  11390. __pyx_L6_bool_binop_done:;
  11391. if (__pyx_t_7) {
  11392. /* "View.MemoryView":957
  11393. *
  11394. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  11395. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
  11396. *
  11397. * return 1
  11398. */
  11399. __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
  11400. /* "View.MemoryView":956
  11401. * shape[i], shape[j] = shape[j], shape[i]
  11402. *
  11403. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
  11404. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  11405. *
  11406. */
  11407. }
  11408. }
  11409. /* "View.MemoryView":959
  11410. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  11411. *
  11412. * return 1 # <<<<<<<<<<<<<<
  11413. *
  11414. *
  11415. */
  11416. __pyx_r = 1;
  11417. goto __pyx_L0;
  11418. /* "View.MemoryView":943
  11419. *
  11420. * @cname('__pyx_memslice_transpose')
  11421. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
  11422. * cdef int ndim = memslice.memview.view.ndim
  11423. *
  11424. */
  11425. /* function exit code */
  11426. __pyx_L1_error:;
  11427. {
  11428. #ifdef WITH_THREAD
  11429. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  11430. #endif
  11431. __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11432. #ifdef WITH_THREAD
  11433. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  11434. #endif
  11435. }
  11436. __pyx_r = 0;
  11437. __pyx_L0:;
  11438. return __pyx_r;
  11439. }
  11440. /* "View.MemoryView":976
  11441. * cdef int (*to_dtype_func)(char *, object) except 0
  11442. *
  11443. * def __dealloc__(self): # <<<<<<<<<<<<<<
  11444. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11445. *
  11446. */
  11447. /* Python wrapper */
  11448. static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
  11449. static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  11450. __Pyx_RefNannyDeclarations
  11451. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  11452. __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  11453. /* function exit code */
  11454. __Pyx_RefNannyFinishContext();
  11455. }
  11456. static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  11457. __Pyx_RefNannyDeclarations
  11458. __Pyx_RefNannySetupContext("__dealloc__", 0);
  11459. /* "View.MemoryView":977
  11460. *
  11461. * def __dealloc__(self):
  11462. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
  11463. *
  11464. * cdef convert_item_to_object(self, char *itemp):
  11465. */
  11466. __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
  11467. /* "View.MemoryView":976
  11468. * cdef int (*to_dtype_func)(char *, object) except 0
  11469. *
  11470. * def __dealloc__(self): # <<<<<<<<<<<<<<
  11471. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11472. *
  11473. */
  11474. /* function exit code */
  11475. __Pyx_RefNannyFinishContext();
  11476. }
  11477. /* "View.MemoryView":979
  11478. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11479. *
  11480. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  11481. * if self.to_object_func != NULL:
  11482. * return self.to_object_func(itemp)
  11483. */
  11484. static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  11485. PyObject *__pyx_r = NULL;
  11486. __Pyx_RefNannyDeclarations
  11487. int __pyx_t_1;
  11488. PyObject *__pyx_t_2 = NULL;
  11489. __Pyx_RefNannySetupContext("convert_item_to_object", 0);
  11490. /* "View.MemoryView":980
  11491. *
  11492. * cdef convert_item_to_object(self, char *itemp):
  11493. * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
  11494. * return self.to_object_func(itemp)
  11495. * else:
  11496. */
  11497. __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  11498. if (__pyx_t_1) {
  11499. /* "View.MemoryView":981
  11500. * cdef convert_item_to_object(self, char *itemp):
  11501. * if self.to_object_func != NULL:
  11502. * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
  11503. * else:
  11504. * return memoryview.convert_item_to_object(self, itemp)
  11505. */
  11506. __Pyx_XDECREF(__pyx_r);
  11507. __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
  11508. __Pyx_GOTREF(__pyx_t_2);
  11509. __pyx_r = __pyx_t_2;
  11510. __pyx_t_2 = 0;
  11511. goto __pyx_L0;
  11512. /* "View.MemoryView":980
  11513. *
  11514. * cdef convert_item_to_object(self, char *itemp):
  11515. * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
  11516. * return self.to_object_func(itemp)
  11517. * else:
  11518. */
  11519. }
  11520. /* "View.MemoryView":983
  11521. * return self.to_object_func(itemp)
  11522. * else:
  11523. * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
  11524. *
  11525. * cdef assign_item_from_object(self, char *itemp, object value):
  11526. */
  11527. /*else*/ {
  11528. __Pyx_XDECREF(__pyx_r);
  11529. __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
  11530. __Pyx_GOTREF(__pyx_t_2);
  11531. __pyx_r = __pyx_t_2;
  11532. __pyx_t_2 = 0;
  11533. goto __pyx_L0;
  11534. }
  11535. /* "View.MemoryView":979
  11536. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  11537. *
  11538. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  11539. * if self.to_object_func != NULL:
  11540. * return self.to_object_func(itemp)
  11541. */
  11542. /* function exit code */
  11543. __pyx_L1_error:;
  11544. __Pyx_XDECREF(__pyx_t_2);
  11545. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11546. __pyx_r = 0;
  11547. __pyx_L0:;
  11548. __Pyx_XGIVEREF(__pyx_r);
  11549. __Pyx_RefNannyFinishContext();
  11550. return __pyx_r;
  11551. }
  11552. /* "View.MemoryView":985
  11553. * return memoryview.convert_item_to_object(self, itemp)
  11554. *
  11555. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  11556. * if self.to_dtype_func != NULL:
  11557. * self.to_dtype_func(itemp, value)
  11558. */
  11559. static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  11560. PyObject *__pyx_r = NULL;
  11561. __Pyx_RefNannyDeclarations
  11562. int __pyx_t_1;
  11563. int __pyx_t_2;
  11564. PyObject *__pyx_t_3 = NULL;
  11565. __Pyx_RefNannySetupContext("assign_item_from_object", 0);
  11566. /* "View.MemoryView":986
  11567. *
  11568. * cdef assign_item_from_object(self, char *itemp, object value):
  11569. * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
  11570. * self.to_dtype_func(itemp, value)
  11571. * else:
  11572. */
  11573. __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  11574. if (__pyx_t_1) {
  11575. /* "View.MemoryView":987
  11576. * cdef assign_item_from_object(self, char *itemp, object value):
  11577. * if self.to_dtype_func != NULL:
  11578. * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
  11579. * else:
  11580. * memoryview.assign_item_from_object(self, itemp, value)
  11581. */
  11582. __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
  11583. /* "View.MemoryView":986
  11584. *
  11585. * cdef assign_item_from_object(self, char *itemp, object value):
  11586. * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
  11587. * self.to_dtype_func(itemp, value)
  11588. * else:
  11589. */
  11590. goto __pyx_L3;
  11591. }
  11592. /* "View.MemoryView":989
  11593. * self.to_dtype_func(itemp, value)
  11594. * else:
  11595. * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
  11596. *
  11597. * @property
  11598. */
  11599. /*else*/ {
  11600. __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
  11601. __Pyx_GOTREF(__pyx_t_3);
  11602. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11603. }
  11604. __pyx_L3:;
  11605. /* "View.MemoryView":985
  11606. * return memoryview.convert_item_to_object(self, itemp)
  11607. *
  11608. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  11609. * if self.to_dtype_func != NULL:
  11610. * self.to_dtype_func(itemp, value)
  11611. */
  11612. /* function exit code */
  11613. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  11614. goto __pyx_L0;
  11615. __pyx_L1_error:;
  11616. __Pyx_XDECREF(__pyx_t_3);
  11617. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11618. __pyx_r = 0;
  11619. __pyx_L0:;
  11620. __Pyx_XGIVEREF(__pyx_r);
  11621. __Pyx_RefNannyFinishContext();
  11622. return __pyx_r;
  11623. }
  11624. /* "View.MemoryView":992
  11625. *
  11626. * @property
  11627. * def base(self): # <<<<<<<<<<<<<<
  11628. * return self.from_object
  11629. *
  11630. */
  11631. /* Python wrapper */
  11632. static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
  11633. static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  11634. PyObject *__pyx_r = 0;
  11635. __Pyx_RefNannyDeclarations
  11636. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  11637. __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  11638. /* function exit code */
  11639. __Pyx_RefNannyFinishContext();
  11640. return __pyx_r;
  11641. }
  11642. static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  11643. PyObject *__pyx_r = NULL;
  11644. __Pyx_RefNannyDeclarations
  11645. __Pyx_RefNannySetupContext("__get__", 0);
  11646. /* "View.MemoryView":993
  11647. * @property
  11648. * def base(self):
  11649. * return self.from_object # <<<<<<<<<<<<<<
  11650. *
  11651. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
  11652. */
  11653. __Pyx_XDECREF(__pyx_r);
  11654. __Pyx_INCREF(__pyx_v_self->from_object);
  11655. __pyx_r = __pyx_v_self->from_object;
  11656. goto __pyx_L0;
  11657. /* "View.MemoryView":992
  11658. *
  11659. * @property
  11660. * def base(self): # <<<<<<<<<<<<<<
  11661. * return self.from_object
  11662. *
  11663. */
  11664. /* function exit code */
  11665. __pyx_L0:;
  11666. __Pyx_XGIVEREF(__pyx_r);
  11667. __Pyx_RefNannyFinishContext();
  11668. return __pyx_r;
  11669. }
  11670. /* "(tree fragment)":1
  11671. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  11672. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11673. * def __setstate_cython__(self, __pyx_state):
  11674. */
  11675. /* Python wrapper */
  11676. static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11677. static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11678. PyObject *__pyx_r = 0;
  11679. __Pyx_RefNannyDeclarations
  11680. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  11681. __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  11682. /* function exit code */
  11683. __Pyx_RefNannyFinishContext();
  11684. return __pyx_r;
  11685. }
  11686. static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  11687. PyObject *__pyx_r = NULL;
  11688. __Pyx_RefNannyDeclarations
  11689. PyObject *__pyx_t_1 = NULL;
  11690. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  11691. /* "(tree fragment)":2
  11692. * def __reduce_cython__(self):
  11693. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  11694. * def __setstate_cython__(self, __pyx_state):
  11695. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11696. */
  11697. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  11698. __Pyx_GOTREF(__pyx_t_1);
  11699. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  11700. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11701. __PYX_ERR(1, 2, __pyx_L1_error)
  11702. /* "(tree fragment)":1
  11703. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  11704. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11705. * def __setstate_cython__(self, __pyx_state):
  11706. */
  11707. /* function exit code */
  11708. __pyx_L1_error:;
  11709. __Pyx_XDECREF(__pyx_t_1);
  11710. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11711. __pyx_r = NULL;
  11712. __Pyx_XGIVEREF(__pyx_r);
  11713. __Pyx_RefNannyFinishContext();
  11714. return __pyx_r;
  11715. }
  11716. /* "(tree fragment)":3
  11717. * def __reduce_cython__(self):
  11718. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11719. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  11720. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11721. */
  11722. /* Python wrapper */
  11723. static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  11724. static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  11725. PyObject *__pyx_r = 0;
  11726. __Pyx_RefNannyDeclarations
  11727. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  11728. __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  11729. /* function exit code */
  11730. __Pyx_RefNannyFinishContext();
  11731. return __pyx_r;
  11732. }
  11733. static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  11734. PyObject *__pyx_r = NULL;
  11735. __Pyx_RefNannyDeclarations
  11736. PyObject *__pyx_t_1 = NULL;
  11737. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  11738. /* "(tree fragment)":4
  11739. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11740. * def __setstate_cython__(self, __pyx_state):
  11741. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  11742. */
  11743. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  11744. __Pyx_GOTREF(__pyx_t_1);
  11745. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  11746. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11747. __PYX_ERR(1, 4, __pyx_L1_error)
  11748. /* "(tree fragment)":3
  11749. * def __reduce_cython__(self):
  11750. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11751. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  11752. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11753. */
  11754. /* function exit code */
  11755. __pyx_L1_error:;
  11756. __Pyx_XDECREF(__pyx_t_1);
  11757. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11758. __pyx_r = NULL;
  11759. __Pyx_XGIVEREF(__pyx_r);
  11760. __Pyx_RefNannyFinishContext();
  11761. return __pyx_r;
  11762. }
  11763. /* "View.MemoryView":999
  11764. *
  11765. * @cname('__pyx_memoryview_fromslice')
  11766. * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
  11767. * int ndim,
  11768. * object (*to_object_func)(char *),
  11769. */
  11770. static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
  11771. struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  11772. Py_ssize_t __pyx_v_suboffset;
  11773. PyObject *__pyx_v_length = NULL;
  11774. PyObject *__pyx_r = NULL;
  11775. __Pyx_RefNannyDeclarations
  11776. int __pyx_t_1;
  11777. PyObject *__pyx_t_2 = NULL;
  11778. PyObject *__pyx_t_3 = NULL;
  11779. __Pyx_TypeInfo *__pyx_t_4;
  11780. Py_buffer __pyx_t_5;
  11781. Py_ssize_t *__pyx_t_6;
  11782. Py_ssize_t *__pyx_t_7;
  11783. Py_ssize_t *__pyx_t_8;
  11784. Py_ssize_t __pyx_t_9;
  11785. __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
  11786. /* "View.MemoryView":1007
  11787. * cdef _memoryviewslice result
  11788. *
  11789. * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
  11790. * return None
  11791. *
  11792. */
  11793. __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  11794. if (__pyx_t_1) {
  11795. /* "View.MemoryView":1008
  11796. *
  11797. * if <PyObject *> memviewslice.memview == Py_None:
  11798. * return None # <<<<<<<<<<<<<<
  11799. *
  11800. *
  11801. */
  11802. __Pyx_XDECREF(__pyx_r);
  11803. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  11804. goto __pyx_L0;
  11805. /* "View.MemoryView":1007
  11806. * cdef _memoryviewslice result
  11807. *
  11808. * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
  11809. * return None
  11810. *
  11811. */
  11812. }
  11813. /* "View.MemoryView":1013
  11814. *
  11815. *
  11816. * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
  11817. *
  11818. * result.from_slice = memviewslice
  11819. */
  11820. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
  11821. __Pyx_GOTREF(__pyx_t_2);
  11822. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
  11823. __Pyx_GOTREF(__pyx_t_3);
  11824. __Pyx_INCREF(Py_None);
  11825. __Pyx_GIVEREF(Py_None);
  11826. PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  11827. __Pyx_INCREF(__pyx_int_0);
  11828. __Pyx_GIVEREF(__pyx_int_0);
  11829. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  11830. __Pyx_GIVEREF(__pyx_t_2);
  11831. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  11832. __pyx_t_2 = 0;
  11833. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
  11834. __Pyx_GOTREF(__pyx_t_2);
  11835. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11836. __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  11837. __pyx_t_2 = 0;
  11838. /* "View.MemoryView":1015
  11839. * result = _memoryviewslice(None, 0, dtype_is_object)
  11840. *
  11841. * result.from_slice = memviewslice # <<<<<<<<<<<<<<
  11842. * __PYX_INC_MEMVIEW(&memviewslice, 1)
  11843. *
  11844. */
  11845. __pyx_v_result->from_slice = __pyx_v_memviewslice;
  11846. /* "View.MemoryView":1016
  11847. *
  11848. * result.from_slice = memviewslice
  11849. * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
  11850. *
  11851. * result.from_object = (<memoryview> memviewslice.memview).base
  11852. */
  11853. __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
  11854. /* "View.MemoryView":1018
  11855. * __PYX_INC_MEMVIEW(&memviewslice, 1)
  11856. *
  11857. * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
  11858. * result.typeinfo = memviewslice.memview.typeinfo
  11859. *
  11860. */
  11861. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
  11862. __Pyx_GOTREF(__pyx_t_2);
  11863. __Pyx_GIVEREF(__pyx_t_2);
  11864. __Pyx_GOTREF(__pyx_v_result->from_object);
  11865. __Pyx_DECREF(__pyx_v_result->from_object);
  11866. __pyx_v_result->from_object = __pyx_t_2;
  11867. __pyx_t_2 = 0;
  11868. /* "View.MemoryView":1019
  11869. *
  11870. * result.from_object = (<memoryview> memviewslice.memview).base
  11871. * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
  11872. *
  11873. * result.view = memviewslice.memview.view
  11874. */
  11875. __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  11876. __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
  11877. /* "View.MemoryView":1021
  11878. * result.typeinfo = memviewslice.memview.typeinfo
  11879. *
  11880. * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
  11881. * result.view.buf = <void *> memviewslice.data
  11882. * result.view.ndim = ndim
  11883. */
  11884. __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  11885. __pyx_v_result->__pyx_base.view = __pyx_t_5;
  11886. /* "View.MemoryView":1022
  11887. *
  11888. * result.view = memviewslice.memview.view
  11889. * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
  11890. * result.view.ndim = ndim
  11891. * (<__pyx_buffer *> &result.view).obj = Py_None
  11892. */
  11893. __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
  11894. /* "View.MemoryView":1023
  11895. * result.view = memviewslice.memview.view
  11896. * result.view.buf = <void *> memviewslice.data
  11897. * result.view.ndim = ndim # <<<<<<<<<<<<<<
  11898. * (<__pyx_buffer *> &result.view).obj = Py_None
  11899. * Py_INCREF(Py_None)
  11900. */
  11901. __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
  11902. /* "View.MemoryView":1024
  11903. * result.view.buf = <void *> memviewslice.data
  11904. * result.view.ndim = ndim
  11905. * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
  11906. * Py_INCREF(Py_None)
  11907. *
  11908. */
  11909. ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
  11910. /* "View.MemoryView":1025
  11911. * result.view.ndim = ndim
  11912. * (<__pyx_buffer *> &result.view).obj = Py_None
  11913. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  11914. *
  11915. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
  11916. */
  11917. Py_INCREF(Py_None);
  11918. /* "View.MemoryView":1027
  11919. * Py_INCREF(Py_None)
  11920. *
  11921. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
  11922. * result.flags = PyBUF_RECORDS
  11923. * else:
  11924. */
  11925. __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  11926. if (__pyx_t_1) {
  11927. /* "View.MemoryView":1028
  11928. *
  11929. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
  11930. * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
  11931. * else:
  11932. * result.flags = PyBUF_RECORDS_RO
  11933. */
  11934. __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
  11935. /* "View.MemoryView":1027
  11936. * Py_INCREF(Py_None)
  11937. *
  11938. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
  11939. * result.flags = PyBUF_RECORDS
  11940. * else:
  11941. */
  11942. goto __pyx_L4;
  11943. }
  11944. /* "View.MemoryView":1030
  11945. * result.flags = PyBUF_RECORDS
  11946. * else:
  11947. * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
  11948. *
  11949. * result.view.shape = <Py_ssize_t *> result.from_slice.shape
  11950. */
  11951. /*else*/ {
  11952. __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  11953. }
  11954. __pyx_L4:;
  11955. /* "View.MemoryView":1032
  11956. * result.flags = PyBUF_RECORDS_RO
  11957. *
  11958. * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
  11959. * result.view.strides = <Py_ssize_t *> result.from_slice.strides
  11960. *
  11961. */
  11962. __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
  11963. /* "View.MemoryView":1033
  11964. *
  11965. * result.view.shape = <Py_ssize_t *> result.from_slice.shape
  11966. * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
  11967. *
  11968. *
  11969. */
  11970. __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
  11971. /* "View.MemoryView":1036
  11972. *
  11973. *
  11974. * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
  11975. * for suboffset in result.from_slice.suboffsets[:ndim]:
  11976. * if suboffset >= 0:
  11977. */
  11978. __pyx_v_result->__pyx_base.view.suboffsets = NULL;
  11979. /* "View.MemoryView":1037
  11980. *
  11981. * result.view.suboffsets = NULL
  11982. * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
  11983. * if suboffset >= 0:
  11984. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  11985. */
  11986. __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  11987. for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
  11988. __pyx_t_6 = __pyx_t_8;
  11989. __pyx_v_suboffset = (__pyx_t_6[0]);
  11990. /* "View.MemoryView":1038
  11991. * result.view.suboffsets = NULL
  11992. * for suboffset in result.from_slice.suboffsets[:ndim]:
  11993. * if suboffset >= 0: # <<<<<<<<<<<<<<
  11994. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  11995. * break
  11996. */
  11997. __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
  11998. if (__pyx_t_1) {
  11999. /* "View.MemoryView":1039
  12000. * for suboffset in result.from_slice.suboffsets[:ndim]:
  12001. * if suboffset >= 0:
  12002. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
  12003. * break
  12004. *
  12005. */
  12006. __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
  12007. /* "View.MemoryView":1040
  12008. * if suboffset >= 0:
  12009. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  12010. * break # <<<<<<<<<<<<<<
  12011. *
  12012. * result.view.len = result.view.itemsize
  12013. */
  12014. goto __pyx_L6_break;
  12015. /* "View.MemoryView":1038
  12016. * result.view.suboffsets = NULL
  12017. * for suboffset in result.from_slice.suboffsets[:ndim]:
  12018. * if suboffset >= 0: # <<<<<<<<<<<<<<
  12019. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  12020. * break
  12021. */
  12022. }
  12023. }
  12024. __pyx_L6_break:;
  12025. /* "View.MemoryView":1042
  12026. * break
  12027. *
  12028. * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
  12029. * for length in result.view.shape[:ndim]:
  12030. * result.view.len *= length
  12031. */
  12032. __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  12033. __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  12034. /* "View.MemoryView":1043
  12035. *
  12036. * result.view.len = result.view.itemsize
  12037. * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
  12038. * result.view.len *= length
  12039. *
  12040. */
  12041. __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  12042. for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
  12043. __pyx_t_6 = __pyx_t_8;
  12044. __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
  12045. __Pyx_GOTREF(__pyx_t_2);
  12046. __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
  12047. __pyx_t_2 = 0;
  12048. /* "View.MemoryView":1044
  12049. * result.view.len = result.view.itemsize
  12050. * for length in result.view.shape[:ndim]:
  12051. * result.view.len *= length # <<<<<<<<<<<<<<
  12052. *
  12053. * result.to_object_func = to_object_func
  12054. */
  12055. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
  12056. __Pyx_GOTREF(__pyx_t_2);
  12057. __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
  12058. __Pyx_GOTREF(__pyx_t_3);
  12059. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12060. __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
  12061. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12062. __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  12063. }
  12064. /* "View.MemoryView":1046
  12065. * result.view.len *= length
  12066. *
  12067. * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
  12068. * result.to_dtype_func = to_dtype_func
  12069. *
  12070. */
  12071. __pyx_v_result->to_object_func = __pyx_v_to_object_func;
  12072. /* "View.MemoryView":1047
  12073. *
  12074. * result.to_object_func = to_object_func
  12075. * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
  12076. *
  12077. * return result
  12078. */
  12079. __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
  12080. /* "View.MemoryView":1049
  12081. * result.to_dtype_func = to_dtype_func
  12082. *
  12083. * return result # <<<<<<<<<<<<<<
  12084. *
  12085. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  12086. */
  12087. __Pyx_XDECREF(__pyx_r);
  12088. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  12089. __pyx_r = ((PyObject *)__pyx_v_result);
  12090. goto __pyx_L0;
  12091. /* "View.MemoryView":999
  12092. *
  12093. * @cname('__pyx_memoryview_fromslice')
  12094. * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
  12095. * int ndim,
  12096. * object (*to_object_func)(char *),
  12097. */
  12098. /* function exit code */
  12099. __pyx_L1_error:;
  12100. __Pyx_XDECREF(__pyx_t_2);
  12101. __Pyx_XDECREF(__pyx_t_3);
  12102. __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12103. __pyx_r = 0;
  12104. __pyx_L0:;
  12105. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  12106. __Pyx_XDECREF(__pyx_v_length);
  12107. __Pyx_XGIVEREF(__pyx_r);
  12108. __Pyx_RefNannyFinishContext();
  12109. return __pyx_r;
  12110. }
  12111. /* "View.MemoryView":1052
  12112. *
  12113. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  12114. * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
  12115. * __Pyx_memviewslice *mslice) except NULL:
  12116. * cdef _memoryviewslice obj
  12117. */
  12118. static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  12119. struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  12120. __Pyx_memviewslice *__pyx_r;
  12121. __Pyx_RefNannyDeclarations
  12122. int __pyx_t_1;
  12123. int __pyx_t_2;
  12124. PyObject *__pyx_t_3 = NULL;
  12125. __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
  12126. /* "View.MemoryView":1055
  12127. * __Pyx_memviewslice *mslice) except NULL:
  12128. * cdef _memoryviewslice obj
  12129. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12130. * obj = memview
  12131. * return &obj.from_slice
  12132. */
  12133. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  12134. __pyx_t_2 = (__pyx_t_1 != 0);
  12135. if (__pyx_t_2) {
  12136. /* "View.MemoryView":1056
  12137. * cdef _memoryviewslice obj
  12138. * if isinstance(memview, _memoryviewslice):
  12139. * obj = memview # <<<<<<<<<<<<<<
  12140. * return &obj.from_slice
  12141. * else:
  12142. */
  12143. if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
  12144. __pyx_t_3 = ((PyObject *)__pyx_v_memview);
  12145. __Pyx_INCREF(__pyx_t_3);
  12146. __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
  12147. __pyx_t_3 = 0;
  12148. /* "View.MemoryView":1057
  12149. * if isinstance(memview, _memoryviewslice):
  12150. * obj = memview
  12151. * return &obj.from_slice # <<<<<<<<<<<<<<
  12152. * else:
  12153. * slice_copy(memview, mslice)
  12154. */
  12155. __pyx_r = (&__pyx_v_obj->from_slice);
  12156. goto __pyx_L0;
  12157. /* "View.MemoryView":1055
  12158. * __Pyx_memviewslice *mslice) except NULL:
  12159. * cdef _memoryviewslice obj
  12160. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12161. * obj = memview
  12162. * return &obj.from_slice
  12163. */
  12164. }
  12165. /* "View.MemoryView":1059
  12166. * return &obj.from_slice
  12167. * else:
  12168. * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
  12169. * return mslice
  12170. *
  12171. */
  12172. /*else*/ {
  12173. __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
  12174. /* "View.MemoryView":1060
  12175. * else:
  12176. * slice_copy(memview, mslice)
  12177. * return mslice # <<<<<<<<<<<<<<
  12178. *
  12179. * @cname('__pyx_memoryview_slice_copy')
  12180. */
  12181. __pyx_r = __pyx_v_mslice;
  12182. goto __pyx_L0;
  12183. }
  12184. /* "View.MemoryView":1052
  12185. *
  12186. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  12187. * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
  12188. * __Pyx_memviewslice *mslice) except NULL:
  12189. * cdef _memoryviewslice obj
  12190. */
  12191. /* function exit code */
  12192. __pyx_L1_error:;
  12193. __Pyx_XDECREF(__pyx_t_3);
  12194. __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12195. __pyx_r = NULL;
  12196. __pyx_L0:;
  12197. __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  12198. __Pyx_RefNannyFinishContext();
  12199. return __pyx_r;
  12200. }
  12201. /* "View.MemoryView":1063
  12202. *
  12203. * @cname('__pyx_memoryview_slice_copy')
  12204. * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
  12205. * cdef int dim
  12206. * cdef (Py_ssize_t*) shape, strides, suboffsets
  12207. */
  12208. static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  12209. int __pyx_v_dim;
  12210. Py_ssize_t *__pyx_v_shape;
  12211. Py_ssize_t *__pyx_v_strides;
  12212. Py_ssize_t *__pyx_v_suboffsets;
  12213. __Pyx_RefNannyDeclarations
  12214. Py_ssize_t *__pyx_t_1;
  12215. int __pyx_t_2;
  12216. int __pyx_t_3;
  12217. int __pyx_t_4;
  12218. Py_ssize_t __pyx_t_5;
  12219. __Pyx_RefNannySetupContext("slice_copy", 0);
  12220. /* "View.MemoryView":1067
  12221. * cdef (Py_ssize_t*) shape, strides, suboffsets
  12222. *
  12223. * shape = memview.view.shape # <<<<<<<<<<<<<<
  12224. * strides = memview.view.strides
  12225. * suboffsets = memview.view.suboffsets
  12226. */
  12227. __pyx_t_1 = __pyx_v_memview->view.shape;
  12228. __pyx_v_shape = __pyx_t_1;
  12229. /* "View.MemoryView":1068
  12230. *
  12231. * shape = memview.view.shape
  12232. * strides = memview.view.strides # <<<<<<<<<<<<<<
  12233. * suboffsets = memview.view.suboffsets
  12234. *
  12235. */
  12236. __pyx_t_1 = __pyx_v_memview->view.strides;
  12237. __pyx_v_strides = __pyx_t_1;
  12238. /* "View.MemoryView":1069
  12239. * shape = memview.view.shape
  12240. * strides = memview.view.strides
  12241. * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
  12242. *
  12243. * dst.memview = <__pyx_memoryview *> memview
  12244. */
  12245. __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  12246. __pyx_v_suboffsets = __pyx_t_1;
  12247. /* "View.MemoryView":1071
  12248. * suboffsets = memview.view.suboffsets
  12249. *
  12250. * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
  12251. * dst.data = <char *> memview.view.buf
  12252. *
  12253. */
  12254. __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
  12255. /* "View.MemoryView":1072
  12256. *
  12257. * dst.memview = <__pyx_memoryview *> memview
  12258. * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
  12259. *
  12260. * for dim in range(memview.view.ndim):
  12261. */
  12262. __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
  12263. /* "View.MemoryView":1074
  12264. * dst.data = <char *> memview.view.buf
  12265. *
  12266. * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
  12267. * dst.shape[dim] = shape[dim]
  12268. * dst.strides[dim] = strides[dim]
  12269. */
  12270. __pyx_t_2 = __pyx_v_memview->view.ndim;
  12271. __pyx_t_3 = __pyx_t_2;
  12272. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  12273. __pyx_v_dim = __pyx_t_4;
  12274. /* "View.MemoryView":1075
  12275. *
  12276. * for dim in range(memview.view.ndim):
  12277. * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
  12278. * dst.strides[dim] = strides[dim]
  12279. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
  12280. */
  12281. (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
  12282. /* "View.MemoryView":1076
  12283. * for dim in range(memview.view.ndim):
  12284. * dst.shape[dim] = shape[dim]
  12285. * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
  12286. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
  12287. *
  12288. */
  12289. (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
  12290. /* "View.MemoryView":1077
  12291. * dst.shape[dim] = shape[dim]
  12292. * dst.strides[dim] = strides[dim]
  12293. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
  12294. *
  12295. * @cname('__pyx_memoryview_copy_object')
  12296. */
  12297. if ((__pyx_v_suboffsets != 0)) {
  12298. __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
  12299. } else {
  12300. __pyx_t_5 = -1L;
  12301. }
  12302. (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  12303. }
  12304. /* "View.MemoryView":1063
  12305. *
  12306. * @cname('__pyx_memoryview_slice_copy')
  12307. * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
  12308. * cdef int dim
  12309. * cdef (Py_ssize_t*) shape, strides, suboffsets
  12310. */
  12311. /* function exit code */
  12312. __Pyx_RefNannyFinishContext();
  12313. }
  12314. /* "View.MemoryView":1080
  12315. *
  12316. * @cname('__pyx_memoryview_copy_object')
  12317. * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
  12318. * "Create a new memoryview object"
  12319. * cdef __Pyx_memviewslice memviewslice
  12320. */
  12321. static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  12322. __Pyx_memviewslice __pyx_v_memviewslice;
  12323. PyObject *__pyx_r = NULL;
  12324. __Pyx_RefNannyDeclarations
  12325. PyObject *__pyx_t_1 = NULL;
  12326. __Pyx_RefNannySetupContext("memoryview_copy", 0);
  12327. /* "View.MemoryView":1083
  12328. * "Create a new memoryview object"
  12329. * cdef __Pyx_memviewslice memviewslice
  12330. * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
  12331. * return memoryview_copy_from_slice(memview, &memviewslice)
  12332. *
  12333. */
  12334. __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
  12335. /* "View.MemoryView":1084
  12336. * cdef __Pyx_memviewslice memviewslice
  12337. * slice_copy(memview, &memviewslice)
  12338. * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
  12339. *
  12340. * @cname('__pyx_memoryview_copy_object_from_slice')
  12341. */
  12342. __Pyx_XDECREF(__pyx_r);
  12343. __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
  12344. __Pyx_GOTREF(__pyx_t_1);
  12345. __pyx_r = __pyx_t_1;
  12346. __pyx_t_1 = 0;
  12347. goto __pyx_L0;
  12348. /* "View.MemoryView":1080
  12349. *
  12350. * @cname('__pyx_memoryview_copy_object')
  12351. * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
  12352. * "Create a new memoryview object"
  12353. * cdef __Pyx_memviewslice memviewslice
  12354. */
  12355. /* function exit code */
  12356. __pyx_L1_error:;
  12357. __Pyx_XDECREF(__pyx_t_1);
  12358. __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12359. __pyx_r = 0;
  12360. __pyx_L0:;
  12361. __Pyx_XGIVEREF(__pyx_r);
  12362. __Pyx_RefNannyFinishContext();
  12363. return __pyx_r;
  12364. }
  12365. /* "View.MemoryView":1087
  12366. *
  12367. * @cname('__pyx_memoryview_copy_object_from_slice')
  12368. * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
  12369. * """
  12370. * Create a new memoryview object from a given memoryview object and slice.
  12371. */
  12372. static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  12373. PyObject *(*__pyx_v_to_object_func)(char *);
  12374. int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  12375. PyObject *__pyx_r = NULL;
  12376. __Pyx_RefNannyDeclarations
  12377. int __pyx_t_1;
  12378. int __pyx_t_2;
  12379. PyObject *(*__pyx_t_3)(char *);
  12380. int (*__pyx_t_4)(char *, PyObject *);
  12381. PyObject *__pyx_t_5 = NULL;
  12382. __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
  12383. /* "View.MemoryView":1094
  12384. * cdef int (*to_dtype_func)(char *, object) except 0
  12385. *
  12386. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12387. * to_object_func = (<_memoryviewslice> memview).to_object_func
  12388. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12389. */
  12390. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  12391. __pyx_t_2 = (__pyx_t_1 != 0);
  12392. if (__pyx_t_2) {
  12393. /* "View.MemoryView":1095
  12394. *
  12395. * if isinstance(memview, _memoryviewslice):
  12396. * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
  12397. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12398. * else:
  12399. */
  12400. __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
  12401. __pyx_v_to_object_func = __pyx_t_3;
  12402. /* "View.MemoryView":1096
  12403. * if isinstance(memview, _memoryviewslice):
  12404. * to_object_func = (<_memoryviewslice> memview).to_object_func
  12405. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
  12406. * else:
  12407. * to_object_func = NULL
  12408. */
  12409. __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
  12410. __pyx_v_to_dtype_func = __pyx_t_4;
  12411. /* "View.MemoryView":1094
  12412. * cdef int (*to_dtype_func)(char *, object) except 0
  12413. *
  12414. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12415. * to_object_func = (<_memoryviewslice> memview).to_object_func
  12416. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12417. */
  12418. goto __pyx_L3;
  12419. }
  12420. /* "View.MemoryView":1098
  12421. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  12422. * else:
  12423. * to_object_func = NULL # <<<<<<<<<<<<<<
  12424. * to_dtype_func = NULL
  12425. *
  12426. */
  12427. /*else*/ {
  12428. __pyx_v_to_object_func = NULL;
  12429. /* "View.MemoryView":1099
  12430. * else:
  12431. * to_object_func = NULL
  12432. * to_dtype_func = NULL # <<<<<<<<<<<<<<
  12433. *
  12434. * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
  12435. */
  12436. __pyx_v_to_dtype_func = NULL;
  12437. }
  12438. __pyx_L3:;
  12439. /* "View.MemoryView":1101
  12440. * to_dtype_func = NULL
  12441. *
  12442. * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
  12443. * to_object_func, to_dtype_func,
  12444. * memview.dtype_is_object)
  12445. */
  12446. __Pyx_XDECREF(__pyx_r);
  12447. /* "View.MemoryView":1103
  12448. * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
  12449. * to_object_func, to_dtype_func,
  12450. * memview.dtype_is_object) # <<<<<<<<<<<<<<
  12451. *
  12452. *
  12453. */
  12454. __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
  12455. __Pyx_GOTREF(__pyx_t_5);
  12456. __pyx_r = __pyx_t_5;
  12457. __pyx_t_5 = 0;
  12458. goto __pyx_L0;
  12459. /* "View.MemoryView":1087
  12460. *
  12461. * @cname('__pyx_memoryview_copy_object_from_slice')
  12462. * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
  12463. * """
  12464. * Create a new memoryview object from a given memoryview object and slice.
  12465. */
  12466. /* function exit code */
  12467. __pyx_L1_error:;
  12468. __Pyx_XDECREF(__pyx_t_5);
  12469. __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12470. __pyx_r = 0;
  12471. __pyx_L0:;
  12472. __Pyx_XGIVEREF(__pyx_r);
  12473. __Pyx_RefNannyFinishContext();
  12474. return __pyx_r;
  12475. }
  12476. /* "View.MemoryView":1109
  12477. *
  12478. *
  12479. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
  12480. * if arg < 0:
  12481. * return -arg
  12482. */
  12483. static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  12484. Py_ssize_t __pyx_r;
  12485. int __pyx_t_1;
  12486. /* "View.MemoryView":1110
  12487. *
  12488. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  12489. * if arg < 0: # <<<<<<<<<<<<<<
  12490. * return -arg
  12491. * else:
  12492. */
  12493. __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  12494. if (__pyx_t_1) {
  12495. /* "View.MemoryView":1111
  12496. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  12497. * if arg < 0:
  12498. * return -arg # <<<<<<<<<<<<<<
  12499. * else:
  12500. * return arg
  12501. */
  12502. __pyx_r = (-__pyx_v_arg);
  12503. goto __pyx_L0;
  12504. /* "View.MemoryView":1110
  12505. *
  12506. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  12507. * if arg < 0: # <<<<<<<<<<<<<<
  12508. * return -arg
  12509. * else:
  12510. */
  12511. }
  12512. /* "View.MemoryView":1113
  12513. * return -arg
  12514. * else:
  12515. * return arg # <<<<<<<<<<<<<<
  12516. *
  12517. * @cname('__pyx_get_best_slice_order')
  12518. */
  12519. /*else*/ {
  12520. __pyx_r = __pyx_v_arg;
  12521. goto __pyx_L0;
  12522. }
  12523. /* "View.MemoryView":1109
  12524. *
  12525. *
  12526. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
  12527. * if arg < 0:
  12528. * return -arg
  12529. */
  12530. /* function exit code */
  12531. __pyx_L0:;
  12532. return __pyx_r;
  12533. }
  12534. /* "View.MemoryView":1116
  12535. *
  12536. * @cname('__pyx_get_best_slice_order')
  12537. * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
  12538. * """
  12539. * Figure out the best memory access order for a given slice.
  12540. */
  12541. static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  12542. int __pyx_v_i;
  12543. Py_ssize_t __pyx_v_c_stride;
  12544. Py_ssize_t __pyx_v_f_stride;
  12545. char __pyx_r;
  12546. int __pyx_t_1;
  12547. int __pyx_t_2;
  12548. int __pyx_t_3;
  12549. int __pyx_t_4;
  12550. /* "View.MemoryView":1121
  12551. * """
  12552. * cdef int i
  12553. * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
  12554. * cdef Py_ssize_t f_stride = 0
  12555. *
  12556. */
  12557. __pyx_v_c_stride = 0;
  12558. /* "View.MemoryView":1122
  12559. * cdef int i
  12560. * cdef Py_ssize_t c_stride = 0
  12561. * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
  12562. *
  12563. * for i in range(ndim - 1, -1, -1):
  12564. */
  12565. __pyx_v_f_stride = 0;
  12566. /* "View.MemoryView":1124
  12567. * cdef Py_ssize_t f_stride = 0
  12568. *
  12569. * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  12570. * if mslice.shape[i] > 1:
  12571. * c_stride = mslice.strides[i]
  12572. */
  12573. for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
  12574. __pyx_v_i = __pyx_t_1;
  12575. /* "View.MemoryView":1125
  12576. *
  12577. * for i in range(ndim - 1, -1, -1):
  12578. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12579. * c_stride = mslice.strides[i]
  12580. * break
  12581. */
  12582. __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
  12583. if (__pyx_t_2) {
  12584. /* "View.MemoryView":1126
  12585. * for i in range(ndim - 1, -1, -1):
  12586. * if mslice.shape[i] > 1:
  12587. * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
  12588. * break
  12589. *
  12590. */
  12591. __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
  12592. /* "View.MemoryView":1127
  12593. * if mslice.shape[i] > 1:
  12594. * c_stride = mslice.strides[i]
  12595. * break # <<<<<<<<<<<<<<
  12596. *
  12597. * for i in range(ndim):
  12598. */
  12599. goto __pyx_L4_break;
  12600. /* "View.MemoryView":1125
  12601. *
  12602. * for i in range(ndim - 1, -1, -1):
  12603. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12604. * c_stride = mslice.strides[i]
  12605. * break
  12606. */
  12607. }
  12608. }
  12609. __pyx_L4_break:;
  12610. /* "View.MemoryView":1129
  12611. * break
  12612. *
  12613. * for i in range(ndim): # <<<<<<<<<<<<<<
  12614. * if mslice.shape[i] > 1:
  12615. * f_stride = mslice.strides[i]
  12616. */
  12617. __pyx_t_1 = __pyx_v_ndim;
  12618. __pyx_t_3 = __pyx_t_1;
  12619. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  12620. __pyx_v_i = __pyx_t_4;
  12621. /* "View.MemoryView":1130
  12622. *
  12623. * for i in range(ndim):
  12624. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12625. * f_stride = mslice.strides[i]
  12626. * break
  12627. */
  12628. __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
  12629. if (__pyx_t_2) {
  12630. /* "View.MemoryView":1131
  12631. * for i in range(ndim):
  12632. * if mslice.shape[i] > 1:
  12633. * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
  12634. * break
  12635. *
  12636. */
  12637. __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
  12638. /* "View.MemoryView":1132
  12639. * if mslice.shape[i] > 1:
  12640. * f_stride = mslice.strides[i]
  12641. * break # <<<<<<<<<<<<<<
  12642. *
  12643. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
  12644. */
  12645. goto __pyx_L7_break;
  12646. /* "View.MemoryView":1130
  12647. *
  12648. * for i in range(ndim):
  12649. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  12650. * f_stride = mslice.strides[i]
  12651. * break
  12652. */
  12653. }
  12654. }
  12655. __pyx_L7_break:;
  12656. /* "View.MemoryView":1134
  12657. * break
  12658. *
  12659. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
  12660. * return 'C'
  12661. * else:
  12662. */
  12663. __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  12664. if (__pyx_t_2) {
  12665. /* "View.MemoryView":1135
  12666. *
  12667. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
  12668. * return 'C' # <<<<<<<<<<<<<<
  12669. * else:
  12670. * return 'F'
  12671. */
  12672. __pyx_r = 'C';
  12673. goto __pyx_L0;
  12674. /* "View.MemoryView":1134
  12675. * break
  12676. *
  12677. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
  12678. * return 'C'
  12679. * else:
  12680. */
  12681. }
  12682. /* "View.MemoryView":1137
  12683. * return 'C'
  12684. * else:
  12685. * return 'F' # <<<<<<<<<<<<<<
  12686. *
  12687. * @cython.cdivision(True)
  12688. */
  12689. /*else*/ {
  12690. __pyx_r = 'F';
  12691. goto __pyx_L0;
  12692. }
  12693. /* "View.MemoryView":1116
  12694. *
  12695. * @cname('__pyx_get_best_slice_order')
  12696. * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
  12697. * """
  12698. * Figure out the best memory access order for a given slice.
  12699. */
  12700. /* function exit code */
  12701. __pyx_L0:;
  12702. return __pyx_r;
  12703. }
  12704. /* "View.MemoryView":1140
  12705. *
  12706. * @cython.cdivision(True)
  12707. * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
  12708. * char *dst_data, Py_ssize_t *dst_strides,
  12709. * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
  12710. */
  12711. static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  12712. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  12713. CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  12714. Py_ssize_t __pyx_v_dst_extent;
  12715. Py_ssize_t __pyx_v_src_stride;
  12716. Py_ssize_t __pyx_v_dst_stride;
  12717. int __pyx_t_1;
  12718. int __pyx_t_2;
  12719. int __pyx_t_3;
  12720. Py_ssize_t __pyx_t_4;
  12721. Py_ssize_t __pyx_t_5;
  12722. Py_ssize_t __pyx_t_6;
  12723. /* "View.MemoryView":1147
  12724. *
  12725. * cdef Py_ssize_t i
  12726. * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
  12727. * cdef Py_ssize_t dst_extent = dst_shape[0]
  12728. * cdef Py_ssize_t src_stride = src_strides[0]
  12729. */
  12730. __pyx_v_src_extent = (__pyx_v_src_shape[0]);
  12731. /* "View.MemoryView":1148
  12732. * cdef Py_ssize_t i
  12733. * cdef Py_ssize_t src_extent = src_shape[0]
  12734. * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
  12735. * cdef Py_ssize_t src_stride = src_strides[0]
  12736. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12737. */
  12738. __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
  12739. /* "View.MemoryView":1149
  12740. * cdef Py_ssize_t src_extent = src_shape[0]
  12741. * cdef Py_ssize_t dst_extent = dst_shape[0]
  12742. * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
  12743. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12744. *
  12745. */
  12746. __pyx_v_src_stride = (__pyx_v_src_strides[0]);
  12747. /* "View.MemoryView":1150
  12748. * cdef Py_ssize_t dst_extent = dst_shape[0]
  12749. * cdef Py_ssize_t src_stride = src_strides[0]
  12750. * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
  12751. *
  12752. * if ndim == 1:
  12753. */
  12754. __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
  12755. /* "View.MemoryView":1152
  12756. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12757. *
  12758. * if ndim == 1: # <<<<<<<<<<<<<<
  12759. * if (src_stride > 0 and dst_stride > 0 and
  12760. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12761. */
  12762. __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  12763. if (__pyx_t_1) {
  12764. /* "View.MemoryView":1153
  12765. *
  12766. * if ndim == 1:
  12767. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  12768. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12769. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12770. */
  12771. __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
  12772. if (__pyx_t_2) {
  12773. } else {
  12774. __pyx_t_1 = __pyx_t_2;
  12775. goto __pyx_L5_bool_binop_done;
  12776. }
  12777. __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
  12778. if (__pyx_t_2) {
  12779. } else {
  12780. __pyx_t_1 = __pyx_t_2;
  12781. goto __pyx_L5_bool_binop_done;
  12782. }
  12783. /* "View.MemoryView":1154
  12784. * if ndim == 1:
  12785. * if (src_stride > 0 and dst_stride > 0 and
  12786. * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
  12787. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12788. * else:
  12789. */
  12790. __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
  12791. if (__pyx_t_2) {
  12792. __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
  12793. }
  12794. __pyx_t_3 = (__pyx_t_2 != 0);
  12795. __pyx_t_1 = __pyx_t_3;
  12796. __pyx_L5_bool_binop_done:;
  12797. /* "View.MemoryView":1153
  12798. *
  12799. * if ndim == 1:
  12800. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  12801. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12802. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12803. */
  12804. if (__pyx_t_1) {
  12805. /* "View.MemoryView":1155
  12806. * if (src_stride > 0 and dst_stride > 0 and
  12807. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12808. * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
  12809. * else:
  12810. * for i in range(dst_extent):
  12811. */
  12812. (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
  12813. /* "View.MemoryView":1153
  12814. *
  12815. * if ndim == 1:
  12816. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  12817. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12818. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12819. */
  12820. goto __pyx_L4;
  12821. }
  12822. /* "View.MemoryView":1157
  12823. * memcpy(dst_data, src_data, itemsize * dst_extent)
  12824. * else:
  12825. * for i in range(dst_extent): # <<<<<<<<<<<<<<
  12826. * memcpy(dst_data, src_data, itemsize)
  12827. * src_data += src_stride
  12828. */
  12829. /*else*/ {
  12830. __pyx_t_4 = __pyx_v_dst_extent;
  12831. __pyx_t_5 = __pyx_t_4;
  12832. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  12833. __pyx_v_i = __pyx_t_6;
  12834. /* "View.MemoryView":1158
  12835. * else:
  12836. * for i in range(dst_extent):
  12837. * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
  12838. * src_data += src_stride
  12839. * dst_data += dst_stride
  12840. */
  12841. (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
  12842. /* "View.MemoryView":1159
  12843. * for i in range(dst_extent):
  12844. * memcpy(dst_data, src_data, itemsize)
  12845. * src_data += src_stride # <<<<<<<<<<<<<<
  12846. * dst_data += dst_stride
  12847. * else:
  12848. */
  12849. __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
  12850. /* "View.MemoryView":1160
  12851. * memcpy(dst_data, src_data, itemsize)
  12852. * src_data += src_stride
  12853. * dst_data += dst_stride # <<<<<<<<<<<<<<
  12854. * else:
  12855. * for i in range(dst_extent):
  12856. */
  12857. __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
  12858. }
  12859. }
  12860. __pyx_L4:;
  12861. /* "View.MemoryView":1152
  12862. * cdef Py_ssize_t dst_stride = dst_strides[0]
  12863. *
  12864. * if ndim == 1: # <<<<<<<<<<<<<<
  12865. * if (src_stride > 0 and dst_stride > 0 and
  12866. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  12867. */
  12868. goto __pyx_L3;
  12869. }
  12870. /* "View.MemoryView":1162
  12871. * dst_data += dst_stride
  12872. * else:
  12873. * for i in range(dst_extent): # <<<<<<<<<<<<<<
  12874. * _copy_strided_to_strided(src_data, src_strides + 1,
  12875. * dst_data, dst_strides + 1,
  12876. */
  12877. /*else*/ {
  12878. __pyx_t_4 = __pyx_v_dst_extent;
  12879. __pyx_t_5 = __pyx_t_4;
  12880. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  12881. __pyx_v_i = __pyx_t_6;
  12882. /* "View.MemoryView":1163
  12883. * else:
  12884. * for i in range(dst_extent):
  12885. * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
  12886. * dst_data, dst_strides + 1,
  12887. * src_shape + 1, dst_shape + 1,
  12888. */
  12889. _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
  12890. /* "View.MemoryView":1167
  12891. * src_shape + 1, dst_shape + 1,
  12892. * ndim - 1, itemsize)
  12893. * src_data += src_stride # <<<<<<<<<<<<<<
  12894. * dst_data += dst_stride
  12895. *
  12896. */
  12897. __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
  12898. /* "View.MemoryView":1168
  12899. * ndim - 1, itemsize)
  12900. * src_data += src_stride
  12901. * dst_data += dst_stride # <<<<<<<<<<<<<<
  12902. *
  12903. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
  12904. */
  12905. __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
  12906. }
  12907. }
  12908. __pyx_L3:;
  12909. /* "View.MemoryView":1140
  12910. *
  12911. * @cython.cdivision(True)
  12912. * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
  12913. * char *dst_data, Py_ssize_t *dst_strides,
  12914. * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
  12915. */
  12916. /* function exit code */
  12917. }
  12918. /* "View.MemoryView":1170
  12919. * dst_data += dst_stride
  12920. *
  12921. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  12922. * __Pyx_memviewslice *dst,
  12923. * int ndim, size_t itemsize) nogil:
  12924. */
  12925. static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
  12926. /* "View.MemoryView":1173
  12927. * __Pyx_memviewslice *dst,
  12928. * int ndim, size_t itemsize) nogil:
  12929. * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
  12930. * src.shape, dst.shape, ndim, itemsize)
  12931. *
  12932. */
  12933. _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
  12934. /* "View.MemoryView":1170
  12935. * dst_data += dst_stride
  12936. *
  12937. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  12938. * __Pyx_memviewslice *dst,
  12939. * int ndim, size_t itemsize) nogil:
  12940. */
  12941. /* function exit code */
  12942. }
  12943. /* "View.MemoryView":1177
  12944. *
  12945. * @cname('__pyx_memoryview_slice_get_size')
  12946. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
  12947. * "Return the size of the memory occupied by the slice in number of bytes"
  12948. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  12949. */
  12950. static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  12951. Py_ssize_t __pyx_v_shape;
  12952. Py_ssize_t __pyx_v_size;
  12953. Py_ssize_t __pyx_r;
  12954. Py_ssize_t __pyx_t_1;
  12955. Py_ssize_t *__pyx_t_2;
  12956. Py_ssize_t *__pyx_t_3;
  12957. Py_ssize_t *__pyx_t_4;
  12958. /* "View.MemoryView":1179
  12959. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
  12960. * "Return the size of the memory occupied by the slice in number of bytes"
  12961. * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
  12962. *
  12963. * for shape in src.shape[:ndim]:
  12964. */
  12965. __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  12966. __pyx_v_size = __pyx_t_1;
  12967. /* "View.MemoryView":1181
  12968. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  12969. *
  12970. * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
  12971. * size *= shape
  12972. *
  12973. */
  12974. __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  12975. for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
  12976. __pyx_t_2 = __pyx_t_4;
  12977. __pyx_v_shape = (__pyx_t_2[0]);
  12978. /* "View.MemoryView":1182
  12979. *
  12980. * for shape in src.shape[:ndim]:
  12981. * size *= shape # <<<<<<<<<<<<<<
  12982. *
  12983. * return size
  12984. */
  12985. __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  12986. }
  12987. /* "View.MemoryView":1184
  12988. * size *= shape
  12989. *
  12990. * return size # <<<<<<<<<<<<<<
  12991. *
  12992. * @cname('__pyx_fill_contig_strides_array')
  12993. */
  12994. __pyx_r = __pyx_v_size;
  12995. goto __pyx_L0;
  12996. /* "View.MemoryView":1177
  12997. *
  12998. * @cname('__pyx_memoryview_slice_get_size')
  12999. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
  13000. * "Return the size of the memory occupied by the slice in number of bytes"
  13001. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  13002. */
  13003. /* function exit code */
  13004. __pyx_L0:;
  13005. return __pyx_r;
  13006. }
  13007. /* "View.MemoryView":1187
  13008. *
  13009. * @cname('__pyx_fill_contig_strides_array')
  13010. * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
  13011. * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
  13012. * int ndim, char order) nogil:
  13013. */
  13014. static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
  13015. int __pyx_v_idx;
  13016. Py_ssize_t __pyx_r;
  13017. int __pyx_t_1;
  13018. int __pyx_t_2;
  13019. int __pyx_t_3;
  13020. int __pyx_t_4;
  13021. /* "View.MemoryView":1196
  13022. * cdef int idx
  13023. *
  13024. * if order == 'F': # <<<<<<<<<<<<<<
  13025. * for idx in range(ndim):
  13026. * strides[idx] = stride
  13027. */
  13028. __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  13029. if (__pyx_t_1) {
  13030. /* "View.MemoryView":1197
  13031. *
  13032. * if order == 'F':
  13033. * for idx in range(ndim): # <<<<<<<<<<<<<<
  13034. * strides[idx] = stride
  13035. * stride *= shape[idx]
  13036. */
  13037. __pyx_t_2 = __pyx_v_ndim;
  13038. __pyx_t_3 = __pyx_t_2;
  13039. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  13040. __pyx_v_idx = __pyx_t_4;
  13041. /* "View.MemoryView":1198
  13042. * if order == 'F':
  13043. * for idx in range(ndim):
  13044. * strides[idx] = stride # <<<<<<<<<<<<<<
  13045. * stride *= shape[idx]
  13046. * else:
  13047. */
  13048. (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
  13049. /* "View.MemoryView":1199
  13050. * for idx in range(ndim):
  13051. * strides[idx] = stride
  13052. * stride *= shape[idx] # <<<<<<<<<<<<<<
  13053. * else:
  13054. * for idx in range(ndim - 1, -1, -1):
  13055. */
  13056. __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
  13057. }
  13058. /* "View.MemoryView":1196
  13059. * cdef int idx
  13060. *
  13061. * if order == 'F': # <<<<<<<<<<<<<<
  13062. * for idx in range(ndim):
  13063. * strides[idx] = stride
  13064. */
  13065. goto __pyx_L3;
  13066. }
  13067. /* "View.MemoryView":1201
  13068. * stride *= shape[idx]
  13069. * else:
  13070. * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  13071. * strides[idx] = stride
  13072. * stride *= shape[idx]
  13073. */
  13074. /*else*/ {
  13075. for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
  13076. __pyx_v_idx = __pyx_t_2;
  13077. /* "View.MemoryView":1202
  13078. * else:
  13079. * for idx in range(ndim - 1, -1, -1):
  13080. * strides[idx] = stride # <<<<<<<<<<<<<<
  13081. * stride *= shape[idx]
  13082. *
  13083. */
  13084. (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
  13085. /* "View.MemoryView":1203
  13086. * for idx in range(ndim - 1, -1, -1):
  13087. * strides[idx] = stride
  13088. * stride *= shape[idx] # <<<<<<<<<<<<<<
  13089. *
  13090. * return stride
  13091. */
  13092. __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
  13093. }
  13094. }
  13095. __pyx_L3:;
  13096. /* "View.MemoryView":1205
  13097. * stride *= shape[idx]
  13098. *
  13099. * return stride # <<<<<<<<<<<<<<
  13100. *
  13101. * @cname('__pyx_memoryview_copy_data_to_temp')
  13102. */
  13103. __pyx_r = __pyx_v_stride;
  13104. goto __pyx_L0;
  13105. /* "View.MemoryView":1187
  13106. *
  13107. * @cname('__pyx_fill_contig_strides_array')
  13108. * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
  13109. * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
  13110. * int ndim, char order) nogil:
  13111. */
  13112. /* function exit code */
  13113. __pyx_L0:;
  13114. return __pyx_r;
  13115. }
  13116. /* "View.MemoryView":1208
  13117. *
  13118. * @cname('__pyx_memoryview_copy_data_to_temp')
  13119. * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  13120. * __Pyx_memviewslice *tmpslice,
  13121. * char order,
  13122. */
  13123. static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
  13124. int __pyx_v_i;
  13125. void *__pyx_v_result;
  13126. size_t __pyx_v_itemsize;
  13127. size_t __pyx_v_size;
  13128. void *__pyx_r;
  13129. Py_ssize_t __pyx_t_1;
  13130. int __pyx_t_2;
  13131. int __pyx_t_3;
  13132. struct __pyx_memoryview_obj *__pyx_t_4;
  13133. int __pyx_t_5;
  13134. int __pyx_t_6;
  13135. /* "View.MemoryView":1219
  13136. * cdef void *result
  13137. *
  13138. * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
  13139. * cdef size_t size = slice_get_size(src, ndim)
  13140. *
  13141. */
  13142. __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  13143. __pyx_v_itemsize = __pyx_t_1;
  13144. /* "View.MemoryView":1220
  13145. *
  13146. * cdef size_t itemsize = src.memview.view.itemsize
  13147. * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
  13148. *
  13149. * result = malloc(size)
  13150. */
  13151. __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
  13152. /* "View.MemoryView":1222
  13153. * cdef size_t size = slice_get_size(src, ndim)
  13154. *
  13155. * result = malloc(size) # <<<<<<<<<<<<<<
  13156. * if not result:
  13157. * _err(MemoryError, NULL)
  13158. */
  13159. __pyx_v_result = malloc(__pyx_v_size);
  13160. /* "View.MemoryView":1223
  13161. *
  13162. * result = malloc(size)
  13163. * if not result: # <<<<<<<<<<<<<<
  13164. * _err(MemoryError, NULL)
  13165. *
  13166. */
  13167. __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  13168. if (__pyx_t_2) {
  13169. /* "View.MemoryView":1224
  13170. * result = malloc(size)
  13171. * if not result:
  13172. * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
  13173. *
  13174. *
  13175. */
  13176. __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
  13177. /* "View.MemoryView":1223
  13178. *
  13179. * result = malloc(size)
  13180. * if not result: # <<<<<<<<<<<<<<
  13181. * _err(MemoryError, NULL)
  13182. *
  13183. */
  13184. }
  13185. /* "View.MemoryView":1227
  13186. *
  13187. *
  13188. * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
  13189. * tmpslice.memview = src.memview
  13190. * for i in range(ndim):
  13191. */
  13192. __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
  13193. /* "View.MemoryView":1228
  13194. *
  13195. * tmpslice.data = <char *> result
  13196. * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
  13197. * for i in range(ndim):
  13198. * tmpslice.shape[i] = src.shape[i]
  13199. */
  13200. __pyx_t_4 = __pyx_v_src->memview;
  13201. __pyx_v_tmpslice->memview = __pyx_t_4;
  13202. /* "View.MemoryView":1229
  13203. * tmpslice.data = <char *> result
  13204. * tmpslice.memview = src.memview
  13205. * for i in range(ndim): # <<<<<<<<<<<<<<
  13206. * tmpslice.shape[i] = src.shape[i]
  13207. * tmpslice.suboffsets[i] = -1
  13208. */
  13209. __pyx_t_3 = __pyx_v_ndim;
  13210. __pyx_t_5 = __pyx_t_3;
  13211. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  13212. __pyx_v_i = __pyx_t_6;
  13213. /* "View.MemoryView":1230
  13214. * tmpslice.memview = src.memview
  13215. * for i in range(ndim):
  13216. * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
  13217. * tmpslice.suboffsets[i] = -1
  13218. *
  13219. */
  13220. (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
  13221. /* "View.MemoryView":1231
  13222. * for i in range(ndim):
  13223. * tmpslice.shape[i] = src.shape[i]
  13224. * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
  13225. *
  13226. * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
  13227. */
  13228. (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  13229. }
  13230. /* "View.MemoryView":1233
  13231. * tmpslice.suboffsets[i] = -1
  13232. *
  13233. * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
  13234. * ndim, order)
  13235. *
  13236. */
  13237. (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
  13238. /* "View.MemoryView":1237
  13239. *
  13240. *
  13241. * for i in range(ndim): # <<<<<<<<<<<<<<
  13242. * if tmpslice.shape[i] == 1:
  13243. * tmpslice.strides[i] = 0
  13244. */
  13245. __pyx_t_3 = __pyx_v_ndim;
  13246. __pyx_t_5 = __pyx_t_3;
  13247. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  13248. __pyx_v_i = __pyx_t_6;
  13249. /* "View.MemoryView":1238
  13250. *
  13251. * for i in range(ndim):
  13252. * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
  13253. * tmpslice.strides[i] = 0
  13254. *
  13255. */
  13256. __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
  13257. if (__pyx_t_2) {
  13258. /* "View.MemoryView":1239
  13259. * for i in range(ndim):
  13260. * if tmpslice.shape[i] == 1:
  13261. * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
  13262. *
  13263. * if slice_is_contig(src[0], order, ndim):
  13264. */
  13265. (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
  13266. /* "View.MemoryView":1238
  13267. *
  13268. * for i in range(ndim):
  13269. * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
  13270. * tmpslice.strides[i] = 0
  13271. *
  13272. */
  13273. }
  13274. }
  13275. /* "View.MemoryView":1241
  13276. * tmpslice.strides[i] = 0
  13277. *
  13278. * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
  13279. * memcpy(result, src.data, size)
  13280. * else:
  13281. */
  13282. __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  13283. if (__pyx_t_2) {
  13284. /* "View.MemoryView":1242
  13285. *
  13286. * if slice_is_contig(src[0], order, ndim):
  13287. * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
  13288. * else:
  13289. * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
  13290. */
  13291. (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
  13292. /* "View.MemoryView":1241
  13293. * tmpslice.strides[i] = 0
  13294. *
  13295. * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
  13296. * memcpy(result, src.data, size)
  13297. * else:
  13298. */
  13299. goto __pyx_L9;
  13300. }
  13301. /* "View.MemoryView":1244
  13302. * memcpy(result, src.data, size)
  13303. * else:
  13304. * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
  13305. *
  13306. * return result
  13307. */
  13308. /*else*/ {
  13309. copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  13310. }
  13311. __pyx_L9:;
  13312. /* "View.MemoryView":1246
  13313. * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
  13314. *
  13315. * return result # <<<<<<<<<<<<<<
  13316. *
  13317. *
  13318. */
  13319. __pyx_r = __pyx_v_result;
  13320. goto __pyx_L0;
  13321. /* "View.MemoryView":1208
  13322. *
  13323. * @cname('__pyx_memoryview_copy_data_to_temp')
  13324. * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  13325. * __Pyx_memviewslice *tmpslice,
  13326. * char order,
  13327. */
  13328. /* function exit code */
  13329. __pyx_L1_error:;
  13330. {
  13331. #ifdef WITH_THREAD
  13332. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13333. #endif
  13334. __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13335. #ifdef WITH_THREAD
  13336. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13337. #endif
  13338. }
  13339. __pyx_r = NULL;
  13340. __pyx_L0:;
  13341. return __pyx_r;
  13342. }
  13343. /* "View.MemoryView":1251
  13344. *
  13345. * @cname('__pyx_memoryview_err_extents')
  13346. * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
  13347. * Py_ssize_t extent2) except -1 with gil:
  13348. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  13349. */
  13350. static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  13351. int __pyx_r;
  13352. __Pyx_RefNannyDeclarations
  13353. PyObject *__pyx_t_1 = NULL;
  13354. PyObject *__pyx_t_2 = NULL;
  13355. PyObject *__pyx_t_3 = NULL;
  13356. PyObject *__pyx_t_4 = NULL;
  13357. #ifdef WITH_THREAD
  13358. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13359. #endif
  13360. __Pyx_RefNannySetupContext("_err_extents", 0);
  13361. /* "View.MemoryView":1254
  13362. * Py_ssize_t extent2) except -1 with gil:
  13363. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  13364. * (i, extent1, extent2)) # <<<<<<<<<<<<<<
  13365. *
  13366. * @cname('__pyx_memoryview_err_dim')
  13367. */
  13368. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
  13369. __Pyx_GOTREF(__pyx_t_1);
  13370. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
  13371. __Pyx_GOTREF(__pyx_t_2);
  13372. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
  13373. __Pyx_GOTREF(__pyx_t_3);
  13374. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
  13375. __Pyx_GOTREF(__pyx_t_4);
  13376. __Pyx_GIVEREF(__pyx_t_1);
  13377. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  13378. __Pyx_GIVEREF(__pyx_t_2);
  13379. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  13380. __Pyx_GIVEREF(__pyx_t_3);
  13381. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  13382. __pyx_t_1 = 0;
  13383. __pyx_t_2 = 0;
  13384. __pyx_t_3 = 0;
  13385. /* "View.MemoryView":1253
  13386. * cdef int _err_extents(int i, Py_ssize_t extent1,
  13387. * Py_ssize_t extent2) except -1 with gil:
  13388. * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
  13389. * (i, extent1, extent2))
  13390. *
  13391. */
  13392. __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
  13393. __Pyx_GOTREF(__pyx_t_3);
  13394. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13395. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
  13396. __Pyx_GOTREF(__pyx_t_4);
  13397. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13398. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  13399. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13400. __PYX_ERR(1, 1253, __pyx_L1_error)
  13401. /* "View.MemoryView":1251
  13402. *
  13403. * @cname('__pyx_memoryview_err_extents')
  13404. * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
  13405. * Py_ssize_t extent2) except -1 with gil:
  13406. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  13407. */
  13408. /* function exit code */
  13409. __pyx_L1_error:;
  13410. __Pyx_XDECREF(__pyx_t_1);
  13411. __Pyx_XDECREF(__pyx_t_2);
  13412. __Pyx_XDECREF(__pyx_t_3);
  13413. __Pyx_XDECREF(__pyx_t_4);
  13414. __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13415. __pyx_r = -1;
  13416. __Pyx_RefNannyFinishContext();
  13417. #ifdef WITH_THREAD
  13418. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13419. #endif
  13420. return __pyx_r;
  13421. }
  13422. /* "View.MemoryView":1257
  13423. *
  13424. * @cname('__pyx_memoryview_err_dim')
  13425. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
  13426. * raise error(msg.decode('ascii') % dim)
  13427. *
  13428. */
  13429. static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  13430. int __pyx_r;
  13431. __Pyx_RefNannyDeclarations
  13432. PyObject *__pyx_t_1 = NULL;
  13433. PyObject *__pyx_t_2 = NULL;
  13434. PyObject *__pyx_t_3 = NULL;
  13435. PyObject *__pyx_t_4 = NULL;
  13436. #ifdef WITH_THREAD
  13437. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13438. #endif
  13439. __Pyx_RefNannySetupContext("_err_dim", 0);
  13440. __Pyx_INCREF(__pyx_v_error);
  13441. /* "View.MemoryView":1258
  13442. * @cname('__pyx_memoryview_err_dim')
  13443. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
  13444. * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
  13445. *
  13446. * @cname('__pyx_memoryview_err')
  13447. */
  13448. __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
  13449. __Pyx_GOTREF(__pyx_t_2);
  13450. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
  13451. __Pyx_GOTREF(__pyx_t_3);
  13452. __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
  13453. __Pyx_GOTREF(__pyx_t_4);
  13454. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13455. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13456. __Pyx_INCREF(__pyx_v_error);
  13457. __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  13458. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  13459. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  13460. if (likely(__pyx_t_2)) {
  13461. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  13462. __Pyx_INCREF(__pyx_t_2);
  13463. __Pyx_INCREF(function);
  13464. __Pyx_DECREF_SET(__pyx_t_3, function);
  13465. }
  13466. }
  13467. __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
  13468. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13469. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13470. if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
  13471. __Pyx_GOTREF(__pyx_t_1);
  13472. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13473. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  13474. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13475. __PYX_ERR(1, 1258, __pyx_L1_error)
  13476. /* "View.MemoryView":1257
  13477. *
  13478. * @cname('__pyx_memoryview_err_dim')
  13479. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
  13480. * raise error(msg.decode('ascii') % dim)
  13481. *
  13482. */
  13483. /* function exit code */
  13484. __pyx_L1_error:;
  13485. __Pyx_XDECREF(__pyx_t_1);
  13486. __Pyx_XDECREF(__pyx_t_2);
  13487. __Pyx_XDECREF(__pyx_t_3);
  13488. __Pyx_XDECREF(__pyx_t_4);
  13489. __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13490. __pyx_r = -1;
  13491. __Pyx_XDECREF(__pyx_v_error);
  13492. __Pyx_RefNannyFinishContext();
  13493. #ifdef WITH_THREAD
  13494. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13495. #endif
  13496. return __pyx_r;
  13497. }
  13498. /* "View.MemoryView":1261
  13499. *
  13500. * @cname('__pyx_memoryview_err')
  13501. * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
  13502. * if msg != NULL:
  13503. * raise error(msg.decode('ascii'))
  13504. */
  13505. static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  13506. int __pyx_r;
  13507. __Pyx_RefNannyDeclarations
  13508. int __pyx_t_1;
  13509. PyObject *__pyx_t_2 = NULL;
  13510. PyObject *__pyx_t_3 = NULL;
  13511. PyObject *__pyx_t_4 = NULL;
  13512. PyObject *__pyx_t_5 = NULL;
  13513. #ifdef WITH_THREAD
  13514. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13515. #endif
  13516. __Pyx_RefNannySetupContext("_err", 0);
  13517. __Pyx_INCREF(__pyx_v_error);
  13518. /* "View.MemoryView":1262
  13519. * @cname('__pyx_memoryview_err')
  13520. * cdef int _err(object error, char *msg) except -1 with gil:
  13521. * if msg != NULL: # <<<<<<<<<<<<<<
  13522. * raise error(msg.decode('ascii'))
  13523. * else:
  13524. */
  13525. __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  13526. if (unlikely(__pyx_t_1)) {
  13527. /* "View.MemoryView":1263
  13528. * cdef int _err(object error, char *msg) except -1 with gil:
  13529. * if msg != NULL:
  13530. * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
  13531. * else:
  13532. * raise error
  13533. */
  13534. __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
  13535. __Pyx_GOTREF(__pyx_t_3);
  13536. __Pyx_INCREF(__pyx_v_error);
  13537. __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
  13538. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  13539. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
  13540. if (likely(__pyx_t_5)) {
  13541. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  13542. __Pyx_INCREF(__pyx_t_5);
  13543. __Pyx_INCREF(function);
  13544. __Pyx_DECREF_SET(__pyx_t_4, function);
  13545. }
  13546. }
  13547. __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
  13548. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  13549. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13550. if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
  13551. __Pyx_GOTREF(__pyx_t_2);
  13552. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13553. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  13554. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13555. __PYX_ERR(1, 1263, __pyx_L1_error)
  13556. /* "View.MemoryView":1262
  13557. * @cname('__pyx_memoryview_err')
  13558. * cdef int _err(object error, char *msg) except -1 with gil:
  13559. * if msg != NULL: # <<<<<<<<<<<<<<
  13560. * raise error(msg.decode('ascii'))
  13561. * else:
  13562. */
  13563. }
  13564. /* "View.MemoryView":1265
  13565. * raise error(msg.decode('ascii'))
  13566. * else:
  13567. * raise error # <<<<<<<<<<<<<<
  13568. *
  13569. * @cname('__pyx_memoryview_copy_contents')
  13570. */
  13571. /*else*/ {
  13572. __Pyx_Raise(__pyx_v_error, 0, 0, 0);
  13573. __PYX_ERR(1, 1265, __pyx_L1_error)
  13574. }
  13575. /* "View.MemoryView":1261
  13576. *
  13577. * @cname('__pyx_memoryview_err')
  13578. * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
  13579. * if msg != NULL:
  13580. * raise error(msg.decode('ascii'))
  13581. */
  13582. /* function exit code */
  13583. __pyx_L1_error:;
  13584. __Pyx_XDECREF(__pyx_t_2);
  13585. __Pyx_XDECREF(__pyx_t_3);
  13586. __Pyx_XDECREF(__pyx_t_4);
  13587. __Pyx_XDECREF(__pyx_t_5);
  13588. __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13589. __pyx_r = -1;
  13590. __Pyx_XDECREF(__pyx_v_error);
  13591. __Pyx_RefNannyFinishContext();
  13592. #ifdef WITH_THREAD
  13593. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13594. #endif
  13595. return __pyx_r;
  13596. }
  13597. /* "View.MemoryView":1268
  13598. *
  13599. * @cname('__pyx_memoryview_copy_contents')
  13600. * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
  13601. * __Pyx_memviewslice dst,
  13602. * int src_ndim, int dst_ndim,
  13603. */
  13604. static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
  13605. void *__pyx_v_tmpdata;
  13606. size_t __pyx_v_itemsize;
  13607. int __pyx_v_i;
  13608. char __pyx_v_order;
  13609. int __pyx_v_broadcasting;
  13610. int __pyx_v_direct_copy;
  13611. __Pyx_memviewslice __pyx_v_tmp;
  13612. int __pyx_v_ndim;
  13613. int __pyx_r;
  13614. Py_ssize_t __pyx_t_1;
  13615. int __pyx_t_2;
  13616. int __pyx_t_3;
  13617. int __pyx_t_4;
  13618. int __pyx_t_5;
  13619. int __pyx_t_6;
  13620. void *__pyx_t_7;
  13621. int __pyx_t_8;
  13622. /* "View.MemoryView":1276
  13623. * Check for overlapping memory and verify the shapes.
  13624. * """
  13625. * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
  13626. * cdef size_t itemsize = src.memview.view.itemsize
  13627. * cdef int i
  13628. */
  13629. __pyx_v_tmpdata = NULL;
  13630. /* "View.MemoryView":1277
  13631. * """
  13632. * cdef void *tmpdata = NULL
  13633. * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
  13634. * cdef int i
  13635. * cdef char order = get_best_order(&src, src_ndim)
  13636. */
  13637. __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  13638. __pyx_v_itemsize = __pyx_t_1;
  13639. /* "View.MemoryView":1279
  13640. * cdef size_t itemsize = src.memview.view.itemsize
  13641. * cdef int i
  13642. * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
  13643. * cdef bint broadcasting = False
  13644. * cdef bint direct_copy = False
  13645. */
  13646. __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
  13647. /* "View.MemoryView":1280
  13648. * cdef int i
  13649. * cdef char order = get_best_order(&src, src_ndim)
  13650. * cdef bint broadcasting = False # <<<<<<<<<<<<<<
  13651. * cdef bint direct_copy = False
  13652. * cdef __Pyx_memviewslice tmp
  13653. */
  13654. __pyx_v_broadcasting = 0;
  13655. /* "View.MemoryView":1281
  13656. * cdef char order = get_best_order(&src, src_ndim)
  13657. * cdef bint broadcasting = False
  13658. * cdef bint direct_copy = False # <<<<<<<<<<<<<<
  13659. * cdef __Pyx_memviewslice tmp
  13660. *
  13661. */
  13662. __pyx_v_direct_copy = 0;
  13663. /* "View.MemoryView":1284
  13664. * cdef __Pyx_memviewslice tmp
  13665. *
  13666. * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
  13667. * broadcast_leading(&src, src_ndim, dst_ndim)
  13668. * elif dst_ndim < src_ndim:
  13669. */
  13670. __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  13671. if (__pyx_t_2) {
  13672. /* "View.MemoryView":1285
  13673. *
  13674. * if src_ndim < dst_ndim:
  13675. * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
  13676. * elif dst_ndim < src_ndim:
  13677. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13678. */
  13679. __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
  13680. /* "View.MemoryView":1284
  13681. * cdef __Pyx_memviewslice tmp
  13682. *
  13683. * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
  13684. * broadcast_leading(&src, src_ndim, dst_ndim)
  13685. * elif dst_ndim < src_ndim:
  13686. */
  13687. goto __pyx_L3;
  13688. }
  13689. /* "View.MemoryView":1286
  13690. * if src_ndim < dst_ndim:
  13691. * broadcast_leading(&src, src_ndim, dst_ndim)
  13692. * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
  13693. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13694. *
  13695. */
  13696. __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  13697. if (__pyx_t_2) {
  13698. /* "View.MemoryView":1287
  13699. * broadcast_leading(&src, src_ndim, dst_ndim)
  13700. * elif dst_ndim < src_ndim:
  13701. * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
  13702. *
  13703. * cdef int ndim = max(src_ndim, dst_ndim)
  13704. */
  13705. __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
  13706. /* "View.MemoryView":1286
  13707. * if src_ndim < dst_ndim:
  13708. * broadcast_leading(&src, src_ndim, dst_ndim)
  13709. * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
  13710. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13711. *
  13712. */
  13713. }
  13714. __pyx_L3:;
  13715. /* "View.MemoryView":1289
  13716. * broadcast_leading(&dst, dst_ndim, src_ndim)
  13717. *
  13718. * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
  13719. *
  13720. * for i in range(ndim):
  13721. */
  13722. __pyx_t_3 = __pyx_v_dst_ndim;
  13723. __pyx_t_4 = __pyx_v_src_ndim;
  13724. if (((__pyx_t_3 > __pyx_t_4) != 0)) {
  13725. __pyx_t_5 = __pyx_t_3;
  13726. } else {
  13727. __pyx_t_5 = __pyx_t_4;
  13728. }
  13729. __pyx_v_ndim = __pyx_t_5;
  13730. /* "View.MemoryView":1291
  13731. * cdef int ndim = max(src_ndim, dst_ndim)
  13732. *
  13733. * for i in range(ndim): # <<<<<<<<<<<<<<
  13734. * if src.shape[i] != dst.shape[i]:
  13735. * if src.shape[i] == 1:
  13736. */
  13737. __pyx_t_5 = __pyx_v_ndim;
  13738. __pyx_t_3 = __pyx_t_5;
  13739. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  13740. __pyx_v_i = __pyx_t_4;
  13741. /* "View.MemoryView":1292
  13742. *
  13743. * for i in range(ndim):
  13744. * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
  13745. * if src.shape[i] == 1:
  13746. * broadcasting = True
  13747. */
  13748. __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
  13749. if (__pyx_t_2) {
  13750. /* "View.MemoryView":1293
  13751. * for i in range(ndim):
  13752. * if src.shape[i] != dst.shape[i]:
  13753. * if src.shape[i] == 1: # <<<<<<<<<<<<<<
  13754. * broadcasting = True
  13755. * src.strides[i] = 0
  13756. */
  13757. __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
  13758. if (__pyx_t_2) {
  13759. /* "View.MemoryView":1294
  13760. * if src.shape[i] != dst.shape[i]:
  13761. * if src.shape[i] == 1:
  13762. * broadcasting = True # <<<<<<<<<<<<<<
  13763. * src.strides[i] = 0
  13764. * else:
  13765. */
  13766. __pyx_v_broadcasting = 1;
  13767. /* "View.MemoryView":1295
  13768. * if src.shape[i] == 1:
  13769. * broadcasting = True
  13770. * src.strides[i] = 0 # <<<<<<<<<<<<<<
  13771. * else:
  13772. * _err_extents(i, dst.shape[i], src.shape[i])
  13773. */
  13774. (__pyx_v_src.strides[__pyx_v_i]) = 0;
  13775. /* "View.MemoryView":1293
  13776. * for i in range(ndim):
  13777. * if src.shape[i] != dst.shape[i]:
  13778. * if src.shape[i] == 1: # <<<<<<<<<<<<<<
  13779. * broadcasting = True
  13780. * src.strides[i] = 0
  13781. */
  13782. goto __pyx_L7;
  13783. }
  13784. /* "View.MemoryView":1297
  13785. * src.strides[i] = 0
  13786. * else:
  13787. * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
  13788. *
  13789. * if src.suboffsets[i] >= 0:
  13790. */
  13791. /*else*/ {
  13792. __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
  13793. }
  13794. __pyx_L7:;
  13795. /* "View.MemoryView":1292
  13796. *
  13797. * for i in range(ndim):
  13798. * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
  13799. * if src.shape[i] == 1:
  13800. * broadcasting = True
  13801. */
  13802. }
  13803. /* "View.MemoryView":1299
  13804. * _err_extents(i, dst.shape[i], src.shape[i])
  13805. *
  13806. * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
  13807. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13808. *
  13809. */
  13810. __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
  13811. if (__pyx_t_2) {
  13812. /* "View.MemoryView":1300
  13813. *
  13814. * if src.suboffsets[i] >= 0:
  13815. * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
  13816. *
  13817. * if slices_overlap(&src, &dst, ndim, itemsize):
  13818. */
  13819. __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
  13820. /* "View.MemoryView":1299
  13821. * _err_extents(i, dst.shape[i], src.shape[i])
  13822. *
  13823. * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
  13824. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13825. *
  13826. */
  13827. }
  13828. }
  13829. /* "View.MemoryView":1302
  13830. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13831. *
  13832. * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
  13833. *
  13834. * if not slice_is_contig(src, order, ndim):
  13835. */
  13836. __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  13837. if (__pyx_t_2) {
  13838. /* "View.MemoryView":1304
  13839. * if slices_overlap(&src, &dst, ndim, itemsize):
  13840. *
  13841. * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
  13842. * order = get_best_order(&dst, ndim)
  13843. *
  13844. */
  13845. __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
  13846. if (__pyx_t_2) {
  13847. /* "View.MemoryView":1305
  13848. *
  13849. * if not slice_is_contig(src, order, ndim):
  13850. * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
  13851. *
  13852. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
  13853. */
  13854. __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
  13855. /* "View.MemoryView":1304
  13856. * if slices_overlap(&src, &dst, ndim, itemsize):
  13857. *
  13858. * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
  13859. * order = get_best_order(&dst, ndim)
  13860. *
  13861. */
  13862. }
  13863. /* "View.MemoryView":1307
  13864. * order = get_best_order(&dst, ndim)
  13865. *
  13866. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
  13867. * src = tmp
  13868. *
  13869. */
  13870. __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
  13871. __pyx_v_tmpdata = __pyx_t_7;
  13872. /* "View.MemoryView":1308
  13873. *
  13874. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
  13875. * src = tmp # <<<<<<<<<<<<<<
  13876. *
  13877. * if not broadcasting:
  13878. */
  13879. __pyx_v_src = __pyx_v_tmp;
  13880. /* "View.MemoryView":1302
  13881. * _err_dim(ValueError, "Dimension %d is not direct", i)
  13882. *
  13883. * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
  13884. *
  13885. * if not slice_is_contig(src, order, ndim):
  13886. */
  13887. }
  13888. /* "View.MemoryView":1310
  13889. * src = tmp
  13890. *
  13891. * if not broadcasting: # <<<<<<<<<<<<<<
  13892. *
  13893. *
  13894. */
  13895. __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  13896. if (__pyx_t_2) {
  13897. /* "View.MemoryView":1313
  13898. *
  13899. *
  13900. * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
  13901. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13902. * elif slice_is_contig(src, 'F', ndim):
  13903. */
  13904. __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
  13905. if (__pyx_t_2) {
  13906. /* "View.MemoryView":1314
  13907. *
  13908. * if slice_is_contig(src, 'C', ndim):
  13909. * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
  13910. * elif slice_is_contig(src, 'F', ndim):
  13911. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13912. */
  13913. __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
  13914. /* "View.MemoryView":1313
  13915. *
  13916. *
  13917. * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
  13918. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13919. * elif slice_is_contig(src, 'F', ndim):
  13920. */
  13921. goto __pyx_L12;
  13922. }
  13923. /* "View.MemoryView":1315
  13924. * if slice_is_contig(src, 'C', ndim):
  13925. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13926. * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
  13927. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13928. *
  13929. */
  13930. __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
  13931. if (__pyx_t_2) {
  13932. /* "View.MemoryView":1316
  13933. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13934. * elif slice_is_contig(src, 'F', ndim):
  13935. * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
  13936. *
  13937. * if direct_copy:
  13938. */
  13939. __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
  13940. /* "View.MemoryView":1315
  13941. * if slice_is_contig(src, 'C', ndim):
  13942. * direct_copy = slice_is_contig(dst, 'C', ndim)
  13943. * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
  13944. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13945. *
  13946. */
  13947. }
  13948. __pyx_L12:;
  13949. /* "View.MemoryView":1318
  13950. * direct_copy = slice_is_contig(dst, 'F', ndim)
  13951. *
  13952. * if direct_copy: # <<<<<<<<<<<<<<
  13953. *
  13954. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13955. */
  13956. __pyx_t_2 = (__pyx_v_direct_copy != 0);
  13957. if (__pyx_t_2) {
  13958. /* "View.MemoryView":1320
  13959. * if direct_copy:
  13960. *
  13961. * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  13962. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  13963. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13964. */
  13965. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  13966. /* "View.MemoryView":1321
  13967. *
  13968. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13969. * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
  13970. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13971. * free(tmpdata)
  13972. */
  13973. (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
  13974. /* "View.MemoryView":1322
  13975. * refcount_copying(&dst, dtype_is_object, ndim, False)
  13976. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  13977. * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  13978. * free(tmpdata)
  13979. * return 0
  13980. */
  13981. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  13982. /* "View.MemoryView":1323
  13983. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  13984. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13985. * free(tmpdata) # <<<<<<<<<<<<<<
  13986. * return 0
  13987. *
  13988. */
  13989. free(__pyx_v_tmpdata);
  13990. /* "View.MemoryView":1324
  13991. * refcount_copying(&dst, dtype_is_object, ndim, True)
  13992. * free(tmpdata)
  13993. * return 0 # <<<<<<<<<<<<<<
  13994. *
  13995. * if order == 'F' == get_best_order(&dst, ndim):
  13996. */
  13997. __pyx_r = 0;
  13998. goto __pyx_L0;
  13999. /* "View.MemoryView":1318
  14000. * direct_copy = slice_is_contig(dst, 'F', ndim)
  14001. *
  14002. * if direct_copy: # <<<<<<<<<<<<<<
  14003. *
  14004. * refcount_copying(&dst, dtype_is_object, ndim, False)
  14005. */
  14006. }
  14007. /* "View.MemoryView":1310
  14008. * src = tmp
  14009. *
  14010. * if not broadcasting: # <<<<<<<<<<<<<<
  14011. *
  14012. *
  14013. */
  14014. }
  14015. /* "View.MemoryView":1326
  14016. * return 0
  14017. *
  14018. * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
  14019. *
  14020. *
  14021. */
  14022. __pyx_t_2 = (__pyx_v_order == 'F');
  14023. if (__pyx_t_2) {
  14024. __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  14025. }
  14026. __pyx_t_8 = (__pyx_t_2 != 0);
  14027. if (__pyx_t_8) {
  14028. /* "View.MemoryView":1329
  14029. *
  14030. *
  14031. * transpose_memslice(&src) # <<<<<<<<<<<<<<
  14032. * transpose_memslice(&dst)
  14033. *
  14034. */
  14035. __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
  14036. /* "View.MemoryView":1330
  14037. *
  14038. * transpose_memslice(&src)
  14039. * transpose_memslice(&dst) # <<<<<<<<<<<<<<
  14040. *
  14041. * refcount_copying(&dst, dtype_is_object, ndim, False)
  14042. */
  14043. __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
  14044. /* "View.MemoryView":1326
  14045. * return 0
  14046. *
  14047. * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
  14048. *
  14049. *
  14050. */
  14051. }
  14052. /* "View.MemoryView":1332
  14053. * transpose_memslice(&dst)
  14054. *
  14055. * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  14056. * copy_strided_to_strided(&src, &dst, ndim, itemsize)
  14057. * refcount_copying(&dst, dtype_is_object, ndim, True)
  14058. */
  14059. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  14060. /* "View.MemoryView":1333
  14061. *
  14062. * refcount_copying(&dst, dtype_is_object, ndim, False)
  14063. * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
  14064. * refcount_copying(&dst, dtype_is_object, ndim, True)
  14065. *
  14066. */
  14067. copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
  14068. /* "View.MemoryView":1334
  14069. * refcount_copying(&dst, dtype_is_object, ndim, False)
  14070. * copy_strided_to_strided(&src, &dst, ndim, itemsize)
  14071. * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  14072. *
  14073. * free(tmpdata)
  14074. */
  14075. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  14076. /* "View.MemoryView":1336
  14077. * refcount_copying(&dst, dtype_is_object, ndim, True)
  14078. *
  14079. * free(tmpdata) # <<<<<<<<<<<<<<
  14080. * return 0
  14081. *
  14082. */
  14083. free(__pyx_v_tmpdata);
  14084. /* "View.MemoryView":1337
  14085. *
  14086. * free(tmpdata)
  14087. * return 0 # <<<<<<<<<<<<<<
  14088. *
  14089. * @cname('__pyx_memoryview_broadcast_leading')
  14090. */
  14091. __pyx_r = 0;
  14092. goto __pyx_L0;
  14093. /* "View.MemoryView":1268
  14094. *
  14095. * @cname('__pyx_memoryview_copy_contents')
  14096. * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
  14097. * __Pyx_memviewslice dst,
  14098. * int src_ndim, int dst_ndim,
  14099. */
  14100. /* function exit code */
  14101. __pyx_L1_error:;
  14102. {
  14103. #ifdef WITH_THREAD
  14104. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  14105. #endif
  14106. __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14107. #ifdef WITH_THREAD
  14108. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  14109. #endif
  14110. }
  14111. __pyx_r = -1;
  14112. __pyx_L0:;
  14113. return __pyx_r;
  14114. }
  14115. /* "View.MemoryView":1340
  14116. *
  14117. * @cname('__pyx_memoryview_broadcast_leading')
  14118. * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
  14119. * int ndim,
  14120. * int ndim_other) nogil:
  14121. */
  14122. static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  14123. int __pyx_v_i;
  14124. int __pyx_v_offset;
  14125. int __pyx_t_1;
  14126. int __pyx_t_2;
  14127. int __pyx_t_3;
  14128. /* "View.MemoryView":1344
  14129. * int ndim_other) nogil:
  14130. * cdef int i
  14131. * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
  14132. *
  14133. * for i in range(ndim - 1, -1, -1):
  14134. */
  14135. __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
  14136. /* "View.MemoryView":1346
  14137. * cdef int offset = ndim_other - ndim
  14138. *
  14139. * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  14140. * mslice.shape[i + offset] = mslice.shape[i]
  14141. * mslice.strides[i + offset] = mslice.strides[i]
  14142. */
  14143. for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
  14144. __pyx_v_i = __pyx_t_1;
  14145. /* "View.MemoryView":1347
  14146. *
  14147. * for i in range(ndim - 1, -1, -1):
  14148. * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
  14149. * mslice.strides[i + offset] = mslice.strides[i]
  14150. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  14151. */
  14152. (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
  14153. /* "View.MemoryView":1348
  14154. * for i in range(ndim - 1, -1, -1):
  14155. * mslice.shape[i + offset] = mslice.shape[i]
  14156. * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
  14157. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  14158. *
  14159. */
  14160. (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
  14161. /* "View.MemoryView":1349
  14162. * mslice.shape[i + offset] = mslice.shape[i]
  14163. * mslice.strides[i + offset] = mslice.strides[i]
  14164. * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
  14165. *
  14166. * for i in range(offset):
  14167. */
  14168. (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  14169. }
  14170. /* "View.MemoryView":1351
  14171. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  14172. *
  14173. * for i in range(offset): # <<<<<<<<<<<<<<
  14174. * mslice.shape[i] = 1
  14175. * mslice.strides[i] = mslice.strides[0]
  14176. */
  14177. __pyx_t_1 = __pyx_v_offset;
  14178. __pyx_t_2 = __pyx_t_1;
  14179. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  14180. __pyx_v_i = __pyx_t_3;
  14181. /* "View.MemoryView":1352
  14182. *
  14183. * for i in range(offset):
  14184. * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
  14185. * mslice.strides[i] = mslice.strides[0]
  14186. * mslice.suboffsets[i] = -1
  14187. */
  14188. (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
  14189. /* "View.MemoryView":1353
  14190. * for i in range(offset):
  14191. * mslice.shape[i] = 1
  14192. * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
  14193. * mslice.suboffsets[i] = -1
  14194. *
  14195. */
  14196. (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
  14197. /* "View.MemoryView":1354
  14198. * mslice.shape[i] = 1
  14199. * mslice.strides[i] = mslice.strides[0]
  14200. * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
  14201. *
  14202. *
  14203. */
  14204. (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  14205. }
  14206. /* "View.MemoryView":1340
  14207. *
  14208. * @cname('__pyx_memoryview_broadcast_leading')
  14209. * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
  14210. * int ndim,
  14211. * int ndim_other) nogil:
  14212. */
  14213. /* function exit code */
  14214. }
  14215. /* "View.MemoryView":1362
  14216. *
  14217. * @cname('__pyx_memoryview_refcount_copying')
  14218. * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
  14219. * int ndim, bint inc) nogil:
  14220. *
  14221. */
  14222. static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
  14223. int __pyx_t_1;
  14224. /* "View.MemoryView":1366
  14225. *
  14226. *
  14227. * if dtype_is_object: # <<<<<<<<<<<<<<
  14228. * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  14229. * dst.strides, ndim, inc)
  14230. */
  14231. __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  14232. if (__pyx_t_1) {
  14233. /* "View.MemoryView":1367
  14234. *
  14235. * if dtype_is_object:
  14236. * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
  14237. * dst.strides, ndim, inc)
  14238. *
  14239. */
  14240. __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
  14241. /* "View.MemoryView":1366
  14242. *
  14243. *
  14244. * if dtype_is_object: # <<<<<<<<<<<<<<
  14245. * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  14246. * dst.strides, ndim, inc)
  14247. */
  14248. }
  14249. /* "View.MemoryView":1362
  14250. *
  14251. * @cname('__pyx_memoryview_refcount_copying')
  14252. * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
  14253. * int ndim, bint inc) nogil:
  14254. *
  14255. */
  14256. /* function exit code */
  14257. }
  14258. /* "View.MemoryView":1371
  14259. *
  14260. * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
  14261. * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14262. * Py_ssize_t *strides, int ndim,
  14263. * bint inc) with gil:
  14264. */
  14265. static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  14266. __Pyx_RefNannyDeclarations
  14267. #ifdef WITH_THREAD
  14268. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  14269. #endif
  14270. __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
  14271. /* "View.MemoryView":1374
  14272. * Py_ssize_t *strides, int ndim,
  14273. * bint inc) with gil:
  14274. * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
  14275. *
  14276. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  14277. */
  14278. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
  14279. /* "View.MemoryView":1371
  14280. *
  14281. * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
  14282. * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14283. * Py_ssize_t *strides, int ndim,
  14284. * bint inc) with gil:
  14285. */
  14286. /* function exit code */
  14287. __Pyx_RefNannyFinishContext();
  14288. #ifdef WITH_THREAD
  14289. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  14290. #endif
  14291. }
  14292. /* "View.MemoryView":1377
  14293. *
  14294. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  14295. * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14296. * Py_ssize_t *strides, int ndim, bint inc):
  14297. * cdef Py_ssize_t i
  14298. */
  14299. static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
  14300. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  14301. __Pyx_RefNannyDeclarations
  14302. Py_ssize_t __pyx_t_1;
  14303. Py_ssize_t __pyx_t_2;
  14304. Py_ssize_t __pyx_t_3;
  14305. int __pyx_t_4;
  14306. __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
  14307. /* "View.MemoryView":1381
  14308. * cdef Py_ssize_t i
  14309. *
  14310. * for i in range(shape[0]): # <<<<<<<<<<<<<<
  14311. * if ndim == 1:
  14312. * if inc:
  14313. */
  14314. __pyx_t_1 = (__pyx_v_shape[0]);
  14315. __pyx_t_2 = __pyx_t_1;
  14316. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  14317. __pyx_v_i = __pyx_t_3;
  14318. /* "View.MemoryView":1382
  14319. *
  14320. * for i in range(shape[0]):
  14321. * if ndim == 1: # <<<<<<<<<<<<<<
  14322. * if inc:
  14323. * Py_INCREF((<PyObject **> data)[0])
  14324. */
  14325. __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
  14326. if (__pyx_t_4) {
  14327. /* "View.MemoryView":1383
  14328. * for i in range(shape[0]):
  14329. * if ndim == 1:
  14330. * if inc: # <<<<<<<<<<<<<<
  14331. * Py_INCREF((<PyObject **> data)[0])
  14332. * else:
  14333. */
  14334. __pyx_t_4 = (__pyx_v_inc != 0);
  14335. if (__pyx_t_4) {
  14336. /* "View.MemoryView":1384
  14337. * if ndim == 1:
  14338. * if inc:
  14339. * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
  14340. * else:
  14341. * Py_DECREF((<PyObject **> data)[0])
  14342. */
  14343. Py_INCREF((((PyObject **)__pyx_v_data)[0]));
  14344. /* "View.MemoryView":1383
  14345. * for i in range(shape[0]):
  14346. * if ndim == 1:
  14347. * if inc: # <<<<<<<<<<<<<<
  14348. * Py_INCREF((<PyObject **> data)[0])
  14349. * else:
  14350. */
  14351. goto __pyx_L6;
  14352. }
  14353. /* "View.MemoryView":1386
  14354. * Py_INCREF((<PyObject **> data)[0])
  14355. * else:
  14356. * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
  14357. * else:
  14358. * refcount_objects_in_slice(data, shape + 1, strides + 1,
  14359. */
  14360. /*else*/ {
  14361. Py_DECREF((((PyObject **)__pyx_v_data)[0]));
  14362. }
  14363. __pyx_L6:;
  14364. /* "View.MemoryView":1382
  14365. *
  14366. * for i in range(shape[0]):
  14367. * if ndim == 1: # <<<<<<<<<<<<<<
  14368. * if inc:
  14369. * Py_INCREF((<PyObject **> data)[0])
  14370. */
  14371. goto __pyx_L5;
  14372. }
  14373. /* "View.MemoryView":1388
  14374. * Py_DECREF((<PyObject **> data)[0])
  14375. * else:
  14376. * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
  14377. * ndim - 1, inc)
  14378. *
  14379. */
  14380. /*else*/ {
  14381. /* "View.MemoryView":1389
  14382. * else:
  14383. * refcount_objects_in_slice(data, shape + 1, strides + 1,
  14384. * ndim - 1, inc) # <<<<<<<<<<<<<<
  14385. *
  14386. * data += strides[0]
  14387. */
  14388. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
  14389. }
  14390. __pyx_L5:;
  14391. /* "View.MemoryView":1391
  14392. * ndim - 1, inc)
  14393. *
  14394. * data += strides[0] # <<<<<<<<<<<<<<
  14395. *
  14396. *
  14397. */
  14398. __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  14399. }
  14400. /* "View.MemoryView":1377
  14401. *
  14402. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  14403. * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14404. * Py_ssize_t *strides, int ndim, bint inc):
  14405. * cdef Py_ssize_t i
  14406. */
  14407. /* function exit code */
  14408. __Pyx_RefNannyFinishContext();
  14409. }
  14410. /* "View.MemoryView":1397
  14411. *
  14412. * @cname('__pyx_memoryview_slice_assign_scalar')
  14413. * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
  14414. * size_t itemsize, void *item,
  14415. * bint dtype_is_object) nogil:
  14416. */
  14417. static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
  14418. /* "View.MemoryView":1400
  14419. * size_t itemsize, void *item,
  14420. * bint dtype_is_object) nogil:
  14421. * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  14422. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
  14423. * itemsize, item)
  14424. */
  14425. __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  14426. /* "View.MemoryView":1401
  14427. * bint dtype_is_object) nogil:
  14428. * refcount_copying(dst, dtype_is_object, ndim, False)
  14429. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
  14430. * itemsize, item)
  14431. * refcount_copying(dst, dtype_is_object, ndim, True)
  14432. */
  14433. __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
  14434. /* "View.MemoryView":1403
  14435. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
  14436. * itemsize, item)
  14437. * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  14438. *
  14439. *
  14440. */
  14441. __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  14442. /* "View.MemoryView":1397
  14443. *
  14444. * @cname('__pyx_memoryview_slice_assign_scalar')
  14445. * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
  14446. * size_t itemsize, void *item,
  14447. * bint dtype_is_object) nogil:
  14448. */
  14449. /* function exit code */
  14450. }
  14451. /* "View.MemoryView":1407
  14452. *
  14453. * @cname('__pyx_memoryview__slice_assign_scalar')
  14454. * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14455. * Py_ssize_t *strides, int ndim,
  14456. * size_t itemsize, void *item) nogil:
  14457. */
  14458. static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
  14459. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  14460. Py_ssize_t __pyx_v_stride;
  14461. Py_ssize_t __pyx_v_extent;
  14462. int __pyx_t_1;
  14463. Py_ssize_t __pyx_t_2;
  14464. Py_ssize_t __pyx_t_3;
  14465. Py_ssize_t __pyx_t_4;
  14466. /* "View.MemoryView":1411
  14467. * size_t itemsize, void *item) nogil:
  14468. * cdef Py_ssize_t i
  14469. * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
  14470. * cdef Py_ssize_t extent = shape[0]
  14471. *
  14472. */
  14473. __pyx_v_stride = (__pyx_v_strides[0]);
  14474. /* "View.MemoryView":1412
  14475. * cdef Py_ssize_t i
  14476. * cdef Py_ssize_t stride = strides[0]
  14477. * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
  14478. *
  14479. * if ndim == 1:
  14480. */
  14481. __pyx_v_extent = (__pyx_v_shape[0]);
  14482. /* "View.MemoryView":1414
  14483. * cdef Py_ssize_t extent = shape[0]
  14484. *
  14485. * if ndim == 1: # <<<<<<<<<<<<<<
  14486. * for i in range(extent):
  14487. * memcpy(data, item, itemsize)
  14488. */
  14489. __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  14490. if (__pyx_t_1) {
  14491. /* "View.MemoryView":1415
  14492. *
  14493. * if ndim == 1:
  14494. * for i in range(extent): # <<<<<<<<<<<<<<
  14495. * memcpy(data, item, itemsize)
  14496. * data += stride
  14497. */
  14498. __pyx_t_2 = __pyx_v_extent;
  14499. __pyx_t_3 = __pyx_t_2;
  14500. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  14501. __pyx_v_i = __pyx_t_4;
  14502. /* "View.MemoryView":1416
  14503. * if ndim == 1:
  14504. * for i in range(extent):
  14505. * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
  14506. * data += stride
  14507. * else:
  14508. */
  14509. (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
  14510. /* "View.MemoryView":1417
  14511. * for i in range(extent):
  14512. * memcpy(data, item, itemsize)
  14513. * data += stride # <<<<<<<<<<<<<<
  14514. * else:
  14515. * for i in range(extent):
  14516. */
  14517. __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  14518. }
  14519. /* "View.MemoryView":1414
  14520. * cdef Py_ssize_t extent = shape[0]
  14521. *
  14522. * if ndim == 1: # <<<<<<<<<<<<<<
  14523. * for i in range(extent):
  14524. * memcpy(data, item, itemsize)
  14525. */
  14526. goto __pyx_L3;
  14527. }
  14528. /* "View.MemoryView":1419
  14529. * data += stride
  14530. * else:
  14531. * for i in range(extent): # <<<<<<<<<<<<<<
  14532. * _slice_assign_scalar(data, shape + 1, strides + 1,
  14533. * ndim - 1, itemsize, item)
  14534. */
  14535. /*else*/ {
  14536. __pyx_t_2 = __pyx_v_extent;
  14537. __pyx_t_3 = __pyx_t_2;
  14538. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  14539. __pyx_v_i = __pyx_t_4;
  14540. /* "View.MemoryView":1420
  14541. * else:
  14542. * for i in range(extent):
  14543. * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
  14544. * ndim - 1, itemsize, item)
  14545. * data += stride
  14546. */
  14547. __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
  14548. /* "View.MemoryView":1422
  14549. * _slice_assign_scalar(data, shape + 1, strides + 1,
  14550. * ndim - 1, itemsize, item)
  14551. * data += stride # <<<<<<<<<<<<<<
  14552. *
  14553. *
  14554. */
  14555. __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  14556. }
  14557. }
  14558. __pyx_L3:;
  14559. /* "View.MemoryView":1407
  14560. *
  14561. * @cname('__pyx_memoryview__slice_assign_scalar')
  14562. * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  14563. * Py_ssize_t *strides, int ndim,
  14564. * size_t itemsize, void *item) nogil:
  14565. */
  14566. /* function exit code */
  14567. }
  14568. /* "(tree fragment)":1
  14569. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  14570. * cdef object __pyx_PickleError
  14571. * cdef object __pyx_result
  14572. */
  14573. /* Python wrapper */
  14574. static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  14575. static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
  14576. static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  14577. PyObject *__pyx_v___pyx_type = 0;
  14578. long __pyx_v___pyx_checksum;
  14579. PyObject *__pyx_v___pyx_state = 0;
  14580. PyObject *__pyx_r = 0;
  14581. __Pyx_RefNannyDeclarations
  14582. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  14583. {
  14584. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
  14585. PyObject* values[3] = {0,0,0};
  14586. if (unlikely(__pyx_kwds)) {
  14587. Py_ssize_t kw_args;
  14588. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  14589. switch (pos_args) {
  14590. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  14591. CYTHON_FALLTHROUGH;
  14592. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  14593. CYTHON_FALLTHROUGH;
  14594. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  14595. CYTHON_FALLTHROUGH;
  14596. case 0: break;
  14597. default: goto __pyx_L5_argtuple_error;
  14598. }
  14599. kw_args = PyDict_Size(__pyx_kwds);
  14600. switch (pos_args) {
  14601. case 0:
  14602. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
  14603. else goto __pyx_L5_argtuple_error;
  14604. CYTHON_FALLTHROUGH;
  14605. case 1:
  14606. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
  14607. else {
  14608. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
  14609. }
  14610. CYTHON_FALLTHROUGH;
  14611. case 2:
  14612. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
  14613. else {
  14614. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
  14615. }
  14616. }
  14617. if (unlikely(kw_args > 0)) {
  14618. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
  14619. }
  14620. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  14621. goto __pyx_L5_argtuple_error;
  14622. } else {
  14623. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  14624. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  14625. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  14626. }
  14627. __pyx_v___pyx_type = values[0];
  14628. __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
  14629. __pyx_v___pyx_state = values[2];
  14630. }
  14631. goto __pyx_L4_argument_unpacking_done;
  14632. __pyx_L5_argtuple_error:;
  14633. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
  14634. __pyx_L3_error:;
  14635. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14636. __Pyx_RefNannyFinishContext();
  14637. return NULL;
  14638. __pyx_L4_argument_unpacking_done:;
  14639. __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
  14640. /* function exit code */
  14641. __Pyx_RefNannyFinishContext();
  14642. return __pyx_r;
  14643. }
  14644. static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  14645. PyObject *__pyx_v___pyx_PickleError = 0;
  14646. PyObject *__pyx_v___pyx_result = 0;
  14647. PyObject *__pyx_r = NULL;
  14648. __Pyx_RefNannyDeclarations
  14649. int __pyx_t_1;
  14650. PyObject *__pyx_t_2 = NULL;
  14651. PyObject *__pyx_t_3 = NULL;
  14652. PyObject *__pyx_t_4 = NULL;
  14653. PyObject *__pyx_t_5 = NULL;
  14654. int __pyx_t_6;
  14655. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
  14656. /* "(tree fragment)":4
  14657. * cdef object __pyx_PickleError
  14658. * cdef object __pyx_result
  14659. * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
  14660. * from pickle import PickleError as __pyx_PickleError
  14661. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14662. */
  14663. __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
  14664. if (__pyx_t_1) {
  14665. /* "(tree fragment)":5
  14666. * cdef object __pyx_result
  14667. * if __pyx_checksum != 0xb068931:
  14668. * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
  14669. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14670. * __pyx_result = Enum.__new__(__pyx_type)
  14671. */
  14672. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  14673. __Pyx_GOTREF(__pyx_t_2);
  14674. __Pyx_INCREF(__pyx_n_s_PickleError);
  14675. __Pyx_GIVEREF(__pyx_n_s_PickleError);
  14676. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
  14677. __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
  14678. __Pyx_GOTREF(__pyx_t_3);
  14679. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14680. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
  14681. __Pyx_GOTREF(__pyx_t_2);
  14682. __Pyx_INCREF(__pyx_t_2);
  14683. __pyx_v___pyx_PickleError = __pyx_t_2;
  14684. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14685. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14686. /* "(tree fragment)":6
  14687. * if __pyx_checksum != 0xb068931:
  14688. * from pickle import PickleError as __pyx_PickleError
  14689. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
  14690. * __pyx_result = Enum.__new__(__pyx_type)
  14691. * if __pyx_state is not None:
  14692. */
  14693. __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
  14694. __Pyx_GOTREF(__pyx_t_2);
  14695. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
  14696. __Pyx_GOTREF(__pyx_t_4);
  14697. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14698. __Pyx_INCREF(__pyx_v___pyx_PickleError);
  14699. __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
  14700. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  14701. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  14702. if (likely(__pyx_t_5)) {
  14703. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14704. __Pyx_INCREF(__pyx_t_5);
  14705. __Pyx_INCREF(function);
  14706. __Pyx_DECREF_SET(__pyx_t_2, function);
  14707. }
  14708. }
  14709. __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  14710. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  14711. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14712. if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
  14713. __Pyx_GOTREF(__pyx_t_3);
  14714. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14715. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  14716. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14717. __PYX_ERR(1, 6, __pyx_L1_error)
  14718. /* "(tree fragment)":4
  14719. * cdef object __pyx_PickleError
  14720. * cdef object __pyx_result
  14721. * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
  14722. * from pickle import PickleError as __pyx_PickleError
  14723. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14724. */
  14725. }
  14726. /* "(tree fragment)":7
  14727. * from pickle import PickleError as __pyx_PickleError
  14728. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14729. * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
  14730. * if __pyx_state is not None:
  14731. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14732. */
  14733. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
  14734. __Pyx_GOTREF(__pyx_t_2);
  14735. __pyx_t_4 = NULL;
  14736. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  14737. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
  14738. if (likely(__pyx_t_4)) {
  14739. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14740. __Pyx_INCREF(__pyx_t_4);
  14741. __Pyx_INCREF(function);
  14742. __Pyx_DECREF_SET(__pyx_t_2, function);
  14743. }
  14744. }
  14745. __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  14746. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  14747. if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
  14748. __Pyx_GOTREF(__pyx_t_3);
  14749. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14750. __pyx_v___pyx_result = __pyx_t_3;
  14751. __pyx_t_3 = 0;
  14752. /* "(tree fragment)":8
  14753. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14754. * __pyx_result = Enum.__new__(__pyx_type)
  14755. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  14756. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14757. * return __pyx_result
  14758. */
  14759. __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  14760. __pyx_t_6 = (__pyx_t_1 != 0);
  14761. if (__pyx_t_6) {
  14762. /* "(tree fragment)":9
  14763. * __pyx_result = Enum.__new__(__pyx_type)
  14764. * if __pyx_state is not None:
  14765. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
  14766. * return __pyx_result
  14767. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14768. */
  14769. if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
  14770. __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
  14771. __Pyx_GOTREF(__pyx_t_3);
  14772. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14773. /* "(tree fragment)":8
  14774. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  14775. * __pyx_result = Enum.__new__(__pyx_type)
  14776. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  14777. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14778. * return __pyx_result
  14779. */
  14780. }
  14781. /* "(tree fragment)":10
  14782. * if __pyx_state is not None:
  14783. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14784. * return __pyx_result # <<<<<<<<<<<<<<
  14785. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14786. * __pyx_result.name = __pyx_state[0]
  14787. */
  14788. __Pyx_XDECREF(__pyx_r);
  14789. __Pyx_INCREF(__pyx_v___pyx_result);
  14790. __pyx_r = __pyx_v___pyx_result;
  14791. goto __pyx_L0;
  14792. /* "(tree fragment)":1
  14793. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  14794. * cdef object __pyx_PickleError
  14795. * cdef object __pyx_result
  14796. */
  14797. /* function exit code */
  14798. __pyx_L1_error:;
  14799. __Pyx_XDECREF(__pyx_t_2);
  14800. __Pyx_XDECREF(__pyx_t_3);
  14801. __Pyx_XDECREF(__pyx_t_4);
  14802. __Pyx_XDECREF(__pyx_t_5);
  14803. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14804. __pyx_r = NULL;
  14805. __pyx_L0:;
  14806. __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  14807. __Pyx_XDECREF(__pyx_v___pyx_result);
  14808. __Pyx_XGIVEREF(__pyx_r);
  14809. __Pyx_RefNannyFinishContext();
  14810. return __pyx_r;
  14811. }
  14812. /* "(tree fragment)":11
  14813. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14814. * return __pyx_result
  14815. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  14816. * __pyx_result.name = __pyx_state[0]
  14817. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14818. */
  14819. static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  14820. PyObject *__pyx_r = NULL;
  14821. __Pyx_RefNannyDeclarations
  14822. PyObject *__pyx_t_1 = NULL;
  14823. int __pyx_t_2;
  14824. Py_ssize_t __pyx_t_3;
  14825. int __pyx_t_4;
  14826. int __pyx_t_5;
  14827. PyObject *__pyx_t_6 = NULL;
  14828. PyObject *__pyx_t_7 = NULL;
  14829. PyObject *__pyx_t_8 = NULL;
  14830. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
  14831. /* "(tree fragment)":12
  14832. * return __pyx_result
  14833. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14834. * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
  14835. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14836. * __pyx_result.__dict__.update(__pyx_state[1])
  14837. */
  14838. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  14839. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  14840. __PYX_ERR(1, 12, __pyx_L1_error)
  14841. }
  14842. __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
  14843. __Pyx_GOTREF(__pyx_t_1);
  14844. __Pyx_GIVEREF(__pyx_t_1);
  14845. __Pyx_GOTREF(__pyx_v___pyx_result->name);
  14846. __Pyx_DECREF(__pyx_v___pyx_result->name);
  14847. __pyx_v___pyx_result->name = __pyx_t_1;
  14848. __pyx_t_1 = 0;
  14849. /* "(tree fragment)":13
  14850. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14851. * __pyx_result.name = __pyx_state[0]
  14852. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  14853. * __pyx_result.__dict__.update(__pyx_state[1])
  14854. */
  14855. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  14856. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  14857. __PYX_ERR(1, 13, __pyx_L1_error)
  14858. }
  14859. __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  14860. __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  14861. if (__pyx_t_4) {
  14862. } else {
  14863. __pyx_t_2 = __pyx_t_4;
  14864. goto __pyx_L4_bool_binop_done;
  14865. }
  14866. __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
  14867. __pyx_t_5 = (__pyx_t_4 != 0);
  14868. __pyx_t_2 = __pyx_t_5;
  14869. __pyx_L4_bool_binop_done:;
  14870. if (__pyx_t_2) {
  14871. /* "(tree fragment)":14
  14872. * __pyx_result.name = __pyx_state[0]
  14873. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14874. * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
  14875. */
  14876. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
  14877. __Pyx_GOTREF(__pyx_t_6);
  14878. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
  14879. __Pyx_GOTREF(__pyx_t_7);
  14880. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14881. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  14882. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  14883. __PYX_ERR(1, 14, __pyx_L1_error)
  14884. }
  14885. __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
  14886. __Pyx_GOTREF(__pyx_t_6);
  14887. __pyx_t_8 = NULL;
  14888. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  14889. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  14890. if (likely(__pyx_t_8)) {
  14891. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  14892. __Pyx_INCREF(__pyx_t_8);
  14893. __Pyx_INCREF(function);
  14894. __Pyx_DECREF_SET(__pyx_t_7, function);
  14895. }
  14896. }
  14897. __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  14898. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  14899. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14900. if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
  14901. __Pyx_GOTREF(__pyx_t_1);
  14902. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  14903. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14904. /* "(tree fragment)":13
  14905. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  14906. * __pyx_result.name = __pyx_state[0]
  14907. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  14908. * __pyx_result.__dict__.update(__pyx_state[1])
  14909. */
  14910. }
  14911. /* "(tree fragment)":11
  14912. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  14913. * return __pyx_result
  14914. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  14915. * __pyx_result.name = __pyx_state[0]
  14916. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  14917. */
  14918. /* function exit code */
  14919. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  14920. goto __pyx_L0;
  14921. __pyx_L1_error:;
  14922. __Pyx_XDECREF(__pyx_t_1);
  14923. __Pyx_XDECREF(__pyx_t_6);
  14924. __Pyx_XDECREF(__pyx_t_7);
  14925. __Pyx_XDECREF(__pyx_t_8);
  14926. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14927. __pyx_r = 0;
  14928. __pyx_L0:;
  14929. __Pyx_XGIVEREF(__pyx_r);
  14930. __Pyx_RefNannyFinishContext();
  14931. return __pyx_r;
  14932. }
  14933. static struct __pyx_vtabstruct_array __pyx_vtable_array;
  14934. static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  14935. struct __pyx_array_obj *p;
  14936. PyObject *o;
  14937. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  14938. o = (*t->tp_alloc)(t, 0);
  14939. } else {
  14940. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  14941. }
  14942. if (unlikely(!o)) return 0;
  14943. p = ((struct __pyx_array_obj *)o);
  14944. p->__pyx_vtab = __pyx_vtabptr_array;
  14945. p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  14946. p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  14947. if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  14948. return o;
  14949. bad:
  14950. Py_DECREF(o); o = 0;
  14951. return NULL;
  14952. }
  14953. static void __pyx_tp_dealloc_array(PyObject *o) {
  14954. struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  14955. #if CYTHON_USE_TP_FINALIZE
  14956. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
  14957. if (PyObject_CallFinalizerFromDealloc(o)) return;
  14958. }
  14959. #endif
  14960. {
  14961. PyObject *etype, *eval, *etb;
  14962. PyErr_Fetch(&etype, &eval, &etb);
  14963. ++Py_REFCNT(o);
  14964. __pyx_array___dealloc__(o);
  14965. --Py_REFCNT(o);
  14966. PyErr_Restore(etype, eval, etb);
  14967. }
  14968. Py_CLEAR(p->mode);
  14969. Py_CLEAR(p->_format);
  14970. (*Py_TYPE(o)->tp_free)(o);
  14971. }
  14972. static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  14973. PyObject *r;
  14974. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  14975. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  14976. Py_DECREF(x);
  14977. return r;
  14978. }
  14979. static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  14980. if (v) {
  14981. return __pyx_array___setitem__(o, i, v);
  14982. }
  14983. else {
  14984. PyErr_Format(PyExc_NotImplementedError,
  14985. "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
  14986. return -1;
  14987. }
  14988. }
  14989. static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  14990. PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  14991. if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  14992. PyErr_Clear();
  14993. v = __pyx_array___getattr__(o, n);
  14994. }
  14995. return v;
  14996. }
  14997. static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  14998. return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
  14999. }
  15000. static PyMethodDef __pyx_methods_array[] = {
  15001. {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  15002. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  15003. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  15004. {0, 0, 0, 0}
  15005. };
  15006. static struct PyGetSetDef __pyx_getsets_array[] = {
  15007. {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  15008. {0, 0, 0, 0, 0}
  15009. };
  15010. static PySequenceMethods __pyx_tp_as_sequence_array = {
  15011. __pyx_array___len__, /*sq_length*/
  15012. 0, /*sq_concat*/
  15013. 0, /*sq_repeat*/
  15014. __pyx_sq_item_array, /*sq_item*/
  15015. 0, /*sq_slice*/
  15016. 0, /*sq_ass_item*/
  15017. 0, /*sq_ass_slice*/
  15018. 0, /*sq_contains*/
  15019. 0, /*sq_inplace_concat*/
  15020. 0, /*sq_inplace_repeat*/
  15021. };
  15022. static PyMappingMethods __pyx_tp_as_mapping_array = {
  15023. __pyx_array___len__, /*mp_length*/
  15024. __pyx_array___getitem__, /*mp_subscript*/
  15025. __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
  15026. };
  15027. static PyBufferProcs __pyx_tp_as_buffer_array = {
  15028. #if PY_MAJOR_VERSION < 3
  15029. 0, /*bf_getreadbuffer*/
  15030. #endif
  15031. #if PY_MAJOR_VERSION < 3
  15032. 0, /*bf_getwritebuffer*/
  15033. #endif
  15034. #if PY_MAJOR_VERSION < 3
  15035. 0, /*bf_getsegcount*/
  15036. #endif
  15037. #if PY_MAJOR_VERSION < 3
  15038. 0, /*bf_getcharbuffer*/
  15039. #endif
  15040. __pyx_array_getbuffer, /*bf_getbuffer*/
  15041. 0, /*bf_releasebuffer*/
  15042. };
  15043. static PyTypeObject __pyx_type___pyx_array = {
  15044. PyVarObject_HEAD_INIT(0, 0)
  15045. "app.colormap.colormap.array", /*tp_name*/
  15046. sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  15047. 0, /*tp_itemsize*/
  15048. __pyx_tp_dealloc_array, /*tp_dealloc*/
  15049. #if PY_VERSION_HEX < 0x030800b4
  15050. 0, /*tp_print*/
  15051. #endif
  15052. #if PY_VERSION_HEX >= 0x030800b4
  15053. 0, /*tp_vectorcall_offset*/
  15054. #endif
  15055. 0, /*tp_getattr*/
  15056. 0, /*tp_setattr*/
  15057. #if PY_MAJOR_VERSION < 3
  15058. 0, /*tp_compare*/
  15059. #endif
  15060. #if PY_MAJOR_VERSION >= 3
  15061. 0, /*tp_as_async*/
  15062. #endif
  15063. 0, /*tp_repr*/
  15064. 0, /*tp_as_number*/
  15065. &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  15066. &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  15067. 0, /*tp_hash*/
  15068. 0, /*tp_call*/
  15069. 0, /*tp_str*/
  15070. __pyx_tp_getattro_array, /*tp_getattro*/
  15071. 0, /*tp_setattro*/
  15072. &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  15073. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  15074. 0, /*tp_doc*/
  15075. 0, /*tp_traverse*/
  15076. 0, /*tp_clear*/
  15077. 0, /*tp_richcompare*/
  15078. 0, /*tp_weaklistoffset*/
  15079. 0, /*tp_iter*/
  15080. 0, /*tp_iternext*/
  15081. __pyx_methods_array, /*tp_methods*/
  15082. 0, /*tp_members*/
  15083. __pyx_getsets_array, /*tp_getset*/
  15084. 0, /*tp_base*/
  15085. 0, /*tp_dict*/
  15086. 0, /*tp_descr_get*/
  15087. 0, /*tp_descr_set*/
  15088. 0, /*tp_dictoffset*/
  15089. 0, /*tp_init*/
  15090. 0, /*tp_alloc*/
  15091. __pyx_tp_new_array, /*tp_new*/
  15092. 0, /*tp_free*/
  15093. 0, /*tp_is_gc*/
  15094. 0, /*tp_bases*/
  15095. 0, /*tp_mro*/
  15096. 0, /*tp_cache*/
  15097. 0, /*tp_subclasses*/
  15098. 0, /*tp_weaklist*/
  15099. 0, /*tp_del*/
  15100. 0, /*tp_version_tag*/
  15101. #if PY_VERSION_HEX >= 0x030400a1
  15102. 0, /*tp_finalize*/
  15103. #endif
  15104. #if PY_VERSION_HEX >= 0x030800b1
  15105. 0, /*tp_vectorcall*/
  15106. #endif
  15107. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15108. 0, /*tp_print*/
  15109. #endif
  15110. };
  15111. static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  15112. struct __pyx_MemviewEnum_obj *p;
  15113. PyObject *o;
  15114. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  15115. o = (*t->tp_alloc)(t, 0);
  15116. } else {
  15117. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  15118. }
  15119. if (unlikely(!o)) return 0;
  15120. p = ((struct __pyx_MemviewEnum_obj *)o);
  15121. p->name = Py_None; Py_INCREF(Py_None);
  15122. return o;
  15123. }
  15124. static void __pyx_tp_dealloc_Enum(PyObject *o) {
  15125. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  15126. #if CYTHON_USE_TP_FINALIZE
  15127. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  15128. if (PyObject_CallFinalizerFromDealloc(o)) return;
  15129. }
  15130. #endif
  15131. PyObject_GC_UnTrack(o);
  15132. Py_CLEAR(p->name);
  15133. (*Py_TYPE(o)->tp_free)(o);
  15134. }
  15135. static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  15136. int e;
  15137. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  15138. if (p->name) {
  15139. e = (*v)(p->name, a); if (e) return e;
  15140. }
  15141. return 0;
  15142. }
  15143. static int __pyx_tp_clear_Enum(PyObject *o) {
  15144. PyObject* tmp;
  15145. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  15146. tmp = ((PyObject*)p->name);
  15147. p->name = Py_None; Py_INCREF(Py_None);
  15148. Py_XDECREF(tmp);
  15149. return 0;
  15150. }
  15151. static PyMethodDef __pyx_methods_Enum[] = {
  15152. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  15153. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  15154. {0, 0, 0, 0}
  15155. };
  15156. static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  15157. PyVarObject_HEAD_INIT(0, 0)
  15158. "app.colormap.colormap.Enum", /*tp_name*/
  15159. sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  15160. 0, /*tp_itemsize*/
  15161. __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  15162. #if PY_VERSION_HEX < 0x030800b4
  15163. 0, /*tp_print*/
  15164. #endif
  15165. #if PY_VERSION_HEX >= 0x030800b4
  15166. 0, /*tp_vectorcall_offset*/
  15167. #endif
  15168. 0, /*tp_getattr*/
  15169. 0, /*tp_setattr*/
  15170. #if PY_MAJOR_VERSION < 3
  15171. 0, /*tp_compare*/
  15172. #endif
  15173. #if PY_MAJOR_VERSION >= 3
  15174. 0, /*tp_as_async*/
  15175. #endif
  15176. __pyx_MemviewEnum___repr__, /*tp_repr*/
  15177. 0, /*tp_as_number*/
  15178. 0, /*tp_as_sequence*/
  15179. 0, /*tp_as_mapping*/
  15180. 0, /*tp_hash*/
  15181. 0, /*tp_call*/
  15182. 0, /*tp_str*/
  15183. 0, /*tp_getattro*/
  15184. 0, /*tp_setattro*/
  15185. 0, /*tp_as_buffer*/
  15186. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  15187. 0, /*tp_doc*/
  15188. __pyx_tp_traverse_Enum, /*tp_traverse*/
  15189. __pyx_tp_clear_Enum, /*tp_clear*/
  15190. 0, /*tp_richcompare*/
  15191. 0, /*tp_weaklistoffset*/
  15192. 0, /*tp_iter*/
  15193. 0, /*tp_iternext*/
  15194. __pyx_methods_Enum, /*tp_methods*/
  15195. 0, /*tp_members*/
  15196. 0, /*tp_getset*/
  15197. 0, /*tp_base*/
  15198. 0, /*tp_dict*/
  15199. 0, /*tp_descr_get*/
  15200. 0, /*tp_descr_set*/
  15201. 0, /*tp_dictoffset*/
  15202. __pyx_MemviewEnum___init__, /*tp_init*/
  15203. 0, /*tp_alloc*/
  15204. __pyx_tp_new_Enum, /*tp_new*/
  15205. 0, /*tp_free*/
  15206. 0, /*tp_is_gc*/
  15207. 0, /*tp_bases*/
  15208. 0, /*tp_mro*/
  15209. 0, /*tp_cache*/
  15210. 0, /*tp_subclasses*/
  15211. 0, /*tp_weaklist*/
  15212. 0, /*tp_del*/
  15213. 0, /*tp_version_tag*/
  15214. #if PY_VERSION_HEX >= 0x030400a1
  15215. 0, /*tp_finalize*/
  15216. #endif
  15217. #if PY_VERSION_HEX >= 0x030800b1
  15218. 0, /*tp_vectorcall*/
  15219. #endif
  15220. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15221. 0, /*tp_print*/
  15222. #endif
  15223. };
  15224. static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
  15225. static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  15226. struct __pyx_memoryview_obj *p;
  15227. PyObject *o;
  15228. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  15229. o = (*t->tp_alloc)(t, 0);
  15230. } else {
  15231. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  15232. }
  15233. if (unlikely(!o)) return 0;
  15234. p = ((struct __pyx_memoryview_obj *)o);
  15235. p->__pyx_vtab = __pyx_vtabptr_memoryview;
  15236. p->obj = Py_None; Py_INCREF(Py_None);
  15237. p->_size = Py_None; Py_INCREF(Py_None);
  15238. p->_array_interface = Py_None; Py_INCREF(Py_None);
  15239. p->view.obj = NULL;
  15240. if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  15241. return o;
  15242. bad:
  15243. Py_DECREF(o); o = 0;
  15244. return NULL;
  15245. }
  15246. static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  15247. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  15248. #if CYTHON_USE_TP_FINALIZE
  15249. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  15250. if (PyObject_CallFinalizerFromDealloc(o)) return;
  15251. }
  15252. #endif
  15253. PyObject_GC_UnTrack(o);
  15254. {
  15255. PyObject *etype, *eval, *etb;
  15256. PyErr_Fetch(&etype, &eval, &etb);
  15257. ++Py_REFCNT(o);
  15258. __pyx_memoryview___dealloc__(o);
  15259. --Py_REFCNT(o);
  15260. PyErr_Restore(etype, eval, etb);
  15261. }
  15262. Py_CLEAR(p->obj);
  15263. Py_CLEAR(p->_size);
  15264. Py_CLEAR(p->_array_interface);
  15265. (*Py_TYPE(o)->tp_free)(o);
  15266. }
  15267. static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  15268. int e;
  15269. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  15270. if (p->obj) {
  15271. e = (*v)(p->obj, a); if (e) return e;
  15272. }
  15273. if (p->_size) {
  15274. e = (*v)(p->_size, a); if (e) return e;
  15275. }
  15276. if (p->_array_interface) {
  15277. e = (*v)(p->_array_interface, a); if (e) return e;
  15278. }
  15279. if (p->view.obj) {
  15280. e = (*v)(p->view.obj, a); if (e) return e;
  15281. }
  15282. return 0;
  15283. }
  15284. static int __pyx_tp_clear_memoryview(PyObject *o) {
  15285. PyObject* tmp;
  15286. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  15287. tmp = ((PyObject*)p->obj);
  15288. p->obj = Py_None; Py_INCREF(Py_None);
  15289. Py_XDECREF(tmp);
  15290. tmp = ((PyObject*)p->_size);
  15291. p->_size = Py_None; Py_INCREF(Py_None);
  15292. Py_XDECREF(tmp);
  15293. tmp = ((PyObject*)p->_array_interface);
  15294. p->_array_interface = Py_None; Py_INCREF(Py_None);
  15295. Py_XDECREF(tmp);
  15296. Py_CLEAR(p->view.obj);
  15297. return 0;
  15298. }
  15299. static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  15300. PyObject *r;
  15301. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  15302. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  15303. Py_DECREF(x);
  15304. return r;
  15305. }
  15306. static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  15307. if (v) {
  15308. return __pyx_memoryview___setitem__(o, i, v);
  15309. }
  15310. else {
  15311. PyErr_Format(PyExc_NotImplementedError,
  15312. "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
  15313. return -1;
  15314. }
  15315. }
  15316. static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  15317. return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
  15318. }
  15319. static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  15320. return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
  15321. }
  15322. static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  15323. return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
  15324. }
  15325. static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  15326. return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
  15327. }
  15328. static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  15329. return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
  15330. }
  15331. static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  15332. return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
  15333. }
  15334. static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  15335. return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
  15336. }
  15337. static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  15338. return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
  15339. }
  15340. static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  15341. return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
  15342. }
  15343. static PyMethodDef __pyx_methods_memoryview[] = {
  15344. {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  15345. {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  15346. {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  15347. {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  15348. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  15349. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  15350. {0, 0, 0, 0}
  15351. };
  15352. static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  15353. {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  15354. {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  15355. {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  15356. {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  15357. {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  15358. {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  15359. {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  15360. {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  15361. {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  15362. {0, 0, 0, 0, 0}
  15363. };
  15364. static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  15365. __pyx_memoryview___len__, /*sq_length*/
  15366. 0, /*sq_concat*/
  15367. 0, /*sq_repeat*/
  15368. __pyx_sq_item_memoryview, /*sq_item*/
  15369. 0, /*sq_slice*/
  15370. 0, /*sq_ass_item*/
  15371. 0, /*sq_ass_slice*/
  15372. 0, /*sq_contains*/
  15373. 0, /*sq_inplace_concat*/
  15374. 0, /*sq_inplace_repeat*/
  15375. };
  15376. static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  15377. __pyx_memoryview___len__, /*mp_length*/
  15378. __pyx_memoryview___getitem__, /*mp_subscript*/
  15379. __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
  15380. };
  15381. static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  15382. #if PY_MAJOR_VERSION < 3
  15383. 0, /*bf_getreadbuffer*/
  15384. #endif
  15385. #if PY_MAJOR_VERSION < 3
  15386. 0, /*bf_getwritebuffer*/
  15387. #endif
  15388. #if PY_MAJOR_VERSION < 3
  15389. 0, /*bf_getsegcount*/
  15390. #endif
  15391. #if PY_MAJOR_VERSION < 3
  15392. 0, /*bf_getcharbuffer*/
  15393. #endif
  15394. __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  15395. 0, /*bf_releasebuffer*/
  15396. };
  15397. static PyTypeObject __pyx_type___pyx_memoryview = {
  15398. PyVarObject_HEAD_INIT(0, 0)
  15399. "app.colormap.colormap.memoryview", /*tp_name*/
  15400. sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  15401. 0, /*tp_itemsize*/
  15402. __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  15403. #if PY_VERSION_HEX < 0x030800b4
  15404. 0, /*tp_print*/
  15405. #endif
  15406. #if PY_VERSION_HEX >= 0x030800b4
  15407. 0, /*tp_vectorcall_offset*/
  15408. #endif
  15409. 0, /*tp_getattr*/
  15410. 0, /*tp_setattr*/
  15411. #if PY_MAJOR_VERSION < 3
  15412. 0, /*tp_compare*/
  15413. #endif
  15414. #if PY_MAJOR_VERSION >= 3
  15415. 0, /*tp_as_async*/
  15416. #endif
  15417. __pyx_memoryview___repr__, /*tp_repr*/
  15418. 0, /*tp_as_number*/
  15419. &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  15420. &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  15421. 0, /*tp_hash*/
  15422. 0, /*tp_call*/
  15423. __pyx_memoryview___str__, /*tp_str*/
  15424. 0, /*tp_getattro*/
  15425. 0, /*tp_setattro*/
  15426. &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  15427. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  15428. 0, /*tp_doc*/
  15429. __pyx_tp_traverse_memoryview, /*tp_traverse*/
  15430. __pyx_tp_clear_memoryview, /*tp_clear*/
  15431. 0, /*tp_richcompare*/
  15432. 0, /*tp_weaklistoffset*/
  15433. 0, /*tp_iter*/
  15434. 0, /*tp_iternext*/
  15435. __pyx_methods_memoryview, /*tp_methods*/
  15436. 0, /*tp_members*/
  15437. __pyx_getsets_memoryview, /*tp_getset*/
  15438. 0, /*tp_base*/
  15439. 0, /*tp_dict*/
  15440. 0, /*tp_descr_get*/
  15441. 0, /*tp_descr_set*/
  15442. 0, /*tp_dictoffset*/
  15443. 0, /*tp_init*/
  15444. 0, /*tp_alloc*/
  15445. __pyx_tp_new_memoryview, /*tp_new*/
  15446. 0, /*tp_free*/
  15447. 0, /*tp_is_gc*/
  15448. 0, /*tp_bases*/
  15449. 0, /*tp_mro*/
  15450. 0, /*tp_cache*/
  15451. 0, /*tp_subclasses*/
  15452. 0, /*tp_weaklist*/
  15453. 0, /*tp_del*/
  15454. 0, /*tp_version_tag*/
  15455. #if PY_VERSION_HEX >= 0x030400a1
  15456. 0, /*tp_finalize*/
  15457. #endif
  15458. #if PY_VERSION_HEX >= 0x030800b1
  15459. 0, /*tp_vectorcall*/
  15460. #endif
  15461. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15462. 0, /*tp_print*/
  15463. #endif
  15464. };
  15465. static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
  15466. static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  15467. struct __pyx_memoryviewslice_obj *p;
  15468. PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  15469. if (unlikely(!o)) return 0;
  15470. p = ((struct __pyx_memoryviewslice_obj *)o);
  15471. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  15472. p->from_object = Py_None; Py_INCREF(Py_None);
  15473. p->from_slice.memview = NULL;
  15474. return o;
  15475. }
  15476. static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  15477. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  15478. #if CYTHON_USE_TP_FINALIZE
  15479. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  15480. if (PyObject_CallFinalizerFromDealloc(o)) return;
  15481. }
  15482. #endif
  15483. PyObject_GC_UnTrack(o);
  15484. {
  15485. PyObject *etype, *eval, *etb;
  15486. PyErr_Fetch(&etype, &eval, &etb);
  15487. ++Py_REFCNT(o);
  15488. __pyx_memoryviewslice___dealloc__(o);
  15489. --Py_REFCNT(o);
  15490. PyErr_Restore(etype, eval, etb);
  15491. }
  15492. Py_CLEAR(p->from_object);
  15493. PyObject_GC_Track(o);
  15494. __pyx_tp_dealloc_memoryview(o);
  15495. }
  15496. static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  15497. int e;
  15498. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  15499. e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  15500. if (p->from_object) {
  15501. e = (*v)(p->from_object, a); if (e) return e;
  15502. }
  15503. return 0;
  15504. }
  15505. static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  15506. PyObject* tmp;
  15507. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  15508. __pyx_tp_clear_memoryview(o);
  15509. tmp = ((PyObject*)p->from_object);
  15510. p->from_object = Py_None; Py_INCREF(Py_None);
  15511. Py_XDECREF(tmp);
  15512. __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  15513. return 0;
  15514. }
  15515. static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  15516. return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
  15517. }
  15518. static PyMethodDef __pyx_methods__memoryviewslice[] = {
  15519. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  15520. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  15521. {0, 0, 0, 0}
  15522. };
  15523. static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  15524. {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  15525. {0, 0, 0, 0, 0}
  15526. };
  15527. static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  15528. PyVarObject_HEAD_INIT(0, 0)
  15529. "app.colormap.colormap._memoryviewslice", /*tp_name*/
  15530. sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  15531. 0, /*tp_itemsize*/
  15532. __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  15533. #if PY_VERSION_HEX < 0x030800b4
  15534. 0, /*tp_print*/
  15535. #endif
  15536. #if PY_VERSION_HEX >= 0x030800b4
  15537. 0, /*tp_vectorcall_offset*/
  15538. #endif
  15539. 0, /*tp_getattr*/
  15540. 0, /*tp_setattr*/
  15541. #if PY_MAJOR_VERSION < 3
  15542. 0, /*tp_compare*/
  15543. #endif
  15544. #if PY_MAJOR_VERSION >= 3
  15545. 0, /*tp_as_async*/
  15546. #endif
  15547. #if CYTHON_COMPILING_IN_PYPY
  15548. __pyx_memoryview___repr__, /*tp_repr*/
  15549. #else
  15550. 0, /*tp_repr*/
  15551. #endif
  15552. 0, /*tp_as_number*/
  15553. 0, /*tp_as_sequence*/
  15554. 0, /*tp_as_mapping*/
  15555. 0, /*tp_hash*/
  15556. 0, /*tp_call*/
  15557. #if CYTHON_COMPILING_IN_PYPY
  15558. __pyx_memoryview___str__, /*tp_str*/
  15559. #else
  15560. 0, /*tp_str*/
  15561. #endif
  15562. 0, /*tp_getattro*/
  15563. 0, /*tp_setattro*/
  15564. 0, /*tp_as_buffer*/
  15565. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  15566. "Internal class for passing memoryview slices to Python", /*tp_doc*/
  15567. __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  15568. __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  15569. 0, /*tp_richcompare*/
  15570. 0, /*tp_weaklistoffset*/
  15571. 0, /*tp_iter*/
  15572. 0, /*tp_iternext*/
  15573. __pyx_methods__memoryviewslice, /*tp_methods*/
  15574. 0, /*tp_members*/
  15575. __pyx_getsets__memoryviewslice, /*tp_getset*/
  15576. 0, /*tp_base*/
  15577. 0, /*tp_dict*/
  15578. 0, /*tp_descr_get*/
  15579. 0, /*tp_descr_set*/
  15580. 0, /*tp_dictoffset*/
  15581. 0, /*tp_init*/
  15582. 0, /*tp_alloc*/
  15583. __pyx_tp_new__memoryviewslice, /*tp_new*/
  15584. 0, /*tp_free*/
  15585. 0, /*tp_is_gc*/
  15586. 0, /*tp_bases*/
  15587. 0, /*tp_mro*/
  15588. 0, /*tp_cache*/
  15589. 0, /*tp_subclasses*/
  15590. 0, /*tp_weaklist*/
  15591. 0, /*tp_del*/
  15592. 0, /*tp_version_tag*/
  15593. #if PY_VERSION_HEX >= 0x030400a1
  15594. 0, /*tp_finalize*/
  15595. #endif
  15596. #if PY_VERSION_HEX >= 0x030800b1
  15597. 0, /*tp_vectorcall*/
  15598. #endif
  15599. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  15600. 0, /*tp_print*/
  15601. #endif
  15602. };
  15603. static PyMethodDef __pyx_methods[] = {
  15604. {0, 0, 0, 0}
  15605. };
  15606. #if PY_MAJOR_VERSION >= 3
  15607. #if CYTHON_PEP489_MULTI_PHASE_INIT
  15608. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  15609. static int __pyx_pymod_exec_colormap(PyObject* module); /*proto*/
  15610. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  15611. {Py_mod_create, (void*)__pyx_pymod_create},
  15612. {Py_mod_exec, (void*)__pyx_pymod_exec_colormap},
  15613. {0, NULL}
  15614. };
  15615. #endif
  15616. static struct PyModuleDef __pyx_moduledef = {
  15617. PyModuleDef_HEAD_INIT,
  15618. "colormap",
  15619. 0, /* m_doc */
  15620. #if CYTHON_PEP489_MULTI_PHASE_INIT
  15621. 0, /* m_size */
  15622. #else
  15623. -1, /* m_size */
  15624. #endif
  15625. __pyx_methods /* m_methods */,
  15626. #if CYTHON_PEP489_MULTI_PHASE_INIT
  15627. __pyx_moduledef_slots, /* m_slots */
  15628. #else
  15629. NULL, /* m_reload */
  15630. #endif
  15631. NULL, /* m_traverse */
  15632. NULL, /* m_clear */
  15633. NULL /* m_free */
  15634. };
  15635. #endif
  15636. #ifndef CYTHON_SMALL_CODE
  15637. #if defined(__clang__)
  15638. #define CYTHON_SMALL_CODE
  15639. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  15640. #define CYTHON_SMALL_CODE __attribute__((cold))
  15641. #else
  15642. #define CYTHON_SMALL_CODE
  15643. #endif
  15644. #endif
  15645. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  15646. {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  15647. {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
  15648. {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
  15649. {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
  15650. {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
  15651. {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
  15652. {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  15653. {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
  15654. {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
  15655. {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  15656. {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  15657. {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
  15658. {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
  15659. {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  15660. {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
  15661. {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  15662. {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  15663. {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
  15664. {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  15665. {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  15666. {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
  15667. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  15668. {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  15669. {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  15670. {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  15671. {&__pyx_n_s_app_colormap_colormap, __pyx_k_app_colormap_colormap, sizeof(__pyx_k_app_colormap_colormap), 0, 0, 1, 1},
  15672. {&__pyx_kp_s_app_colormap_colormap_pyx, __pyx_k_app_colormap_colormap_pyx, sizeof(__pyx_k_app_colormap_colormap_pyx), 0, 0, 1, 0},
  15673. {&__pyx_n_s_apply_colormap, __pyx_k_apply_colormap, sizeof(__pyx_k_apply_colormap), 0, 0, 1, 1},
  15674. {&__pyx_n_u_apply_colormap, __pyx_k_apply_colormap, sizeof(__pyx_k_apply_colormap), 0, 1, 0, 1},
  15675. {&__pyx_n_s_apply_colormap_single, __pyx_k_apply_colormap_single, sizeof(__pyx_k_apply_colormap_single), 0, 0, 1, 1},
  15676. {&__pyx_n_u_apply_colormap_single, __pyx_k_apply_colormap_single, sizeof(__pyx_k_apply_colormap_single), 0, 1, 0, 1},
  15677. {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  15678. {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  15679. {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  15680. {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  15681. {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  15682. {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  15683. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  15684. {&__pyx_n_s_clip, __pyx_k_clip, sizeof(__pyx_k_clip), 0, 0, 1, 1},
  15685. {&__pyx_n_s_cmaps, __pyx_k_cmaps, sizeof(__pyx_k_cmaps), 0, 0, 1, 1},
  15686. {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
  15687. {&__pyx_n_s_colormap, __pyx_k_colormap, sizeof(__pyx_k_colormap), 0, 0, 1, 1},
  15688. {&__pyx_n_s_colors, __pyx_k_colors, sizeof(__pyx_k_colors), 0, 0, 1, 1},
  15689. {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  15690. {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  15691. {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  15692. {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  15693. {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  15694. {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  15695. {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  15696. {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  15697. {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  15698. {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  15699. {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
  15700. {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  15701. {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  15702. {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  15703. {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  15704. {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
  15705. {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  15706. {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  15707. {&__pyx_n_s_idxs, __pyx_k_idxs, sizeof(__pyx_k_idxs), 0, 0, 1, 1},
  15708. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  15709. {&__pyx_n_s_inferno, __pyx_k_inferno, sizeof(__pyx_k_inferno), 0, 0, 1, 1},
  15710. {&__pyx_n_u_inferno, __pyx_k_inferno, sizeof(__pyx_k_inferno), 0, 1, 0, 1},
  15711. {&__pyx_n_s_input, __pyx_k_input, sizeof(__pyx_k_input), 0, 0, 1, 1},
  15712. {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  15713. {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  15714. {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
  15715. {&__pyx_n_s_magma, __pyx_k_magma, sizeof(__pyx_k_magma), 0, 0, 1, 1},
  15716. {&__pyx_n_u_magma, __pyx_k_magma, sizeof(__pyx_k_magma), 0, 1, 0, 1},
  15717. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  15718. {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  15719. {&__pyx_n_s_max_2, __pyx_k_max_2, sizeof(__pyx_k_max_2), 0, 0, 1, 1},
  15720. {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  15721. {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  15722. {&__pyx_n_s_min_2, __pyx_k_min_2, sizeof(__pyx_k_min_2), 0, 0, 1, 1},
  15723. {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  15724. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  15725. {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  15726. {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  15727. {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  15728. {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  15729. {&__pyx_n_s_normalized, __pyx_k_normalized, sizeof(__pyx_k_normalized), 0, 0, 1, 1},
  15730. {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  15731. {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  15732. {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  15733. {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
  15734. {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  15735. {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  15736. {&__pyx_n_s_plasma, __pyx_k_plasma, sizeof(__pyx_k_plasma), 0, 0, 1, 1},
  15737. {&__pyx_n_u_plasma, __pyx_k_plasma, sizeof(__pyx_k_plasma), 0, 1, 0, 1},
  15738. {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  15739. {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  15740. {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  15741. {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  15742. {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  15743. {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  15744. {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  15745. {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  15746. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  15747. {&__pyx_n_s_range_2, __pyx_k_range_2, sizeof(__pyx_k_range_2), 0, 0, 1, 1},
  15748. {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  15749. {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  15750. {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  15751. {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  15752. {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  15753. {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  15754. {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  15755. {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  15756. {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  15757. {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  15758. {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  15759. {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
  15760. {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  15761. {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  15762. {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  15763. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  15764. {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
  15765. {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
  15766. {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  15767. {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  15768. {&__pyx_n_s_viridis, __pyx_k_viridis, sizeof(__pyx_k_viridis), 0, 0, 1, 1},
  15769. {&__pyx_n_u_viridis, __pyx_k_viridis, sizeof(__pyx_k_viridis), 0, 1, 0, 1},
  15770. {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  15771. {0, 0, 0, 0, 0, 0, 0}
  15772. };
  15773. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  15774. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 114, __pyx_L1_error)
  15775. __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error)
  15776. __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
  15777. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
  15778. __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
  15779. __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
  15780. __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
  15781. __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
  15782. return 0;
  15783. __pyx_L1_error:;
  15784. return -1;
  15785. }
  15786. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  15787. __Pyx_RefNannyDeclarations
  15788. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  15789. /* "View.MemoryView":133
  15790. *
  15791. * if not self.ndim:
  15792. * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
  15793. *
  15794. * if itemsize <= 0:
  15795. */
  15796. __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 133, __pyx_L1_error)
  15797. __Pyx_GOTREF(__pyx_tuple_);
  15798. __Pyx_GIVEREF(__pyx_tuple_);
  15799. /* "View.MemoryView":136
  15800. *
  15801. * if itemsize <= 0:
  15802. * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
  15803. *
  15804. * if not isinstance(format, bytes):
  15805. */
  15806. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 136, __pyx_L1_error)
  15807. __Pyx_GOTREF(__pyx_tuple__2);
  15808. __Pyx_GIVEREF(__pyx_tuple__2);
  15809. /* "View.MemoryView":148
  15810. *
  15811. * if not self._shape:
  15812. * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
  15813. *
  15814. *
  15815. */
  15816. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 148, __pyx_L1_error)
  15817. __Pyx_GOTREF(__pyx_tuple__3);
  15818. __Pyx_GIVEREF(__pyx_tuple__3);
  15819. /* "View.MemoryView":176
  15820. * self.data = <char *>malloc(self.len)
  15821. * if not self.data:
  15822. * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
  15823. *
  15824. * if self.dtype_is_object:
  15825. */
  15826. __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 176, __pyx_L1_error)
  15827. __Pyx_GOTREF(__pyx_tuple__4);
  15828. __Pyx_GIVEREF(__pyx_tuple__4);
  15829. /* "View.MemoryView":192
  15830. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  15831. * if not (flags & bufmode):
  15832. * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
  15833. * info.buf = self.data
  15834. * info.len = self.len
  15835. */
  15836. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 192, __pyx_L1_error)
  15837. __Pyx_GOTREF(__pyx_tuple__5);
  15838. __Pyx_GIVEREF(__pyx_tuple__5);
  15839. /* "(tree fragment)":2
  15840. * def __reduce_cython__(self):
  15841. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15842. * def __setstate_cython__(self, __pyx_state):
  15843. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15844. */
  15845. __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 2, __pyx_L1_error)
  15846. __Pyx_GOTREF(__pyx_tuple__6);
  15847. __Pyx_GIVEREF(__pyx_tuple__6);
  15848. /* "(tree fragment)":4
  15849. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15850. * def __setstate_cython__(self, __pyx_state):
  15851. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15852. */
  15853. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 4, __pyx_L1_error)
  15854. __Pyx_GOTREF(__pyx_tuple__7);
  15855. __Pyx_GIVEREF(__pyx_tuple__7);
  15856. /* "View.MemoryView":418
  15857. * def __setitem__(memoryview self, object index, object value):
  15858. * if self.view.readonly:
  15859. * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
  15860. *
  15861. * have_slices, index = _unellipsify(index, self.view.ndim)
  15862. */
  15863. __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 418, __pyx_L1_error)
  15864. __Pyx_GOTREF(__pyx_tuple__8);
  15865. __Pyx_GIVEREF(__pyx_tuple__8);
  15866. /* "View.MemoryView":495
  15867. * result = struct.unpack(self.view.format, bytesitem)
  15868. * except struct.error:
  15869. * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
  15870. * else:
  15871. * if len(self.view.format) == 1:
  15872. */
  15873. __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 495, __pyx_L1_error)
  15874. __Pyx_GOTREF(__pyx_tuple__9);
  15875. __Pyx_GIVEREF(__pyx_tuple__9);
  15876. /* "View.MemoryView":520
  15877. * def __getbuffer__(self, Py_buffer *info, int flags):
  15878. * if flags & PyBUF_WRITABLE and self.view.readonly:
  15879. * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
  15880. *
  15881. * if flags & PyBUF_ND:
  15882. */
  15883. __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 520, __pyx_L1_error)
  15884. __Pyx_GOTREF(__pyx_tuple__10);
  15885. __Pyx_GIVEREF(__pyx_tuple__10);
  15886. /* "View.MemoryView":570
  15887. * if self.view.strides == NULL:
  15888. *
  15889. * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
  15890. *
  15891. * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
  15892. */
  15893. __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 570, __pyx_L1_error)
  15894. __Pyx_GOTREF(__pyx_tuple__11);
  15895. __Pyx_GIVEREF(__pyx_tuple__11);
  15896. /* "View.MemoryView":577
  15897. * def suboffsets(self):
  15898. * if self.view.suboffsets == NULL:
  15899. * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
  15900. *
  15901. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
  15902. */
  15903. __pyx_tuple__12 = PyTuple_New(1); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 577, __pyx_L1_error)
  15904. __Pyx_GOTREF(__pyx_tuple__12);
  15905. __Pyx_INCREF(__pyx_int_neg_1);
  15906. __Pyx_GIVEREF(__pyx_int_neg_1);
  15907. PyTuple_SET_ITEM(__pyx_tuple__12, 0, __pyx_int_neg_1);
  15908. __Pyx_GIVEREF(__pyx_tuple__12);
  15909. /* "(tree fragment)":2
  15910. * def __reduce_cython__(self):
  15911. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15912. * def __setstate_cython__(self, __pyx_state):
  15913. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15914. */
  15915. __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
  15916. __Pyx_GOTREF(__pyx_tuple__13);
  15917. __Pyx_GIVEREF(__pyx_tuple__13);
  15918. /* "(tree fragment)":4
  15919. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15920. * def __setstate_cython__(self, __pyx_state):
  15921. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15922. */
  15923. __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
  15924. __Pyx_GOTREF(__pyx_tuple__14);
  15925. __Pyx_GIVEREF(__pyx_tuple__14);
  15926. /* "View.MemoryView":682
  15927. * if item is Ellipsis:
  15928. * if not seen_ellipsis:
  15929. * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
  15930. * seen_ellipsis = True
  15931. * else:
  15932. */
  15933. __pyx_slice__15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(1, 682, __pyx_L1_error)
  15934. __Pyx_GOTREF(__pyx_slice__15);
  15935. __Pyx_GIVEREF(__pyx_slice__15);
  15936. /* "View.MemoryView":703
  15937. * for suboffset in suboffsets[:ndim]:
  15938. * if suboffset >= 0:
  15939. * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
  15940. *
  15941. *
  15942. */
  15943. __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 703, __pyx_L1_error)
  15944. __Pyx_GOTREF(__pyx_tuple__16);
  15945. __Pyx_GIVEREF(__pyx_tuple__16);
  15946. /* "(tree fragment)":2
  15947. * def __reduce_cython__(self):
  15948. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15949. * def __setstate_cython__(self, __pyx_state):
  15950. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15951. */
  15952. __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 2, __pyx_L1_error)
  15953. __Pyx_GOTREF(__pyx_tuple__17);
  15954. __Pyx_GIVEREF(__pyx_tuple__17);
  15955. /* "(tree fragment)":4
  15956. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  15957. * def __setstate_cython__(self, __pyx_state):
  15958. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  15959. */
  15960. __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 4, __pyx_L1_error)
  15961. __Pyx_GOTREF(__pyx_tuple__18);
  15962. __Pyx_GIVEREF(__pyx_tuple__18);
  15963. /* "app/colormap/colormap.pyx":121
  15964. *
  15965. *
  15966. * def apply_colormap(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  15967. *
  15968. * if max_ is None:
  15969. */
  15970. __pyx_tuple__19 = PyTuple_Pack(8, __pyx_n_s_input, __pyx_n_s_colormap, __pyx_n_s_min, __pyx_n_s_max, __pyx_n_s_range_2, __pyx_n_s_idxs, __pyx_n_s_normalized, __pyx_n_s_colors); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 121, __pyx_L1_error)
  15971. __Pyx_GOTREF(__pyx_tuple__19);
  15972. __Pyx_GIVEREF(__pyx_tuple__19);
  15973. __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_app_colormap_colormap_pyx, __pyx_n_s_apply_colormap, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 121, __pyx_L1_error)
  15974. /* "app/colormap/colormap.pyx":138
  15975. * return colors
  15976. *
  15977. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  15978. * range_ = max_ - min_
  15979. * if range_ == 0:
  15980. */
  15981. __pyx_tuple__21 = PyTuple_Pack(7, __pyx_n_s_input, __pyx_n_s_colormap, __pyx_n_s_min, __pyx_n_s_max, __pyx_n_s_range_2, __pyx_n_s_idx, __pyx_n_s_color); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 138, __pyx_L1_error)
  15982. __Pyx_GOTREF(__pyx_tuple__21);
  15983. __Pyx_GIVEREF(__pyx_tuple__21);
  15984. __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_app_colormap_colormap_pyx, __pyx_n_s_apply_colormap_single, 138, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 138, __pyx_L1_error)
  15985. /* "View.MemoryView":286
  15986. * return self.name
  15987. *
  15988. * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
  15989. * cdef strided = Enum("<strided and direct>") # default
  15990. * cdef indirect = Enum("<strided and indirect>")
  15991. */
  15992. __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 286, __pyx_L1_error)
  15993. __Pyx_GOTREF(__pyx_tuple__23);
  15994. __Pyx_GIVEREF(__pyx_tuple__23);
  15995. /* "View.MemoryView":287
  15996. *
  15997. * cdef generic = Enum("<strided and direct or indirect>")
  15998. * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
  15999. * cdef indirect = Enum("<strided and indirect>")
  16000. *
  16001. */
  16002. __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 287, __pyx_L1_error)
  16003. __Pyx_GOTREF(__pyx_tuple__24);
  16004. __Pyx_GIVEREF(__pyx_tuple__24);
  16005. /* "View.MemoryView":288
  16006. * cdef generic = Enum("<strided and direct or indirect>")
  16007. * cdef strided = Enum("<strided and direct>") # default
  16008. * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
  16009. *
  16010. *
  16011. */
  16012. __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 288, __pyx_L1_error)
  16013. __Pyx_GOTREF(__pyx_tuple__25);
  16014. __Pyx_GIVEREF(__pyx_tuple__25);
  16015. /* "View.MemoryView":291
  16016. *
  16017. *
  16018. * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
  16019. * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  16020. *
  16021. */
  16022. __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 291, __pyx_L1_error)
  16023. __Pyx_GOTREF(__pyx_tuple__26);
  16024. __Pyx_GIVEREF(__pyx_tuple__26);
  16025. /* "View.MemoryView":292
  16026. *
  16027. * cdef contiguous = Enum("<contiguous and direct>")
  16028. * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
  16029. *
  16030. *
  16031. */
  16032. __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 292, __pyx_L1_error)
  16033. __Pyx_GOTREF(__pyx_tuple__27);
  16034. __Pyx_GIVEREF(__pyx_tuple__27);
  16035. /* "(tree fragment)":1
  16036. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  16037. * cdef object __pyx_PickleError
  16038. * cdef object __pyx_result
  16039. */
  16040. __pyx_tuple__28 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 1, __pyx_L1_error)
  16041. __Pyx_GOTREF(__pyx_tuple__28);
  16042. __Pyx_GIVEREF(__pyx_tuple__28);
  16043. __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(1, 1, __pyx_L1_error)
  16044. __Pyx_RefNannyFinishContext();
  16045. return 0;
  16046. __pyx_L1_error:;
  16047. __Pyx_RefNannyFinishContext();
  16048. return -1;
  16049. }
  16050. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  16051. if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  16052. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  16053. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  16054. __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  16055. __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  16056. __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error)
  16057. __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
  16058. __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  16059. return 0;
  16060. __pyx_L1_error:;
  16061. return -1;
  16062. }
  16063. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  16064. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  16065. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  16066. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  16067. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  16068. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  16069. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  16070. static int __Pyx_modinit_global_init_code(void) {
  16071. __Pyx_RefNannyDeclarations
  16072. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  16073. /*--- Global init code ---*/
  16074. generic = Py_None; Py_INCREF(Py_None);
  16075. strided = Py_None; Py_INCREF(Py_None);
  16076. indirect = Py_None; Py_INCREF(Py_None);
  16077. contiguous = Py_None; Py_INCREF(Py_None);
  16078. indirect_contiguous = Py_None; Py_INCREF(Py_None);
  16079. __Pyx_RefNannyFinishContext();
  16080. return 0;
  16081. }
  16082. static int __Pyx_modinit_variable_export_code(void) {
  16083. __Pyx_RefNannyDeclarations
  16084. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  16085. /*--- Variable export code ---*/
  16086. __Pyx_RefNannyFinishContext();
  16087. return 0;
  16088. }
  16089. static int __Pyx_modinit_function_export_code(void) {
  16090. __Pyx_RefNannyDeclarations
  16091. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  16092. /*--- Function export code ---*/
  16093. __Pyx_RefNannyFinishContext();
  16094. return 0;
  16095. }
  16096. static int __Pyx_modinit_type_init_code(void) {
  16097. __Pyx_RefNannyDeclarations
  16098. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  16099. /*--- Type init code ---*/
  16100. __pyx_vtabptr_array = &__pyx_vtable_array;
  16101. __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  16102. if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
  16103. #if PY_VERSION_HEX < 0x030800B1
  16104. __pyx_type___pyx_array.tp_print = 0;
  16105. #endif
  16106. if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
  16107. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
  16108. __pyx_array_type = &__pyx_type___pyx_array;
  16109. if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
  16110. #if PY_VERSION_HEX < 0x030800B1
  16111. __pyx_type___pyx_MemviewEnum.tp_print = 0;
  16112. #endif
  16113. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
  16114. __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  16115. }
  16116. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
  16117. __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  16118. __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  16119. __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  16120. __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  16121. __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  16122. __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  16123. __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  16124. __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  16125. __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  16126. if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
  16127. #if PY_VERSION_HEX < 0x030800B1
  16128. __pyx_type___pyx_memoryview.tp_print = 0;
  16129. #endif
  16130. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
  16131. __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  16132. }
  16133. if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
  16134. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
  16135. __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  16136. __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  16137. __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  16138. __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  16139. __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  16140. __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  16141. if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
  16142. #if PY_VERSION_HEX < 0x030800B1
  16143. __pyx_type___pyx_memoryviewslice.tp_print = 0;
  16144. #endif
  16145. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
  16146. __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  16147. }
  16148. if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
  16149. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
  16150. __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  16151. __Pyx_RefNannyFinishContext();
  16152. return 0;
  16153. __pyx_L1_error:;
  16154. __Pyx_RefNannyFinishContext();
  16155. return -1;
  16156. }
  16157. static int __Pyx_modinit_type_import_code(void) {
  16158. __Pyx_RefNannyDeclarations
  16159. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  16160. /*--- Type import code ---*/
  16161. __Pyx_RefNannyFinishContext();
  16162. return 0;
  16163. }
  16164. static int __Pyx_modinit_variable_import_code(void) {
  16165. __Pyx_RefNannyDeclarations
  16166. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  16167. /*--- Variable import code ---*/
  16168. __Pyx_RefNannyFinishContext();
  16169. return 0;
  16170. }
  16171. static int __Pyx_modinit_function_import_code(void) {
  16172. __Pyx_RefNannyDeclarations
  16173. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  16174. /*--- Function import code ---*/
  16175. __Pyx_RefNannyFinishContext();
  16176. return 0;
  16177. }
  16178. #if PY_MAJOR_VERSION < 3
  16179. #ifdef CYTHON_NO_PYINIT_EXPORT
  16180. #define __Pyx_PyMODINIT_FUNC void
  16181. #else
  16182. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  16183. #endif
  16184. #else
  16185. #ifdef CYTHON_NO_PYINIT_EXPORT
  16186. #define __Pyx_PyMODINIT_FUNC PyObject *
  16187. #else
  16188. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  16189. #endif
  16190. #endif
  16191. #if PY_MAJOR_VERSION < 3
  16192. __Pyx_PyMODINIT_FUNC initcolormap(void) CYTHON_SMALL_CODE; /*proto*/
  16193. __Pyx_PyMODINIT_FUNC initcolormap(void)
  16194. #else
  16195. __Pyx_PyMODINIT_FUNC PyInit_colormap(void) CYTHON_SMALL_CODE; /*proto*/
  16196. __Pyx_PyMODINIT_FUNC PyInit_colormap(void)
  16197. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16198. {
  16199. return PyModuleDef_Init(&__pyx_moduledef);
  16200. }
  16201. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  16202. #if PY_VERSION_HEX >= 0x030700A1
  16203. static PY_INT64_T main_interpreter_id = -1;
  16204. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  16205. if (main_interpreter_id == -1) {
  16206. main_interpreter_id = current_id;
  16207. return (unlikely(current_id == -1)) ? -1 : 0;
  16208. } else if (unlikely(main_interpreter_id != current_id))
  16209. #else
  16210. static PyInterpreterState *main_interpreter = NULL;
  16211. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  16212. if (!main_interpreter) {
  16213. main_interpreter = current_interpreter;
  16214. } else if (unlikely(main_interpreter != current_interpreter))
  16215. #endif
  16216. {
  16217. PyErr_SetString(
  16218. PyExc_ImportError,
  16219. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  16220. return -1;
  16221. }
  16222. return 0;
  16223. }
  16224. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
  16225. PyObject *value = PyObject_GetAttrString(spec, from_name);
  16226. int result = 0;
  16227. if (likely(value)) {
  16228. if (allow_none || value != Py_None) {
  16229. result = PyDict_SetItemString(moddict, to_name, value);
  16230. }
  16231. Py_DECREF(value);
  16232. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  16233. PyErr_Clear();
  16234. } else {
  16235. result = -1;
  16236. }
  16237. return result;
  16238. }
  16239. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  16240. PyObject *module = NULL, *moddict, *modname;
  16241. if (__Pyx_check_single_interpreter())
  16242. return NULL;
  16243. if (__pyx_m)
  16244. return __Pyx_NewRef(__pyx_m);
  16245. modname = PyObject_GetAttrString(spec, "name");
  16246. if (unlikely(!modname)) goto bad;
  16247. module = PyModule_NewObject(modname);
  16248. Py_DECREF(modname);
  16249. if (unlikely(!module)) goto bad;
  16250. moddict = PyModule_GetDict(module);
  16251. if (unlikely(!moddict)) goto bad;
  16252. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  16253. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  16254. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  16255. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  16256. return module;
  16257. bad:
  16258. Py_XDECREF(module);
  16259. return NULL;
  16260. }
  16261. static CYTHON_SMALL_CODE int __pyx_pymod_exec_colormap(PyObject *__pyx_pyinit_module)
  16262. #endif
  16263. #endif
  16264. {
  16265. PyObject *__pyx_t_1 = NULL;
  16266. static float __pyx_t_2[3];
  16267. static float __pyx_t_3[3];
  16268. static float __pyx_t_4[3];
  16269. static float __pyx_t_5[3];
  16270. static float __pyx_t_6[3];
  16271. static float __pyx_t_7[3];
  16272. static float __pyx_t_8[3];
  16273. static float __pyx_t_9[3];
  16274. static float __pyx_t_10[3];
  16275. static float __pyx_t_11[3];
  16276. static float __pyx_t_12[3];
  16277. static float __pyx_t_13[3];
  16278. static float __pyx_t_14[3];
  16279. static float __pyx_t_15[3];
  16280. static float __pyx_t_16[3];
  16281. static float __pyx_t_17[3];
  16282. static float __pyx_t_18[3];
  16283. static float __pyx_t_19[3];
  16284. static float __pyx_t_20[3];
  16285. static float __pyx_t_21[3];
  16286. static float __pyx_t_22[3];
  16287. static float __pyx_t_23[3];
  16288. static float __pyx_t_24[3];
  16289. static float __pyx_t_25[3];
  16290. static float __pyx_t_26[3];
  16291. static float __pyx_t_27[3];
  16292. static float __pyx_t_28[3];
  16293. static float __pyx_t_29[3];
  16294. static float __pyx_t_30[3];
  16295. static float __pyx_t_31[3];
  16296. static float __pyx_t_32[3];
  16297. static float __pyx_t_33[3];
  16298. static float __pyx_t_34[3];
  16299. static float __pyx_t_35[3];
  16300. static float __pyx_t_36[3];
  16301. static float __pyx_t_37[3];
  16302. static float __pyx_t_38[3];
  16303. static float __pyx_t_39[3];
  16304. static float __pyx_t_40[3];
  16305. static float __pyx_t_41[3];
  16306. static float __pyx_t_42[3];
  16307. static float __pyx_t_43[3];
  16308. static float __pyx_t_44[3];
  16309. static float __pyx_t_45[3];
  16310. static float __pyx_t_46[3];
  16311. static float __pyx_t_47[3];
  16312. static float __pyx_t_48[3];
  16313. static float __pyx_t_49[3];
  16314. static float __pyx_t_50[3];
  16315. static float __pyx_t_51[3];
  16316. static float __pyx_t_52[3];
  16317. static float __pyx_t_53[3];
  16318. static float __pyx_t_54[3];
  16319. static float __pyx_t_55[3];
  16320. static float __pyx_t_56[3];
  16321. static float __pyx_t_57[3];
  16322. static float __pyx_t_58[3];
  16323. static float __pyx_t_59[3];
  16324. static float __pyx_t_60[3];
  16325. static float __pyx_t_61[3];
  16326. static float __pyx_t_62[3];
  16327. static float __pyx_t_63[3];
  16328. static float __pyx_t_64[3];
  16329. static float __pyx_t_65[3];
  16330. PyObject *__pyx_t_66 = NULL;
  16331. PyObject *__pyx_t_67 = NULL;
  16332. PyObject *__pyx_t_68 = NULL;
  16333. PyObject *__pyx_t_69 = NULL;
  16334. Py_ssize_t __pyx_t_70;
  16335. PyObject *__pyx_t_71 = NULL;
  16336. static PyThread_type_lock __pyx_t_72[8];
  16337. __Pyx_RefNannyDeclarations
  16338. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16339. if (__pyx_m) {
  16340. if (__pyx_m == __pyx_pyinit_module) return 0;
  16341. PyErr_SetString(PyExc_RuntimeError, "Module 'colormap' has already been imported. Re-initialisation is not supported.");
  16342. return -1;
  16343. }
  16344. #elif PY_MAJOR_VERSION >= 3
  16345. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  16346. #endif
  16347. #if CYTHON_REFNANNY
  16348. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  16349. if (!__Pyx_RefNanny) {
  16350. PyErr_Clear();
  16351. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  16352. if (!__Pyx_RefNanny)
  16353. Py_FatalError("failed to import 'refnanny' module");
  16354. }
  16355. #endif
  16356. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_colormap(void)", 0);
  16357. if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16358. #ifdef __Pxy_PyFrame_Initialize_Offsets
  16359. __Pxy_PyFrame_Initialize_Offsets();
  16360. #endif
  16361. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  16362. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  16363. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  16364. #ifdef __Pyx_CyFunction_USED
  16365. if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16366. #endif
  16367. #ifdef __Pyx_FusedFunction_USED
  16368. if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16369. #endif
  16370. #ifdef __Pyx_Coroutine_USED
  16371. if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16372. #endif
  16373. #ifdef __Pyx_Generator_USED
  16374. if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16375. #endif
  16376. #ifdef __Pyx_AsyncGen_USED
  16377. if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16378. #endif
  16379. #ifdef __Pyx_StopAsyncIteration_USED
  16380. if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16381. #endif
  16382. /*--- Library function declarations ---*/
  16383. /*--- Threads initialization code ---*/
  16384. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  16385. #ifdef WITH_THREAD /* Python build with threading support? */
  16386. PyEval_InitThreads();
  16387. #endif
  16388. #endif
  16389. /*--- Module creation code ---*/
  16390. #if CYTHON_PEP489_MULTI_PHASE_INIT
  16391. __pyx_m = __pyx_pyinit_module;
  16392. Py_INCREF(__pyx_m);
  16393. #else
  16394. #if PY_MAJOR_VERSION < 3
  16395. __pyx_m = Py_InitModule4("colormap", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  16396. #else
  16397. __pyx_m = PyModule_Create(&__pyx_moduledef);
  16398. #endif
  16399. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  16400. #endif
  16401. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  16402. Py_INCREF(__pyx_d);
  16403. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  16404. Py_INCREF(__pyx_b);
  16405. __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  16406. Py_INCREF(__pyx_cython_runtime);
  16407. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  16408. /*--- Initialize various global constants etc. ---*/
  16409. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16410. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  16411. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16412. #endif
  16413. if (__pyx_module_is_main_app__colormap__colormap) {
  16414. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16415. }
  16416. #if PY_MAJOR_VERSION >= 3
  16417. {
  16418. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  16419. if (!PyDict_GetItemString(modules, "app.colormap.colormap")) {
  16420. if (unlikely(PyDict_SetItemString(modules, "app.colormap.colormap", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  16421. }
  16422. }
  16423. #endif
  16424. /*--- Builtin init code ---*/
  16425. if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
  16426. /*--- Constants init code ---*/
  16427. if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
  16428. /*--- Global type/function init code ---*/
  16429. (void)__Pyx_modinit_global_init_code();
  16430. (void)__Pyx_modinit_variable_export_code();
  16431. (void)__Pyx_modinit_function_export_code();
  16432. if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  16433. (void)__Pyx_modinit_type_import_code();
  16434. (void)__Pyx_modinit_variable_import_code();
  16435. (void)__Pyx_modinit_function_import_code();
  16436. /*--- Execution code ---*/
  16437. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  16438. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  16439. #endif
  16440. /* "app/colormap/colormap.pyx":15
  16441. * # work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
  16442. *
  16443. * __all__ = ['apply_colormap', 'apply_colormap_single'] # <<<<<<<<<<<<<<
  16444. *
  16445. * cdef float _magma_data[16][3]
  16446. */
  16447. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  16448. __Pyx_GOTREF(__pyx_t_1);
  16449. __Pyx_INCREF(__pyx_n_u_apply_colormap);
  16450. __Pyx_GIVEREF(__pyx_n_u_apply_colormap);
  16451. PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_apply_colormap);
  16452. __Pyx_INCREF(__pyx_n_u_apply_colormap_single);
  16453. __Pyx_GIVEREF(__pyx_n_u_apply_colormap_single);
  16454. PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_apply_colormap_single);
  16455. if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  16456. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16457. /* "app/colormap/colormap.pyx":18
  16458. *
  16459. * cdef float _magma_data[16][3]
  16460. * _magma_data[0][:] = [0.001462, 0.000466, 0.013866] # <<<<<<<<<<<<<<
  16461. * _magma_data[1][:] = [0.039608, 0.031090, 0.133515]
  16462. * _magma_data[2][:] = [0.113094, 0.065492, 0.276784]
  16463. */
  16464. __pyx_t_2[0] = 0.001462;
  16465. __pyx_t_2[1] = 0.000466;
  16466. __pyx_t_2[2] = 0.013866;
  16467. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[0])[0]), __pyx_t_2, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[0])[0]) * (3));
  16468. /* "app/colormap/colormap.pyx":19
  16469. * cdef float _magma_data[16][3]
  16470. * _magma_data[0][:] = [0.001462, 0.000466, 0.013866]
  16471. * _magma_data[1][:] = [0.039608, 0.031090, 0.133515] # <<<<<<<<<<<<<<
  16472. * _magma_data[2][:] = [0.113094, 0.065492, 0.276784]
  16473. * _magma_data[3][:] = [0.211718, 0.061992, 0.418647]
  16474. */
  16475. __pyx_t_3[0] = 0.039608;
  16476. __pyx_t_3[1] = 0.031090;
  16477. __pyx_t_3[2] = 0.133515;
  16478. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[1])[0]), __pyx_t_3, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[1])[0]) * (3));
  16479. /* "app/colormap/colormap.pyx":20
  16480. * _magma_data[0][:] = [0.001462, 0.000466, 0.013866]
  16481. * _magma_data[1][:] = [0.039608, 0.031090, 0.133515]
  16482. * _magma_data[2][:] = [0.113094, 0.065492, 0.276784] # <<<<<<<<<<<<<<
  16483. * _magma_data[3][:] = [0.211718, 0.061992, 0.418647]
  16484. * _magma_data[4][:] = [0.316654, 0.071690, 0.485380]
  16485. */
  16486. __pyx_t_4[0] = 0.113094;
  16487. __pyx_t_4[1] = 0.065492;
  16488. __pyx_t_4[2] = 0.276784;
  16489. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[2])[0]), __pyx_t_4, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[2])[0]) * (3));
  16490. /* "app/colormap/colormap.pyx":21
  16491. * _magma_data[1][:] = [0.039608, 0.031090, 0.133515]
  16492. * _magma_data[2][:] = [0.113094, 0.065492, 0.276784]
  16493. * _magma_data[3][:] = [0.211718, 0.061992, 0.418647] # <<<<<<<<<<<<<<
  16494. * _magma_data[4][:] = [0.316654, 0.071690, 0.485380]
  16495. * _magma_data[5][:] = [0.414709, 0.110431, 0.504662]
  16496. */
  16497. __pyx_t_5[0] = 0.211718;
  16498. __pyx_t_5[1] = 0.061992;
  16499. __pyx_t_5[2] = 0.418647;
  16500. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[3])[0]), __pyx_t_5, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[3])[0]) * (3));
  16501. /* "app/colormap/colormap.pyx":22
  16502. * _magma_data[2][:] = [0.113094, 0.065492, 0.276784]
  16503. * _magma_data[3][:] = [0.211718, 0.061992, 0.418647]
  16504. * _magma_data[4][:] = [0.316654, 0.071690, 0.485380] # <<<<<<<<<<<<<<
  16505. * _magma_data[5][:] = [0.414709, 0.110431, 0.504662]
  16506. * _magma_data[6][:] = [0.512831, 0.148179, 0.507648]
  16507. */
  16508. __pyx_t_6[0] = 0.316654;
  16509. __pyx_t_6[1] = 0.071690;
  16510. __pyx_t_6[2] = 0.485380;
  16511. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[4])[0]), __pyx_t_6, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[4])[0]) * (3));
  16512. /* "app/colormap/colormap.pyx":23
  16513. * _magma_data[3][:] = [0.211718, 0.061992, 0.418647]
  16514. * _magma_data[4][:] = [0.316654, 0.071690, 0.485380]
  16515. * _magma_data[5][:] = [0.414709, 0.110431, 0.504662] # <<<<<<<<<<<<<<
  16516. * _magma_data[6][:] = [0.512831, 0.148179, 0.507648]
  16517. * _magma_data[7][:] = [0.613617, 0.181811, 0.498536]
  16518. */
  16519. __pyx_t_7[0] = 0.414709;
  16520. __pyx_t_7[1] = 0.110431;
  16521. __pyx_t_7[2] = 0.504662;
  16522. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[5])[0]), __pyx_t_7, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[5])[0]) * (3));
  16523. /* "app/colormap/colormap.pyx":24
  16524. * _magma_data[4][:] = [0.316654, 0.071690, 0.485380]
  16525. * _magma_data[5][:] = [0.414709, 0.110431, 0.504662]
  16526. * _magma_data[6][:] = [0.512831, 0.148179, 0.507648] # <<<<<<<<<<<<<<
  16527. * _magma_data[7][:] = [0.613617, 0.181811, 0.498536]
  16528. * _magma_data[8][:] = [0.716387, 0.214982, 0.475290]
  16529. */
  16530. __pyx_t_8[0] = 0.512831;
  16531. __pyx_t_8[1] = 0.148179;
  16532. __pyx_t_8[2] = 0.507648;
  16533. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[6])[0]), __pyx_t_8, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[6])[0]) * (3));
  16534. /* "app/colormap/colormap.pyx":25
  16535. * _magma_data[5][:] = [0.414709, 0.110431, 0.504662]
  16536. * _magma_data[6][:] = [0.512831, 0.148179, 0.507648]
  16537. * _magma_data[7][:] = [0.613617, 0.181811, 0.498536] # <<<<<<<<<<<<<<
  16538. * _magma_data[8][:] = [0.716387, 0.214982, 0.475290]
  16539. * _magma_data[9][:] = [0.816914, 0.255895, 0.436461]
  16540. */
  16541. __pyx_t_9[0] = 0.613617;
  16542. __pyx_t_9[1] = 0.181811;
  16543. __pyx_t_9[2] = 0.498536;
  16544. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[7])[0]), __pyx_t_9, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[7])[0]) * (3));
  16545. /* "app/colormap/colormap.pyx":26
  16546. * _magma_data[6][:] = [0.512831, 0.148179, 0.507648]
  16547. * _magma_data[7][:] = [0.613617, 0.181811, 0.498536]
  16548. * _magma_data[8][:] = [0.716387, 0.214982, 0.475290] # <<<<<<<<<<<<<<
  16549. * _magma_data[9][:] = [0.816914, 0.255895, 0.436461]
  16550. * _magma_data[10][:] = [0.904281, 0.319610, 0.388137]
  16551. */
  16552. __pyx_t_10[0] = 0.716387;
  16553. __pyx_t_10[1] = 0.214982;
  16554. __pyx_t_10[2] = 0.475290;
  16555. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[8])[0]), __pyx_t_10, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[8])[0]) * (3));
  16556. /* "app/colormap/colormap.pyx":27
  16557. * _magma_data[7][:] = [0.613617, 0.181811, 0.498536]
  16558. * _magma_data[8][:] = [0.716387, 0.214982, 0.475290]
  16559. * _magma_data[9][:] = [0.816914, 0.255895, 0.436461] # <<<<<<<<<<<<<<
  16560. * _magma_data[10][:] = [0.904281, 0.319610, 0.388137]
  16561. * _magma_data[11][:] = [0.960949, 0.418323, 0.359630]
  16562. */
  16563. __pyx_t_11[0] = 0.816914;
  16564. __pyx_t_11[1] = 0.255895;
  16565. __pyx_t_11[2] = 0.436461;
  16566. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[9])[0]), __pyx_t_11, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[9])[0]) * (3));
  16567. /* "app/colormap/colormap.pyx":28
  16568. * _magma_data[8][:] = [0.716387, 0.214982, 0.475290]
  16569. * _magma_data[9][:] = [0.816914, 0.255895, 0.436461]
  16570. * _magma_data[10][:] = [0.904281, 0.319610, 0.388137] # <<<<<<<<<<<<<<
  16571. * _magma_data[11][:] = [0.960949, 0.418323, 0.359630]
  16572. * _magma_data[12][:] = [0.986700, 0.535582, 0.382210]
  16573. */
  16574. __pyx_t_12[0] = 0.904281;
  16575. __pyx_t_12[1] = 0.319610;
  16576. __pyx_t_12[2] = 0.388137;
  16577. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[10])[0]), __pyx_t_12, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[10])[0]) * (3));
  16578. /* "app/colormap/colormap.pyx":29
  16579. * _magma_data[9][:] = [0.816914, 0.255895, 0.436461]
  16580. * _magma_data[10][:] = [0.904281, 0.319610, 0.388137]
  16581. * _magma_data[11][:] = [0.960949, 0.418323, 0.359630] # <<<<<<<<<<<<<<
  16582. * _magma_data[12][:] = [0.986700, 0.535582, 0.382210]
  16583. * _magma_data[13][:] = [0.996096, 0.653659, 0.446213]
  16584. */
  16585. __pyx_t_13[0] = 0.960949;
  16586. __pyx_t_13[1] = 0.418323;
  16587. __pyx_t_13[2] = 0.359630;
  16588. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[11])[0]), __pyx_t_13, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[11])[0]) * (3));
  16589. /* "app/colormap/colormap.pyx":30
  16590. * _magma_data[10][:] = [0.904281, 0.319610, 0.388137]
  16591. * _magma_data[11][:] = [0.960949, 0.418323, 0.359630]
  16592. * _magma_data[12][:] = [0.986700, 0.535582, 0.382210] # <<<<<<<<<<<<<<
  16593. * _magma_data[13][:] = [0.996096, 0.653659, 0.446213]
  16594. * _magma_data[14][:] = [0.996898, 0.769591, 0.534892]
  16595. */
  16596. __pyx_t_14[0] = 0.986700;
  16597. __pyx_t_14[1] = 0.535582;
  16598. __pyx_t_14[2] = 0.382210;
  16599. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[12])[0]), __pyx_t_14, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[12])[0]) * (3));
  16600. /* "app/colormap/colormap.pyx":31
  16601. * _magma_data[11][:] = [0.960949, 0.418323, 0.359630]
  16602. * _magma_data[12][:] = [0.986700, 0.535582, 0.382210]
  16603. * _magma_data[13][:] = [0.996096, 0.653659, 0.446213] # <<<<<<<<<<<<<<
  16604. * _magma_data[14][:] = [0.996898, 0.769591, 0.534892]
  16605. * _magma_data[15][:] = [0.992440, 0.884330, 0.640099]
  16606. */
  16607. __pyx_t_15[0] = 0.996096;
  16608. __pyx_t_15[1] = 0.653659;
  16609. __pyx_t_15[2] = 0.446213;
  16610. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[13])[0]), __pyx_t_15, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[13])[0]) * (3));
  16611. /* "app/colormap/colormap.pyx":32
  16612. * _magma_data[12][:] = [0.986700, 0.535582, 0.382210]
  16613. * _magma_data[13][:] = [0.996096, 0.653659, 0.446213]
  16614. * _magma_data[14][:] = [0.996898, 0.769591, 0.534892] # <<<<<<<<<<<<<<
  16615. * _magma_data[15][:] = [0.992440, 0.884330, 0.640099]
  16616. *
  16617. */
  16618. __pyx_t_16[0] = 0.996898;
  16619. __pyx_t_16[1] = 0.769591;
  16620. __pyx_t_16[2] = 0.534892;
  16621. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[14])[0]), __pyx_t_16, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[14])[0]) * (3));
  16622. /* "app/colormap/colormap.pyx":33
  16623. * _magma_data[13][:] = [0.996096, 0.653659, 0.446213]
  16624. * _magma_data[14][:] = [0.996898, 0.769591, 0.534892]
  16625. * _magma_data[15][:] = [0.992440, 0.884330, 0.640099] # <<<<<<<<<<<<<<
  16626. *
  16627. *
  16628. */
  16629. __pyx_t_17[0] = 0.992440;
  16630. __pyx_t_17[1] = 0.884330;
  16631. __pyx_t_17[2] = 0.640099;
  16632. memcpy(&((__pyx_v_3app_8colormap_8colormap__magma_data[15])[0]), __pyx_t_17, sizeof((__pyx_v_3app_8colormap_8colormap__magma_data[15])[0]) * (3));
  16633. /* "app/colormap/colormap.pyx":37
  16634. *
  16635. * cdef float _inferno_data[16][3]
  16636. * _inferno_data[0][:] = [0.001462, 0.000466, 0.013866] # <<<<<<<<<<<<<<
  16637. * _inferno_data[1][:] = [0.042253, 0.028139, 0.141141]
  16638. * _inferno_data[2][:] = [0.129285, 0.047293, 0.290788]
  16639. */
  16640. __pyx_t_18[0] = 0.001462;
  16641. __pyx_t_18[1] = 0.000466;
  16642. __pyx_t_18[2] = 0.013866;
  16643. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[0])[0]), __pyx_t_18, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[0])[0]) * (3));
  16644. /* "app/colormap/colormap.pyx":38
  16645. * cdef float _inferno_data[16][3]
  16646. * _inferno_data[0][:] = [0.001462, 0.000466, 0.013866]
  16647. * _inferno_data[1][:] = [0.042253, 0.028139, 0.141141] # <<<<<<<<<<<<<<
  16648. * _inferno_data[2][:] = [0.129285, 0.047293, 0.290788]
  16649. * _inferno_data[3][:] = [0.238273, 0.036621, 0.396353]
  16650. */
  16651. __pyx_t_19[0] = 0.042253;
  16652. __pyx_t_19[1] = 0.028139;
  16653. __pyx_t_19[2] = 0.141141;
  16654. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[1])[0]), __pyx_t_19, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[1])[0]) * (3));
  16655. /* "app/colormap/colormap.pyx":39
  16656. * _inferno_data[0][:] = [0.001462, 0.000466, 0.013866]
  16657. * _inferno_data[1][:] = [0.042253, 0.028139, 0.141141]
  16658. * _inferno_data[2][:] = [0.129285, 0.047293, 0.290788] # <<<<<<<<<<<<<<
  16659. * _inferno_data[3][:] = [0.238273, 0.036621, 0.396353]
  16660. * _inferno_data[4][:] = [0.341500, 0.062325, 0.429425]
  16661. */
  16662. __pyx_t_20[0] = 0.129285;
  16663. __pyx_t_20[1] = 0.047293;
  16664. __pyx_t_20[2] = 0.290788;
  16665. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[2])[0]), __pyx_t_20, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[2])[0]) * (3));
  16666. /* "app/colormap/colormap.pyx":40
  16667. * _inferno_data[1][:] = [0.042253, 0.028139, 0.141141]
  16668. * _inferno_data[2][:] = [0.129285, 0.047293, 0.290788]
  16669. * _inferno_data[3][:] = [0.238273, 0.036621, 0.396353] # <<<<<<<<<<<<<<
  16670. * _inferno_data[4][:] = [0.341500, 0.062325, 0.429425]
  16671. * _inferno_data[5][:] = [0.441207, 0.099338, 0.431594]
  16672. */
  16673. __pyx_t_21[0] = 0.238273;
  16674. __pyx_t_21[1] = 0.036621;
  16675. __pyx_t_21[2] = 0.396353;
  16676. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[3])[0]), __pyx_t_21, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[3])[0]) * (3));
  16677. /* "app/colormap/colormap.pyx":41
  16678. * _inferno_data[2][:] = [0.129285, 0.047293, 0.290788]
  16679. * _inferno_data[3][:] = [0.238273, 0.036621, 0.396353]
  16680. * _inferno_data[4][:] = [0.341500, 0.062325, 0.429425] # <<<<<<<<<<<<<<
  16681. * _inferno_data[5][:] = [0.441207, 0.099338, 0.431594]
  16682. * _inferno_data[6][:] = [0.540920, 0.134729, 0.415123]
  16683. */
  16684. __pyx_t_22[0] = 0.341500;
  16685. __pyx_t_22[1] = 0.062325;
  16686. __pyx_t_22[2] = 0.429425;
  16687. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[4])[0]), __pyx_t_22, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[4])[0]) * (3));
  16688. /* "app/colormap/colormap.pyx":42
  16689. * _inferno_data[3][:] = [0.238273, 0.036621, 0.396353]
  16690. * _inferno_data[4][:] = [0.341500, 0.062325, 0.429425]
  16691. * _inferno_data[5][:] = [0.441207, 0.099338, 0.431594] # <<<<<<<<<<<<<<
  16692. * _inferno_data[6][:] = [0.540920, 0.134729, 0.415123]
  16693. * _inferno_data[7][:] = [0.640135, 0.171438, 0.381065]
  16694. */
  16695. __pyx_t_23[0] = 0.441207;
  16696. __pyx_t_23[1] = 0.099338;
  16697. __pyx_t_23[2] = 0.431594;
  16698. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[5])[0]), __pyx_t_23, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[5])[0]) * (3));
  16699. /* "app/colormap/colormap.pyx":43
  16700. * _inferno_data[4][:] = [0.341500, 0.062325, 0.429425]
  16701. * _inferno_data[5][:] = [0.441207, 0.099338, 0.431594]
  16702. * _inferno_data[6][:] = [0.540920, 0.134729, 0.415123] # <<<<<<<<<<<<<<
  16703. * _inferno_data[7][:] = [0.640135, 0.171438, 0.381065]
  16704. * _inferno_data[8][:] = [0.735683, 0.215906, 0.330245]
  16705. */
  16706. __pyx_t_24[0] = 0.540920;
  16707. __pyx_t_24[1] = 0.134729;
  16708. __pyx_t_24[2] = 0.415123;
  16709. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[6])[0]), __pyx_t_24, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[6])[0]) * (3));
  16710. /* "app/colormap/colormap.pyx":44
  16711. * _inferno_data[5][:] = [0.441207, 0.099338, 0.431594]
  16712. * _inferno_data[6][:] = [0.540920, 0.134729, 0.415123]
  16713. * _inferno_data[7][:] = [0.640135, 0.171438, 0.381065] # <<<<<<<<<<<<<<
  16714. * _inferno_data[8][:] = [0.735683, 0.215906, 0.330245]
  16715. * _inferno_data[9][:] = [0.822386, 0.275197, 0.266085]
  16716. */
  16717. __pyx_t_25[0] = 0.640135;
  16718. __pyx_t_25[1] = 0.171438;
  16719. __pyx_t_25[2] = 0.381065;
  16720. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[7])[0]), __pyx_t_25, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[7])[0]) * (3));
  16721. /* "app/colormap/colormap.pyx":45
  16722. * _inferno_data[6][:] = [0.540920, 0.134729, 0.415123]
  16723. * _inferno_data[7][:] = [0.640135, 0.171438, 0.381065]
  16724. * _inferno_data[8][:] = [0.735683, 0.215906, 0.330245] # <<<<<<<<<<<<<<
  16725. * _inferno_data[9][:] = [0.822386, 0.275197, 0.266085]
  16726. * _inferno_data[10][:] = [0.894305, 0.353399, 0.193584]
  16727. */
  16728. __pyx_t_26[0] = 0.735683;
  16729. __pyx_t_26[1] = 0.215906;
  16730. __pyx_t_26[2] = 0.330245;
  16731. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[8])[0]), __pyx_t_26, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[8])[0]) * (3));
  16732. /* "app/colormap/colormap.pyx":46
  16733. * _inferno_data[7][:] = [0.640135, 0.171438, 0.381065]
  16734. * _inferno_data[8][:] = [0.735683, 0.215906, 0.330245]
  16735. * _inferno_data[9][:] = [0.822386, 0.275197, 0.266085] # <<<<<<<<<<<<<<
  16736. * _inferno_data[10][:] = [0.894305, 0.353399, 0.193584]
  16737. * _inferno_data[11][:] = [0.946965, 0.449191, 0.115272]
  16738. */
  16739. __pyx_t_27[0] = 0.822386;
  16740. __pyx_t_27[1] = 0.275197;
  16741. __pyx_t_27[2] = 0.266085;
  16742. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[9])[0]), __pyx_t_27, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[9])[0]) * (3));
  16743. /* "app/colormap/colormap.pyx":47
  16744. * _inferno_data[8][:] = [0.735683, 0.215906, 0.330245]
  16745. * _inferno_data[9][:] = [0.822386, 0.275197, 0.266085]
  16746. * _inferno_data[10][:] = [0.894305, 0.353399, 0.193584] # <<<<<<<<<<<<<<
  16747. * _inferno_data[11][:] = [0.946965, 0.449191, 0.115272]
  16748. * _inferno_data[12][:] = [0.978422, 0.557937, 0.034931]
  16749. */
  16750. __pyx_t_28[0] = 0.894305;
  16751. __pyx_t_28[1] = 0.353399;
  16752. __pyx_t_28[2] = 0.193584;
  16753. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[10])[0]), __pyx_t_28, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[10])[0]) * (3));
  16754. /* "app/colormap/colormap.pyx":48
  16755. * _inferno_data[9][:] = [0.822386, 0.275197, 0.266085]
  16756. * _inferno_data[10][:] = [0.894305, 0.353399, 0.193584]
  16757. * _inferno_data[11][:] = [0.946965, 0.449191, 0.115272] # <<<<<<<<<<<<<<
  16758. * _inferno_data[12][:] = [0.978422, 0.557937, 0.034931]
  16759. * _inferno_data[13][:] = [0.987874, 0.675267, 0.065257]
  16760. */
  16761. __pyx_t_29[0] = 0.946965;
  16762. __pyx_t_29[1] = 0.449191;
  16763. __pyx_t_29[2] = 0.115272;
  16764. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[11])[0]), __pyx_t_29, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[11])[0]) * (3));
  16765. /* "app/colormap/colormap.pyx":49
  16766. * _inferno_data[10][:] = [0.894305, 0.353399, 0.193584]
  16767. * _inferno_data[11][:] = [0.946965, 0.449191, 0.115272]
  16768. * _inferno_data[12][:] = [0.978422, 0.557937, 0.034931] # <<<<<<<<<<<<<<
  16769. * _inferno_data[13][:] = [0.987874, 0.675267, 0.065257]
  16770. * _inferno_data[14][:] = [0.974638, 0.797692, 0.206332]
  16771. */
  16772. __pyx_t_30[0] = 0.978422;
  16773. __pyx_t_30[1] = 0.557937;
  16774. __pyx_t_30[2] = 0.034931;
  16775. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[12])[0]), __pyx_t_30, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[12])[0]) * (3));
  16776. /* "app/colormap/colormap.pyx":50
  16777. * _inferno_data[11][:] = [0.946965, 0.449191, 0.115272]
  16778. * _inferno_data[12][:] = [0.978422, 0.557937, 0.034931]
  16779. * _inferno_data[13][:] = [0.987874, 0.675267, 0.065257] # <<<<<<<<<<<<<<
  16780. * _inferno_data[14][:] = [0.974638, 0.797692, 0.206332]
  16781. * _inferno_data[15][:] = [0.947594, 0.917399, 0.410665]
  16782. */
  16783. __pyx_t_31[0] = 0.987874;
  16784. __pyx_t_31[1] = 0.675267;
  16785. __pyx_t_31[2] = 0.065257;
  16786. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[13])[0]), __pyx_t_31, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[13])[0]) * (3));
  16787. /* "app/colormap/colormap.pyx":51
  16788. * _inferno_data[12][:] = [0.978422, 0.557937, 0.034931]
  16789. * _inferno_data[13][:] = [0.987874, 0.675267, 0.065257]
  16790. * _inferno_data[14][:] = [0.974638, 0.797692, 0.206332] # <<<<<<<<<<<<<<
  16791. * _inferno_data[15][:] = [0.947594, 0.917399, 0.410665]
  16792. *
  16793. */
  16794. __pyx_t_32[0] = 0.974638;
  16795. __pyx_t_32[1] = 0.797692;
  16796. __pyx_t_32[2] = 0.206332;
  16797. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[14])[0]), __pyx_t_32, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[14])[0]) * (3));
  16798. /* "app/colormap/colormap.pyx":52
  16799. * _inferno_data[13][:] = [0.987874, 0.675267, 0.065257]
  16800. * _inferno_data[14][:] = [0.974638, 0.797692, 0.206332]
  16801. * _inferno_data[15][:] = [0.947594, 0.917399, 0.410665] # <<<<<<<<<<<<<<
  16802. *
  16803. * cdef float _plasma_data[16][3]
  16804. */
  16805. __pyx_t_33[0] = 0.947594;
  16806. __pyx_t_33[1] = 0.917399;
  16807. __pyx_t_33[2] = 0.410665;
  16808. memcpy(&((__pyx_v_3app_8colormap_8colormap__inferno_data[15])[0]), __pyx_t_33, sizeof((__pyx_v_3app_8colormap_8colormap__inferno_data[15])[0]) * (3));
  16809. /* "app/colormap/colormap.pyx":55
  16810. *
  16811. * cdef float _plasma_data[16][3]
  16812. * _plasma_data[0][:] = [0.050383, 0.029803, 0.527975] # <<<<<<<<<<<<<<
  16813. * _plasma_data[1][:] = [0.193374, 0.018354, 0.590330]
  16814. * _plasma_data[2][:] = [0.299855, 0.009561, 0.631624]
  16815. */
  16816. __pyx_t_34[0] = 0.050383;
  16817. __pyx_t_34[1] = 0.029803;
  16818. __pyx_t_34[2] = 0.527975;
  16819. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[0])[0]), __pyx_t_34, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[0])[0]) * (3));
  16820. /* "app/colormap/colormap.pyx":56
  16821. * cdef float _plasma_data[16][3]
  16822. * _plasma_data[0][:] = [0.050383, 0.029803, 0.527975]
  16823. * _plasma_data[1][:] = [0.193374, 0.018354, 0.590330] # <<<<<<<<<<<<<<
  16824. * _plasma_data[2][:] = [0.299855, 0.009561, 0.631624]
  16825. * _plasma_data[3][:] = [0.399411, 0.000859, 0.656133]
  16826. */
  16827. __pyx_t_35[0] = 0.193374;
  16828. __pyx_t_35[1] = 0.018354;
  16829. __pyx_t_35[2] = 0.590330;
  16830. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[1])[0]), __pyx_t_35, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[1])[0]) * (3));
  16831. /* "app/colormap/colormap.pyx":57
  16832. * _plasma_data[0][:] = [0.050383, 0.029803, 0.527975]
  16833. * _plasma_data[1][:] = [0.193374, 0.018354, 0.590330]
  16834. * _plasma_data[2][:] = [0.299855, 0.009561, 0.631624] # <<<<<<<<<<<<<<
  16835. * _plasma_data[3][:] = [0.399411, 0.000859, 0.656133]
  16836. * _plasma_data[4][:] = [0.494877, 0.011990, 0.657865]
  16837. */
  16838. __pyx_t_36[0] = 0.299855;
  16839. __pyx_t_36[1] = 0.009561;
  16840. __pyx_t_36[2] = 0.631624;
  16841. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[2])[0]), __pyx_t_36, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[2])[0]) * (3));
  16842. /* "app/colormap/colormap.pyx":58
  16843. * _plasma_data[1][:] = [0.193374, 0.018354, 0.590330]
  16844. * _plasma_data[2][:] = [0.299855, 0.009561, 0.631624]
  16845. * _plasma_data[3][:] = [0.399411, 0.000859, 0.656133] # <<<<<<<<<<<<<<
  16846. * _plasma_data[4][:] = [0.494877, 0.011990, 0.657865]
  16847. * _plasma_data[5][:] = [0.584391, 0.068579, 0.632812]
  16848. */
  16849. __pyx_t_37[0] = 0.399411;
  16850. __pyx_t_37[1] = 0.000859;
  16851. __pyx_t_37[2] = 0.656133;
  16852. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[3])[0]), __pyx_t_37, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[3])[0]) * (3));
  16853. /* "app/colormap/colormap.pyx":59
  16854. * _plasma_data[2][:] = [0.299855, 0.009561, 0.631624]
  16855. * _plasma_data[3][:] = [0.399411, 0.000859, 0.656133]
  16856. * _plasma_data[4][:] = [0.494877, 0.011990, 0.657865] # <<<<<<<<<<<<<<
  16857. * _plasma_data[5][:] = [0.584391, 0.068579, 0.632812]
  16858. * _plasma_data[6][:] = [0.665129, 0.138566, 0.585582]
  16859. */
  16860. __pyx_t_38[0] = 0.494877;
  16861. __pyx_t_38[1] = 0.011990;
  16862. __pyx_t_38[2] = 0.657865;
  16863. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[4])[0]), __pyx_t_38, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[4])[0]) * (3));
  16864. /* "app/colormap/colormap.pyx":60
  16865. * _plasma_data[3][:] = [0.399411, 0.000859, 0.656133]
  16866. * _plasma_data[4][:] = [0.494877, 0.011990, 0.657865]
  16867. * _plasma_data[5][:] = [0.584391, 0.068579, 0.632812] # <<<<<<<<<<<<<<
  16868. * _plasma_data[6][:] = [0.665129, 0.138566, 0.585582]
  16869. * _plasma_data[7][:] = [0.736019, 0.209439, 0.527908]
  16870. */
  16871. __pyx_t_39[0] = 0.584391;
  16872. __pyx_t_39[1] = 0.068579;
  16873. __pyx_t_39[2] = 0.632812;
  16874. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[5])[0]), __pyx_t_39, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[5])[0]) * (3));
  16875. /* "app/colormap/colormap.pyx":61
  16876. * _plasma_data[4][:] = [0.494877, 0.011990, 0.657865]
  16877. * _plasma_data[5][:] = [0.584391, 0.068579, 0.632812]
  16878. * _plasma_data[6][:] = [0.665129, 0.138566, 0.585582] # <<<<<<<<<<<<<<
  16879. * _plasma_data[7][:] = [0.736019, 0.209439, 0.527908]
  16880. * _plasma_data[8][:] = [0.798216, 0.280197, 0.469538]
  16881. */
  16882. __pyx_t_40[0] = 0.665129;
  16883. __pyx_t_40[1] = 0.138566;
  16884. __pyx_t_40[2] = 0.585582;
  16885. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[6])[0]), __pyx_t_40, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[6])[0]) * (3));
  16886. /* "app/colormap/colormap.pyx":62
  16887. * _plasma_data[5][:] = [0.584391, 0.068579, 0.632812]
  16888. * _plasma_data[6][:] = [0.665129, 0.138566, 0.585582]
  16889. * _plasma_data[7][:] = [0.736019, 0.209439, 0.527908] # <<<<<<<<<<<<<<
  16890. * _plasma_data[8][:] = [0.798216, 0.280197, 0.469538]
  16891. * _plasma_data[9][:] = [0.853319, 0.351553, 0.413734]
  16892. */
  16893. __pyx_t_41[0] = 0.736019;
  16894. __pyx_t_41[1] = 0.209439;
  16895. __pyx_t_41[2] = 0.527908;
  16896. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[7])[0]), __pyx_t_41, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[7])[0]) * (3));
  16897. /* "app/colormap/colormap.pyx":63
  16898. * _plasma_data[6][:] = [0.665129, 0.138566, 0.585582]
  16899. * _plasma_data[7][:] = [0.736019, 0.209439, 0.527908]
  16900. * _plasma_data[8][:] = [0.798216, 0.280197, 0.469538] # <<<<<<<<<<<<<<
  16901. * _plasma_data[9][:] = [0.853319, 0.351553, 0.413734]
  16902. * _plasma_data[10][:] = [0.901807, 0.425087, 0.359688]
  16903. */
  16904. __pyx_t_42[0] = 0.798216;
  16905. __pyx_t_42[1] = 0.280197;
  16906. __pyx_t_42[2] = 0.469538;
  16907. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[8])[0]), __pyx_t_42, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[8])[0]) * (3));
  16908. /* "app/colormap/colormap.pyx":64
  16909. * _plasma_data[7][:] = [0.736019, 0.209439, 0.527908]
  16910. * _plasma_data[8][:] = [0.798216, 0.280197, 0.469538]
  16911. * _plasma_data[9][:] = [0.853319, 0.351553, 0.413734] # <<<<<<<<<<<<<<
  16912. * _plasma_data[10][:] = [0.901807, 0.425087, 0.359688]
  16913. * _plasma_data[11][:] = [0.942598, 0.502639, 0.305816]
  16914. */
  16915. __pyx_t_43[0] = 0.853319;
  16916. __pyx_t_43[1] = 0.351553;
  16917. __pyx_t_43[2] = 0.413734;
  16918. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[9])[0]), __pyx_t_43, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[9])[0]) * (3));
  16919. /* "app/colormap/colormap.pyx":65
  16920. * _plasma_data[8][:] = [0.798216, 0.280197, 0.469538]
  16921. * _plasma_data[9][:] = [0.853319, 0.351553, 0.413734]
  16922. * _plasma_data[10][:] = [0.901807, 0.425087, 0.359688] # <<<<<<<<<<<<<<
  16923. * _plasma_data[11][:] = [0.942598, 0.502639, 0.305816]
  16924. * _plasma_data[12][:] = [0.973416, 0.585761, 0.251540]
  16925. */
  16926. __pyx_t_44[0] = 0.901807;
  16927. __pyx_t_44[1] = 0.425087;
  16928. __pyx_t_44[2] = 0.359688;
  16929. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[10])[0]), __pyx_t_44, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[10])[0]) * (3));
  16930. /* "app/colormap/colormap.pyx":66
  16931. * _plasma_data[9][:] = [0.853319, 0.351553, 0.413734]
  16932. * _plasma_data[10][:] = [0.901807, 0.425087, 0.359688]
  16933. * _plasma_data[11][:] = [0.942598, 0.502639, 0.305816] # <<<<<<<<<<<<<<
  16934. * _plasma_data[12][:] = [0.973416, 0.585761, 0.251540]
  16935. * _plasma_data[13][:] = [0.991365, 0.675355, 0.198453]
  16936. */
  16937. __pyx_t_45[0] = 0.942598;
  16938. __pyx_t_45[1] = 0.502639;
  16939. __pyx_t_45[2] = 0.305816;
  16940. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[11])[0]), __pyx_t_45, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[11])[0]) * (3));
  16941. /* "app/colormap/colormap.pyx":67
  16942. * _plasma_data[10][:] = [0.901807, 0.425087, 0.359688]
  16943. * _plasma_data[11][:] = [0.942598, 0.502639, 0.305816]
  16944. * _plasma_data[12][:] = [0.973416, 0.585761, 0.251540] # <<<<<<<<<<<<<<
  16945. * _plasma_data[13][:] = [0.991365, 0.675355, 0.198453]
  16946. * _plasma_data[14][:] = [0.993033, 0.771720, 0.154808]
  16947. */
  16948. __pyx_t_46[0] = 0.973416;
  16949. __pyx_t_46[1] = 0.585761;
  16950. __pyx_t_46[2] = 0.251540;
  16951. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[12])[0]), __pyx_t_46, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[12])[0]) * (3));
  16952. /* "app/colormap/colormap.pyx":68
  16953. * _plasma_data[11][:] = [0.942598, 0.502639, 0.305816]
  16954. * _plasma_data[12][:] = [0.973416, 0.585761, 0.251540]
  16955. * _plasma_data[13][:] = [0.991365, 0.675355, 0.198453] # <<<<<<<<<<<<<<
  16956. * _plasma_data[14][:] = [0.993033, 0.771720, 0.154808]
  16957. * _plasma_data[15][:] = [0.974443, 0.874622, 0.144061]
  16958. */
  16959. __pyx_t_47[0] = 0.991365;
  16960. __pyx_t_47[1] = 0.675355;
  16961. __pyx_t_47[2] = 0.198453;
  16962. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[13])[0]), __pyx_t_47, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[13])[0]) * (3));
  16963. /* "app/colormap/colormap.pyx":69
  16964. * _plasma_data[12][:] = [0.973416, 0.585761, 0.251540]
  16965. * _plasma_data[13][:] = [0.991365, 0.675355, 0.198453]
  16966. * _plasma_data[14][:] = [0.993033, 0.771720, 0.154808] # <<<<<<<<<<<<<<
  16967. * _plasma_data[15][:] = [0.974443, 0.874622, 0.144061]
  16968. *
  16969. */
  16970. __pyx_t_48[0] = 0.993033;
  16971. __pyx_t_48[1] = 0.771720;
  16972. __pyx_t_48[2] = 0.154808;
  16973. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[14])[0]), __pyx_t_48, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[14])[0]) * (3));
  16974. /* "app/colormap/colormap.pyx":70
  16975. * _plasma_data[13][:] = [0.991365, 0.675355, 0.198453]
  16976. * _plasma_data[14][:] = [0.993033, 0.771720, 0.154808]
  16977. * _plasma_data[15][:] = [0.974443, 0.874622, 0.144061] # <<<<<<<<<<<<<<
  16978. *
  16979. * cdef float _viridis_data[16][3]
  16980. */
  16981. __pyx_t_49[0] = 0.974443;
  16982. __pyx_t_49[1] = 0.874622;
  16983. __pyx_t_49[2] = 0.144061;
  16984. memcpy(&((__pyx_v_3app_8colormap_8colormap__plasma_data[15])[0]), __pyx_t_49, sizeof((__pyx_v_3app_8colormap_8colormap__plasma_data[15])[0]) * (3));
  16985. /* "app/colormap/colormap.pyx":73
  16986. *
  16987. * cdef float _viridis_data[16][3]
  16988. * _viridis_data[0][:] = [0.267004, 0.004874, 0.329415] # <<<<<<<<<<<<<<
  16989. * _viridis_data[1][:] = [0.282327, 0.094955, 0.417331]
  16990. * _viridis_data[2][:] = [0.278826, 0.175490, 0.483397]
  16991. */
  16992. __pyx_t_50[0] = 0.267004;
  16993. __pyx_t_50[1] = 0.004874;
  16994. __pyx_t_50[2] = 0.329415;
  16995. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[0])[0]), __pyx_t_50, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[0])[0]) * (3));
  16996. /* "app/colormap/colormap.pyx":74
  16997. * cdef float _viridis_data[16][3]
  16998. * _viridis_data[0][:] = [0.267004, 0.004874, 0.329415]
  16999. * _viridis_data[1][:] = [0.282327, 0.094955, 0.417331] # <<<<<<<<<<<<<<
  17000. * _viridis_data[2][:] = [0.278826, 0.175490, 0.483397]
  17001. * _viridis_data[3][:] = [0.258965, 0.251537, 0.524736]
  17002. */
  17003. __pyx_t_51[0] = 0.282327;
  17004. __pyx_t_51[1] = 0.094955;
  17005. __pyx_t_51[2] = 0.417331;
  17006. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[1])[0]), __pyx_t_51, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[1])[0]) * (3));
  17007. /* "app/colormap/colormap.pyx":75
  17008. * _viridis_data[0][:] = [0.267004, 0.004874, 0.329415]
  17009. * _viridis_data[1][:] = [0.282327, 0.094955, 0.417331]
  17010. * _viridis_data[2][:] = [0.278826, 0.175490, 0.483397] # <<<<<<<<<<<<<<
  17011. * _viridis_data[3][:] = [0.258965, 0.251537, 0.524736]
  17012. * _viridis_data[4][:] = [0.229739, 0.322361, 0.545706]
  17013. */
  17014. __pyx_t_52[0] = 0.278826;
  17015. __pyx_t_52[1] = 0.175490;
  17016. __pyx_t_52[2] = 0.483397;
  17017. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[2])[0]), __pyx_t_52, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[2])[0]) * (3));
  17018. /* "app/colormap/colormap.pyx":76
  17019. * _viridis_data[1][:] = [0.282327, 0.094955, 0.417331]
  17020. * _viridis_data[2][:] = [0.278826, 0.175490, 0.483397]
  17021. * _viridis_data[3][:] = [0.258965, 0.251537, 0.524736] # <<<<<<<<<<<<<<
  17022. * _viridis_data[4][:] = [0.229739, 0.322361, 0.545706]
  17023. * _viridis_data[5][:] = [0.199430, 0.387607, 0.554642]
  17024. */
  17025. __pyx_t_53[0] = 0.258965;
  17026. __pyx_t_53[1] = 0.251537;
  17027. __pyx_t_53[2] = 0.524736;
  17028. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[3])[0]), __pyx_t_53, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[3])[0]) * (3));
  17029. /* "app/colormap/colormap.pyx":77
  17030. * _viridis_data[2][:] = [0.278826, 0.175490, 0.483397]
  17031. * _viridis_data[3][:] = [0.258965, 0.251537, 0.524736]
  17032. * _viridis_data[4][:] = [0.229739, 0.322361, 0.545706] # <<<<<<<<<<<<<<
  17033. * _viridis_data[5][:] = [0.199430, 0.387607, 0.554642]
  17034. * _viridis_data[6][:] = [0.172719, 0.448791, 0.557885]
  17035. */
  17036. __pyx_t_54[0] = 0.229739;
  17037. __pyx_t_54[1] = 0.322361;
  17038. __pyx_t_54[2] = 0.545706;
  17039. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[4])[0]), __pyx_t_54, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[4])[0]) * (3));
  17040. /* "app/colormap/colormap.pyx":78
  17041. * _viridis_data[3][:] = [0.258965, 0.251537, 0.524736]
  17042. * _viridis_data[4][:] = [0.229739, 0.322361, 0.545706]
  17043. * _viridis_data[5][:] = [0.199430, 0.387607, 0.554642] # <<<<<<<<<<<<<<
  17044. * _viridis_data[6][:] = [0.172719, 0.448791, 0.557885]
  17045. * _viridis_data[7][:] = [0.149039, 0.508051, 0.557250]
  17046. */
  17047. __pyx_t_55[0] = 0.199430;
  17048. __pyx_t_55[1] = 0.387607;
  17049. __pyx_t_55[2] = 0.554642;
  17050. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[5])[0]), __pyx_t_55, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[5])[0]) * (3));
  17051. /* "app/colormap/colormap.pyx":79
  17052. * _viridis_data[4][:] = [0.229739, 0.322361, 0.545706]
  17053. * _viridis_data[5][:] = [0.199430, 0.387607, 0.554642]
  17054. * _viridis_data[6][:] = [0.172719, 0.448791, 0.557885] # <<<<<<<<<<<<<<
  17055. * _viridis_data[7][:] = [0.149039, 0.508051, 0.557250]
  17056. * _viridis_data[8][:] = [0.127568, 0.566949, 0.550556]
  17057. */
  17058. __pyx_t_56[0] = 0.172719;
  17059. __pyx_t_56[1] = 0.448791;
  17060. __pyx_t_56[2] = 0.557885;
  17061. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[6])[0]), __pyx_t_56, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[6])[0]) * (3));
  17062. /* "app/colormap/colormap.pyx":80
  17063. * _viridis_data[5][:] = [0.199430, 0.387607, 0.554642]
  17064. * _viridis_data[6][:] = [0.172719, 0.448791, 0.557885]
  17065. * _viridis_data[7][:] = [0.149039, 0.508051, 0.557250] # <<<<<<<<<<<<<<
  17066. * _viridis_data[8][:] = [0.127568, 0.566949, 0.550556]
  17067. * _viridis_data[9][:] = [0.120638, 0.625828, 0.533488]
  17068. */
  17069. __pyx_t_57[0] = 0.149039;
  17070. __pyx_t_57[1] = 0.508051;
  17071. __pyx_t_57[2] = 0.557250;
  17072. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[7])[0]), __pyx_t_57, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[7])[0]) * (3));
  17073. /* "app/colormap/colormap.pyx":81
  17074. * _viridis_data[6][:] = [0.172719, 0.448791, 0.557885]
  17075. * _viridis_data[7][:] = [0.149039, 0.508051, 0.557250]
  17076. * _viridis_data[8][:] = [0.127568, 0.566949, 0.550556] # <<<<<<<<<<<<<<
  17077. * _viridis_data[9][:] = [0.120638, 0.625828, 0.533488]
  17078. * _viridis_data[10][:] = [0.157851, 0.683765, 0.501686]
  17079. */
  17080. __pyx_t_58[0] = 0.127568;
  17081. __pyx_t_58[1] = 0.566949;
  17082. __pyx_t_58[2] = 0.550556;
  17083. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[8])[0]), __pyx_t_58, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[8])[0]) * (3));
  17084. /* "app/colormap/colormap.pyx":82
  17085. * _viridis_data[7][:] = [0.149039, 0.508051, 0.557250]
  17086. * _viridis_data[8][:] = [0.127568, 0.566949, 0.550556]
  17087. * _viridis_data[9][:] = [0.120638, 0.625828, 0.533488] # <<<<<<<<<<<<<<
  17088. * _viridis_data[10][:] = [0.157851, 0.683765, 0.501686]
  17089. * _viridis_data[11][:] = [0.246070, 0.738910, 0.452024]
  17090. */
  17091. __pyx_t_59[0] = 0.120638;
  17092. __pyx_t_59[1] = 0.625828;
  17093. __pyx_t_59[2] = 0.533488;
  17094. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[9])[0]), __pyx_t_59, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[9])[0]) * (3));
  17095. /* "app/colormap/colormap.pyx":83
  17096. * _viridis_data[8][:] = [0.127568, 0.566949, 0.550556]
  17097. * _viridis_data[9][:] = [0.120638, 0.625828, 0.533488]
  17098. * _viridis_data[10][:] = [0.157851, 0.683765, 0.501686] # <<<<<<<<<<<<<<
  17099. * _viridis_data[11][:] = [0.246070, 0.738910, 0.452024]
  17100. * _viridis_data[12][:] = [0.369214, 0.788888, 0.382914]
  17101. */
  17102. __pyx_t_60[0] = 0.157851;
  17103. __pyx_t_60[1] = 0.683765;
  17104. __pyx_t_60[2] = 0.501686;
  17105. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[10])[0]), __pyx_t_60, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[10])[0]) * (3));
  17106. /* "app/colormap/colormap.pyx":84
  17107. * _viridis_data[9][:] = [0.120638, 0.625828, 0.533488]
  17108. * _viridis_data[10][:] = [0.157851, 0.683765, 0.501686]
  17109. * _viridis_data[11][:] = [0.246070, 0.738910, 0.452024] # <<<<<<<<<<<<<<
  17110. * _viridis_data[12][:] = [0.369214, 0.788888, 0.382914]
  17111. * _viridis_data[13][:] = [0.515992, 0.831158, 0.294279]
  17112. */
  17113. __pyx_t_61[0] = 0.246070;
  17114. __pyx_t_61[1] = 0.738910;
  17115. __pyx_t_61[2] = 0.452024;
  17116. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[11])[0]), __pyx_t_61, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[11])[0]) * (3));
  17117. /* "app/colormap/colormap.pyx":85
  17118. * _viridis_data[10][:] = [0.157851, 0.683765, 0.501686]
  17119. * _viridis_data[11][:] = [0.246070, 0.738910, 0.452024]
  17120. * _viridis_data[12][:] = [0.369214, 0.788888, 0.382914] # <<<<<<<<<<<<<<
  17121. * _viridis_data[13][:] = [0.515992, 0.831158, 0.294279]
  17122. * _viridis_data[14][:] = [0.678489, 0.863742, 0.189503]
  17123. */
  17124. __pyx_t_62[0] = 0.369214;
  17125. __pyx_t_62[1] = 0.788888;
  17126. __pyx_t_62[2] = 0.382914;
  17127. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[12])[0]), __pyx_t_62, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[12])[0]) * (3));
  17128. /* "app/colormap/colormap.pyx":86
  17129. * _viridis_data[11][:] = [0.246070, 0.738910, 0.452024]
  17130. * _viridis_data[12][:] = [0.369214, 0.788888, 0.382914]
  17131. * _viridis_data[13][:] = [0.515992, 0.831158, 0.294279] # <<<<<<<<<<<<<<
  17132. * _viridis_data[14][:] = [0.678489, 0.863742, 0.189503]
  17133. * _viridis_data[15][:] = [0.845561, 0.887322, 0.099702]
  17134. */
  17135. __pyx_t_63[0] = 0.515992;
  17136. __pyx_t_63[1] = 0.831158;
  17137. __pyx_t_63[2] = 0.294279;
  17138. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[13])[0]), __pyx_t_63, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[13])[0]) * (3));
  17139. /* "app/colormap/colormap.pyx":87
  17140. * _viridis_data[12][:] = [0.369214, 0.788888, 0.382914]
  17141. * _viridis_data[13][:] = [0.515992, 0.831158, 0.294279]
  17142. * _viridis_data[14][:] = [0.678489, 0.863742, 0.189503] # <<<<<<<<<<<<<<
  17143. * _viridis_data[15][:] = [0.845561, 0.887322, 0.099702]
  17144. *
  17145. */
  17146. __pyx_t_64[0] = 0.678489;
  17147. __pyx_t_64[1] = 0.863742;
  17148. __pyx_t_64[2] = 0.189503;
  17149. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[14])[0]), __pyx_t_64, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[14])[0]) * (3));
  17150. /* "app/colormap/colormap.pyx":88
  17151. * _viridis_data[13][:] = [0.515992, 0.831158, 0.294279]
  17152. * _viridis_data[14][:] = [0.678489, 0.863742, 0.189503]
  17153. * _viridis_data[15][:] = [0.845561, 0.887322, 0.099702] # <<<<<<<<<<<<<<
  17154. *
  17155. * import numpy as np
  17156. */
  17157. __pyx_t_65[0] = 0.845561;
  17158. __pyx_t_65[1] = 0.887322;
  17159. __pyx_t_65[2] = 0.099702;
  17160. memcpy(&((__pyx_v_3app_8colormap_8colormap__viridis_data[15])[0]), __pyx_t_65, sizeof((__pyx_v_3app_8colormap_8colormap__viridis_data[15])[0]) * (3));
  17161. /* "app/colormap/colormap.pyx":90
  17162. * _viridis_data[15][:] = [0.845561, 0.887322, 0.099702]
  17163. *
  17164. * import numpy as np # <<<<<<<<<<<<<<
  17165. * cimport cython
  17166. *
  17167. */
  17168. __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
  17169. __Pyx_GOTREF(__pyx_t_1);
  17170. if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
  17171. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17172. /* "app/colormap/colormap.pyx":93
  17173. * cimport cython
  17174. *
  17175. * cmaps = {} # <<<<<<<<<<<<<<
  17176. * for (name, data) in (
  17177. * ('magma', _magma_data),
  17178. */
  17179. __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
  17180. __Pyx_GOTREF(__pyx_t_1);
  17181. if (PyDict_SetItem(__pyx_d, __pyx_n_s_cmaps, __pyx_t_1) < 0) __PYX_ERR(0, 93, __pyx_L1_error)
  17182. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17183. /* "app/colormap/colormap.pyx":95
  17184. * cmaps = {}
  17185. * for (name, data) in (
  17186. * ('magma', _magma_data), # <<<<<<<<<<<<<<
  17187. * ('inferno', _inferno_data),
  17188. * ('plasma', _plasma_data),
  17189. */
  17190. __pyx_t_1 = __Pyx_carray_to_py_float___5b_3_5d_(__pyx_v_3app_8colormap_8colormap__magma_data, 16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  17191. __Pyx_GOTREF(__pyx_t_1);
  17192. __pyx_t_66 = PyTuple_New(2); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 95, __pyx_L1_error)
  17193. __Pyx_GOTREF(__pyx_t_66);
  17194. __Pyx_INCREF(__pyx_n_u_magma);
  17195. __Pyx_GIVEREF(__pyx_n_u_magma);
  17196. PyTuple_SET_ITEM(__pyx_t_66, 0, __pyx_n_u_magma);
  17197. __Pyx_GIVEREF(__pyx_t_1);
  17198. PyTuple_SET_ITEM(__pyx_t_66, 1, __pyx_t_1);
  17199. __pyx_t_1 = 0;
  17200. /* "app/colormap/colormap.pyx":96
  17201. * for (name, data) in (
  17202. * ('magma', _magma_data),
  17203. * ('inferno', _inferno_data), # <<<<<<<<<<<<<<
  17204. * ('plasma', _plasma_data),
  17205. * ('viridis', _viridis_data)
  17206. */
  17207. __pyx_t_1 = __Pyx_carray_to_py_float___5b_3_5d_(__pyx_v_3app_8colormap_8colormap__inferno_data, 16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
  17208. __Pyx_GOTREF(__pyx_t_1);
  17209. __pyx_t_67 = PyTuple_New(2); if (unlikely(!__pyx_t_67)) __PYX_ERR(0, 96, __pyx_L1_error)
  17210. __Pyx_GOTREF(__pyx_t_67);
  17211. __Pyx_INCREF(__pyx_n_u_inferno);
  17212. __Pyx_GIVEREF(__pyx_n_u_inferno);
  17213. PyTuple_SET_ITEM(__pyx_t_67, 0, __pyx_n_u_inferno);
  17214. __Pyx_GIVEREF(__pyx_t_1);
  17215. PyTuple_SET_ITEM(__pyx_t_67, 1, __pyx_t_1);
  17216. __pyx_t_1 = 0;
  17217. /* "app/colormap/colormap.pyx":97
  17218. * ('magma', _magma_data),
  17219. * ('inferno', _inferno_data),
  17220. * ('plasma', _plasma_data), # <<<<<<<<<<<<<<
  17221. * ('viridis', _viridis_data)
  17222. * ):
  17223. */
  17224. __pyx_t_1 = __Pyx_carray_to_py_float___5b_3_5d_(__pyx_v_3app_8colormap_8colormap__plasma_data, 16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  17225. __Pyx_GOTREF(__pyx_t_1);
  17226. __pyx_t_68 = PyTuple_New(2); if (unlikely(!__pyx_t_68)) __PYX_ERR(0, 97, __pyx_L1_error)
  17227. __Pyx_GOTREF(__pyx_t_68);
  17228. __Pyx_INCREF(__pyx_n_u_plasma);
  17229. __Pyx_GIVEREF(__pyx_n_u_plasma);
  17230. PyTuple_SET_ITEM(__pyx_t_68, 0, __pyx_n_u_plasma);
  17231. __Pyx_GIVEREF(__pyx_t_1);
  17232. PyTuple_SET_ITEM(__pyx_t_68, 1, __pyx_t_1);
  17233. __pyx_t_1 = 0;
  17234. /* "app/colormap/colormap.pyx":98
  17235. * ('inferno', _inferno_data),
  17236. * ('plasma', _plasma_data),
  17237. * ('viridis', _viridis_data) # <<<<<<<<<<<<<<
  17238. * ):
  17239. *
  17240. */
  17241. __pyx_t_1 = __Pyx_carray_to_py_float___5b_3_5d_(__pyx_v_3app_8colormap_8colormap__viridis_data, 16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  17242. __Pyx_GOTREF(__pyx_t_1);
  17243. __pyx_t_69 = PyTuple_New(2); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 98, __pyx_L1_error)
  17244. __Pyx_GOTREF(__pyx_t_69);
  17245. __Pyx_INCREF(__pyx_n_u_viridis);
  17246. __Pyx_GIVEREF(__pyx_n_u_viridis);
  17247. PyTuple_SET_ITEM(__pyx_t_69, 0, __pyx_n_u_viridis);
  17248. __Pyx_GIVEREF(__pyx_t_1);
  17249. PyTuple_SET_ITEM(__pyx_t_69, 1, __pyx_t_1);
  17250. __pyx_t_1 = 0;
  17251. /* "app/colormap/colormap.pyx":95
  17252. * cmaps = {}
  17253. * for (name, data) in (
  17254. * ('magma', _magma_data), # <<<<<<<<<<<<<<
  17255. * ('inferno', _inferno_data),
  17256. * ('plasma', _plasma_data),
  17257. */
  17258. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  17259. __Pyx_GOTREF(__pyx_t_1);
  17260. __Pyx_GIVEREF(__pyx_t_66);
  17261. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_66);
  17262. __Pyx_GIVEREF(__pyx_t_67);
  17263. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_67);
  17264. __Pyx_GIVEREF(__pyx_t_68);
  17265. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_68);
  17266. __Pyx_GIVEREF(__pyx_t_69);
  17267. PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_69);
  17268. __pyx_t_66 = 0;
  17269. __pyx_t_67 = 0;
  17270. __pyx_t_68 = 0;
  17271. __pyx_t_69 = 0;
  17272. /* "app/colormap/colormap.pyx":94
  17273. *
  17274. * cmaps = {}
  17275. * for (name, data) in ( # <<<<<<<<<<<<<<
  17276. * ('magma', _magma_data),
  17277. * ('inferno', _inferno_data),
  17278. */
  17279. __pyx_t_69 = __pyx_t_1; __Pyx_INCREF(__pyx_t_69); __pyx_t_70 = 0;
  17280. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17281. for (;;) {
  17282. if (__pyx_t_70 >= 4) break;
  17283. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  17284. __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_69, __pyx_t_70); __Pyx_INCREF(__pyx_t_1); __pyx_t_70++; if (unlikely(0 < 0)) __PYX_ERR(0, 94, __pyx_L1_error)
  17285. #else
  17286. __pyx_t_1 = PySequence_ITEM(__pyx_t_69, __pyx_t_70); __pyx_t_70++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
  17287. __Pyx_GOTREF(__pyx_t_1);
  17288. #endif
  17289. if (likely(__pyx_t_1 != Py_None)) {
  17290. PyObject* sequence = __pyx_t_1;
  17291. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  17292. if (unlikely(size != 2)) {
  17293. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  17294. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  17295. __PYX_ERR(0, 94, __pyx_L1_error)
  17296. }
  17297. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  17298. __pyx_t_68 = PyTuple_GET_ITEM(sequence, 0);
  17299. __pyx_t_67 = PyTuple_GET_ITEM(sequence, 1);
  17300. __Pyx_INCREF(__pyx_t_68);
  17301. __Pyx_INCREF(__pyx_t_67);
  17302. #else
  17303. __pyx_t_68 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_68)) __PYX_ERR(0, 94, __pyx_L1_error)
  17304. __Pyx_GOTREF(__pyx_t_68);
  17305. __pyx_t_67 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_67)) __PYX_ERR(0, 94, __pyx_L1_error)
  17306. __Pyx_GOTREF(__pyx_t_67);
  17307. #endif
  17308. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17309. } else {
  17310. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 94, __pyx_L1_error)
  17311. }
  17312. if (PyDict_SetItem(__pyx_d, __pyx_n_s_name, __pyx_t_68) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  17313. __Pyx_DECREF(__pyx_t_68); __pyx_t_68 = 0;
  17314. if (PyDict_SetItem(__pyx_d, __pyx_n_s_data, __pyx_t_67) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
  17315. __Pyx_DECREF(__pyx_t_67); __pyx_t_67 = 0;
  17316. /* "app/colormap/colormap.pyx":101
  17317. * ):
  17318. *
  17319. * cmaps[name] = np.array(data, dtype=np.float32)*255 # <<<<<<<<<<<<<<
  17320. *
  17321. * magma = cmaps['magma']
  17322. */
  17323. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
  17324. __Pyx_GOTREF(__pyx_t_1);
  17325. __pyx_t_67 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_67)) __PYX_ERR(0, 101, __pyx_L1_error)
  17326. __Pyx_GOTREF(__pyx_t_67);
  17327. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17328. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
  17329. __Pyx_GOTREF(__pyx_t_1);
  17330. __pyx_t_68 = PyTuple_New(1); if (unlikely(!__pyx_t_68)) __PYX_ERR(0, 101, __pyx_L1_error)
  17331. __Pyx_GOTREF(__pyx_t_68);
  17332. __Pyx_GIVEREF(__pyx_t_1);
  17333. PyTuple_SET_ITEM(__pyx_t_68, 0, __pyx_t_1);
  17334. __pyx_t_1 = 0;
  17335. __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
  17336. __Pyx_GOTREF(__pyx_t_1);
  17337. __Pyx_GetModuleGlobalName(__pyx_t_66, __pyx_n_s_np); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 101, __pyx_L1_error)
  17338. __Pyx_GOTREF(__pyx_t_66);
  17339. __pyx_t_71 = __Pyx_PyObject_GetAttrStr(__pyx_t_66, __pyx_n_s_float32); if (unlikely(!__pyx_t_71)) __PYX_ERR(0, 101, __pyx_L1_error)
  17340. __Pyx_GOTREF(__pyx_t_71);
  17341. __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
  17342. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_71) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
  17343. __Pyx_DECREF(__pyx_t_71); __pyx_t_71 = 0;
  17344. __pyx_t_71 = __Pyx_PyObject_Call(__pyx_t_67, __pyx_t_68, __pyx_t_1); if (unlikely(!__pyx_t_71)) __PYX_ERR(0, 101, __pyx_L1_error)
  17345. __Pyx_GOTREF(__pyx_t_71);
  17346. __Pyx_DECREF(__pyx_t_67); __pyx_t_67 = 0;
  17347. __Pyx_DECREF(__pyx_t_68); __pyx_t_68 = 0;
  17348. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17349. __pyx_t_1 = PyNumber_Multiply(__pyx_t_71, __pyx_int_255); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
  17350. __Pyx_GOTREF(__pyx_t_1);
  17351. __Pyx_DECREF(__pyx_t_71); __pyx_t_71 = 0;
  17352. __Pyx_GetModuleGlobalName(__pyx_t_71, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_71)) __PYX_ERR(0, 101, __pyx_L1_error)
  17353. __Pyx_GOTREF(__pyx_t_71);
  17354. __Pyx_GetModuleGlobalName(__pyx_t_68, __pyx_n_s_name); if (unlikely(!__pyx_t_68)) __PYX_ERR(0, 101, __pyx_L1_error)
  17355. __Pyx_GOTREF(__pyx_t_68);
  17356. if (unlikely(PyObject_SetItem(__pyx_t_71, __pyx_t_68, __pyx_t_1) < 0)) __PYX_ERR(0, 101, __pyx_L1_error)
  17357. __Pyx_DECREF(__pyx_t_71); __pyx_t_71 = 0;
  17358. __Pyx_DECREF(__pyx_t_68); __pyx_t_68 = 0;
  17359. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17360. /* "app/colormap/colormap.pyx":94
  17361. *
  17362. * cmaps = {}
  17363. * for (name, data) in ( # <<<<<<<<<<<<<<
  17364. * ('magma', _magma_data),
  17365. * ('inferno', _inferno_data),
  17366. */
  17367. }
  17368. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17369. /* "app/colormap/colormap.pyx":103
  17370. * cmaps[name] = np.array(data, dtype=np.float32)*255
  17371. *
  17372. * magma = cmaps['magma'] # <<<<<<<<<<<<<<
  17373. * inferno = cmaps['inferno']
  17374. * plasma = cmaps['plasma']
  17375. */
  17376. __Pyx_GetModuleGlobalName(__pyx_t_69, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 103, __pyx_L1_error)
  17377. __Pyx_GOTREF(__pyx_t_69);
  17378. __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_69, __pyx_n_u_magma); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
  17379. __Pyx_GOTREF(__pyx_t_1);
  17380. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17381. if (PyDict_SetItem(__pyx_d, __pyx_n_s_magma, __pyx_t_1) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  17382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17383. /* "app/colormap/colormap.pyx":104
  17384. *
  17385. * magma = cmaps['magma']
  17386. * inferno = cmaps['inferno'] # <<<<<<<<<<<<<<
  17387. * plasma = cmaps['plasma']
  17388. * viridis = cmaps['viridis']
  17389. */
  17390. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
  17391. __Pyx_GOTREF(__pyx_t_1);
  17392. __pyx_t_69 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_inferno); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 104, __pyx_L1_error)
  17393. __Pyx_GOTREF(__pyx_t_69);
  17394. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17395. if (PyDict_SetItem(__pyx_d, __pyx_n_s_inferno, __pyx_t_69) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  17396. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17397. /* "app/colormap/colormap.pyx":105
  17398. * magma = cmaps['magma']
  17399. * inferno = cmaps['inferno']
  17400. * plasma = cmaps['plasma'] # <<<<<<<<<<<<<<
  17401. * viridis = cmaps['viridis']
  17402. *
  17403. */
  17404. __Pyx_GetModuleGlobalName(__pyx_t_69, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 105, __pyx_L1_error)
  17405. __Pyx_GOTREF(__pyx_t_69);
  17406. __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_69, __pyx_n_u_plasma); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
  17407. __Pyx_GOTREF(__pyx_t_1);
  17408. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17409. if (PyDict_SetItem(__pyx_d, __pyx_n_s_plasma, __pyx_t_1) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
  17410. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17411. /* "app/colormap/colormap.pyx":106
  17412. * inferno = cmaps['inferno']
  17413. * plasma = cmaps['plasma']
  17414. * viridis = cmaps['viridis'] # <<<<<<<<<<<<<<
  17415. *
  17416. *
  17417. */
  17418. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_cmaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error)
  17419. __Pyx_GOTREF(__pyx_t_1);
  17420. __pyx_t_69 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_viridis); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 106, __pyx_L1_error)
  17421. __Pyx_GOTREF(__pyx_t_69);
  17422. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17423. if (PyDict_SetItem(__pyx_d, __pyx_n_s_viridis, __pyx_t_69) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  17424. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17425. /* "app/colormap/colormap.pyx":121
  17426. *
  17427. *
  17428. * def apply_colormap(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  17429. *
  17430. * if max_ is None:
  17431. */
  17432. __pyx_t_69 = PyCFunction_NewEx(&__pyx_mdef_3app_8colormap_8colormap_1apply_colormap, NULL, __pyx_n_s_app_colormap_colormap); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 121, __pyx_L1_error)
  17433. __Pyx_GOTREF(__pyx_t_69);
  17434. if (PyDict_SetItem(__pyx_d, __pyx_n_s_apply_colormap, __pyx_t_69) < 0) __PYX_ERR(0, 121, __pyx_L1_error)
  17435. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17436. /* "app/colormap/colormap.pyx":138
  17437. * return colors
  17438. *
  17439. * def apply_colormap_single(input_: np.ndarray, colormap: str, min_: float=None, max_: float=None): # <<<<<<<<<<<<<<
  17440. * range_ = max_ - min_
  17441. * if range_ == 0:
  17442. */
  17443. __pyx_t_69 = PyCFunction_NewEx(&__pyx_mdef_3app_8colormap_8colormap_3apply_colormap_single, NULL, __pyx_n_s_app_colormap_colormap); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 138, __pyx_L1_error)
  17444. __Pyx_GOTREF(__pyx_t_69);
  17445. if (PyDict_SetItem(__pyx_d, __pyx_n_s_apply_colormap_single, __pyx_t_69) < 0) __PYX_ERR(0, 138, __pyx_L1_error)
  17446. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17447. /* "app/colormap/colormap.pyx":1
  17448. * # New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, # <<<<<<<<<<<<<<
  17449. * # and (in the case of viridis) Eric Firing.
  17450. * #
  17451. */
  17452. __pyx_t_69 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_69)) __PYX_ERR(0, 1, __pyx_L1_error)
  17453. __Pyx_GOTREF(__pyx_t_69);
  17454. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_69) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  17455. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17456. /* "View.MemoryView":209
  17457. * info.obj = self
  17458. *
  17459. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  17460. *
  17461. * def __dealloc__(array self):
  17462. */
  17463. __pyx_t_69 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 209, __pyx_L1_error)
  17464. __Pyx_GOTREF(__pyx_t_69);
  17465. if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_69) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
  17466. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17467. PyType_Modified(__pyx_array_type);
  17468. /* "View.MemoryView":286
  17469. * return self.name
  17470. *
  17471. * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
  17472. * cdef strided = Enum("<strided and direct>") # default
  17473. * cdef indirect = Enum("<strided and indirect>")
  17474. */
  17475. __pyx_t_69 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 286, __pyx_L1_error)
  17476. __Pyx_GOTREF(__pyx_t_69);
  17477. __Pyx_XGOTREF(generic);
  17478. __Pyx_DECREF_SET(generic, __pyx_t_69);
  17479. __Pyx_GIVEREF(__pyx_t_69);
  17480. __pyx_t_69 = 0;
  17481. /* "View.MemoryView":287
  17482. *
  17483. * cdef generic = Enum("<strided and direct or indirect>")
  17484. * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
  17485. * cdef indirect = Enum("<strided and indirect>")
  17486. *
  17487. */
  17488. __pyx_t_69 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 287, __pyx_L1_error)
  17489. __Pyx_GOTREF(__pyx_t_69);
  17490. __Pyx_XGOTREF(strided);
  17491. __Pyx_DECREF_SET(strided, __pyx_t_69);
  17492. __Pyx_GIVEREF(__pyx_t_69);
  17493. __pyx_t_69 = 0;
  17494. /* "View.MemoryView":288
  17495. * cdef generic = Enum("<strided and direct or indirect>")
  17496. * cdef strided = Enum("<strided and direct>") # default
  17497. * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
  17498. *
  17499. *
  17500. */
  17501. __pyx_t_69 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 288, __pyx_L1_error)
  17502. __Pyx_GOTREF(__pyx_t_69);
  17503. __Pyx_XGOTREF(indirect);
  17504. __Pyx_DECREF_SET(indirect, __pyx_t_69);
  17505. __Pyx_GIVEREF(__pyx_t_69);
  17506. __pyx_t_69 = 0;
  17507. /* "View.MemoryView":291
  17508. *
  17509. *
  17510. * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
  17511. * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  17512. *
  17513. */
  17514. __pyx_t_69 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 291, __pyx_L1_error)
  17515. __Pyx_GOTREF(__pyx_t_69);
  17516. __Pyx_XGOTREF(contiguous);
  17517. __Pyx_DECREF_SET(contiguous, __pyx_t_69);
  17518. __Pyx_GIVEREF(__pyx_t_69);
  17519. __pyx_t_69 = 0;
  17520. /* "View.MemoryView":292
  17521. *
  17522. * cdef contiguous = Enum("<contiguous and direct>")
  17523. * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
  17524. *
  17525. *
  17526. */
  17527. __pyx_t_69 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 292, __pyx_L1_error)
  17528. __Pyx_GOTREF(__pyx_t_69);
  17529. __Pyx_XGOTREF(indirect_contiguous);
  17530. __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_69);
  17531. __Pyx_GIVEREF(__pyx_t_69);
  17532. __pyx_t_69 = 0;
  17533. /* "View.MemoryView":316
  17534. *
  17535. * DEF THREAD_LOCKS_PREALLOCATED = 8
  17536. * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
  17537. * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
  17538. * PyThread_allocate_lock(),
  17539. */
  17540. __pyx_memoryview_thread_locks_used = 0;
  17541. /* "View.MemoryView":317
  17542. * DEF THREAD_LOCKS_PREALLOCATED = 8
  17543. * cdef int __pyx_memoryview_thread_locks_used = 0
  17544. * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
  17545. * PyThread_allocate_lock(),
  17546. * PyThread_allocate_lock(),
  17547. */
  17548. __pyx_t_72[0] = PyThread_allocate_lock();
  17549. __pyx_t_72[1] = PyThread_allocate_lock();
  17550. __pyx_t_72[2] = PyThread_allocate_lock();
  17551. __pyx_t_72[3] = PyThread_allocate_lock();
  17552. __pyx_t_72[4] = PyThread_allocate_lock();
  17553. __pyx_t_72[5] = PyThread_allocate_lock();
  17554. __pyx_t_72[6] = PyThread_allocate_lock();
  17555. __pyx_t_72[7] = PyThread_allocate_lock();
  17556. memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_72, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
  17557. /* "View.MemoryView":549
  17558. * info.obj = self
  17559. *
  17560. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  17561. *
  17562. *
  17563. */
  17564. __pyx_t_69 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 549, __pyx_L1_error)
  17565. __Pyx_GOTREF(__pyx_t_69);
  17566. if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_69) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
  17567. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17568. PyType_Modified(__pyx_memoryview_type);
  17569. /* "View.MemoryView":995
  17570. * return self.from_object
  17571. *
  17572. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  17573. *
  17574. *
  17575. */
  17576. __pyx_t_69 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 995, __pyx_L1_error)
  17577. __Pyx_GOTREF(__pyx_t_69);
  17578. if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_69) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
  17579. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17580. PyType_Modified(__pyx_memoryviewslice_type);
  17581. /* "(tree fragment)":1
  17582. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  17583. * cdef object __pyx_PickleError
  17584. * cdef object __pyx_result
  17585. */
  17586. __pyx_t_69 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_69)) __PYX_ERR(1, 1, __pyx_L1_error)
  17587. __Pyx_GOTREF(__pyx_t_69);
  17588. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_69) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
  17589. __Pyx_DECREF(__pyx_t_69); __pyx_t_69 = 0;
  17590. /* "(tree fragment)":11
  17591. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17592. * return __pyx_result
  17593. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  17594. * __pyx_result.name = __pyx_state[0]
  17595. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  17596. */
  17597. /*--- Wrapped vars code ---*/
  17598. goto __pyx_L0;
  17599. __pyx_L1_error:;
  17600. __Pyx_XDECREF(__pyx_t_1);
  17601. __Pyx_XDECREF(__pyx_t_66);
  17602. __Pyx_XDECREF(__pyx_t_67);
  17603. __Pyx_XDECREF(__pyx_t_68);
  17604. __Pyx_XDECREF(__pyx_t_69);
  17605. __Pyx_XDECREF(__pyx_t_71);
  17606. if (__pyx_m) {
  17607. if (__pyx_d) {
  17608. __Pyx_AddTraceback("init app.colormap.colormap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17609. }
  17610. Py_CLEAR(__pyx_m);
  17611. } else if (!PyErr_Occurred()) {
  17612. PyErr_SetString(PyExc_ImportError, "init app.colormap.colormap");
  17613. }
  17614. __pyx_L0:;
  17615. __Pyx_RefNannyFinishContext();
  17616. #if CYTHON_PEP489_MULTI_PHASE_INIT
  17617. return (__pyx_m != NULL) ? 0 : -1;
  17618. #elif PY_MAJOR_VERSION >= 3
  17619. return __pyx_m;
  17620. #else
  17621. return;
  17622. #endif
  17623. }
  17624. /* --- Runtime support code --- */
  17625. /* Refnanny */
  17626. #if CYTHON_REFNANNY
  17627. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  17628. PyObject *m = NULL, *p = NULL;
  17629. void *r = NULL;
  17630. m = PyImport_ImportModule(modname);
  17631. if (!m) goto end;
  17632. p = PyObject_GetAttrString(m, "RefNannyAPI");
  17633. if (!p) goto end;
  17634. r = PyLong_AsVoidPtr(p);
  17635. end:
  17636. Py_XDECREF(p);
  17637. Py_XDECREF(m);
  17638. return (__Pyx_RefNannyAPIStruct *)r;
  17639. }
  17640. #endif
  17641. /* PyObjectGetAttrStr */
  17642. #if CYTHON_USE_TYPE_SLOTS
  17643. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  17644. PyTypeObject* tp = Py_TYPE(obj);
  17645. if (likely(tp->tp_getattro))
  17646. return tp->tp_getattro(obj, attr_name);
  17647. #if PY_MAJOR_VERSION < 3
  17648. if (likely(tp->tp_getattr))
  17649. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  17650. #endif
  17651. return PyObject_GetAttr(obj, attr_name);
  17652. }
  17653. #endif
  17654. /* GetBuiltinName */
  17655. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  17656. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  17657. if (unlikely(!result)) {
  17658. PyErr_Format(PyExc_NameError,
  17659. #if PY_MAJOR_VERSION >= 3
  17660. "name '%U' is not defined", name);
  17661. #else
  17662. "name '%.200s' is not defined", PyString_AS_STRING(name));
  17663. #endif
  17664. }
  17665. return result;
  17666. }
  17667. /* RaiseArgTupleInvalid */
  17668. static void __Pyx_RaiseArgtupleInvalid(
  17669. const char* func_name,
  17670. int exact,
  17671. Py_ssize_t num_min,
  17672. Py_ssize_t num_max,
  17673. Py_ssize_t num_found)
  17674. {
  17675. Py_ssize_t num_expected;
  17676. const char *more_or_less;
  17677. if (num_found < num_min) {
  17678. num_expected = num_min;
  17679. more_or_less = "at least";
  17680. } else {
  17681. num_expected = num_max;
  17682. more_or_less = "at most";
  17683. }
  17684. if (exact) {
  17685. more_or_less = "exactly";
  17686. }
  17687. PyErr_Format(PyExc_TypeError,
  17688. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  17689. func_name, more_or_less, num_expected,
  17690. (num_expected == 1) ? "" : "s", num_found);
  17691. }
  17692. /* RaiseDoubleKeywords */
  17693. static void __Pyx_RaiseDoubleKeywordsError(
  17694. const char* func_name,
  17695. PyObject* kw_name)
  17696. {
  17697. PyErr_Format(PyExc_TypeError,
  17698. #if PY_MAJOR_VERSION >= 3
  17699. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  17700. #else
  17701. "%s() got multiple values for keyword argument '%s'", func_name,
  17702. PyString_AsString(kw_name));
  17703. #endif
  17704. }
  17705. /* ParseKeywords */
  17706. static int __Pyx_ParseOptionalKeywords(
  17707. PyObject *kwds,
  17708. PyObject **argnames[],
  17709. PyObject *kwds2,
  17710. PyObject *values[],
  17711. Py_ssize_t num_pos_args,
  17712. const char* function_name)
  17713. {
  17714. PyObject *key = 0, *value = 0;
  17715. Py_ssize_t pos = 0;
  17716. PyObject*** name;
  17717. PyObject*** first_kw_arg = argnames + num_pos_args;
  17718. while (PyDict_Next(kwds, &pos, &key, &value)) {
  17719. name = first_kw_arg;
  17720. while (*name && (**name != key)) name++;
  17721. if (*name) {
  17722. values[name-argnames] = value;
  17723. continue;
  17724. }
  17725. name = first_kw_arg;
  17726. #if PY_MAJOR_VERSION < 3
  17727. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  17728. while (*name) {
  17729. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  17730. && _PyString_Eq(**name, key)) {
  17731. values[name-argnames] = value;
  17732. break;
  17733. }
  17734. name++;
  17735. }
  17736. if (*name) continue;
  17737. else {
  17738. PyObject*** argname = argnames;
  17739. while (argname != first_kw_arg) {
  17740. if ((**argname == key) || (
  17741. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  17742. && _PyString_Eq(**argname, key))) {
  17743. goto arg_passed_twice;
  17744. }
  17745. argname++;
  17746. }
  17747. }
  17748. } else
  17749. #endif
  17750. if (likely(PyUnicode_Check(key))) {
  17751. while (*name) {
  17752. int cmp = (**name == key) ? 0 :
  17753. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  17754. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  17755. #endif
  17756. PyUnicode_Compare(**name, key);
  17757. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  17758. if (cmp == 0) {
  17759. values[name-argnames] = value;
  17760. break;
  17761. }
  17762. name++;
  17763. }
  17764. if (*name) continue;
  17765. else {
  17766. PyObject*** argname = argnames;
  17767. while (argname != first_kw_arg) {
  17768. int cmp = (**argname == key) ? 0 :
  17769. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  17770. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  17771. #endif
  17772. PyUnicode_Compare(**argname, key);
  17773. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  17774. if (cmp == 0) goto arg_passed_twice;
  17775. argname++;
  17776. }
  17777. }
  17778. } else
  17779. goto invalid_keyword_type;
  17780. if (kwds2) {
  17781. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  17782. } else {
  17783. goto invalid_keyword;
  17784. }
  17785. }
  17786. return 0;
  17787. arg_passed_twice:
  17788. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  17789. goto bad;
  17790. invalid_keyword_type:
  17791. PyErr_Format(PyExc_TypeError,
  17792. "%.200s() keywords must be strings", function_name);
  17793. goto bad;
  17794. invalid_keyword:
  17795. PyErr_Format(PyExc_TypeError,
  17796. #if PY_MAJOR_VERSION < 3
  17797. "%.200s() got an unexpected keyword argument '%.200s'",
  17798. function_name, PyString_AsString(key));
  17799. #else
  17800. "%s() got an unexpected keyword argument '%U'",
  17801. function_name, key);
  17802. #endif
  17803. bad:
  17804. return -1;
  17805. }
  17806. /* ArgTypeTest */
  17807. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  17808. {
  17809. if (unlikely(!type)) {
  17810. PyErr_SetString(PyExc_SystemError, "Missing type object");
  17811. return 0;
  17812. }
  17813. else if (exact) {
  17814. #if PY_MAJOR_VERSION == 2
  17815. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  17816. #endif
  17817. }
  17818. else {
  17819. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  17820. }
  17821. PyErr_Format(PyExc_TypeError,
  17822. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  17823. name, type->tp_name, Py_TYPE(obj)->tp_name);
  17824. return 0;
  17825. }
  17826. /* PyDictVersioning */
  17827. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  17828. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  17829. PyObject *dict = Py_TYPE(obj)->tp_dict;
  17830. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  17831. }
  17832. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  17833. PyObject **dictptr = NULL;
  17834. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  17835. if (offset) {
  17836. #if CYTHON_COMPILING_IN_CPYTHON
  17837. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  17838. #else
  17839. dictptr = _PyObject_GetDictPtr(obj);
  17840. #endif
  17841. }
  17842. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  17843. }
  17844. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  17845. PyObject *dict = Py_TYPE(obj)->tp_dict;
  17846. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  17847. return 0;
  17848. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  17849. }
  17850. #endif
  17851. /* GetModuleGlobalName */
  17852. #if CYTHON_USE_DICT_VERSIONS
  17853. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  17854. #else
  17855. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  17856. #endif
  17857. {
  17858. PyObject *result;
  17859. #if !CYTHON_AVOID_BORROWED_REFS
  17860. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  17861. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  17862. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  17863. if (likely(result)) {
  17864. return __Pyx_NewRef(result);
  17865. } else if (unlikely(PyErr_Occurred())) {
  17866. return NULL;
  17867. }
  17868. #else
  17869. result = PyDict_GetItem(__pyx_d, name);
  17870. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  17871. if (likely(result)) {
  17872. return __Pyx_NewRef(result);
  17873. }
  17874. #endif
  17875. #else
  17876. result = PyObject_GetItem(__pyx_d, name);
  17877. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  17878. if (likely(result)) {
  17879. return __Pyx_NewRef(result);
  17880. }
  17881. PyErr_Clear();
  17882. #endif
  17883. return __Pyx_GetBuiltinName(name);
  17884. }
  17885. /* PyCFunctionFastCall */
  17886. #if CYTHON_FAST_PYCCALL
  17887. static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
  17888. PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
  17889. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  17890. PyObject *self = PyCFunction_GET_SELF(func);
  17891. int flags = PyCFunction_GET_FLAGS(func);
  17892. assert(PyCFunction_Check(func));
  17893. assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
  17894. assert(nargs >= 0);
  17895. assert(nargs == 0 || args != NULL);
  17896. /* _PyCFunction_FastCallDict() must not be called with an exception set,
  17897. because it may clear it (directly or indirectly) and so the
  17898. caller loses its exception */
  17899. assert(!PyErr_Occurred());
  17900. if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
  17901. return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
  17902. } else {
  17903. return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
  17904. }
  17905. }
  17906. #endif
  17907. /* PyFunctionFastCall */
  17908. #if CYTHON_FAST_PYCALL
  17909. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  17910. PyObject *globals) {
  17911. PyFrameObject *f;
  17912. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  17913. PyObject **fastlocals;
  17914. Py_ssize_t i;
  17915. PyObject *result;
  17916. assert(globals != NULL);
  17917. /* XXX Perhaps we should create a specialized
  17918. PyFrame_New() that doesn't take locals, but does
  17919. take builtins without sanity checking them.
  17920. */
  17921. assert(tstate != NULL);
  17922. f = PyFrame_New(tstate, co, globals, NULL);
  17923. if (f == NULL) {
  17924. return NULL;
  17925. }
  17926. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  17927. for (i = 0; i < na; i++) {
  17928. Py_INCREF(*args);
  17929. fastlocals[i] = *args++;
  17930. }
  17931. result = PyEval_EvalFrameEx(f,0);
  17932. ++tstate->recursion_depth;
  17933. Py_DECREF(f);
  17934. --tstate->recursion_depth;
  17935. return result;
  17936. }
  17937. #if 1 || PY_VERSION_HEX < 0x030600B1
  17938. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
  17939. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  17940. PyObject *globals = PyFunction_GET_GLOBALS(func);
  17941. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  17942. PyObject *closure;
  17943. #if PY_MAJOR_VERSION >= 3
  17944. PyObject *kwdefs;
  17945. #endif
  17946. PyObject *kwtuple, **k;
  17947. PyObject **d;
  17948. Py_ssize_t nd;
  17949. Py_ssize_t nk;
  17950. PyObject *result;
  17951. assert(kwargs == NULL || PyDict_Check(kwargs));
  17952. nk = kwargs ? PyDict_Size(kwargs) : 0;
  17953. if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
  17954. return NULL;
  17955. }
  17956. if (
  17957. #if PY_MAJOR_VERSION >= 3
  17958. co->co_kwonlyargcount == 0 &&
  17959. #endif
  17960. likely(kwargs == NULL || nk == 0) &&
  17961. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  17962. if (argdefs == NULL && co->co_argcount == nargs) {
  17963. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  17964. goto done;
  17965. }
  17966. else if (nargs == 0 && argdefs != NULL
  17967. && co->co_argcount == Py_SIZE(argdefs)) {
  17968. /* function called with no arguments, but all parameters have
  17969. a default value: use default values as arguments .*/
  17970. args = &PyTuple_GET_ITEM(argdefs, 0);
  17971. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  17972. goto done;
  17973. }
  17974. }
  17975. if (kwargs != NULL) {
  17976. Py_ssize_t pos, i;
  17977. kwtuple = PyTuple_New(2 * nk);
  17978. if (kwtuple == NULL) {
  17979. result = NULL;
  17980. goto done;
  17981. }
  17982. k = &PyTuple_GET_ITEM(kwtuple, 0);
  17983. pos = i = 0;
  17984. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  17985. Py_INCREF(k[i]);
  17986. Py_INCREF(k[i+1]);
  17987. i += 2;
  17988. }
  17989. nk = i / 2;
  17990. }
  17991. else {
  17992. kwtuple = NULL;
  17993. k = NULL;
  17994. }
  17995. closure = PyFunction_GET_CLOSURE(func);
  17996. #if PY_MAJOR_VERSION >= 3
  17997. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  17998. #endif
  17999. if (argdefs != NULL) {
  18000. d = &PyTuple_GET_ITEM(argdefs, 0);
  18001. nd = Py_SIZE(argdefs);
  18002. }
  18003. else {
  18004. d = NULL;
  18005. nd = 0;
  18006. }
  18007. #if PY_MAJOR_VERSION >= 3
  18008. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  18009. args, (int)nargs,
  18010. k, (int)nk,
  18011. d, (int)nd, kwdefs, closure);
  18012. #else
  18013. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  18014. args, (int)nargs,
  18015. k, (int)nk,
  18016. d, (int)nd, closure);
  18017. #endif
  18018. Py_XDECREF(kwtuple);
  18019. done:
  18020. Py_LeaveRecursiveCall();
  18021. return result;
  18022. }
  18023. #endif
  18024. #endif
  18025. /* PyObjectCall */
  18026. #if CYTHON_COMPILING_IN_CPYTHON
  18027. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  18028. PyObject *result;
  18029. ternaryfunc call = func->ob_type->tp_call;
  18030. if (unlikely(!call))
  18031. return PyObject_Call(func, arg, kw);
  18032. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  18033. return NULL;
  18034. result = (*call)(func, arg, kw);
  18035. Py_LeaveRecursiveCall();
  18036. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  18037. PyErr_SetString(
  18038. PyExc_SystemError,
  18039. "NULL result without error in PyObject_Call");
  18040. }
  18041. return result;
  18042. }
  18043. #endif
  18044. /* PyObjectCall2Args */
  18045. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  18046. PyObject *args, *result = NULL;
  18047. #if CYTHON_FAST_PYCALL
  18048. if (PyFunction_Check(function)) {
  18049. PyObject *args[2] = {arg1, arg2};
  18050. return __Pyx_PyFunction_FastCall(function, args, 2);
  18051. }
  18052. #endif
  18053. #if CYTHON_FAST_PYCCALL
  18054. if (__Pyx_PyFastCFunction_Check(function)) {
  18055. PyObject *args[2] = {arg1, arg2};
  18056. return __Pyx_PyCFunction_FastCall(function, args, 2);
  18057. }
  18058. #endif
  18059. args = PyTuple_New(2);
  18060. if (unlikely(!args)) goto done;
  18061. Py_INCREF(arg1);
  18062. PyTuple_SET_ITEM(args, 0, arg1);
  18063. Py_INCREF(arg2);
  18064. PyTuple_SET_ITEM(args, 1, arg2);
  18065. Py_INCREF(function);
  18066. result = __Pyx_PyObject_Call(function, args, NULL);
  18067. Py_DECREF(args);
  18068. Py_DECREF(function);
  18069. done:
  18070. return result;
  18071. }
  18072. /* PyObjectCallMethO */
  18073. #if CYTHON_COMPILING_IN_CPYTHON
  18074. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  18075. PyObject *self, *result;
  18076. PyCFunction cfunc;
  18077. cfunc = PyCFunction_GET_FUNCTION(func);
  18078. self = PyCFunction_GET_SELF(func);
  18079. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  18080. return NULL;
  18081. result = cfunc(self, arg);
  18082. Py_LeaveRecursiveCall();
  18083. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  18084. PyErr_SetString(
  18085. PyExc_SystemError,
  18086. "NULL result without error in PyObject_Call");
  18087. }
  18088. return result;
  18089. }
  18090. #endif
  18091. /* PyObjectCallOneArg */
  18092. #if CYTHON_COMPILING_IN_CPYTHON
  18093. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  18094. PyObject *result;
  18095. PyObject *args = PyTuple_New(1);
  18096. if (unlikely(!args)) return NULL;
  18097. Py_INCREF(arg);
  18098. PyTuple_SET_ITEM(args, 0, arg);
  18099. result = __Pyx_PyObject_Call(func, args, NULL);
  18100. Py_DECREF(args);
  18101. return result;
  18102. }
  18103. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  18104. #if CYTHON_FAST_PYCALL
  18105. if (PyFunction_Check(func)) {
  18106. return __Pyx_PyFunction_FastCall(func, &arg, 1);
  18107. }
  18108. #endif
  18109. if (likely(PyCFunction_Check(func))) {
  18110. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  18111. return __Pyx_PyObject_CallMethO(func, arg);
  18112. #if CYTHON_FAST_PYCCALL
  18113. } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
  18114. return __Pyx_PyCFunction_FastCall(func, &arg, 1);
  18115. #endif
  18116. }
  18117. }
  18118. return __Pyx__PyObject_CallOneArg(func, arg);
  18119. }
  18120. #else
  18121. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  18122. PyObject *result;
  18123. PyObject *args = PyTuple_Pack(1, arg);
  18124. if (unlikely(!args)) return NULL;
  18125. result = __Pyx_PyObject_Call(func, args, NULL);
  18126. Py_DECREF(args);
  18127. return result;
  18128. }
  18129. #endif
  18130. /* PyIntCompare */
  18131. static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
  18132. if (op1 == op2) {
  18133. Py_RETURN_TRUE;
  18134. }
  18135. #if PY_MAJOR_VERSION < 3
  18136. if (likely(PyInt_CheckExact(op1))) {
  18137. const long b = intval;
  18138. long a = PyInt_AS_LONG(op1);
  18139. if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
  18140. }
  18141. #endif
  18142. #if CYTHON_USE_PYLONG_INTERNALS
  18143. if (likely(PyLong_CheckExact(op1))) {
  18144. int unequal;
  18145. unsigned long uintval;
  18146. Py_ssize_t size = Py_SIZE(op1);
  18147. const digit* digits = ((PyLongObject*)op1)->ob_digit;
  18148. if (intval == 0) {
  18149. if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
  18150. } else if (intval < 0) {
  18151. if (size >= 0)
  18152. Py_RETURN_FALSE;
  18153. intval = -intval;
  18154. size = -size;
  18155. } else {
  18156. if (size <= 0)
  18157. Py_RETURN_FALSE;
  18158. }
  18159. uintval = (unsigned long) intval;
  18160. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  18161. if (uintval >> (PyLong_SHIFT * 4)) {
  18162. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  18163. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  18164. } else
  18165. #endif
  18166. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  18167. if (uintval >> (PyLong_SHIFT * 3)) {
  18168. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  18169. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  18170. } else
  18171. #endif
  18172. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  18173. if (uintval >> (PyLong_SHIFT * 2)) {
  18174. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  18175. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  18176. } else
  18177. #endif
  18178. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  18179. if (uintval >> (PyLong_SHIFT * 1)) {
  18180. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  18181. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  18182. } else
  18183. #endif
  18184. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  18185. if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
  18186. }
  18187. #endif
  18188. if (PyFloat_CheckExact(op1)) {
  18189. const long b = intval;
  18190. double a = PyFloat_AS_DOUBLE(op1);
  18191. if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
  18192. }
  18193. return (
  18194. PyObject_RichCompare(op1, op2, Py_EQ));
  18195. }
  18196. /* GetItemInt */
  18197. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  18198. PyObject *r;
  18199. if (!j) return NULL;
  18200. r = PyObject_GetItem(o, j);
  18201. Py_DECREF(j);
  18202. return r;
  18203. }
  18204. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  18205. CYTHON_NCP_UNUSED int wraparound,
  18206. CYTHON_NCP_UNUSED int boundscheck) {
  18207. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18208. Py_ssize_t wrapped_i = i;
  18209. if (wraparound & unlikely(i < 0)) {
  18210. wrapped_i += PyList_GET_SIZE(o);
  18211. }
  18212. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  18213. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  18214. Py_INCREF(r);
  18215. return r;
  18216. }
  18217. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  18218. #else
  18219. return PySequence_GetItem(o, i);
  18220. #endif
  18221. }
  18222. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  18223. CYTHON_NCP_UNUSED int wraparound,
  18224. CYTHON_NCP_UNUSED int boundscheck) {
  18225. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18226. Py_ssize_t wrapped_i = i;
  18227. if (wraparound & unlikely(i < 0)) {
  18228. wrapped_i += PyTuple_GET_SIZE(o);
  18229. }
  18230. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  18231. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  18232. Py_INCREF(r);
  18233. return r;
  18234. }
  18235. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  18236. #else
  18237. return PySequence_GetItem(o, i);
  18238. #endif
  18239. }
  18240. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  18241. CYTHON_NCP_UNUSED int wraparound,
  18242. CYTHON_NCP_UNUSED int boundscheck) {
  18243. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  18244. if (is_list || PyList_CheckExact(o)) {
  18245. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  18246. if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  18247. PyObject *r = PyList_GET_ITEM(o, n);
  18248. Py_INCREF(r);
  18249. return r;
  18250. }
  18251. }
  18252. else if (PyTuple_CheckExact(o)) {
  18253. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  18254. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  18255. PyObject *r = PyTuple_GET_ITEM(o, n);
  18256. Py_INCREF(r);
  18257. return r;
  18258. }
  18259. } else {
  18260. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  18261. if (likely(m && m->sq_item)) {
  18262. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  18263. Py_ssize_t l = m->sq_length(o);
  18264. if (likely(l >= 0)) {
  18265. i += l;
  18266. } else {
  18267. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  18268. return NULL;
  18269. PyErr_Clear();
  18270. }
  18271. }
  18272. return m->sq_item(o, i);
  18273. }
  18274. }
  18275. #else
  18276. if (is_list || PySequence_Check(o)) {
  18277. return PySequence_GetItem(o, i);
  18278. }
  18279. #endif
  18280. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  18281. }
  18282. /* DictGetItem */
  18283. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  18284. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  18285. PyObject *value;
  18286. value = PyDict_GetItemWithError(d, key);
  18287. if (unlikely(!value)) {
  18288. if (!PyErr_Occurred()) {
  18289. if (unlikely(PyTuple_Check(key))) {
  18290. PyObject* args = PyTuple_Pack(1, key);
  18291. if (likely(args)) {
  18292. PyErr_SetObject(PyExc_KeyError, args);
  18293. Py_DECREF(args);
  18294. }
  18295. } else {
  18296. PyErr_SetObject(PyExc_KeyError, key);
  18297. }
  18298. }
  18299. return NULL;
  18300. }
  18301. Py_INCREF(value);
  18302. return value;
  18303. }
  18304. #endif
  18305. /* MemviewSliceInit */
  18306. static int
  18307. __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
  18308. int ndim,
  18309. __Pyx_memviewslice *memviewslice,
  18310. int memview_is_new_reference)
  18311. {
  18312. __Pyx_RefNannyDeclarations
  18313. int i, retval=-1;
  18314. Py_buffer *buf = &memview->view;
  18315. __Pyx_RefNannySetupContext("init_memviewslice", 0);
  18316. if (memviewslice->memview || memviewslice->data) {
  18317. PyErr_SetString(PyExc_ValueError,
  18318. "memviewslice is already initialized!");
  18319. goto fail;
  18320. }
  18321. if (buf->strides) {
  18322. for (i = 0; i < ndim; i++) {
  18323. memviewslice->strides[i] = buf->strides[i];
  18324. }
  18325. } else {
  18326. Py_ssize_t stride = buf->itemsize;
  18327. for (i = ndim - 1; i >= 0; i--) {
  18328. memviewslice->strides[i] = stride;
  18329. stride *= buf->shape[i];
  18330. }
  18331. }
  18332. for (i = 0; i < ndim; i++) {
  18333. memviewslice->shape[i] = buf->shape[i];
  18334. if (buf->suboffsets) {
  18335. memviewslice->suboffsets[i] = buf->suboffsets[i];
  18336. } else {
  18337. memviewslice->suboffsets[i] = -1;
  18338. }
  18339. }
  18340. memviewslice->memview = memview;
  18341. memviewslice->data = (char *)buf->buf;
  18342. if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
  18343. Py_INCREF(memview);
  18344. }
  18345. retval = 0;
  18346. goto no_fail;
  18347. fail:
  18348. memviewslice->memview = 0;
  18349. memviewslice->data = 0;
  18350. retval = -1;
  18351. no_fail:
  18352. __Pyx_RefNannyFinishContext();
  18353. return retval;
  18354. }
  18355. #ifndef Py_NO_RETURN
  18356. #define Py_NO_RETURN
  18357. #endif
  18358. static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
  18359. va_list vargs;
  18360. char msg[200];
  18361. #ifdef HAVE_STDARG_PROTOTYPES
  18362. va_start(vargs, fmt);
  18363. #else
  18364. va_start(vargs);
  18365. #endif
  18366. vsnprintf(msg, 200, fmt, vargs);
  18367. va_end(vargs);
  18368. Py_FatalError(msg);
  18369. }
  18370. static CYTHON_INLINE int
  18371. __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
  18372. PyThread_type_lock lock)
  18373. {
  18374. int result;
  18375. PyThread_acquire_lock(lock, 1);
  18376. result = (*acquisition_count)++;
  18377. PyThread_release_lock(lock);
  18378. return result;
  18379. }
  18380. static CYTHON_INLINE int
  18381. __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
  18382. PyThread_type_lock lock)
  18383. {
  18384. int result;
  18385. PyThread_acquire_lock(lock, 1);
  18386. result = (*acquisition_count)--;
  18387. PyThread_release_lock(lock);
  18388. return result;
  18389. }
  18390. static CYTHON_INLINE void
  18391. __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
  18392. {
  18393. int first_time;
  18394. struct __pyx_memoryview_obj *memview = memslice->memview;
  18395. if (!memview || (PyObject *) memview == Py_None)
  18396. return;
  18397. if (__pyx_get_slice_count(memview) < 0)
  18398. __pyx_fatalerror("Acquisition count is %d (line %d)",
  18399. __pyx_get_slice_count(memview), lineno);
  18400. first_time = __pyx_add_acquisition_count(memview) == 0;
  18401. if (first_time) {
  18402. if (have_gil) {
  18403. Py_INCREF((PyObject *) memview);
  18404. } else {
  18405. PyGILState_STATE _gilstate = PyGILState_Ensure();
  18406. Py_INCREF((PyObject *) memview);
  18407. PyGILState_Release(_gilstate);
  18408. }
  18409. }
  18410. }
  18411. static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
  18412. int have_gil, int lineno) {
  18413. int last_time;
  18414. struct __pyx_memoryview_obj *memview = memslice->memview;
  18415. if (!memview ) {
  18416. return;
  18417. } else if ((PyObject *) memview == Py_None) {
  18418. memslice->memview = NULL;
  18419. return;
  18420. }
  18421. if (__pyx_get_slice_count(memview) <= 0)
  18422. __pyx_fatalerror("Acquisition count is %d (line %d)",
  18423. __pyx_get_slice_count(memview), lineno);
  18424. last_time = __pyx_sub_acquisition_count(memview) == 1;
  18425. memslice->data = NULL;
  18426. if (last_time) {
  18427. if (have_gil) {
  18428. Py_CLEAR(memslice->memview);
  18429. } else {
  18430. PyGILState_STATE _gilstate = PyGILState_Ensure();
  18431. Py_CLEAR(memslice->memview);
  18432. PyGILState_Release(_gilstate);
  18433. }
  18434. } else {
  18435. memslice->memview = NULL;
  18436. }
  18437. }
  18438. /* ObjectGetItem */
  18439. #if CYTHON_USE_TYPE_SLOTS
  18440. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
  18441. PyObject *runerr;
  18442. Py_ssize_t key_value;
  18443. PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
  18444. if (unlikely(!(m && m->sq_item))) {
  18445. PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
  18446. return NULL;
  18447. }
  18448. key_value = __Pyx_PyIndex_AsSsize_t(index);
  18449. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  18450. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  18451. }
  18452. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  18453. PyErr_Clear();
  18454. PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
  18455. }
  18456. return NULL;
  18457. }
  18458. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
  18459. PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
  18460. if (likely(m && m->mp_subscript)) {
  18461. return m->mp_subscript(obj, key);
  18462. }
  18463. return __Pyx_PyObject_GetIndex(obj, key);
  18464. }
  18465. #endif
  18466. /* PyErrFetchRestore */
  18467. #if CYTHON_FAST_THREAD_STATE
  18468. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  18469. PyObject *tmp_type, *tmp_value, *tmp_tb;
  18470. tmp_type = tstate->curexc_type;
  18471. tmp_value = tstate->curexc_value;
  18472. tmp_tb = tstate->curexc_traceback;
  18473. tstate->curexc_type = type;
  18474. tstate->curexc_value = value;
  18475. tstate->curexc_traceback = tb;
  18476. Py_XDECREF(tmp_type);
  18477. Py_XDECREF(tmp_value);
  18478. Py_XDECREF(tmp_tb);
  18479. }
  18480. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  18481. *type = tstate->curexc_type;
  18482. *value = tstate->curexc_value;
  18483. *tb = tstate->curexc_traceback;
  18484. tstate->curexc_type = 0;
  18485. tstate->curexc_value = 0;
  18486. tstate->curexc_traceback = 0;
  18487. }
  18488. #endif
  18489. /* RaiseException */
  18490. #if PY_MAJOR_VERSION < 3
  18491. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  18492. CYTHON_UNUSED PyObject *cause) {
  18493. __Pyx_PyThreadState_declare
  18494. Py_XINCREF(type);
  18495. if (!value || value == Py_None)
  18496. value = NULL;
  18497. else
  18498. Py_INCREF(value);
  18499. if (!tb || tb == Py_None)
  18500. tb = NULL;
  18501. else {
  18502. Py_INCREF(tb);
  18503. if (!PyTraceBack_Check(tb)) {
  18504. PyErr_SetString(PyExc_TypeError,
  18505. "raise: arg 3 must be a traceback or None");
  18506. goto raise_error;
  18507. }
  18508. }
  18509. if (PyType_Check(type)) {
  18510. #if CYTHON_COMPILING_IN_PYPY
  18511. if (!value) {
  18512. Py_INCREF(Py_None);
  18513. value = Py_None;
  18514. }
  18515. #endif
  18516. PyErr_NormalizeException(&type, &value, &tb);
  18517. } else {
  18518. if (value) {
  18519. PyErr_SetString(PyExc_TypeError,
  18520. "instance exception may not have a separate value");
  18521. goto raise_error;
  18522. }
  18523. value = type;
  18524. type = (PyObject*) Py_TYPE(type);
  18525. Py_INCREF(type);
  18526. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  18527. PyErr_SetString(PyExc_TypeError,
  18528. "raise: exception class must be a subclass of BaseException");
  18529. goto raise_error;
  18530. }
  18531. }
  18532. __Pyx_PyThreadState_assign
  18533. __Pyx_ErrRestore(type, value, tb);
  18534. return;
  18535. raise_error:
  18536. Py_XDECREF(value);
  18537. Py_XDECREF(type);
  18538. Py_XDECREF(tb);
  18539. return;
  18540. }
  18541. #else
  18542. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  18543. PyObject* owned_instance = NULL;
  18544. if (tb == Py_None) {
  18545. tb = 0;
  18546. } else if (tb && !PyTraceBack_Check(tb)) {
  18547. PyErr_SetString(PyExc_TypeError,
  18548. "raise: arg 3 must be a traceback or None");
  18549. goto bad;
  18550. }
  18551. if (value == Py_None)
  18552. value = 0;
  18553. if (PyExceptionInstance_Check(type)) {
  18554. if (value) {
  18555. PyErr_SetString(PyExc_TypeError,
  18556. "instance exception may not have a separate value");
  18557. goto bad;
  18558. }
  18559. value = type;
  18560. type = (PyObject*) Py_TYPE(value);
  18561. } else if (PyExceptionClass_Check(type)) {
  18562. PyObject *instance_class = NULL;
  18563. if (value && PyExceptionInstance_Check(value)) {
  18564. instance_class = (PyObject*) Py_TYPE(value);
  18565. if (instance_class != type) {
  18566. int is_subclass = PyObject_IsSubclass(instance_class, type);
  18567. if (!is_subclass) {
  18568. instance_class = NULL;
  18569. } else if (unlikely(is_subclass == -1)) {
  18570. goto bad;
  18571. } else {
  18572. type = instance_class;
  18573. }
  18574. }
  18575. }
  18576. if (!instance_class) {
  18577. PyObject *args;
  18578. if (!value)
  18579. args = PyTuple_New(0);
  18580. else if (PyTuple_Check(value)) {
  18581. Py_INCREF(value);
  18582. args = value;
  18583. } else
  18584. args = PyTuple_Pack(1, value);
  18585. if (!args)
  18586. goto bad;
  18587. owned_instance = PyObject_Call(type, args, NULL);
  18588. Py_DECREF(args);
  18589. if (!owned_instance)
  18590. goto bad;
  18591. value = owned_instance;
  18592. if (!PyExceptionInstance_Check(value)) {
  18593. PyErr_Format(PyExc_TypeError,
  18594. "calling %R should have returned an instance of "
  18595. "BaseException, not %R",
  18596. type, Py_TYPE(value));
  18597. goto bad;
  18598. }
  18599. }
  18600. } else {
  18601. PyErr_SetString(PyExc_TypeError,
  18602. "raise: exception class must be a subclass of BaseException");
  18603. goto bad;
  18604. }
  18605. if (cause) {
  18606. PyObject *fixed_cause;
  18607. if (cause == Py_None) {
  18608. fixed_cause = NULL;
  18609. } else if (PyExceptionClass_Check(cause)) {
  18610. fixed_cause = PyObject_CallObject(cause, NULL);
  18611. if (fixed_cause == NULL)
  18612. goto bad;
  18613. } else if (PyExceptionInstance_Check(cause)) {
  18614. fixed_cause = cause;
  18615. Py_INCREF(fixed_cause);
  18616. } else {
  18617. PyErr_SetString(PyExc_TypeError,
  18618. "exception causes must derive from "
  18619. "BaseException");
  18620. goto bad;
  18621. }
  18622. PyException_SetCause(value, fixed_cause);
  18623. }
  18624. PyErr_SetObject(type, value);
  18625. if (tb) {
  18626. #if CYTHON_COMPILING_IN_PYPY
  18627. PyObject *tmp_type, *tmp_value, *tmp_tb;
  18628. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  18629. Py_INCREF(tb);
  18630. PyErr_Restore(tmp_type, tmp_value, tb);
  18631. Py_XDECREF(tmp_tb);
  18632. #else
  18633. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  18634. PyObject* tmp_tb = tstate->curexc_traceback;
  18635. if (tb != tmp_tb) {
  18636. Py_INCREF(tb);
  18637. tstate->curexc_traceback = tb;
  18638. Py_XDECREF(tmp_tb);
  18639. }
  18640. #endif
  18641. }
  18642. bad:
  18643. Py_XDECREF(owned_instance);
  18644. return;
  18645. }
  18646. #endif
  18647. /* BytesEquals */
  18648. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  18649. #if CYTHON_COMPILING_IN_PYPY
  18650. return PyObject_RichCompareBool(s1, s2, equals);
  18651. #else
  18652. if (s1 == s2) {
  18653. return (equals == Py_EQ);
  18654. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  18655. const char *ps1, *ps2;
  18656. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  18657. if (length != PyBytes_GET_SIZE(s2))
  18658. return (equals == Py_NE);
  18659. ps1 = PyBytes_AS_STRING(s1);
  18660. ps2 = PyBytes_AS_STRING(s2);
  18661. if (ps1[0] != ps2[0]) {
  18662. return (equals == Py_NE);
  18663. } else if (length == 1) {
  18664. return (equals == Py_EQ);
  18665. } else {
  18666. int result;
  18667. #if CYTHON_USE_UNICODE_INTERNALS
  18668. Py_hash_t hash1, hash2;
  18669. hash1 = ((PyBytesObject*)s1)->ob_shash;
  18670. hash2 = ((PyBytesObject*)s2)->ob_shash;
  18671. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  18672. return (equals == Py_NE);
  18673. }
  18674. #endif
  18675. result = memcmp(ps1, ps2, (size_t)length);
  18676. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  18677. }
  18678. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  18679. return (equals == Py_NE);
  18680. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  18681. return (equals == Py_NE);
  18682. } else {
  18683. int result;
  18684. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  18685. if (!py_result)
  18686. return -1;
  18687. result = __Pyx_PyObject_IsTrue(py_result);
  18688. Py_DECREF(py_result);
  18689. return result;
  18690. }
  18691. #endif
  18692. }
  18693. /* UnicodeEquals */
  18694. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  18695. #if CYTHON_COMPILING_IN_PYPY
  18696. return PyObject_RichCompareBool(s1, s2, equals);
  18697. #else
  18698. #if PY_MAJOR_VERSION < 3
  18699. PyObject* owned_ref = NULL;
  18700. #endif
  18701. int s1_is_unicode, s2_is_unicode;
  18702. if (s1 == s2) {
  18703. goto return_eq;
  18704. }
  18705. s1_is_unicode = PyUnicode_CheckExact(s1);
  18706. s2_is_unicode = PyUnicode_CheckExact(s2);
  18707. #if PY_MAJOR_VERSION < 3
  18708. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  18709. owned_ref = PyUnicode_FromObject(s2);
  18710. if (unlikely(!owned_ref))
  18711. return -1;
  18712. s2 = owned_ref;
  18713. s2_is_unicode = 1;
  18714. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  18715. owned_ref = PyUnicode_FromObject(s1);
  18716. if (unlikely(!owned_ref))
  18717. return -1;
  18718. s1 = owned_ref;
  18719. s1_is_unicode = 1;
  18720. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  18721. return __Pyx_PyBytes_Equals(s1, s2, equals);
  18722. }
  18723. #endif
  18724. if (s1_is_unicode & s2_is_unicode) {
  18725. Py_ssize_t length;
  18726. int kind;
  18727. void *data1, *data2;
  18728. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  18729. return -1;
  18730. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  18731. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  18732. goto return_ne;
  18733. }
  18734. #if CYTHON_USE_UNICODE_INTERNALS
  18735. {
  18736. Py_hash_t hash1, hash2;
  18737. #if CYTHON_PEP393_ENABLED
  18738. hash1 = ((PyASCIIObject*)s1)->hash;
  18739. hash2 = ((PyASCIIObject*)s2)->hash;
  18740. #else
  18741. hash1 = ((PyUnicodeObject*)s1)->hash;
  18742. hash2 = ((PyUnicodeObject*)s2)->hash;
  18743. #endif
  18744. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  18745. goto return_ne;
  18746. }
  18747. }
  18748. #endif
  18749. kind = __Pyx_PyUnicode_KIND(s1);
  18750. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  18751. goto return_ne;
  18752. }
  18753. data1 = __Pyx_PyUnicode_DATA(s1);
  18754. data2 = __Pyx_PyUnicode_DATA(s2);
  18755. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  18756. goto return_ne;
  18757. } else if (length == 1) {
  18758. goto return_eq;
  18759. } else {
  18760. int result = memcmp(data1, data2, (size_t)(length * kind));
  18761. #if PY_MAJOR_VERSION < 3
  18762. Py_XDECREF(owned_ref);
  18763. #endif
  18764. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  18765. }
  18766. } else if ((s1 == Py_None) & s2_is_unicode) {
  18767. goto return_ne;
  18768. } else if ((s2 == Py_None) & s1_is_unicode) {
  18769. goto return_ne;
  18770. } else {
  18771. int result;
  18772. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  18773. #if PY_MAJOR_VERSION < 3
  18774. Py_XDECREF(owned_ref);
  18775. #endif
  18776. if (!py_result)
  18777. return -1;
  18778. result = __Pyx_PyObject_IsTrue(py_result);
  18779. Py_DECREF(py_result);
  18780. return result;
  18781. }
  18782. return_eq:
  18783. #if PY_MAJOR_VERSION < 3
  18784. Py_XDECREF(owned_ref);
  18785. #endif
  18786. return (equals == Py_EQ);
  18787. return_ne:
  18788. #if PY_MAJOR_VERSION < 3
  18789. Py_XDECREF(owned_ref);
  18790. #endif
  18791. return (equals == Py_NE);
  18792. #endif
  18793. }
  18794. /* None */
  18795. static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
  18796. Py_ssize_t q = a / b;
  18797. Py_ssize_t r = a - q*b;
  18798. q -= ((r != 0) & ((r ^ b) < 0));
  18799. return q;
  18800. }
  18801. /* GetAttr */
  18802. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
  18803. #if CYTHON_USE_TYPE_SLOTS
  18804. #if PY_MAJOR_VERSION >= 3
  18805. if (likely(PyUnicode_Check(n)))
  18806. #else
  18807. if (likely(PyString_Check(n)))
  18808. #endif
  18809. return __Pyx_PyObject_GetAttrStr(o, n);
  18810. #endif
  18811. return PyObject_GetAttr(o, n);
  18812. }
  18813. /* decode_c_string */
  18814. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  18815. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  18816. const char* encoding, const char* errors,
  18817. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
  18818. Py_ssize_t length;
  18819. if (unlikely((start < 0) | (stop < 0))) {
  18820. size_t slen = strlen(cstring);
  18821. if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
  18822. PyErr_SetString(PyExc_OverflowError,
  18823. "c-string too long to convert to Python");
  18824. return NULL;
  18825. }
  18826. length = (Py_ssize_t) slen;
  18827. if (start < 0) {
  18828. start += length;
  18829. if (start < 0)
  18830. start = 0;
  18831. }
  18832. if (stop < 0)
  18833. stop += length;
  18834. }
  18835. length = stop - start;
  18836. if (unlikely(length <= 0))
  18837. return PyUnicode_FromUnicode(NULL, 0);
  18838. cstring += start;
  18839. if (decode_func) {
  18840. return decode_func(cstring, length, errors);
  18841. } else {
  18842. return PyUnicode_Decode(cstring, length, encoding, errors);
  18843. }
  18844. }
  18845. /* PyErrExceptionMatches */
  18846. #if CYTHON_FAST_THREAD_STATE
  18847. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  18848. Py_ssize_t i, n;
  18849. n = PyTuple_GET_SIZE(tuple);
  18850. #if PY_MAJOR_VERSION >= 3
  18851. for (i=0; i<n; i++) {
  18852. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  18853. }
  18854. #endif
  18855. for (i=0; i<n; i++) {
  18856. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  18857. }
  18858. return 0;
  18859. }
  18860. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  18861. PyObject *exc_type = tstate->curexc_type;
  18862. if (exc_type == err) return 1;
  18863. if (unlikely(!exc_type)) return 0;
  18864. if (unlikely(PyTuple_Check(err)))
  18865. return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  18866. return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  18867. }
  18868. #endif
  18869. /* GetAttr3 */
  18870. static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
  18871. __Pyx_PyThreadState_declare
  18872. __Pyx_PyThreadState_assign
  18873. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  18874. return NULL;
  18875. __Pyx_PyErr_Clear();
  18876. Py_INCREF(d);
  18877. return d;
  18878. }
  18879. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
  18880. PyObject *r = __Pyx_GetAttr(o, n);
  18881. return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
  18882. }
  18883. /* RaiseTooManyValuesToUnpack */
  18884. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  18885. PyErr_Format(PyExc_ValueError,
  18886. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  18887. }
  18888. /* RaiseNeedMoreValuesToUnpack */
  18889. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  18890. PyErr_Format(PyExc_ValueError,
  18891. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  18892. index, (index == 1) ? "" : "s");
  18893. }
  18894. /* RaiseNoneIterError */
  18895. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  18896. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  18897. }
  18898. /* ExtTypeTest */
  18899. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  18900. if (unlikely(!type)) {
  18901. PyErr_SetString(PyExc_SystemError, "Missing type object");
  18902. return 0;
  18903. }
  18904. if (likely(__Pyx_TypeCheck(obj, type)))
  18905. return 1;
  18906. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  18907. Py_TYPE(obj)->tp_name, type->tp_name);
  18908. return 0;
  18909. }
  18910. /* GetTopmostException */
  18911. #if CYTHON_USE_EXC_INFO_STACK
  18912. static _PyErr_StackItem *
  18913. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  18914. {
  18915. _PyErr_StackItem *exc_info = tstate->exc_info;
  18916. while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
  18917. exc_info->previous_item != NULL)
  18918. {
  18919. exc_info = exc_info->previous_item;
  18920. }
  18921. return exc_info;
  18922. }
  18923. #endif
  18924. /* SaveResetException */
  18925. #if CYTHON_FAST_THREAD_STATE
  18926. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  18927. #if CYTHON_USE_EXC_INFO_STACK
  18928. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  18929. *type = exc_info->exc_type;
  18930. *value = exc_info->exc_value;
  18931. *tb = exc_info->exc_traceback;
  18932. #else
  18933. *type = tstate->exc_type;
  18934. *value = tstate->exc_value;
  18935. *tb = tstate->exc_traceback;
  18936. #endif
  18937. Py_XINCREF(*type);
  18938. Py_XINCREF(*value);
  18939. Py_XINCREF(*tb);
  18940. }
  18941. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  18942. PyObject *tmp_type, *tmp_value, *tmp_tb;
  18943. #if CYTHON_USE_EXC_INFO_STACK
  18944. _PyErr_StackItem *exc_info = tstate->exc_info;
  18945. tmp_type = exc_info->exc_type;
  18946. tmp_value = exc_info->exc_value;
  18947. tmp_tb = exc_info->exc_traceback;
  18948. exc_info->exc_type = type;
  18949. exc_info->exc_value = value;
  18950. exc_info->exc_traceback = tb;
  18951. #else
  18952. tmp_type = tstate->exc_type;
  18953. tmp_value = tstate->exc_value;
  18954. tmp_tb = tstate->exc_traceback;
  18955. tstate->exc_type = type;
  18956. tstate->exc_value = value;
  18957. tstate->exc_traceback = tb;
  18958. #endif
  18959. Py_XDECREF(tmp_type);
  18960. Py_XDECREF(tmp_value);
  18961. Py_XDECREF(tmp_tb);
  18962. }
  18963. #endif
  18964. /* GetException */
  18965. #if CYTHON_FAST_THREAD_STATE
  18966. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  18967. #else
  18968. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  18969. #endif
  18970. {
  18971. PyObject *local_type, *local_value, *local_tb;
  18972. #if CYTHON_FAST_THREAD_STATE
  18973. PyObject *tmp_type, *tmp_value, *tmp_tb;
  18974. local_type = tstate->curexc_type;
  18975. local_value = tstate->curexc_value;
  18976. local_tb = tstate->curexc_traceback;
  18977. tstate->curexc_type = 0;
  18978. tstate->curexc_value = 0;
  18979. tstate->curexc_traceback = 0;
  18980. #else
  18981. PyErr_Fetch(&local_type, &local_value, &local_tb);
  18982. #endif
  18983. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  18984. #if CYTHON_FAST_THREAD_STATE
  18985. if (unlikely(tstate->curexc_type))
  18986. #else
  18987. if (unlikely(PyErr_Occurred()))
  18988. #endif
  18989. goto bad;
  18990. #if PY_MAJOR_VERSION >= 3
  18991. if (local_tb) {
  18992. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  18993. goto bad;
  18994. }
  18995. #endif
  18996. Py_XINCREF(local_tb);
  18997. Py_XINCREF(local_type);
  18998. Py_XINCREF(local_value);
  18999. *type = local_type;
  19000. *value = local_value;
  19001. *tb = local_tb;
  19002. #if CYTHON_FAST_THREAD_STATE
  19003. #if CYTHON_USE_EXC_INFO_STACK
  19004. {
  19005. _PyErr_StackItem *exc_info = tstate->exc_info;
  19006. tmp_type = exc_info->exc_type;
  19007. tmp_value = exc_info->exc_value;
  19008. tmp_tb = exc_info->exc_traceback;
  19009. exc_info->exc_type = local_type;
  19010. exc_info->exc_value = local_value;
  19011. exc_info->exc_traceback = local_tb;
  19012. }
  19013. #else
  19014. tmp_type = tstate->exc_type;
  19015. tmp_value = tstate->exc_value;
  19016. tmp_tb = tstate->exc_traceback;
  19017. tstate->exc_type = local_type;
  19018. tstate->exc_value = local_value;
  19019. tstate->exc_traceback = local_tb;
  19020. #endif
  19021. Py_XDECREF(tmp_type);
  19022. Py_XDECREF(tmp_value);
  19023. Py_XDECREF(tmp_tb);
  19024. #else
  19025. PyErr_SetExcInfo(local_type, local_value, local_tb);
  19026. #endif
  19027. return 0;
  19028. bad:
  19029. *type = 0;
  19030. *value = 0;
  19031. *tb = 0;
  19032. Py_XDECREF(local_type);
  19033. Py_XDECREF(local_value);
  19034. Py_XDECREF(local_tb);
  19035. return -1;
  19036. }
  19037. /* SwapException */
  19038. #if CYTHON_FAST_THREAD_STATE
  19039. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  19040. PyObject *tmp_type, *tmp_value, *tmp_tb;
  19041. #if CYTHON_USE_EXC_INFO_STACK
  19042. _PyErr_StackItem *exc_info = tstate->exc_info;
  19043. tmp_type = exc_info->exc_type;
  19044. tmp_value = exc_info->exc_value;
  19045. tmp_tb = exc_info->exc_traceback;
  19046. exc_info->exc_type = *type;
  19047. exc_info->exc_value = *value;
  19048. exc_info->exc_traceback = *tb;
  19049. #else
  19050. tmp_type = tstate->exc_type;
  19051. tmp_value = tstate->exc_value;
  19052. tmp_tb = tstate->exc_traceback;
  19053. tstate->exc_type = *type;
  19054. tstate->exc_value = *value;
  19055. tstate->exc_traceback = *tb;
  19056. #endif
  19057. *type = tmp_type;
  19058. *value = tmp_value;
  19059. *tb = tmp_tb;
  19060. }
  19061. #else
  19062. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  19063. PyObject *tmp_type, *tmp_value, *tmp_tb;
  19064. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  19065. PyErr_SetExcInfo(*type, *value, *tb);
  19066. *type = tmp_type;
  19067. *value = tmp_value;
  19068. *tb = tmp_tb;
  19069. }
  19070. #endif
  19071. /* Import */
  19072. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  19073. PyObject *empty_list = 0;
  19074. PyObject *module = 0;
  19075. PyObject *global_dict = 0;
  19076. PyObject *empty_dict = 0;
  19077. PyObject *list;
  19078. #if PY_MAJOR_VERSION < 3
  19079. PyObject *py_import;
  19080. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  19081. if (!py_import)
  19082. goto bad;
  19083. #endif
  19084. if (from_list)
  19085. list = from_list;
  19086. else {
  19087. empty_list = PyList_New(0);
  19088. if (!empty_list)
  19089. goto bad;
  19090. list = empty_list;
  19091. }
  19092. global_dict = PyModule_GetDict(__pyx_m);
  19093. if (!global_dict)
  19094. goto bad;
  19095. empty_dict = PyDict_New();
  19096. if (!empty_dict)
  19097. goto bad;
  19098. {
  19099. #if PY_MAJOR_VERSION >= 3
  19100. if (level == -1) {
  19101. if (strchr(__Pyx_MODULE_NAME, '.')) {
  19102. module = PyImport_ImportModuleLevelObject(
  19103. name, global_dict, empty_dict, list, 1);
  19104. if (!module) {
  19105. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  19106. goto bad;
  19107. PyErr_Clear();
  19108. }
  19109. }
  19110. level = 0;
  19111. }
  19112. #endif
  19113. if (!module) {
  19114. #if PY_MAJOR_VERSION < 3
  19115. PyObject *py_level = PyInt_FromLong(level);
  19116. if (!py_level)
  19117. goto bad;
  19118. module = PyObject_CallFunctionObjArgs(py_import,
  19119. name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
  19120. Py_DECREF(py_level);
  19121. #else
  19122. module = PyImport_ImportModuleLevelObject(
  19123. name, global_dict, empty_dict, list, level);
  19124. #endif
  19125. }
  19126. }
  19127. bad:
  19128. #if PY_MAJOR_VERSION < 3
  19129. Py_XDECREF(py_import);
  19130. #endif
  19131. Py_XDECREF(empty_list);
  19132. Py_XDECREF(empty_dict);
  19133. return module;
  19134. }
  19135. /* FastTypeChecks */
  19136. #if CYTHON_COMPILING_IN_CPYTHON
  19137. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  19138. while (a) {
  19139. a = a->tp_base;
  19140. if (a == b)
  19141. return 1;
  19142. }
  19143. return b == &PyBaseObject_Type;
  19144. }
  19145. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  19146. PyObject *mro;
  19147. if (a == b) return 1;
  19148. mro = a->tp_mro;
  19149. if (likely(mro)) {
  19150. Py_ssize_t i, n;
  19151. n = PyTuple_GET_SIZE(mro);
  19152. for (i = 0; i < n; i++) {
  19153. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  19154. return 1;
  19155. }
  19156. return 0;
  19157. }
  19158. return __Pyx_InBases(a, b);
  19159. }
  19160. #if PY_MAJOR_VERSION == 2
  19161. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  19162. PyObject *exception, *value, *tb;
  19163. int res;
  19164. __Pyx_PyThreadState_declare
  19165. __Pyx_PyThreadState_assign
  19166. __Pyx_ErrFetch(&exception, &value, &tb);
  19167. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  19168. if (unlikely(res == -1)) {
  19169. PyErr_WriteUnraisable(err);
  19170. res = 0;
  19171. }
  19172. if (!res) {
  19173. res = PyObject_IsSubclass(err, exc_type2);
  19174. if (unlikely(res == -1)) {
  19175. PyErr_WriteUnraisable(err);
  19176. res = 0;
  19177. }
  19178. }
  19179. __Pyx_ErrRestore(exception, value, tb);
  19180. return res;
  19181. }
  19182. #else
  19183. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  19184. int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  19185. if (!res) {
  19186. res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  19187. }
  19188. return res;
  19189. }
  19190. #endif
  19191. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  19192. Py_ssize_t i, n;
  19193. assert(PyExceptionClass_Check(exc_type));
  19194. n = PyTuple_GET_SIZE(tuple);
  19195. #if PY_MAJOR_VERSION >= 3
  19196. for (i=0; i<n; i++) {
  19197. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  19198. }
  19199. #endif
  19200. for (i=0; i<n; i++) {
  19201. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  19202. #if PY_MAJOR_VERSION < 3
  19203. if (likely(exc_type == t)) return 1;
  19204. #endif
  19205. if (likely(PyExceptionClass_Check(t))) {
  19206. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  19207. } else {
  19208. }
  19209. }
  19210. return 0;
  19211. }
  19212. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  19213. if (likely(err == exc_type)) return 1;
  19214. if (likely(PyExceptionClass_Check(err))) {
  19215. if (likely(PyExceptionClass_Check(exc_type))) {
  19216. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  19217. } else if (likely(PyTuple_Check(exc_type))) {
  19218. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  19219. } else {
  19220. }
  19221. }
  19222. return PyErr_GivenExceptionMatches(err, exc_type);
  19223. }
  19224. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  19225. assert(PyExceptionClass_Check(exc_type1));
  19226. assert(PyExceptionClass_Check(exc_type2));
  19227. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  19228. if (likely(PyExceptionClass_Check(err))) {
  19229. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  19230. }
  19231. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  19232. }
  19233. #endif
  19234. /* PyIntBinop */
  19235. #if !CYTHON_COMPILING_IN_PYPY
  19236. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
  19237. (void)inplace;
  19238. (void)zerodivision_check;
  19239. #if PY_MAJOR_VERSION < 3
  19240. if (likely(PyInt_CheckExact(op1))) {
  19241. const long b = intval;
  19242. long x;
  19243. long a = PyInt_AS_LONG(op1);
  19244. x = (long)((unsigned long)a + b);
  19245. if (likely((x^a) >= 0 || (x^b) >= 0))
  19246. return PyInt_FromLong(x);
  19247. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  19248. }
  19249. #endif
  19250. #if CYTHON_USE_PYLONG_INTERNALS
  19251. if (likely(PyLong_CheckExact(op1))) {
  19252. const long b = intval;
  19253. long a, x;
  19254. #ifdef HAVE_LONG_LONG
  19255. const PY_LONG_LONG llb = intval;
  19256. PY_LONG_LONG lla, llx;
  19257. #endif
  19258. const digit* digits = ((PyLongObject*)op1)->ob_digit;
  19259. const Py_ssize_t size = Py_SIZE(op1);
  19260. if (likely(__Pyx_sst_abs(size) <= 1)) {
  19261. a = likely(size) ? digits[0] : 0;
  19262. if (size == -1) a = -a;
  19263. } else {
  19264. switch (size) {
  19265. case -2:
  19266. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  19267. a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  19268. break;
  19269. #ifdef HAVE_LONG_LONG
  19270. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  19271. lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  19272. goto long_long;
  19273. #endif
  19274. }
  19275. CYTHON_FALLTHROUGH;
  19276. case 2:
  19277. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  19278. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  19279. break;
  19280. #ifdef HAVE_LONG_LONG
  19281. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  19282. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  19283. goto long_long;
  19284. #endif
  19285. }
  19286. CYTHON_FALLTHROUGH;
  19287. case -3:
  19288. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  19289. a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  19290. break;
  19291. #ifdef HAVE_LONG_LONG
  19292. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  19293. lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  19294. goto long_long;
  19295. #endif
  19296. }
  19297. CYTHON_FALLTHROUGH;
  19298. case 3:
  19299. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  19300. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  19301. break;
  19302. #ifdef HAVE_LONG_LONG
  19303. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  19304. lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  19305. goto long_long;
  19306. #endif
  19307. }
  19308. CYTHON_FALLTHROUGH;
  19309. case -4:
  19310. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  19311. a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  19312. break;
  19313. #ifdef HAVE_LONG_LONG
  19314. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  19315. lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  19316. goto long_long;
  19317. #endif
  19318. }
  19319. CYTHON_FALLTHROUGH;
  19320. case 4:
  19321. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  19322. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  19323. break;
  19324. #ifdef HAVE_LONG_LONG
  19325. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  19326. lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  19327. goto long_long;
  19328. #endif
  19329. }
  19330. CYTHON_FALLTHROUGH;
  19331. default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
  19332. }
  19333. }
  19334. x = a + b;
  19335. return PyLong_FromLong(x);
  19336. #ifdef HAVE_LONG_LONG
  19337. long_long:
  19338. llx = lla + llb;
  19339. return PyLong_FromLongLong(llx);
  19340. #endif
  19341. }
  19342. #endif
  19343. if (PyFloat_CheckExact(op1)) {
  19344. const long b = intval;
  19345. double a = PyFloat_AS_DOUBLE(op1);
  19346. double result;
  19347. PyFPE_START_PROTECT("add", return NULL)
  19348. result = ((double)a) + (double)b;
  19349. PyFPE_END_PROTECT(result)
  19350. return PyFloat_FromDouble(result);
  19351. }
  19352. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  19353. }
  19354. #endif
  19355. /* None */
  19356. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
  19357. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  19358. }
  19359. /* None */
  19360. static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
  19361. long q = a / b;
  19362. long r = a - q*b;
  19363. q -= ((r != 0) & ((r ^ b) < 0));
  19364. return q;
  19365. }
  19366. /* ImportFrom */
  19367. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  19368. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  19369. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  19370. PyErr_Format(PyExc_ImportError,
  19371. #if PY_MAJOR_VERSION < 3
  19372. "cannot import name %.230s", PyString_AS_STRING(name));
  19373. #else
  19374. "cannot import name %S", name);
  19375. #endif
  19376. }
  19377. return value;
  19378. }
  19379. /* HasAttr */
  19380. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  19381. PyObject *r;
  19382. if (unlikely(!__Pyx_PyBaseString_Check(n))) {
  19383. PyErr_SetString(PyExc_TypeError,
  19384. "hasattr(): attribute name must be string");
  19385. return -1;
  19386. }
  19387. r = __Pyx_GetAttr(o, n);
  19388. if (unlikely(!r)) {
  19389. PyErr_Clear();
  19390. return 0;
  19391. } else {
  19392. Py_DECREF(r);
  19393. return 1;
  19394. }
  19395. }
  19396. /* PyObject_GenericGetAttrNoDict */
  19397. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  19398. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  19399. PyErr_Format(PyExc_AttributeError,
  19400. #if PY_MAJOR_VERSION >= 3
  19401. "'%.50s' object has no attribute '%U'",
  19402. tp->tp_name, attr_name);
  19403. #else
  19404. "'%.50s' object has no attribute '%.400s'",
  19405. tp->tp_name, PyString_AS_STRING(attr_name));
  19406. #endif
  19407. return NULL;
  19408. }
  19409. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  19410. PyObject *descr;
  19411. PyTypeObject *tp = Py_TYPE(obj);
  19412. if (unlikely(!PyString_Check(attr_name))) {
  19413. return PyObject_GenericGetAttr(obj, attr_name);
  19414. }
  19415. assert(!tp->tp_dictoffset);
  19416. descr = _PyType_Lookup(tp, attr_name);
  19417. if (unlikely(!descr)) {
  19418. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  19419. }
  19420. Py_INCREF(descr);
  19421. #if PY_MAJOR_VERSION < 3
  19422. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  19423. #endif
  19424. {
  19425. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  19426. if (unlikely(f)) {
  19427. PyObject *res = f(descr, obj, (PyObject *)tp);
  19428. Py_DECREF(descr);
  19429. return res;
  19430. }
  19431. }
  19432. return descr;
  19433. }
  19434. #endif
  19435. /* PyObject_GenericGetAttr */
  19436. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  19437. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
  19438. if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
  19439. return PyObject_GenericGetAttr(obj, attr_name);
  19440. }
  19441. return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
  19442. }
  19443. #endif
  19444. /* SetVTable */
  19445. static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
  19446. #if PY_VERSION_HEX >= 0x02070000
  19447. PyObject *ob = PyCapsule_New(vtable, 0, 0);
  19448. #else
  19449. PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
  19450. #endif
  19451. if (!ob)
  19452. goto bad;
  19453. if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
  19454. goto bad;
  19455. Py_DECREF(ob);
  19456. return 0;
  19457. bad:
  19458. Py_XDECREF(ob);
  19459. return -1;
  19460. }
  19461. /* SetupReduce */
  19462. static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  19463. int ret;
  19464. PyObject *name_attr;
  19465. name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  19466. if (likely(name_attr)) {
  19467. ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  19468. } else {
  19469. ret = -1;
  19470. }
  19471. if (unlikely(ret < 0)) {
  19472. PyErr_Clear();
  19473. ret = 0;
  19474. }
  19475. Py_XDECREF(name_attr);
  19476. return ret;
  19477. }
  19478. static int __Pyx_setup_reduce(PyObject* type_obj) {
  19479. int ret = 0;
  19480. PyObject *object_reduce = NULL;
  19481. PyObject *object_reduce_ex = NULL;
  19482. PyObject *reduce = NULL;
  19483. PyObject *reduce_ex = NULL;
  19484. PyObject *reduce_cython = NULL;
  19485. PyObject *setstate = NULL;
  19486. PyObject *setstate_cython = NULL;
  19487. #if CYTHON_USE_PYTYPE_LOOKUP
  19488. if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
  19489. #else
  19490. if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
  19491. #endif
  19492. #if CYTHON_USE_PYTYPE_LOOKUP
  19493. object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  19494. #else
  19495. object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  19496. #endif
  19497. reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
  19498. if (reduce_ex == object_reduce_ex) {
  19499. #if CYTHON_USE_PYTYPE_LOOKUP
  19500. object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
  19501. #else
  19502. object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
  19503. #endif
  19504. reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
  19505. if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
  19506. reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
  19507. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  19508. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  19509. setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
  19510. if (!setstate) PyErr_Clear();
  19511. if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
  19512. setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
  19513. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  19514. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  19515. }
  19516. PyType_Modified((PyTypeObject*)type_obj);
  19517. }
  19518. }
  19519. goto __PYX_GOOD;
  19520. __PYX_BAD:
  19521. if (!PyErr_Occurred())
  19522. PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
  19523. ret = -1;
  19524. __PYX_GOOD:
  19525. #if !CYTHON_USE_PYTYPE_LOOKUP
  19526. Py_XDECREF(object_reduce);
  19527. Py_XDECREF(object_reduce_ex);
  19528. #endif
  19529. Py_XDECREF(reduce);
  19530. Py_XDECREF(reduce_ex);
  19531. Py_XDECREF(reduce_cython);
  19532. Py_XDECREF(setstate);
  19533. Py_XDECREF(setstate_cython);
  19534. return ret;
  19535. }
  19536. /* CLineInTraceback */
  19537. #ifndef CYTHON_CLINE_IN_TRACEBACK
  19538. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  19539. PyObject *use_cline;
  19540. PyObject *ptype, *pvalue, *ptraceback;
  19541. #if CYTHON_COMPILING_IN_CPYTHON
  19542. PyObject **cython_runtime_dict;
  19543. #endif
  19544. if (unlikely(!__pyx_cython_runtime)) {
  19545. return c_line;
  19546. }
  19547. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  19548. #if CYTHON_COMPILING_IN_CPYTHON
  19549. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  19550. if (likely(cython_runtime_dict)) {
  19551. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  19552. use_cline, *cython_runtime_dict,
  19553. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  19554. } else
  19555. #endif
  19556. {
  19557. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  19558. if (use_cline_obj) {
  19559. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  19560. Py_DECREF(use_cline_obj);
  19561. } else {
  19562. PyErr_Clear();
  19563. use_cline = NULL;
  19564. }
  19565. }
  19566. if (!use_cline) {
  19567. c_line = 0;
  19568. PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  19569. }
  19570. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  19571. c_line = 0;
  19572. }
  19573. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  19574. return c_line;
  19575. }
  19576. #endif
  19577. /* CodeObjectCache */
  19578. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  19579. int start = 0, mid = 0, end = count - 1;
  19580. if (end >= 0 && code_line > entries[end].code_line) {
  19581. return count;
  19582. }
  19583. while (start < end) {
  19584. mid = start + (end - start) / 2;
  19585. if (code_line < entries[mid].code_line) {
  19586. end = mid;
  19587. } else if (code_line > entries[mid].code_line) {
  19588. start = mid + 1;
  19589. } else {
  19590. return mid;
  19591. }
  19592. }
  19593. if (code_line <= entries[mid].code_line) {
  19594. return mid;
  19595. } else {
  19596. return mid + 1;
  19597. }
  19598. }
  19599. static PyCodeObject *__pyx_find_code_object(int code_line) {
  19600. PyCodeObject* code_object;
  19601. int pos;
  19602. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  19603. return NULL;
  19604. }
  19605. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  19606. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  19607. return NULL;
  19608. }
  19609. code_object = __pyx_code_cache.entries[pos].code_object;
  19610. Py_INCREF(code_object);
  19611. return code_object;
  19612. }
  19613. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  19614. int pos, i;
  19615. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  19616. if (unlikely(!code_line)) {
  19617. return;
  19618. }
  19619. if (unlikely(!entries)) {
  19620. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  19621. if (likely(entries)) {
  19622. __pyx_code_cache.entries = entries;
  19623. __pyx_code_cache.max_count = 64;
  19624. __pyx_code_cache.count = 1;
  19625. entries[0].code_line = code_line;
  19626. entries[0].code_object = code_object;
  19627. Py_INCREF(code_object);
  19628. }
  19629. return;
  19630. }
  19631. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  19632. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  19633. PyCodeObject* tmp = entries[pos].code_object;
  19634. entries[pos].code_object = code_object;
  19635. Py_DECREF(tmp);
  19636. return;
  19637. }
  19638. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  19639. int new_max = __pyx_code_cache.max_count + 64;
  19640. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  19641. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  19642. if (unlikely(!entries)) {
  19643. return;
  19644. }
  19645. __pyx_code_cache.entries = entries;
  19646. __pyx_code_cache.max_count = new_max;
  19647. }
  19648. for (i=__pyx_code_cache.count; i>pos; i--) {
  19649. entries[i] = entries[i-1];
  19650. }
  19651. entries[pos].code_line = code_line;
  19652. entries[pos].code_object = code_object;
  19653. __pyx_code_cache.count++;
  19654. Py_INCREF(code_object);
  19655. }
  19656. /* AddTraceback */
  19657. #include "compile.h"
  19658. #include "frameobject.h"
  19659. #include "traceback.h"
  19660. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  19661. const char *funcname, int c_line,
  19662. int py_line, const char *filename) {
  19663. PyCodeObject *py_code = 0;
  19664. PyObject *py_srcfile = 0;
  19665. PyObject *py_funcname = 0;
  19666. #if PY_MAJOR_VERSION < 3
  19667. py_srcfile = PyString_FromString(filename);
  19668. #else
  19669. py_srcfile = PyUnicode_FromString(filename);
  19670. #endif
  19671. if (!py_srcfile) goto bad;
  19672. if (c_line) {
  19673. #if PY_MAJOR_VERSION < 3
  19674. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  19675. #else
  19676. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  19677. #endif
  19678. }
  19679. else {
  19680. #if PY_MAJOR_VERSION < 3
  19681. py_funcname = PyString_FromString(funcname);
  19682. #else
  19683. py_funcname = PyUnicode_FromString(funcname);
  19684. #endif
  19685. }
  19686. if (!py_funcname) goto bad;
  19687. py_code = __Pyx_PyCode_New(
  19688. 0,
  19689. 0,
  19690. 0,
  19691. 0,
  19692. 0,
  19693. __pyx_empty_bytes, /*PyObject *code,*/
  19694. __pyx_empty_tuple, /*PyObject *consts,*/
  19695. __pyx_empty_tuple, /*PyObject *names,*/
  19696. __pyx_empty_tuple, /*PyObject *varnames,*/
  19697. __pyx_empty_tuple, /*PyObject *freevars,*/
  19698. __pyx_empty_tuple, /*PyObject *cellvars,*/
  19699. py_srcfile, /*PyObject *filename,*/
  19700. py_funcname, /*PyObject *name,*/
  19701. py_line,
  19702. __pyx_empty_bytes /*PyObject *lnotab*/
  19703. );
  19704. Py_DECREF(py_srcfile);
  19705. Py_DECREF(py_funcname);
  19706. return py_code;
  19707. bad:
  19708. Py_XDECREF(py_srcfile);
  19709. Py_XDECREF(py_funcname);
  19710. return NULL;
  19711. }
  19712. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  19713. int py_line, const char *filename) {
  19714. PyCodeObject *py_code = 0;
  19715. PyFrameObject *py_frame = 0;
  19716. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  19717. if (c_line) {
  19718. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  19719. }
  19720. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  19721. if (!py_code) {
  19722. py_code = __Pyx_CreateCodeObjectForTraceback(
  19723. funcname, c_line, py_line, filename);
  19724. if (!py_code) goto bad;
  19725. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  19726. }
  19727. py_frame = PyFrame_New(
  19728. tstate, /*PyThreadState *tstate,*/
  19729. py_code, /*PyCodeObject *code,*/
  19730. __pyx_d, /*PyObject *globals,*/
  19731. 0 /*PyObject *locals*/
  19732. );
  19733. if (!py_frame) goto bad;
  19734. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  19735. PyTraceBack_Here(py_frame);
  19736. bad:
  19737. Py_XDECREF(py_code);
  19738. Py_XDECREF(py_frame);
  19739. }
  19740. #if PY_MAJOR_VERSION < 3
  19741. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  19742. if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  19743. if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
  19744. if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
  19745. PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  19746. return -1;
  19747. }
  19748. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  19749. PyObject *obj = view->obj;
  19750. if (!obj) return;
  19751. if (PyObject_CheckBuffer(obj)) {
  19752. PyBuffer_Release(view);
  19753. return;
  19754. }
  19755. if ((0)) {}
  19756. view->obj = NULL;
  19757. Py_DECREF(obj);
  19758. }
  19759. #endif
  19760. /* MemviewSliceIsContig */
  19761. static int
  19762. __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
  19763. {
  19764. int i, index, step, start;
  19765. Py_ssize_t itemsize = mvs.memview->view.itemsize;
  19766. if (order == 'F') {
  19767. step = 1;
  19768. start = 0;
  19769. } else {
  19770. step = -1;
  19771. start = ndim - 1;
  19772. }
  19773. for (i = 0; i < ndim; i++) {
  19774. index = start + step * i;
  19775. if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
  19776. return 0;
  19777. itemsize *= mvs.shape[index];
  19778. }
  19779. return 1;
  19780. }
  19781. /* OverlappingSlices */
  19782. static void
  19783. __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
  19784. void **out_start, void **out_end,
  19785. int ndim, size_t itemsize)
  19786. {
  19787. char *start, *end;
  19788. int i;
  19789. start = end = slice->data;
  19790. for (i = 0; i < ndim; i++) {
  19791. Py_ssize_t stride = slice->strides[i];
  19792. Py_ssize_t extent = slice->shape[i];
  19793. if (extent == 0) {
  19794. *out_start = *out_end = start;
  19795. return;
  19796. } else {
  19797. if (stride > 0)
  19798. end += stride * (extent - 1);
  19799. else
  19800. start += stride * (extent - 1);
  19801. }
  19802. }
  19803. *out_start = start;
  19804. *out_end = end + itemsize;
  19805. }
  19806. static int
  19807. __pyx_slices_overlap(__Pyx_memviewslice *slice1,
  19808. __Pyx_memviewslice *slice2,
  19809. int ndim, size_t itemsize)
  19810. {
  19811. void *start1, *end1, *start2, *end2;
  19812. __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
  19813. __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
  19814. return (start1 < end2) && (start2 < end1);
  19815. }
  19816. /* Capsule */
  19817. static CYTHON_INLINE PyObject *
  19818. __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
  19819. {
  19820. PyObject *cobj;
  19821. #if PY_VERSION_HEX >= 0x02070000
  19822. cobj = PyCapsule_New(p, sig, NULL);
  19823. #else
  19824. cobj = PyCObject_FromVoidPtr(p, NULL);
  19825. #endif
  19826. return cobj;
  19827. }
  19828. /* CIntToPy */
  19829. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  19830. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  19831. const int is_unsigned = neg_one > const_zero;
  19832. if (is_unsigned) {
  19833. if (sizeof(int) < sizeof(long)) {
  19834. return PyInt_FromLong((long) value);
  19835. } else if (sizeof(int) <= sizeof(unsigned long)) {
  19836. return PyLong_FromUnsignedLong((unsigned long) value);
  19837. #ifdef HAVE_LONG_LONG
  19838. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  19839. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  19840. #endif
  19841. }
  19842. } else {
  19843. if (sizeof(int) <= sizeof(long)) {
  19844. return PyInt_FromLong((long) value);
  19845. #ifdef HAVE_LONG_LONG
  19846. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  19847. return PyLong_FromLongLong((PY_LONG_LONG) value);
  19848. #endif
  19849. }
  19850. }
  19851. {
  19852. int one = 1; int little = (int)*(unsigned char *)&one;
  19853. unsigned char *bytes = (unsigned char *)&value;
  19854. return _PyLong_FromByteArray(bytes, sizeof(int),
  19855. little, !is_unsigned);
  19856. }
  19857. }
  19858. /* CIntFromPyVerify */
  19859. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  19860. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  19861. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  19862. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  19863. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  19864. {\
  19865. func_type value = func_value;\
  19866. if (sizeof(target_type) < sizeof(func_type)) {\
  19867. if (unlikely(value != (func_type) (target_type) value)) {\
  19868. func_type zero = 0;\
  19869. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  19870. return (target_type) -1;\
  19871. if (is_unsigned && unlikely(value < zero))\
  19872. goto raise_neg_overflow;\
  19873. else\
  19874. goto raise_overflow;\
  19875. }\
  19876. }\
  19877. return (target_type) value;\
  19878. }
  19879. /* CIntToPy */
  19880. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  19881. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  19882. const int is_unsigned = neg_one > const_zero;
  19883. if (is_unsigned) {
  19884. if (sizeof(long) < sizeof(long)) {
  19885. return PyInt_FromLong((long) value);
  19886. } else if (sizeof(long) <= sizeof(unsigned long)) {
  19887. return PyLong_FromUnsignedLong((unsigned long) value);
  19888. #ifdef HAVE_LONG_LONG
  19889. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  19890. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  19891. #endif
  19892. }
  19893. } else {
  19894. if (sizeof(long) <= sizeof(long)) {
  19895. return PyInt_FromLong((long) value);
  19896. #ifdef HAVE_LONG_LONG
  19897. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  19898. return PyLong_FromLongLong((PY_LONG_LONG) value);
  19899. #endif
  19900. }
  19901. }
  19902. {
  19903. int one = 1; int little = (int)*(unsigned char *)&one;
  19904. unsigned char *bytes = (unsigned char *)&value;
  19905. return _PyLong_FromByteArray(bytes, sizeof(long),
  19906. little, !is_unsigned);
  19907. }
  19908. }
  19909. /* MemviewSliceCopyTemplate */
  19910. static __Pyx_memviewslice
  19911. __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
  19912. const char *mode, int ndim,
  19913. size_t sizeof_dtype, int contig_flag,
  19914. int dtype_is_object)
  19915. {
  19916. __Pyx_RefNannyDeclarations
  19917. int i;
  19918. __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
  19919. struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
  19920. Py_buffer *buf = &from_memview->view;
  19921. PyObject *shape_tuple = NULL;
  19922. PyObject *temp_int = NULL;
  19923. struct __pyx_array_obj *array_obj = NULL;
  19924. struct __pyx_memoryview_obj *memview_obj = NULL;
  19925. __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
  19926. for (i = 0; i < ndim; i++) {
  19927. if (from_mvs->suboffsets[i] >= 0) {
  19928. PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
  19929. "indirect dimensions (axis %d)", i);
  19930. goto fail;
  19931. }
  19932. }
  19933. shape_tuple = PyTuple_New(ndim);
  19934. if (unlikely(!shape_tuple)) {
  19935. goto fail;
  19936. }
  19937. __Pyx_GOTREF(shape_tuple);
  19938. for(i = 0; i < ndim; i++) {
  19939. temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
  19940. if(unlikely(!temp_int)) {
  19941. goto fail;
  19942. } else {
  19943. PyTuple_SET_ITEM(shape_tuple, i, temp_int);
  19944. temp_int = NULL;
  19945. }
  19946. }
  19947. array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
  19948. if (unlikely(!array_obj)) {
  19949. goto fail;
  19950. }
  19951. __Pyx_GOTREF(array_obj);
  19952. memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
  19953. (PyObject *) array_obj, contig_flag,
  19954. dtype_is_object,
  19955. from_mvs->memview->typeinfo);
  19956. if (unlikely(!memview_obj))
  19957. goto fail;
  19958. if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
  19959. goto fail;
  19960. if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
  19961. dtype_is_object) < 0))
  19962. goto fail;
  19963. goto no_fail;
  19964. fail:
  19965. __Pyx_XDECREF(new_mvs.memview);
  19966. new_mvs.memview = NULL;
  19967. new_mvs.data = NULL;
  19968. no_fail:
  19969. __Pyx_XDECREF(shape_tuple);
  19970. __Pyx_XDECREF(temp_int);
  19971. __Pyx_XDECREF(array_obj);
  19972. __Pyx_RefNannyFinishContext();
  19973. return new_mvs;
  19974. }
  19975. /* CIntFromPy */
  19976. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  19977. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  19978. const int is_unsigned = neg_one > const_zero;
  19979. #if PY_MAJOR_VERSION < 3
  19980. if (likely(PyInt_Check(x))) {
  19981. if (sizeof(int) < sizeof(long)) {
  19982. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  19983. } else {
  19984. long val = PyInt_AS_LONG(x);
  19985. if (is_unsigned && unlikely(val < 0)) {
  19986. goto raise_neg_overflow;
  19987. }
  19988. return (int) val;
  19989. }
  19990. } else
  19991. #endif
  19992. if (likely(PyLong_Check(x))) {
  19993. if (is_unsigned) {
  19994. #if CYTHON_USE_PYLONG_INTERNALS
  19995. const digit* digits = ((PyLongObject*)x)->ob_digit;
  19996. switch (Py_SIZE(x)) {
  19997. case 0: return (int) 0;
  19998. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  19999. case 2:
  20000. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  20001. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20002. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20003. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  20004. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  20005. }
  20006. }
  20007. break;
  20008. case 3:
  20009. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  20010. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20011. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20012. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  20013. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  20014. }
  20015. }
  20016. break;
  20017. case 4:
  20018. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  20019. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20020. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20021. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  20022. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  20023. }
  20024. }
  20025. break;
  20026. }
  20027. #endif
  20028. #if CYTHON_COMPILING_IN_CPYTHON
  20029. if (unlikely(Py_SIZE(x) < 0)) {
  20030. goto raise_neg_overflow;
  20031. }
  20032. #else
  20033. {
  20034. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  20035. if (unlikely(result < 0))
  20036. return (int) -1;
  20037. if (unlikely(result == 1))
  20038. goto raise_neg_overflow;
  20039. }
  20040. #endif
  20041. if (sizeof(int) <= sizeof(unsigned long)) {
  20042. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  20043. #ifdef HAVE_LONG_LONG
  20044. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  20045. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  20046. #endif
  20047. }
  20048. } else {
  20049. #if CYTHON_USE_PYLONG_INTERNALS
  20050. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20051. switch (Py_SIZE(x)) {
  20052. case 0: return (int) 0;
  20053. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  20054. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  20055. case -2:
  20056. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  20057. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20058. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20059. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  20060. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  20061. }
  20062. }
  20063. break;
  20064. case 2:
  20065. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  20066. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20067. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20068. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  20069. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  20070. }
  20071. }
  20072. break;
  20073. case -3:
  20074. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  20075. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20076. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20077. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  20078. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  20079. }
  20080. }
  20081. break;
  20082. case 3:
  20083. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  20084. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20085. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20086. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  20087. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  20088. }
  20089. }
  20090. break;
  20091. case -4:
  20092. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  20093. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20094. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20095. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  20096. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  20097. }
  20098. }
  20099. break;
  20100. case 4:
  20101. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  20102. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20103. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20104. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  20105. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  20106. }
  20107. }
  20108. break;
  20109. }
  20110. #endif
  20111. if (sizeof(int) <= sizeof(long)) {
  20112. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  20113. #ifdef HAVE_LONG_LONG
  20114. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  20115. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  20116. #endif
  20117. }
  20118. }
  20119. {
  20120. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  20121. PyErr_SetString(PyExc_RuntimeError,
  20122. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  20123. #else
  20124. int val;
  20125. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  20126. #if PY_MAJOR_VERSION < 3
  20127. if (likely(v) && !PyLong_Check(v)) {
  20128. PyObject *tmp = v;
  20129. v = PyNumber_Long(tmp);
  20130. Py_DECREF(tmp);
  20131. }
  20132. #endif
  20133. if (likely(v)) {
  20134. int one = 1; int is_little = (int)*(unsigned char *)&one;
  20135. unsigned char *bytes = (unsigned char *)&val;
  20136. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  20137. bytes, sizeof(val),
  20138. is_little, !is_unsigned);
  20139. Py_DECREF(v);
  20140. if (likely(!ret))
  20141. return val;
  20142. }
  20143. #endif
  20144. return (int) -1;
  20145. }
  20146. } else {
  20147. int val;
  20148. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  20149. if (!tmp) return (int) -1;
  20150. val = __Pyx_PyInt_As_int(tmp);
  20151. Py_DECREF(tmp);
  20152. return val;
  20153. }
  20154. raise_overflow:
  20155. PyErr_SetString(PyExc_OverflowError,
  20156. "value too large to convert to int");
  20157. return (int) -1;
  20158. raise_neg_overflow:
  20159. PyErr_SetString(PyExc_OverflowError,
  20160. "can't convert negative value to int");
  20161. return (int) -1;
  20162. }
  20163. /* CIntFromPy */
  20164. static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
  20165. const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
  20166. const int is_unsigned = neg_one > const_zero;
  20167. #if PY_MAJOR_VERSION < 3
  20168. if (likely(PyInt_Check(x))) {
  20169. if (sizeof(size_t) < sizeof(long)) {
  20170. __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
  20171. } else {
  20172. long val = PyInt_AS_LONG(x);
  20173. if (is_unsigned && unlikely(val < 0)) {
  20174. goto raise_neg_overflow;
  20175. }
  20176. return (size_t) val;
  20177. }
  20178. } else
  20179. #endif
  20180. if (likely(PyLong_Check(x))) {
  20181. if (is_unsigned) {
  20182. #if CYTHON_USE_PYLONG_INTERNALS
  20183. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20184. switch (Py_SIZE(x)) {
  20185. case 0: return (size_t) 0;
  20186. case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
  20187. case 2:
  20188. if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
  20189. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20190. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20191. } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
  20192. return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20193. }
  20194. }
  20195. break;
  20196. case 3:
  20197. if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
  20198. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20199. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20200. } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
  20201. return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20202. }
  20203. }
  20204. break;
  20205. case 4:
  20206. if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
  20207. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20208. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20209. } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
  20210. return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  20211. }
  20212. }
  20213. break;
  20214. }
  20215. #endif
  20216. #if CYTHON_COMPILING_IN_CPYTHON
  20217. if (unlikely(Py_SIZE(x) < 0)) {
  20218. goto raise_neg_overflow;
  20219. }
  20220. #else
  20221. {
  20222. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  20223. if (unlikely(result < 0))
  20224. return (size_t) -1;
  20225. if (unlikely(result == 1))
  20226. goto raise_neg_overflow;
  20227. }
  20228. #endif
  20229. if (sizeof(size_t) <= sizeof(unsigned long)) {
  20230. __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
  20231. #ifdef HAVE_LONG_LONG
  20232. } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
  20233. __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  20234. #endif
  20235. }
  20236. } else {
  20237. #if CYTHON_USE_PYLONG_INTERNALS
  20238. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20239. switch (Py_SIZE(x)) {
  20240. case 0: return (size_t) 0;
  20241. case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
  20242. case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
  20243. case -2:
  20244. if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
  20245. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20246. __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20247. } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
  20248. return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  20249. }
  20250. }
  20251. break;
  20252. case 2:
  20253. if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
  20254. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20255. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20256. } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
  20257. return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  20258. }
  20259. }
  20260. break;
  20261. case -3:
  20262. if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
  20263. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20264. __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20265. } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
  20266. return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  20267. }
  20268. }
  20269. break;
  20270. case 3:
  20271. if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
  20272. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20273. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20274. } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
  20275. return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  20276. }
  20277. }
  20278. break;
  20279. case -4:
  20280. if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
  20281. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20282. __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20283. } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
  20284. return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  20285. }
  20286. }
  20287. break;
  20288. case 4:
  20289. if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
  20290. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20291. __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20292. } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
  20293. return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
  20294. }
  20295. }
  20296. break;
  20297. }
  20298. #endif
  20299. if (sizeof(size_t) <= sizeof(long)) {
  20300. __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
  20301. #ifdef HAVE_LONG_LONG
  20302. } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
  20303. __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
  20304. #endif
  20305. }
  20306. }
  20307. {
  20308. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  20309. PyErr_SetString(PyExc_RuntimeError,
  20310. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  20311. #else
  20312. size_t val;
  20313. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  20314. #if PY_MAJOR_VERSION < 3
  20315. if (likely(v) && !PyLong_Check(v)) {
  20316. PyObject *tmp = v;
  20317. v = PyNumber_Long(tmp);
  20318. Py_DECREF(tmp);
  20319. }
  20320. #endif
  20321. if (likely(v)) {
  20322. int one = 1; int is_little = (int)*(unsigned char *)&one;
  20323. unsigned char *bytes = (unsigned char *)&val;
  20324. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  20325. bytes, sizeof(val),
  20326. is_little, !is_unsigned);
  20327. Py_DECREF(v);
  20328. if (likely(!ret))
  20329. return val;
  20330. }
  20331. #endif
  20332. return (size_t) -1;
  20333. }
  20334. } else {
  20335. size_t val;
  20336. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  20337. if (!tmp) return (size_t) -1;
  20338. val = __Pyx_PyInt_As_size_t(tmp);
  20339. Py_DECREF(tmp);
  20340. return val;
  20341. }
  20342. raise_overflow:
  20343. PyErr_SetString(PyExc_OverflowError,
  20344. "value too large to convert to size_t");
  20345. return (size_t) -1;
  20346. raise_neg_overflow:
  20347. PyErr_SetString(PyExc_OverflowError,
  20348. "can't convert negative value to size_t");
  20349. return (size_t) -1;
  20350. }
  20351. /* CIntFromPy */
  20352. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  20353. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  20354. const int is_unsigned = neg_one > const_zero;
  20355. #if PY_MAJOR_VERSION < 3
  20356. if (likely(PyInt_Check(x))) {
  20357. if (sizeof(long) < sizeof(long)) {
  20358. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  20359. } else {
  20360. long val = PyInt_AS_LONG(x);
  20361. if (is_unsigned && unlikely(val < 0)) {
  20362. goto raise_neg_overflow;
  20363. }
  20364. return (long) val;
  20365. }
  20366. } else
  20367. #endif
  20368. if (likely(PyLong_Check(x))) {
  20369. if (is_unsigned) {
  20370. #if CYTHON_USE_PYLONG_INTERNALS
  20371. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20372. switch (Py_SIZE(x)) {
  20373. case 0: return (long) 0;
  20374. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  20375. case 2:
  20376. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  20377. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20378. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20379. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  20380. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  20381. }
  20382. }
  20383. break;
  20384. case 3:
  20385. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  20386. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20387. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20388. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  20389. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  20390. }
  20391. }
  20392. break;
  20393. case 4:
  20394. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  20395. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20396. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20397. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  20398. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  20399. }
  20400. }
  20401. break;
  20402. }
  20403. #endif
  20404. #if CYTHON_COMPILING_IN_CPYTHON
  20405. if (unlikely(Py_SIZE(x) < 0)) {
  20406. goto raise_neg_overflow;
  20407. }
  20408. #else
  20409. {
  20410. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  20411. if (unlikely(result < 0))
  20412. return (long) -1;
  20413. if (unlikely(result == 1))
  20414. goto raise_neg_overflow;
  20415. }
  20416. #endif
  20417. if (sizeof(long) <= sizeof(unsigned long)) {
  20418. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  20419. #ifdef HAVE_LONG_LONG
  20420. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  20421. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  20422. #endif
  20423. }
  20424. } else {
  20425. #if CYTHON_USE_PYLONG_INTERNALS
  20426. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20427. switch (Py_SIZE(x)) {
  20428. case 0: return (long) 0;
  20429. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  20430. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  20431. case -2:
  20432. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  20433. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20434. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20435. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  20436. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  20437. }
  20438. }
  20439. break;
  20440. case 2:
  20441. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  20442. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20443. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20444. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  20445. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  20446. }
  20447. }
  20448. break;
  20449. case -3:
  20450. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  20451. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20452. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20453. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  20454. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  20455. }
  20456. }
  20457. break;
  20458. case 3:
  20459. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  20460. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20461. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20462. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  20463. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  20464. }
  20465. }
  20466. break;
  20467. case -4:
  20468. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  20469. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20470. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20471. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  20472. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  20473. }
  20474. }
  20475. break;
  20476. case 4:
  20477. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  20478. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20479. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20480. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  20481. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  20482. }
  20483. }
  20484. break;
  20485. }
  20486. #endif
  20487. if (sizeof(long) <= sizeof(long)) {
  20488. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  20489. #ifdef HAVE_LONG_LONG
  20490. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  20491. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  20492. #endif
  20493. }
  20494. }
  20495. {
  20496. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  20497. PyErr_SetString(PyExc_RuntimeError,
  20498. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  20499. #else
  20500. long val;
  20501. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  20502. #if PY_MAJOR_VERSION < 3
  20503. if (likely(v) && !PyLong_Check(v)) {
  20504. PyObject *tmp = v;
  20505. v = PyNumber_Long(tmp);
  20506. Py_DECREF(tmp);
  20507. }
  20508. #endif
  20509. if (likely(v)) {
  20510. int one = 1; int is_little = (int)*(unsigned char *)&one;
  20511. unsigned char *bytes = (unsigned char *)&val;
  20512. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  20513. bytes, sizeof(val),
  20514. is_little, !is_unsigned);
  20515. Py_DECREF(v);
  20516. if (likely(!ret))
  20517. return val;
  20518. }
  20519. #endif
  20520. return (long) -1;
  20521. }
  20522. } else {
  20523. long val;
  20524. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  20525. if (!tmp) return (long) -1;
  20526. val = __Pyx_PyInt_As_long(tmp);
  20527. Py_DECREF(tmp);
  20528. return val;
  20529. }
  20530. raise_overflow:
  20531. PyErr_SetString(PyExc_OverflowError,
  20532. "value too large to convert to long");
  20533. return (long) -1;
  20534. raise_neg_overflow:
  20535. PyErr_SetString(PyExc_OverflowError,
  20536. "can't convert negative value to long");
  20537. return (long) -1;
  20538. }
  20539. /* CIntFromPy */
  20540. static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
  20541. const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
  20542. const int is_unsigned = neg_one > const_zero;
  20543. #if PY_MAJOR_VERSION < 3
  20544. if (likely(PyInt_Check(x))) {
  20545. if (sizeof(char) < sizeof(long)) {
  20546. __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
  20547. } else {
  20548. long val = PyInt_AS_LONG(x);
  20549. if (is_unsigned && unlikely(val < 0)) {
  20550. goto raise_neg_overflow;
  20551. }
  20552. return (char) val;
  20553. }
  20554. } else
  20555. #endif
  20556. if (likely(PyLong_Check(x))) {
  20557. if (is_unsigned) {
  20558. #if CYTHON_USE_PYLONG_INTERNALS
  20559. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20560. switch (Py_SIZE(x)) {
  20561. case 0: return (char) 0;
  20562. case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
  20563. case 2:
  20564. if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
  20565. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20566. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20567. } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
  20568. return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  20569. }
  20570. }
  20571. break;
  20572. case 3:
  20573. if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
  20574. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20575. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20576. } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
  20577. return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  20578. }
  20579. }
  20580. break;
  20581. case 4:
  20582. if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
  20583. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20584. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20585. } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
  20586. return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  20587. }
  20588. }
  20589. break;
  20590. }
  20591. #endif
  20592. #if CYTHON_COMPILING_IN_CPYTHON
  20593. if (unlikely(Py_SIZE(x) < 0)) {
  20594. goto raise_neg_overflow;
  20595. }
  20596. #else
  20597. {
  20598. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  20599. if (unlikely(result < 0))
  20600. return (char) -1;
  20601. if (unlikely(result == 1))
  20602. goto raise_neg_overflow;
  20603. }
  20604. #endif
  20605. if (sizeof(char) <= sizeof(unsigned long)) {
  20606. __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
  20607. #ifdef HAVE_LONG_LONG
  20608. } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
  20609. __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  20610. #endif
  20611. }
  20612. } else {
  20613. #if CYTHON_USE_PYLONG_INTERNALS
  20614. const digit* digits = ((PyLongObject*)x)->ob_digit;
  20615. switch (Py_SIZE(x)) {
  20616. case 0: return (char) 0;
  20617. case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
  20618. case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
  20619. case -2:
  20620. if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
  20621. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20622. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20623. } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  20624. return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  20625. }
  20626. }
  20627. break;
  20628. case 2:
  20629. if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
  20630. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  20631. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20632. } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  20633. return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  20634. }
  20635. }
  20636. break;
  20637. case -3:
  20638. if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  20639. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20640. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20641. } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  20642. return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  20643. }
  20644. }
  20645. break;
  20646. case 3:
  20647. if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
  20648. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  20649. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20650. } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  20651. return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  20652. }
  20653. }
  20654. break;
  20655. case -4:
  20656. if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  20657. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20658. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20659. } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
  20660. return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  20661. }
  20662. }
  20663. break;
  20664. case 4:
  20665. if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
  20666. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  20667. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  20668. } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
  20669. return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  20670. }
  20671. }
  20672. break;
  20673. }
  20674. #endif
  20675. if (sizeof(char) <= sizeof(long)) {
  20676. __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
  20677. #ifdef HAVE_LONG_LONG
  20678. } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
  20679. __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
  20680. #endif
  20681. }
  20682. }
  20683. {
  20684. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  20685. PyErr_SetString(PyExc_RuntimeError,
  20686. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  20687. #else
  20688. char val;
  20689. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  20690. #if PY_MAJOR_VERSION < 3
  20691. if (likely(v) && !PyLong_Check(v)) {
  20692. PyObject *tmp = v;
  20693. v = PyNumber_Long(tmp);
  20694. Py_DECREF(tmp);
  20695. }
  20696. #endif
  20697. if (likely(v)) {
  20698. int one = 1; int is_little = (int)*(unsigned char *)&one;
  20699. unsigned char *bytes = (unsigned char *)&val;
  20700. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  20701. bytes, sizeof(val),
  20702. is_little, !is_unsigned);
  20703. Py_DECREF(v);
  20704. if (likely(!ret))
  20705. return val;
  20706. }
  20707. #endif
  20708. return (char) -1;
  20709. }
  20710. } else {
  20711. char val;
  20712. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  20713. if (!tmp) return (char) -1;
  20714. val = __Pyx_PyInt_As_char(tmp);
  20715. Py_DECREF(tmp);
  20716. return val;
  20717. }
  20718. raise_overflow:
  20719. PyErr_SetString(PyExc_OverflowError,
  20720. "value too large to convert to char");
  20721. return (char) -1;
  20722. raise_neg_overflow:
  20723. PyErr_SetString(PyExc_OverflowError,
  20724. "can't convert negative value to char");
  20725. return (char) -1;
  20726. }
  20727. /* IsLittleEndian */
  20728. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
  20729. {
  20730. union {
  20731. uint32_t u32;
  20732. uint8_t u8[4];
  20733. } S;
  20734. S.u32 = 0x01020304;
  20735. return S.u8[0] == 4;
  20736. }
  20737. /* BufferFormatCheck */
  20738. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  20739. __Pyx_BufFmt_StackElem* stack,
  20740. __Pyx_TypeInfo* type) {
  20741. stack[0].field = &ctx->root;
  20742. stack[0].parent_offset = 0;
  20743. ctx->root.type = type;
  20744. ctx->root.name = "buffer dtype";
  20745. ctx->root.offset = 0;
  20746. ctx->head = stack;
  20747. ctx->head->field = &ctx->root;
  20748. ctx->fmt_offset = 0;
  20749. ctx->head->parent_offset = 0;
  20750. ctx->new_packmode = '@';
  20751. ctx->enc_packmode = '@';
  20752. ctx->new_count = 1;
  20753. ctx->enc_count = 0;
  20754. ctx->enc_type = 0;
  20755. ctx->is_complex = 0;
  20756. ctx->is_valid_array = 0;
  20757. ctx->struct_alignment = 0;
  20758. while (type->typegroup == 'S') {
  20759. ++ctx->head;
  20760. ctx->head->field = type->fields;
  20761. ctx->head->parent_offset = 0;
  20762. type = type->fields->type;
  20763. }
  20764. }
  20765. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  20766. int count;
  20767. const char* t = *ts;
  20768. if (*t < '0' || *t > '9') {
  20769. return -1;
  20770. } else {
  20771. count = *t++ - '0';
  20772. while (*t >= '0' && *t <= '9') {
  20773. count *= 10;
  20774. count += *t++ - '0';
  20775. }
  20776. }
  20777. *ts = t;
  20778. return count;
  20779. }
  20780. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  20781. int number = __Pyx_BufFmt_ParseNumber(ts);
  20782. if (number == -1)
  20783. PyErr_Format(PyExc_ValueError,\
  20784. "Does not understand character buffer dtype format string ('%c')", **ts);
  20785. return number;
  20786. }
  20787. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  20788. PyErr_Format(PyExc_ValueError,
  20789. "Unexpected format string character: '%c'", ch);
  20790. }
  20791. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  20792. switch (ch) {
  20793. case '?': return "'bool'";
  20794. case 'c': return "'char'";
  20795. case 'b': return "'signed char'";
  20796. case 'B': return "'unsigned char'";
  20797. case 'h': return "'short'";
  20798. case 'H': return "'unsigned short'";
  20799. case 'i': return "'int'";
  20800. case 'I': return "'unsigned int'";
  20801. case 'l': return "'long'";
  20802. case 'L': return "'unsigned long'";
  20803. case 'q': return "'long long'";
  20804. case 'Q': return "'unsigned long long'";
  20805. case 'f': return (is_complex ? "'complex float'" : "'float'");
  20806. case 'd': return (is_complex ? "'complex double'" : "'double'");
  20807. case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  20808. case 'T': return "a struct";
  20809. case 'O': return "Python object";
  20810. case 'P': return "a pointer";
  20811. case 's': case 'p': return "a string";
  20812. case 0: return "end";
  20813. default: return "unparseable format string";
  20814. }
  20815. }
  20816. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  20817. switch (ch) {
  20818. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  20819. case 'h': case 'H': return 2;
  20820. case 'i': case 'I': case 'l': case 'L': return 4;
  20821. case 'q': case 'Q': return 8;
  20822. case 'f': return (is_complex ? 8 : 4);
  20823. case 'd': return (is_complex ? 16 : 8);
  20824. case 'g': {
  20825. PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  20826. return 0;
  20827. }
  20828. case 'O': case 'P': return sizeof(void*);
  20829. default:
  20830. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  20831. return 0;
  20832. }
  20833. }
  20834. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  20835. switch (ch) {
  20836. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  20837. case 'h': case 'H': return sizeof(short);
  20838. case 'i': case 'I': return sizeof(int);
  20839. case 'l': case 'L': return sizeof(long);
  20840. #ifdef HAVE_LONG_LONG
  20841. case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  20842. #endif
  20843. case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  20844. case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  20845. case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  20846. case 'O': case 'P': return sizeof(void*);
  20847. default: {
  20848. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  20849. return 0;
  20850. }
  20851. }
  20852. }
  20853. typedef struct { char c; short x; } __Pyx_st_short;
  20854. typedef struct { char c; int x; } __Pyx_st_int;
  20855. typedef struct { char c; long x; } __Pyx_st_long;
  20856. typedef struct { char c; float x; } __Pyx_st_float;
  20857. typedef struct { char c; double x; } __Pyx_st_double;
  20858. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  20859. typedef struct { char c; void *x; } __Pyx_st_void_p;
  20860. #ifdef HAVE_LONG_LONG
  20861. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  20862. #endif
  20863. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  20864. switch (ch) {
  20865. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  20866. case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  20867. case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  20868. case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  20869. #ifdef HAVE_LONG_LONG
  20870. case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  20871. #endif
  20872. case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  20873. case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  20874. case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  20875. case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  20876. default:
  20877. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  20878. return 0;
  20879. }
  20880. }
  20881. /* These are for computing the padding at the end of the struct to align
  20882. on the first member of the struct. This will probably the same as above,
  20883. but we don't have any guarantees.
  20884. */
  20885. typedef struct { short x; char c; } __Pyx_pad_short;
  20886. typedef struct { int x; char c; } __Pyx_pad_int;
  20887. typedef struct { long x; char c; } __Pyx_pad_long;
  20888. typedef struct { float x; char c; } __Pyx_pad_float;
  20889. typedef struct { double x; char c; } __Pyx_pad_double;
  20890. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  20891. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  20892. #ifdef HAVE_LONG_LONG
  20893. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  20894. #endif
  20895. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  20896. switch (ch) {
  20897. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  20898. case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  20899. case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  20900. case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  20901. #ifdef HAVE_LONG_LONG
  20902. case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  20903. #endif
  20904. case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  20905. case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  20906. case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  20907. case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  20908. default:
  20909. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  20910. return 0;
  20911. }
  20912. }
  20913. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  20914. switch (ch) {
  20915. case 'c':
  20916. return 'H';
  20917. case 'b': case 'h': case 'i':
  20918. case 'l': case 'q': case 's': case 'p':
  20919. return 'I';
  20920. case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
  20921. return 'U';
  20922. case 'f': case 'd': case 'g':
  20923. return (is_complex ? 'C' : 'R');
  20924. case 'O':
  20925. return 'O';
  20926. case 'P':
  20927. return 'P';
  20928. default: {
  20929. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  20930. return 0;
  20931. }
  20932. }
  20933. }
  20934. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  20935. if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  20936. const char* expected;
  20937. const char* quote;
  20938. if (ctx->head == NULL) {
  20939. expected = "end";
  20940. quote = "";
  20941. } else {
  20942. expected = ctx->head->field->type->name;
  20943. quote = "'";
  20944. }
  20945. PyErr_Format(PyExc_ValueError,
  20946. "Buffer dtype mismatch, expected %s%s%s but got %s",
  20947. quote, expected, quote,
  20948. __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  20949. } else {
  20950. __Pyx_StructField* field = ctx->head->field;
  20951. __Pyx_StructField* parent = (ctx->head - 1)->field;
  20952. PyErr_Format(PyExc_ValueError,
  20953. "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  20954. field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  20955. parent->type->name, field->name);
  20956. }
  20957. }
  20958. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  20959. char group;
  20960. size_t size, offset, arraysize = 1;
  20961. if (ctx->enc_type == 0) return 0;
  20962. if (ctx->head->field->type->arraysize[0]) {
  20963. int i, ndim = 0;
  20964. if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  20965. ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  20966. ndim = 1;
  20967. if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  20968. PyErr_Format(PyExc_ValueError,
  20969. "Expected a dimension of size %zu, got %zu",
  20970. ctx->head->field->type->arraysize[0], ctx->enc_count);
  20971. return -1;
  20972. }
  20973. }
  20974. if (!ctx->is_valid_array) {
  20975. PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  20976. ctx->head->field->type->ndim, ndim);
  20977. return -1;
  20978. }
  20979. for (i = 0; i < ctx->head->field->type->ndim; i++) {
  20980. arraysize *= ctx->head->field->type->arraysize[i];
  20981. }
  20982. ctx->is_valid_array = 0;
  20983. ctx->enc_count = 1;
  20984. }
  20985. group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  20986. do {
  20987. __Pyx_StructField* field = ctx->head->field;
  20988. __Pyx_TypeInfo* type = field->type;
  20989. if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  20990. size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  20991. } else {
  20992. size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  20993. }
  20994. if (ctx->enc_packmode == '@') {
  20995. size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  20996. size_t align_mod_offset;
  20997. if (align_at == 0) return -1;
  20998. align_mod_offset = ctx->fmt_offset % align_at;
  20999. if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  21000. if (ctx->struct_alignment == 0)
  21001. ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  21002. ctx->is_complex);
  21003. }
  21004. if (type->size != size || type->typegroup != group) {
  21005. if (type->typegroup == 'C' && type->fields != NULL) {
  21006. size_t parent_offset = ctx->head->parent_offset + field->offset;
  21007. ++ctx->head;
  21008. ctx->head->field = type->fields;
  21009. ctx->head->parent_offset = parent_offset;
  21010. continue;
  21011. }
  21012. if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  21013. } else {
  21014. __Pyx_BufFmt_RaiseExpected(ctx);
  21015. return -1;
  21016. }
  21017. }
  21018. offset = ctx->head->parent_offset + field->offset;
  21019. if (ctx->fmt_offset != offset) {
  21020. PyErr_Format(PyExc_ValueError,
  21021. "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  21022. (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  21023. return -1;
  21024. }
  21025. ctx->fmt_offset += size;
  21026. if (arraysize)
  21027. ctx->fmt_offset += (arraysize - 1) * size;
  21028. --ctx->enc_count;
  21029. while (1) {
  21030. if (field == &ctx->root) {
  21031. ctx->head = NULL;
  21032. if (ctx->enc_count != 0) {
  21033. __Pyx_BufFmt_RaiseExpected(ctx);
  21034. return -1;
  21035. }
  21036. break;
  21037. }
  21038. ctx->head->field = ++field;
  21039. if (field->type == NULL) {
  21040. --ctx->head;
  21041. field = ctx->head->field;
  21042. continue;
  21043. } else if (field->type->typegroup == 'S') {
  21044. size_t parent_offset = ctx->head->parent_offset + field->offset;
  21045. if (field->type->fields->type == NULL) continue;
  21046. field = field->type->fields;
  21047. ++ctx->head;
  21048. ctx->head->field = field;
  21049. ctx->head->parent_offset = parent_offset;
  21050. break;
  21051. } else {
  21052. break;
  21053. }
  21054. }
  21055. } while (ctx->enc_count);
  21056. ctx->enc_type = 0;
  21057. ctx->is_complex = 0;
  21058. return 0;
  21059. }
  21060. static PyObject *
  21061. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  21062. {
  21063. const char *ts = *tsp;
  21064. int i = 0, number;
  21065. int ndim = ctx->head->field->type->ndim;
  21066. ;
  21067. ++ts;
  21068. if (ctx->new_count != 1) {
  21069. PyErr_SetString(PyExc_ValueError,
  21070. "Cannot handle repeated arrays in format string");
  21071. return NULL;
  21072. }
  21073. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  21074. while (*ts && *ts != ')') {
  21075. switch (*ts) {
  21076. case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
  21077. default: break;
  21078. }
  21079. number = __Pyx_BufFmt_ExpectNumber(&ts);
  21080. if (number == -1) return NULL;
  21081. if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  21082. return PyErr_Format(PyExc_ValueError,
  21083. "Expected a dimension of size %zu, got %d",
  21084. ctx->head->field->type->arraysize[i], number);
  21085. if (*ts != ',' && *ts != ')')
  21086. return PyErr_Format(PyExc_ValueError,
  21087. "Expected a comma in format string, got '%c'", *ts);
  21088. if (*ts == ',') ts++;
  21089. i++;
  21090. }
  21091. if (i != ndim)
  21092. return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  21093. ctx->head->field->type->ndim, i);
  21094. if (!*ts) {
  21095. PyErr_SetString(PyExc_ValueError,
  21096. "Unexpected end of format string, expected ')'");
  21097. return NULL;
  21098. }
  21099. ctx->is_valid_array = 1;
  21100. ctx->new_count = 1;
  21101. *tsp = ++ts;
  21102. return Py_None;
  21103. }
  21104. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  21105. int got_Z = 0;
  21106. while (1) {
  21107. switch(*ts) {
  21108. case 0:
  21109. if (ctx->enc_type != 0 && ctx->head == NULL) {
  21110. __Pyx_BufFmt_RaiseExpected(ctx);
  21111. return NULL;
  21112. }
  21113. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  21114. if (ctx->head != NULL) {
  21115. __Pyx_BufFmt_RaiseExpected(ctx);
  21116. return NULL;
  21117. }
  21118. return ts;
  21119. case ' ':
  21120. case '\r':
  21121. case '\n':
  21122. ++ts;
  21123. break;
  21124. case '<':
  21125. if (!__Pyx_Is_Little_Endian()) {
  21126. PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  21127. return NULL;
  21128. }
  21129. ctx->new_packmode = '=';
  21130. ++ts;
  21131. break;
  21132. case '>':
  21133. case '!':
  21134. if (__Pyx_Is_Little_Endian()) {
  21135. PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  21136. return NULL;
  21137. }
  21138. ctx->new_packmode = '=';
  21139. ++ts;
  21140. break;
  21141. case '=':
  21142. case '@':
  21143. case '^':
  21144. ctx->new_packmode = *ts++;
  21145. break;
  21146. case 'T':
  21147. {
  21148. const char* ts_after_sub;
  21149. size_t i, struct_count = ctx->new_count;
  21150. size_t struct_alignment = ctx->struct_alignment;
  21151. ctx->new_count = 1;
  21152. ++ts;
  21153. if (*ts != '{') {
  21154. PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  21155. return NULL;
  21156. }
  21157. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  21158. ctx->enc_type = 0;
  21159. ctx->enc_count = 0;
  21160. ctx->struct_alignment = 0;
  21161. ++ts;
  21162. ts_after_sub = ts;
  21163. for (i = 0; i != struct_count; ++i) {
  21164. ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  21165. if (!ts_after_sub) return NULL;
  21166. }
  21167. ts = ts_after_sub;
  21168. if (struct_alignment) ctx->struct_alignment = struct_alignment;
  21169. }
  21170. break;
  21171. case '}':
  21172. {
  21173. size_t alignment = ctx->struct_alignment;
  21174. ++ts;
  21175. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  21176. ctx->enc_type = 0;
  21177. if (alignment && ctx->fmt_offset % alignment) {
  21178. ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  21179. }
  21180. }
  21181. return ts;
  21182. case 'x':
  21183. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  21184. ctx->fmt_offset += ctx->new_count;
  21185. ctx->new_count = 1;
  21186. ctx->enc_count = 0;
  21187. ctx->enc_type = 0;
  21188. ctx->enc_packmode = ctx->new_packmode;
  21189. ++ts;
  21190. break;
  21191. case 'Z':
  21192. got_Z = 1;
  21193. ++ts;
  21194. if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  21195. __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  21196. return NULL;
  21197. }
  21198. CYTHON_FALLTHROUGH;
  21199. case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  21200. case 'l': case 'L': case 'q': case 'Q':
  21201. case 'f': case 'd': case 'g':
  21202. case 'O': case 'p':
  21203. if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
  21204. ctx->enc_packmode == ctx->new_packmode) {
  21205. ctx->enc_count += ctx->new_count;
  21206. ctx->new_count = 1;
  21207. got_Z = 0;
  21208. ++ts;
  21209. break;
  21210. }
  21211. CYTHON_FALLTHROUGH;
  21212. case 's':
  21213. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  21214. ctx->enc_count = ctx->new_count;
  21215. ctx->enc_packmode = ctx->new_packmode;
  21216. ctx->enc_type = *ts;
  21217. ctx->is_complex = got_Z;
  21218. ++ts;
  21219. ctx->new_count = 1;
  21220. got_Z = 0;
  21221. break;
  21222. case ':':
  21223. ++ts;
  21224. while(*ts != ':') ++ts;
  21225. ++ts;
  21226. break;
  21227. case '(':
  21228. if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  21229. break;
  21230. default:
  21231. {
  21232. int number = __Pyx_BufFmt_ExpectNumber(&ts);
  21233. if (number == -1) return NULL;
  21234. ctx->new_count = (size_t)number;
  21235. }
  21236. }
  21237. }
  21238. }
  21239. /* TypeInfoCompare */
  21240. static int
  21241. __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
  21242. {
  21243. int i;
  21244. if (!a || !b)
  21245. return 0;
  21246. if (a == b)
  21247. return 1;
  21248. if (a->size != b->size || a->typegroup != b->typegroup ||
  21249. a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
  21250. if (a->typegroup == 'H' || b->typegroup == 'H') {
  21251. return a->size == b->size;
  21252. } else {
  21253. return 0;
  21254. }
  21255. }
  21256. if (a->ndim) {
  21257. for (i = 0; i < a->ndim; i++)
  21258. if (a->arraysize[i] != b->arraysize[i])
  21259. return 0;
  21260. }
  21261. if (a->typegroup == 'S') {
  21262. if (a->flags != b->flags)
  21263. return 0;
  21264. if (a->fields || b->fields) {
  21265. if (!(a->fields && b->fields))
  21266. return 0;
  21267. for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
  21268. __Pyx_StructField *field_a = a->fields + i;
  21269. __Pyx_StructField *field_b = b->fields + i;
  21270. if (field_a->offset != field_b->offset ||
  21271. !__pyx_typeinfo_cmp(field_a->type, field_b->type))
  21272. return 0;
  21273. }
  21274. return !a->fields[i].type && !b->fields[i].type;
  21275. }
  21276. }
  21277. return 1;
  21278. }
  21279. /* MemviewSliceValidateAndInit */
  21280. static int
  21281. __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
  21282. {
  21283. if (buf->shape[dim] <= 1)
  21284. return 1;
  21285. if (buf->strides) {
  21286. if (spec & __Pyx_MEMVIEW_CONTIG) {
  21287. if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
  21288. if (buf->strides[dim] != sizeof(void *)) {
  21289. PyErr_Format(PyExc_ValueError,
  21290. "Buffer is not indirectly contiguous "
  21291. "in dimension %d.", dim);
  21292. goto fail;
  21293. }
  21294. } else if (buf->strides[dim] != buf->itemsize) {
  21295. PyErr_SetString(PyExc_ValueError,
  21296. "Buffer and memoryview are not contiguous "
  21297. "in the same dimension.");
  21298. goto fail;
  21299. }
  21300. }
  21301. if (spec & __Pyx_MEMVIEW_FOLLOW) {
  21302. Py_ssize_t stride = buf->strides[dim];
  21303. if (stride < 0)
  21304. stride = -stride;
  21305. if (stride < buf->itemsize) {
  21306. PyErr_SetString(PyExc_ValueError,
  21307. "Buffer and memoryview are not contiguous "
  21308. "in the same dimension.");
  21309. goto fail;
  21310. }
  21311. }
  21312. } else {
  21313. if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
  21314. PyErr_Format(PyExc_ValueError,
  21315. "C-contiguous buffer is not contiguous in "
  21316. "dimension %d", dim);
  21317. goto fail;
  21318. } else if (spec & (__Pyx_MEMVIEW_PTR)) {
  21319. PyErr_Format(PyExc_ValueError,
  21320. "C-contiguous buffer is not indirect in "
  21321. "dimension %d", dim);
  21322. goto fail;
  21323. } else if (buf->suboffsets) {
  21324. PyErr_SetString(PyExc_ValueError,
  21325. "Buffer exposes suboffsets but no strides");
  21326. goto fail;
  21327. }
  21328. }
  21329. return 1;
  21330. fail:
  21331. return 0;
  21332. }
  21333. static int
  21334. __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
  21335. {
  21336. if (spec & __Pyx_MEMVIEW_DIRECT) {
  21337. if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
  21338. PyErr_Format(PyExc_ValueError,
  21339. "Buffer not compatible with direct access "
  21340. "in dimension %d.", dim);
  21341. goto fail;
  21342. }
  21343. }
  21344. if (spec & __Pyx_MEMVIEW_PTR) {
  21345. if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
  21346. PyErr_Format(PyExc_ValueError,
  21347. "Buffer is not indirectly accessible "
  21348. "in dimension %d.", dim);
  21349. goto fail;
  21350. }
  21351. }
  21352. return 1;
  21353. fail:
  21354. return 0;
  21355. }
  21356. static int
  21357. __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
  21358. {
  21359. int i;
  21360. if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
  21361. Py_ssize_t stride = 1;
  21362. for (i = 0; i < ndim; i++) {
  21363. if (stride * buf->itemsize != buf->strides[i] &&
  21364. buf->shape[i] > 1)
  21365. {
  21366. PyErr_SetString(PyExc_ValueError,
  21367. "Buffer not fortran contiguous.");
  21368. goto fail;
  21369. }
  21370. stride = stride * buf->shape[i];
  21371. }
  21372. } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
  21373. Py_ssize_t stride = 1;
  21374. for (i = ndim - 1; i >- 1; i--) {
  21375. if (stride * buf->itemsize != buf->strides[i] &&
  21376. buf->shape[i] > 1) {
  21377. PyErr_SetString(PyExc_ValueError,
  21378. "Buffer not C contiguous.");
  21379. goto fail;
  21380. }
  21381. stride = stride * buf->shape[i];
  21382. }
  21383. }
  21384. return 1;
  21385. fail:
  21386. return 0;
  21387. }
  21388. static int __Pyx_ValidateAndInit_memviewslice(
  21389. int *axes_specs,
  21390. int c_or_f_flag,
  21391. int buf_flags,
  21392. int ndim,
  21393. __Pyx_TypeInfo *dtype,
  21394. __Pyx_BufFmt_StackElem stack[],
  21395. __Pyx_memviewslice *memviewslice,
  21396. PyObject *original_obj)
  21397. {
  21398. struct __pyx_memoryview_obj *memview, *new_memview;
  21399. __Pyx_RefNannyDeclarations
  21400. Py_buffer *buf;
  21401. int i, spec = 0, retval = -1;
  21402. __Pyx_BufFmt_Context ctx;
  21403. int from_memoryview = __pyx_memoryview_check(original_obj);
  21404. __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
  21405. if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
  21406. original_obj)->typeinfo)) {
  21407. memview = (struct __pyx_memoryview_obj *) original_obj;
  21408. new_memview = NULL;
  21409. } else {
  21410. memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
  21411. original_obj, buf_flags, 0, dtype);
  21412. new_memview = memview;
  21413. if (unlikely(!memview))
  21414. goto fail;
  21415. }
  21416. buf = &memview->view;
  21417. if (buf->ndim != ndim) {
  21418. PyErr_Format(PyExc_ValueError,
  21419. "Buffer has wrong number of dimensions (expected %d, got %d)",
  21420. ndim, buf->ndim);
  21421. goto fail;
  21422. }
  21423. if (new_memview) {
  21424. __Pyx_BufFmt_Init(&ctx, stack, dtype);
  21425. if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  21426. }
  21427. if ((unsigned) buf->itemsize != dtype->size) {
  21428. PyErr_Format(PyExc_ValueError,
  21429. "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
  21430. "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
  21431. buf->itemsize,
  21432. (buf->itemsize > 1) ? "s" : "",
  21433. dtype->name,
  21434. dtype->size,
  21435. (dtype->size > 1) ? "s" : "");
  21436. goto fail;
  21437. }
  21438. for (i = 0; i < ndim; i++) {
  21439. spec = axes_specs[i];
  21440. if (!__pyx_check_strides(buf, i, ndim, spec))
  21441. goto fail;
  21442. if (!__pyx_check_suboffsets(buf, i, ndim, spec))
  21443. goto fail;
  21444. }
  21445. if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
  21446. goto fail;
  21447. if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
  21448. new_memview != NULL) == -1)) {
  21449. goto fail;
  21450. }
  21451. retval = 0;
  21452. goto no_fail;
  21453. fail:
  21454. Py_XDECREF(new_memview);
  21455. retval = -1;
  21456. no_fail:
  21457. __Pyx_RefNannyFinishContext();
  21458. return retval;
  21459. }
  21460. /* ObjectToMemviewSlice */
  21461. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj, int writable_flag) {
  21462. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  21463. __Pyx_BufFmt_StackElem stack[1];
  21464. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  21465. int retcode;
  21466. if (obj == Py_None) {
  21467. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  21468. return result;
  21469. }
  21470. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  21471. PyBUF_RECORDS_RO | writable_flag, 2,
  21472. &__Pyx_TypeInfo_int, stack,
  21473. &result, obj);
  21474. if (unlikely(retcode == -1))
  21475. goto __pyx_fail;
  21476. return result;
  21477. __pyx_fail:
  21478. result.memview = NULL;
  21479. result.data = NULL;
  21480. return result;
  21481. }
  21482. /* ObjectToMemviewSlice */
  21483. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(PyObject *obj, int writable_flag) {
  21484. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  21485. __Pyx_BufFmt_StackElem stack[1];
  21486. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  21487. int retcode;
  21488. if (obj == Py_None) {
  21489. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  21490. return result;
  21491. }
  21492. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  21493. PyBUF_RECORDS_RO | writable_flag, 3,
  21494. &__Pyx_TypeInfo_float, stack,
  21495. &result, obj);
  21496. if (unlikely(retcode == -1))
  21497. goto __pyx_fail;
  21498. return result;
  21499. __pyx_fail:
  21500. result.memview = NULL;
  21501. result.data = NULL;
  21502. return result;
  21503. }
  21504. /* ObjectToMemviewSlice */
  21505. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj, int writable_flag) {
  21506. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  21507. __Pyx_BufFmt_StackElem stack[1];
  21508. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  21509. int retcode;
  21510. if (obj == Py_None) {
  21511. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  21512. return result;
  21513. }
  21514. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  21515. PyBUF_RECORDS_RO | writable_flag, 2,
  21516. &__Pyx_TypeInfo_float, stack,
  21517. &result, obj);
  21518. if (unlikely(retcode == -1))
  21519. goto __pyx_fail;
  21520. return result;
  21521. __pyx_fail:
  21522. result.memview = NULL;
  21523. result.data = NULL;
  21524. return result;
  21525. }
  21526. /* CheckBinaryVersion */
  21527. static int __Pyx_check_binary_version(void) {
  21528. char ctversion[4], rtversion[4];
  21529. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  21530. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  21531. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  21532. char message[200];
  21533. PyOS_snprintf(message, sizeof(message),
  21534. "compiletime version %s of module '%.100s' "
  21535. "does not match runtime version %s",
  21536. ctversion, __Pyx_MODULE_NAME, rtversion);
  21537. return PyErr_WarnEx(NULL, message, 1);
  21538. }
  21539. return 0;
  21540. }
  21541. /* InitStrings */
  21542. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  21543. while (t->p) {
  21544. #if PY_MAJOR_VERSION < 3
  21545. if (t->is_unicode) {
  21546. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  21547. } else if (t->intern) {
  21548. *t->p = PyString_InternFromString(t->s);
  21549. } else {
  21550. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  21551. }
  21552. #else
  21553. if (t->is_unicode | t->is_str) {
  21554. if (t->intern) {
  21555. *t->p = PyUnicode_InternFromString(t->s);
  21556. } else if (t->encoding) {
  21557. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  21558. } else {
  21559. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  21560. }
  21561. } else {
  21562. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  21563. }
  21564. #endif
  21565. if (!*t->p)
  21566. return -1;
  21567. if (PyObject_Hash(*t->p) == -1)
  21568. return -1;
  21569. ++t;
  21570. }
  21571. return 0;
  21572. }
  21573. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  21574. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  21575. }
  21576. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  21577. Py_ssize_t ignore;
  21578. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  21579. }
  21580. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  21581. #if !CYTHON_PEP393_ENABLED
  21582. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  21583. char* defenc_c;
  21584. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  21585. if (!defenc) return NULL;
  21586. defenc_c = PyBytes_AS_STRING(defenc);
  21587. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  21588. {
  21589. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  21590. char* c;
  21591. for (c = defenc_c; c < end; c++) {
  21592. if ((unsigned char) (*c) >= 128) {
  21593. PyUnicode_AsASCIIString(o);
  21594. return NULL;
  21595. }
  21596. }
  21597. }
  21598. #endif
  21599. *length = PyBytes_GET_SIZE(defenc);
  21600. return defenc_c;
  21601. }
  21602. #else
  21603. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  21604. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  21605. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  21606. if (likely(PyUnicode_IS_ASCII(o))) {
  21607. *length = PyUnicode_GET_LENGTH(o);
  21608. return PyUnicode_AsUTF8(o);
  21609. } else {
  21610. PyUnicode_AsASCIIString(o);
  21611. return NULL;
  21612. }
  21613. #else
  21614. return PyUnicode_AsUTF8AndSize(o, length);
  21615. #endif
  21616. }
  21617. #endif
  21618. #endif
  21619. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  21620. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  21621. if (
  21622. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  21623. __Pyx_sys_getdefaultencoding_not_ascii &&
  21624. #endif
  21625. PyUnicode_Check(o)) {
  21626. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  21627. } else
  21628. #endif
  21629. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  21630. if (PyByteArray_Check(o)) {
  21631. *length = PyByteArray_GET_SIZE(o);
  21632. return PyByteArray_AS_STRING(o);
  21633. } else
  21634. #endif
  21635. {
  21636. char* result;
  21637. int r = PyBytes_AsStringAndSize(o, &result, length);
  21638. if (unlikely(r < 0)) {
  21639. return NULL;
  21640. } else {
  21641. return result;
  21642. }
  21643. }
  21644. }
  21645. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  21646. int is_true = x == Py_True;
  21647. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  21648. else return PyObject_IsTrue(x);
  21649. }
  21650. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  21651. int retval;
  21652. if (unlikely(!x)) return -1;
  21653. retval = __Pyx_PyObject_IsTrue(x);
  21654. Py_DECREF(x);
  21655. return retval;
  21656. }
  21657. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  21658. #if PY_MAJOR_VERSION >= 3
  21659. if (PyLong_Check(result)) {
  21660. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  21661. "__int__ returned non-int (type %.200s). "
  21662. "The ability to return an instance of a strict subclass of int "
  21663. "is deprecated, and may be removed in a future version of Python.",
  21664. Py_TYPE(result)->tp_name)) {
  21665. Py_DECREF(result);
  21666. return NULL;
  21667. }
  21668. return result;
  21669. }
  21670. #endif
  21671. PyErr_Format(PyExc_TypeError,
  21672. "__%.4s__ returned non-%.4s (type %.200s)",
  21673. type_name, type_name, Py_TYPE(result)->tp_name);
  21674. Py_DECREF(result);
  21675. return NULL;
  21676. }
  21677. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  21678. #if CYTHON_USE_TYPE_SLOTS
  21679. PyNumberMethods *m;
  21680. #endif
  21681. const char *name = NULL;
  21682. PyObject *res = NULL;
  21683. #if PY_MAJOR_VERSION < 3
  21684. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  21685. #else
  21686. if (likely(PyLong_Check(x)))
  21687. #endif
  21688. return __Pyx_NewRef(x);
  21689. #if CYTHON_USE_TYPE_SLOTS
  21690. m = Py_TYPE(x)->tp_as_number;
  21691. #if PY_MAJOR_VERSION < 3
  21692. if (m && m->nb_int) {
  21693. name = "int";
  21694. res = m->nb_int(x);
  21695. }
  21696. else if (m && m->nb_long) {
  21697. name = "long";
  21698. res = m->nb_long(x);
  21699. }
  21700. #else
  21701. if (likely(m && m->nb_int)) {
  21702. name = "int";
  21703. res = m->nb_int(x);
  21704. }
  21705. #endif
  21706. #else
  21707. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  21708. res = PyNumber_Int(x);
  21709. }
  21710. #endif
  21711. if (likely(res)) {
  21712. #if PY_MAJOR_VERSION < 3
  21713. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  21714. #else
  21715. if (unlikely(!PyLong_CheckExact(res))) {
  21716. #endif
  21717. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  21718. }
  21719. }
  21720. else if (!PyErr_Occurred()) {
  21721. PyErr_SetString(PyExc_TypeError,
  21722. "an integer is required");
  21723. }
  21724. return res;
  21725. }
  21726. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  21727. Py_ssize_t ival;
  21728. PyObject *x;
  21729. #if PY_MAJOR_VERSION < 3
  21730. if (likely(PyInt_CheckExact(b))) {
  21731. if (sizeof(Py_ssize_t) >= sizeof(long))
  21732. return PyInt_AS_LONG(b);
  21733. else
  21734. return PyInt_AsSsize_t(b);
  21735. }
  21736. #endif
  21737. if (likely(PyLong_CheckExact(b))) {
  21738. #if CYTHON_USE_PYLONG_INTERNALS
  21739. const digit* digits = ((PyLongObject*)b)->ob_digit;
  21740. const Py_ssize_t size = Py_SIZE(b);
  21741. if (likely(__Pyx_sst_abs(size) <= 1)) {
  21742. ival = likely(size) ? digits[0] : 0;
  21743. if (size == -1) ival = -ival;
  21744. return ival;
  21745. } else {
  21746. switch (size) {
  21747. case 2:
  21748. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  21749. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  21750. }
  21751. break;
  21752. case -2:
  21753. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  21754. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  21755. }
  21756. break;
  21757. case 3:
  21758. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  21759. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  21760. }
  21761. break;
  21762. case -3:
  21763. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  21764. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  21765. }
  21766. break;
  21767. case 4:
  21768. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  21769. return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  21770. }
  21771. break;
  21772. case -4:
  21773. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  21774. return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  21775. }
  21776. break;
  21777. }
  21778. }
  21779. #endif
  21780. return PyLong_AsSsize_t(b);
  21781. }
  21782. x = PyNumber_Index(b);
  21783. if (!x) return -1;
  21784. ival = PyInt_AsSsize_t(x);
  21785. Py_DECREF(x);
  21786. return ival;
  21787. }
  21788. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  21789. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  21790. }
  21791. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  21792. return PyInt_FromSize_t(ival);
  21793. }
  21794. #endif /* Py_PYTHON_H */